From af38e75e2dfd0ddd5b685614bd9ec4aafd46306a Mon Sep 17 00:00:00 2001 From: ABird Date: Thu, 8 Oct 2026 21:49:37 +0800 Subject: [PATCH] refactor(api)!: drop the v1 version marker (#6447) --- .agents/skills/release/SKILL.md | 6 +- .github/workflows/proto-linter.yml | 20 + AGENTS.md | 19 +- core/README.md | 2 +- proto/api/CHANGELOG.md | 62 + proto/api/README.md | 32 + proto/api/ai_service.proto | 52 + proto/api/attachment_service.proto | 377 + proto/api/auth_service.proto | 130 + proto/api/common.proto | 33 + proto/api/{v1 => }/idp_service.proto | 127 +- proto/api/instance_service.proto | 532 ++ proto/api/memo_service.proto | 761 ++ proto/api/space_service.proto | 474 ++ proto/api/user_service.proto | 1387 +++ proto/api/v1/README.md | 3 - proto/api/v1/ai_service.proto | 46 - proto/api/v1/attachment_service.proto | 322 - proto/api/v1/auth_service.proto | 115 - proto/api/v1/common.proto | 23 - proto/api/v1/instance_service.proto | 431 - proto/api/v1/memo_service.proto | 677 -- proto/api/v1/space_service.proto | 400 - proto/api/v1/user_service.proto | 1238 --- proto/buf.gen.yaml | 2 +- proto/gen/api/{v1 => }/ai_service.pb.go | 196 +- proto/gen/api/{v1 => }/ai_service.pb.gw.go | 12 +- proto/gen/api/{v1 => }/ai_service_grpc.pb.go | 20 +- .../ai_service.connect.go | 46 +- .../attachment_service.connect.go | 258 +- .../auth_service.connect.go | 208 +- .../idp_service.connect.go | 124 +- .../instance_service.connect.go | 158 +- .../memo_service.connect.go | 672 +- .../space_service.connect.go | 696 +- .../api/apiconnect/user_service.connect.go | 1175 +++ .../gen/api/{v1 => }/attachment_service.pb.go | 2074 ++--- .../api/{v1 => }/attachment_service.pb.gw.go | 328 +- .../{v1 => }/attachment_service_grpc.pb.go | 226 +- proto/gen/api/{v1 => }/auth_service.pb.go | 524 +- proto/gen/api/{v1 => }/auth_service.pb.gw.go | 258 +- .../gen/api/{v1 => }/auth_service_grpc.pb.go | 214 +- proto/gen/api/{v1 => }/common.pb.go | 106 +- proto/gen/api/{v1 => }/idp_service.pb.go | 895 +- proto/gen/api/{v1 => }/idp_service.pb.gw.go | 36 +- proto/gen/api/{v1 => }/idp_service_grpc.pb.go | 36 +- proto/gen/api/{v1 => }/instance_service.pb.go | 1695 ++-- .../api/{v1 => }/instance_service.pb.gw.go | 68 +- .../api/{v1 => }/instance_service_grpc.pb.go | 54 +- proto/gen/api/{v1 => }/memo_service.pb.go | 2905 +++---- proto/gen/api/{v1 => }/memo_service.pb.gw.go | 844 +- .../gen/api/{v1 => }/memo_service_grpc.pb.go | 470 +- proto/gen/api/{v1 => }/space_service.pb.go | 1863 +++-- proto/gen/api/{v1 => }/space_service.pb.gw.go | 1398 ++-- .../gen/api/{v1 => }/space_service_grpc.pb.go | 734 +- proto/gen/api/{v1 => }/user_service.pb.go | 7406 +++++++++-------- proto/gen/api/{v1 => }/user_service.pb.gw.go | 2586 +++--- .../gen/api/{v1 => }/user_service_grpc.pb.go | 1128 +-- .../v1/apiv1connect/user_service.connect.go | 1129 --- proto/gen/openapi.yaml | 2291 ++--- scripts/release_smoke_test.sh | 18 +- server/api/{v1 => }/acl_config.go | 62 +- server/api/acl_config_test.go | 165 + server/api/{v1 => }/ai_service.go | 14 +- server/api/{v1/v1.go => api.go} | 76 +- server/api/api_test.go | 49 + .../{v1 => }/attachment_exif_sniff_test.go | 6 +- server/api/{v1 => }/attachment_exif_test.go | 2 +- .../api/{v1 => }/attachment_media_metadata.go | 20 +- .../attachment_media_metadata_test.go | 72 +- server/api/{v1 => }/attachment_mime_test.go | 2 +- server/api/{v1 => }/attachment_motion.go | 14 +- server/api/{v1 => }/attachment_service.go | 32 +- .../api/{v1 => }/attachment_service_image.go | 12 +- .../{v1 => }/attachment_service_storage.go | 14 +- .../attachment_service_storage_test.go | 2 +- server/api/{v1 => }/attachment_upload.go | 30 +- server/api/{v1 => }/attachment_upload_test.go | 96 +- .../attachment_upload_transport_test.go | 24 +- server/api/{v1 => }/auth_service.go | 20 +- .../{v1 => }/auth_service_client_info_test.go | 10 +- server/api/{v1 => }/auth_service_session.go | 26 +- .../auth_service_session_status_test.go | 2 +- server/api/{v1 => }/auth_service_sso.go | 14 +- server/api/{v1 => }/authz.go | 2 +- server/api/{v1 => }/authz_test.go | 16 +- server/api/{v1 => }/common.go | 22 +- server/api/{v1 => }/common_test.go | 2 +- server/api/{v1 => }/connect_handler.go | 28 +- server/api/{v1 => }/connect_handler_test.go | 2 +- server/api/{v1 => }/connect_interceptors.go | 2 +- .../api/{v1 => }/connect_interceptors_test.go | 2 +- server/api/{v1 => }/connect_services.go | 378 +- server/api/{v1 => }/filter_access.go | 8 +- server/api/{v1 => }/gateway_marshaler_test.go | 32 +- server/api/{v1 => }/gateway_route_resolver.go | 4 +- .../{v1 => }/gateway_route_resolver_test.go | 147 +- server/api/{v1 => }/header_carrier.go | 10 +- server/api/{v1 => }/health_service.go | 4 +- server/api/{v1 => }/idp_service.go | 38 +- server/api/{v1 => }/instance_service.go | 44 +- .../{v1 => }/instance_service_converters.go | 106 +- .../{v1 => }/instance_service_validation.go | 18 +- server/api/{v1 => }/instance_stats.go | 18 +- server/api/{v1 => }/instance_stats_test.go | 2 +- server/api/{v1 => }/link_metadata_test.go | 30 +- server/api/{v1 => }/memo_access.go | 20 +- .../api/{v1 => }/memo_attachment_service.go | 30 +- server/api/{v1 => }/memo_batch_helpers.go | 4 +- .../{v1 => }/memo_comment_relations_test.go | 16 +- server/api/{v1 => }/memo_create_helpers.go | 6 +- .../api/{v1 => }/memo_create_helpers_test.go | 72 +- .../api/{v1 => }/memo_delete_webhook_test.go | 34 +- server/api/{v1 => }/memo_mention_helpers.go | 16 +- server/api/{v1 => }/memo_relation_service.go | 34 +- server/api/{v1 => }/memo_service.go | 30 +- server/api/{v1 => }/memo_service_comments.go | 26 +- server/api/{v1 => }/memo_service_converter.go | 78 +- server/api/memo_service_filter.go | 1 + .../{v1 => }/memo_service_link_metadata.go | 18 +- server/api/{v1 => }/memo_service_query.go | 4 +- server/api/{v1 => }/memo_service_webhooks.go | 20 +- server/api/{v1 => }/memo_share_service.go | 20 +- server/api/{v1 => }/memo_update_helpers.go | 10 +- server/api/{v1 => }/memo_view_icon.go | 16 +- server/api/{v1 => }/notification_email.go | 6 +- server/api/{v1 => }/ratelimit.go | 20 +- server/api/{v1 => }/ratelimit_test.go | 2 +- server/api/{v1 => }/reaction_service.go | 20 +- .../{v1 => }/reaction_service_policy_test.go | 2 +- .../api/{v1 => }/request_body_limit_test.go | 14 +- server/api/{v1 => }/resource_name.go | 2 +- server/api/{v1 => }/resource_name_test.go | 2 +- server/api/{v1 => }/space_icon_test.go | 44 +- server/api/{v1 => }/space_service.go | 66 +- .../api/{v1 => }/space_service_converters.go | 44 +- .../{v1 => }/space_service_notifications.go | 34 +- server/api/{v1 => }/space_service_test.go | 252 +- server/api/{v1 => }/sse_handler.go | 4 +- server/api/{v1 => }/sse_hub.go | 2 +- server/api/{v1 => }/sse_hub_test.go | 2 +- server/api/{v1 => }/sse_service_test.go | 224 +- server/api/{v1 => }/sso_username.go | 2 +- server/api/{v1 => }/sso_username_test.go | 2 +- server/api/{v1 => }/test/ai_service_test.go | 44 +- .../test/attachment_service_s3_test.go | 38 +- .../{v1 => }/test/attachment_service_test.go | 302 +- .../test/auth_service_sso_username_test.go | 20 +- server/api/{v1 => }/test/auth_service_test.go | 74 +- server/api/{v1 => }/test/auth_test.go | 0 server/api/{v1 => }/test/authz_test.go | 26 +- .../test/configuration_provisioning_test.go | 44 +- server/api/{v1 => }/test/idp_service_test.go | 186 +- .../test/instance_admin_cache_test.go | 8 +- .../{v1 => }/test/instance_service_test.go | 312 +- .../api/{v1 => }/test/instance_stats_test.go | 10 +- .../test/memo_attachment_markdown_test.go | 104 +- .../test/memo_attachment_service_test.go | 148 +- server/api/{v1 => }/test/memo_export_test.go | 146 +- server/api/{v1 => }/test/memo_move_test.go | 50 +- .../test/memo_relation_service_test.go | 104 +- .../test/memo_service_benchmark_test.go | 24 +- server/api/{v1 => }/test/memo_service_test.go | 640 +- .../{v1 => }/test/memo_share_service_test.go | 120 +- .../api/{v1 => }/test/memo_timestamp_test.go | 34 +- .../api/{v1 => }/test/memo_view_icon_test.go | 38 +- .../{v1 => }/test/memo_view_service_test.go | 158 +- .../test/personal_access_token_test.go | 18 +- server/api/{v1 => }/test/ratelimit_test.go | 44 +- .../{v1 => }/test/reaction_service_test.go | 184 +- server/api/{v1 => }/test/sse_handler_test.go | 24 +- server/api/{v1 => }/test/test_helper.go | 10 +- .../test/user_email_visibility_test.go | 14 +- .../{v1 => }/test/user_notification_test.go | 227 +- .../{v1 => }/test/user_resource_name_test.go | 54 +- server/api/{v1 => }/test/user_search_test.go | 38 +- .../{v1 => }/test/user_service_delete_test.go | 100 +- .../test/user_service_email_username_test.go | 58 +- .../test/user_service_pagination_test.go | 14 +- .../test/user_service_password_test.go | 10 +- .../test/user_service_registration_test.go | 100 +- .../{v1 => }/test/user_service_stats_test.go | 139 +- .../test/user_service_unique_email_test.go | 32 +- server/api/{v1 => }/test/user_setting_test.go | 104 +- server/api/{v1 => }/upload_session.go | 4 +- server/api/{v1 => }/user_resource_name.go | 2 +- .../api/{v1 => }/user_resource_name_test.go | 2 +- server/api/{v1 => }/user_service.go | 100 +- .../{v1 => }/user_service_access_tokens.go | 30 +- .../api/{v1 => }/user_service_converters.go | 84 +- server/api/{v1 => }/user_service_filter.go | 2 +- .../api/{v1 => }/user_service_identities.go | 18 +- .../api/{v1 => }/user_service_memo_export.go | 8 +- .../api/{v1 => }/user_service_memo_import.go | 60 +- .../{v1 => }/user_service_memo_transfer.go | 28 +- .../api/{v1 => }/user_service_memo_views.go | 30 +- .../{v1 => }/user_service_notifications.go | 63 +- server/api/{v1 => }/user_service_settings.go | 46 +- server/api/{v1 => }/user_service_stats.go | 54 +- server/api/{v1 => }/user_service_webhooks.go | 26 +- server/api/{v1 => }/user_webhook_test.go | 24 +- server/api/v1/acl_config_test.go | 165 - server/api/v1/memo_service_filter.go | 1 - server/auth/token.go | 2 +- server/cors_test.go | 10 +- server/doc.go | 2 +- server/fileserver/fileserver_test.go | 186 +- server/frontend/frontend.go | 4 +- server/mcp/README.md | 6 +- server/mcp/adapter.go | 2 +- server/mcp/adapter_test.go | 64 +- server/mcp/catalog_test.go | 8 +- server/mcp/service.go | 4 +- server/mcp/service_test.go | 40 +- server/server.go | 18 +- server/test/ratelimit_test.go | 6 +- server/test/startup_test.go | 36 +- web/src/components/AppSidebar/AppSidebar.tsx | 2 +- .../components/AppSidebar/ViewsSection.tsx | 2 +- web/src/components/AttachmentIcon.tsx | 2 +- .../AttachmentLibrary/AttachmentFileRows.tsx | 2 +- .../AttachmentLibraryPrimitives.tsx | 2 +- .../AttachmentLibrary/AttachmentMediaGrid.tsx | 2 +- web/src/components/AuthPageLayout.tsx | 2 +- .../components/CalendarView/CalendarView.tsx | 2 +- web/src/components/CalendarView/dayModel.ts | 2 +- .../components/CalendarView/useMonthMemos.ts | 4 +- .../components/ChangeMemberPasswordDialog.tsx | 2 +- .../components/CreateAccessTokenDialog.tsx | 2 +- .../CreateIdentityProviderDialog.tsx | 2 +- web/src/components/CreateSpaceDialog.tsx | 2 +- web/src/components/CreateUserDialog.tsx | 2 +- .../components/IdentityProviderButtons.tsx | 2 +- .../components/Inbox/MemoCommentMessage.tsx | 2 +- .../components/Inbox/MemoMentionMessage.tsx | 2 +- .../Inbox/SpaceInvitationMessage.tsx | 6 +- web/src/components/MapView/MapCanvas.tsx | 2 +- web/src/components/MapView/MapView.tsx | 2 +- web/src/components/MapView/model.ts | 2 +- web/src/components/MapView/useMapMemos.ts | 2 +- web/src/components/MapView/useMapPins.ts | 2 +- .../MemoActionMenu/MemoActionMenu.tsx | 2 +- web/src/components/MemoActionMenu/hooks.ts | 4 +- .../memoShareImagePreviewModel.ts | 4 +- web/src/components/MemoActionMenu/types.ts | 2 +- web/src/components/MemoCommentSection.tsx | 4 +- .../MemoContent/MemoMarkdownRenderer.tsx | 2 +- .../MemoContent/MentionResolutionContext.tsx | 2 +- web/src/components/MemoContent/types.ts | 2 +- .../MemoDetailSidebar/MemoDetailSidebar.tsx | 4 +- .../MemoDetailSidebar/MemoSharePanel.tsx | 2 +- .../MemoEditor/Toolbar/AudienceMenu.tsx | 2 +- .../MemoEditor/Toolbar/EditorToolbar.tsx | 2 +- .../MemoEditor/Toolbar/InsertMenu.tsx | 2 +- .../hooks/useAttachmentTranscription.ts | 2 +- .../MemoEditor/hooks/useAutoSave.ts | 4 +- .../MemoEditor/hooks/useFileUpload.ts | 2 +- .../MemoEditor/hooks/useInlineImageUpload.ts | 2 +- .../MemoEditor/hooks/useLinkMemo.ts | 6 +- .../MemoEditor/hooks/useLocation.ts | 2 +- .../MemoEditor/hooks/useMemoInit.ts | 2 +- .../MemoEditor/hooks/useMemoSave.ts | 2 +- web/src/components/MemoEditor/index.tsx | 2 +- .../MemoEditor/services/cacheService.ts | 6 +- .../services/mediaMetadataService.ts | 2 +- .../MemoEditor/services/memoService.ts | 10 +- .../services/transcriptionService.ts | 6 +- .../MemoEditor/services/uploadService.ts | 4 +- web/src/components/MemoEditor/state/types.ts | 6 +- .../components/MemoEditor/types/attachment.ts | 4 +- .../components/MemoEditor/types/components.ts | 4 +- .../Attachment/AttachmentCard.tsx | 2 +- .../Attachment/AttachmentListEditor.tsx | 2 +- .../Attachment/AttachmentListView.tsx | 2 +- .../Attachment/attachmentHelpers.ts | 2 +- .../Location/LocationDisplayEditor.tsx | 2 +- .../Location/LocationDisplayView.tsx | 2 +- .../MemoMetadata/Location/locationHelpers.ts | 2 +- .../MemoMetadata/MemoMetadataRows.tsx | 4 +- .../MemoMetadata/Relation/LinkMemoDialog.tsx | 2 +- .../Relation/RelationListEditor.tsx | 2 +- .../MemoMetadata/Relation/RelationRow.tsx | 4 +- .../MemoMetadata/Relation/RelationRows.tsx | 2 +- .../MemoMetadata/Relation/relationHelpers.ts | 4 +- .../Relation/useResolvedRelationMemos.ts | 6 +- .../components/MemoPanel/MemoPanelList.tsx | 2 +- .../components/MemoPreview/MemoPreview.tsx | 6 +- .../MemoReactionListView.tsx | 4 +- .../MemoReactionListView/ReactionSelector.tsx | 2 +- .../MemoReactionListView/ReactionView.tsx | 6 +- .../components/MemoReactionListView/hooks.ts | 6 +- web/src/components/MemoView/MemoView.tsx | 2 +- .../components/MemoView/MemoViewContext.tsx | 6 +- .../components/MemoCommentListView.tsx | 2 +- .../MemoView/components/MemoHeader.tsx | 4 +- web/src/components/MemoView/types.ts | 2 +- web/src/components/MemoViewIcon.tsx | 2 +- .../PagedMemoList/PagedMemoList.tsx | 4 +- .../PagedMemoList/memoCardHeight.ts | 6 +- web/src/components/PasswordSignInForm.tsx | 2 +- web/src/components/Settings/AISection.tsx | 2 +- .../Settings/AccessTokenSection.tsx | 12 +- .../components/Settings/InstanceSection.tsx | 4 +- .../Settings/InviteSpaceMemberDialog.tsx | 2 +- .../Settings/LinkedIdentitySection.tsx | 18 +- web/src/components/Settings/MemberSection.tsx | 4 +- .../components/Settings/MemoExportSection.tsx | 18 +- .../Settings/MemoRelatedSettings.tsx | 2 +- .../Settings/NotificationSection.tsx | 2 +- .../Settings/PreferencesSection.tsx | 2 +- web/src/components/Settings/SSOSection.tsx | 2 +- web/src/components/Settings/SpacesSection.tsx | 4 +- .../components/Settings/StorageSection.tsx | 2 +- web/src/components/Settings/TagsSection.tsx | 2 +- .../components/Settings/WebhookSection.tsx | 2 +- .../components/Settings/settingSections.ts | 2 +- web/src/components/Settings/sso-display.ts | 2 +- .../Settings/useInstanceSettingUpdater.ts | 2 +- web/src/components/SpaceIcon.tsx | 2 +- web/src/components/SpaceIconPicker.tsx | 2 +- web/src/components/SpaceMark.tsx | 2 +- web/src/components/SpaceRoleBadge.tsx | 2 +- web/src/components/SpaceSelectItem.tsx | 2 +- .../UpdateCustomizedProfileDialog.tsx | 2 +- web/src/components/UserMenu.tsx | 2 +- web/src/components/VisibilityIcon.tsx | 2 +- web/src/connect.ts | 18 +- web/src/contexts/AppSidebarContext.tsx | 2 +- web/src/contexts/AuthContext.tsx | 4 +- web/src/contexts/InstanceContext.tsx | 12 +- web/src/contexts/SpaceContext.tsx | 2 +- web/src/hooks/useAttachmentLibrary.ts | 2 +- web/src/hooks/useAttachmentQueries.ts | 2 +- web/src/hooks/useFilteredMemoStats.ts | 12 +- web/src/hooks/useIdentityProviderQueries.ts | 2 +- web/src/hooks/useInstanceQueries.ts | 6 +- web/src/hooks/useLiveMemoRefresh.ts | 2 +- web/src/hooks/useMemoFilters.ts | 2 +- web/src/hooks/useMemoQueries.ts | 10 +- web/src/hooks/useMemoShareQueries.ts | 6 +- web/src/hooks/useMemoSorting.ts | 4 +- web/src/hooks/useSpaceQueries.ts | 2 +- web/src/hooks/useUserQueries.ts | 36 +- web/src/layouts/RootLayout.tsx | 2 +- web/src/lib/context-suggestions.ts | 2 +- web/src/lib/memo-export.ts | 8 +- web/src/lib/memo-suggestions.ts | 2 +- web/src/lib/resource-names.ts | 6 +- web/src/lib/tag.ts | 2 +- web/src/pages/Archived.tsx | 4 +- web/src/pages/Attachments.tsx | 2 +- web/src/pages/AuthCallback.tsx | 9 +- web/src/pages/Home.tsx | 4 +- web/src/pages/Inboxes.tsx | 2 +- web/src/pages/MemoDetail.tsx | 6 +- web/src/pages/MemoViews.tsx | 2 +- web/src/pages/Setting.tsx | 2 +- web/src/pages/SignUp.tsx | 4 +- web/src/types/proto/api/ai_service_pb.ts | 130 + .../types/proto/api/attachment_service_pb.ts | 884 ++ web/src/types/proto/api/auth_service_pb.ts | 320 + web/src/types/proto/api/common_pb.ts | 107 + web/src/types/proto/api/idp_service_pb.ts | 435 + .../types/proto/api/instance_service_pb.ts | 1408 ++++ web/src/types/proto/api/memo_service_pb.ts | 1579 ++++ web/src/types/proto/api/space_service_pb.ts | 964 +++ web/src/types/proto/api/user_service_pb.ts | 3022 +++++++ web/src/types/proto/api/v1/ai_service_pb.ts | 119 - .../proto/api/v1/attachment_service_pb.ts | 809 -- web/src/types/proto/api/v1/auth_service_pb.ts | 300 - web/src/types/proto/api/v1/common_pb.ts | 90 - web/src/types/proto/api/v1/idp_service_pb.ts | 377 - .../types/proto/api/v1/instance_service_pb.ts | 1306 --- web/src/types/proto/api/v1/memo_service_pb.ts | 1469 ---- .../types/proto/api/v1/space_service_pb.ts | 859 -- web/src/types/proto/api/v1/user_service_pb.ts | 2794 ------- web/src/utils/attachment.ts | 2 +- web/src/utils/managed-attachment.ts | 2 +- web/src/utils/media-item.ts | 2 +- web/src/utils/media-metadata.ts | 2 +- web/src/utils/memo.ts | 2 +- web/src/utils/user.ts | 2 +- .../attachment-inline-placement.test.tsx | 2 +- .../attachment-library-source-link.test.tsx | 4 +- web/tests/attachment-library-stats.test.ts | 2 +- .../attachment-transcription-action.test.tsx | 2 +- web/tests/attachment-urls.test.ts | 2 +- web/tests/audience-menu.test.tsx | 2 +- .../auth-context-initialization.test.tsx | 6 +- web/tests/auth-page-layout.test.tsx | 2 +- web/tests/calendar-day-model.test.ts | 4 +- web/tests/calendar-day-snapshot.test.tsx | 2 +- web/tests/can-manage-memo.test.ts | 2 +- web/tests/editor-suggestions.test.tsx | 2 +- web/tests/error-info.test.ts | 4 +- web/tests/filtered-memo-stats.test.ts | 6 +- web/tests/hoist-new-memo.test.ts | 2 +- web/tests/inline-image-upload-files.test.ts | 2 +- web/tests/instance-access-query.test.tsx | 4 +- web/tests/instance-section-access.test.tsx | 2 +- web/tests/invite-space-member-dialog.test.tsx | 10 +- web/tests/location-display-view.test.tsx | 2 +- web/tests/managed-attachment.test.ts | 2 +- web/tests/map-canvas.test.tsx | 2 +- web/tests/map-memos.test.tsx | 2 +- web/tests/map-model.test.ts | 2 +- web/tests/map-view.test.tsx | 2 +- web/tests/media-item-preview-metadata.test.ts | 2 +- web/tests/media-metadata-display.test.ts | 2 +- web/tests/memo-access-transitions.test.tsx | 2 +- web/tests/memo-action-menu.test.tsx | 4 +- web/tests/memo-action-navigation.test.tsx | 4 +- web/tests/memo-card-height.test.ts | 8 +- web/tests/memo-comment-section.test.tsx | 4 +- web/tests/memo-comments-pagination.test.tsx | 8 +- web/tests/memo-detail-access.test.tsx | 4 +- web/tests/memo-detail-sidebar.test.tsx | 16 +- web/tests/memo-editor-cache.test.ts | 4 +- web/tests/memo-editor-relations.test.ts | 12 +- web/tests/memo-editor-space-move.test.ts | 2 +- web/tests/memo-editor-timestamps.test.tsx | 2 +- web/tests/memo-editor-transcription.test.tsx | 4 +- web/tests/memo-export.test.ts | 2 +- web/tests/memo-panel-list.test.tsx | 2 +- web/tests/memo-related-settings.test.tsx | 6 +- web/tests/memo-share-image.test.ts | 4 +- web/tests/memo-view-icons.test.tsx | 2 +- web/tests/memo-views.test.ts | 2 +- web/tests/paged-memo-list.test.tsx | 2 +- web/tests/preview-image-dialog.test.tsx | 2 +- web/tests/query-deduplication.test.tsx | 6 +- web/tests/reaction-selector.test.tsx | 2 +- web/tests/space-icon-picker.test.tsx | 2 +- web/tests/space-invitation-message.test.tsx | 40 +- web/tests/space-queries.test.tsx | 2 +- web/tests/spaces-section.test.tsx | 18 +- web/tests/tag.test.ts | 8 +- web/tests/transcription-service.test.ts | 2 +- web/tests/upload-media-metadata.test.ts | 2 +- web/tests/upload-service.test.ts | 2 +- .../use-attachment-transcription.test.tsx | 2 +- web/tests/use-auto-save.test.tsx | 4 +- web/tests/use-inline-image-upload.test.tsx | 2 +- web/tests/use-memo-init.test.tsx | 4 +- web/tests/user-stats-filter-queries.test.tsx | 8 +- web/tests/visibility-space.test.tsx | 2 +- web/vite.config.mts | 4 +- 447 files changed, 34260 insertions(+), 31472 deletions(-) create mode 100644 proto/api/CHANGELOG.md create mode 100644 proto/api/README.md create mode 100644 proto/api/ai_service.proto create mode 100644 proto/api/attachment_service.proto create mode 100644 proto/api/auth_service.proto create mode 100644 proto/api/common.proto rename proto/api/{v1 => }/idp_service.proto (51%) create mode 100644 proto/api/instance_service.proto create mode 100644 proto/api/memo_service.proto create mode 100644 proto/api/space_service.proto create mode 100644 proto/api/user_service.proto delete mode 100644 proto/api/v1/README.md delete mode 100644 proto/api/v1/ai_service.proto delete mode 100644 proto/api/v1/attachment_service.proto delete mode 100644 proto/api/v1/auth_service.proto delete mode 100644 proto/api/v1/common.proto delete mode 100644 proto/api/v1/instance_service.proto delete mode 100644 proto/api/v1/memo_service.proto delete mode 100644 proto/api/v1/space_service.proto delete mode 100644 proto/api/v1/user_service.proto rename proto/gen/api/{v1 => }/ai_service.pb.go (62%) rename proto/gen/api/{v1 => }/ai_service.pb.gw.go (94%) rename proto/gen/api/{v1 => }/ai_service_grpc.pb.go (85%) rename proto/gen/api/{v1/apiv1connect => apiconnect}/ai_service.connect.go (63%) rename proto/gen/api/{v1/apiv1connect => apiconnect}/attachment_service.connect.go (53%) rename proto/gen/api/{v1/apiv1connect => apiconnect}/auth_service.connect.go (51%) rename proto/gen/api/{v1/apiv1connect => apiconnect}/idp_service.connect.go (57%) rename proto/gen/api/{v1/apiv1connect => apiconnect}/instance_service.connect.go (52%) rename proto/gen/api/{v1/apiv1connect => apiconnect}/memo_service.connect.go (51%) rename proto/gen/api/{v1/apiv1connect => apiconnect}/space_service.connect.go (50%) create mode 100644 proto/gen/api/apiconnect/user_service.connect.go rename proto/gen/api/{v1 => }/attachment_service.pb.go (58%) rename proto/gen/api/{v1 => }/attachment_service.pb.gw.go (92%) rename proto/gen/api/{v1 => }/attachment_service_grpc.pb.go (87%) rename proto/gen/api/{v1 => }/auth_service.pb.go (52%) rename proto/gen/api/{v1 => }/auth_service.pb.gw.go (92%) rename proto/gen/api/{v1 => }/auth_service_grpc.pb.go (78%) rename proto/gen/api/{v1 => }/common.pb.go (57%) rename proto/gen/api/{v1 => }/idp_service.pb.go (57%) rename proto/gen/api/{v1 => }/idp_service.pb.gw.go (92%) rename proto/gen/api/{v1 => }/idp_service_grpc.pb.go (88%) rename proto/gen/api/{v1 => }/instance_service.pb.go (59%) rename proto/gen/api/{v1 => }/instance_service.pb.gw.go (89%) rename proto/gen/api/{v1 => }/instance_service_grpc.pb.go (84%) rename proto/gen/api/{v1 => }/memo_service.pb.go (56%) rename proto/gen/api/{v1 => }/memo_service.pb.gw.go (89%) rename proto/gen/api/{v1 => }/memo_service_grpc.pb.go (85%) rename proto/gen/api/{v1 => }/space_service.pb.go (55%) rename proto/gen/api/{v1 => }/space_service.pb.gw.go (92%) rename proto/gen/api/{v1 => }/space_service_grpc.pb.go (88%) rename proto/gen/api/{v1 => }/user_service.pb.go (58%) rename proto/gen/api/{v1 => }/user_service.pb.gw.go (90%) rename proto/gen/api/{v1 => }/user_service_grpc.pb.go (84%) delete mode 100644 proto/gen/api/v1/apiv1connect/user_service.connect.go rename server/api/{v1 => }/acl_config.go (54%) create mode 100644 server/api/acl_config_test.go rename server/api/{v1 => }/ai_service.go (94%) rename server/api/{v1/v1.go => api.go} (79%) create mode 100644 server/api/api_test.go rename server/api/{v1 => }/attachment_exif_sniff_test.go (93%) rename server/api/{v1 => }/attachment_exif_test.go (99%) rename server/api/{v1 => }/attachment_media_metadata.go (92%) rename server/api/{v1 => }/attachment_media_metadata_test.go (53%) rename server/api/{v1 => }/attachment_mime_test.go (98%) rename server/api/{v1 => }/attachment_motion.go (80%) rename server/api/{v1 => }/attachment_service.go (92%) rename server/api/{v1 => }/attachment_service_image.go (90%) rename server/api/{v1 => }/attachment_service_storage.go (95%) rename server/api/{v1 => }/attachment_service_storage_test.go (98%) rename server/api/{v1 => }/attachment_upload.go (83%) rename server/api/{v1 => }/attachment_upload_test.go (69%) rename server/api/{v1 => }/attachment_upload_transport_test.go (76%) rename server/api/{v1 => }/auth_service.go (89%) rename server/api/{v1 => }/auth_service_client_info_test.go (98%) rename server/api/{v1 => }/auth_service_session.go (94%) rename server/api/{v1 => }/auth_service_session_status_test.go (98%) rename server/api/{v1 => }/auth_service_sso.go (93%) rename server/api/{v1 => }/authz.go (99%) rename server/api/{v1 => }/authz_test.go (87%) rename server/api/{v1 => }/common.go (70%) rename server/api/{v1 => }/common_test.go (98%) rename server/api/{v1 => }/connect_handler.go (75%) rename server/api/{v1 => }/connect_handler_test.go (98%) rename server/api/{v1 => }/connect_interceptors.go (99%) rename server/api/{v1 => }/connect_interceptors_test.go (99%) rename server/api/{v1 => }/connect_services.go (50%) rename server/api/{v1 => }/filter_access.go (91%) rename server/api/{v1 => }/gateway_marshaler_test.go (86%) rename server/api/{v1 => }/gateway_route_resolver.go (99%) rename server/api/{v1 => }/gateway_route_resolver_test.go (54%) rename server/api/{v1 => }/header_carrier.go (93%) rename server/api/{v1 => }/health_service.go (92%) rename server/api/{v1 => }/idp_service.go (84%) rename server/api/{v1 => }/instance_service.go (87%) rename server/api/{v1 => }/instance_service_converters.go (76%) rename server/api/{v1 => }/instance_service_validation.go (90%) rename server/api/{v1 => }/instance_stats.go (87%) rename server/api/{v1 => }/instance_stats_test.go (98%) rename server/api/{v1 => }/link_metadata_test.go (81%) rename server/api/{v1 => }/memo_access.go (86%) rename server/api/{v1 => }/memo_attachment_service.go (94%) rename server/api/{v1 => }/memo_batch_helpers.go (84%) rename server/api/{v1 => }/memo_comment_relations_test.go (72%) rename server/api/{v1 => }/memo_create_helpers.go (93%) rename server/api/{v1 => }/memo_create_helpers_test.go (62%) rename server/api/{v1 => }/memo_delete_webhook_test.go (76%) rename server/api/{v1 => }/memo_mention_helpers.go (79%) rename server/api/{v1 => }/memo_relation_service.go (83%) rename server/api/{v1 => }/memo_service.go (95%) rename server/api/{v1 => }/memo_service_comments.go (91%) rename server/api/{v1 => }/memo_service_converter.go (80%) create mode 100644 server/api/memo_service_filter.go rename server/api/{v1 => }/memo_service_link_metadata.go (73%) rename server/api/{v1 => }/memo_service_query.go (94%) rename server/api/{v1 => }/memo_service_webhooks.go (86%) rename server/api/{v1 => }/memo_share_service.go (91%) rename server/api/{v1 => }/memo_update_helpers.go (84%) rename server/api/{v1 => }/memo_view_icon.go (65%) rename server/api/{v1 => }/notification_email.go (73%) rename server/api/{v1 => }/ratelimit.go (92%) rename server/api/{v1 => }/ratelimit_test.go (99%) rename server/api/{v1 => }/reaction_service.go (87%) rename server/api/{v1 => }/reaction_service_policy_test.go (99%) rename server/api/{v1 => }/request_body_limit_test.go (75%) rename server/api/{v1 => }/resource_name.go (99%) rename server/api/{v1 => }/resource_name_test.go (99%) rename server/api/{v1 => }/space_icon_test.go (59%) rename server/api/{v1 => }/space_service.go (88%) rename server/api/{v1 => }/space_service_converters.go (71%) rename server/api/{v1 => }/space_service_notifications.go (79%) rename server/api/{v1 => }/space_service_test.go (67%) rename server/api/{v1 => }/sse_handler.go (98%) rename server/api/{v1 => }/sse_hub.go (99%) rename server/api/{v1 => }/sse_hub_test.go (99%) rename server/api/{v1 => }/sse_service_test.go (72%) rename server/api/{v1 => }/sso_username.go (98%) rename server/api/{v1 => }/sso_username_test.go (97%) rename server/api/{v1 => }/test/ai_service_test.go (84%) rename server/api/{v1 => }/test/attachment_service_s3_test.go (86%) rename server/api/{v1 => }/test/attachment_service_test.go (74%) rename server/api/{v1 => }/test/auth_service_sso_username_test.go (95%) rename server/api/{v1 => }/test/auth_service_test.go (72%) rename server/api/{v1 => }/test/auth_test.go (100%) rename server/api/{v1 => }/test/authz_test.go (82%) rename server/api/{v1 => }/test/configuration_provisioning_test.go (70%) rename server/api/{v1 => }/test/idp_service_test.go (75%) rename server/api/{v1 => }/test/instance_admin_cache_test.go (80%) rename server/api/{v1 => }/test/instance_service_test.go (73%) rename server/api/{v1 => }/test/instance_stats_test.go (82%) rename server/api/{v1 => }/test/memo_attachment_markdown_test.go (75%) rename server/api/{v1 => }/test/memo_attachment_service_test.go (72%) rename server/api/{v1 => }/test/memo_export_test.go (80%) rename server/api/{v1 => }/test/memo_move_test.go (67%) rename server/api/{v1 => }/test/memo_relation_service_test.go (63%) rename server/api/{v1 => }/test/memo_service_benchmark_test.go (90%) rename server/api/{v1 => }/test/memo_service_test.go (65%) rename server/api/{v1 => }/test/memo_share_service_test.go (75%) rename server/api/{v1 => }/test/memo_timestamp_test.go (79%) rename server/api/{v1 => }/test/memo_view_icon_test.go (67%) rename server/api/{v1 => }/test/memo_view_service_test.go (87%) rename server/api/{v1 => }/test/personal_access_token_test.go (63%) rename server/api/{v1 => }/test/ratelimit_test.go (90%) rename server/api/{v1 => }/test/reaction_service_test.go (73%) rename server/api/{v1 => }/test/sse_handler_test.go (86%) rename server/api/{v1 => }/test/test_helper.go (95%) rename server/api/{v1 => }/test/user_email_visibility_test.go (86%) rename server/api/{v1 => }/test/user_notification_test.go (75%) rename server/api/{v1 => }/test/user_resource_name_test.go (73%) rename server/api/{v1 => }/test/user_search_test.go (58%) rename server/api/{v1 => }/test/user_service_delete_test.go (88%) rename server/api/{v1 => }/test/user_service_email_username_test.go (81%) rename server/api/{v1 => }/test/user_service_pagination_test.go (87%) rename server/api/{v1 => }/test/user_service_password_test.go (92%) rename server/api/{v1 => }/test/user_service_registration_test.go (80%) rename server/api/{v1 => }/test/user_service_stats_test.go (72%) rename server/api/{v1 => }/test/user_service_unique_email_test.go (85%) rename server/api/{v1 => }/test/user_setting_test.go (67%) rename server/api/{v1 => }/upload_session.go (99%) rename server/api/{v1 => }/user_resource_name.go (99%) rename server/api/{v1 => }/user_resource_name_test.go (99%) rename server/api/{v1 => }/user_service.go (85%) rename server/api/{v1 => }/user_service_access_tokens.go (81%) rename server/api/{v1 => }/user_service_converters.go (75%) rename server/api/{v1 => }/user_service_filter.go (99%) rename server/api/{v1 => }/user_service_identities.go (84%) rename server/api/{v1 => }/user_service_memo_export.go (95%) rename server/api/{v1 => }/user_service_memo_import.go (90%) rename server/api/{v1 => }/user_service_memo_transfer.go (81%) rename server/api/{v1 => }/user_service_memo_views.go (87%) rename server/api/{v1 => }/user_service_notifications.go (83%) rename server/api/{v1 => }/user_service_settings.go (83%) rename server/api/{v1 => }/user_service_stats.go (81%) rename server/api/{v1 => }/user_service_webhooks.go (89%) rename server/api/{v1 => }/user_webhook_test.go (76%) delete mode 100644 server/api/v1/acl_config_test.go delete mode 100644 server/api/v1/memo_service_filter.go create mode 100644 web/src/types/proto/api/ai_service_pb.ts create mode 100644 web/src/types/proto/api/attachment_service_pb.ts create mode 100644 web/src/types/proto/api/auth_service_pb.ts create mode 100644 web/src/types/proto/api/common_pb.ts create mode 100644 web/src/types/proto/api/idp_service_pb.ts create mode 100644 web/src/types/proto/api/instance_service_pb.ts create mode 100644 web/src/types/proto/api/memo_service_pb.ts create mode 100644 web/src/types/proto/api/space_service_pb.ts create mode 100644 web/src/types/proto/api/user_service_pb.ts delete mode 100644 web/src/types/proto/api/v1/ai_service_pb.ts delete mode 100644 web/src/types/proto/api/v1/attachment_service_pb.ts delete mode 100644 web/src/types/proto/api/v1/auth_service_pb.ts delete mode 100644 web/src/types/proto/api/v1/common_pb.ts delete mode 100644 web/src/types/proto/api/v1/idp_service_pb.ts delete mode 100644 web/src/types/proto/api/v1/instance_service_pb.ts delete mode 100644 web/src/types/proto/api/v1/memo_service_pb.ts delete mode 100644 web/src/types/proto/api/v1/space_service_pb.ts delete mode 100644 web/src/types/proto/api/v1/user_service_pb.ts diff --git a/.agents/skills/release/SKILL.md b/.agents/skills/release/SKILL.md index e5649b253..f189498c3 100644 --- a/.agents/skills/release/SKILL.md +++ b/.agents/skills/release/SKILL.md @@ -72,7 +72,8 @@ All must pass before you propose the tag: Write notes for the range from the last stable tag to the candidate, following [release-notes.md](references/release-notes.md). Read the commits, the merged PRs (`gh pr view`), and the diff for migrations, proto changes, configuration flags, and removed -behavior. Save the draft in a temporary directory outside the repo. +behavior. Carry the `## Unreleased` entries of `proto/api/CHANGELOG.md` into the notes as breaking API changes. Save the +draft in a temporary directory outside the repo. ## 5. Propose, Then Tag @@ -125,4 +126,5 @@ that links resolve to the right PRs and commits. Give the release URL, tag, SHA, image tags and digest, verification results, any reruns and why, and anything not done. Out of scope for this skill: announcements, website or docs updates, and the demo deploy (`demo-deploy.yml`, manual dispatch). List -them as follow-ups for the user rather than doing them. +them as follow-ups for the user rather than doing them. If `proto/api/CHANGELOG.md` has `## Unreleased` entries, list +renaming that heading to the tag as a follow-up too. diff --git a/.github/workflows/proto-linter.yml b/.github/workflows/proto-linter.yml index a6422349c..d13e7d026 100644 --- a/.github/workflows/proto-linter.yml +++ b/.github/workflows/proto-linter.yml @@ -38,3 +38,23 @@ jobs: echo "❌ Proto files are not formatted. Run 'buf format -w' to fix." exit 1 fi + + # A breaking change to the public API is allowed only when the same change + # records it in proto/api/CHANGELOG.md. + - name: Check breaking API changes + working-directory: proto + env: + BASE_SHA: ${{ github.event.pull_request.base.sha || github.event.before }} + run: | + if [[ -z "$BASE_SHA" || "$BASE_SHA" =~ ^0+$ ]] || ! git cat-file -e "$BASE_SHA^{commit}" 2>/dev/null; then + echo "No comparable base commit; skipping." + exit 0 + fi + if buf breaking --against "../.git#ref=$BASE_SHA,subdir=proto" --path api; then + exit 0 + fi + if git diff --quiet "$BASE_SHA" HEAD -- api/CHANGELOG.md; then + echo "❌ Breaking API change. Record it in proto/api/CHANGELOG.md, or make the change compatible." + exit 1 + fi + echo "::warning::Breaking API change recorded in proto/api/CHANGELOG.md." diff --git a/AGENTS.md b/AGENTS.md index d9744e924..a5bb00880 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -18,7 +18,7 @@ Memos is a self-hosted note-taking app. - Keep diffs scoped. Do not do repo-wide cleanup, dependency churn, or generated-file rewrites unless the task requires it. - Do not hand-edit generated proto outputs. Change `.proto` files, then run `buf generate`. - Add migrations for all database drivers when schema changes, and update each driver's `LATEST.sql`. -- Add public API endpoints to `server/api/v1/acl_config.go`. +- Add public API endpoints to `server/api/acl_config.go`. - Ask before adding heavy dependencies, changing auth/token behavior, or altering Docker/release workflows. ## Documentation @@ -67,7 +67,7 @@ Every root folder is named for what it holds. Read the folder's `doc.go` or `REA | --- | --- | --- | | `cmd/memos/` | Cobra/Viper CLI setup and server startup | anything | | `server/` | The HTTP process: Echo bootstrap, graceful shutdown, every transport | core, store, provider, markdown, filter, internal | -| `server/api/v1/` | Connect/gRPC-Gateway services, ACL config, SSE hub. Thin handlers; rules go to `core/` | | +| `server/api/` | Connect/gRPC-Gateway services, ACL config, SSE hub. Thin handlers; rules go to `core/` | | | `server/fileserver/` | Native HTTP file serving, thumbnails, range requests | | | `server/frontend/` | Static SPA serving; `dist/` is the built SPA baked in by `go:embed` | | | `server/mcp/` | Model Context Protocol server | | @@ -78,7 +78,7 @@ Every root folder is named for what it holds. Read the folder's `doc.go` or `REA | `filter/` | CEL filter compiler: parse to IR, render to SQL per driver, filterable field schema | internal | | `provider/` | Backends configured by instance settings: `ai`, `idp`, `storage` | proto/gen, internal | | `internal/` | Private plumbing with no memos vocabulary (`identifier`, `email`, `webhook`, `ratelimit`, …) | third party only | -| `proto/api/v1/`, `proto/store/` | Public API and internal storage proto sources; `proto/gen/` is generated | | +| `proto/api/`, `proto/store/` | Public API and internal storage proto sources; `proto/gen/` is generated | | | `web/src/` | React SPA: `connect.ts` clients, `auth-state.ts`, `hooks/`, `contexts/`, `components/`, `themes/` | | Layering rules, enforced by `depguard` in `.golangci.yaml`: @@ -87,11 +87,11 @@ Layering rules, enforced by `depguard` in `.golangci.yaml`: - `internal/` packages import nothing from this module (except `internal/testutil`, which may import `proto/gen`). - A package goes in `internal/` only if it could be published as a standalone module unchanged. If it knows what a Memo, Space, or instance setting is, it is a root package. - Never create `util`, `common`, `base`, `helpers`, `misc`, or `pkg` packages. Name a package for the one thing it does, or put the code next to its only caller. -- New business rules extracted from `server/api/v1` go to `core//`, one package per resource. +- New business rules extracted from `server/api` go to `core//`, one package per resource. -File convention inside `server/api/v1/`: `_service.go` holds the RPC handlers, `_service_converters.go` the +File convention inside `server/api/`: `_service.go` holds the RPC handlers, `_service_converters.go` the store↔proto conversion, and `_service_.go` further splits. Extend the matching file; do not add `*_helpers2.go`. -Black-box service tests live in `server/api/v1/test/`, unit tests next to the code. +Black-box service tests live in `server/api/test/`, unit tests next to the code. ## Change Routing @@ -103,8 +103,8 @@ Black-box service tests live in `server/api/v1/test/`, unit tests next to the co | Internal package logic | Relevant `internal/` package tests | `go test -v -race ./internal/...` | | Frontend behavior | Components/hooks/contexts under `web/src/` | `cd web && pnpm lint && pnpm test` | | Frontend production output | Vite config or release-sensitive UI | `cd web && pnpm build` or `pnpm release` | -| Proto API | `.proto` source plus generated outputs | `cd proto && buf generate && buf lint` | -| Public unauthenticated route | `server/api/v1/acl_config.go` | Targeted server test or manual route check | +| Proto API | `.proto` source, generated outputs, `proto/api/CHANGELOG.md` for breaks | `cd proto && buf generate && buf lint` | +| Public unauthenticated route | `server/api/acl_config.go` | Targeted server test or manual route check | ## Go Conventions @@ -127,7 +127,8 @@ Black-box service tests live in `server/api/v1/test/`, unit tests next to the co - Schema changes require SQLite, MySQL, and PostgreSQL migrations plus `LATEST.sql` updates. - Fresh-install SQL and incremental migrations must stay equivalent. -- Proto field changes must preserve compatibility unless the task explicitly allows a breaking API change. +- Proto field changes must preserve compatibility unless the task explicitly allows a breaking API change. Record every + allowed break in `proto/api/CHANGELOG.md`; CI fails a `buf breaking` failure without an edit there. - Regenerate after proto edits and include both Go/OpenAPI and TypeScript generated outputs. ## Verification Policy diff --git a/core/README.md b/core/README.md index 0e76bcf48..38d8b2917 100644 --- a/core/README.md +++ b/core/README.md @@ -13,5 +13,5 @@ apply the same way. Layering: `core` may import `store`, `provider`, `markdown`, `filter`, `proto/gen`, and `internal`. It must not import `server` or `cmd`. New -resource-specific rules extracted from `server/api/v1` belong here, one package +resource-specific rules extracted from `server/api` belong here, one package per resource. diff --git a/proto/api/CHANGELOG.md b/proto/api/CHANGELOG.md new file mode 100644 index 000000000..6d4e9fc5a --- /dev/null +++ b/proto/api/CHANGELOG.md @@ -0,0 +1,62 @@ +# API Changelog + +Breaking and deprecated changes to the public API in `proto/api/`, newest release first. Additive changes are not listed. + +The Proto Linter workflow runs `buf breaking` against the base commit and fails when a schema break lands without an edit to +this file. It cannot see REST route changes in `google.api.http` annotations or behavior changes with an unchanged schema; +record those by hand. + +Add entries under a `## Unreleased` heading. After the release ships, rename it to the release tag. + +```markdown +## Unreleased + +### Breaking + +- `MemoService.ListShortcuts`: removed. Use `UserService.ListMemoViews`. + +### Deprecated + +- `Memo.unassigned`: use an unset `Memo.space`. Removed in a later release. +``` + +## Unreleased + +### Breaking + +- The API no longer carries a `v1` version marker. Every client must update its paths: + - REST routes move from `/api/v1/...` to `/api/...` (for example `GET /api/memos`). Server-sent events move from + `/api/v1/sse` to `/api/sse`. + - The proto package `memos.api.v1` is now `memos.api`, so Connect and gRPC procedures move from + `/memos.api.v1./` to `/memos.api./`. + - Resource types move from `memos.api.v1/` to `memos.api/`. + - The `domain` of `google.rpc.ErrorInfo` details is now `memos.api`. + - For this release only, requests to `/api/v1/...` and `/memos.api.v1.*` return `410 Gone` with an `UNIMPLEMENTED` + error that points here. The next release removes these routes. +- Field numbers in every message are renumbered from 1 in declaration order, and all `reserved` ranges are removed. + JSON field names are unchanged; clients that use the binary protobuf encoding must regenerate from the new schema. +- Names now follow AIP conventions: + - `MemoService`: `ListMemoAttachments`, `ListMemoRelations`, `ListMemoComments`, `CreateMemoComment`, + `ListMemoReactions`, and `UpsertMemoReaction` take `parent` instead of `name` (REST path variable + `{parent=memos/*}`). `ListMemoCommentsResponse.memos` is now `comments`. The nested `MemoRelation.Memo` type is + now `MemoRelation.MemoRef`. The `MemoShare` resource singular/plural is now `memoShare`/`memoShares`. + - `UserService.ListAllUserStats` is now `ListUserStats`. It requires a `parent`: `users/-` for all users (REST + `GET /api/users/-/stats` instead of `GET /api/users:stats`) or `users/{user}` for one user. The response field + `stats` is now `user_stats`. + - `BatchGetUsersRequest.usernames` is now `names` and takes resource names (`users/{user}`), not bare usernames. + - `PersonalAccessToken.created_at`, `expires_at`, and `last_used_at` are now `create_time`, `expire_time`, and + `last_use_time`. + - `LinkedIdentity.idp_name` and `extern_uid` are now `identity_provider` and `external_uid`; + `CreateLinkedIdentityRequest.idp_name` is now `identity_provider`. + - The `MemoView` and `UserNotification` resource singulars are now `memoView` and `userNotification`. + - `UserStats.tag_count` is now `tag_counts`. + - `MemoImportPlan`, `MemoImportReport`, and `MemoImportIssue` are now `ImportMemosPlan`, `ImportMemosReport`, and + `ImportMemosIssue`. `ImportMemosPlan.memos` and `attachments` are now `memo_count` and `attachment_count`; + `ImportMemosIssue.memo` is now `memo_uid`. + - `UserNotification.SpaceInvitationPayload.State` is now `InvitationState`. + - `UpdateUserSettingRequest.setting` and `ListUserSettingsResponse.settings` are now `user_setting` and + `user_settings`; `UpdateInstanceSettingRequest.setting` and `BatchGetInstanceSettingsResponse.settings` are now + `instance_setting` and `instance_settings`. + - `SignInResponse.access_token_expires_at` and `RefreshTokenResponse.expires_at` are both now + `access_token_expire_time`. + - `SignInRequest.SSOCredentials` is now `SsoCredentials`, and its `idp_name` is now `identity_provider`. diff --git a/proto/api/README.md b/proto/api/README.md new file mode 100644 index 000000000..5d79743bc --- /dev/null +++ b/proto/api/README.md @@ -0,0 +1,32 @@ +# Memos API Design + +This API design should follow the guidelines and best practices outlined in the [Google API Improvement Proposals (AIPs)](https://google.aip.dev/). + +The package is `memos.api`. It carries no version marker; breaking changes are recorded in [CHANGELOG.md](CHANGELOG.md). + +## File Layout + +1. The service, then shared top-level types used by more than one group. +2. One block per resource group, in service order: the resource message, then the group's request/response messages in + RPC order, then helper messages used only by that group. + +Within a group, order RPCs `List`, `Get`, `BatchGet`, `Create`, `Update`, `Delete`, `BatchDelete`, then custom methods. + +## Messages + +- Resources: `name` first, timestamps (`create_time`, `update_time`, others) last. +- Requests: `parent` or `name`, the payload, `update_mask`, then `page_size`, `page_token`, `filter`, `order_by`, and + other options. +- Responses: items, then `next_page_token`. +- Fields first, then nested enums, then nested messages. +- Number fields 1..N in declaration order. A new field takes the next number; never reuse or renumber a released field + outside a recorded breaking change. +- `google.api.resource` lists `type`, `pattern`, `singular`, `plural`; omit `name_field: "name"`. + +## Comments + +- Every service, RPC, message, enum and field has a comment. RPC comments start with the RPC name. +- Fields with `google.api.field_behavior` start with the matching prefix: `Identifier.`, `Required.`, `Optional.`, + `Output only.`, or `Input only.`. Fields without the annotation get no prefix. +- Resource-name fields end with a `Format: memos/{memo}` line. +- Describe what the server does, not what it might do. diff --git a/proto/api/ai_service.proto b/proto/api/ai_service.proto new file mode 100644 index 000000000..ec6d38c74 --- /dev/null +++ b/proto/api/ai_service.proto @@ -0,0 +1,52 @@ +syntax = "proto3"; + +package memos.api; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; + +option go_package = "gen/api"; + +// AIService runs AI tasks through the AI providers configured on the instance. +service AIService { + // Transcribe transcribes an audio file with the instance's configured + // transcription provider. The caller must be signed in, and requests are rate limited per user. + rpc Transcribe(TranscribeRequest) returns (TranscribeResponse) { + option (google.api.http) = { + post: "/api/ai:transcribe" + body: "*" + }; + option (google.api.method_signature) = "audio"; + } +} + +// Request message for AIService.Transcribe. +message TranscribeRequest { + // Required. The audio to transcribe. + TranscriptionAudio audio = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// Response message for AIService.Transcribe. +message TranscribeResponse { + // The transcribed text. + string text = 1; +} + +// TranscriptionAudio is the audio input for a transcription. +message TranscriptionAudio { + // The audio source. Only inline content is supported. + oneof source { + // Input only. Inline audio bytes, at most 25 MiB. + bytes content = 1 [(google.api.field_behavior) = INPUT_ONLY]; + + // URI of the audio content. Reserved for future use; the service rejects requests that set it. + string uri = 2; + } + + // Optional. The uploaded filename, at most 255 characters. + string filename = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The MIME type of the audio. If empty, the service detects it from the content. + string content_type = 4 [(google.api.field_behavior) = OPTIONAL]; +} diff --git a/proto/api/attachment_service.proto b/proto/api/attachment_service.proto new file mode 100644 index 000000000..cf310d15e --- /dev/null +++ b/proto/api/attachment_service.proto @@ -0,0 +1,377 @@ +syntax = "proto3"; + +package memos.api; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "gen/api"; + +// AttachmentService manages files attached to memos. +service AttachmentService { + // ListAttachments lists attachments linked to memos the caller can read, plus the caller's unlinked uploads. + rpc ListAttachments(ListAttachmentsRequest) returns (ListAttachmentsResponse) { + option (google.api.http) = {get: "/api/attachments"}; + } + + // GetAttachment gets an attachment by name. An unlinked attachment is visible only to its uploader and admins; + // a linked attachment follows the read access of its memo. + rpc GetAttachment(GetAttachmentRequest) returns (Attachment) { + option (google.api.http) = {get: "/api/{name=attachments/*}"}; + option (google.api.method_signature) = "name"; + } + + // CreateAttachment creates an attachment from inline content. + rpc CreateAttachment(CreateAttachmentRequest) returns (Attachment) { + option (google.api.http) = { + post: "/api/attachments" + body: "attachment" + }; + option (google.api.method_signature) = "attachment"; + } + + // UpdateAttachment updates an attachment. Only `filename` can be updated. The caller must be the uploader or an + // admin. + rpc UpdateAttachment(UpdateAttachmentRequest) returns (Attachment) { + option (google.api.http) = { + patch: "/api/{attachment.name=attachments/*}" + body: "attachment" + }; + option (google.api.method_signature) = "attachment,update_mask"; + } + + // DeleteAttachment deletes an attachment uploaded by the caller. + rpc DeleteAttachment(DeleteAttachmentRequest) returns (google.protobuf.Empty) { + option (google.api.http) = {delete: "/api/{name=attachments/*}"}; + option (google.api.method_signature) = "name"; + } + + // BatchDeleteAttachments deletes up to 100 attachments in one atomic request. The caller must be the uploader of + // each attachment or an admin. + rpc BatchDeleteAttachments(BatchDeleteAttachmentsRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + post: "/api/attachments:batchDelete" + body: "*" + }; + } + + // UploadAttachment uploads a file in bounded chunks. The first call carries the spec and returns an upload_id; + // later calls carry that upload_id. Uploads are bound to the authenticated user, expire after 30 minutes of + // inactivity, and do not survive a server restart. + rpc UploadAttachment(UploadAttachmentRequest) returns (UploadAttachmentResponse) { + option (google.api.http) = { + post: "/api/attachments:upload" + body: "*" + }; + } +} + +// Attachment is a file uploaded by a user, optionally linked to a memo. +message Attachment { + option (google.api.resource) = { + type: "memos.api/Attachment" + pattern: "attachments/{attachment}" + singular: "attachment" + plural: "attachments" + }; + + // Identifier. The resource name of the attachment. + // Format: attachments/{attachment} + string name = 1 [(google.api.field_behavior) = IDENTIFIER]; + + // Output only. The user who uploaded the attachment, which may differ from the creator of the linked memo. + // Format: users/{user} + string creator = 2 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.resource_reference) = {type: "memos.api/User"} + ]; + + // Required. The filename of the attachment. + string filename = 3 [(google.api.field_behavior) = REQUIRED]; + + // Required. The MIME type of the attachment. If empty on create, the service detects it from the filename and + // content. + string type = 4 [(google.api.field_behavior) = REQUIRED]; + + // Input only. The content of the attachment. + bytes content = 5 [(google.api.field_behavior) = INPUT_ONLY]; + + // Optional. The external link of the attachment. Set only for externally stored attachments; ignored on create. + string external_link = 6 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Motion photo metadata. Clients may only supply Apple Live Photo metadata; the service detects Android + // motion photos in JPEG content. + MotionMedia motion_media = 7 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Normalized media metadata supplied by the client at creation time. Immutable after creation. + MediaMetadata media_metadata = 8 [ + (google.api.field_behavior) = OPTIONAL, + (google.api.field_behavior) = IMMUTABLE + ]; + + // Optional. The memo the attachment is linked to. On create, the caller must be able to manage the memo. + // Format: memos/{memo} + optional string memo = 9 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. The size of the stored content in bytes. + int64 size = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The creation time. + google.protobuf.Timestamp create_time = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Request message for AttachmentService.ListAttachments. +message ListAttachmentsRequest { + // Optional. The maximum number of attachments to return. The service may return fewer. + // If unspecified, at most 50 attachments are returned. Values above 1000 are coerced to 1000. + int32 page_size = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A page token from a previous call. Provide it to retrieve the next page. + string page_token = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A CEL filter over the results. + // Example: `mime_type == "image/png"` or `filename.contains("test")`. + // Supported operators: ==, !=, <, <=, >, >=, : (contains), in. + // Supported fields: creator, filename, mime_type, create_time, memo_id, space. + // `creator` is the linked memo's creator, or the uploader for an unlinked attachment. It supports equality with a + // User resource name. + // `space` is the linked memo's Space resource name, or null when the attachment is unlinked or its memo has no + // space. It supports only a non-negated `==` comparison with a Space resource name or null. + string filter = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The order to sort results by, such as "create_time desc" or "filename asc". The service does not apply + // it yet. + string order_by = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response message for AttachmentService.ListAttachments. +message ListAttachmentsResponse { + // The attachments. + repeated Attachment attachments = 1; + + // A token to retrieve the next page. Empty when there are no more pages. + string next_page_token = 2; +} + +// Request message for AttachmentService.GetAttachment. +message GetAttachmentRequest { + // Required. The name of the attachment to get. + // Format: attachments/{attachment} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = {type: "memos.api/Attachment"} + ]; +} + +// Request message for AttachmentService.CreateAttachment. +message CreateAttachmentRequest { + // Required. The attachment to create. + Attachment attachment = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The ID to use for the attachment. If empty, a unique ID is generated. + // Format: ^[a-zA-Z0-9]([a-zA-Z0-9-]{0,34}[a-zA-Z0-9])?$ + string attachment_id = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for AttachmentService.UpdateAttachment. +message UpdateAttachmentRequest { + // Required. The attachment to update. Its `name` identifies the attachment. + Attachment attachment = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The fields to update. Only `filename` is supported. + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for AttachmentService.DeleteAttachment. +message DeleteAttachmentRequest { + // Required. The name of the attachment to delete. + // Format: attachments/{attachment} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = {type: "memos.api/Attachment"} + ]; +} + +// Request message for AttachmentService.BatchDeleteAttachments. +message BatchDeleteAttachmentsRequest { + // Required. The names of the attachments to delete, at most 100. Duplicate names are ignored. + // Format: attachments/{attachment} + repeated string names = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for AttachmentService.UploadAttachment. +message UploadAttachmentRequest { + // Starts a new upload or continues an existing one. Exactly one must be set. + oneof upload { + // Starts a new upload. The same call may also carry data and finish_write. + UploadAttachmentSpec spec = 1; + + // Continues the upload identified by a previous response. + string upload_id = 2; + } + + // Required. Zero-based byte offset at which data is written. Must equal the committed size, except when retrying + // the most recently accepted chunk with identical bytes and offset, which is accepted without writing again. + int64 write_offset = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. File bytes, at most max_chunk_size long. With no data and finish_write false, the call reports + // progress without writing, and write_offset is ignored. + bytes data = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Finalize the upload after writing data. The committed size must then equal total_size. Any later call + // for the same upload_id returns the created attachment. + bool finish_write = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response message for AttachmentService.UploadAttachment. +message UploadAttachmentResponse { + // Opaque ID for subsequent calls. This is not a resource name. + string upload_id = 1; + + // Number of file bytes committed so far. + int64 committed_size = 2; + + // Maximum number of data bytes accepted in one call. + int32 max_chunk_size = 3; + + // The created attachment. Set once the upload has been finalized. + Attachment attachment = 4; +} + +// UploadAttachmentSpec describes the attachment that a new upload creates. +message UploadAttachmentSpec { + // Required. Metadata for the attachment to create. content must be empty; file bytes are sent in data. + Attachment attachment = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The ID to use for the attachment. If empty, a unique ID is generated. + // Format: ^[a-zA-Z0-9]([a-zA-Z0-9-]{0,34}[a-zA-Z0-9])?$ + string attachment_id = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Total size of the file in bytes before media processing. Zero represents an empty file. + int64 total_size = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// MotionMedia links the parts of a motion photo. +message MotionMedia { + // The motion photo format. + MotionMediaFamily family = 1; + + // The part this attachment plays in the motion photo. + MotionMediaRole role = 2; + + // Groups the attachments that belong to one motion photo. Required for client-supplied Apple Live Photo metadata; + // for an Android motion photo it is the attachment's own ID. + string group_id = 3; + + // Presentation timestamp of the still frame within the video, in microseconds. + int64 presentation_timestamp_us = 4; + + // Whether the file embeds the motion video, as in an Android motion photo container. + bool has_embedded_video = 5; +} + +// MotionMediaFamily is the format of a motion photo. +enum MotionMediaFamily { + MOTION_MEDIA_FAMILY_UNSPECIFIED = 0; + // An Apple Live Photo: a still image and a video stored as separate attachments. + APPLE_LIVE_PHOTO = 1; + // An Android motion photo: a JPEG with an embedded video. + ANDROID_MOTION_PHOTO = 2; +} + +// MotionMediaRole is the part an attachment plays in a motion photo. +enum MotionMediaRole { + MOTION_MEDIA_ROLE_UNSPECIFIED = 0; + // The still image of an Apple Live Photo. + STILL = 1; + // The video of an Apple Live Photo. + VIDEO = 2; + // A single file holding both the still image and the video. + CONTAINER = 3; +} + +// MediaMetadata contains normalized metadata explicitly supplied by a client. +// The service validates and stores this data but does not extract it from the media file. +message MediaMetadata { + // Display-oriented width in pixels. Must be provided with height. + optional int32 width = 1; + + // Display-oriented height in pixels. Must be provided with width. + optional int32 height = 2; + + // Type-specific metadata. Must match the attachment's MIME type. + oneof details { + // Photo metadata, for image attachments. + PhotoMetadata photo = 3; + + // Video metadata, for video attachments. + VideoMetadata video = 4; + } +} + +// PhotoMetadata is metadata recorded by the source of a photo. +message PhotoMetadata { + // Capture time as recorded by the source media. + MediaCaptureTime capture_time = 1; + + // Geographic location recorded by the source media. + MediaLocation location = 2; + + // EXIF orientation value from 1 through 8 as recorded by the source file. + // This value is informational and must not be reapplied to the stored attachment; + // width and height already describe its display-oriented dimensions. + optional int32 source_exif_orientation = 3; + + // The camera manufacturer. + string camera_make = 4; + + // The camera model. + string camera_model = 5; + + // The lens model. + string lens_model = 6; + + // The aperture f-number. + optional double f_number = 7; + + // The exposure time in seconds. + optional double exposure_time_seconds = 8; + + // The ISO sensitivity. + optional int32 iso = 9; + + // The focal length in millimeters. + optional double focal_length_mm = 10; +} + +// MediaCaptureTime is the local time at which media was captured. +message MediaCaptureTime { + // Local date and time without a time zone, formatted as YYYY-MM-DDTHH:mm:ss[.fraction]. + string local_date_time = 1; + + // UTC offset formatted as Z or +/-HH:MM. + optional string utc_offset = 2; +} + +// MediaLocation is the geographic location at which media was captured. +message MediaLocation { + // WGS84 latitude in decimal degrees. Must be provided with longitude. + optional double latitude = 1; + + // WGS84 longitude in decimal degrees. Must be provided with latitude. + optional double longitude = 2; + + // Signed altitude in meters relative to sea level. + optional double altitude_meters = 3; +} + +// VideoMetadata is metadata recorded by the source of a video. +message VideoMetadata { + // The duration of the video in seconds. + optional double duration_seconds = 1; +} diff --git a/proto/api/auth_service.proto b/proto/api/auth_service.proto new file mode 100644 index 000000000..f95f081ad --- /dev/null +++ b/proto/api/auth_service.proto @@ -0,0 +1,130 @@ +syntax = "proto3"; + +package memos.api; + +import "api/user_service.proto"; +import "google/api/annotations.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "gen/api"; + +// AuthService manages sign-in sessions: it issues, refreshes, and revokes the tokens that authenticate API calls. +service AuthService { + // SignIn authenticates a user with password or SSO credentials. + // On success, returns a short-lived access token and sets a refresh token in an HttpOnly cookie. + // Public. Attempts are rate limited. Archived users cannot sign in. + rpc SignIn(SignInRequest) returns (SignInResponse) { + option (google.api.http) = { + post: "/api/auth/signin" + body: "*" + }; + } + + // RefreshToken exchanges the refresh token for a new access token. + // The refresh token is read from the HttpOnly cookie and rotated: the old token is revoked and a new one with a + // fresh 30-day expiry is set in the cookie. + // Public, so it can be called after the access token has expired. + rpc RefreshToken(RefreshTokenRequest) returns (RefreshTokenResponse) { + option (google.api.http) = { + post: "/api/auth/refresh" + body: "*" + }; + } + + // GetCurrentUser returns the authenticated user, similar to OIDC's /userinfo endpoint. + // When the caller is not signed in or the account is no longer active, clears the refresh token cookie and returns + // UNAUTHENTICATED. + rpc GetCurrentUser(GetCurrentUserRequest) returns (GetCurrentUserResponse) { + option (google.api.http) = {get: "/api/auth/me"}; + } + + // SignOut ends the current session. + // Revokes the refresh token from the cookie and clears the cookie. + rpc SignOut(SignOutRequest) returns (google.protobuf.Empty) { + option (google.api.http) = {post: "/api/auth/signout"}; + } +} + +// Request message for AuthService.SignIn. +message SignInRequest { + // The credentials to authenticate with. Provide exactly one. + oneof credentials { + // Username and password credentials. + PasswordCredentials password_credentials = 1; + + // SSO credentials from an OAuth2 authorization code flow. + SsoCredentials sso_credentials = 2; + } + + // PasswordCredentials are a username and password. + // Regular users cannot use them when the instance disallows password sign-in. + message PasswordCredentials { + // Required. The username to sign in with. + string username = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The password to sign in with. + string password = 2 [(google.api.field_behavior) = REQUIRED]; + } + + // SsoCredentials are the result of an OAuth2 authorization code flow with an identity provider. + // A first sign-in creates a local user unless the instance disallows user registration. + message SsoCredentials { + // Required. The resource name of the identity provider. + // Format: identity-providers/{idp} + string identity_provider = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = {type: "memos.api/IdentityProvider"} + ]; + + // Required. The authorization code returned by the identity provider. + string code = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The redirect URI used in the authorization request. + string redirect_uri = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The PKCE code verifier (RFC 7636). Set it when the authorization request used a code challenge. + string code_verifier = 4 [(google.api.field_behavior) = OPTIONAL]; + } +} + +// Response message for AuthService.SignIn. +message SignInResponse { + // The signed-in user. + User user = 1; + + // The short-lived access token for API requests. + // Keep it in memory only, not in localStorage. + string access_token = 2; + + // When the access token expires. + // Call RefreshToken before this time. + google.protobuf.Timestamp access_token_expire_time = 3; +} + +// Request message for AuthService.RefreshToken. +// It has no fields: the refresh token is read from the HttpOnly cookie. +message RefreshTokenRequest {} + +// Response message for AuthService.RefreshToken. +message RefreshTokenResponse { + // The new short-lived access token. + string access_token = 1; + + // When the new access token expires. + google.protobuf.Timestamp access_token_expire_time = 2; +} + +// Request message for AuthService.GetCurrentUser. +message GetCurrentUserRequest {} + +// Response message for AuthService.GetCurrentUser. +message GetCurrentUserResponse { + // The authenticated user. + User user = 1; +} + +// Request message for AuthService.SignOut. +message SignOutRequest {} diff --git a/proto/api/common.proto b/proto/api/common.proto new file mode 100644 index 000000000..e2f72a91c --- /dev/null +++ b/proto/api/common.proto @@ -0,0 +1,33 @@ +syntax = "proto3"; + +package memos.api; + +option go_package = "gen/api"; + +// State is the lifecycle state of a resource. +enum State { + STATE_UNSPECIFIED = 0; + // The resource is active. + NORMAL = 1; + // The resource is archived. + ARCHIVED = 2; +} + +// Direction is a sort direction. +enum Direction { + DIRECTION_UNSPECIFIED = 0; + // Ascending order. + ASC = 1; + // Descending order. + DESC = 2; +} + +// PageToken is the internal content of an opaque page token. The service +// serializes it and encodes it as base64; clients must not parse it. +message PageToken { + // The page size used for the next page. + int32 limit = 1; + + // The number of items to skip before the next page. + int32 offset = 2; +} diff --git a/proto/api/v1/idp_service.proto b/proto/api/idp_service.proto similarity index 51% rename from proto/api/v1/idp_service.proto rename to proto/api/idp_service.proto index 40ec4e028..04cfde775 100644 --- a/proto/api/v1/idp_service.proto +++ b/proto/api/idp_service.proto @@ -1,6 +1,6 @@ syntax = "proto3"; -package memos.api.v1; +package memos.api; import "google/api/annotations.proto"; import "google/api/client.proto"; @@ -9,55 +9,63 @@ import "google/api/resource.proto"; import "google/protobuf/empty.proto"; import "google/protobuf/field_mask.proto"; -option go_package = "gen/api/v1"; +option go_package = "gen/api"; +// IdentityProviderService manages the external identity providers users can sign in with. service IdentityProviderService { // ListIdentityProviders lists identity providers. + // Public, so the sign-in page can show SSO options. Client secrets are never returned. rpc ListIdentityProviders(ListIdentityProvidersRequest) returns (ListIdentityProvidersResponse) { - option (google.api.http) = {get: "/api/v1/identity-providers"}; + option (google.api.http) = {get: "/api/identity-providers"}; } // GetIdentityProvider gets an identity provider. + // The client secret is never returned. rpc GetIdentityProvider(GetIdentityProviderRequest) returns (IdentityProvider) { - option (google.api.http) = {get: "/api/v1/{name=identity-providers/*}"}; + option (google.api.http) = {get: "/api/{name=identity-providers/*}"}; option (google.api.method_signature) = "name"; } // CreateIdentityProvider creates an identity provider. + // Requires the admin role. Fails with FAILED_PRECONDITION when the ID belongs to a provider configured by the + // deployment. rpc CreateIdentityProvider(CreateIdentityProviderRequest) returns (IdentityProvider) { option (google.api.http) = { - post: "/api/v1/identity-providers" + post: "/api/identity-providers" body: "identity_provider" }; option (google.api.method_signature) = "identity_provider"; } // UpdateIdentityProvider updates an identity provider. + // Requires the admin role. Providers configured by the deployment cannot be updated. rpc UpdateIdentityProvider(UpdateIdentityProviderRequest) returns (IdentityProvider) { option (google.api.http) = { - patch: "/api/v1/{identity_provider.name=identity-providers/*}" + patch: "/api/{identity_provider.name=identity-providers/*}" body: "identity_provider" }; option (google.api.method_signature) = "identity_provider,update_mask"; } // DeleteIdentityProvider deletes an identity provider. + // Requires the admin role. Providers configured by the deployment cannot be deleted. Fails with + // FAILED_PRECONDITION when password sign-in is disabled for regular users and no other effective provider remains. rpc DeleteIdentityProvider(DeleteIdentityProviderRequest) returns (google.protobuf.Empty) { - option (google.api.http) = {delete: "/api/v1/{name=identity-providers/*}"}; + option (google.api.http) = {delete: "/api/{name=identity-providers/*}"}; option (google.api.method_signature) = "name"; } } +// IdentityProvider is an external identity provider users can sign in with. message IdentityProvider { option (google.api.resource) = { - type: "memos.api.v1/IdentityProvider" + type: "memos.api/IdentityProvider" pattern: "identity-providers/{idp}" - name_field: "name" singular: "identityProvider" plural: "identityProviders" }; - // The resource name of the identity provider. + // Identifier. The resource name of the identity provider. // Format: identity-providers/{idp} string name = 1 [(google.api.field_behavior) = IDENTIFIER]; @@ -67,12 +75,13 @@ message IdentityProvider { // Required. The display title of the identity provider. string title = 3 [(google.api.field_behavior) = REQUIRED]; - // Optional. Filter applied to user identifiers. + // Optional. A regular expression the user identifier must match to sign in. Empty allows every identifier. string identifier_filter = 4 [(google.api.field_behavior) = OPTIONAL]; - // Required. Configuration for the identity provider. + // Required. The type-specific configuration of the identity provider. IdentityProviderConfig config = 5 [(google.api.field_behavior) = REQUIRED]; + // Type is the protocol of an identity provider. enum Type { TYPE_UNSPECIFIED = 0; // OAuth2 identity provider. @@ -80,69 +89,101 @@ message IdentityProvider { } } -message IdentityProviderConfig { - oneof config { - OAuth2Config oauth2_config = 1; - } -} - -message FieldMapping { - string identifier = 1; - string display_name = 2; - string email = 3; - string avatar_url = 4; -} - -message OAuth2Config { - string client_id = 1; - string client_secret = 2; - string auth_url = 3; - string token_url = 4; - string user_info_url = 5; - repeated string scopes = 6; - FieldMapping field_mapping = 7; -} - +// Request message for IdentityProviderService.ListIdentityProviders. message ListIdentityProvidersRequest {} +// Response message for IdentityProviderService.ListIdentityProviders. message ListIdentityProvidersResponse { - // The list of identity providers. + // The identity providers. repeated IdentityProvider identity_providers = 1; } +// Request message for IdentityProviderService.GetIdentityProvider. message GetIdentityProviderRequest { // Required. The resource name of the identity provider to get. // Format: identity-providers/{idp} string name = 1 [ (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = {type: "memos.api.v1/IdentityProvider"} + (google.api.resource_reference) = {type: "memos.api/IdentityProvider"} ]; } +// Request message for IdentityProviderService.CreateIdentityProvider. message CreateIdentityProviderRequest { // Required. The identity provider to create. IdentityProvider identity_provider = 1 [(google.api.field_behavior) = REQUIRED]; - // Optional. The ID to use for the identity provider, which will become the final component of the resource name. - // If not provided, the system will generate one. + // Optional. The ID to use for the identity provider, which becomes the final component of the resource name. + // If empty, the server generates one. // Format: ^[a-zA-Z0-9]([a-zA-Z0-9-]{0,34}[a-zA-Z0-9])?$ string identity_provider_id = 2 [(google.api.field_behavior) = OPTIONAL]; } +// Request message for IdentityProviderService.UpdateIdentityProvider. message UpdateIdentityProviderRequest { - // Required. The identity provider to update. + // Required. The identity provider to update. Its name identifies the provider. IdentityProvider identity_provider = 1 [(google.api.field_behavior) = REQUIRED]; - // Required. The update mask applies to the resource. Only the top level fields of - // IdentityProvider are supported. + // Required. The fields to update. Supported paths: title, identifier_filter, config; other paths are ignored. + // An empty OAuth2 client secret in config keeps the stored secret. google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; } +// Request message for IdentityProviderService.DeleteIdentityProvider. message DeleteIdentityProviderRequest { // Required. The resource name of the identity provider to delete. // Format: identity-providers/{idp} string name = 1 [ (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = {type: "memos.api.v1/IdentityProvider"} + (google.api.resource_reference) = {type: "memos.api/IdentityProvider"} ]; } + +// IdentityProviderConfig is the type-specific configuration of an identity provider. +message IdentityProviderConfig { + // The configuration, matching the provider type. + oneof config { + // The configuration of an OAuth2 identity provider. + OAuth2Config oauth2_config = 1; + } +} + +// OAuth2Config is the configuration of an OAuth2 identity provider. +message OAuth2Config { + // The OAuth2 client ID. + string client_id = 1; + + // The OAuth2 client secret. Write-only: it is never returned in responses. + string client_secret = 2; + + // The authorization endpoint URL. + string auth_url = 3; + + // The token endpoint URL, used to exchange the authorization code for an access token. + string token_url = 4; + + // The user info endpoint URL, used to fetch the claims of the signed-in user. + string user_info_url = 5; + + // The scopes to request. + repeated string scopes = 6; + + // How user info claims map to user fields. + FieldMapping field_mapping = 7; +} + +// FieldMapping maps user info claims of an OAuth2 identity provider to user fields. +// Each field holds the name of a claim. +message FieldMapping { + // The claim that uniquely identifies the user. Sign-in fails when it is missing or empty. + string identifier = 1; + + // The claim used as the display name. Falls back to the identifier when unset. + string display_name = 2; + + // The claim used as the email address. + string email = 3; + + // The claim used as the avatar URL. + string avatar_url = 4; +} diff --git a/proto/api/instance_service.proto b/proto/api/instance_service.proto new file mode 100644 index 000000000..ae28a8395 --- /dev/null +++ b/proto/api/instance_service.proto @@ -0,0 +1,532 @@ +syntax = "proto3"; + +package memos.api; + +import "api/user_service.proto"; +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; +import "google/type/color.proto"; + +option go_package = "gen/api"; + +// InstanceService exposes the instance profile, instance-wide settings and usage statistics. +service InstanceService { + // GetInstanceProfile gets the instance profile. Available without authentication, including on a private instance. + rpc GetInstanceProfile(GetInstanceProfileRequest) returns (InstanceProfile) { + option (google.api.http) = {get: "/api/instance/profile"}; + } + + // GetInstanceSetting gets an instance setting. Available without authentication, except STORAGE and NOTIFICATION, + // which are admin only, and AI, which requires a signed-in user and hides transcription defaults from non-admins. + rpc GetInstanceSetting(GetInstanceSettingRequest) returns (InstanceSetting) { + option (google.api.http) = {get: "/api/{name=instance/settings/*}"}; + option (google.api.method_signature) = "name"; + } + + // BatchGetInstanceSettings gets up to 100 instance settings in request order, with the same access rules as + // GetInstanceSetting. The call fails if any setting cannot be returned. + rpc BatchGetInstanceSettings(BatchGetInstanceSettingsRequest) returns (BatchGetInstanceSettingsResponse) { + option (google.api.http) = { + post: "/api/instance/settings:batchGet" + body: "*" + }; + } + + // UpdateInstanceSetting replaces an instance setting. Admin only. Settings configured by the deployment cannot be + // updated. Empty write-only credentials keep the stored values. + rpc UpdateInstanceSetting(UpdateInstanceSettingRequest) returns (InstanceSetting) { + option (google.api.http) = { + patch: "/api/{instance_setting.name=instance/settings/*}" + body: "instance_setting" + }; + option (google.api.method_signature) = "instance_setting,update_mask"; + } + + // TestInstanceEmailSetting sends a test email with the provided or stored SMTP settings. Admin only. + rpc TestInstanceEmailSetting(TestInstanceEmailSettingRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + post: "/api/instance/settings/notification:testEmail" + body: "*" + }; + } + + // GetInstanceStats gets resource usage statistics for the instance. Admin only. Results are cached for 60 seconds. + rpc GetInstanceStats(GetInstanceStatsRequest) returns (InstanceStats) { + option (google.api.http) = {get: "/api/instance/stats"}; + } +} + +// InstanceAccessMode controls whether unauthenticated users may access instance content. +enum InstanceAccessMode { + INSTANCE_ACCESS_MODE_UNSPECIFIED = 0; + // Unauthenticated users may only reach the endpoints needed to sign in, register and open share links. + // This is the default. + INSTANCE_ACCESS_MODE_PRIVATE = 1; + // Unauthenticated users may read public content. + INSTANCE_ACCESS_MODE_PUBLIC = 2; +} + +// InstanceProfile is the basic information about the instance. +message InstanceProfile { + // The version of the running server. + string version = 1; + + // The build commit of the running server. + string commit = 2; + + // Whether the instance runs in demo mode. + bool demo = 3; + + // The configured URL of the instance. + string instance_url = 4; + + // Whether unauthenticated users may access instance content. + InstanceAccessMode access_mode = 5; + + // Whether the instance has no users yet and requires initial setup (creating the first admin account). + // Unlike a null admin, this stays false once any user exists, so an instance that has lost its admins is not + // mistaken for a fresh install. + bool needs_setup = 6; + + // The first administrator of the instance, for display purposes. + // May be null on an instance that has lost all admins; use needs_setup to determine whether initial setup is + // required. + User admin = 7; + + // The proof-of-humanity challenge required on signup and password sign-in. + // Absent when none is configured, which is the case on every self-hosted instance. + Challenge challenge = 8; + + // Challenge describes a proof-of-humanity challenge widget. + message Challenge { + // The challenge provider, which selects the widget the web app renders. + string provider = 1; + + // The provider's public site key for the widget. + string site_key = 2; + } +} + +// Request message for InstanceService.GetInstanceProfile. +message GetInstanceProfileRequest {} + +// InstanceSetting is one group of instance-wide settings, selected by its key. +message InstanceSetting { + option (google.api.resource) = { + type: "memos.api/InstanceSetting" + pattern: "instance/settings/{setting}" + singular: "instanceSetting" + plural: "instanceSettings" + }; + + // Identifier. The resource name of the instance setting. {setting} is a Key value, such as GENERAL. + // Format: instance/settings/{setting} + string name = 1 [(google.api.field_behavior) = IDENTIFIER]; + + // The setting value. The set field matches the key in name. + oneof value { + // The value of the GENERAL setting. + GeneralSetting general_setting = 2; + // The value of the STORAGE setting. + StorageSetting storage_setting = 3; + // The value of the MEMO_RELATED setting. + MemoRelatedSetting memo_related_setting = 4; + // The value of the TAGS setting. + TagsSetting tags_setting = 5; + // The value of the NOTIFICATION setting. + NotificationSetting notification_setting = 6; + // The value of the AI setting. + AISetting ai_setting = 7; + // The value of the ACCESS setting. + AccessSetting access_setting = 8; + } + + // Key identifies an instance setting. + enum Key { + KEY_UNSPECIFIED = 0; + // General settings. + GENERAL = 1; + // Attachment storage settings. + STORAGE = 2; + // Memo-related settings. + MEMO_RELATED = 3; + // Tag metadata. + TAGS = 4; + // Notification transport settings. + NOTIFICATION = 5; + // AI provider settings. + AI = 6; + // Instance access policy settings. + ACCESS = 7; + } + + // StorageType is the backend of a configured storage. + enum StorageType { + STORAGE_TYPE_UNSPECIFIED = 0; + // Stores attachment content in the application database. + DATABASE = 1; + // Stores attachment content on the local filesystem. + LOCAL = 2; + // Stores attachment content in an S3-compatible object store. + S3 = 3; + } + + // AIProviderType is the provider implementation type. + enum AIProviderType { + AI_PROVIDER_TYPE_UNSPECIFIED = 0; + // OpenAI API. The endpoint defaults to https://api.openai.com/v1. + OPENAI = 1; + // Google Gemini API. The endpoint defaults to https://generativelanguage.googleapis.com/v1beta. + GEMINI = 2; + } + + // GeneralSetting is the general instance configuration. + message GeneralSetting { + // Branding shown in the web app. + CustomProfile custom_profile = 1; + + // Whether user self-registration is disabled. + bool disallow_user_registration = 2; + + // Whether password authentication is disabled. + bool disallow_password_auth = 3; + + // Whether users are prevented from changing their username. + bool disallow_change_username = 4; + + // Whether users are prevented from changing their nickname. + bool disallow_change_nickname = 5; + + // The first day of the week as an offset from Sunday. + // 0: Sunday, 1: Monday, 2: Tuesday, 3: Wednesday, 4: Thursday, 5: Friday, 6: Saturday. + // Default is Sunday. + int32 week_start_day_offset = 6; + + // Custom CSS injected into the web app. + string additional_style = 7; + + // Custom JavaScript injected into the web app. + string additional_script = 8; + + // CustomProfile is the instance branding. + message CustomProfile { + // The instance title. + string title = 1; + + // The instance description. + string description = 2; + + // The URL of the instance logo. + string logo_url = 3; + } + } + + // StorageSetting is the attachment storage configuration. + message StorageSetting { + // Configured storage instances, including inactive instances still referenced by attachments. + repeated Storage storages = 1; + + // The ID of the storage used for new attachments. + string default_storage_id = 2; + + // The template of attachment file paths. + // Default is assets/{timestamp}_{uuid}_{filename}. + string filepath_template = 3; + + // The maximum upload size in megabytes. Default is 30. + int64 upload_size_limit_mb = 4; + + // Legacy compatibility field. New clients use default_storage_id. + StorageType storage_type = 5; + + // Legacy compatibility field. New clients use storages. + S3Config s3_config = 6; + + // StorageType is the legacy storage type, retained for compatibility with existing clients. + enum StorageType { + STORAGE_TYPE_UNSPECIFIED = 0; + // Database storage. + DATABASE = 1; + // Local filesystem storage. + LOCAL = 2; + // S3 storage. + S3 = 3; + } + + // S3Config is the legacy S3 configuration, retained for compatibility with existing clients. + // Reference: https://developers.cloudflare.com/r2/examples/aws/aws-sdk-go/ + message S3Config { + // The S3 endpoint URL. + string endpoint = 1; + + // The S3 region. + string region = 2; + + // The S3 bucket. + string bucket = 3; + + // The S3 access key ID. + string access_key_id = 4; + + // Input only. The S3 access key secret. Never returned; an empty value keeps the stored secret. + string access_key_secret = 5 [(google.api.field_behavior) = INPUT_ONLY]; + + // Whether to use path-style addressing instead of virtual-hosted-style. + bool use_path_style = 6; + + // Whether to skip TLS certificate verification when connecting to the S3 endpoint. + // Only enable this for trusted endpoints that use a self-signed certificate; it removes protection against + // man-in-the-middle attacks. + bool insecure_skip_tls_verify = 7; + } + } + + // Storage is a configured attachment storage instance. + message Storage { + // The stable identifier referenced by attachments. + string id = 1; + + // The human-readable storage name. + string name = 2; + + // The storage backend. + StorageType type = 3; + + // The backend-specific configuration. + oneof config { + // The configuration of an S3 storage. + S3Config s3_config = 4; + } + + // S3Config is the configuration of an S3-compatible object store. + // Reference: https://developers.cloudflare.com/r2/examples/aws/aws-sdk-go/ + message S3Config { + // The S3 endpoint URL. + string endpoint = 1; + + // The S3 region. + string region = 2; + + // The S3 bucket. + string bucket = 3; + + // The S3 access key ID. + string access_key_id = 4; + + // Input only. The S3 access key secret. Never returned; an empty value keeps the stored secret. + string access_key_secret = 5 [(google.api.field_behavior) = INPUT_ONLY]; + + // Whether to use path-style addressing instead of virtual-hosted-style. + bool use_path_style = 6; + + // Whether to skip TLS certificate verification when connecting to the S3 endpoint. + // Only enable this for trusted endpoints that use a self-signed certificate; it removes protection against + // man-in-the-middle attacks. + bool insecure_skip_tls_verify = 7; + } + } + + // MemoRelatedSetting is the memo-related instance configuration. + message MemoRelatedSetting { + // The maximum memo content length in bytes. Default and minimum is 8192. + int32 content_length_limit = 1; + + // The reactions users can choose from. Defaults to a built-in emoji set when empty. + repeated string reactions = 2; + + // Whether double-clicking a memo opens it for editing. + bool enable_double_click_edit = 3; + } + + // TagsSetting is the instance-wide tag metadata configuration. + // Active tag metadata is stored in per-user tag settings. This message remains for backward compatibility with + // existing clients and migrations. + message TagsSetting { + // Map of tag name pattern to tag metadata. + // Each key is treated as an anchored regular expression (^pattern$), so a single entry like "project/.*" matches + // all tags under that prefix. Exact tag names are also valid. + map tags = 1; + } + + // TagMetadata is the display metadata for a tag. + message TagMetadata { + // The background color of the tag label. When unset, the default tag color is used. + google.type.Color background_color = 1; + + // Whether memos with this tag have their content blurred. + bool blur_content = 2; + } + + // NotificationSetting is the notification transport configuration. + message NotificationSetting { + // The email delivery configuration. + EmailSetting email = 1; + + // EmailSetting is the SMTP configuration for notification emails. + message EmailSetting { + // Whether email notifications are enabled. + bool enabled = 1; + + // The SMTP server host. + string smtp_host = 2; + + // The SMTP server port. + int32 smtp_port = 3; + + // The SMTP username. + string smtp_username = 4; + + // Input only. The SMTP password. Never returned. An empty value keeps the stored password, unless the host, + // port, username or encryption settings change. + string smtp_password = 5 [(google.api.field_behavior) = INPUT_ONLY]; + + // Whether to use STARTTLS. + bool use_tls = 6; + + // Whether to use implicit SSL/TLS. + bool use_ssl = 7; + + // The sender email address. + string from_email = 8; + + // The sender display name. + string from_name = 9; + + // The Reply-To email address. + string reply_to = 10; + } + } + + // AISetting is the AI provider configuration. + message AISetting { + // The AI provider configurations available instance-wide. + repeated AIProviderConfig providers = 1; + + // The speech-to-text feature configuration. + // When unset or transcription.provider_id is empty, transcription is disabled. An update that omits it keeps the + // stored configuration. + TranscriptionConfig transcription = 2; + } + + // AIProviderConfig is one callable AI provider connection. + message AIProviderConfig { + // The provider ID. Generated when empty on update. + string id = 1; + + // The provider display title. + string title = 2; + + // The provider implementation type. + AIProviderType type = 3; + + // The provider API endpoint. Defaults to the provider's public endpoint when empty. + string endpoint = 4; + + // Input only. The provider API key. Never returned; an empty value keeps the stored key. + string api_key = 5 [(google.api.field_behavior) = INPUT_ONLY]; + + // Output only. Whether an API key is stored for this provider. + bool api_key_set = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. A masked hint of the stored API key. + string api_key_hint = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + } + + // TranscriptionConfig is the speech-to-text feature configuration. + message TranscriptionConfig { + // The ID of the provider used for transcription; must reference an entry in AISetting.providers. + // Empty means transcription is disabled. + string provider_id = 1; + + // The provider-specific model identifier. Hidden from non-admins. + // Empty falls back to the engine default (whisper-1 for OPENAI providers, gemini-2.5-flash for GEMINI providers). + string model = 2; + + // The default ISO 639-1 language hint sent to the provider. Hidden from non-admins. + // Empty lets the provider auto-detect. + string language = 3; + + // A default spelling and vocabulary hint passed to the provider. Hidden from non-admins. + string prompt = 4; + } + + // AccessSetting is the instance access policy. + message AccessSetting { + // Whether unauthenticated users may access instance content. Must be PRIVATE or PUBLIC on update. + InstanceAccessMode access_mode = 1; + } +} + +// Request message for InstanceService.GetInstanceSetting. +message GetInstanceSettingRequest { + // Required. The resource name of the instance setting. + // Format: instance/settings/{setting} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = {type: "memos.api/InstanceSetting"} + ]; +} + +// Request message for InstanceService.BatchGetInstanceSettings. +message BatchGetInstanceSettingsRequest { + // Required. The resource names of the instance settings. At most 100. + // Format: instance/settings/{setting} + repeated string names = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = {type: "memos.api/InstanceSetting"} + ]; +} + +// Response message for InstanceService.BatchGetInstanceSettings. +message BatchGetInstanceSettingsResponse { + // The instance settings, in the same order as the requested names. + repeated InstanceSetting instance_settings = 1; +} + +// Request message for InstanceService.UpdateInstanceSetting. +message UpdateInstanceSettingRequest { + // Required. The instance setting, which replaces the stored setting. + InstanceSetting instance_setting = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The list of fields to update. Currently ignored; the whole setting is replaced. + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for InstanceService.TestInstanceEmailSetting. +message TestInstanceEmailSettingRequest { + // Optional. The SMTP settings to test. If omitted, the stored notification email setting is used. An empty + // password reuses the stored password when the connection settings are unchanged. + InstanceSetting.NotificationSetting.EmailSetting email = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The recipient email address. If omitted, the current user's email address is used. + string recipient_email = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// InstanceStats is a snapshot of the instance's resource usage. +message InstanceStats { + // The database size statistics. + DatabaseStats database = 1; + + // The recursive size of the data directory in bytes. -1 if unavailable. + int64 local_storage_bytes = 2; + + // The time the snapshot was generated on the server. + google.protobuf.Timestamp generated_time = 3; + + // DatabaseStats is the database size statistics. + message DatabaseStats { + // The database driver: "sqlite", "mysql" or "postgres". + string driver = 1; + + // The database size in bytes. -1 if unavailable. + int64 size_bytes = 2; + } +} + +// Request message for InstanceService.GetInstanceStats. +message GetInstanceStatsRequest {} diff --git a/proto/api/memo_service.proto b/proto/api/memo_service.proto new file mode 100644 index 000000000..75a7e00d7 --- /dev/null +++ b/proto/api/memo_service.proto @@ -0,0 +1,761 @@ +syntax = "proto3"; + +package memos.api; + +import "api/attachment_service.proto"; +import "api/common.proto"; +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "gen/api"; + +// MemoService manages memos and their attachments, relations, comments, +// reactions, and share links. +service MemoService { + // ListMemos lists the memos the caller can read, excluding comments. + // Anonymous callers can list only when the instance allows public access. + rpc ListMemos(ListMemosRequest) returns (ListMemosResponse) { + option (google.api.http) = {get: "/api/memos"}; + option (google.api.method_signature) = ""; + } + + // GetMemo gets a memo. Requires read access to the memo. + rpc GetMemo(GetMemoRequest) returns (Memo) { + option (google.api.http) = {get: "/api/{name=memos/*}"}; + option (google.api.method_signature) = "name"; + } + + // 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. + rpc CreateMemo(CreateMemoRequest) returns (Memo) { + option (google.api.http) = { + post: "/api/memos" + body: "memo" + }; + option (google.api.method_signature) = "memo"; + } + + // UpdateMemo updates the memo fields listed in update_mask. Requires the memo + // creator or an instance administrator. + rpc UpdateMemo(UpdateMemoRequest) returns (Memo) { + option (google.api.http) = { + patch: "/api/{memo.name=memos/*}" + body: "memo" + }; + option (google.api.method_signature) = "memo,update_mask"; + } + + // 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. + rpc DeleteMemo(DeleteMemoRequest) returns (google.protobuf.Empty) { + option (google.api.http) = {delete: "/api/{name=memos/*}"}; + option (google.api.method_signature) = "name"; + } + + // ListMemoAttachments lists the attachments of a memo. Requires read access + // to the memo. + rpc ListMemoAttachments(ListMemoAttachmentsRequest) returns (ListMemoAttachmentsResponse) { + option (google.api.http) = {get: "/api/{parent=memos/*}/attachments"}; + option (google.api.method_signature) = "parent"; + } + + // 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. + rpc SetMemoAttachments(SetMemoAttachmentsRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + patch: "/api/{name=memos/*}/attachments" + body: "*" + }; + option (google.api.method_signature) = "name"; + } + + // ListMemoRelations lists the relations of a memo in both directions. + // Requires read access to the memo. + rpc ListMemoRelations(ListMemoRelationsRequest) returns (ListMemoRelationsResponse) { + option (google.api.http) = {get: "/api/{parent=memos/*}/relations"}; + option (google.api.method_signature) = "parent"; + } + + // 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. + rpc SetMemoRelations(SetMemoRelationsRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + patch: "/api/{name=memos/*}/relations" + body: "*" + }; + option (google.api.method_signature) = "name"; + } + + // ListMemoComments lists the active comments on a memo that the caller can + // read. Requires read access to the memo. + rpc ListMemoComments(ListMemoCommentsRequest) returns (ListMemoCommentsResponse) { + option (google.api.http) = {get: "/api/{parent=memos/*}/comments"}; + option (google.api.method_signature) = "parent"; + } + + // 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. + rpc CreateMemoComment(CreateMemoCommentRequest) returns (Memo) { + option (google.api.http) = { + post: "/api/{parent=memos/*}/comments" + body: "comment" + }; + option (google.api.method_signature) = "parent,comment"; + } + + // ListMemoReactions lists the reactions on a memo. Requires read access to + // the memo. + rpc ListMemoReactions(ListMemoReactionsRequest) returns (ListMemoReactionsResponse) { + option (google.api.http) = {get: "/api/{parent=memos/*}/reactions"}; + option (google.api.method_signature) = "parent"; + } + + // DeleteMemoReaction deletes a reaction. Requires the reaction creator or an + // instance administrator. + rpc DeleteMemoReaction(DeleteMemoReactionRequest) returns (google.protobuf.Empty) { + option (google.api.http) = {delete: "/api/{name=memos/*/reactions/*}"}; + option (google.api.method_signature) = "name"; + } + + // UpsertMemoReaction adds or updates the authenticated user's reaction on a + // memo. Requires read access to the memo. + rpc UpsertMemoReaction(UpsertMemoReactionRequest) returns (Reaction) { + option (google.api.http) = { + post: "/api/{parent=memos/*}/reactions" + body: "*" + }; + option (google.api.method_signature) = "parent"; + } + + // ListMemoShares lists all share links for a memo. Requires the memo creator + // or an instance administrator. + rpc ListMemoShares(ListMemoSharesRequest) returns (ListMemoSharesResponse) { + option (google.api.http) = {get: "/api/{parent=memos/*}/shares"}; + option (google.api.method_signature) = "parent"; + } + + // 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. + rpc CreateMemoShare(CreateMemoShareRequest) returns (MemoShare) { + option (google.api.http) = { + post: "/api/{parent=memos/*}/shares" + body: "memo_share" + }; + option (google.api.method_signature) = "parent,memo_share"; + } + + // DeleteMemoShare revokes a share link. Requires the memo creator or an + // instance administrator. + rpc DeleteMemoShare(DeleteMemoShareRequest) returns (google.protobuf.Empty) { + option (google.api.http) = {delete: "/api/{name=memos/*/shares/*}"}; + option (google.api.method_signature) = "name"; + } + + // GetSharedMemo resolves a share token to its memo. No authentication is + // required. Returns NOT_FOUND if the token is invalid or expired. + rpc GetSharedMemo(GetSharedMemoRequest) returns (Memo) { + option (google.api.http) = {get: "/api/shares/{share_token}/memo"}; + } + + // GetLinkMetadata fetches the title, description, and image of a link. + rpc GetLinkMetadata(GetLinkMetadataRequest) returns (LinkMetadata) { + option (google.api.http) = {get: "/api/memos/-/linkMetadata"}; + } + + // BatchGetLinkMetadata fetches the metadata of up to 10 links. + rpc BatchGetLinkMetadata(BatchGetLinkMetadataRequest) returns (BatchGetLinkMetadataResponse) { + option (google.api.http) = { + post: "/api/memos/-/linkMetadata:batchGet" + body: "*" + }; + } +} + +// Visibility controls who can read a memo. +enum Visibility { + VISIBILITY_UNSPECIFIED = 0; + // Only the creator can read the memo. + PRIVATE = 1; + // Signed-in users of the instance can read the memo. + PROTECTED = 2; + // Signed-in users can read the memo; anonymous visitors can read it when + // instance policy permits. + PUBLIC = 3; + // Active members of the memo's space can read the memo. + SPACE = 4; +} + +// Memo is a Markdown note written by a user. +message Memo { + option (google.api.resource) = { + type: "memos.api/Memo" + pattern: "memos/{memo}" + singular: "memo" + plural: "memos" + }; + + // Identifier. The resource name of the memo, where memo is the + // user-defined UID. + // Format: memos/{memo} + string name = 1 [(google.api.field_behavior) = IDENTIFIER]; + + // Output only. The resource name of the creator. + // Format: users/{user} + string creator = 2 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.resource_reference) = {type: "memos.api/User"} + ]; + + // Optional. The space in which the memo is placed. Every memo, including a + // comment, owns its placement independently. + // Format: spaces/{space} + optional string space = 3 [ + (google.api.field_behavior) = OPTIONAL, + (google.api.resource_reference) = {type: "memos.api/Space"} + ]; + + // Required. The content of the memo in Markdown. Must not exceed the + // instance's content length limit. + string content = 4 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The location of the memo. + optional Location location = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Required. The visibility of the memo. Defaults to PRIVATE on creation when + // unspecified. SPACE requires the memo to be placed in a space. + Visibility visibility = 6 [(google.api.field_behavior) = REQUIRED]; + + // Required. The state of the memo. New memos are always NORMAL; change it + // with UpdateMemo. + State state = 7 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Whether the memo is pinned. Ignored on creation; change it with + // UpdateMemo. + bool pinned = 8 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The attachments of the memo. Setting it replaces the full set. + repeated Attachment attachments = 9 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The relations of the memo in both directions. Only REFERENCE + // relations can be set; COMMENT relations are output only. + repeated MemoRelation relations = 10 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. The reactions to the memo. + repeated Reaction reactions = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The context memo of this COMMENT relation, if any. + // Its identity is returned even when the caller cannot read the parent. + // Fetch the parent independently; this field does not grant read access. + // Format: memos/{memo} + optional string parent = 12 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.resource_reference) = {type: "memos.api/Memo"} + ]; + + // Output only. The tags extracted from the content. + repeated string tags = 13 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The properties computed from the content. + Property property = 14 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. A plain-text snippet of the content. + string snippet = 15 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. The creation time. Defaults to the current time when unset on + // creation. + google.protobuf.Timestamp create_time = 16 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The last update time. Defaults to the current time when unset on + // creation. + google.protobuf.Timestamp update_time = 17 [(google.api.field_behavior) = OPTIONAL]; + + // Property holds properties computed from the memo content. + message Property { + // The text of the H1 heading when it is the first block of the content. + string title = 1; + + // Whether the content contains a link. + bool has_link = 2; + + // Whether the content contains inline code or a code block. + bool has_code = 3; + + // Whether the content contains a task list. + bool has_task_list = 4; + + // Whether the content contains an unchecked task. + bool has_incomplete_tasks = 5; + } +} + +// Request message for MemoService.ListMemos. +message ListMemosRequest { + // Optional. The maximum number of memos to return. The service may return + // fewer. Defaults to 50; values above 1000 are coerced to 1000. + int32 page_size = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A page token from a previous call. Provide it to retrieve the + // next page. + string page_token = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A CEL expression to filter memos. Combine terms with && and ||. + // Available fields: + // content (string), creator (string, e.g. "users/1"), + // created_ts / updated_ts (timestamp), pinned (bool), + // visibility (string: PRIVATE | PROTECTED | PUBLIC | SPACE), + // space (string resource name, or null when the memo has no space; + // supports == and comparisons against null, e.g. space != null), + // tags (list; match with `"work" in tags`, not `tag == "work"`), + // has_task_list / has_link / has_code / has_incomplete_tasks (bool), + // has_location (bool; true when the memo has a location attached). + // Note: the time fields here are created_ts / updated_ts, which differ from + // the create_time / update_time names used by order_by. + // Examples: + // pinned == true && visibility == "PUBLIC" + // space == "spaces/team" or space == null + // tags.exists(t, t == "urgent") + // content.contains("roadmap") && created_ts > now - duration("168h") + string filter = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The order to sort results by, as a comma-separated list of + // fields following AIP-132. Defaults to "create_time desc". + // Supported fields: pinned, create_time, update_time, name. + // Example: "pinned desc, create_time desc" or "update_time asc". + // Note: order_by uses create_time / update_time, while the filter + // expression uses created_ts / updated_ts for the same timestamps. + string order_by = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Whether to include deleted memos. Currently ignored by the + // server. + bool show_deleted = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The state of the memos to list. Defaults to NORMAL. Set to + // ARCHIVED to list the caller's own archived memos. + State state = 6 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response message for MemoService.ListMemos. +message ListMemosResponse { + // The memos. + repeated Memo memos = 1; + + // A token to retrieve the next page. Empty when there are no more pages. + string next_page_token = 2; +} + +// Request message for MemoService.GetMemo. +message GetMemoRequest { + // Required. The resource name of the memo. + // Format: memos/{memo} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = {type: "memos.api/Memo"} + ]; +} + +// Request message for MemoService.CreateMemo. +message CreateMemoRequest { + // Required. The memo to create. + Memo memo = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The ID to use for the memo, which becomes the final segment of + // its resource name. If empty, a unique ID is generated. + // Format: ^[a-zA-Z0-9]([a-zA-Z0-9-]{0,34}[a-zA-Z0-9])?$ + string memo_id = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for MemoService.UpdateMemo. +message UpdateMemoRequest { + // Required. The memo to update. Its name identifies the memo. + Memo memo = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The fields to update. Supported paths: content, visibility, + // space, pinned, state, create_time, update_time, location, attachments, + // relations. + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for MemoService.DeleteMemo. +message DeleteMemoRequest { + // Required. The resource name of the memo to delete. + // Format: memos/{memo} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = {type: "memos.api/Memo"} + ]; + + // Optional. Currently ignored by the server; deletion always includes the + // comment subtree. + bool force = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// Location is a geographic location attached to a memo. +message Location { + // Optional. A human-readable label for the location. + string placeholder = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The latitude of the location. + double latitude = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The longitude of the location. + double longitude = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for MemoService.ListMemoAttachments. +message ListMemoAttachmentsRequest { + // Required. The resource name of the memo. + // Format: memos/{memo} + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = {type: "memos.api/Memo"} + ]; + + // Optional. The maximum number of attachments to return. The service may + // return fewer. Currently ignored; all attachments are returned. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A page token from a previous call. Provide it to retrieve the + // next page. Currently ignored. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response message for MemoService.ListMemoAttachments. +message ListMemoAttachmentsResponse { + // The attachments. + repeated Attachment attachments = 1; + + // A token to retrieve the next page. Empty when there are no more pages. + string next_page_token = 2; +} + +// Request message for MemoService.SetMemoAttachments. +message SetMemoAttachmentsRequest { + // Required. The resource name of the memo. + // Format: memos/{memo} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = {type: "memos.api/Memo"} + ]; + + // Required. The complete set of attachments for the memo. + repeated Attachment attachments = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// MemoRelation is a directed link from one memo to another. +message MemoRelation { + // Required. The source memo of the relation. For COMMENT, the comment. + MemoRef memo = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The target memo of the relation. For COMMENT, the memo being + // commented on. + MemoRef related_memo = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The type of the relation. + Type type = 3 [(google.api.field_behavior) = REQUIRED]; + + // Type is the kind of a memo relation. + enum Type { + TYPE_UNSPECIFIED = 0; + // The source memo references the target memo. Clients can set it. + REFERENCE = 1; + // The source memo is a comment on the target memo. Output only. + COMMENT = 2; + } + + // MemoRef identifies a memo in a relation. + message MemoRef { + // Required. The resource name of the memo. + // Format: memos/{memo} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = {type: "memos.api/Memo"} + ]; + + // Output only. A plain-text snippet of the memo content. Empty in + // ListMemos and ListMemoComments responses. + string snippet = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + } +} + +// Request message for MemoService.ListMemoRelations. +message ListMemoRelationsRequest { + // Required. The resource name of the memo. + // Format: memos/{memo} + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = {type: "memos.api/Memo"} + ]; + + // Optional. The maximum number of relations to return. The service may + // return fewer. Defaults to 50; values above 1000 are coerced to 1000. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A page token from a previous call. Provide it to retrieve the + // next page. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response message for MemoService.ListMemoRelations. +message ListMemoRelationsResponse { + // The relations. + repeated MemoRelation relations = 1; + + // A token to retrieve the next page. Empty when there are no more pages. + string next_page_token = 2; +} + +// Request message for MemoService.SetMemoRelations. +message SetMemoRelationsRequest { + // Required. The resource name of the memo. + // Format: memos/{memo} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = {type: "memos.api/Memo"} + ]; + + // Required. The complete set of REFERENCE relations for the memo. COMMENT + // relations are rejected. + repeated MemoRelation relations = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for MemoService.ListMemoComments. +message ListMemoCommentsRequest { + // Required. The resource name of the memo. + // Format: memos/{memo} + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = {type: "memos.api/Memo"} + ]; + + // Optional. The maximum number of comments to return. The service may return + // fewer. Defaults to 50; values above 1000 are coerced to 1000. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A page token from a previous call. Provide it to retrieve the + // next page. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The order to sort results by. Currently ignored by the server. + string order_by = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response message for MemoService.ListMemoComments. +message ListMemoCommentsResponse { + // The comment memos. + repeated Memo comments = 1; + + // A token to retrieve the next page. Empty when there are no more pages. + string next_page_token = 2; +} + +// Request message for MemoService.CreateMemoComment. +message CreateMemoCommentRequest { + // Required. The resource name of the memo to comment on. + // Format: memos/{memo} + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = {type: "memos.api/Memo"} + ]; + + // Required. The comment memo to create. + Memo comment = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The ID to use for the comment memo, in the same format as + // CreateMemoRequest.memo_id. If empty, a unique ID is generated. + string comment_id = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Reaction is a reaction a user leaves on a memo. +message Reaction { + option (google.api.resource) = { + type: "memos.api/Reaction" + pattern: "memos/{memo}/reactions/{reaction}" + singular: "reaction" + plural: "reactions" + }; + + // Identifier. The resource name of the reaction. + // Format: memos/{memo}/reactions/{reaction} + string name = 1 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.field_behavior) = IDENTIFIER + ]; + + // Output only. The resource name of the creator. + // Format: users/{user} + string creator = 2 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.resource_reference) = {type: "memos.api/User"} + ]; + + // Required. The reaction, such as an emoji ("👍", "❤️", "😄"). + string reaction_type = 3 [(google.api.field_behavior) = REQUIRED]; + + // Output only. The creation time. + google.protobuf.Timestamp create_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Request message for MemoService.ListMemoReactions. +message ListMemoReactionsRequest { + // Required. The resource name of the memo. + // Format: memos/{memo} + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = {type: "memos.api/Memo"} + ]; + + // Optional. The maximum number of reactions to return. The service may + // return fewer. Currently ignored; all reactions are returned. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A page token from a previous call. Provide it to retrieve the + // next page. Currently ignored. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response message for MemoService.ListMemoReactions. +message ListMemoReactionsResponse { + // The reactions. + repeated Reaction reactions = 1; + + // A token to retrieve the next page. Empty when there are no more pages. + string next_page_token = 2; +} + +// Request message for MemoService.DeleteMemoReaction. +message DeleteMemoReactionRequest { + // Required. The resource name of the reaction to delete. + // Format: memos/{memo}/reactions/{reaction} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = {type: "memos.api/Reaction"} + ]; +} + +// Request message for MemoService.UpsertMemoReaction. +message UpsertMemoReactionRequest { + // Required. The resource name of the memo. + // Format: memos/{memo} + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = {type: "memos.api/Memo"} + ]; + + // Required. The reaction to upsert. Only reaction_type is used. + Reaction reaction = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// MemoShare is an access grant that permits read-only access to a memo via an +// opaque bearer token. +message MemoShare { + option (google.api.resource) = { + type: "memos.api/MemoShare" + pattern: "memos/{memo}/shares/{share}" + singular: "memoShare" + plural: "memoShares" + }; + + // Identifier. The resource name of the share. The {share} segment is the + // opaque token used in the share URL. + // Format: memos/{memo}/shares/{share} + string name = 1 [(google.api.field_behavior) = IDENTIFIER]; + + // Output only. The creation time. + google.protobuf.Timestamp create_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. The time after which the share link stops working. Must be in + // the future when set. If unset, the link never expires. + optional google.protobuf.Timestamp expire_time = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for MemoService.ListMemoShares. +message ListMemoSharesRequest { + // Required. The resource name of the memo. + // Format: memos/{memo} + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = {type: "memos.api/Memo"} + ]; +} + +// Response message for MemoService.ListMemoShares. +message ListMemoSharesResponse { + // The share links. + repeated MemoShare memo_shares = 1; +} + +// Request message for MemoService.CreateMemoShare. +message CreateMemoShareRequest { + // Required. The resource name of the memo to share. + // Format: memos/{memo} + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = {type: "memos.api/Memo"} + ]; + + // Required. The share to create. Only expire_time is used. + MemoShare memo_share = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for MemoService.DeleteMemoShare. +message DeleteMemoShareRequest { + // Required. The resource name of the share to delete. + // Format: memos/{memo}/shares/{share} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = {type: "memos.api/MemoShare"} + ]; +} + +// Request message for MemoService.GetSharedMemo. +message GetSharedMemoRequest { + // Required. The opaque bearer token from the share URL. + string share_token = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// LinkMetadata is the preview metadata of a web link. +message LinkMetadata { + // The link URL as given in the request. + string url = 1; + + // The page title. + string title = 2; + + // The page description. + string description = 3; + + // The preview image URL. + string image = 4; +} + +// Request message for MemoService.GetLinkMetadata. +message GetLinkMetadataRequest { + // Required. The link URL. + string url = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for MemoService.BatchGetLinkMetadata. +message BatchGetLinkMetadataRequest { + // Required. The link URLs. At most 10. + repeated string urls = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// Response message for MemoService.BatchGetLinkMetadata. +message BatchGetLinkMetadataResponse { + // The link metadata, in the same order as the requested URLs. + repeated LinkMetadata link_metadata = 1; +} diff --git a/proto/api/space_service.proto b/proto/api/space_service.proto new file mode 100644 index 000000000..7686c9b42 --- /dev/null +++ b/proto/api/space_service.proto @@ -0,0 +1,474 @@ +syntax = "proto3"; + +package memos.api; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; + +option go_package = "gen/api"; + +// SpaceService manages collaborative spaces, their members and their invitations. +service SpaceService { + // ListSpaces lists the spaces of which the authenticated caller is a member. + rpc ListSpaces(ListSpacesRequest) returns (ListSpacesResponse) { + option (google.api.http) = {get: "/api/spaces"}; + option (google.api.method_signature) = ""; + } + + // GetSpace gets a space of which the authenticated caller is a member. + // Spaces the caller is not a member of are reported as not found. + rpc GetSpace(GetSpaceRequest) returns (Space) { + option (google.api.http) = {get: "/api/{name=spaces/*}"}; + option (google.api.method_signature) = "name"; + } + + // CreateSpace creates a space and makes the authenticated caller its first + // administrator. + rpc CreateSpace(CreateSpaceRequest) returns (Space) { + option (google.api.http) = { + post: "/api/spaces" + body: "space" + }; + option (google.api.method_signature) = "space"; + } + + // UpdateSpace updates space metadata. Only a space administrator can update + // a space. + rpc UpdateSpace(UpdateSpaceRequest) returns (Space) { + option (google.api.http) = { + patch: "/api/{space.name=spaces/*}" + body: "space" + }; + option (google.api.method_signature) = "space,update_mask"; + } + + // DeleteSpace permanently deletes a space and every memo currently placed + // in it. It never follows memo relations to other memos. Only a space + // administrator can delete a space. + rpc DeleteSpace(DeleteSpaceRequest) returns (google.protobuf.Empty) { + option (google.api.http) = {delete: "/api/{name=spaces/*}"}; + option (google.api.method_signature) = "name"; + } + + // ListSpaceMembers lists the members of a space. The caller must be a member + // of the space. + rpc ListSpaceMembers(ListSpaceMembersRequest) returns (ListSpaceMembersResponse) { + option (google.api.http) = {get: "/api/{parent=spaces/*}/members"}; + option (google.api.method_signature) = "parent"; + } + + // GetSpaceMember gets one membership in a space. The caller must be a member + // of the space. + rpc GetSpaceMember(GetSpaceMemberRequest) returns (SpaceMember) { + option (google.api.http) = {get: "/api/{name=spaces/*/members/*}"}; + option (google.api.method_signature) = "name"; + } + + // UpdateSpaceMember changes a member's space role. Only a space administrator + // can change roles, and a space must keep at least one administrator. + rpc UpdateSpaceMember(UpdateSpaceMemberRequest) returns (SpaceMember) { + option (google.api.http) = { + patch: "/api/{space_member.name=spaces/*/members/*}" + body: "space_member" + }; + option (google.api.method_signature) = "space_member,update_mask"; + } + + // DeleteSpaceMember removes a member. A space administrator can remove any + // member, and a member may delete their own membership to leave the space. + // A space must keep at least one administrator. + rpc DeleteSpaceMember(DeleteSpaceMemberRequest) returns (google.protobuf.Empty) { + option (google.api.http) = {delete: "/api/{name=spaces/*/members/*}"}; + option (google.api.method_signature) = "name"; + } + + // ListSpaceInvitations lists the pending invitations for a space. Only a + // space administrator can list them. + rpc ListSpaceInvitations(ListSpaceInvitationsRequest) returns (ListSpaceInvitationsResponse) { + option (google.api.http) = {get: "/api/{parent=spaces/*}/invitations"}; + option (google.api.method_signature) = "parent"; + } + + // ListUserSpaceInvitations lists the authenticated user's pending space + // invitations. A user cannot list another user's invitations. + rpc ListUserSpaceInvitations(ListUserSpaceInvitationsRequest) returns (ListUserSpaceInvitationsResponse) { + option (google.api.http) = {get: "/api/{parent=users/*}/spaceInvitations"}; + option (google.api.method_signature) = "parent"; + } + + // GetSpaceInvitation gets one pending invitation. Only the invitee or a + // space administrator can get it. + rpc GetSpaceInvitation(GetSpaceInvitationRequest) returns (SpaceInvitation) { + option (google.api.http) = {get: "/api/{name=spaces/*/invitations/*}"}; + option (google.api.method_signature) = "name"; + } + + // CreateSpaceInvitation invites an existing active user to a space. Only a + // space administrator can invite. The invitee gets no space access until + // they accept. + rpc CreateSpaceInvitation(CreateSpaceInvitationRequest) returns (SpaceInvitation) { + option (google.api.http) = { + post: "/api/{parent=spaces/*}/invitations" + body: "space_invitation" + }; + option (google.api.method_signature) = "parent,space_invitation"; + } + + // DeleteSpaceInvitation revokes a pending invitation. Only a space + // administrator can revoke it. + rpc DeleteSpaceInvitation(DeleteSpaceInvitationRequest) returns (google.protobuf.Empty) { + option (google.api.http) = {delete: "/api/{name=spaces/*/invitations/*}"}; + option (google.api.method_signature) = "name"; + } + + // AcceptSpaceInvitation accepts a pending invitation and creates a + // membership with the invited role. Only the invitee can accept it. + rpc AcceptSpaceInvitation(AcceptSpaceInvitationRequest) returns (SpaceMember) { + option (google.api.http) = { + post: "/api/{name=spaces/*/invitations/*}:accept" + body: "*" + }; + option (google.api.method_signature) = "name"; + } + + // DeclineSpaceInvitation declines a pending invitation without creating a + // membership. Only the invitee can decline it. + rpc DeclineSpaceInvitation(DeclineSpaceInvitationRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + post: "/api/{name=spaces/*/invitations/*}:decline" + body: "*" + }; + option (google.api.method_signature) = "name"; + } +} + +// Space is a collaboration boundary for placed memos. +message Space { + option (google.api.resource) = { + type: "memos.api/Space" + pattern: "spaces/{space}" + singular: "space" + plural: "spaces" + }; + + // Identifier. The resource name of the space. + // Format: spaces/{space} + string name = 1 [(google.api.field_behavior) = IDENTIFIER]; + + // Required. The human-readable title. + string title = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. A description of the space. + string description = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The display icon. Omit it when updating with the "icon" mask to + // reset to the default space mark. + Icon icon = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. The authenticated user's membership role in this space. + // ROLE_UNSPECIFIED when this space is exposed as metadata only. + SpaceMember.Role current_user_role = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The number of accepted members in this space. Pending + // invitations are excluded. Zero when this space is exposed as metadata only. + int32 member_count = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Icon is the display icon of a space. + message Icon { + // The icon value. + oneof value { + // A Unicode emoji sequence. + string emoji = 1; + + // A canonical Lucide icon name, such as "leaf". + string lucide = 2; + } + } +} + +// Request message for SpaceService.ListSpaces. +message ListSpacesRequest { + // Optional. The maximum number of spaces to return. The service may return fewer. + int32 page_size = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A page token from a previous call. Provide it to retrieve the next page. + string page_token = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response message for SpaceService.ListSpaces. +message ListSpacesResponse { + // The spaces of which the caller is a member. + repeated Space spaces = 1; + + // A token to retrieve the next page. Empty when there are no more pages. + string next_page_token = 2; +} + +// Request message for SpaceService.GetSpace. +message GetSpaceRequest { + // Required. The resource name of the space. + // Format: spaces/{space} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = {type: "memos.api/Space"} + ]; +} + +// Request message for SpaceService.CreateSpace. +message CreateSpaceRequest { + // Required. The space to create. + Space space = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The ID to use for the space, which becomes the final segment of + // its resource name. If empty, a UUID v4 is generated. Must match + // ^[a-zA-Z0-9]([a-zA-Z0-9-]{0,34}[a-zA-Z0-9])?$. + string space_id = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for SpaceService.UpdateSpace. +message UpdateSpaceRequest { + // Required. The space with updated values. Its name identifies the space to + // update. + Space space = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The fields to update. Supported paths: title, description, icon. + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for SpaceService.DeleteSpace. +message DeleteSpaceRequest { + // Required. The resource name of the space. + // Format: spaces/{space} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = {type: "memos.api/Space"} + ]; +} + +// SpaceMember is a user's membership and governance role in a space. +message SpaceMember { + option (google.api.resource) = { + type: "memos.api/SpaceMember" + pattern: "spaces/{space}/members/{member}" + singular: "spaceMember" + plural: "spaceMembers" + }; + + // Identifier. The resource name of the membership. The member segment is + // the member's username. + // Format: spaces/{space}/members/{member} + string name = 1 [(google.api.field_behavior) = IDENTIFIER]; + + // Required. The member user. + // Format: users/{user} + string user = 2 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = {type: "memos.api/User"} + ]; + + // Required. The member's role within this space. + Role role = 3 [(google.api.field_behavior) = REQUIRED]; + + // Role is a member's governance role within a space. + enum Role { + ROLE_UNSPECIFIED = 0; + // Can update and delete the space, manage members and manage invitations. + ADMIN = 1; + // A regular member without governance permissions. + USER = 2; + } +} + +// Request message for SpaceService.ListSpaceMembers. +message ListSpaceMembersRequest { + // Required. The parent space. + // Format: spaces/{space} + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = {child_type: "memos.api/SpaceMember"} + ]; + + // Optional. The maximum number of members to return. The service may return fewer. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A page token from a previous call. Provide it to retrieve the next page. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response message for SpaceService.ListSpaceMembers. +message ListSpaceMembersResponse { + // The members of the space. + repeated SpaceMember space_members = 1; + + // A token to retrieve the next page. Empty when there are no more pages. + string next_page_token = 2; +} + +// Request message for SpaceService.GetSpaceMember. +message GetSpaceMemberRequest { + // Required. The resource name of the membership. + // Format: spaces/{space}/members/{member} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = {type: "memos.api/SpaceMember"} + ]; +} + +// Request message for SpaceService.UpdateSpaceMember. +message UpdateSpaceMemberRequest { + // Required. The membership with the new role. Its name identifies the + // membership to update. + SpaceMember space_member = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The fields to update. Must include role. The user path is also + // accepted, but the user must match the existing member and is never changed. + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for SpaceService.DeleteSpaceMember. +message DeleteSpaceMemberRequest { + // Required. The resource name of the membership. + // Format: spaces/{space}/members/{member} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = {type: "memos.api/SpaceMember"} + ]; +} + +// SpaceInvitation is a pending invitation for an existing user to join a space. +message SpaceInvitation { + option (google.api.resource) = { + type: "memos.api/SpaceInvitation" + pattern: "spaces/{space}/invitations/{invitation}" + singular: "spaceInvitation" + plural: "spaceInvitations" + }; + + // Identifier. The resource name of the invitation. The invitation segment + // is the invitee's username. + // Format: spaces/{space}/invitations/{invitation} + string name = 1 [(google.api.field_behavior) = IDENTIFIER]; + + // Required. The invited user. + // Format: users/{user} + string invitee = 2 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = {type: "memos.api/User"} + ]; + + // Required. The role the user receives after accepting the invitation. + SpaceMember.Role role = 3 [(google.api.field_behavior) = REQUIRED]; + + // Output only. The space the user is invited to, as metadata only. This lets + // an invitee understand the invitation without membership-based GetSpace + // access. + Space space = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Request message for SpaceService.ListSpaceInvitations. +message ListSpaceInvitationsRequest { + // Required. The parent space. + // Format: spaces/{space} + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = {child_type: "memos.api/SpaceInvitation"} + ]; + + // Optional. The maximum number of invitations to return. The service may return fewer. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A page token from a previous call. Provide it to retrieve the next page. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response message for SpaceService.ListSpaceInvitations. +message ListSpaceInvitationsResponse { + // The pending invitations for the space. + repeated SpaceInvitation space_invitations = 1; + + // A token to retrieve the next page. Empty when there are no more pages. + string next_page_token = 2; +} + +// Request message for SpaceService.ListUserSpaceInvitations. +message ListUserSpaceInvitationsRequest { + // Required. The user whose invitations to list. Must be the authenticated + // user. + // Format: users/{user} + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = {type: "memos.api/User"} + ]; + + // Optional. The maximum number of invitations to return. The service may return fewer. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A page token from a previous call. Provide it to retrieve the next page. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response message for SpaceService.ListUserSpaceInvitations. +message ListUserSpaceInvitationsResponse { + // The pending invitations received by the user. + repeated SpaceInvitation space_invitations = 1; + + // A token to retrieve the next page. Empty when there are no more pages. + string next_page_token = 2; +} + +// Request message for SpaceService.GetSpaceInvitation. +message GetSpaceInvitationRequest { + // Required. The resource name of the invitation. + // Format: spaces/{space}/invitations/{invitation} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = {type: "memos.api/SpaceInvitation"} + ]; +} + +// Request message for SpaceService.CreateSpaceInvitation. +message CreateSpaceInvitationRequest { + // Required. The parent space. + // Format: spaces/{space} + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = {child_type: "memos.api/SpaceInvitation"} + ]; + + // Required. The invitation to create. The role must be ADMIN or USER. + SpaceInvitation space_invitation = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for SpaceService.DeleteSpaceInvitation. +message DeleteSpaceInvitationRequest { + // Required. The resource name of the invitation. + // Format: spaces/{space}/invitations/{invitation} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = {type: "memos.api/SpaceInvitation"} + ]; +} + +// Request message for SpaceService.AcceptSpaceInvitation. +message AcceptSpaceInvitationRequest { + // Required. The resource name of the invitation. + // Format: spaces/{space}/invitations/{invitation} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = {type: "memos.api/SpaceInvitation"} + ]; +} + +// Request message for SpaceService.DeclineSpaceInvitation. +message DeclineSpaceInvitationRequest { + // Required. The resource name of the invitation. + // Format: spaces/{space}/invitations/{invitation} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = {type: "memos.api/SpaceInvitation"} + ]; +} diff --git a/proto/api/user_service.proto b/proto/api/user_service.proto new file mode 100644 index 000000000..a2253dd30 --- /dev/null +++ b/proto/api/user_service.proto @@ -0,0 +1,1387 @@ +syntax = "proto3"; + +package memos.api; + +import "api/common.proto"; +import "api/space_service.proto"; +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/httpbody.proto"; +import "google/api/resource.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; +import "google/type/color.proto"; + +option go_package = "gen/api"; + +// UserService manages users and the resources they own: settings, statistics, +// memo views, notifications, webhooks, linked identities, personal access +// tokens, and memo export files. +service UserService { + // ListUsers lists users in every state. Only admins may call it. + rpc ListUsers(ListUsersRequest) returns (ListUsersResponse) { + option (google.api.http) = {get: "/api/users"}; + } + + // GetUser gets a user by resource name. + rpc GetUser(GetUserRequest) returns (User) { + option (google.api.http) = {get: "/api/{name=users/*}"}; + option (google.api.method_signature) = "name"; + } + + // BatchGetUsers gets active users by username. Usernames that match no + // active user are omitted from the response. + rpc BatchGetUsers(BatchGetUsersRequest) returns (BatchGetUsersResponse) { + option (google.api.http) = { + post: "/api/users:batchGet" + body: "*" + }; + } + + // 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. + rpc CreateUser(CreateUserRequest) returns (User) { + option (google.api.http) = { + post: "/api/users" + body: "user" + }; + option (google.api.method_signature) = "user,user_id"; + } + + // UpdateUser updates a user. Users may update themselves; admins may update + // anyone. Changing the password ends the user's other sessions. + rpc UpdateUser(UpdateUserRequest) returns (User) { + option (google.api.http) = { + patch: "/api/{user.name=users/*}" + body: "user" + }; + option (google.api.method_signature) = "user,update_mask"; + } + + // DeleteUser deletes a user. Users may delete themselves; admins may delete + // anyone. A user who belongs to any space cannot be deleted. + rpc DeleteUser(DeleteUserRequest) returns (google.protobuf.Empty) { + option (google.api.http) = {delete: "/api/{name=users/*}"}; + option (google.api.method_signature) = "name"; + } + + // 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. + rpc ListUserSettings(ListUserSettingsRequest) returns (ListUserSettingsResponse) { + option (google.api.http) = {get: "/api/{parent=users/*}/settings"}; + option (google.api.method_signature) = "parent"; + } + + // GetUserSetting gets a user setting. Only the user may call it. + rpc GetUserSetting(GetUserSettingRequest) returns (UserSetting) { + option (google.api.http) = {get: "/api/{name=users/*/settings/*}"}; + option (google.api.method_signature) = "name"; + } + + // UpdateUserSetting updates a user setting. Only the user may call it, and + // only the GENERAL and TAGS settings can be updated. + rpc UpdateUserSetting(UpdateUserSettingRequest) returns (UserSetting) { + option (google.api.http) = { + patch: "/api/{user_setting.name=users/*/settings/*}" + body: "user_setting" + }; + option (google.api.method_signature) = "user_setting,update_mask"; + } + + // 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. + rpc ListUserStats(ListUserStatsRequest) returns (ListUserStatsResponse) { + option (google.api.http) = {get: "/api/{parent=users/*}/stats"}; + option (google.api.method_signature) = "parent"; + } + + // GetUserStats returns memo statistics for one user, counting the user's + // memos that the caller can read. + rpc GetUserStats(GetUserStatsRequest) returns (UserStats) { + option (google.api.http) = {get: "/api/{name=users/*}:getStats"}; + option (google.api.method_signature) = "name"; + } + + // 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. + rpc ListMemoViews(ListMemoViewsRequest) returns (ListMemoViewsResponse) { + option (google.api.http) = {get: "/api/{parent=users/*}/views"}; + option (google.api.method_signature) = "parent"; + } + + // GetMemoView gets a memo view. Only the owner may call it. + rpc GetMemoView(GetMemoViewRequest) returns (MemoView) { + option (google.api.http) = {get: "/api/{name=users/*/views/*}"}; + option (google.api.method_signature) = "name"; + } + + // CreateMemoView creates a memo view for a user. Only the user may call it. + rpc CreateMemoView(CreateMemoViewRequest) returns (MemoView) { + option (google.api.http) = { + post: "/api/{parent=users/*}/views" + body: "memo_view" + }; + option (google.api.method_signature) = "parent,memo_view"; + } + + // UpdateMemoView updates a memo view. Only the owner may call it. + rpc UpdateMemoView(UpdateMemoViewRequest) returns (MemoView) { + option (google.api.http) = { + patch: "/api/{memo_view.name=users/*/views/*}" + body: "memo_view" + }; + option (google.api.method_signature) = "memo_view,update_mask"; + } + + // DeleteMemoView deletes a memo view. Only the owner may call it. + rpc DeleteMemoView(DeleteMemoViewRequest) returns (google.protobuf.Empty) { + option (google.api.http) = {delete: "/api/{name=users/*/views/*}"}; + option (google.api.method_signature) = "name"; + } + + // 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. + rpc ListUserNotifications(ListUserNotificationsRequest) returns (ListUserNotificationsResponse) { + option (google.api.http) = {get: "/api/{parent=users/*}/notifications"}; + option (google.api.method_signature) = "parent"; + } + + // UpdateUserNotification updates a notification's status. Only the receiver + // may call it. + rpc UpdateUserNotification(UpdateUserNotificationRequest) returns (UserNotification) { + option (google.api.http) = { + patch: "/api/{notification.name=users/*/notifications/*}" + body: "notification" + }; + option (google.api.method_signature) = "notification,update_mask"; + } + + // DeleteUserNotification permanently deletes a notification. Only the + // receiver may call it. + rpc DeleteUserNotification(DeleteUserNotificationRequest) returns (google.protobuf.Empty) { + option (google.api.http) = {delete: "/api/{name=users/*/notifications/*}"}; + option (google.api.method_signature) = "name"; + } + + // ListUserWebhooks lists a user's webhooks. Only the user may call it. + rpc ListUserWebhooks(ListUserWebhooksRequest) returns (ListUserWebhooksResponse) { + option (google.api.http) = {get: "/api/{parent=users/*}/webhooks"}; + option (google.api.method_signature) = "parent"; + } + + // CreateUserWebhook creates a webhook for a user. Only the user may call it. + // The service generates a signing secret when none is given. + rpc CreateUserWebhook(CreateUserWebhookRequest) returns (UserWebhook) { + option (google.api.http) = { + post: "/api/{parent=users/*}/webhooks" + body: "webhook" + }; + option (google.api.method_signature) = "parent,webhook"; + } + + // UpdateUserWebhook updates a webhook. Only the owner may call it. + rpc UpdateUserWebhook(UpdateUserWebhookRequest) returns (UserWebhook) { + option (google.api.http) = { + patch: "/api/{webhook.name=users/*/webhooks/*}" + body: "webhook" + }; + option (google.api.method_signature) = "webhook,update_mask"; + } + + // DeleteUserWebhook deletes a webhook. Only the owner may call it. + rpc DeleteUserWebhook(DeleteUserWebhookRequest) returns (google.protobuf.Empty) { + option (google.api.http) = {delete: "/api/{name=users/*/webhooks/*}"}; + option (google.api.method_signature) = "name"; + } + + // 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. + rpc GetUserWebhookSigningSecret(GetUserWebhookSigningSecretRequest) returns (GetUserWebhookSigningSecretResponse) { + option (google.api.http) = {get: "/api/{name=users/*/webhooks/*}:getSigningSecret"}; + option (google.api.method_signature) = "name"; + } + + // ListLinkedIdentities lists the SSO identities linked to a user. The user + // and admins may call it. + rpc ListLinkedIdentities(ListLinkedIdentitiesRequest) returns (ListLinkedIdentitiesResponse) { + option (google.api.http) = {get: "/api/{parent=users/*}/linkedIdentities"}; + option (google.api.method_signature) = "parent"; + } + + // GetLinkedIdentity gets an SSO identity linked to a user. The user and + // admins may call it. + rpc GetLinkedIdentity(GetLinkedIdentityRequest) returns (LinkedIdentity) { + option (google.api.http) = {get: "/api/{name=users/*/linkedIdentities/*}"}; + option (google.api.method_signature) = "name"; + } + + // CreateLinkedIdentity completes an OAuth flow and links the resulting SSO + // identity to the authenticated user, who must be the parent. + rpc CreateLinkedIdentity(CreateLinkedIdentityRequest) returns (LinkedIdentity) { + option (google.api.http) = { + post: "/api/{parent=users/*}/linkedIdentities" + body: "*" + }; + option (google.api.method_signature) = "parent,identity_provider"; + } + + // DeleteLinkedIdentity unlinks an SSO identity from a user. The user and + // admins may call it. + rpc DeleteLinkedIdentity(DeleteLinkedIdentityRequest) returns (google.protobuf.Empty) { + option (google.api.http) = {delete: "/api/{name=users/*/linkedIdentities/*}"}; + option (google.api.method_signature) = "name"; + } + + // 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. + rpc ListPersonalAccessTokens(ListPersonalAccessTokensRequest) returns (ListPersonalAccessTokensResponse) { + option (google.api.http) = {get: "/api/{parent=users/*}/personalAccessTokens"}; + option (google.api.method_signature) = "parent"; + } + + // 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. + rpc CreatePersonalAccessToken(CreatePersonalAccessTokenRequest) returns (CreatePersonalAccessTokenResponse) { + option (google.api.http) = { + post: "/api/{parent=users/*}/personalAccessTokens" + body: "*" + }; + } + + // DeletePersonalAccessToken deletes a personal access token, which stops + // working immediately. Only the owner may call it. + rpc DeletePersonalAccessToken(DeletePersonalAccessTokenRequest) returns (google.protobuf.Empty) { + option (google.api.http) = {delete: "/api/{name=users/*/personalAccessTokens/*}"}; + option (google.api.method_signature) = "name"; + } + + // ExportMemos writes every memo the user created, with comments, archived + // memos, and attachment files, as a Memos export file (a ZIP file, see + // docs/design/memos-export-format.md). Only the user may export their own + // memos. The body is the archive; content_type is its media type. + rpc ExportMemos(ExportMemosRequest) returns (google.api.HttpBody) { + option (google.api.http) = {get: "/api/{name=users/*}:exportMemos"}; + option (google.api.method_signature) = "name"; + } + + // 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. + rpc ImportMemos(ImportMemosRequest) returns (ImportMemosResponse) { + option (google.api.http) = { + post: "/api/{name=users/*}:importMemos" + body: "*" + }; + } +} + +// User is an account on the instance. +message User { + option (google.api.resource) = { + type: "memos.api/User" + pattern: "users/{user}" + singular: "user" + plural: "users" + }; + + // Identifier. The resource name of the user. {user} is the username. + // Format: users/{user} + string name = 1 [(google.api.field_behavior) = IDENTIFIER]; + + // Required. The unique username, used to sign in. + string username = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The display name of the user. + string display_name = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The email address of the user. Stored trimmed and lowercased; + // empty means no address. An address belongs to at most one user on the + // instance, so writes that would reuse one fail with ALREADY_EXISTS. + // Returned only to the user and to admins. + string email = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The avatar URL of the user. An avatar set as a data URI (PNG, + // JPEG, GIF or WebP, at most 2 MiB) is returned as a file server URL. + string avatar_url = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The description of the user. + string description = 6 [(google.api.field_behavior) = OPTIONAL]; + + // Input only. The password of the user. Never returned. + string password = 7 [(google.api.field_behavior) = INPUT_ONLY]; + + // Required. The role of the user. Only admins can change it. + Role role = 8 [(google.api.field_behavior) = REQUIRED]; + + // Required. The state of the user. Only admins can change it. + State state = 9 [(google.api.field_behavior) = REQUIRED]; + + // Output only. The creation timestamp. + google.protobuf.Timestamp create_time = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The last update timestamp. + google.protobuf.Timestamp update_time = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Role is the instance-wide role of a user. + enum Role { + ROLE_UNSPECIFIED = 0; + // An administrator of the instance. + ADMIN = 2; + // A regular user. + USER = 3; + } +} + +// Request message for UserService.ListUsers. +message ListUsersRequest { + // Optional. The maximum number of users to return. The service may return + // fewer. If unspecified, at most 50 users are returned. The maximum value is + // 1000; values above 1000 are coerced to 1000. + int32 page_size = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A page token from a previous call. Provide it to retrieve the + // next page. + string page_token = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A CEL filter on the users. Only `username == ''` is + // supported. + // Example: "username == 'steven'" + string filter = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Currently ignored; the list includes users in every state. + bool show_deleted = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response message for UserService.ListUsers. +message ListUsersResponse { + // The users. + repeated User users = 1; + + // A token to retrieve the next page. Empty when there are no more pages. + string next_page_token = 2; +} + +// Request message for UserService.GetUser. +message GetUserRequest { + // Required. The resource name of the user. + // Format: users/{user} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = {type: "memos.api/User"} + ]; + + // Optional. Currently ignored; all fields are returned. + google.protobuf.FieldMask read_mask = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for UserService.BatchGetUsers. +message BatchGetUsersRequest { + // Required. The resource names of the users to get. Empty and duplicate + // entries are ignored. At most 100 non-empty names are allowed. + // Format: users/{user} + repeated string names = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = {type: "memos.api/User"} + ]; +} + +// Response message for UserService.BatchGetUsers. +message BatchGetUsersResponse { + // The active users that match the requested names. + repeated User users = 1; +} + +// Request message for UserService.CreateUser. +message CreateUserRequest { + // Required. The user to create. username and password are required; role + // is honored only when an admin calls the method. + User user = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.field_behavior) = INPUT_ONLY + ]; + + // Optional. The resource ID to use for this user. If set, it must equal + // user.username and follow the username format. + // Format: ^[a-zA-Z0-9]([a-zA-Z0-9-]{0,34}[a-zA-Z0-9])?$ + string user_id = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. If set, validate the request but do not create the user. + bool validate_only = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. An idempotency token. Currently ignored. + string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for UserService.UpdateUser. +message UpdateUserRequest { + // Required. The user to update. Its name identifies the user. + User user = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The fields to update. Supported paths: username, display_name, + // email, avatar_url, description, password, role, state. role and state + // require an admin. + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Currently ignored; updating a missing user fails with NOT_FOUND. + bool allow_missing = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for UserService.DeleteUser. +message DeleteUserRequest { + // Required. The resource name of the user to delete. + // Format: users/{user} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = {type: "memos.api/User"} + ]; + + // Optional. Currently ignored; deleting a user who belongs to any space + // fails with FAILED_PRECONDITION. + bool force = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// UserSetting is one group of a user's preferences, identified by its key. +message UserSetting { + option (google.api.resource) = { + type: "memos.api/UserSetting" + pattern: "users/{user}/settings/{setting}" + singular: "userSetting" + plural: "userSettings" + }; + + // Identifier. The resource name of the user setting. {setting} is the + // setting key, such as GENERAL. + // Format: users/{user}/settings/{setting} + string name = 1 [(google.api.field_behavior) = IDENTIFIER]; + + // The setting value. The set field matches the setting key. + oneof value { + // The value of the GENERAL setting. + GeneralSetting general_setting = 2; + + // The value of the WEBHOOKS setting. + WebhooksSetting webhooks_setting = 3; + + // The value of the TAGS setting. + TagsSetting tags_setting = 4; + } + + // Key identifies a user setting. + enum Key { + KEY_UNSPECIFIED = 0; + // General user preferences. + GENERAL = 1; + // The user's webhooks. + WEBHOOKS = 4; + // Per-user tag metadata. + TAGS = 5; + } + + // GeneralSetting holds general user preferences. + message GeneralSetting { + // Optional. The preferred locale of the user. + string locale = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The default visibility of new memos: PRIVATE, PROTECTED or + // PUBLIC. + string memo_visibility = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The preferred theme of the user. This references a CSS file in + // the web/public/themes/ directory. If not set, the default theme is used. + string theme = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Whether the official client should save metadata from future + // media uploads. + bool save_media_metadata = 4 [(google.api.field_behavior) = OPTIONAL]; + } + + // WebhooksSetting holds a user's webhooks. + message WebhooksSetting { + // The user's webhooks. + repeated UserWebhook webhooks = 1; + } + + // TagsSetting holds user-specific tag metadata. + message TagsSetting { + // Optional. Map of tag name pattern to tag metadata. Each key is treated as + // an anchored regular expression (^pattern$). + map tags = 1 [(google.api.field_behavior) = OPTIONAL]; + } + + // TagMetadata holds user-specific display rules for a tag. + message TagMetadata { + // Optional. The background color of the tag label. When unset, the default + // tag color is used. + google.type.Color background_color = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Whether memos with this tag have their content blurred. + bool blur_content = 2 [(google.api.field_behavior) = OPTIONAL]; + } +} + +// Request message for UserService.ListUserSettings. +message ListUserSettingsRequest { + // Required. The user whose settings are listed. + // Format: users/{user} + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = {type: "memos.api/User"} + ]; + + // Optional. The maximum number of settings to return. The service may return + // fewer. Currently ignored; all settings are returned in one page. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A page token from a previous call. Provide it to retrieve the + // next page. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response message for UserService.ListUserSettings. +message ListUserSettingsResponse { + // The user settings. + repeated UserSetting user_settings = 1; + + // A token to retrieve the next page. Empty when there are no more pages. + string next_page_token = 2; +} + +// Request message for UserService.GetUserSetting. +message GetUserSettingRequest { + // Required. The resource name of the user setting. + // Format: users/{user}/settings/{setting} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = {type: "memos.api/UserSetting"} + ]; +} + +// Request message for UserService.UpdateUserSetting. +message UpdateUserSettingRequest { + // Required. The user setting to update. Its name identifies the setting. + UserSetting user_setting = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The fields to update, relative to the setting value. GENERAL + // supports locale, memo_visibility, theme and save_media_metadata; TAGS + // supports tags. + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// UserStats is a summary of a user's memos. Comments are not counted. +message UserStats { + option (google.api.resource) = { + type: "memos.api/UserStats" + pattern: "users/{user}/stats" + singular: "userStats" + plural: "userStats" + }; + + // Identifier. The resource name of the user statistics singleton. + // Format: users/{user}/stats + string name = 1 [(google.api.field_behavior) = IDENTIFIER]; + + // The number of counted memos. + int32 total_memo_count = 2; + + // The number of counted memos by content type. + MemoTypeStats memo_type_stats = 3; + + // The number of counted memos per tag. + map tag_counts = 4; + + // The pinned memos among the counted memos. + // Format: memos/{memo} + repeated string pinned_memos = 5 [(google.api.resource_reference) = {type: "memos.api/Memo"}]; + + // The creation timestamps of the counted memos, one per memo. + repeated google.protobuf.Timestamp memo_created_timestamps = 6; + + // The latest update timestamps of the counted memos (one per memo, mirrors + // memo_created_timestamps). Used by the activity heatmap when the client's + // view is set to update_time basis. + repeated google.protobuf.Timestamp memo_updated_timestamps = 7; + + // Output only. Total persisted attachment size in bytes, including unlinked + // uploads and attachments in all spaces. Excludes temporary uploads and + // derived files. Returned only by GetUserStats for the authenticated user's + // own stats, independently of the request's memo filter. + optional int64 attachment_storage_bytes = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // MemoTypeStats counts memos by the kind of content they contain. + message MemoTypeStats { + // The number of memos that contain a link. + int32 link_count = 1; + + // The number of memos that contain code. + int32 code_count = 2; + + // The number of memos that contain a task list. + int32 todo_count = 3; + + // The number of memos that contain incomplete tasks. + int32 undo_count = 4; + } +} + +// Request message for UserService.ListUserStats. +message ListUserStatsRequest { + // Required. The users to list statistics for: users/- for all users, or + // users/{user} for one user. + // Format: users/{user} + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = {child_type: "memos.api/UserStats"} + ]; + + // Optional. A CEL expression selecting the memos to count. Uses the same + // filter syntax as ListMemos. + string filter = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The state of the memos to count. Defaults to NORMAL. ARCHIVED + // counts only the caller's own memos. + State state = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response message for UserService.ListUserStats. +message ListUserStatsResponse { + // The statistics, one entry per user. + repeated UserStats user_stats = 1; +} + +// Request message for UserService.GetUserStats. +message GetUserStatsRequest { + // Required. The resource name of the user. + // Format: users/{user} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = {type: "memos.api/User"} + ]; + + // Optional. A CEL expression selecting the readable non-comment memos to + // count. Supports the same fields as ListMemos, including `space`. + string filter = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// MemoView is a user's saved memo filter. +message MemoView { + option (google.api.resource) = { + type: "memos.api/MemoView" + pattern: "users/{user}/views/{view}" + singular: "memoView" + plural: "memoViews" + }; + + // Identifier. The resource name of the memo view. + // Format: users/{user}/views/{view} + string name = 1 [(google.api.field_behavior) = IDENTIFIER]; + + // Required. The title of the memo view. + string title = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The CEL filter expression for the memo view, using the same + // grammar as the ListMemos `filter` argument. Reuse it by passing this value + // to ListMemos. + string filter = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Display icon. Omit when updating with the "icon" mask to reset to + // the default view icon. + Icon icon = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Icon is the display icon of a memo view. + message Icon { + // The icon value. + oneof value { + // A Unicode emoji sequence. + string emoji = 1; + + // A canonical Lucide icon name, such as "leaf". + string lucide = 2; + } + } +} + +// Request message for UserService.ListMemoViews. +message ListMemoViewsRequest { + // Required. The user whose memo views are listed. + // Format: users/{user} + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = {child_type: "memos.api/MemoView"} + ]; +} + +// Response message for UserService.ListMemoViews. +message ListMemoViewsResponse { + // The memo views. + repeated MemoView memo_views = 1; +} + +// Request message for UserService.GetMemoView. +message GetMemoViewRequest { + // Required. The resource name of the memo view. + // Format: users/{user}/views/{view} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = {type: "memos.api/MemoView"} + ]; +} + +// Request message for UserService.CreateMemoView. +message CreateMemoViewRequest { + // Required. The user who owns the memo view. + // Format: users/{user} + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = {child_type: "memos.api/MemoView"} + ]; + + // Required. The memo view to create. + MemoView memo_view = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. If set, validate the request but do not create the memo view. + bool validate_only = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for UserService.UpdateMemoView. +message UpdateMemoViewRequest { + // Required. The memo view to update. Its name identifies the memo view. + MemoView memo_view = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The fields to update. Supported paths: title, filter, icon. The + // service rejects an empty mask. + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for UserService.DeleteMemoView. +message DeleteMemoViewRequest { + // Required. The resource name of the memo view to delete. + // Format: users/{user}/views/{view} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = {type: "memos.api/MemoView"} + ]; +} + +// UserNotification is a notification delivered to a user. +message UserNotification { + option (google.api.resource) = { + type: "memos.api/UserNotification" + pattern: "users/{user}/notifications/{notification}" + singular: "userNotification" + plural: "userNotifications" + }; + + // Identifier. The resource name of the notification. + // Format: users/{user}/notifications/{notification} + string name = 1 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.field_behavior) = IDENTIFIER + ]; + + // Output only. The user who caused the notification. + // Format: users/{user} + string sender = 2 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.resource_reference) = {type: "memos.api/User"} + ]; + + // Output only. The sender user details. + User sender_user = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The type of the notification. + Type type = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The type-specific details. The set field matches the type. + oneof payload { + // Output only. Details of a MEMO_COMMENT notification. + MemoCommentPayload memo_comment = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Details of a MEMO_MENTION notification. + MemoMentionPayload memo_mention = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Details of a SPACE_INVITATION notification. + SpaceInvitationPayload space_invitation = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + } + + // Optional. The status of the notification. + Status status = 8 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. The creation timestamp. + google.protobuf.Timestamp create_time = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Status is the receiver's handling state of a notification. + enum Status { + STATUS_UNSPECIFIED = 0; + // The receiver has not handled the notification yet. + UNREAD = 1; + // The receiver has archived the notification. + ARCHIVED = 2; + } + + // Type is the kind of event a notification reports. + enum Type { + TYPE_UNSPECIFIED = 0; + // Someone commented on a memo. + MEMO_COMMENT = 1; + // Someone mentioned the receiver in a memo. + MEMO_MENTION = 2; + // Someone invited the receiver to a space. + SPACE_INVITATION = 3; + } + + // MemoCommentPayload holds the details of a MEMO_COMMENT notification. + message MemoCommentPayload { + // The comment memo. + // Format: memos/{memo} + string memo = 1; + + // The memo that was commented on. + // Format: memos/{memo} + string related_memo = 2; + + // Preview text of the comment memo. + string memo_snippet = 3; + + // Preview text of the related memo. + string related_memo_snippet = 4; + } + + // MemoMentionPayload holds the details of a MEMO_MENTION notification. + message MemoMentionPayload { + // The memo that contains the mention. + // Format: memos/{memo} + string memo = 1; + + // The related parent memo when the mention was created in a comment. + // Format: memos/{memo} + string related_memo = 2; + + // Preview text of the memo that contains the mention. + string memo_snippet = 3; + + // Preview text of the related parent memo. + string related_memo_snippet = 4; + } + + // SpaceInvitationPayload holds the details of a SPACE_INVITATION + // notification. + message SpaceInvitationPayload { + // The invitation. + // Format: spaces/{space}/invitations/{invitation} + string space_invitation = 1 [(google.api.resource_reference) = {type: "memos.api/SpaceInvitation"}]; + + // The read-only Space summary carried by the invitation. + Space space = 2; + + // The role the invitation offers. + SpaceMember.Role role = 3; + + // The current state of the invitation for the receiver. + InvitationState state = 4; + + // InvitationState is the receiver's progress on the invitation. + enum InvitationState { + STATE_UNSPECIFIED = 0; + // The receiver has not yet accepted or declined the invitation. + PENDING = 1; + // The receiver accepted the invitation and is an active member. + ACCEPTED = 2; + } + } +} + +// Request message for UserService.ListUserNotifications. +message ListUserNotificationsRequest { + // Required. The user whose notifications are listed. + // Format: users/{user} + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = {type: "memos.api/User"} + ]; + + // Optional. The maximum number of notifications to return. The service may + // return fewer. Currently ignored; all notifications are returned in one + // page. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A page token from a previous call. Provide it to retrieve the + // next page. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A filter on the notifications. Currently ignored. + string filter = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response message for UserService.ListUserNotifications. +message ListUserNotificationsResponse { + // The notifications. + repeated UserNotification notifications = 1; + + // A token to retrieve the next page. Empty when there are no more pages. + string next_page_token = 2; +} + +// Request message for UserService.UpdateUserNotification. +message UpdateUserNotificationRequest { + // Required. The notification to update. Its name identifies the + // notification. + UserNotification notification = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The fields to update. Only status is supported. + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for UserService.DeleteUserNotification. +message DeleteUserNotificationRequest { + // Required. The resource name of the notification to delete. + // Format: users/{user}/notifications/{notification} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = {type: "memos.api/UserNotification"} + ]; +} + +// UserWebhook is a webhook owned by a user. +message UserWebhook { + option (google.api.resource) = { + type: "memos.api/UserWebhook" + pattern: "users/{user}/webhooks/{webhook}" + singular: "userWebhook" + plural: "userWebhooks" + }; + + // Identifier. The resource name of the webhook. + // Format: users/{user}/webhooks/{webhook} + string name = 1 [(google.api.field_behavior) = IDENTIFIER]; + + // A human-readable name for the webhook. + string display_name = 2; + + // The URL the webhook request is sent to. Required on create. + string url = 3; + + // Input only. The secret used to HMAC-SHA256 sign the webhook request body. + // Never returned; use GetUserWebhookSigningSecret to read it. + string signing_secret = 4 [(google.api.field_behavior) = INPUT_ONLY]; + + // Output only. Whether a signing secret is configured for this webhook. + bool signing_secret_set = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The creation timestamp. Currently never set. + google.protobuf.Timestamp create_time = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The last update timestamp. Currently never set. + google.protobuf.Timestamp update_time = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Request message for UserService.ListUserWebhooks. +message ListUserWebhooksRequest { + // Required. The user whose webhooks are listed. + // Format: users/{user} + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = {child_type: "memos.api/UserWebhook"} + ]; +} + +// Response message for UserService.ListUserWebhooks. +message ListUserWebhooksResponse { + // The webhooks. + repeated UserWebhook webhooks = 1; +} + +// Request message for UserService.CreateUserWebhook. +message CreateUserWebhookRequest { + // Required. The user who owns the webhook. + // Format: users/{user} + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = {child_type: "memos.api/UserWebhook"} + ]; + + // Required. The webhook to create. + UserWebhook webhook = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for UserService.UpdateUserWebhook. +message UpdateUserWebhookRequest { + // Required. The webhook to update. Its name identifies the webhook. + UserWebhook webhook = 1 [(google.api.field_behavior) = REQUIRED]; + + // The fields to update. Supported paths: url, display_name, signing_secret. + // When unset, all of them are updated, skipping an empty url or + // signing_secret. + google.protobuf.FieldMask update_mask = 2; +} + +// Request message for UserService.DeleteUserWebhook. +message DeleteUserWebhookRequest { + // Required. The resource name of the webhook to delete. + // Format: users/{user}/webhooks/{webhook} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = {type: "memos.api/UserWebhook"} + ]; +} + +// Request message for UserService.GetUserWebhookSigningSecret. +message GetUserWebhookSigningSecretRequest { + // Required. The resource name of the webhook whose signing secret to reveal. + // Format: users/{user}/webhooks/{webhook} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = {type: "memos.api/UserWebhook"} + ]; +} + +// Response message for UserService.GetUserWebhookSigningSecret. +message GetUserWebhookSigningSecretResponse { + // The signing secret, in the Standard Webhooks "whsec_" form. + string signing_secret = 1; +} + +// LinkedIdentity is an SSO identity linked to a user account. +message LinkedIdentity { + option (google.api.resource) = { + type: "memos.api/LinkedIdentity" + pattern: "users/{user}/linkedIdentities/{linked_identity}" + singular: "linkedIdentity" + plural: "linkedIdentities" + }; + + // Identifier. The resource name of the linked identity. {linked_identity} is + // the ID of the identity provider. + // Format: users/{user}/linkedIdentities/{linked_identity} + string name = 1 [(google.api.field_behavior) = IDENTIFIER]; + + // Output only. The resource name of the identity provider. + // Format: identity-providers/{idp} + string identity_provider = 2 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.resource_reference) = {type: "memos.api/IdentityProvider"} + ]; + + // Output only. The external user identifier from the identity provider. + string external_uid = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Request message for UserService.ListLinkedIdentities. +message ListLinkedIdentitiesRequest { + // Required. The user whose linked identities are listed. + // Format: users/{user} + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = {type: "memos.api/User"} + ]; +} + +// Response message for UserService.ListLinkedIdentities. +message ListLinkedIdentitiesResponse { + // The linked identities. + repeated LinkedIdentity linked_identities = 1; +} + +// Request message for UserService.GetLinkedIdentity. +message GetLinkedIdentityRequest { + // Required. The resource name of the linked identity. + // Format: users/{user}/linkedIdentities/{linked_identity} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = {type: "memos.api/LinkedIdentity"} + ]; +} + +// Request message for UserService.CreateLinkedIdentity. +message CreateLinkedIdentityRequest { + // Required. The user who owns the linked identity. Must be the caller. + // Format: users/{user} + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = {type: "memos.api/User"} + ]; + + // Required. The identity provider to link. + // Format: identity-providers/{idp} + string identity_provider = 2 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = {type: "memos.api/IdentityProvider"} + ]; + + // Required. The authorization code from the identity provider. + string code = 3 [(google.api.field_behavior) = REQUIRED]; + + // Required. The redirect URI used in the OAuth flow. + string redirect_uri = 4 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The PKCE code verifier used in the OAuth flow. + string code_verifier = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for UserService.DeleteLinkedIdentity. +message DeleteLinkedIdentityRequest { + // Required. The resource name of the linked identity to delete. + // Format: users/{user}/linkedIdentities/{linked_identity} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = {type: "memos.api/LinkedIdentity"} + ]; +} + +// PersonalAccessToken is a long-lived token for API and script access. +// PATs are distinct from short-lived JWT access tokens used for session +// authentication. +message PersonalAccessToken { + option (google.api.resource) = { + type: "memos.api/PersonalAccessToken" + pattern: "users/{user}/personalAccessTokens/{personal_access_token}" + singular: "personalAccessToken" + plural: "personalAccessTokens" + }; + + // Identifier. The resource name of the personal access token. + // Format: users/{user}/personalAccessTokens/{personal_access_token} + string name = 1 [(google.api.field_behavior) = IDENTIFIER]; + + // Optional. The description of the token. + string description = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. The creation time. + google.protobuf.Timestamp create_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. The expiration time. Unset means the token never expires. + google.protobuf.Timestamp expire_time = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. The time the token was last used. + google.protobuf.Timestamp last_use_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Request message for UserService.ListPersonalAccessTokens. +message ListPersonalAccessTokensRequest { + // Required. The user whose personal access tokens are listed. + // Format: users/{user} + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = {type: "memos.api/User"} + ]; + + // Optional. The maximum number of tokens to return. The service may return + // fewer. Currently ignored; all tokens are returned in one page. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A page token from a previous call. Provide it to retrieve the + // next page. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response message for UserService.ListPersonalAccessTokens. +message ListPersonalAccessTokensResponse { + // The personal access tokens, without their token values. + repeated PersonalAccessToken personal_access_tokens = 1; + + // A token to retrieve the next page. Empty when there are no more pages. + string next_page_token = 2; +} + +// Request message for UserService.CreatePersonalAccessToken. +message CreatePersonalAccessTokenRequest { + // Required. The user who owns the token. Must be the caller. + // Format: users/{user} + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = {type: "memos.api/User"} + ]; + + // Optional. The description of the token. + string description = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The lifetime of the token in days. 0 means the token never + // expires. + int32 expires_in_days = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response message for UserService.CreatePersonalAccessToken. +message CreatePersonalAccessTokenResponse { + // The personal access token metadata. + PersonalAccessToken personal_access_token = 1; + + // The token value. This is the only time it is returned. + string token = 2; +} + +// Request message for UserService.DeletePersonalAccessToken. +message DeletePersonalAccessTokenRequest { + // Required. The resource name of the personal access token to delete. + // Format: users/{user}/personalAccessTokens/{personal_access_token} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = {type: "memos.api/PersonalAccessToken"} + ]; +} + +// Request message for UserService.ExportMemos. +message ExportMemosRequest { + // Required. The user whose memos are exported. Must be the caller. + // Format: users/{user} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = {type: "memos.api/User"} + ]; +} + +// Request message for UserService.ImportMemos. +message ImportMemosRequest { + // Required. The user who receives the memos. Must be the caller. + // Format: users/{user} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = {type: "memos.api/User"} + ]; + + // Required. Start a new upload or continue an existing one. + oneof upload { + // Starts a new upload. The same call may also carry data and finish_write. + ImportMemosSpec spec = 2; + + // Continues the upload identified by a previous response. + string upload_id = 3; + } + + // Required. Zero-based byte offset at which data is written. Must equal the + // committed size, except when retrying the most recently accepted chunk + // with identical bytes and offset, which is accepted without writing again. + int64 write_offset = 4 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Archive bytes, at most max_chunk_size long. With no data and + // finish_write false, the call reports progress without writing, and + // write_offset is ignored. + bytes data = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Finish the upload after writing data. The committed size must + // then equal total_size. The archive is validated and, unless + // validate_only is set, imported. Any later call for an imported upload + // returns the same report. + bool finish_write = 6 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Read on the finishing call that imports. Unspecified means SKIP. + ConflictPolicy conflict_policy = 7 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. On a finishing call, validate the archive and return the plan + // without importing. The upload stays staged so a later finishing call can + // import it. + bool validate_only = 8 [(google.api.field_behavior) = OPTIONAL]; + + // ConflictPolicy says what the importer does with a memo whose UID the user + // already holds. + enum ConflictPolicy { + CONFLICT_POLICY_UNSPECIFIED = 0; + // Leave the existing memo untouched. This is the default. + SKIP = 1; + // Update the existing memo's content and metadata from the archive. + REPLACE = 2; + // Keep the existing memo and create the archive version under a fresh UID. + DUPLICATE = 3; + } +} + +// Response message for UserService.ImportMemos. +message ImportMemosResponse { + // Opaque ID for subsequent calls. This is not a resource name. + string upload_id = 1; + + // Number of archive bytes committed so far. + int64 committed_size = 2; + + // Maximum number of data bytes accepted in one call. + int32 max_chunk_size = 3; + + // Set once the upload has been finished. + oneof result { + // What the import would do. Set by a finishing call with validate_only. + ImportMemosPlan plan = 4; + + // What the import did. Set by a finishing call that imported. + ImportMemosReport report = 5; + } +} + +// ImportMemosSpec describes a new memo import upload. +message ImportMemosSpec { + // Optional. Total size of the archive in bytes. + int64 total_size = 1 [(google.api.field_behavior) = OPTIONAL]; +} + +// ImportMemosPlan describes what importing a staged archive would do. +message ImportMemosPlan { + // When the archive was written. + google.protobuf.Timestamp export_time = 1; + + // Username of the user who exported the archive. + string exporter = 2; + + // The software that wrote the archive. + string generator = 3; + + // Number of memo records in the archive. + int32 memo_count = 4; + + // Number of attachment files in the archive. + int32 attachment_count = 5; + + // Memos whose UID nobody on the instance holds. + int32 new = 6; + + // Memos the user already holds; the conflict policy applies to them. + int32 existing = 7; + + // Memos whose UID another account holds; they are imported under fresh UIDs. + int32 renamed = 8; + + // Deviations the archive reader corrected while validating. + repeated ImportMemosIssue warnings = 9; +} + +// ImportMemosReport is the outcome of an import. +message ImportMemosReport { + // Number of memos created. + int32 created = 1; + + // Number of existing memos replaced under the REPLACE policy. + int32 updated = 2; + + // Number of existing memos left untouched under the SKIP policy. + int32 skipped = 3; + + // Number of memos that could not be imported. + int32 failed = 4; + + // Deviations the importer corrected or tolerated. + repeated ImportMemosIssue warnings = 5; + + // One entry per failed memo, with the reason. + repeated ImportMemosIssue failures = 6; +} + +// ImportMemosIssue is one warning or failure of an import, tied to the memo +// UID from the archive when there is one. +message ImportMemosIssue { + // The archive memo UID the issue concerns, if any. + string memo_uid = 1; + + // A description of the issue. + string message = 2; +} diff --git a/proto/api/v1/README.md b/proto/api/v1/README.md deleted file mode 100644 index 09b7b3d6c..000000000 --- a/proto/api/v1/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Memos API Design - -This API design should follow the guidelines and best practices outlined in the [Google API Improvement Proposals (AIPs)](https://google.aip.dev/). diff --git a/proto/api/v1/ai_service.proto b/proto/api/v1/ai_service.proto deleted file mode 100644 index 1aeb1e63e..000000000 --- a/proto/api/v1/ai_service.proto +++ /dev/null @@ -1,46 +0,0 @@ -syntax = "proto3"; - -package memos.api.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; - -option go_package = "gen/api/v1"; - -service AIService { - // Transcribe transcribes an audio file using an instance AI provider. - rpc Transcribe(TranscribeRequest) returns (TranscribeResponse) { - option (google.api.http) = { - post: "/api/v1/ai:transcribe" - body: "*" - }; - option (google.api.method_signature) = "audio"; - } -} - -message TranscribeRequest { - // Required. Audio input. - TranscriptionAudio audio = 1 [(google.api.field_behavior) = REQUIRED]; -} - -message TranscriptionAudio { - oneof source { - // Inline audio bytes. - bytes content = 1 [(google.api.field_behavior) = INPUT_ONLY]; - - // URI for audio content. Reserved for future use. - string uri = 2; - } - - // Optional. The uploaded filename. - string filename = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The MIME type of the input audio. - string content_type = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -message TranscribeResponse { - // The transcribed text. - string text = 1; -} diff --git a/proto/api/v1/attachment_service.proto b/proto/api/v1/attachment_service.proto deleted file mode 100644 index c5a0a879f..000000000 --- a/proto/api/v1/attachment_service.proto +++ /dev/null @@ -1,322 +0,0 @@ -syntax = "proto3"; - -package memos.api.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; - -option go_package = "gen/api/v1"; - -service AttachmentService { - // CreateAttachment creates a new attachment. - rpc CreateAttachment(CreateAttachmentRequest) returns (Attachment) { - option (google.api.http) = { - post: "/api/v1/attachments" - body: "attachment" - }; - option (google.api.method_signature) = "attachment"; - } - // UploadAttachment uploads a file in bounded chunks. The first call carries - // the spec and returns an upload_id; later calls carry that upload_id. - // Uploads are bound to the authenticated user, expire after 30 minutes of - // inactivity, and do not survive a server restart. - rpc UploadAttachment(UploadAttachmentRequest) returns (UploadAttachmentResponse) { - option (google.api.http) = { - post: "/api/v1/attachments:upload" - body: "*" - }; - } - // ListAttachments lists attachments linked to readable memos and the caller's unlinked uploads. - rpc ListAttachments(ListAttachmentsRequest) returns (ListAttachmentsResponse) { - option (google.api.http) = {get: "/api/v1/attachments"}; - } - // GetAttachment returns an attachment by name. - rpc GetAttachment(GetAttachmentRequest) returns (Attachment) { - option (google.api.http) = {get: "/api/v1/{name=attachments/*}"}; - option (google.api.method_signature) = "name"; - } - // UpdateAttachment updates an attachment. - rpc UpdateAttachment(UpdateAttachmentRequest) returns (Attachment) { - option (google.api.http) = { - patch: "/api/v1/{attachment.name=attachments/*}" - body: "attachment" - }; - option (google.api.method_signature) = "attachment,update_mask"; - } - // DeleteAttachment deletes an attachment by name. - rpc DeleteAttachment(DeleteAttachmentRequest) returns (google.protobuf.Empty) { - option (google.api.http) = {delete: "/api/v1/{name=attachments/*}"}; - option (google.api.method_signature) = "name"; - } - // BatchDeleteAttachments deletes multiple attachments in one request. - rpc BatchDeleteAttachments(BatchDeleteAttachmentsRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - post: "/api/v1/attachments:batchDelete" - body: "*" - }; - } -} - -enum MotionMediaFamily { - MOTION_MEDIA_FAMILY_UNSPECIFIED = 0; - APPLE_LIVE_PHOTO = 1; - ANDROID_MOTION_PHOTO = 2; -} - -enum MotionMediaRole { - MOTION_MEDIA_ROLE_UNSPECIFIED = 0; - STILL = 1; - VIDEO = 2; - CONTAINER = 3; -} - -message MotionMedia { - MotionMediaFamily family = 1; - MotionMediaRole role = 2; - string group_id = 3; - int64 presentation_timestamp_us = 4; - bool has_embedded_video = 5; -} - -// MediaMetadata contains normalized metadata explicitly supplied by a client. -// The server validates and stores this data but does not extract it from the media file. -message MediaMetadata { - // Optional. Display-oriented width in pixels. - optional int32 width = 1; - // Optional. Display-oriented height in pixels. - optional int32 height = 2; - - oneof details { - PhotoMetadata photo = 3; - VideoMetadata video = 4; - } -} - -message PhotoMetadata { - // Optional. Capture time as recorded by the source media. - MediaCaptureTime capture_time = 1; - // Optional. Geographic location recorded by the source media. - MediaLocation location = 2; - // Optional. EXIF orientation value from 1 through 8 as recorded by the source file. - // This value is informational and must not be reapplied to the stored attachment; - // width and height already describe its display-oriented dimensions. - optional int32 source_exif_orientation = 3; - string camera_make = 4; - string camera_model = 5; - string lens_model = 6; - optional double f_number = 7; - optional double exposure_time_seconds = 8; - optional int32 iso = 9; - optional double focal_length_mm = 10; -} - -message MediaCaptureTime { - // Local date and time without a time zone, formatted as YYYY-MM-DDTHH:mm:ss[.fraction]. - string local_date_time = 1; - // Optional. UTC offset formatted as Z or +/-HH:MM. - optional string utc_offset = 2; -} - -message MediaLocation { - // Optional. WGS84 latitude in decimal degrees. Must be provided with longitude. - optional double latitude = 1; - // Optional. WGS84 longitude in decimal degrees. Must be provided with latitude. - optional double longitude = 2; - // Optional. Signed altitude in meters relative to sea level. - optional double altitude_meters = 3; -} - -message VideoMetadata { - optional double duration_seconds = 1; -} - -message Attachment { - option (google.api.resource) = { - type: "memos.api.v1/Attachment" - pattern: "attachments/{attachment}" - singular: "attachment" - plural: "attachments" - }; - - // The name of the attachment. - // Format: attachments/{attachment} - string name = 1 [(google.api.field_behavior) = IDENTIFIER]; - - // Output only. The creation timestamp. - google.protobuf.Timestamp create_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The filename of the attachment. - string filename = 3 [(google.api.field_behavior) = REQUIRED]; - - // Input only. The content of the attachment. - bytes content = 4 [(google.api.field_behavior) = INPUT_ONLY]; - - // Optional. The external link of the attachment. - string external_link = 5 [(google.api.field_behavior) = OPTIONAL]; - - // The MIME type of the attachment. - string type = 6 [(google.api.field_behavior) = REQUIRED]; - - // Output only. The size of the attachment in bytes. - int64 size = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. The related memo. Refer to `Memo.name`. - // Format: memos/{memo} - optional string memo = 8 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Motion media metadata. - MotionMedia motion_media = 9 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Immutable normalized media metadata explicitly supplied by the client at creation time. - MediaMetadata media_metadata = 10 [ - (google.api.field_behavior) = OPTIONAL, - (google.api.field_behavior) = IMMUTABLE - ]; - - // Output only. The user who uploaded this attachment, which may differ from - // the creator of the linked memo. Format: users/{user}. - string creator = 11 [ - (google.api.field_behavior) = OUTPUT_ONLY, - (google.api.resource_reference) = {type: "memos.api.v1/User"} - ]; -} - -message CreateAttachmentRequest { - // Required. The attachment to create. - Attachment attachment = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The attachment ID to use for this attachment. - // If empty, a unique ID will be generated. - // Format: ^[a-zA-Z0-9]([a-zA-Z0-9-]{0,34}[a-zA-Z0-9])?$ - string attachment_id = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -message UploadAttachmentRequest { - // Required. Start a new upload or continue an existing one. - oneof upload { - // Starts a new upload. The same call may also carry data and finish_write. - UploadAttachmentSpec spec = 1; - - // Continues the upload identified by a previous response. - string upload_id = 2; - } - - // Required. Zero-based byte offset at which data is written. Must equal the - // committed size, except when retrying the most recently accepted chunk - // with identical bytes and offset, which is accepted without writing again. - int64 write_offset = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. File bytes, at most max_chunk_size long. With no data and - // finish_write false, the call reports progress without writing, and - // write_offset is ignored. - bytes data = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Finalize the upload after writing data. The committed size must - // then equal total_size. Any later call for the same upload_id returns the - // created attachment. - bool finish_write = 5 [(google.api.field_behavior) = OPTIONAL]; -} - -message UploadAttachmentSpec { - // Required. Metadata for the attachment to create. content must be empty; - // file bytes are sent in data. - Attachment attachment = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The attachment ID to use for this attachment. - // If empty, a unique ID will be generated. - // Format: ^[a-zA-Z0-9]([a-zA-Z0-9-]{0,34}[a-zA-Z0-9])?$ - string attachment_id = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Total size of the file in bytes before media processing. - // Zero represents an empty file. - int64 total_size = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -message UploadAttachmentResponse { - // Opaque ID for subsequent calls. This is not a resource name. - string upload_id = 1; - - // Number of file bytes committed so far. - int64 committed_size = 2; - - // Set once the upload has been finalized. - Attachment attachment = 3; - - // Maximum number of data bytes accepted in one call. - int32 max_chunk_size = 4; -} - -message ListAttachmentsRequest { - // Optional. The maximum number of attachments to return. - // The service may return fewer than this value. - // If unspecified, at most 50 attachments will be returned. - // The maximum value is 1000; values above 1000 will be coerced to 1000. - int32 page_size = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A page token, received from a previous `ListAttachments` call. - // Provide this to retrieve the subsequent page. - string page_token = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Filter to apply to the list results. - // Example: "mime_type==\"image/png\"" or "filename.contains(\"test\")" - // Supported operators: =, !=, <, <=, >, >=, : (contains), in - // Supported fields: creator, filename, mime_type, create_time, memo_id, space. - // `creator` is the linked memo's creator, or the uploader for an unlinked - // attachment. It supports equality with a User resource name. - // `space` only supports a non-negated `==` comparison with a Space resource - // name or null. - // `space` is the linked memo's space resource name, or null when the - // attachment is unlinked or its linked memo has no space. - string filter = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The order to sort results by. - // Example: "create_time desc" or "filename asc" - string order_by = 4 [(google.api.field_behavior) = OPTIONAL]; - - reserved 5, 6; - reserved "space", "unassigned"; -} - -message ListAttachmentsResponse { - // The list of attachments. - repeated Attachment attachments = 1; - - // A token that can be sent as `page_token` to retrieve the next page. - // If this field is omitted, there are no subsequent pages. - string next_page_token = 2; -} - -message GetAttachmentRequest { - // Required. The attachment name of the attachment to retrieve. - // Format: attachments/{attachment} - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = {type: "memos.api.v1/Attachment"} - ]; -} - -message UpdateAttachmentRequest { - // Required. The attachment which replaces the attachment on the server. - Attachment attachment = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The list of fields to update. - google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; -} - -message DeleteAttachmentRequest { - // Required. The attachment name of the attachment to delete. - // Format: attachments/{attachment} - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = {type: "memos.api.v1/Attachment"} - ]; -} - -message BatchDeleteAttachmentsRequest { - repeated string names = 1 [(google.api.field_behavior) = REQUIRED]; -} diff --git a/proto/api/v1/auth_service.proto b/proto/api/v1/auth_service.proto deleted file mode 100644 index fa13844c3..000000000 --- a/proto/api/v1/auth_service.proto +++ /dev/null @@ -1,115 +0,0 @@ -syntax = "proto3"; - -package memos.api.v1; - -import "api/v1/user_service.proto"; -import "google/api/annotations.proto"; -import "google/api/field_behavior.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/timestamp.proto"; - -option go_package = "gen/api/v1"; - -service AuthService { - // GetCurrentUser returns the authenticated user's information. - // Validates the access token and returns user details. - // Similar to OIDC's /userinfo endpoint. - rpc GetCurrentUser(GetCurrentUserRequest) returns (GetCurrentUserResponse) { - option (google.api.http) = {get: "/api/v1/auth/me"}; - } - - // SignIn authenticates a user with credentials and returns tokens. - // On success, returns an access token and sets a refresh token cookie. - // Supports password-based and SSO authentication methods. - rpc SignIn(SignInRequest) returns (SignInResponse) { - option (google.api.http) = { - post: "/api/v1/auth/signin" - body: "*" - }; - } - - // SignOut terminates the user's authentication. - // Revokes the refresh token and clears the authentication cookie. - rpc SignOut(SignOutRequest) returns (google.protobuf.Empty) { - option (google.api.http) = {post: "/api/v1/auth/signout"}; - } - - // RefreshToken exchanges a valid refresh token for a new access token. - // The refresh token is read from the HttpOnly cookie. - // Returns a new short-lived access token. - rpc RefreshToken(RefreshTokenRequest) returns (RefreshTokenResponse) { - option (google.api.http) = { - post: "/api/v1/auth/refresh" - body: "*" - }; - } -} - -message GetCurrentUserRequest {} - -message GetCurrentUserResponse { - // The authenticated user's information. - User user = 1; -} - -message SignInRequest { - // Nested message for password-based authentication credentials. - message PasswordCredentials { - // The username to sign in with. - string username = 1 [(google.api.field_behavior) = REQUIRED]; - - // The password to sign in with. - string password = 2 [(google.api.field_behavior) = REQUIRED]; - } - - // Nested message for SSO authentication credentials. - message SSOCredentials { - // The resource name of the SSO provider. - // Format: identity-providers/{idp} - string idp_name = 1 [(google.api.field_behavior) = REQUIRED]; - - // The authorization code from the SSO provider. - string code = 2 [(google.api.field_behavior) = REQUIRED]; - - // The redirect URI used in the SSO flow. - string redirect_uri = 3 [(google.api.field_behavior) = REQUIRED]; - - // The PKCE code verifier for enhanced security (RFC 7636). - // Optional - enables PKCE flow protection against authorization code interception. - string code_verifier = 4 [(google.api.field_behavior) = OPTIONAL]; - } - - // Authentication credentials. Provide one method. - oneof credentials { - // Username and password authentication. - PasswordCredentials password_credentials = 1; - - // SSO provider authentication. - SSOCredentials sso_credentials = 2; - } -} - -message SignInResponse { - // The authenticated user's information. - User user = 1; - - // The short-lived access token for API requests. - // Store in memory only, not in localStorage. - string access_token = 2; - - // When the access token expires. - // Client should call RefreshToken before this time. - google.protobuf.Timestamp access_token_expires_at = 3; -} - -message SignOutRequest {} - -message RefreshTokenRequest {} - -message RefreshTokenResponse { - // The new short-lived access token. - string access_token = 1; - - // When the access token expires. - google.protobuf.Timestamp expires_at = 2; -} diff --git a/proto/api/v1/common.proto b/proto/api/v1/common.proto deleted file mode 100644 index 6c5fcf880..000000000 --- a/proto/api/v1/common.proto +++ /dev/null @@ -1,23 +0,0 @@ -syntax = "proto3"; - -package memos.api.v1; - -option go_package = "gen/api/v1"; - -enum State { - STATE_UNSPECIFIED = 0; - NORMAL = 1; - ARCHIVED = 2; -} - -// Used internally for obfuscating the page token. -message PageToken { - int32 limit = 1; - int32 offset = 2; -} - -enum Direction { - DIRECTION_UNSPECIFIED = 0; - ASC = 1; - DESC = 2; -} diff --git a/proto/api/v1/instance_service.proto b/proto/api/v1/instance_service.proto deleted file mode 100644 index bc299eabb..000000000 --- a/proto/api/v1/instance_service.proto +++ /dev/null @@ -1,431 +0,0 @@ -syntax = "proto3"; - -package memos.api.v1; - -import "api/v1/user_service.proto"; -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; -import "google/type/color.proto"; - -option go_package = "gen/api/v1"; - -service InstanceService { - // Gets the instance profile. - rpc GetInstanceProfile(GetInstanceProfileRequest) returns (InstanceProfile) { - option (google.api.http) = {get: "/api/v1/instance/profile"}; - } - - // Gets an instance setting. - rpc GetInstanceSetting(GetInstanceSettingRequest) returns (InstanceSetting) { - option (google.api.http) = {get: "/api/v1/{name=instance/settings/*}"}; - option (google.api.method_signature) = "name"; - } - - // Batch gets instance settings. - rpc BatchGetInstanceSettings(BatchGetInstanceSettingsRequest) returns (BatchGetInstanceSettingsResponse) { - option (google.api.http) = { - post: "/api/v1/instance/settings:batchGet" - body: "*" - }; - } - - // Updates an instance setting. - rpc UpdateInstanceSetting(UpdateInstanceSettingRequest) returns (InstanceSetting) { - option (google.api.http) = { - patch: "/api/v1/{setting.name=instance/settings/*}" - body: "setting" - }; - option (google.api.method_signature) = "setting,update_mask"; - } - - // Tests notification email delivery with the provided or stored SMTP settings. - rpc TestInstanceEmailSetting(TestInstanceEmailSettingRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - post: "/api/v1/instance/settings/notification:testEmail" - body: "*" - }; - } - - // GetInstanceStats returns resource usage statistics for the instance. Admin only. - rpc GetInstanceStats(GetInstanceStatsRequest) returns (InstanceStats) { - option (google.api.http) = {get: "/api/v1/instance/stats"}; - } -} - -// InstanceAccessMode controls whether unauthenticated users may access instance content. -enum InstanceAccessMode { - INSTANCE_ACCESS_MODE_UNSPECIFIED = 0; - INSTANCE_ACCESS_MODE_PRIVATE = 1; - INSTANCE_ACCESS_MODE_PUBLIC = 2; -} - -// Instance profile message containing basic instance information. -message InstanceProfile { - // Version is the current version of instance. - string version = 2; - - // Demo indicates if the instance is in demo mode. - bool demo = 3; - - // Instance URL is the URL of the instance. - string instance_url = 6; - - // The first administrator who set up this instance, for display purposes. - // May be null on an instance that has lost all admins; use needs_setup to - // determine whether initial setup is actually required. - User admin = 7; - - // Commit is the current build commit of instance. - string commit = 8; - - // NeedsSetup is true when the instance has no users yet and requires initial - // setup (creating the first admin account). Unlike a null admin, this stays - // false once any user exists, so an instance that has lost its admins is not - // mistaken for a fresh install. - bool needs_setup = 9; - - // Access mode controls whether unauthenticated users may access instance content. - InstanceAccessMode access_mode = 10; - - // A proof-of-humanity challenge the deployment requires on signup and - // password sign-in. Absent when none is configured, which is the case on - // every self-hosted instance. - message Challenge { - // The challenge provider, which selects the widget the web app renders. - string provider = 1; - // The provider's public site key for the widget. - string site_key = 2; - } - Challenge challenge = 11; -} - -// Request for instance profile. -message GetInstanceProfileRequest {} - -// An instance setting resource. -message InstanceSetting { - option (google.api.resource) = { - type: "memos.api.v1/InstanceSetting" - pattern: "instance/settings/{setting}" - singular: "instanceSetting" - plural: "instanceSettings" - }; - - // The name of the instance setting. - // Format: instance/settings/{setting} - string name = 1 [(google.api.field_behavior) = IDENTIFIER]; - - oneof value { - GeneralSetting general_setting = 2; - StorageSetting storage_setting = 3; - MemoRelatedSetting memo_related_setting = 4; - TagsSetting tags_setting = 5; - NotificationSetting notification_setting = 6; - AISetting ai_setting = 7; - AccessSetting access_setting = 8; - } - - // Enumeration of instance setting keys. - enum Key { - KEY_UNSPECIFIED = 0; - // GENERAL is the key for general settings. - GENERAL = 1; - // STORAGE is the key for storage settings. - STORAGE = 2; - // MEMO_RELATED is the key for memo related settings. - MEMO_RELATED = 3; - // TAGS is the key for tag metadata. - TAGS = 4; - // NOTIFICATION is the key for notification transport settings. - NOTIFICATION = 5; - // AI is the key for AI provider settings. - AI = 6; - // ACCESS is the key for instance access policy settings. - ACCESS = 7; - } - - // General instance settings configuration. - message GeneralSetting { - // disallow_user_registration disallows user registration. - bool disallow_user_registration = 2; - // disallow_password_auth disallows password authentication. - bool disallow_password_auth = 3; - // additional_script is the additional script. - string additional_script = 4; - // additional_style is the additional style. - string additional_style = 5; - // custom_profile is the custom profile. - CustomProfile custom_profile = 6; - // week_start_day_offset is the week start day offset from Sunday. - // 0: Sunday, 1: Monday, 2: Tuesday, 3: Wednesday, 4: Thursday, 5: Friday, 6: Saturday - // Default is Sunday. - int32 week_start_day_offset = 7; - - // disallow_change_username disallows changing username. - bool disallow_change_username = 8; - // disallow_change_nickname disallows changing nickname. - bool disallow_change_nickname = 9; - - // Custom profile configuration for instance branding. - message CustomProfile { - string title = 1; - string description = 2; - string logo_url = 3; - } - } - - enum StorageType { - STORAGE_TYPE_UNSPECIFIED = 0; - // DATABASE stores attachment content in the application database. - DATABASE = 1; - // LOCAL stores attachment content on the local filesystem. - LOCAL = 2; - // S3 stores attachment content in an S3-compatible object store. - S3 = 3; - } - - // Storage is a configured attachment storage instance. - message Storage { - // id is the stable identifier referenced by attachments. - string id = 1; - // name is the human-readable storage name. - string name = 2; - StorageType type = 3; - - oneof config { - S3Config s3_config = 10; - } - - // S3 configuration for an S3-compatible object store. - // Reference: https://developers.cloudflare.com/r2/examples/aws/aws-sdk-go/ - message S3Config { - string access_key_id = 1; - string access_key_secret = 2 [(google.api.field_behavior) = INPUT_ONLY]; - string endpoint = 3; - string region = 4; - string bucket = 5; - bool use_path_style = 6; - // insecure_skip_tls_verify disables TLS certificate verification when connecting - // to the S3 endpoint. Only enable this for trusted endpoints that use a self-signed - // certificate; it removes protection against man-in-the-middle attacks. - bool insecure_skip_tls_verify = 7; - } - } - - // Storage configuration settings for instance attachments. - message StorageSetting { - // Legacy storage type enum retained for compatibility with existing clients. - enum StorageType { - STORAGE_TYPE_UNSPECIFIED = 0; - // DATABASE is the database storage type. - DATABASE = 1; - // LOCAL is the local storage type. - LOCAL = 2; - // S3 is the S3 storage type. - S3 = 3; - } - // Legacy compatibility field. New clients use default_storage_id. - StorageType storage_type = 1; - // The template of file path. - // e.g. assets/{timestamp}_{filename} - string filepath_template = 2; - // The max upload size in megabytes. - int64 upload_size_limit_mb = 3; - - // Legacy S3 configuration retained for compatibility with existing clients. - // Reference: https://developers.cloudflare.com/r2/examples/aws/aws-sdk-go/ - message S3Config { - string access_key_id = 1; - string access_key_secret = 2 [(google.api.field_behavior) = INPUT_ONLY]; - string endpoint = 3; - string region = 4; - string bucket = 5; - bool use_path_style = 6; - // insecure_skip_tls_verify disables TLS certificate verification when connecting - // to the S3 endpoint. Only enable this for trusted endpoints that use a self-signed - // certificate; it removes protection against man-in-the-middle attacks. - bool insecure_skip_tls_verify = 7; - } - // Legacy compatibility field. New clients use storages. - S3Config s3_config = 4; - // Configured storage instances, including inactive instances referenced by attachments. - repeated Storage storages = 5; - // Storage used for new attachments. - string default_storage_id = 6; - } - - // Memo-related instance settings and policies. - message MemoRelatedSetting { - reserved 2; - reserved "display_with_update_time"; - // content_length_limit is the limit of content length. Unit is byte. - int32 content_length_limit = 3; - // enable_double_click_edit enables editing on double click. - bool enable_double_click_edit = 4; - // reactions is the list of reactions. - repeated string reactions = 7; - } - - // Metadata for a tag. - message TagMetadata { - // Optional background color for the tag label. - // When unset, the default tag color is used. - google.type.Color background_color = 1; - // Whether memos with this tag should have their content blurred. - bool blur_content = 2; - } - - // Tag metadata configuration. - // Active tag metadata is stored in per-user tag settings. - // This message remains for backward compatibility with existing clients and migrations. - message TagsSetting { - // Map of tag name pattern to tag metadata. - // Each key is treated as an anchored regular expression (^pattern$), - // so a single entry like "project/.*" matches all tags under that prefix. - // Exact tag names are also valid (they are trivially valid regex patterns). - map tags = 1; - } - - // Notification transport configuration. - message NotificationSetting { - EmailSetting email = 1; - - // Email delivery configuration for notifications. - message EmailSetting { - bool enabled = 1; - string smtp_host = 2; - int32 smtp_port = 3; - string smtp_username = 4; - string smtp_password = 5 [(google.api.field_behavior) = INPUT_ONLY]; - string from_email = 6; - string from_name = 7; - string reply_to = 8; - bool use_tls = 9; - bool use_ssl = 10; - } - } - - // AI provider configuration settings. - message AISetting { - // providers is the list of AI provider configurations available instance-wide. - repeated AIProviderConfig providers = 1; - - // transcription is the speech-to-text feature configuration. - // When unset or transcription.provider_id is empty, transcription is disabled. - TranscriptionConfig transcription = 2; - } - - // AIProviderConfig represents one callable AI provider connection. - message AIProviderConfig { - string id = 1; - string title = 2; - AIProviderType type = 3; - string endpoint = 4; - // api_key is write-only and is never returned by GetInstanceSetting. - string api_key = 5 [(google.api.field_behavior) = INPUT_ONLY]; - // api_key_set indicates whether an API key is stored for this provider. - bool api_key_set = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; - // api_key_hint is a masked hint for the stored API key. - string api_key_hint = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; - } - - // AIProviderType is the provider implementation type. - enum AIProviderType { - AI_PROVIDER_TYPE_UNSPECIFIED = 0; - OPENAI = 1; - GEMINI = 2; - } - - // TranscriptionConfig configures the speech-to-text feature. - message TranscriptionConfig { - // provider_id references an entry in AISetting.providers[].id. - // Empty string means transcription is disabled. - string provider_id = 1; - - // model is the provider-specific model identifier. - // Empty string falls back to the engine default - // (whisper-1 for OPENAI providers, gemini-2.5-flash for GEMINI providers). - string model = 2; - - // language is the default ISO 639-1 language hint sent to the provider. - // Empty string lets the provider auto-detect. - string language = 3; - - // prompt is a default spelling/vocabulary hint passed to the provider. - string prompt = 4; - } - - // Access policy configuration for the instance. - message AccessSetting { - InstanceAccessMode access_mode = 1; - } -} - -// Request message for GetInstanceSetting method. -message GetInstanceSettingRequest { - // The resource name of the instance setting. - // Format: instance/settings/{setting} - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = {type: "memos.api.v1/InstanceSetting"} - ]; -} - -// Request message for BatchGetInstanceSettings method. -message BatchGetInstanceSettingsRequest { - // The resource names of the instance settings. - // Format: instance/settings/{setting} - repeated string names = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = {type: "memos.api.v1/InstanceSetting"} - ]; -} - -// Response message for BatchGetInstanceSettings method. -message BatchGetInstanceSettingsResponse { - // The instance settings in the same order as the input names. - repeated InstanceSetting settings = 1; -} - -// Request message for UpdateInstanceSetting method. -message UpdateInstanceSettingRequest { - // The instance setting resource which replaces the resource on the server. - InstanceSetting setting = 1 [(google.api.field_behavior) = REQUIRED]; - - // The list of fields to update. - google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for TestInstanceEmailSetting method. -message TestInstanceEmailSettingRequest { - // Optional. SMTP email settings to test. If omitted, the stored notification email setting is used. - InstanceSetting.NotificationSetting.EmailSetting email = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Recipient email address. If omitted, the current user's email address is used. - string recipient_email = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for GetInstanceStats. -message GetInstanceStatsRequest {} - -// Resource usage statistics for the instance. -message InstanceStats { - DatabaseStats database = 1; - // Recursive size of the data directory in bytes. -1 if unavailable. - int64 local_storage_bytes = 2; - // Server-side timestamp when the snapshot was generated. - google.protobuf.Timestamp generated_time = 4; - - // Database size statistics. - message DatabaseStats { - // driver is one of "sqlite", "mysql", "postgres". - string driver = 1; - // size_bytes is the database size in bytes; -1 if unavailable. - int64 size_bytes = 2; - } -} diff --git a/proto/api/v1/memo_service.proto b/proto/api/v1/memo_service.proto deleted file mode 100644 index cb48a98be..000000000 --- a/proto/api/v1/memo_service.proto +++ /dev/null @@ -1,677 +0,0 @@ -syntax = "proto3"; - -package memos.api.v1; - -import "api/v1/attachment_service.proto"; -import "api/v1/common.proto"; -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; - -option go_package = "gen/api/v1"; - -service MemoService { - // CreateMemo creates a memo. The request body is a Memo; set its content - // (Markdown) and visibility (PRIVATE | PROTECTED | PUBLIC | SPACE, - // default PRIVATE). - // The memo is owned by the authenticated user; requires authentication. - rpc CreateMemo(CreateMemoRequest) returns (Memo) { - option (google.api.http) = { - post: "/api/v1/memos" - body: "memo" - }; - option (google.api.method_signature) = "memo"; - } - // ListMemos lists readable non-comment memos with pagination and filter. - rpc ListMemos(ListMemosRequest) returns (ListMemosResponse) { - option (google.api.http) = {get: "/api/v1/memos"}; - option (google.api.method_signature) = ""; - } - // GetMemo gets a memo. - rpc GetMemo(GetMemoRequest) returns (Memo) { - option (google.api.http) = {get: "/api/v1/{name=memos/*}"}; - option (google.api.method_signature) = "name"; - } - // UpdateMemo updates a memo. - rpc UpdateMemo(UpdateMemoRequest) returns (Memo) { - option (google.api.http) = { - patch: "/api/v1/{memo.name=memos/*}" - body: "memo" - }; - option (google.api.method_signature) = "memo,update_mask"; - } - // DeleteMemo deletes the named memo and its comment subtree, including nested - // replies and their owned resources. It removes incident relations for all - // deleted memos. - rpc DeleteMemo(DeleteMemoRequest) returns (google.protobuf.Empty) { - option (google.api.http) = {delete: "/api/v1/{name=memos/*}"}; - option (google.api.method_signature) = "name"; - } - // 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. - rpc SetMemoAttachments(SetMemoAttachmentsRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - patch: "/api/v1/{name=memos/*}/attachments" - body: "*" - }; - option (google.api.method_signature) = "name"; - } - // ListMemoAttachments lists attachments for a memo. - rpc ListMemoAttachments(ListMemoAttachmentsRequest) returns (ListMemoAttachmentsResponse) { - option (google.api.http) = {get: "/api/v1/{name=memos/*}/attachments"}; - option (google.api.method_signature) = "name"; - } - // 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. - rpc SetMemoRelations(SetMemoRelationsRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - patch: "/api/v1/{name=memos/*}/relations" - body: "*" - }; - option (google.api.method_signature) = "name"; - } - // ListMemoRelations lists relations for a memo. - rpc ListMemoRelations(ListMemoRelationsRequest) returns (ListMemoRelationsResponse) { - option (google.api.http) = {get: "/api/v1/{name=memos/*}/relations"}; - option (google.api.method_signature) = "name"; - } - // 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. - rpc CreateMemoComment(CreateMemoCommentRequest) returns (Memo) { - option (google.api.http) = { - post: "/api/v1/{name=memos/*}/comments" - body: "comment" - }; - option (google.api.method_signature) = "name,comment"; - } - // ListMemoComments lists comments for a memo. - rpc ListMemoComments(ListMemoCommentsRequest) returns (ListMemoCommentsResponse) { - option (google.api.http) = {get: "/api/v1/{name=memos/*}/comments"}; - option (google.api.method_signature) = "name"; - } - // ListMemoReactions lists reactions for a memo. - rpc ListMemoReactions(ListMemoReactionsRequest) returns (ListMemoReactionsResponse) { - option (google.api.http) = {get: "/api/v1/{name=memos/*}/reactions"}; - option (google.api.method_signature) = "name"; - } - // UpsertMemoReaction adds or updates the authenticated user's reaction on a memo. - rpc UpsertMemoReaction(UpsertMemoReactionRequest) returns (Reaction) { - option (google.api.http) = { - post: "/api/v1/{name=memos/*}/reactions" - body: "*" - }; - option (google.api.method_signature) = "name"; - } - // DeleteMemoReaction deletes a reaction for a memo. - rpc DeleteMemoReaction(DeleteMemoReactionRequest) returns (google.protobuf.Empty) { - option (google.api.http) = {delete: "/api/v1/{name=memos/*/reactions/*}"}; - option (google.api.method_signature) = "name"; - } - // CreateMemoShare creates a share link for a memo. Requires the memo creator or an instance administrator. - rpc CreateMemoShare(CreateMemoShareRequest) returns (MemoShare) { - option (google.api.http) = { - post: "/api/v1/{parent=memos/*}/shares" - body: "memo_share" - }; - option (google.api.method_signature) = "parent,memo_share"; - } - // ListMemoShares lists all share links for a memo. Requires the memo creator or an instance administrator. - rpc ListMemoShares(ListMemoSharesRequest) returns (ListMemoSharesResponse) { - option (google.api.http) = {get: "/api/v1/{parent=memos/*}/shares"}; - option (google.api.method_signature) = "parent"; - } - // DeleteMemoShare revokes a share link. Requires the memo creator or an instance administrator. - rpc DeleteMemoShare(DeleteMemoShareRequest) returns (google.protobuf.Empty) { - option (google.api.http) = {delete: "/api/v1/{name=memos/*/shares/*}"}; - option (google.api.method_signature) = "name"; - } - // GetSharedMemo resolves a share token to its memo. No authentication required. - // Returns NOT_FOUND if the token is invalid or expired. - rpc GetSharedMemo(GetSharedMemoRequest) returns (Memo) { - option (google.api.http) = {get: "/api/v1/shares/{share_token}/memo"}; - } - // GetLinkMetadata gets metadata for a link. - rpc GetLinkMetadata(GetLinkMetadataRequest) returns (LinkMetadata) { - option (google.api.http) = {get: "/api/v1/memos/-/linkMetadata"}; - } - // BatchGetLinkMetadata gets metadata for links. - rpc BatchGetLinkMetadata(BatchGetLinkMetadataRequest) returns (BatchGetLinkMetadataResponse) { - option (google.api.http) = { - post: "/api/v1/memos/-/linkMetadata:batchGet" - body: "*" - }; - } -} - -// Visibility controls who can read a memo. -enum Visibility { - VISIBILITY_UNSPECIFIED = 0; - // PRIVATE: only the creator can read the memo. - PRIVATE = 1; - // PROTECTED: signed-in users of the instance can read the memo. - PROTECTED = 2; - // PUBLIC: signed-in users can read the memo; anonymous visitors can read it - // when instance policy permits. - PUBLIC = 3; - // SPACE: active members of the memo's space can read it. - SPACE = 4; -} - -// Reaction is a reaction attached to a memo. -message Reaction { - option (google.api.resource) = { - type: "memos.api.v1/Reaction" - pattern: "memos/{memo}/reactions/{reaction}" - name_field: "name" - singular: "reaction" - plural: "reactions" - }; - - // The resource name of the reaction. - // Format: memos/{memo}/reactions/{reaction} - string name = 1 [ - (google.api.field_behavior) = OUTPUT_ONLY, - (google.api.field_behavior) = IDENTIFIER - ]; - - // The resource name of the creator. - // Format: users/{user} - string creator = 2 [ - (google.api.field_behavior) = OUTPUT_ONLY, - (google.api.resource_reference) = {type: "memos.api.v1/User"} - ]; - - reserved 3; - reserved "content_id"; - - // Required. The type of reaction (e.g., "👍", "❤️", "😄"). - string reaction_type = 4 [(google.api.field_behavior) = REQUIRED]; - - // Output only. The creation timestamp. - google.protobuf.Timestamp create_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -message Memo { - option (google.api.resource) = { - type: "memos.api.v1/Memo" - pattern: "memos/{memo}" - name_field: "name" - singular: "memo" - plural: "memos" - }; - - // The resource name of the memo. - // Format: memos/{memo}, where memo is the user-defined UID. - string name = 1 [(google.api.field_behavior) = IDENTIFIER]; - - // The state of the memo. - State state = 2 [(google.api.field_behavior) = REQUIRED]; - - // The name of the creator. - // Format: users/{user} - string creator = 3 [ - (google.api.field_behavior) = OUTPUT_ONLY, - (google.api.resource_reference) = {type: "memos.api.v1/User"} - ]; - - // The creation timestamp. - // If not set on creation, the server will set it to the current time. - google.protobuf.Timestamp create_time = 4 [(google.api.field_behavior) = OPTIONAL]; - - // The last update timestamp. - // If not set on creation, the server will set it to the current time. - google.protobuf.Timestamp update_time = 5 [(google.api.field_behavior) = OPTIONAL]; - - reserved 6; - reserved "display_time"; - - // Required. The content of the memo in Markdown format. - string content = 7 [(google.api.field_behavior) = REQUIRED]; - - // The visibility of the memo. - // One of PRIVATE (creator only), PROTECTED (signed-in users), PUBLIC - // (anonymous-eligible), or SPACE (active space members). Defaults to - // PRIVATE on creation when unspecified. - Visibility visibility = 9 [(google.api.field_behavior) = REQUIRED]; - - // Output only. The tags extracted from the content. - repeated string tags = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Whether the memo is pinned. - bool pinned = 11 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The attachments of the memo. - repeated Attachment attachments = 12 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The relations of the memo. - repeated MemoRelation relations = 13 [(google.api.field_behavior) = OPTIONAL]; - - // Output only. The reactions to the memo. - repeated Reaction reactions = 14 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The computed properties of the memo. - Property property = 15 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The context memo of this COMMENT relation, if any. - // Its identity is returned even when the caller cannot read the parent. - // Fetch the parent independently; this field does not grant read access. - // Format: memos/{memo} - optional string parent = 16 [ - (google.api.field_behavior) = OUTPUT_ONLY, - (google.api.resource_reference) = {type: "memos.api.v1/Memo"} - ]; - - // Output only. The snippet of the memo content. Plain text only. - string snippet = 17 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. The location of the memo. - optional Location location = 18 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The space in which this memo is placed. Format: spaces/{space}. - // Every memo, including a comment, owns its placement independently. - optional string space = 19 [ - (google.api.field_behavior) = OPTIONAL, - (google.api.resource_reference) = {type: "memos.api.v1/Space"} - ]; - - // Computed properties of a memo. - message Property { - bool has_link = 1; - bool has_task_list = 2; - bool has_code = 3; - bool has_incomplete_tasks = 4; - // The title extracted from the first H1 heading, if present. - string title = 5; - } -} - -message Location { - // A placeholder text for the location. - string placeholder = 1 [(google.api.field_behavior) = OPTIONAL]; - - // The latitude of the location. - double latitude = 2 [(google.api.field_behavior) = OPTIONAL]; - - // The longitude of the location. - double longitude = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -message CreateMemoRequest { - // Required. The memo to create. - Memo memo = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The memo ID to use for this memo. - // If empty, a unique ID will be generated. - // Format: ^[a-zA-Z0-9]([a-zA-Z0-9-]{0,34}[a-zA-Z0-9])?$ - string memo_id = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -message ListMemosRequest { - // Optional. The maximum number of memos to return. - // The service may return fewer than this value. - // If unspecified, at most 50 memos will be returned. - // The maximum value is 1000; values above 1000 will be coerced to 1000. - int32 page_size = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A page token, received from a previous `ListMemos` call. - // Provide this to retrieve the subsequent page. - string page_token = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The state of the memos to list. - // Default to `NORMAL`. Set to `ARCHIVED` to list archived memos. - State state = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The order to sort results by. - // Default to "create_time desc". - // Supports comma-separated list of fields following AIP-132. - // Example: "pinned desc, create_time desc" or "update_time asc" - // Supported fields: pinned, create_time, update_time, name. - // Note: order_by uses create_time / update_time, while the filter - // expression uses created_ts / updated_ts for the same timestamps. - string order_by = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A CEL expression to filter memos. Combine terms with && and ||. - // Available fields: - // content (string), creator (string, e.g. "users/1"), - // created_ts / updated_ts (timestamp), pinned (bool), - // visibility (string: PRIVATE | PROTECTED | PUBLIC | SPACE), - // space (string resource name, or null when the memo has no space; - // supports == and comparisons against null, e.g. space != null), - // tags (list; match with `"work" in tags`, not `tag == "work"`), - // has_task_list / has_link / has_code / has_incomplete_tasks (bool), - // has_location (bool; true when the memo has a location attached). - // Note: the time fields here are created_ts / updated_ts, which differ from - // the create_time / update_time names used by order_by. - // Examples: - // pinned == true && visibility == "PUBLIC" - // space == "spaces/team" or space == null - // tags.exists(t, t == "urgent") - // content.contains("roadmap") && created_ts > now - duration("168h") - string filter = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If true, show deleted memos in the response. - bool show_deleted = 6 [(google.api.field_behavior) = OPTIONAL]; - - reserved 7, 8; - reserved "space", "unassigned"; -} - -message ListMemosResponse { - // The list of memos. - repeated Memo memos = 1; - - // A token that can be sent as `page_token` to retrieve the next page. - // If this field is omitted, there are no subsequent pages. - string next_page_token = 2; -} - -message GetMemoRequest { - // Required. The resource name of the memo. - // Format: memos/{memo} - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = {type: "memos.api.v1/Memo"} - ]; -} - -message UpdateMemoRequest { - // Required. The memo to update. - // The `name` field is required. - Memo memo = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The list of fields to update. - google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; -} - -message DeleteMemoRequest { - // Required. The resource name of the memo to delete. - // Format: memos/{memo} - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = {type: "memos.api.v1/Memo"} - ]; - - // Optional. If set to true, the memo will be deleted even if it has associated data. - bool force = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -message SetMemoAttachmentsRequest { - // Required. The resource name of the memo. - // Format: memos/{memo} - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = {type: "memos.api.v1/Memo"} - ]; - - // Required. The attachments to set for the memo. - repeated Attachment attachments = 2 [(google.api.field_behavior) = REQUIRED]; -} - -message ListMemoAttachmentsRequest { - // Required. The resource name of the memo. - // Format: memos/{memo} - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = {type: "memos.api.v1/Memo"} - ]; - - // Optional. The maximum number of attachments to return. - int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A page token for pagination. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -message ListMemoAttachmentsResponse { - // The list of attachments. - repeated Attachment attachments = 1; - - // A token for the next page of results. - string next_page_token = 2; -} - -message MemoRelation { - // The memo in the relation. - Memo memo = 1 [(google.api.field_behavior) = REQUIRED]; - - // The related memo. - Memo related_memo = 2 [(google.api.field_behavior) = REQUIRED]; - - // The type of the relation. - enum Type { - TYPE_UNSPECIFIED = 0; - REFERENCE = 1; - COMMENT = 2; - } - Type type = 3 [(google.api.field_behavior) = REQUIRED]; - - // Memo reference in relations. - message Memo { - // The resource name of the memo. - // Format: memos/{memo} - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = {type: "memos.api.v1/Memo"} - ]; - - // Output only. The snippet of the memo content. Plain text only. - string snippet = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - } -} - -message SetMemoRelationsRequest { - // Required. The resource name of the memo. - // Format: memos/{memo} - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = {type: "memos.api.v1/Memo"} - ]; - - // Required. The REFERENCE relations to set for the memo. COMMENT is invalid. - repeated MemoRelation relations = 2 [(google.api.field_behavior) = REQUIRED]; -} - -message ListMemoRelationsRequest { - // Required. The resource name of the memo. - // Format: memos/{memo} - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = {type: "memos.api.v1/Memo"} - ]; - - // Optional. The maximum number of relations to return. - int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A page token for pagination. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -message ListMemoRelationsResponse { - // The list of relations. - repeated MemoRelation relations = 1; - - // A token for the next page of results. - string next_page_token = 2; -} - -message CreateMemoCommentRequest { - // Required. The resource name of the memo. - // Format: memos/{memo} - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = {type: "memos.api.v1/Memo"} - ]; - - // Required. The comment to create. - Memo comment = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The comment ID to use. - string comment_id = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -message ListMemoCommentsRequest { - // Required. The resource name of the memo. - // Format: memos/{memo} - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = {type: "memos.api.v1/Memo"} - ]; - - // Optional. The maximum number of comments to return. - int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A page token for pagination. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The order to sort results by. - string order_by = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -message ListMemoCommentsResponse { - // The list of comment memos. - repeated Memo memos = 1; - - // A token for the next page of results. - string next_page_token = 2; -} - -message ListMemoReactionsRequest { - // Required. The resource name of the memo. - // Format: memos/{memo} - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = {type: "memos.api.v1/Memo"} - ]; - - // Optional. The maximum number of reactions to return. - int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A page token for pagination. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -message ListMemoReactionsResponse { - // The list of reactions. - repeated Reaction reactions = 1; - - // A token for the next page of results. - string next_page_token = 2; -} - -message UpsertMemoReactionRequest { - // Required. The resource name of the memo. - // Format: memos/{memo} - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = {type: "memos.api.v1/Memo"} - ]; - - // Required. The reaction to upsert. - Reaction reaction = 2 [(google.api.field_behavior) = REQUIRED]; -} - -message DeleteMemoReactionRequest { - // Required. The resource name of the reaction to delete. - // Format: memos/{memo}/reactions/{reaction} - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = {type: "memos.api.v1/Reaction"} - ]; -} - -// MemoShare is an access grant that permits read-only access to a memo via an opaque bearer token. -message MemoShare { - option (google.api.resource) = { - type: "memos.api.v1/MemoShare" - pattern: "memos/{memo}/shares/{share}" - singular: "share" - plural: "shares" - }; - - // The resource name of the share. Format: memos/{memo}/shares/{share} - // The {share} segment is the opaque token used in the share URL. - string name = 1 [(google.api.field_behavior) = IDENTIFIER]; - - // Output only. When this share link was created. - google.protobuf.Timestamp create_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. When set, the share link stops working after this time. - // If unset, the link never expires. - optional google.protobuf.Timestamp expire_time = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -message CreateMemoShareRequest { - // Required. The resource name of the memo to share. - // Format: memos/{memo} - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = {type: "memos.api.v1/Memo"} - ]; - - // Required. The share to create. - MemoShare memo_share = 2 [(google.api.field_behavior) = REQUIRED]; -} - -message ListMemoSharesRequest { - // Required. The resource name of the memo. - // Format: memos/{memo} - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = {type: "memos.api.v1/Memo"} - ]; -} - -message ListMemoSharesResponse { - // The list of share links. - repeated MemoShare memo_shares = 1; -} - -message DeleteMemoShareRequest { - // Required. The resource name of the share to delete. - // Format: memos/{memo}/shares/{share} - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = {type: "memos.api.v1/MemoShare"} - ]; -} - -message GetSharedMemoRequest { - // Required. The opaque bearer token extracted from the share URL. - string share_token = 1 [(google.api.field_behavior) = REQUIRED]; -} - -message GetLinkMetadataRequest { - // Required. The link URL. - string url = 1 [(google.api.field_behavior) = REQUIRED]; -} - -message BatchGetLinkMetadataRequest { - // Required. The link URLs. - repeated string urls = 1 [(google.api.field_behavior) = REQUIRED]; -} - -message BatchGetLinkMetadataResponse { - // The link metadata list, in the same order as the input URLs. - repeated LinkMetadata link_metadata = 1; -} - -message LinkMetadata { - // The original link URL. - string url = 1; - - // The link title. - string title = 2; - - // The link description. - string description = 3; - - // The link image URL. - string image = 4; -} diff --git a/proto/api/v1/space_service.proto b/proto/api/v1/space_service.proto deleted file mode 100644 index 7cb0a73bb..000000000 --- a/proto/api/v1/space_service.proto +++ /dev/null @@ -1,400 +0,0 @@ -syntax = "proto3"; - -package memos.api.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; - -option go_package = "gen/api/v1"; - -// SpaceService manages collaborative spaces and their memberships. -service SpaceService { - // CreateSpace creates a space and makes the authenticated caller its first - // administrator. - rpc CreateSpace(CreateSpaceRequest) returns (Space) { - option (google.api.http) = { - post: "/api/v1/spaces" - body: "space" - }; - option (google.api.method_signature) = "space"; - } - - // ListSpaces lists spaces of which the authenticated caller is a member. - rpc ListSpaces(ListSpacesRequest) returns (ListSpacesResponse) { - option (google.api.http) = {get: "/api/v1/spaces"}; - option (google.api.method_signature) = ""; - } - - // GetSpace gets a space of which the authenticated caller is a member. - rpc GetSpace(GetSpaceRequest) returns (Space) { - option (google.api.http) = {get: "/api/v1/{name=spaces/*}"}; - option (google.api.method_signature) = "name"; - } - - // UpdateSpace updates space metadata. - rpc UpdateSpace(UpdateSpaceRequest) returns (Space) { - option (google.api.http) = { - patch: "/api/v1/{space.name=spaces/*}" - body: "space" - }; - option (google.api.method_signature) = "space,update_mask"; - } - - // DeleteSpace permanently deletes a space and every memo currently placed - // in it. It never follows memo relations to other memos. - rpc DeleteSpace(DeleteSpaceRequest) returns (google.protobuf.Empty) { - option (google.api.http) = {delete: "/api/v1/{name=spaces/*}"}; - option (google.api.method_signature) = "name"; - } - - // CreateSpaceInvitation invites an existing active user to a space. - rpc CreateSpaceInvitation(CreateSpaceInvitationRequest) returns (SpaceInvitation) { - option (google.api.http) = { - post: "/api/v1/{parent=spaces/*}/invitations" - body: "space_invitation" - }; - option (google.api.method_signature) = "parent,space_invitation"; - } - - // ListSpaceInvitations lists the pending invitations for a space. - rpc ListSpaceInvitations(ListSpaceInvitationsRequest) returns (ListSpaceInvitationsResponse) { - option (google.api.http) = {get: "/api/v1/{parent=spaces/*}/invitations"}; - option (google.api.method_signature) = "parent"; - } - - // ListUserSpaceInvitations lists the authenticated user's pending space invitations. - rpc ListUserSpaceInvitations(ListUserSpaceInvitationsRequest) returns (ListUserSpaceInvitationsResponse) { - option (google.api.http) = {get: "/api/v1/{parent=users/*}/spaceInvitations"}; - option (google.api.method_signature) = "parent"; - } - - // GetSpaceInvitation gets one pending invitation. - rpc GetSpaceInvitation(GetSpaceInvitationRequest) returns (SpaceInvitation) { - option (google.api.http) = {get: "/api/v1/{name=spaces/*/invitations/*}"}; - option (google.api.method_signature) = "name"; - } - - // DeleteSpaceInvitation revokes a pending invitation. - rpc DeleteSpaceInvitation(DeleteSpaceInvitationRequest) returns (google.protobuf.Empty) { - option (google.api.http) = {delete: "/api/v1/{name=spaces/*/invitations/*}"}; - option (google.api.method_signature) = "name"; - } - - // AcceptSpaceInvitation accepts a pending invitation and creates a membership. - rpc AcceptSpaceInvitation(AcceptSpaceInvitationRequest) returns (SpaceMember) { - option (google.api.http) = { - post: "/api/v1/{name=spaces/*/invitations/*}:accept" - body: "*" - }; - option (google.api.method_signature) = "name"; - } - - // DeclineSpaceInvitation declines a pending invitation. - rpc DeclineSpaceInvitation(DeclineSpaceInvitationRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - post: "/api/v1/{name=spaces/*/invitations/*}:decline" - body: "*" - }; - option (google.api.method_signature) = "name"; - } - - // ListSpaceMembers lists the members of a space. - rpc ListSpaceMembers(ListSpaceMembersRequest) returns (ListSpaceMembersResponse) { - option (google.api.http) = {get: "/api/v1/{parent=spaces/*}/members"}; - option (google.api.method_signature) = "parent"; - } - - // GetSpaceMember gets one membership in a space. - rpc GetSpaceMember(GetSpaceMemberRequest) returns (SpaceMember) { - option (google.api.http) = {get: "/api/v1/{name=spaces/*/members/*}"}; - option (google.api.method_signature) = "name"; - } - - // UpdateSpaceMember changes a member's space role. - rpc UpdateSpaceMember(UpdateSpaceMemberRequest) returns (SpaceMember) { - option (google.api.http) = { - patch: "/api/v1/{space_member.name=spaces/*/members/*}" - body: "space_member" - }; - option (google.api.method_signature) = "space_member,update_mask"; - } - - // DeleteSpaceMember removes a member. A member may delete their own - // membership to leave the space. - rpc DeleteSpaceMember(DeleteSpaceMemberRequest) returns (google.protobuf.Empty) { - option (google.api.http) = {delete: "/api/v1/{name=spaces/*/members/*}"}; - option (google.api.method_signature) = "name"; - } -} - -// Space is a collaboration boundary for placed memos. -message Space { - option (google.api.resource) = { - type: "memos.api.v1/Space" - pattern: "spaces/{space}" - name_field: "name" - singular: "space" - plural: "spaces" - }; - - // The resource name of the space. Format: spaces/{space}. - string name = 1 [(google.api.field_behavior) = IDENTIFIER]; - - // Required. The human-readable title. - string title = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. A description of the space. - string description = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Output only. The authenticated user's membership role in this space. - // ROLE_UNSPECIFIED when this Space is exposed as metadata-only. - SpaceMember.Role current_user_role = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The number of accepted members in this space. Pending - // invitations are excluded. Zero when this Space is exposed as metadata-only. - int32 member_count = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. Display icon. Omit when updating with the "icon" mask to reset - // to the default Space mark. - Icon icon = 6 [(google.api.field_behavior) = OPTIONAL]; - - message Icon { - oneof value { - // A Unicode emoji sequence. - string emoji = 1; - // A canonical Lucide icon name, such as "leaf". - string lucide = 2; - } - } -} - -// SpaceMember is a user's membership and governance role in a space. -message SpaceMember { - option (google.api.resource) = { - type: "memos.api.v1/SpaceMember" - pattern: "spaces/{space}/members/{member}" - name_field: "name" - singular: "spaceMember" - plural: "spaceMembers" - }; - - enum Role { - ROLE_UNSPECIFIED = 0; - ADMIN = 1; - USER = 2; - } - - // The resource name. Format: spaces/{space}/members/{username}. - string name = 1 [(google.api.field_behavior) = IDENTIFIER]; - - // Required. The member user. Format: users/{username}. - string user = 2 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = {type: "memos.api.v1/User"} - ]; - - // Required. The member's role within this space. - Role role = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// SpaceInvitation is a pending invitation for an existing user to join a space. -message SpaceInvitation { - option (google.api.resource) = { - type: "memos.api.v1/SpaceInvitation" - pattern: "spaces/{space}/invitations/{invitation}" - name_field: "name" - singular: "spaceInvitation" - plural: "spaceInvitations" - }; - - // The resource name. Format: spaces/{space}/invitations/{username}. - string name = 1 [(google.api.field_behavior) = IDENTIFIER]; - - // Required. The invited user. Format: users/{username}. - string invitee = 2 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = {type: "memos.api.v1/User"} - ]; - - // Required. The role the user will receive after accepting the invitation. - SpaceMember.Role role = 3 [(google.api.field_behavior) = REQUIRED]; - - // Output only. The Space the user is invited to. This lets an invitee - // understand the invitation without granting membership-based GetSpace access. - Space space = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -message CreateSpaceRequest { - // Required. The space to create. - Space space = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The space UID to use for this space. - // If empty, a canonical UUID v4 will be generated. - // Format: ^[a-zA-Z0-9]([a-zA-Z0-9-]{0,34}[a-zA-Z0-9])?$ - string space_id = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -message ListSpacesRequest { - // Optional. The maximum number of spaces to return. - int32 page_size = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A token from a previous ListSpaces response. - string page_token = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -message ListSpacesResponse { - repeated Space spaces = 1; - string next_page_token = 2; -} - -message GetSpaceRequest { - // Required. The resource name of the space. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = {type: "memos.api.v1/Space"} - ]; -} - -message UpdateSpaceRequest { - // Required. The space with updated values. - Space space = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The fields to update: title or description. - google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; -} - -message DeleteSpaceRequest { - // Required. The resource name of the space. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = {type: "memos.api.v1/Space"} - ]; -} - -message CreateSpaceInvitationRequest { - // Required. The parent space. Format: spaces/{space}. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = {child_type: "memos.api.v1/SpaceInvitation"} - ]; - - // Required. The invitation to create. - SpaceInvitation space_invitation = 2 [(google.api.field_behavior) = REQUIRED]; -} - -message ListSpaceInvitationsRequest { - // Required. The parent space. Format: spaces/{space}. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = {child_type: "memos.api.v1/SpaceInvitation"} - ]; - - // Optional. The maximum number of invitations to return. - int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A token from a previous ListSpaceInvitations response. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -message ListSpaceInvitationsResponse { - repeated SpaceInvitation space_invitations = 1; - string next_page_token = 2; -} - -message ListUserSpaceInvitationsRequest { - // Required. The authenticated user. Format: users/{username}. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = {type: "memos.api.v1/User"} - ]; - - // Optional. The maximum number of invitations to return. - int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A token from a previous ListUserSpaceInvitations response. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -message ListUserSpaceInvitationsResponse { - repeated SpaceInvitation space_invitations = 1; - string next_page_token = 2; -} - -message GetSpaceInvitationRequest { - // Required. Format: spaces/{space}/invitations/{username}. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = {type: "memos.api.v1/SpaceInvitation"} - ]; -} - -message DeleteSpaceInvitationRequest { - // Required. Format: spaces/{space}/invitations/{username}. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = {type: "memos.api.v1/SpaceInvitation"} - ]; -} - -message AcceptSpaceInvitationRequest { - // Required. Format: spaces/{space}/invitations/{username}. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = {type: "memos.api.v1/SpaceInvitation"} - ]; -} - -message DeclineSpaceInvitationRequest { - // Required. Format: spaces/{space}/invitations/{username}. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = {type: "memos.api.v1/SpaceInvitation"} - ]; -} - -message ListSpaceMembersRequest { - // Required. The parent space. Format: spaces/{space}. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = {child_type: "memos.api.v1/SpaceMember"} - ]; - - // Optional. The maximum number of members to return. - int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A token from a previous ListSpaceMembers response. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -message ListSpaceMembersResponse { - repeated SpaceMember space_members = 1; - string next_page_token = 2; -} - -message GetSpaceMemberRequest { - // Required. Format: spaces/{space}/members/{username}. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = {type: "memos.api.v1/SpaceMember"} - ]; -} - -message UpdateSpaceMemberRequest { - // Required. The membership with the new role. - SpaceMember space_member = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Only role is supported. - google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; -} - -message DeleteSpaceMemberRequest { - // Required. Format: spaces/{space}/members/{username}. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = {type: "memos.api.v1/SpaceMember"} - ]; -} diff --git a/proto/api/v1/user_service.proto b/proto/api/v1/user_service.proto deleted file mode 100644 index 2ff03d984..000000000 --- a/proto/api/v1/user_service.proto +++ /dev/null @@ -1,1238 +0,0 @@ -syntax = "proto3"; - -package memos.api.v1; - -import "api/v1/common.proto"; -import "api/v1/space_service.proto"; -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/httpbody.proto"; -import "google/api/resource.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; -import "google/type/color.proto"; - -option go_package = "gen/api/v1"; - -service UserService { - // ListUsers returns a list of users. - rpc ListUsers(ListUsersRequest) returns (ListUsersResponse) { - option (google.api.http) = {get: "/api/v1/users"}; - } - - // BatchGetUsers returns active users by usernames. - rpc BatchGetUsers(BatchGetUsersRequest) returns (BatchGetUsersResponse) { - option (google.api.http) = { - post: "/api/v1/users:batchGet" - body: "*" - }; - } - - // GetUser gets a user by username. - // Format: users/{user} (e.g., users/steven) - rpc GetUser(GetUserRequest) returns (User) { - option (google.api.http) = {get: "/api/v1/{name=users/*}"}; - option (google.api.method_signature) = "name"; - } - - // CreateUser creates a new user. - rpc CreateUser(CreateUserRequest) returns (User) { - option (google.api.http) = { - post: "/api/v1/users" - body: "user" - }; - option (google.api.method_signature) = "user,user_id"; - } - - // UpdateUser updates a user. - rpc UpdateUser(UpdateUserRequest) returns (User) { - option (google.api.http) = { - patch: "/api/v1/{user.name=users/*}" - body: "user" - }; - option (google.api.method_signature) = "user,update_mask"; - } - - // DeleteUser deletes a user. - rpc DeleteUser(DeleteUserRequest) returns (google.protobuf.Empty) { - option (google.api.http) = {delete: "/api/v1/{name=users/*}"}; - option (google.api.method_signature) = "name"; - } - - // ListAllUserStats returns statistics for all users. - rpc ListAllUserStats(ListAllUserStatsRequest) returns (ListAllUserStatsResponse) { - option (google.api.http) = {get: "/api/v1/users:stats"}; - } - - // GetUserStats returns statistics for a specific user. - rpc GetUserStats(GetUserStatsRequest) returns (UserStats) { - option (google.api.http) = {get: "/api/v1/{name=users/*}:getStats"}; - option (google.api.method_signature) = "name"; - } - - // ExportMemos writes every memo the user created, with comments, archived - // memos, and attachment files, as a Memos export file (a ZIP file, see - // docs/design/memos-export-format.md). Only the user may export their own - // memos. The body is the archive; content_type is its media type. - rpc ExportMemos(ExportMemosRequest) returns (google.api.HttpBody) { - option (google.api.http) = {get: "/api/v1/{name=users/*}:exportMemos"}; - option (google.api.method_signature) = "name"; - } - - // 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. - rpc ImportMemos(ImportMemosRequest) returns (ImportMemosResponse) { - option (google.api.http) = { - post: "/api/v1/{name=users/*}:importMemos" - body: "*" - }; - } - - // GetUserSetting returns the user setting. - rpc GetUserSetting(GetUserSettingRequest) returns (UserSetting) { - option (google.api.http) = {get: "/api/v1/{name=users/*/settings/*}"}; - option (google.api.method_signature) = "name"; - } - - // UpdateUserSetting updates the user setting. - rpc UpdateUserSetting(UpdateUserSettingRequest) returns (UserSetting) { - option (google.api.http) = { - patch: "/api/v1/{setting.name=users/*/settings/*}" - body: "setting" - }; - option (google.api.method_signature) = "setting,update_mask"; - } - - // ListUserSettings returns a list of user settings. - rpc ListUserSettings(ListUserSettingsRequest) returns (ListUserSettingsResponse) { - option (google.api.http) = {get: "/api/v1/{parent=users/*}/settings"}; - option (google.api.method_signature) = "parent"; - } - - // ListMemoViews returns a user's memo views. Each view is a named, reusable - // CEL filter (see MemoView.filter); pass its filter string directly to the - // ListMemos `filter` argument. - rpc ListMemoViews(ListMemoViewsRequest) returns (ListMemoViewsResponse) { - option (google.api.http) = {get: "/api/v1/{parent=users/*}/views"}; - option (google.api.method_signature) = "parent"; - } - - // GetMemoView gets a memo view by name. - rpc GetMemoView(GetMemoViewRequest) returns (MemoView) { - option (google.api.http) = {get: "/api/v1/{name=users/*/views/*}"}; - option (google.api.method_signature) = "name"; - } - - // CreateMemoView creates a new memo view for a user. - rpc CreateMemoView(CreateMemoViewRequest) returns (MemoView) { - option (google.api.http) = { - post: "/api/v1/{parent=users/*}/views" - body: "memo_view" - }; - option (google.api.method_signature) = "parent,memo_view"; - } - - // UpdateMemoView updates a memo view for a user. - rpc UpdateMemoView(UpdateMemoViewRequest) returns (MemoView) { - option (google.api.http) = { - patch: "/api/v1/{memo_view.name=users/*/views/*}" - body: "memo_view" - }; - option (google.api.method_signature) = "memo_view,update_mask"; - } - - // DeleteMemoView deletes a memo view for a user. - rpc DeleteMemoView(DeleteMemoViewRequest) returns (google.protobuf.Empty) { - option (google.api.http) = {delete: "/api/v1/{name=users/*/views/*}"}; - option (google.api.method_signature) = "name"; - } - - // ListLinkedIdentities returns a list of linked SSO identities for a user. - rpc ListLinkedIdentities(ListLinkedIdentitiesRequest) returns (ListLinkedIdentitiesResponse) { - option (google.api.http) = {get: "/api/v1/{parent=users/*}/linkedIdentities"}; - option (google.api.method_signature) = "parent"; - } - - // CreateLinkedIdentity links an SSO identity to the authenticated user. - rpc CreateLinkedIdentity(CreateLinkedIdentityRequest) returns (LinkedIdentity) { - option (google.api.http) = { - post: "/api/v1/{parent=users/*}/linkedIdentities" - body: "*" - }; - option (google.api.method_signature) = "parent,idp_name"; - } - - // GetLinkedIdentity gets a linked SSO identity for a user. - rpc GetLinkedIdentity(GetLinkedIdentityRequest) returns (LinkedIdentity) { - option (google.api.http) = {get: "/api/v1/{name=users/*/linkedIdentities/*}"}; - option (google.api.method_signature) = "name"; - } - - // DeleteLinkedIdentity unlinks an SSO identity from a user. - rpc DeleteLinkedIdentity(DeleteLinkedIdentityRequest) returns (google.protobuf.Empty) { - option (google.api.http) = {delete: "/api/v1/{name=users/*/linkedIdentities/*}"}; - option (google.api.method_signature) = "name"; - } - - // ListPersonalAccessTokens returns a list of Personal Access Tokens (PATs) for a user. - // PATs are long-lived tokens for API/script access, distinct from short-lived JWT access tokens. - rpc ListPersonalAccessTokens(ListPersonalAccessTokensRequest) returns (ListPersonalAccessTokensResponse) { - option (google.api.http) = {get: "/api/v1/{parent=users/*}/personalAccessTokens"}; - option (google.api.method_signature) = "parent"; - } - - // CreatePersonalAccessToken creates a new Personal Access Token for a user. - // The token value is only returned once upon creation. - rpc CreatePersonalAccessToken(CreatePersonalAccessTokenRequest) returns (CreatePersonalAccessTokenResponse) { - option (google.api.http) = { - post: "/api/v1/{parent=users/*}/personalAccessTokens" - body: "*" - }; - } - - // DeletePersonalAccessToken deletes a Personal Access Token. - rpc DeletePersonalAccessToken(DeletePersonalAccessTokenRequest) returns (google.protobuf.Empty) { - option (google.api.http) = {delete: "/api/v1/{name=users/*/personalAccessTokens/*}"}; - option (google.api.method_signature) = "name"; - } - - // ListUserWebhooks returns a list of webhooks for a user. - rpc ListUserWebhooks(ListUserWebhooksRequest) returns (ListUserWebhooksResponse) { - option (google.api.http) = {get: "/api/v1/{parent=users/*}/webhooks"}; - option (google.api.method_signature) = "parent"; - } - - // CreateUserWebhook creates a new webhook for a user. - rpc CreateUserWebhook(CreateUserWebhookRequest) returns (UserWebhook) { - option (google.api.http) = { - post: "/api/v1/{parent=users/*}/webhooks" - body: "webhook" - }; - option (google.api.method_signature) = "parent,webhook"; - } - - // UpdateUserWebhook updates an existing webhook for a user. - rpc UpdateUserWebhook(UpdateUserWebhookRequest) returns (UserWebhook) { - option (google.api.http) = { - patch: "/api/v1/{webhook.name=users/*/webhooks/*}" - body: "webhook" - }; - option (google.api.method_signature) = "webhook,update_mask"; - } - - // DeleteUserWebhook deletes a webhook for a user. - rpc DeleteUserWebhook(DeleteUserWebhookRequest) returns (google.protobuf.Empty) { - option (google.api.http) = {delete: "/api/v1/{name=users/*/webhooks/*}"}; - option (google.api.method_signature) = "name"; - } - - // GetUserWebhookSigningSecret returns the signing secret for a webhook. - // The secret is returned only through this explicit, owner-gated call; it is - // never included in List/Create/Update responses. - rpc GetUserWebhookSigningSecret(GetUserWebhookSigningSecretRequest) returns (GetUserWebhookSigningSecretResponse) { - option (google.api.http) = {get: "/api/v1/{name=users/*/webhooks/*}:getSigningSecret"}; - option (google.api.method_signature) = "name"; - } - - // ListUserNotifications lists notifications for a user. - rpc ListUserNotifications(ListUserNotificationsRequest) returns (ListUserNotificationsResponse) { - option (google.api.http) = {get: "/api/v1/{parent=users/*}/notifications"}; - option (google.api.method_signature) = "parent"; - } - - // UpdateUserNotification updates a notification. - rpc UpdateUserNotification(UpdateUserNotificationRequest) returns (UserNotification) { - option (google.api.http) = { - patch: "/api/v1/{notification.name=users/*/notifications/*}" - body: "notification" - }; - option (google.api.method_signature) = "notification,update_mask"; - } - - // DeleteUserNotification deletes a notification. - rpc DeleteUserNotification(DeleteUserNotificationRequest) returns (google.protobuf.Empty) { - option (google.api.http) = {delete: "/api/v1/{name=users/*/notifications/*}"}; - option (google.api.method_signature) = "name"; - } -} - -message User { - option (google.api.resource) = { - type: "memos.api.v1/User" - pattern: "users/{user}" - name_field: "name" - singular: "user" - plural: "users" - }; - - // The resource name of the user. - // Format: users/{user} - string name = 1 [(google.api.field_behavior) = IDENTIFIER]; - - // The role of the user. - Role role = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The unique username for login. - string username = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The email address of the user. Stored trimmed and lowercased; - // empty means no address. An address belongs to at most one user on the - // instance, so writes that would reuse one fail with ALREADY_EXISTS. - string email = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The display name of the user. - string display_name = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The avatar URL of the user. - string avatar_url = 6 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The description of the user. - string description = 7 [(google.api.field_behavior) = OPTIONAL]; - - // Input only. The password for the user. - string password = 8 [(google.api.field_behavior) = INPUT_ONLY]; - - // The state of the user. - State state = 9 [(google.api.field_behavior) = REQUIRED]; - - // Output only. The creation timestamp. - google.protobuf.Timestamp create_time = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The last update timestamp. - google.protobuf.Timestamp update_time = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // User role enumeration. - enum Role { - ROLE_UNSPECIFIED = 0; - // Admin role with system access. - ADMIN = 2; - // User role with limited access. - USER = 3; - } -} - -message ListUsersRequest { - // Optional. The maximum number of users to return. - // The service may return fewer than this value. - // If unspecified, at most 50 users will be returned. - // The maximum value is 1000; values above 1000 will be coerced to 1000. - int32 page_size = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A page token, received from a previous `ListUsers` call. - // Provide this to retrieve the subsequent page. - string page_token = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Filter to apply to the list results. - // Example: "username == 'steven'" - // Supported operators: == - // Supported fields: username - string filter = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If true, show deleted users in the response. - bool show_deleted = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -message ListUsersResponse { - // The list of users. - repeated User users = 1; - - // A token that can be sent as `page_token` to retrieve the next page. - // If this field is omitted, there are no subsequent pages. - string next_page_token = 2; -} - -message BatchGetUsersRequest { - repeated string usernames = 1; -} - -message BatchGetUsersResponse { - repeated User users = 1; -} - -message GetUserRequest { - // Required. The resource name of the user. - // Format: users/{user} - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = {type: "memos.api.v1/User"} - ]; - - // Optional. The fields to return in the response. - // If not specified, all fields are returned. - google.protobuf.FieldMask read_mask = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -message CreateUserRequest { - // Required. The user to create. - User user = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.field_behavior) = INPUT_ONLY - ]; - - // Optional. The resource ID to use for this user. If set, it must equal - // user.username and follow the username format. - // Format: ^[a-zA-Z0-9]([a-zA-Z0-9-]{0,34}[a-zA-Z0-9])?$ - string user_id = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If set, validate the request but don't actually create the user. - bool validate_only = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. An idempotency token that can be used to ensure that multiple - // requests to create a user have the same result. - string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -message UpdateUserRequest { - // Required. The user to update. - User user = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The list of fields to update. - google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. If set to true, allows updating sensitive fields. - bool allow_missing = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -message DeleteUserRequest { - // Required. The resource name of the user to delete. - // Format: users/{user} - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = {type: "memos.api.v1/User"} - ]; - - // Optional. If set to true, the user will be deleted even if they have associated data. - bool force = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// User statistics messages -message UserStats { - option (google.api.resource) = { - type: "memos.api.v1/UserStats" - pattern: "users/{user}/stats" - singular: "userStats" - plural: "userStats" - }; - - // The resource name of the user statistics singleton. - // Format: users/{user}/stats - string name = 1 [(google.api.field_behavior) = IDENTIFIER]; - - reserved 2; - reserved "memo_display_timestamps"; - - // The stats of memo types. - MemoTypeStats memo_type_stats = 3; - - // The count of tags. - map tag_count = 4; - - // The creation timestamps of the user's memos. - repeated google.protobuf.Timestamp memo_created_timestamps = 7; - - // The latest update timestamps of the user's memos (one per memo, - // mirrors memo_created_timestamps). Used by the activity heatmap when - // the client's view is set to update_time basis. - repeated google.protobuf.Timestamp memo_updated_timestamps = 8; - - // The pinned memos of the user. - repeated string pinned_memos = 5 [(google.api.resource_reference) = {type: "memos.api.v1/Memo"}]; - - // Total memo count. - int32 total_memo_count = 6; - - // Total persisted attachment size in bytes, including unlinked uploads and - // attachments in all spaces. Excludes temporary uploads and derived files. - // Returned only by GetUserStats for the authenticated user's own stats, - // independently of the request's memo filter. - optional int64 attachment_storage_bytes = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Memo type statistics. - message MemoTypeStats { - int32 link_count = 1; - int32 code_count = 2; - int32 todo_count = 3; - int32 undo_count = 4; - } -} - -message ExportMemosRequest { - // Required. The user whose memos are exported. Must be the caller. - // Format: users/{user} - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = {type: "memos.api.v1/User"} - ]; -} - -message ImportMemosRequest { - // What the importer does with a memo whose UID the user already holds. - enum ConflictPolicy { - CONFLICT_POLICY_UNSPECIFIED = 0; - // Leave the existing memo untouched. This is the default. - SKIP = 1; - // Update the existing memo's content and metadata from the archive. - REPLACE = 2; - // Keep the existing memo and create the archive version under a fresh UID. - DUPLICATE = 3; - } - - // Required. The user who receives the memos. Must be the caller. - // Format: users/{user} - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = {type: "memos.api.v1/User"} - ]; - - // Required. Start a new upload or continue an existing one. - oneof upload { - // Starts a new upload. The same call may also carry data and finish_write. - ImportMemosSpec spec = 2; - - // Continues the upload identified by a previous response. - string upload_id = 3; - } - - // Required. Zero-based byte offset at which data is written. Must equal the - // committed size, except when retrying the most recently accepted chunk - // with identical bytes and offset, which is accepted without writing again. - int64 write_offset = 4 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Archive bytes, at most max_chunk_size long. With no data and - // finish_write false, the call reports progress without writing, and - // write_offset is ignored. - bytes data = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Finish the upload after writing data. The committed size must - // then equal total_size. The archive is validated and, unless - // validate_only is set, imported. Any later call for an imported upload - // returns the same report. - bool finish_write = 6 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. On a finishing call, validate the archive and return the plan - // without importing. The upload stays staged so a later finishing call can - // import it. - bool validate_only = 7 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Read on the finishing call that imports. Unspecified means SKIP. - ConflictPolicy conflict_policy = 8 [(google.api.field_behavior) = OPTIONAL]; -} - -message ImportMemosSpec { - // Optional. Total size of the archive in bytes. - int64 total_size = 1 [(google.api.field_behavior) = OPTIONAL]; -} - -message ImportMemosResponse { - // Opaque ID for subsequent calls. This is not a resource name. - string upload_id = 1; - - // Number of archive bytes committed so far. - int64 committed_size = 2; - - // Maximum number of data bytes accepted in one call. - int32 max_chunk_size = 3; - - // Set once the upload has been finished. - oneof result { - // What the import would do. Set by a finishing call with validate_only. - MemoImportPlan plan = 4; - - // What the import did. Set by a finishing call that imported. - MemoImportReport report = 5; - } -} - -// MemoImportIssue is one warning or failure of an import, tied to the memo -// UID from the archive when there is one. -message MemoImportIssue { - // The archive memo UID the issue concerns, if any. - string memo = 1; - - string message = 2; -} - -// MemoImportPlan describes what importing a staged archive would do. -message MemoImportPlan { - // When the archive was written. - google.protobuf.Timestamp export_time = 1; - - // Username of the user who exported the archive. - string exporter = 2; - - // The software that wrote the archive. - string generator = 3; - - // Number of memo records in the archive. - int32 memos = 4; - - // Number of attachment files in the archive. - int32 attachments = 5; - - // Memos whose UID nobody on the instance holds. - int32 new = 6; - - // Memos the user already holds; the conflict policy applies to them. - int32 existing = 7; - - // Memos whose UID another account holds; they are imported under fresh UIDs. - int32 renamed = 8; - - // Deviations the archive reader corrected while validating. - repeated MemoImportIssue warnings = 9; -} - -// MemoImportReport is the outcome of an import. -message MemoImportReport { - int32 created = 1; - - int32 updated = 2; - - int32 skipped = 3; - - int32 failed = 4; - - repeated MemoImportIssue warnings = 5; - - // One entry per failed memo, with the reason. - repeated MemoImportIssue failures = 6; -} - -message GetUserStatsRequest { - // Required. The resource name of the user. - // Format: users/{user} - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = {type: "memos.api.v1/User"} - ]; - - // Optional. CEL expression selecting the readable non-comment memos to - // include. Supports the same fields as ListMemos, including `space`. - string filter = 2 [(google.api.field_behavior) = OPTIONAL]; - - reserved 3; - reserved "space", "unassigned"; -} - -message ListAllUserStatsRequest { - // Optional. The state of memos to include. Defaults to NORMAL. - State state = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Filter to apply to memo stats. - // Uses the same filter syntax as ListMemos. - string filter = 2 [(google.api.field_behavior) = OPTIONAL]; - - reserved 3, 4; - reserved "space", "unassigned"; -} - -message ListAllUserStatsResponse { - // The list of user statistics. - repeated UserStats stats = 1; -} - -// User settings message -message UserSetting { - option (google.api.resource) = { - type: "memos.api.v1/UserSetting" - pattern: "users/{user}/settings/{setting}" - singular: "userSetting" - plural: "userSettings" - }; - - // The name of the user setting. - // Format: users/{user}/settings/{setting}, {setting} is the key for the setting. - // For example, "users/steven/settings/GENERAL" for general settings. - string name = 1 [(google.api.field_behavior) = IDENTIFIER]; - - oneof value { - GeneralSetting general_setting = 2; - WebhooksSetting webhooks_setting = 5; - TagsSetting tags_setting = 6; - } - - // Enumeration of user setting keys. - enum Key { - KEY_UNSPECIFIED = 0; - // GENERAL is the key for general user settings. - GENERAL = 1; - // WEBHOOKS is the key for user webhooks. - WEBHOOKS = 4; - // TAGS is the key for per-user tag metadata. - TAGS = 5; - } - - // General user settings configuration. - message GeneralSetting { - // The preferred locale of the user. - string locale = 1 [(google.api.field_behavior) = OPTIONAL]; - // The default visibility of the memo. - string memo_visibility = 3 [(google.api.field_behavior) = OPTIONAL]; - // The preferred theme of the user. - // This references a CSS file in the web/public/themes/ directory. - // If not set, the default theme will be used. - string theme = 4 [(google.api.field_behavior) = OPTIONAL]; - // Whether the official client should save metadata from future media uploads. - bool save_media_metadata = 5 [(google.api.field_behavior) = OPTIONAL]; - } - - // Tag metadata for user-specific display rules. - message TagMetadata { - // Optional background color for the tag label. - // When unset, the default tag color is used. - google.type.Color background_color = 1 [(google.api.field_behavior) = OPTIONAL]; - // Whether memos with this tag should have their content blurred. - bool blur_content = 2 [(google.api.field_behavior) = OPTIONAL]; - } - - // User-specific tag metadata. - message TagsSetting { - // Map of tag name pattern to tag metadata. - // Each key is treated as an anchored regular expression (^pattern$). - map tags = 1 [(google.api.field_behavior) = OPTIONAL]; - } - - // User webhooks configuration. - message WebhooksSetting { - // List of user webhooks. - repeated UserWebhook webhooks = 1; - } -} - -message GetUserSettingRequest { - // Required. The resource name of the user setting. - // Format: users/{user}/settings/{setting} - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = {type: "memos.api.v1/UserSetting"} - ]; -} - -message UpdateUserSettingRequest { - // Required. The user setting to update. - UserSetting setting = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The list of fields to update. - google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for ListUserSettings method. -message ListUserSettingsRequest { - // Required. The parent resource whose settings will be listed. - // Format: users/{user} - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = {type: "memos.api.v1/User"} - ]; - - // Optional. The maximum number of settings to return. - // The service may return fewer than this value. - // If unspecified, at most 50 settings will be returned. - // The maximum value is 1000; values above 1000 will be coerced to 1000. - int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A page token, received from a previous `ListUserSettings` call. - // Provide this to retrieve the subsequent page. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// Response message for ListUserSettings method. -message ListUserSettingsResponse { - // The list of user settings. - repeated UserSetting settings = 1; - - // A token that can be sent as `page_token` to retrieve the next page. - // If this field is omitted, there are no subsequent pages. - string next_page_token = 2; -} - -// Saved memo view messages -message MemoView { - option (google.api.resource) = { - type: "memos.api.v1/MemoView" - pattern: "users/{user}/views/{view}" - singular: "view" - plural: "views" - }; - - // The resource name of the memo view. - // Format: users/{user}/views/{view} - string name = 1 [(google.api.field_behavior) = IDENTIFIER]; - - // The title of the memo view. - string title = 2 [(google.api.field_behavior) = REQUIRED]; - - // The CEL filter expression for the memo view, using the same grammar as the - // ListMemos `filter` argument. Reuse it by passing this value to ListMemos. - string filter = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Display icon. Omit when updating with the "icon" mask to reset - // to the default view icon. - Icon icon = 4 [(google.api.field_behavior) = OPTIONAL]; - - message Icon { - oneof value { - // A Unicode emoji sequence. - string emoji = 1; - // A canonical Lucide icon name, such as "leaf". - string lucide = 2; - } - } -} - -message ListMemoViewsRequest { - // Required. The parent resource where memo views are listed. - // Format: users/{user} - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = {child_type: "memos.api.v1/MemoView"} - ]; -} - -message ListMemoViewsResponse { - // The list of memo views. - repeated MemoView memo_views = 1; -} - -message GetMemoViewRequest { - // Required. The resource name of the memo view to retrieve. - // Format: users/{user}/views/{view} - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = {type: "memos.api.v1/MemoView"} - ]; -} - -message CreateMemoViewRequest { - // Required. The parent resource where this memo view will be created. - // Format: users/{user} - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = {child_type: "memos.api.v1/MemoView"} - ]; - - // Required. The memo view to create. - MemoView memo_view = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. If set, validate the request, but do not actually create the memo view. - bool validate_only = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -message UpdateMemoViewRequest { - // Required. The memo view resource which replaces the resource on the server. - MemoView memo_view = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The list of fields to update. - google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -message DeleteMemoViewRequest { - // Required. The resource name of the memo view to delete. - // Format: users/{user}/views/{view} - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = {type: "memos.api.v1/MemoView"} - ]; -} - -// LinkedIdentity represents an SSO identity linked to a user account. -message LinkedIdentity { - option (google.api.resource) = { - type: "memos.api.v1/LinkedIdentity" - pattern: "users/{user}/linkedIdentities/{linked_identity}" - singular: "linkedIdentity" - plural: "linkedIdentities" - }; - - // The resource name of the linked identity. - // Format: users/{user}/linkedIdentities/{linked_identity} - string name = 1 [(google.api.field_behavior) = IDENTIFIER]; - - // The resource name of the identity provider. - // Format: identity-providers/{idp} - string idp_name = 2 [ - (google.api.field_behavior) = OUTPUT_ONLY, - (google.api.resource_reference) = {type: "memos.api.v1/IdentityProvider"} - ]; - - // The external user identifier from the identity provider. - string extern_uid = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -message ListLinkedIdentitiesRequest { - // Required. The parent resource whose linked identities will be listed. - // Format: users/{user} - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = {type: "memos.api.v1/User"} - ]; -} - -message ListLinkedIdentitiesResponse { - // The list of linked identities. - repeated LinkedIdentity linked_identities = 1; -} - -message CreateLinkedIdentityRequest { - // Required. The parent user who owns the linked identity. - // Format: users/{user} - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = {type: "memos.api.v1/User"} - ]; - - // Required. The identity provider to link. - // Format: identity-providers/{idp} - string idp_name = 2 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = {type: "memos.api.v1/IdentityProvider"} - ]; - - // Required. The authorization code from the identity provider. - string code = 3 [(google.api.field_behavior) = REQUIRED]; - - // Required. The redirect URI used in the OAuth flow. - string redirect_uri = 4 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The PKCE code verifier used in the OAuth flow. - string code_verifier = 5 [(google.api.field_behavior) = OPTIONAL]; -} - -message GetLinkedIdentityRequest { - // Required. The resource name of the linked identity to get. - // Format: users/{user}/linkedIdentities/{linked_identity} - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = {type: "memos.api.v1/LinkedIdentity"} - ]; -} - -message DeleteLinkedIdentityRequest { - // Required. The resource name of the linked identity to delete. - // Format: users/{user}/linkedIdentities/{linked_identity} - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = {type: "memos.api.v1/LinkedIdentity"} - ]; -} - -// PersonalAccessToken represents a long-lived token for API/script access. -// PATs are distinct from short-lived JWT access tokens used for session authentication. -message PersonalAccessToken { - option (google.api.resource) = { - type: "memos.api.v1/PersonalAccessToken" - pattern: "users/{user}/personalAccessTokens/{personal_access_token}" - singular: "personalAccessToken" - plural: "personalAccessTokens" - }; - - // The resource name of the personal access token. - // Format: users/{user}/personalAccessTokens/{personal_access_token} - string name = 1 [(google.api.field_behavior) = IDENTIFIER]; - - // The description of the token. - string description = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Output only. The creation timestamp. - google.protobuf.Timestamp created_at = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. The expiration timestamp. - google.protobuf.Timestamp expires_at = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Output only. The last used timestamp. - google.protobuf.Timestamp last_used_at = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -message ListPersonalAccessTokensRequest { - // Required. The parent resource whose personal access tokens will be listed. - // Format: users/{user} - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = {type: "memos.api.v1/User"} - ]; - - // Optional. The maximum number of tokens to return. - int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A page token for pagination. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -message ListPersonalAccessTokensResponse { - // The list of personal access tokens. - repeated PersonalAccessToken personal_access_tokens = 1; - - // A token for the next page of results. - string next_page_token = 2; -} - -message CreatePersonalAccessTokenRequest { - // Required. The parent resource where this token will be created. - // Format: users/{user} - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = {type: "memos.api.v1/User"} - ]; - - // Optional. Description of the personal access token. - string description = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Expiration duration in days (0 = never expires). - int32 expires_in_days = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -message CreatePersonalAccessTokenResponse { - // The personal access token metadata. - PersonalAccessToken personal_access_token = 1; - - // The actual token value - only returned on creation. - // This is the only time the token value will be visible. - string token = 2; -} - -message DeletePersonalAccessTokenRequest { - // Required. The resource name of the personal access token to delete. - // Format: users/{user}/personalAccessTokens/{personal_access_token} - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = {type: "memos.api.v1/PersonalAccessToken"} - ]; -} - -// UserWebhook represents a webhook owned by a user. -message UserWebhook { - option (google.api.resource) = { - type: "memos.api.v1/UserWebhook" - pattern: "users/{user}/webhooks/{webhook}" - singular: "userWebhook" - plural: "userWebhooks" - }; - - // The name of the webhook. - // Format: users/{user}/webhooks/{webhook} - string name = 1 [(google.api.field_behavior) = IDENTIFIER]; - - // The URL to send the webhook to. - string url = 2; - - // Optional. Human-readable name for the webhook. - string display_name = 3; - - // The creation time of the webhook. - google.protobuf.Timestamp create_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The last update time of the webhook. - google.protobuf.Timestamp update_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. Signing secret used to HMAC-SHA256 sign the webhook request body. - // This field is input-only; it is never returned in responses. - string signing_secret = 6 [(google.api.field_behavior) = INPUT_ONLY]; - - // Whether a signing secret is configured for this webhook. - bool signing_secret_set = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -message ListUserWebhooksRequest { - // The parent user resource. - // Format: users/{user} - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = {child_type: "memos.api.v1/UserWebhook"} - ]; -} - -message ListUserWebhooksResponse { - // The list of webhooks. - repeated UserWebhook webhooks = 1; -} - -message CreateUserWebhookRequest { - // The parent user resource. - // Format: users/{user} - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = {child_type: "memos.api.v1/UserWebhook"} - ]; - - // The webhook to create. - UserWebhook webhook = 2 [(google.api.field_behavior) = REQUIRED]; -} - -message UpdateUserWebhookRequest { - // The webhook to update. - UserWebhook webhook = 1 [(google.api.field_behavior) = REQUIRED]; - - // The list of fields to update. - google.protobuf.FieldMask update_mask = 2; -} - -message DeleteUserWebhookRequest { - // The name of the webhook to delete. - // Format: users/{user}/webhooks/{webhook} - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = {type: "memos.api.v1/UserWebhook"} - ]; -} - -message GetUserWebhookSigningSecretRequest { - // The name of the webhook whose signing secret to reveal. - // Format: users/{user}/webhooks/{webhook} - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = {type: "memos.api.v1/UserWebhook"} - ]; -} - -message GetUserWebhookSigningSecretResponse { - // The signing secret, in the Standard Webhooks "whsec_" form. - string signing_secret = 1; -} - -message UserNotification { - option (google.api.resource) = { - type: "memos.api.v1/UserNotification" - pattern: "users/{user}/notifications/{notification}" - name_field: "name" - singular: "notification" - plural: "notifications" - }; - - // The resource name of the notification. - // Format: users/{user}/notifications/{notification} - string name = 1 [ - (google.api.field_behavior) = OUTPUT_ONLY, - (google.api.field_behavior) = IDENTIFIER - ]; - - // The sender of the notification. - // Format: users/{user} - string sender = 2 [ - (google.api.field_behavior) = OUTPUT_ONLY, - (google.api.resource_reference) = {type: "memos.api.v1/User"} - ]; - - // The sender user details. - User sender_user = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The status of the notification. - Status status = 3 [(google.api.field_behavior) = OPTIONAL]; - - // The creation timestamp. - google.protobuf.Timestamp create_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The type of the notification. - Type type = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - oneof payload { - MemoCommentPayload memo_comment = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - MemoMentionPayload memo_mention = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; - SpaceInvitationPayload space_invitation = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; - } - - message MemoCommentPayload { - // The memo name of comment. - // Format: memos/{memo} - string memo = 1; - - // The name of related memo. - // Format: memos/{memo} - string related_memo = 2; - - // Preview text of the comment memo. - string memo_snippet = 3; - - // Preview text of the related memo. - string related_memo_snippet = 4; - } - - message MemoMentionPayload { - // The memo that contains the mention. - // Format: memos/{memo} - string memo = 1; - - // The related parent memo when the mention was created in a comment. - // Format: memos/{memo} - string related_memo = 2; - - // Preview text of the memo that contains the mention. - string memo_snippet = 3; - - // Preview text of the related parent memo. - string related_memo_snippet = 4; - } - - message SpaceInvitationPayload { - // The invitation resource. - // Format: spaces/{space}/invitations/{username} - string space_invitation = 1 [(google.api.resource_reference) = {type: "memos.api.v1/SpaceInvitation"}]; - - // The read-only Space summary carried by the invitation. - Space space = 2; - - // The role the invitation offers. - SpaceMember.Role role = 3; - - // The current state of the invitation for the receiver. - State state = 4; - - enum State { - STATE_UNSPECIFIED = 0; - // The receiver has not yet accepted or declined the invitation. - PENDING = 1; - // The receiver accepted the invitation and is an active member. - ACCEPTED = 2; - } - } - - enum Status { - STATUS_UNSPECIFIED = 0; - UNREAD = 1; - ARCHIVED = 2; - } - - enum Type { - TYPE_UNSPECIFIED = 0; - MEMO_COMMENT = 1; - MEMO_MENTION = 2; - SPACE_INVITATION = 3; - } -} - -message ListUserNotificationsRequest { - // The parent user resource. - // Format: users/{user} - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = {type: "memos.api.v1/User"} - ]; - - int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; - string filter = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -message ListUserNotificationsResponse { - repeated UserNotification notifications = 1; - string next_page_token = 2; -} - -message UpdateUserNotificationRequest { - UserNotification notification = 1 [(google.api.field_behavior) = REQUIRED]; - google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; -} - -message DeleteUserNotificationRequest { - // Format: users/{user}/notifications/{notification} - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = {type: "memos.api.v1/UserNotification"} - ]; -} diff --git a/proto/buf.gen.yaml b/proto/buf.gen.yaml index b7a25698b..2475507c1 100644 --- a/proto/buf.gen.yaml +++ b/proto/buf.gen.yaml @@ -14,7 +14,7 @@ plugins: - remote: buf.build/grpc/go out: gen opt: paths=source_relative - - remote: buf.build/connectrpc/go + - remote: buf.build/connectrpc/go:v1.20.0 out: gen opt: paths=source_relative - remote: buf.build/grpc-ecosystem/gateway diff --git a/proto/gen/api/v1/ai_service.pb.go b/proto/gen/api/ai_service.pb.go similarity index 62% rename from proto/gen/api/v1/ai_service.pb.go rename to proto/gen/api/ai_service.pb.go index 6b7bb50c8..157f920de 100644 --- a/proto/gen/api/v1/ai_service.pb.go +++ b/proto/gen/api/ai_service.pb.go @@ -2,9 +2,9 @@ // versions: // protoc-gen-go v1.36.12 // protoc (unknown) -// source: api/v1/ai_service.proto +// source: api/ai_service.proto -package apiv1 +package api import ( _ "google.golang.org/genproto/googleapis/api/annotations" @@ -22,9 +22,10 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) +// Request message for AIService.Transcribe. type TranscribeRequest struct { state protoimpl.MessageState `protogen:"open.v1"` - // Required. Audio input. + // Required. The audio to transcribe. Audio *TranscriptionAudio `protobuf:"bytes,1,opt,name=audio,proto3" json:"audio,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache @@ -32,7 +33,7 @@ type TranscribeRequest struct { func (x *TranscribeRequest) Reset() { *x = TranscribeRequest{} - mi := &file_api_v1_ai_service_proto_msgTypes[0] + mi := &file_api_ai_service_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -44,7 +45,7 @@ func (x *TranscribeRequest) String() string { func (*TranscribeRequest) ProtoMessage() {} func (x *TranscribeRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_ai_service_proto_msgTypes[0] + mi := &file_api_ai_service_proto_msgTypes[0] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -57,7 +58,7 @@ func (x *TranscribeRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use TranscribeRequest.ProtoReflect.Descriptor instead. func (*TranscribeRequest) Descriptor() ([]byte, []int) { - return file_api_v1_ai_service_proto_rawDescGZIP(), []int{0} + return file_api_ai_service_proto_rawDescGZIP(), []int{0} } func (x *TranscribeRequest) GetAudio() *TranscriptionAudio { @@ -67,16 +68,65 @@ func (x *TranscribeRequest) GetAudio() *TranscriptionAudio { return nil } +// Response message for AIService.Transcribe. +type TranscribeResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The transcribed text. + Text string `protobuf:"bytes,1,opt,name=text,proto3" json:"text,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TranscribeResponse) Reset() { + *x = TranscribeResponse{} + mi := &file_api_ai_service_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TranscribeResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TranscribeResponse) ProtoMessage() {} + +func (x *TranscribeResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_ai_service_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TranscribeResponse.ProtoReflect.Descriptor instead. +func (*TranscribeResponse) Descriptor() ([]byte, []int) { + return file_api_ai_service_proto_rawDescGZIP(), []int{1} +} + +func (x *TranscribeResponse) GetText() string { + if x != nil { + return x.Text + } + return "" +} + +// TranscriptionAudio is the audio input for a transcription. type TranscriptionAudio struct { state protoimpl.MessageState `protogen:"open.v1"` + // The audio source. Only inline content is supported. + // // Types that are valid to be assigned to Source: // // *TranscriptionAudio_Content // *TranscriptionAudio_Uri Source isTranscriptionAudio_Source `protobuf_oneof:"source"` - // Optional. The uploaded filename. + // Optional. The uploaded filename, at most 255 characters. Filename string `protobuf:"bytes,3,opt,name=filename,proto3" json:"filename,omitempty"` - // Optional. The MIME type of the input audio. + // Optional. The MIME type of the audio. If empty, the service detects it from the content. ContentType string `protobuf:"bytes,4,opt,name=content_type,json=contentType,proto3" json:"content_type,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache @@ -84,7 +134,7 @@ type TranscriptionAudio struct { func (x *TranscriptionAudio) Reset() { *x = TranscriptionAudio{} - mi := &file_api_v1_ai_service_proto_msgTypes[1] + mi := &file_api_ai_service_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -96,7 +146,7 @@ func (x *TranscriptionAudio) String() string { func (*TranscriptionAudio) ProtoMessage() {} func (x *TranscriptionAudio) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_ai_service_proto_msgTypes[1] + mi := &file_api_ai_service_proto_msgTypes[2] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -109,7 +159,7 @@ func (x *TranscriptionAudio) ProtoReflect() protoreflect.Message { // Deprecated: Use TranscriptionAudio.ProtoReflect.Descriptor instead. func (*TranscriptionAudio) Descriptor() ([]byte, []int) { - return file_api_v1_ai_service_proto_rawDescGZIP(), []int{1} + return file_api_ai_service_proto_rawDescGZIP(), []int{2} } func (x *TranscriptionAudio) GetSource() isTranscriptionAudio_Source { @@ -156,12 +206,12 @@ type isTranscriptionAudio_Source interface { } type TranscriptionAudio_Content struct { - // Inline audio bytes. + // Input only. Inline audio bytes, at most 25 MiB. Content []byte `protobuf:"bytes,1,opt,name=content,proto3,oneof"` } type TranscriptionAudio_Uri struct { - // URI for audio content. Reserved for future use. + // URI of the audio content. Reserved for future use; the service rejects requests that set it. Uri string `protobuf:"bytes,2,opt,name=uri,proto3,oneof"` } @@ -169,93 +219,49 @@ func (*TranscriptionAudio_Content) isTranscriptionAudio_Source() {} func (*TranscriptionAudio_Uri) isTranscriptionAudio_Source() {} -type TranscribeResponse struct { - state protoimpl.MessageState `protogen:"open.v1"` - // The transcribed text. - Text string `protobuf:"bytes,1,opt,name=text,proto3" json:"text,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} +var File_api_ai_service_proto protoreflect.FileDescriptor -func (x *TranscribeResponse) Reset() { - *x = TranscribeResponse{} - mi := &file_api_v1_ai_service_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *TranscribeResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*TranscribeResponse) ProtoMessage() {} - -func (x *TranscribeResponse) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_ai_service_proto_msgTypes[2] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use TranscribeResponse.ProtoReflect.Descriptor instead. -func (*TranscribeResponse) Descriptor() ([]byte, []int) { - return file_api_v1_ai_service_proto_rawDescGZIP(), []int{2} -} - -func (x *TranscribeResponse) GetText() string { - if x != nil { - return x.Text - } - return "" -} - -var File_api_v1_ai_service_proto protoreflect.FileDescriptor - -const file_api_v1_ai_service_proto_rawDesc = "" + +const file_api_ai_service_proto_rawDesc = "" + "\n" + - "\x17api/v1/ai_service.proto\x12\fmemos.api.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\"P\n" + - "\x11TranscribeRequest\x12;\n" + - "\x05audio\x18\x01 \x01(\v2 .memos.api.v1.TranscriptionAudioB\x03\xe0A\x02R\x05audio\"\x9c\x01\n" + + "\x14api/ai_service.proto\x12\tmemos.api\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\"M\n" + + "\x11TranscribeRequest\x128\n" + + "\x05audio\x18\x01 \x01(\v2\x1d.memos.api.TranscriptionAudioB\x03\xe0A\x02R\x05audio\"(\n" + + "\x12TranscribeResponse\x12\x12\n" + + "\x04text\x18\x01 \x01(\tR\x04text\"\x9c\x01\n" + "\x12TranscriptionAudio\x12\x1f\n" + "\acontent\x18\x01 \x01(\fB\x03\xe0A\x04H\x00R\acontent\x12\x12\n" + "\x03uri\x18\x02 \x01(\tH\x00R\x03uri\x12\x1f\n" + "\bfilename\x18\x03 \x01(\tB\x03\xe0A\x01R\bfilename\x12&\n" + "\fcontent_type\x18\x04 \x01(\tB\x03\xe0A\x01R\vcontentTypeB\b\n" + - "\x06source\"(\n" + - "\x12TranscribeResponse\x12\x12\n" + - "\x04text\x18\x01 \x01(\tR\x04text2\x86\x01\n" + - "\tAIService\x12y\n" + + "\x06source2}\n" + + "\tAIService\x12p\n" + "\n" + - "Transcribe\x12\x1f.memos.api.v1.TranscribeRequest\x1a .memos.api.v1.TranscribeResponse\"(\xdaA\x05audio\x82\xd3\xe4\x93\x02\x1a:\x01*\"\x15/api/v1/ai:transcribeB\xa6\x01\n" + - "\x10com.memos.api.v1B\x0eAiServiceProtoP\x01Z0github.com/usememos/memos/proto/gen/api/v1;apiv1\xa2\x02\x03MAX\xaa\x02\fMemos.Api.V1\xca\x02\fMemos\\Api\\V1\xe2\x02\x18Memos\\Api\\V1\\GPBMetadata\xea\x02\x0eMemos::Api::V1b\x06proto3" + "Transcribe\x12\x1c.memos.api.TranscribeRequest\x1a\x1d.memos.api.TranscribeResponse\"%\xdaA\x05audio\x82\xd3\xe4\x93\x02\x17:\x01*\"\x12/api/ai:transcribeB\x8d\x01\n" + + "\rcom.memos.apiB\x0eAiServiceProtoP\x01Z'github.com/usememos/memos/proto/gen/api\xa2\x02\x03MAX\xaa\x02\tMemos.Api\xca\x02\tMemos\\Api\xe2\x02\x15Memos\\Api\\GPBMetadata\xea\x02\n" + + "Memos::Apib\x06proto3" var ( - file_api_v1_ai_service_proto_rawDescOnce sync.Once - file_api_v1_ai_service_proto_rawDescData []byte + file_api_ai_service_proto_rawDescOnce sync.Once + file_api_ai_service_proto_rawDescData []byte ) -func file_api_v1_ai_service_proto_rawDescGZIP() []byte { - file_api_v1_ai_service_proto_rawDescOnce.Do(func() { - file_api_v1_ai_service_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_api_v1_ai_service_proto_rawDesc), len(file_api_v1_ai_service_proto_rawDesc))) +func file_api_ai_service_proto_rawDescGZIP() []byte { + file_api_ai_service_proto_rawDescOnce.Do(func() { + file_api_ai_service_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_api_ai_service_proto_rawDesc), len(file_api_ai_service_proto_rawDesc))) }) - return file_api_v1_ai_service_proto_rawDescData + return file_api_ai_service_proto_rawDescData } -var file_api_v1_ai_service_proto_msgTypes = make([]protoimpl.MessageInfo, 3) -var file_api_v1_ai_service_proto_goTypes = []any{ - (*TranscribeRequest)(nil), // 0: memos.api.v1.TranscribeRequest - (*TranscriptionAudio)(nil), // 1: memos.api.v1.TranscriptionAudio - (*TranscribeResponse)(nil), // 2: memos.api.v1.TranscribeResponse +var file_api_ai_service_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_api_ai_service_proto_goTypes = []any{ + (*TranscribeRequest)(nil), // 0: memos.api.TranscribeRequest + (*TranscribeResponse)(nil), // 1: memos.api.TranscribeResponse + (*TranscriptionAudio)(nil), // 2: memos.api.TranscriptionAudio } -var file_api_v1_ai_service_proto_depIdxs = []int32{ - 1, // 0: memos.api.v1.TranscribeRequest.audio:type_name -> memos.api.v1.TranscriptionAudio - 0, // 1: memos.api.v1.AIService.Transcribe:input_type -> memos.api.v1.TranscribeRequest - 2, // 2: memos.api.v1.AIService.Transcribe:output_type -> memos.api.v1.TranscribeResponse +var file_api_ai_service_proto_depIdxs = []int32{ + 2, // 0: memos.api.TranscribeRequest.audio:type_name -> memos.api.TranscriptionAudio + 0, // 1: memos.api.AIService.Transcribe:input_type -> memos.api.TranscribeRequest + 1, // 2: memos.api.AIService.Transcribe:output_type -> memos.api.TranscribeResponse 2, // [2:3] is the sub-list for method output_type 1, // [1:2] is the sub-list for method input_type 1, // [1:1] is the sub-list for extension type_name @@ -263,12 +269,12 @@ var file_api_v1_ai_service_proto_depIdxs = []int32{ 0, // [0:1] is the sub-list for field type_name } -func init() { file_api_v1_ai_service_proto_init() } -func file_api_v1_ai_service_proto_init() { - if File_api_v1_ai_service_proto != nil { +func init() { file_api_ai_service_proto_init() } +func file_api_ai_service_proto_init() { + if File_api_ai_service_proto != nil { return } - file_api_v1_ai_service_proto_msgTypes[1].OneofWrappers = []any{ + file_api_ai_service_proto_msgTypes[2].OneofWrappers = []any{ (*TranscriptionAudio_Content)(nil), (*TranscriptionAudio_Uri)(nil), } @@ -276,17 +282,17 @@ func file_api_v1_ai_service_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: unsafe.Slice(unsafe.StringData(file_api_v1_ai_service_proto_rawDesc), len(file_api_v1_ai_service_proto_rawDesc)), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_api_ai_service_proto_rawDesc), len(file_api_ai_service_proto_rawDesc)), NumEnums: 0, NumMessages: 3, NumExtensions: 0, NumServices: 1, }, - GoTypes: file_api_v1_ai_service_proto_goTypes, - DependencyIndexes: file_api_v1_ai_service_proto_depIdxs, - MessageInfos: file_api_v1_ai_service_proto_msgTypes, + GoTypes: file_api_ai_service_proto_goTypes, + DependencyIndexes: file_api_ai_service_proto_depIdxs, + MessageInfos: file_api_ai_service_proto_msgTypes, }.Build() - File_api_v1_ai_service_proto = out.File - file_api_v1_ai_service_proto_goTypes = nil - file_api_v1_ai_service_proto_depIdxs = nil + File_api_ai_service_proto = out.File + file_api_ai_service_proto_goTypes = nil + file_api_ai_service_proto_depIdxs = nil } diff --git a/proto/gen/api/v1/ai_service.pb.gw.go b/proto/gen/api/ai_service.pb.gw.go similarity index 94% rename from proto/gen/api/v1/ai_service.pb.gw.go rename to proto/gen/api/ai_service.pb.gw.go index c38e17301..e13247a83 100644 --- a/proto/gen/api/v1/ai_service.pb.gw.go +++ b/proto/gen/api/ai_service.pb.gw.go @@ -1,12 +1,12 @@ // Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: api/v1/ai_service.proto +// source: api/ai_service.proto /* -Package apiv1 is a reverse proxy. +Package api is a reverse proxy. It translates gRPC into RESTful JSON APIs. */ -package apiv1 +package api import ( "context" @@ -74,7 +74,7 @@ func RegisterAIServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.AIService/Transcribe", runtime.WithHTTPPathPattern("/api/v1/ai:transcribe")) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.AIService/Transcribe", runtime.WithHTTPPathPattern("/api/ai:transcribe")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -132,7 +132,7 @@ func RegisterAIServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.AIService/Transcribe", runtime.WithHTTPPathPattern("/api/v1/ai:transcribe")) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.AIService/Transcribe", runtime.WithHTTPPathPattern("/api/ai:transcribe")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -149,7 +149,7 @@ func RegisterAIServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, } var ( - pattern_AIService_Transcribe_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "v1", "ai"}, "transcribe")) + pattern_AIService_Transcribe_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"api", "ai"}, "transcribe")) ) var ( diff --git a/proto/gen/api/v1/ai_service_grpc.pb.go b/proto/gen/api/ai_service_grpc.pb.go similarity index 85% rename from proto/gen/api/v1/ai_service_grpc.pb.go rename to proto/gen/api/ai_service_grpc.pb.go index fdfff3642..105857ec2 100644 --- a/proto/gen/api/v1/ai_service_grpc.pb.go +++ b/proto/gen/api/ai_service_grpc.pb.go @@ -2,9 +2,9 @@ // versions: // - protoc-gen-go-grpc v1.6.2 // - protoc (unknown) -// source: api/v1/ai_service.proto +// source: api/ai_service.proto -package apiv1 +package api import ( context "context" @@ -19,14 +19,17 @@ import ( const _ = grpc.SupportPackageIsVersion9 const ( - AIService_Transcribe_FullMethodName = "/memos.api.v1.AIService/Transcribe" + AIService_Transcribe_FullMethodName = "/memos.api.AIService/Transcribe" ) // AIServiceClient is the client API for AIService service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +// +// AIService runs AI tasks through the AI providers configured on the instance. type AIServiceClient interface { - // Transcribe transcribes an audio file using an instance AI provider. + // Transcribe transcribes an audio file with the instance's configured + // transcription provider. The caller must be signed in, and requests are rate limited per user. Transcribe(ctx context.Context, in *TranscribeRequest, opts ...grpc.CallOption) (*TranscribeResponse, error) } @@ -51,8 +54,11 @@ func (c *aIServiceClient) Transcribe(ctx context.Context, in *TranscribeRequest, // AIServiceServer is the server API for AIService service. // All implementations must embed UnimplementedAIServiceServer // for forward compatibility. +// +// AIService runs AI tasks through the AI providers configured on the instance. type AIServiceServer interface { - // Transcribe transcribes an audio file using an instance AI provider. + // Transcribe transcribes an audio file with the instance's configured + // transcription provider. The caller must be signed in, and requests are rate limited per user. Transcribe(context.Context, *TranscribeRequest) (*TranscribeResponse, error) mustEmbedUnimplementedAIServiceServer() } @@ -110,7 +116,7 @@ func _AIService_Transcribe_Handler(srv interface{}, ctx context.Context, dec fun // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) var AIService_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "memos.api.v1.AIService", + ServiceName: "memos.api.AIService", HandlerType: (*AIServiceServer)(nil), Methods: []grpc.MethodDesc{ { @@ -119,5 +125,5 @@ var AIService_ServiceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: "api/v1/ai_service.proto", + Metadata: "api/ai_service.proto", } diff --git a/proto/gen/api/v1/apiv1connect/ai_service.connect.go b/proto/gen/api/apiconnect/ai_service.connect.go similarity index 63% rename from proto/gen/api/v1/apiv1connect/ai_service.connect.go rename to proto/gen/api/apiconnect/ai_service.connect.go index 5d992f9bd..8c761c894 100644 --- a/proto/gen/api/v1/apiv1connect/ai_service.connect.go +++ b/proto/gen/api/apiconnect/ai_service.connect.go @@ -1,14 +1,14 @@ // Code generated by protoc-gen-connect-go. DO NOT EDIT. // -// Source: api/v1/ai_service.proto +// Source: api/ai_service.proto -package apiv1connect +package apiconnect import ( connect "connectrpc.com/connect" context "context" errors "errors" - v1 "github.com/usememos/memos/proto/gen/api/v1" + api "github.com/usememos/memos/proto/gen/api" http "net/http" strings "strings" ) @@ -22,7 +22,7 @@ const _ = connect.IsAtLeastVersion1_13_0 const ( // AIServiceName is the fully-qualified name of the AIService service. - AIServiceName = "memos.api.v1.AIService" + AIServiceName = "memos.api.AIService" ) // These constants are the fully-qualified names of the RPCs defined in this package. They're @@ -34,17 +34,18 @@ const ( // period. const ( // AIServiceTranscribeProcedure is the fully-qualified name of the AIService's Transcribe RPC. - AIServiceTranscribeProcedure = "/memos.api.v1.AIService/Transcribe" + AIServiceTranscribeProcedure = "/memos.api.AIService/Transcribe" ) -// AIServiceClient is a client for the memos.api.v1.AIService service. +// AIServiceClient is a client for the memos.api.AIService service. type AIServiceClient interface { - // Transcribe transcribes an audio file using an instance AI provider. - Transcribe(context.Context, *connect.Request[v1.TranscribeRequest]) (*connect.Response[v1.TranscribeResponse], error) + // Transcribe transcribes an audio file with the instance's configured + // transcription provider. The caller must be signed in, and requests are rate limited per user. + Transcribe(context.Context, *connect.Request[api.TranscribeRequest]) (*connect.Response[api.TranscribeResponse], error) } -// NewAIServiceClient constructs a client for the memos.api.v1.AIService service. By default, it -// uses the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends +// NewAIServiceClient constructs a client for the memos.api.AIService 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. // @@ -52,9 +53,9 @@ type AIServiceClient interface { // http://api.acme.com or https://acme.com/grpc). func NewAIServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) AIServiceClient { baseURL = strings.TrimRight(baseURL, "/") - aIServiceMethods := v1.File_api_v1_ai_service_proto.Services().ByName("AIService").Methods() + aIServiceMethods := api.File_api_ai_service_proto.Services().ByName("AIService").Methods() return &aIServiceClient{ - transcribe: connect.NewClient[v1.TranscribeRequest, v1.TranscribeResponse]( + transcribe: connect.NewClient[api.TranscribeRequest, api.TranscribeResponse]( httpClient, baseURL+AIServiceTranscribeProcedure, connect.WithSchema(aIServiceMethods.ByName("Transcribe")), @@ -65,18 +66,19 @@ func NewAIServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...c // aIServiceClient implements AIServiceClient. type aIServiceClient struct { - transcribe *connect.Client[v1.TranscribeRequest, v1.TranscribeResponse] + transcribe *connect.Client[api.TranscribeRequest, api.TranscribeResponse] } -// Transcribe calls memos.api.v1.AIService.Transcribe. -func (c *aIServiceClient) Transcribe(ctx context.Context, req *connect.Request[v1.TranscribeRequest]) (*connect.Response[v1.TranscribeResponse], error) { +// Transcribe calls memos.api.AIService.Transcribe. +func (c *aIServiceClient) Transcribe(ctx context.Context, req *connect.Request[api.TranscribeRequest]) (*connect.Response[api.TranscribeResponse], error) { return c.transcribe.CallUnary(ctx, req) } -// AIServiceHandler is an implementation of the memos.api.v1.AIService service. +// AIServiceHandler is an implementation of the memos.api.AIService service. type AIServiceHandler interface { - // Transcribe transcribes an audio file using an instance AI provider. - Transcribe(context.Context, *connect.Request[v1.TranscribeRequest]) (*connect.Response[v1.TranscribeResponse], error) + // Transcribe transcribes an audio file with the instance's configured + // transcription provider. The caller must be signed in, and requests are rate limited per user. + Transcribe(context.Context, *connect.Request[api.TranscribeRequest]) (*connect.Response[api.TranscribeResponse], error) } // NewAIServiceHandler builds an HTTP handler from the service implementation. It returns the path @@ -85,14 +87,14 @@ type AIServiceHandler interface { // By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf // and JSON codecs. They also support gzip compression. func NewAIServiceHandler(svc AIServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) { - aIServiceMethods := v1.File_api_v1_ai_service_proto.Services().ByName("AIService").Methods() + aIServiceMethods := api.File_api_ai_service_proto.Services().ByName("AIService").Methods() aIServiceTranscribeHandler := connect.NewUnaryHandler( AIServiceTranscribeProcedure, svc.Transcribe, connect.WithSchema(aIServiceMethods.ByName("Transcribe")), connect.WithHandlerOptions(opts...), ) - return "/memos.api.v1.AIService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + return "/memos.api.AIService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { switch r.URL.Path { case AIServiceTranscribeProcedure: aIServiceTranscribeHandler.ServeHTTP(w, r) @@ -105,6 +107,6 @@ func NewAIServiceHandler(svc AIServiceHandler, opts ...connect.HandlerOption) (s // UnimplementedAIServiceHandler returns CodeUnimplemented from all methods. type UnimplementedAIServiceHandler struct{} -func (UnimplementedAIServiceHandler) Transcribe(context.Context, *connect.Request[v1.TranscribeRequest]) (*connect.Response[v1.TranscribeResponse], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.AIService.Transcribe is not implemented")) +func (UnimplementedAIServiceHandler) Transcribe(context.Context, *connect.Request[api.TranscribeRequest]) (*connect.Response[api.TranscribeResponse], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.AIService.Transcribe is not implemented")) } diff --git a/proto/gen/api/v1/apiv1connect/attachment_service.connect.go b/proto/gen/api/apiconnect/attachment_service.connect.go similarity index 53% rename from proto/gen/api/v1/apiv1connect/attachment_service.connect.go rename to proto/gen/api/apiconnect/attachment_service.connect.go index a49a235af..59eecd9cd 100644 --- a/proto/gen/api/v1/apiv1connect/attachment_service.connect.go +++ b/proto/gen/api/apiconnect/attachment_service.connect.go @@ -1,14 +1,14 @@ // Code generated by protoc-gen-connect-go. DO NOT EDIT. // -// Source: api/v1/attachment_service.proto +// Source: api/attachment_service.proto -package apiv1connect +package apiconnect import ( connect "connectrpc.com/connect" context "context" errors "errors" - v1 "github.com/usememos/memos/proto/gen/api/v1" + api "github.com/usememos/memos/proto/gen/api" emptypb "google.golang.org/protobuf/types/known/emptypb" http "net/http" strings "strings" @@ -23,7 +23,7 @@ const _ = connect.IsAtLeastVersion1_13_0 const ( // AttachmentServiceName is the fully-qualified name of the AttachmentService service. - AttachmentServiceName = "memos.api.v1.AttachmentService" + AttachmentServiceName = "memos.api.AttachmentService" ) // These constants are the fully-qualified names of the RPCs defined in this package. They're @@ -34,51 +34,53 @@ const ( // reflection-formatted method names, remove the leading slash and convert the remaining slash to a // period. const ( - // AttachmentServiceCreateAttachmentProcedure is the fully-qualified name of the AttachmentService's - // CreateAttachment RPC. - AttachmentServiceCreateAttachmentProcedure = "/memos.api.v1.AttachmentService/CreateAttachment" - // AttachmentServiceUploadAttachmentProcedure is the fully-qualified name of the AttachmentService's - // UploadAttachment RPC. - AttachmentServiceUploadAttachmentProcedure = "/memos.api.v1.AttachmentService/UploadAttachment" // AttachmentServiceListAttachmentsProcedure is the fully-qualified name of the AttachmentService's // ListAttachments RPC. - AttachmentServiceListAttachmentsProcedure = "/memos.api.v1.AttachmentService/ListAttachments" + AttachmentServiceListAttachmentsProcedure = "/memos.api.AttachmentService/ListAttachments" // AttachmentServiceGetAttachmentProcedure is the fully-qualified name of the AttachmentService's // GetAttachment RPC. - AttachmentServiceGetAttachmentProcedure = "/memos.api.v1.AttachmentService/GetAttachment" + AttachmentServiceGetAttachmentProcedure = "/memos.api.AttachmentService/GetAttachment" + // AttachmentServiceCreateAttachmentProcedure is the fully-qualified name of the AttachmentService's + // CreateAttachment RPC. + AttachmentServiceCreateAttachmentProcedure = "/memos.api.AttachmentService/CreateAttachment" // AttachmentServiceUpdateAttachmentProcedure is the fully-qualified name of the AttachmentService's // UpdateAttachment RPC. - AttachmentServiceUpdateAttachmentProcedure = "/memos.api.v1.AttachmentService/UpdateAttachment" + AttachmentServiceUpdateAttachmentProcedure = "/memos.api.AttachmentService/UpdateAttachment" // AttachmentServiceDeleteAttachmentProcedure is the fully-qualified name of the AttachmentService's // DeleteAttachment RPC. - AttachmentServiceDeleteAttachmentProcedure = "/memos.api.v1.AttachmentService/DeleteAttachment" + AttachmentServiceDeleteAttachmentProcedure = "/memos.api.AttachmentService/DeleteAttachment" // AttachmentServiceBatchDeleteAttachmentsProcedure is the fully-qualified name of the // AttachmentService's BatchDeleteAttachments RPC. - AttachmentServiceBatchDeleteAttachmentsProcedure = "/memos.api.v1.AttachmentService/BatchDeleteAttachments" + AttachmentServiceBatchDeleteAttachmentsProcedure = "/memos.api.AttachmentService/BatchDeleteAttachments" + // AttachmentServiceUploadAttachmentProcedure is the fully-qualified name of the AttachmentService's + // UploadAttachment RPC. + AttachmentServiceUploadAttachmentProcedure = "/memos.api.AttachmentService/UploadAttachment" ) -// AttachmentServiceClient is a client for the memos.api.v1.AttachmentService service. +// AttachmentServiceClient is a client for the memos.api.AttachmentService service. type AttachmentServiceClient interface { - // CreateAttachment creates a new attachment. - CreateAttachment(context.Context, *connect.Request[v1.CreateAttachmentRequest]) (*connect.Response[v1.Attachment], error) - // UploadAttachment uploads a file in bounded chunks. The first call carries - // the spec and returns an upload_id; later calls carry that upload_id. - // Uploads are bound to the authenticated user, expire after 30 minutes of + // ListAttachments lists attachments linked to memos the caller can read, plus the caller's unlinked uploads. + ListAttachments(context.Context, *connect.Request[api.ListAttachmentsRequest]) (*connect.Response[api.ListAttachmentsResponse], error) + // GetAttachment gets an attachment by name. An unlinked attachment is visible only to its uploader and admins; + // a linked attachment follows the read access of its memo. + GetAttachment(context.Context, *connect.Request[api.GetAttachmentRequest]) (*connect.Response[api.Attachment], error) + // CreateAttachment creates an attachment from inline content. + CreateAttachment(context.Context, *connect.Request[api.CreateAttachmentRequest]) (*connect.Response[api.Attachment], error) + // UpdateAttachment updates an attachment. Only `filename` can be updated. The caller must be the uploader or an + // admin. + UpdateAttachment(context.Context, *connect.Request[api.UpdateAttachmentRequest]) (*connect.Response[api.Attachment], error) + // DeleteAttachment deletes an attachment uploaded by the caller. + DeleteAttachment(context.Context, *connect.Request[api.DeleteAttachmentRequest]) (*connect.Response[emptypb.Empty], error) + // BatchDeleteAttachments deletes up to 100 attachments in one atomic request. The caller must be the uploader of + // each attachment or an admin. + BatchDeleteAttachments(context.Context, *connect.Request[api.BatchDeleteAttachmentsRequest]) (*connect.Response[emptypb.Empty], error) + // UploadAttachment uploads a file in bounded chunks. The first call carries the spec and returns an upload_id; + // later calls carry that upload_id. Uploads are bound to the authenticated user, expire after 30 minutes of // inactivity, and do not survive a server restart. - UploadAttachment(context.Context, *connect.Request[v1.UploadAttachmentRequest]) (*connect.Response[v1.UploadAttachmentResponse], error) - // ListAttachments lists attachments linked to readable memos and the caller's unlinked uploads. - ListAttachments(context.Context, *connect.Request[v1.ListAttachmentsRequest]) (*connect.Response[v1.ListAttachmentsResponse], error) - // GetAttachment returns an attachment by name. - GetAttachment(context.Context, *connect.Request[v1.GetAttachmentRequest]) (*connect.Response[v1.Attachment], error) - // UpdateAttachment updates an attachment. - UpdateAttachment(context.Context, *connect.Request[v1.UpdateAttachmentRequest]) (*connect.Response[v1.Attachment], error) - // DeleteAttachment deletes an attachment by name. - DeleteAttachment(context.Context, *connect.Request[v1.DeleteAttachmentRequest]) (*connect.Response[emptypb.Empty], error) - // BatchDeleteAttachments deletes multiple attachments in one request. - BatchDeleteAttachments(context.Context, *connect.Request[v1.BatchDeleteAttachmentsRequest]) (*connect.Response[emptypb.Empty], error) + UploadAttachment(context.Context, *connect.Request[api.UploadAttachmentRequest]) (*connect.Response[api.UploadAttachmentResponse], error) } -// NewAttachmentServiceClient constructs a client for the memos.api.v1.AttachmentService service. By +// NewAttachmentServiceClient constructs a client for the memos.api.AttachmentService 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. @@ -87,118 +89,120 @@ type AttachmentServiceClient interface { // http://api.acme.com or https://acme.com/grpc). func NewAttachmentServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) AttachmentServiceClient { baseURL = strings.TrimRight(baseURL, "/") - attachmentServiceMethods := v1.File_api_v1_attachment_service_proto.Services().ByName("AttachmentService").Methods() + attachmentServiceMethods := api.File_api_attachment_service_proto.Services().ByName("AttachmentService").Methods() return &attachmentServiceClient{ - createAttachment: connect.NewClient[v1.CreateAttachmentRequest, v1.Attachment]( - httpClient, - baseURL+AttachmentServiceCreateAttachmentProcedure, - connect.WithSchema(attachmentServiceMethods.ByName("CreateAttachment")), - connect.WithClientOptions(opts...), - ), - uploadAttachment: connect.NewClient[v1.UploadAttachmentRequest, v1.UploadAttachmentResponse]( - httpClient, - baseURL+AttachmentServiceUploadAttachmentProcedure, - connect.WithSchema(attachmentServiceMethods.ByName("UploadAttachment")), - connect.WithClientOptions(opts...), - ), - listAttachments: connect.NewClient[v1.ListAttachmentsRequest, v1.ListAttachmentsResponse]( + listAttachments: connect.NewClient[api.ListAttachmentsRequest, api.ListAttachmentsResponse]( httpClient, baseURL+AttachmentServiceListAttachmentsProcedure, connect.WithSchema(attachmentServiceMethods.ByName("ListAttachments")), connect.WithClientOptions(opts...), ), - getAttachment: connect.NewClient[v1.GetAttachmentRequest, v1.Attachment]( + getAttachment: connect.NewClient[api.GetAttachmentRequest, api.Attachment]( httpClient, baseURL+AttachmentServiceGetAttachmentProcedure, connect.WithSchema(attachmentServiceMethods.ByName("GetAttachment")), connect.WithClientOptions(opts...), ), - updateAttachment: connect.NewClient[v1.UpdateAttachmentRequest, v1.Attachment]( + createAttachment: connect.NewClient[api.CreateAttachmentRequest, api.Attachment]( + httpClient, + baseURL+AttachmentServiceCreateAttachmentProcedure, + connect.WithSchema(attachmentServiceMethods.ByName("CreateAttachment")), + connect.WithClientOptions(opts...), + ), + updateAttachment: connect.NewClient[api.UpdateAttachmentRequest, api.Attachment]( httpClient, baseURL+AttachmentServiceUpdateAttachmentProcedure, connect.WithSchema(attachmentServiceMethods.ByName("UpdateAttachment")), connect.WithClientOptions(opts...), ), - deleteAttachment: connect.NewClient[v1.DeleteAttachmentRequest, emptypb.Empty]( + deleteAttachment: connect.NewClient[api.DeleteAttachmentRequest, emptypb.Empty]( httpClient, baseURL+AttachmentServiceDeleteAttachmentProcedure, connect.WithSchema(attachmentServiceMethods.ByName("DeleteAttachment")), connect.WithClientOptions(opts...), ), - batchDeleteAttachments: connect.NewClient[v1.BatchDeleteAttachmentsRequest, emptypb.Empty]( + batchDeleteAttachments: connect.NewClient[api.BatchDeleteAttachmentsRequest, emptypb.Empty]( httpClient, baseURL+AttachmentServiceBatchDeleteAttachmentsProcedure, connect.WithSchema(attachmentServiceMethods.ByName("BatchDeleteAttachments")), connect.WithClientOptions(opts...), ), + uploadAttachment: connect.NewClient[api.UploadAttachmentRequest, api.UploadAttachmentResponse]( + httpClient, + baseURL+AttachmentServiceUploadAttachmentProcedure, + connect.WithSchema(attachmentServiceMethods.ByName("UploadAttachment")), + connect.WithClientOptions(opts...), + ), } } // attachmentServiceClient implements AttachmentServiceClient. type attachmentServiceClient struct { - createAttachment *connect.Client[v1.CreateAttachmentRequest, v1.Attachment] - uploadAttachment *connect.Client[v1.UploadAttachmentRequest, v1.UploadAttachmentResponse] - listAttachments *connect.Client[v1.ListAttachmentsRequest, v1.ListAttachmentsResponse] - getAttachment *connect.Client[v1.GetAttachmentRequest, v1.Attachment] - updateAttachment *connect.Client[v1.UpdateAttachmentRequest, v1.Attachment] - deleteAttachment *connect.Client[v1.DeleteAttachmentRequest, emptypb.Empty] - batchDeleteAttachments *connect.Client[v1.BatchDeleteAttachmentsRequest, emptypb.Empty] + listAttachments *connect.Client[api.ListAttachmentsRequest, api.ListAttachmentsResponse] + getAttachment *connect.Client[api.GetAttachmentRequest, api.Attachment] + createAttachment *connect.Client[api.CreateAttachmentRequest, api.Attachment] + updateAttachment *connect.Client[api.UpdateAttachmentRequest, api.Attachment] + deleteAttachment *connect.Client[api.DeleteAttachmentRequest, emptypb.Empty] + batchDeleteAttachments *connect.Client[api.BatchDeleteAttachmentsRequest, emptypb.Empty] + uploadAttachment *connect.Client[api.UploadAttachmentRequest, api.UploadAttachmentResponse] } -// CreateAttachment calls memos.api.v1.AttachmentService.CreateAttachment. -func (c *attachmentServiceClient) CreateAttachment(ctx context.Context, req *connect.Request[v1.CreateAttachmentRequest]) (*connect.Response[v1.Attachment], error) { - return c.createAttachment.CallUnary(ctx, req) -} - -// UploadAttachment calls memos.api.v1.AttachmentService.UploadAttachment. -func (c *attachmentServiceClient) UploadAttachment(ctx context.Context, req *connect.Request[v1.UploadAttachmentRequest]) (*connect.Response[v1.UploadAttachmentResponse], error) { - return c.uploadAttachment.CallUnary(ctx, req) -} - -// ListAttachments calls memos.api.v1.AttachmentService.ListAttachments. -func (c *attachmentServiceClient) ListAttachments(ctx context.Context, req *connect.Request[v1.ListAttachmentsRequest]) (*connect.Response[v1.ListAttachmentsResponse], error) { +// ListAttachments calls memos.api.AttachmentService.ListAttachments. +func (c *attachmentServiceClient) ListAttachments(ctx context.Context, req *connect.Request[api.ListAttachmentsRequest]) (*connect.Response[api.ListAttachmentsResponse], error) { return c.listAttachments.CallUnary(ctx, req) } -// GetAttachment calls memos.api.v1.AttachmentService.GetAttachment. -func (c *attachmentServiceClient) GetAttachment(ctx context.Context, req *connect.Request[v1.GetAttachmentRequest]) (*connect.Response[v1.Attachment], error) { +// GetAttachment calls memos.api.AttachmentService.GetAttachment. +func (c *attachmentServiceClient) GetAttachment(ctx context.Context, req *connect.Request[api.GetAttachmentRequest]) (*connect.Response[api.Attachment], error) { return c.getAttachment.CallUnary(ctx, req) } -// UpdateAttachment calls memos.api.v1.AttachmentService.UpdateAttachment. -func (c *attachmentServiceClient) UpdateAttachment(ctx context.Context, req *connect.Request[v1.UpdateAttachmentRequest]) (*connect.Response[v1.Attachment], error) { +// CreateAttachment calls memos.api.AttachmentService.CreateAttachment. +func (c *attachmentServiceClient) CreateAttachment(ctx context.Context, req *connect.Request[api.CreateAttachmentRequest]) (*connect.Response[api.Attachment], error) { + return c.createAttachment.CallUnary(ctx, req) +} + +// UpdateAttachment calls memos.api.AttachmentService.UpdateAttachment. +func (c *attachmentServiceClient) UpdateAttachment(ctx context.Context, req *connect.Request[api.UpdateAttachmentRequest]) (*connect.Response[api.Attachment], error) { return c.updateAttachment.CallUnary(ctx, req) } -// DeleteAttachment calls memos.api.v1.AttachmentService.DeleteAttachment. -func (c *attachmentServiceClient) DeleteAttachment(ctx context.Context, req *connect.Request[v1.DeleteAttachmentRequest]) (*connect.Response[emptypb.Empty], error) { +// DeleteAttachment calls memos.api.AttachmentService.DeleteAttachment. +func (c *attachmentServiceClient) DeleteAttachment(ctx context.Context, req *connect.Request[api.DeleteAttachmentRequest]) (*connect.Response[emptypb.Empty], error) { return c.deleteAttachment.CallUnary(ctx, req) } -// BatchDeleteAttachments calls memos.api.v1.AttachmentService.BatchDeleteAttachments. -func (c *attachmentServiceClient) BatchDeleteAttachments(ctx context.Context, req *connect.Request[v1.BatchDeleteAttachmentsRequest]) (*connect.Response[emptypb.Empty], error) { +// BatchDeleteAttachments calls memos.api.AttachmentService.BatchDeleteAttachments. +func (c *attachmentServiceClient) BatchDeleteAttachments(ctx context.Context, req *connect.Request[api.BatchDeleteAttachmentsRequest]) (*connect.Response[emptypb.Empty], error) { return c.batchDeleteAttachments.CallUnary(ctx, req) } -// AttachmentServiceHandler is an implementation of the memos.api.v1.AttachmentService service. +// UploadAttachment calls memos.api.AttachmentService.UploadAttachment. +func (c *attachmentServiceClient) UploadAttachment(ctx context.Context, req *connect.Request[api.UploadAttachmentRequest]) (*connect.Response[api.UploadAttachmentResponse], error) { + return c.uploadAttachment.CallUnary(ctx, req) +} + +// AttachmentServiceHandler is an implementation of the memos.api.AttachmentService service. type AttachmentServiceHandler interface { - // CreateAttachment creates a new attachment. - CreateAttachment(context.Context, *connect.Request[v1.CreateAttachmentRequest]) (*connect.Response[v1.Attachment], error) - // UploadAttachment uploads a file in bounded chunks. The first call carries - // the spec and returns an upload_id; later calls carry that upload_id. - // Uploads are bound to the authenticated user, expire after 30 minutes of + // ListAttachments lists attachments linked to memos the caller can read, plus the caller's unlinked uploads. + ListAttachments(context.Context, *connect.Request[api.ListAttachmentsRequest]) (*connect.Response[api.ListAttachmentsResponse], error) + // GetAttachment gets an attachment by name. An unlinked attachment is visible only to its uploader and admins; + // a linked attachment follows the read access of its memo. + GetAttachment(context.Context, *connect.Request[api.GetAttachmentRequest]) (*connect.Response[api.Attachment], error) + // CreateAttachment creates an attachment from inline content. + CreateAttachment(context.Context, *connect.Request[api.CreateAttachmentRequest]) (*connect.Response[api.Attachment], error) + // UpdateAttachment updates an attachment. Only `filename` can be updated. The caller must be the uploader or an + // admin. + UpdateAttachment(context.Context, *connect.Request[api.UpdateAttachmentRequest]) (*connect.Response[api.Attachment], error) + // DeleteAttachment deletes an attachment uploaded by the caller. + DeleteAttachment(context.Context, *connect.Request[api.DeleteAttachmentRequest]) (*connect.Response[emptypb.Empty], error) + // BatchDeleteAttachments deletes up to 100 attachments in one atomic request. The caller must be the uploader of + // each attachment or an admin. + BatchDeleteAttachments(context.Context, *connect.Request[api.BatchDeleteAttachmentsRequest]) (*connect.Response[emptypb.Empty], error) + // UploadAttachment uploads a file in bounded chunks. The first call carries the spec and returns an upload_id; + // later calls carry that upload_id. Uploads are bound to the authenticated user, expire after 30 minutes of // inactivity, and do not survive a server restart. - UploadAttachment(context.Context, *connect.Request[v1.UploadAttachmentRequest]) (*connect.Response[v1.UploadAttachmentResponse], error) - // ListAttachments lists attachments linked to readable memos and the caller's unlinked uploads. - ListAttachments(context.Context, *connect.Request[v1.ListAttachmentsRequest]) (*connect.Response[v1.ListAttachmentsResponse], error) - // GetAttachment returns an attachment by name. - GetAttachment(context.Context, *connect.Request[v1.GetAttachmentRequest]) (*connect.Response[v1.Attachment], error) - // UpdateAttachment updates an attachment. - UpdateAttachment(context.Context, *connect.Request[v1.UpdateAttachmentRequest]) (*connect.Response[v1.Attachment], error) - // DeleteAttachment deletes an attachment by name. - DeleteAttachment(context.Context, *connect.Request[v1.DeleteAttachmentRequest]) (*connect.Response[emptypb.Empty], error) - // BatchDeleteAttachments deletes multiple attachments in one request. - BatchDeleteAttachments(context.Context, *connect.Request[v1.BatchDeleteAttachmentsRequest]) (*connect.Response[emptypb.Empty], error) + UploadAttachment(context.Context, *connect.Request[api.UploadAttachmentRequest]) (*connect.Response[api.UploadAttachmentResponse], error) } // NewAttachmentServiceHandler builds an HTTP handler from the service implementation. It returns @@ -207,19 +211,7 @@ type AttachmentServiceHandler interface { // By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf // and JSON codecs. They also support gzip compression. func NewAttachmentServiceHandler(svc AttachmentServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) { - attachmentServiceMethods := v1.File_api_v1_attachment_service_proto.Services().ByName("AttachmentService").Methods() - attachmentServiceCreateAttachmentHandler := connect.NewUnaryHandler( - AttachmentServiceCreateAttachmentProcedure, - svc.CreateAttachment, - connect.WithSchema(attachmentServiceMethods.ByName("CreateAttachment")), - connect.WithHandlerOptions(opts...), - ) - attachmentServiceUploadAttachmentHandler := connect.NewUnaryHandler( - AttachmentServiceUploadAttachmentProcedure, - svc.UploadAttachment, - connect.WithSchema(attachmentServiceMethods.ByName("UploadAttachment")), - connect.WithHandlerOptions(opts...), - ) + attachmentServiceMethods := api.File_api_attachment_service_proto.Services().ByName("AttachmentService").Methods() attachmentServiceListAttachmentsHandler := connect.NewUnaryHandler( AttachmentServiceListAttachmentsProcedure, svc.ListAttachments, @@ -232,6 +224,12 @@ func NewAttachmentServiceHandler(svc AttachmentServiceHandler, opts ...connect.H connect.WithSchema(attachmentServiceMethods.ByName("GetAttachment")), connect.WithHandlerOptions(opts...), ) + attachmentServiceCreateAttachmentHandler := connect.NewUnaryHandler( + AttachmentServiceCreateAttachmentProcedure, + svc.CreateAttachment, + connect.WithSchema(attachmentServiceMethods.ByName("CreateAttachment")), + connect.WithHandlerOptions(opts...), + ) attachmentServiceUpdateAttachmentHandler := connect.NewUnaryHandler( AttachmentServiceUpdateAttachmentProcedure, svc.UpdateAttachment, @@ -250,22 +248,28 @@ func NewAttachmentServiceHandler(svc AttachmentServiceHandler, opts ...connect.H connect.WithSchema(attachmentServiceMethods.ByName("BatchDeleteAttachments")), connect.WithHandlerOptions(opts...), ) - return "/memos.api.v1.AttachmentService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + attachmentServiceUploadAttachmentHandler := connect.NewUnaryHandler( + AttachmentServiceUploadAttachmentProcedure, + svc.UploadAttachment, + connect.WithSchema(attachmentServiceMethods.ByName("UploadAttachment")), + connect.WithHandlerOptions(opts...), + ) + return "/memos.api.AttachmentService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { switch r.URL.Path { - case AttachmentServiceCreateAttachmentProcedure: - attachmentServiceCreateAttachmentHandler.ServeHTTP(w, r) - case AttachmentServiceUploadAttachmentProcedure: - attachmentServiceUploadAttachmentHandler.ServeHTTP(w, r) case AttachmentServiceListAttachmentsProcedure: attachmentServiceListAttachmentsHandler.ServeHTTP(w, r) case AttachmentServiceGetAttachmentProcedure: attachmentServiceGetAttachmentHandler.ServeHTTP(w, r) + case AttachmentServiceCreateAttachmentProcedure: + attachmentServiceCreateAttachmentHandler.ServeHTTP(w, r) case AttachmentServiceUpdateAttachmentProcedure: attachmentServiceUpdateAttachmentHandler.ServeHTTP(w, r) case AttachmentServiceDeleteAttachmentProcedure: attachmentServiceDeleteAttachmentHandler.ServeHTTP(w, r) case AttachmentServiceBatchDeleteAttachmentsProcedure: attachmentServiceBatchDeleteAttachmentsHandler.ServeHTTP(w, r) + case AttachmentServiceUploadAttachmentProcedure: + attachmentServiceUploadAttachmentHandler.ServeHTTP(w, r) default: http.NotFound(w, r) } @@ -275,30 +279,30 @@ func NewAttachmentServiceHandler(svc AttachmentServiceHandler, opts ...connect.H // UnimplementedAttachmentServiceHandler returns CodeUnimplemented from all methods. type UnimplementedAttachmentServiceHandler struct{} -func (UnimplementedAttachmentServiceHandler) CreateAttachment(context.Context, *connect.Request[v1.CreateAttachmentRequest]) (*connect.Response[v1.Attachment], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.AttachmentService.CreateAttachment is not implemented")) +func (UnimplementedAttachmentServiceHandler) ListAttachments(context.Context, *connect.Request[api.ListAttachmentsRequest]) (*connect.Response[api.ListAttachmentsResponse], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.AttachmentService.ListAttachments is not implemented")) } -func (UnimplementedAttachmentServiceHandler) UploadAttachment(context.Context, *connect.Request[v1.UploadAttachmentRequest]) (*connect.Response[v1.UploadAttachmentResponse], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.AttachmentService.UploadAttachment is not implemented")) +func (UnimplementedAttachmentServiceHandler) GetAttachment(context.Context, *connect.Request[api.GetAttachmentRequest]) (*connect.Response[api.Attachment], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.AttachmentService.GetAttachment is not implemented")) } -func (UnimplementedAttachmentServiceHandler) ListAttachments(context.Context, *connect.Request[v1.ListAttachmentsRequest]) (*connect.Response[v1.ListAttachmentsResponse], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.AttachmentService.ListAttachments is not implemented")) +func (UnimplementedAttachmentServiceHandler) CreateAttachment(context.Context, *connect.Request[api.CreateAttachmentRequest]) (*connect.Response[api.Attachment], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.AttachmentService.CreateAttachment is not implemented")) } -func (UnimplementedAttachmentServiceHandler) GetAttachment(context.Context, *connect.Request[v1.GetAttachmentRequest]) (*connect.Response[v1.Attachment], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.AttachmentService.GetAttachment is not implemented")) +func (UnimplementedAttachmentServiceHandler) UpdateAttachment(context.Context, *connect.Request[api.UpdateAttachmentRequest]) (*connect.Response[api.Attachment], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.AttachmentService.UpdateAttachment is not implemented")) } -func (UnimplementedAttachmentServiceHandler) UpdateAttachment(context.Context, *connect.Request[v1.UpdateAttachmentRequest]) (*connect.Response[v1.Attachment], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.AttachmentService.UpdateAttachment is not implemented")) +func (UnimplementedAttachmentServiceHandler) DeleteAttachment(context.Context, *connect.Request[api.DeleteAttachmentRequest]) (*connect.Response[emptypb.Empty], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.AttachmentService.DeleteAttachment is not implemented")) } -func (UnimplementedAttachmentServiceHandler) DeleteAttachment(context.Context, *connect.Request[v1.DeleteAttachmentRequest]) (*connect.Response[emptypb.Empty], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.AttachmentService.DeleteAttachment is not implemented")) +func (UnimplementedAttachmentServiceHandler) BatchDeleteAttachments(context.Context, *connect.Request[api.BatchDeleteAttachmentsRequest]) (*connect.Response[emptypb.Empty], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.AttachmentService.BatchDeleteAttachments is not implemented")) } -func (UnimplementedAttachmentServiceHandler) BatchDeleteAttachments(context.Context, *connect.Request[v1.BatchDeleteAttachmentsRequest]) (*connect.Response[emptypb.Empty], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.AttachmentService.BatchDeleteAttachments is not implemented")) +func (UnimplementedAttachmentServiceHandler) UploadAttachment(context.Context, *connect.Request[api.UploadAttachmentRequest]) (*connect.Response[api.UploadAttachmentResponse], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.AttachmentService.UploadAttachment is not implemented")) } diff --git a/proto/gen/api/v1/apiv1connect/auth_service.connect.go b/proto/gen/api/apiconnect/auth_service.connect.go similarity index 51% rename from proto/gen/api/v1/apiv1connect/auth_service.connect.go rename to proto/gen/api/apiconnect/auth_service.connect.go index 1293e4026..139060540 100644 --- a/proto/gen/api/v1/apiv1connect/auth_service.connect.go +++ b/proto/gen/api/apiconnect/auth_service.connect.go @@ -1,14 +1,14 @@ // Code generated by protoc-gen-connect-go. DO NOT EDIT. // -// Source: api/v1/auth_service.proto +// Source: api/auth_service.proto -package apiv1connect +package apiconnect import ( connect "connectrpc.com/connect" context "context" errors "errors" - v1 "github.com/usememos/memos/proto/gen/api/v1" + api "github.com/usememos/memos/proto/gen/api" emptypb "google.golang.org/protobuf/types/known/emptypb" http "net/http" strings "strings" @@ -23,7 +23,7 @@ const _ = connect.IsAtLeastVersion1_13_0 const ( // AuthServiceName is the fully-qualified name of the AuthService service. - AuthServiceName = "memos.api.v1.AuthService" + AuthServiceName = "memos.api.AuthService" ) // These constants are the fully-qualified names of the RPCs defined in this package. They're @@ -34,38 +34,39 @@ const ( // reflection-formatted method names, remove the leading slash and convert the remaining slash to a // period. const ( - // AuthServiceGetCurrentUserProcedure is the fully-qualified name of the AuthService's - // GetCurrentUser RPC. - AuthServiceGetCurrentUserProcedure = "/memos.api.v1.AuthService/GetCurrentUser" // AuthServiceSignInProcedure is the fully-qualified name of the AuthService's SignIn RPC. - AuthServiceSignInProcedure = "/memos.api.v1.AuthService/SignIn" - // AuthServiceSignOutProcedure is the fully-qualified name of the AuthService's SignOut RPC. - AuthServiceSignOutProcedure = "/memos.api.v1.AuthService/SignOut" + AuthServiceSignInProcedure = "/memos.api.AuthService/SignIn" // AuthServiceRefreshTokenProcedure is the fully-qualified name of the AuthService's RefreshToken // RPC. - AuthServiceRefreshTokenProcedure = "/memos.api.v1.AuthService/RefreshToken" + AuthServiceRefreshTokenProcedure = "/memos.api.AuthService/RefreshToken" + // AuthServiceGetCurrentUserProcedure is the fully-qualified name of the AuthService's + // GetCurrentUser RPC. + AuthServiceGetCurrentUserProcedure = "/memos.api.AuthService/GetCurrentUser" + // AuthServiceSignOutProcedure is the fully-qualified name of the AuthService's SignOut RPC. + AuthServiceSignOutProcedure = "/memos.api.AuthService/SignOut" ) -// AuthServiceClient is a client for the memos.api.v1.AuthService service. +// AuthServiceClient is a client for the memos.api.AuthService service. type AuthServiceClient interface { - // GetCurrentUser returns the authenticated user's information. - // Validates the access token and returns user details. - // Similar to OIDC's /userinfo endpoint. - GetCurrentUser(context.Context, *connect.Request[v1.GetCurrentUserRequest]) (*connect.Response[v1.GetCurrentUserResponse], error) - // SignIn authenticates a user with credentials and returns tokens. - // On success, returns an access token and sets a refresh token cookie. - // Supports password-based and SSO authentication methods. - SignIn(context.Context, *connect.Request[v1.SignInRequest]) (*connect.Response[v1.SignInResponse], error) - // SignOut terminates the user's authentication. - // Revokes the refresh token and clears the authentication cookie. - SignOut(context.Context, *connect.Request[v1.SignOutRequest]) (*connect.Response[emptypb.Empty], error) - // RefreshToken exchanges a valid refresh token for a new access token. - // The refresh token is read from the HttpOnly cookie. - // Returns a new short-lived access token. - RefreshToken(context.Context, *connect.Request[v1.RefreshTokenRequest]) (*connect.Response[v1.RefreshTokenResponse], error) + // SignIn authenticates a user with password or SSO credentials. + // On success, returns a short-lived access token and sets a refresh token in an HttpOnly cookie. + // Public. Attempts are rate limited. Archived users cannot sign in. + SignIn(context.Context, *connect.Request[api.SignInRequest]) (*connect.Response[api.SignInResponse], error) + // RefreshToken exchanges the refresh token for a new access token. + // The refresh token is read from the HttpOnly cookie and rotated: the old token is revoked and a new one with a + // fresh 30-day expiry is set in the cookie. + // Public, so it can be called after the access token has expired. + RefreshToken(context.Context, *connect.Request[api.RefreshTokenRequest]) (*connect.Response[api.RefreshTokenResponse], error) + // GetCurrentUser returns the authenticated user, similar to OIDC's /userinfo endpoint. + // When the caller is not signed in or the account is no longer active, clears the refresh token cookie and returns + // UNAUTHENTICATED. + GetCurrentUser(context.Context, *connect.Request[api.GetCurrentUserRequest]) (*connect.Response[api.GetCurrentUserResponse], error) + // SignOut ends the current session. + // Revokes the refresh token from the cookie and clears the cookie. + SignOut(context.Context, *connect.Request[api.SignOutRequest]) (*connect.Response[emptypb.Empty], error) } -// NewAuthServiceClient constructs a client for the memos.api.v1.AuthService service. By default, it +// NewAuthServiceClient constructs a client for the memos.api.AuthService 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. @@ -74,80 +75,81 @@ type AuthServiceClient interface { // http://api.acme.com or https://acme.com/grpc). func NewAuthServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) AuthServiceClient { baseURL = strings.TrimRight(baseURL, "/") - authServiceMethods := v1.File_api_v1_auth_service_proto.Services().ByName("AuthService").Methods() + authServiceMethods := api.File_api_auth_service_proto.Services().ByName("AuthService").Methods() return &authServiceClient{ - getCurrentUser: connect.NewClient[v1.GetCurrentUserRequest, v1.GetCurrentUserResponse]( - httpClient, - baseURL+AuthServiceGetCurrentUserProcedure, - connect.WithSchema(authServiceMethods.ByName("GetCurrentUser")), - connect.WithClientOptions(opts...), - ), - signIn: connect.NewClient[v1.SignInRequest, v1.SignInResponse]( + signIn: connect.NewClient[api.SignInRequest, api.SignInResponse]( httpClient, baseURL+AuthServiceSignInProcedure, connect.WithSchema(authServiceMethods.ByName("SignIn")), connect.WithClientOptions(opts...), ), - signOut: connect.NewClient[v1.SignOutRequest, emptypb.Empty]( - httpClient, - baseURL+AuthServiceSignOutProcedure, - connect.WithSchema(authServiceMethods.ByName("SignOut")), - connect.WithClientOptions(opts...), - ), - refreshToken: connect.NewClient[v1.RefreshTokenRequest, v1.RefreshTokenResponse]( + refreshToken: connect.NewClient[api.RefreshTokenRequest, api.RefreshTokenResponse]( httpClient, baseURL+AuthServiceRefreshTokenProcedure, connect.WithSchema(authServiceMethods.ByName("RefreshToken")), connect.WithClientOptions(opts...), ), + getCurrentUser: connect.NewClient[api.GetCurrentUserRequest, api.GetCurrentUserResponse]( + httpClient, + baseURL+AuthServiceGetCurrentUserProcedure, + connect.WithSchema(authServiceMethods.ByName("GetCurrentUser")), + connect.WithClientOptions(opts...), + ), + signOut: connect.NewClient[api.SignOutRequest, emptypb.Empty]( + httpClient, + baseURL+AuthServiceSignOutProcedure, + connect.WithSchema(authServiceMethods.ByName("SignOut")), + connect.WithClientOptions(opts...), + ), } } // authServiceClient implements AuthServiceClient. type authServiceClient struct { - getCurrentUser *connect.Client[v1.GetCurrentUserRequest, v1.GetCurrentUserResponse] - signIn *connect.Client[v1.SignInRequest, v1.SignInResponse] - signOut *connect.Client[v1.SignOutRequest, emptypb.Empty] - refreshToken *connect.Client[v1.RefreshTokenRequest, v1.RefreshTokenResponse] + signIn *connect.Client[api.SignInRequest, api.SignInResponse] + refreshToken *connect.Client[api.RefreshTokenRequest, api.RefreshTokenResponse] + getCurrentUser *connect.Client[api.GetCurrentUserRequest, api.GetCurrentUserResponse] + signOut *connect.Client[api.SignOutRequest, emptypb.Empty] } -// GetCurrentUser calls memos.api.v1.AuthService.GetCurrentUser. -func (c *authServiceClient) GetCurrentUser(ctx context.Context, req *connect.Request[v1.GetCurrentUserRequest]) (*connect.Response[v1.GetCurrentUserResponse], error) { - return c.getCurrentUser.CallUnary(ctx, req) -} - -// SignIn calls memos.api.v1.AuthService.SignIn. -func (c *authServiceClient) SignIn(ctx context.Context, req *connect.Request[v1.SignInRequest]) (*connect.Response[v1.SignInResponse], error) { +// SignIn calls memos.api.AuthService.SignIn. +func (c *authServiceClient) SignIn(ctx context.Context, req *connect.Request[api.SignInRequest]) (*connect.Response[api.SignInResponse], error) { return c.signIn.CallUnary(ctx, req) } -// SignOut calls memos.api.v1.AuthService.SignOut. -func (c *authServiceClient) SignOut(ctx context.Context, req *connect.Request[v1.SignOutRequest]) (*connect.Response[emptypb.Empty], error) { - return c.signOut.CallUnary(ctx, req) -} - -// RefreshToken calls memos.api.v1.AuthService.RefreshToken. -func (c *authServiceClient) RefreshToken(ctx context.Context, req *connect.Request[v1.RefreshTokenRequest]) (*connect.Response[v1.RefreshTokenResponse], error) { +// RefreshToken calls memos.api.AuthService.RefreshToken. +func (c *authServiceClient) RefreshToken(ctx context.Context, req *connect.Request[api.RefreshTokenRequest]) (*connect.Response[api.RefreshTokenResponse], error) { return c.refreshToken.CallUnary(ctx, req) } -// AuthServiceHandler is an implementation of the memos.api.v1.AuthService service. +// GetCurrentUser calls memos.api.AuthService.GetCurrentUser. +func (c *authServiceClient) GetCurrentUser(ctx context.Context, req *connect.Request[api.GetCurrentUserRequest]) (*connect.Response[api.GetCurrentUserResponse], error) { + return c.getCurrentUser.CallUnary(ctx, req) +} + +// SignOut calls memos.api.AuthService.SignOut. +func (c *authServiceClient) SignOut(ctx context.Context, req *connect.Request[api.SignOutRequest]) (*connect.Response[emptypb.Empty], error) { + return c.signOut.CallUnary(ctx, req) +} + +// AuthServiceHandler is an implementation of the memos.api.AuthService service. type AuthServiceHandler interface { - // GetCurrentUser returns the authenticated user's information. - // Validates the access token and returns user details. - // Similar to OIDC's /userinfo endpoint. - GetCurrentUser(context.Context, *connect.Request[v1.GetCurrentUserRequest]) (*connect.Response[v1.GetCurrentUserResponse], error) - // SignIn authenticates a user with credentials and returns tokens. - // On success, returns an access token and sets a refresh token cookie. - // Supports password-based and SSO authentication methods. - SignIn(context.Context, *connect.Request[v1.SignInRequest]) (*connect.Response[v1.SignInResponse], error) - // SignOut terminates the user's authentication. - // Revokes the refresh token and clears the authentication cookie. - SignOut(context.Context, *connect.Request[v1.SignOutRequest]) (*connect.Response[emptypb.Empty], error) - // RefreshToken exchanges a valid refresh token for a new access token. - // The refresh token is read from the HttpOnly cookie. - // Returns a new short-lived access token. - RefreshToken(context.Context, *connect.Request[v1.RefreshTokenRequest]) (*connect.Response[v1.RefreshTokenResponse], error) + // SignIn authenticates a user with password or SSO credentials. + // On success, returns a short-lived access token and sets a refresh token in an HttpOnly cookie. + // Public. Attempts are rate limited. Archived users cannot sign in. + SignIn(context.Context, *connect.Request[api.SignInRequest]) (*connect.Response[api.SignInResponse], error) + // RefreshToken exchanges the refresh token for a new access token. + // The refresh token is read from the HttpOnly cookie and rotated: the old token is revoked and a new one with a + // fresh 30-day expiry is set in the cookie. + // Public, so it can be called after the access token has expired. + RefreshToken(context.Context, *connect.Request[api.RefreshTokenRequest]) (*connect.Response[api.RefreshTokenResponse], error) + // GetCurrentUser returns the authenticated user, similar to OIDC's /userinfo endpoint. + // When the caller is not signed in or the account is no longer active, clears the refresh token cookie and returns + // UNAUTHENTICATED. + GetCurrentUser(context.Context, *connect.Request[api.GetCurrentUserRequest]) (*connect.Response[api.GetCurrentUserResponse], error) + // SignOut ends the current session. + // Revokes the refresh token from the cookie and clears the cookie. + SignOut(context.Context, *connect.Request[api.SignOutRequest]) (*connect.Response[emptypb.Empty], error) } // NewAuthServiceHandler builds an HTTP handler from the service implementation. It returns the path @@ -156,41 +158,41 @@ type AuthServiceHandler interface { // By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf // and JSON codecs. They also support gzip compression. func NewAuthServiceHandler(svc AuthServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) { - authServiceMethods := v1.File_api_v1_auth_service_proto.Services().ByName("AuthService").Methods() - authServiceGetCurrentUserHandler := connect.NewUnaryHandler( - AuthServiceGetCurrentUserProcedure, - svc.GetCurrentUser, - connect.WithSchema(authServiceMethods.ByName("GetCurrentUser")), - connect.WithHandlerOptions(opts...), - ) + authServiceMethods := api.File_api_auth_service_proto.Services().ByName("AuthService").Methods() authServiceSignInHandler := connect.NewUnaryHandler( AuthServiceSignInProcedure, svc.SignIn, connect.WithSchema(authServiceMethods.ByName("SignIn")), connect.WithHandlerOptions(opts...), ) - authServiceSignOutHandler := connect.NewUnaryHandler( - AuthServiceSignOutProcedure, - svc.SignOut, - connect.WithSchema(authServiceMethods.ByName("SignOut")), - connect.WithHandlerOptions(opts...), - ) authServiceRefreshTokenHandler := connect.NewUnaryHandler( AuthServiceRefreshTokenProcedure, svc.RefreshToken, connect.WithSchema(authServiceMethods.ByName("RefreshToken")), connect.WithHandlerOptions(opts...), ) - return "/memos.api.v1.AuthService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + authServiceGetCurrentUserHandler := connect.NewUnaryHandler( + AuthServiceGetCurrentUserProcedure, + svc.GetCurrentUser, + connect.WithSchema(authServiceMethods.ByName("GetCurrentUser")), + connect.WithHandlerOptions(opts...), + ) + authServiceSignOutHandler := connect.NewUnaryHandler( + AuthServiceSignOutProcedure, + svc.SignOut, + connect.WithSchema(authServiceMethods.ByName("SignOut")), + connect.WithHandlerOptions(opts...), + ) + return "/memos.api.AuthService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { switch r.URL.Path { - case AuthServiceGetCurrentUserProcedure: - authServiceGetCurrentUserHandler.ServeHTTP(w, r) case AuthServiceSignInProcedure: authServiceSignInHandler.ServeHTTP(w, r) - case AuthServiceSignOutProcedure: - authServiceSignOutHandler.ServeHTTP(w, r) case AuthServiceRefreshTokenProcedure: authServiceRefreshTokenHandler.ServeHTTP(w, r) + case AuthServiceGetCurrentUserProcedure: + authServiceGetCurrentUserHandler.ServeHTTP(w, r) + case AuthServiceSignOutProcedure: + authServiceSignOutHandler.ServeHTTP(w, r) default: http.NotFound(w, r) } @@ -200,18 +202,18 @@ func NewAuthServiceHandler(svc AuthServiceHandler, opts ...connect.HandlerOption // UnimplementedAuthServiceHandler returns CodeUnimplemented from all methods. type UnimplementedAuthServiceHandler struct{} -func (UnimplementedAuthServiceHandler) GetCurrentUser(context.Context, *connect.Request[v1.GetCurrentUserRequest]) (*connect.Response[v1.GetCurrentUserResponse], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.AuthService.GetCurrentUser is not implemented")) +func (UnimplementedAuthServiceHandler) SignIn(context.Context, *connect.Request[api.SignInRequest]) (*connect.Response[api.SignInResponse], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.AuthService.SignIn is not implemented")) } -func (UnimplementedAuthServiceHandler) SignIn(context.Context, *connect.Request[v1.SignInRequest]) (*connect.Response[v1.SignInResponse], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.AuthService.SignIn is not implemented")) +func (UnimplementedAuthServiceHandler) RefreshToken(context.Context, *connect.Request[api.RefreshTokenRequest]) (*connect.Response[api.RefreshTokenResponse], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.AuthService.RefreshToken is not implemented")) } -func (UnimplementedAuthServiceHandler) SignOut(context.Context, *connect.Request[v1.SignOutRequest]) (*connect.Response[emptypb.Empty], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.AuthService.SignOut is not implemented")) +func (UnimplementedAuthServiceHandler) GetCurrentUser(context.Context, *connect.Request[api.GetCurrentUserRequest]) (*connect.Response[api.GetCurrentUserResponse], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.AuthService.GetCurrentUser is not implemented")) } -func (UnimplementedAuthServiceHandler) RefreshToken(context.Context, *connect.Request[v1.RefreshTokenRequest]) (*connect.Response[v1.RefreshTokenResponse], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.AuthService.RefreshToken is not implemented")) +func (UnimplementedAuthServiceHandler) SignOut(context.Context, *connect.Request[api.SignOutRequest]) (*connect.Response[emptypb.Empty], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.AuthService.SignOut is not implemented")) } diff --git a/proto/gen/api/v1/apiv1connect/idp_service.connect.go b/proto/gen/api/apiconnect/idp_service.connect.go similarity index 57% rename from proto/gen/api/v1/apiv1connect/idp_service.connect.go rename to proto/gen/api/apiconnect/idp_service.connect.go index d9111ba32..dab833ef2 100644 --- a/proto/gen/api/v1/apiv1connect/idp_service.connect.go +++ b/proto/gen/api/apiconnect/idp_service.connect.go @@ -1,14 +1,14 @@ // Code generated by protoc-gen-connect-go. DO NOT EDIT. // -// Source: api/v1/idp_service.proto +// Source: api/idp_service.proto -package apiv1connect +package apiconnect import ( connect "connectrpc.com/connect" context "context" errors "errors" - v1 "github.com/usememos/memos/proto/gen/api/v1" + api "github.com/usememos/memos/proto/gen/api" emptypb "google.golang.org/protobuf/types/known/emptypb" http "net/http" strings "strings" @@ -23,7 +23,7 @@ const _ = connect.IsAtLeastVersion1_13_0 const ( // IdentityProviderServiceName is the fully-qualified name of the IdentityProviderService service. - IdentityProviderServiceName = "memos.api.v1.IdentityProviderService" + IdentityProviderServiceName = "memos.api.IdentityProviderService" ) // These constants are the fully-qualified names of the RPCs defined in this package. They're @@ -36,36 +36,43 @@ const ( const ( // IdentityProviderServiceListIdentityProvidersProcedure is the fully-qualified name of the // IdentityProviderService's ListIdentityProviders RPC. - IdentityProviderServiceListIdentityProvidersProcedure = "/memos.api.v1.IdentityProviderService/ListIdentityProviders" + IdentityProviderServiceListIdentityProvidersProcedure = "/memos.api.IdentityProviderService/ListIdentityProviders" // IdentityProviderServiceGetIdentityProviderProcedure is the fully-qualified name of the // IdentityProviderService's GetIdentityProvider RPC. - IdentityProviderServiceGetIdentityProviderProcedure = "/memos.api.v1.IdentityProviderService/GetIdentityProvider" + IdentityProviderServiceGetIdentityProviderProcedure = "/memos.api.IdentityProviderService/GetIdentityProvider" // IdentityProviderServiceCreateIdentityProviderProcedure is the fully-qualified name of the // IdentityProviderService's CreateIdentityProvider RPC. - IdentityProviderServiceCreateIdentityProviderProcedure = "/memos.api.v1.IdentityProviderService/CreateIdentityProvider" + IdentityProviderServiceCreateIdentityProviderProcedure = "/memos.api.IdentityProviderService/CreateIdentityProvider" // IdentityProviderServiceUpdateIdentityProviderProcedure is the fully-qualified name of the // IdentityProviderService's UpdateIdentityProvider RPC. - IdentityProviderServiceUpdateIdentityProviderProcedure = "/memos.api.v1.IdentityProviderService/UpdateIdentityProvider" + IdentityProviderServiceUpdateIdentityProviderProcedure = "/memos.api.IdentityProviderService/UpdateIdentityProvider" // IdentityProviderServiceDeleteIdentityProviderProcedure is the fully-qualified name of the // IdentityProviderService's DeleteIdentityProvider RPC. - IdentityProviderServiceDeleteIdentityProviderProcedure = "/memos.api.v1.IdentityProviderService/DeleteIdentityProvider" + IdentityProviderServiceDeleteIdentityProviderProcedure = "/memos.api.IdentityProviderService/DeleteIdentityProvider" ) -// IdentityProviderServiceClient is a client for the memos.api.v1.IdentityProviderService service. +// IdentityProviderServiceClient is a client for the memos.api.IdentityProviderService service. type IdentityProviderServiceClient interface { // ListIdentityProviders lists identity providers. - ListIdentityProviders(context.Context, *connect.Request[v1.ListIdentityProvidersRequest]) (*connect.Response[v1.ListIdentityProvidersResponse], error) + // Public, so the sign-in page can show SSO options. Client secrets are never returned. + ListIdentityProviders(context.Context, *connect.Request[api.ListIdentityProvidersRequest]) (*connect.Response[api.ListIdentityProvidersResponse], error) // GetIdentityProvider gets an identity provider. - GetIdentityProvider(context.Context, *connect.Request[v1.GetIdentityProviderRequest]) (*connect.Response[v1.IdentityProvider], error) + // The client secret is never returned. + GetIdentityProvider(context.Context, *connect.Request[api.GetIdentityProviderRequest]) (*connect.Response[api.IdentityProvider], error) // CreateIdentityProvider creates an identity provider. - CreateIdentityProvider(context.Context, *connect.Request[v1.CreateIdentityProviderRequest]) (*connect.Response[v1.IdentityProvider], error) + // Requires the admin role. Fails with FAILED_PRECONDITION when the ID belongs to a provider configured by the + // deployment. + CreateIdentityProvider(context.Context, *connect.Request[api.CreateIdentityProviderRequest]) (*connect.Response[api.IdentityProvider], error) // UpdateIdentityProvider updates an identity provider. - UpdateIdentityProvider(context.Context, *connect.Request[v1.UpdateIdentityProviderRequest]) (*connect.Response[v1.IdentityProvider], error) + // Requires the admin role. Providers configured by the deployment cannot be updated. + UpdateIdentityProvider(context.Context, *connect.Request[api.UpdateIdentityProviderRequest]) (*connect.Response[api.IdentityProvider], error) // DeleteIdentityProvider deletes an identity provider. - DeleteIdentityProvider(context.Context, *connect.Request[v1.DeleteIdentityProviderRequest]) (*connect.Response[emptypb.Empty], error) + // Requires the admin role. Providers configured by the deployment cannot be deleted. Fails with + // FAILED_PRECONDITION when password sign-in is disabled for regular users and no other effective provider remains. + DeleteIdentityProvider(context.Context, *connect.Request[api.DeleteIdentityProviderRequest]) (*connect.Response[emptypb.Empty], error) } -// NewIdentityProviderServiceClient constructs a client for the memos.api.v1.IdentityProviderService +// NewIdentityProviderServiceClient constructs a client for the memos.api.IdentityProviderService // 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. @@ -74,33 +81,33 @@ type IdentityProviderServiceClient interface { // http://api.acme.com or https://acme.com/grpc). func NewIdentityProviderServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) IdentityProviderServiceClient { baseURL = strings.TrimRight(baseURL, "/") - identityProviderServiceMethods := v1.File_api_v1_idp_service_proto.Services().ByName("IdentityProviderService").Methods() + identityProviderServiceMethods := api.File_api_idp_service_proto.Services().ByName("IdentityProviderService").Methods() return &identityProviderServiceClient{ - listIdentityProviders: connect.NewClient[v1.ListIdentityProvidersRequest, v1.ListIdentityProvidersResponse]( + listIdentityProviders: connect.NewClient[api.ListIdentityProvidersRequest, api.ListIdentityProvidersResponse]( httpClient, baseURL+IdentityProviderServiceListIdentityProvidersProcedure, connect.WithSchema(identityProviderServiceMethods.ByName("ListIdentityProviders")), connect.WithClientOptions(opts...), ), - getIdentityProvider: connect.NewClient[v1.GetIdentityProviderRequest, v1.IdentityProvider]( + getIdentityProvider: connect.NewClient[api.GetIdentityProviderRequest, api.IdentityProvider]( httpClient, baseURL+IdentityProviderServiceGetIdentityProviderProcedure, connect.WithSchema(identityProviderServiceMethods.ByName("GetIdentityProvider")), connect.WithClientOptions(opts...), ), - createIdentityProvider: connect.NewClient[v1.CreateIdentityProviderRequest, v1.IdentityProvider]( + createIdentityProvider: connect.NewClient[api.CreateIdentityProviderRequest, api.IdentityProvider]( httpClient, baseURL+IdentityProviderServiceCreateIdentityProviderProcedure, connect.WithSchema(identityProviderServiceMethods.ByName("CreateIdentityProvider")), connect.WithClientOptions(opts...), ), - updateIdentityProvider: connect.NewClient[v1.UpdateIdentityProviderRequest, v1.IdentityProvider]( + updateIdentityProvider: connect.NewClient[api.UpdateIdentityProviderRequest, api.IdentityProvider]( httpClient, baseURL+IdentityProviderServiceUpdateIdentityProviderProcedure, connect.WithSchema(identityProviderServiceMethods.ByName("UpdateIdentityProvider")), connect.WithClientOptions(opts...), ), - deleteIdentityProvider: connect.NewClient[v1.DeleteIdentityProviderRequest, emptypb.Empty]( + deleteIdentityProvider: connect.NewClient[api.DeleteIdentityProviderRequest, emptypb.Empty]( httpClient, baseURL+IdentityProviderServiceDeleteIdentityProviderProcedure, connect.WithSchema(identityProviderServiceMethods.ByName("DeleteIdentityProvider")), @@ -111,51 +118,58 @@ func NewIdentityProviderServiceClient(httpClient connect.HTTPClient, baseURL str // identityProviderServiceClient implements IdentityProviderServiceClient. type identityProviderServiceClient struct { - listIdentityProviders *connect.Client[v1.ListIdentityProvidersRequest, v1.ListIdentityProvidersResponse] - getIdentityProvider *connect.Client[v1.GetIdentityProviderRequest, v1.IdentityProvider] - createIdentityProvider *connect.Client[v1.CreateIdentityProviderRequest, v1.IdentityProvider] - updateIdentityProvider *connect.Client[v1.UpdateIdentityProviderRequest, v1.IdentityProvider] - deleteIdentityProvider *connect.Client[v1.DeleteIdentityProviderRequest, emptypb.Empty] + listIdentityProviders *connect.Client[api.ListIdentityProvidersRequest, api.ListIdentityProvidersResponse] + getIdentityProvider *connect.Client[api.GetIdentityProviderRequest, api.IdentityProvider] + createIdentityProvider *connect.Client[api.CreateIdentityProviderRequest, api.IdentityProvider] + updateIdentityProvider *connect.Client[api.UpdateIdentityProviderRequest, api.IdentityProvider] + deleteIdentityProvider *connect.Client[api.DeleteIdentityProviderRequest, emptypb.Empty] } -// ListIdentityProviders calls memos.api.v1.IdentityProviderService.ListIdentityProviders. -func (c *identityProviderServiceClient) ListIdentityProviders(ctx context.Context, req *connect.Request[v1.ListIdentityProvidersRequest]) (*connect.Response[v1.ListIdentityProvidersResponse], error) { +// ListIdentityProviders calls memos.api.IdentityProviderService.ListIdentityProviders. +func (c *identityProviderServiceClient) ListIdentityProviders(ctx context.Context, req *connect.Request[api.ListIdentityProvidersRequest]) (*connect.Response[api.ListIdentityProvidersResponse], error) { return c.listIdentityProviders.CallUnary(ctx, req) } -// GetIdentityProvider calls memos.api.v1.IdentityProviderService.GetIdentityProvider. -func (c *identityProviderServiceClient) GetIdentityProvider(ctx context.Context, req *connect.Request[v1.GetIdentityProviderRequest]) (*connect.Response[v1.IdentityProvider], error) { +// GetIdentityProvider calls memos.api.IdentityProviderService.GetIdentityProvider. +func (c *identityProviderServiceClient) GetIdentityProvider(ctx context.Context, req *connect.Request[api.GetIdentityProviderRequest]) (*connect.Response[api.IdentityProvider], error) { return c.getIdentityProvider.CallUnary(ctx, req) } -// CreateIdentityProvider calls memos.api.v1.IdentityProviderService.CreateIdentityProvider. -func (c *identityProviderServiceClient) CreateIdentityProvider(ctx context.Context, req *connect.Request[v1.CreateIdentityProviderRequest]) (*connect.Response[v1.IdentityProvider], error) { +// CreateIdentityProvider calls memos.api.IdentityProviderService.CreateIdentityProvider. +func (c *identityProviderServiceClient) CreateIdentityProvider(ctx context.Context, req *connect.Request[api.CreateIdentityProviderRequest]) (*connect.Response[api.IdentityProvider], error) { return c.createIdentityProvider.CallUnary(ctx, req) } -// UpdateIdentityProvider calls memos.api.v1.IdentityProviderService.UpdateIdentityProvider. -func (c *identityProviderServiceClient) UpdateIdentityProvider(ctx context.Context, req *connect.Request[v1.UpdateIdentityProviderRequest]) (*connect.Response[v1.IdentityProvider], error) { +// UpdateIdentityProvider calls memos.api.IdentityProviderService.UpdateIdentityProvider. +func (c *identityProviderServiceClient) UpdateIdentityProvider(ctx context.Context, req *connect.Request[api.UpdateIdentityProviderRequest]) (*connect.Response[api.IdentityProvider], error) { return c.updateIdentityProvider.CallUnary(ctx, req) } -// DeleteIdentityProvider calls memos.api.v1.IdentityProviderService.DeleteIdentityProvider. -func (c *identityProviderServiceClient) DeleteIdentityProvider(ctx context.Context, req *connect.Request[v1.DeleteIdentityProviderRequest]) (*connect.Response[emptypb.Empty], error) { +// DeleteIdentityProvider calls memos.api.IdentityProviderService.DeleteIdentityProvider. +func (c *identityProviderServiceClient) DeleteIdentityProvider(ctx context.Context, req *connect.Request[api.DeleteIdentityProviderRequest]) (*connect.Response[emptypb.Empty], error) { return c.deleteIdentityProvider.CallUnary(ctx, req) } -// IdentityProviderServiceHandler is an implementation of the memos.api.v1.IdentityProviderService +// IdentityProviderServiceHandler is an implementation of the memos.api.IdentityProviderService // service. type IdentityProviderServiceHandler interface { // ListIdentityProviders lists identity providers. - ListIdentityProviders(context.Context, *connect.Request[v1.ListIdentityProvidersRequest]) (*connect.Response[v1.ListIdentityProvidersResponse], error) + // Public, so the sign-in page can show SSO options. Client secrets are never returned. + ListIdentityProviders(context.Context, *connect.Request[api.ListIdentityProvidersRequest]) (*connect.Response[api.ListIdentityProvidersResponse], error) // GetIdentityProvider gets an identity provider. - GetIdentityProvider(context.Context, *connect.Request[v1.GetIdentityProviderRequest]) (*connect.Response[v1.IdentityProvider], error) + // The client secret is never returned. + GetIdentityProvider(context.Context, *connect.Request[api.GetIdentityProviderRequest]) (*connect.Response[api.IdentityProvider], error) // CreateIdentityProvider creates an identity provider. - CreateIdentityProvider(context.Context, *connect.Request[v1.CreateIdentityProviderRequest]) (*connect.Response[v1.IdentityProvider], error) + // Requires the admin role. Fails with FAILED_PRECONDITION when the ID belongs to a provider configured by the + // deployment. + CreateIdentityProvider(context.Context, *connect.Request[api.CreateIdentityProviderRequest]) (*connect.Response[api.IdentityProvider], error) // UpdateIdentityProvider updates an identity provider. - UpdateIdentityProvider(context.Context, *connect.Request[v1.UpdateIdentityProviderRequest]) (*connect.Response[v1.IdentityProvider], error) + // Requires the admin role. Providers configured by the deployment cannot be updated. + UpdateIdentityProvider(context.Context, *connect.Request[api.UpdateIdentityProviderRequest]) (*connect.Response[api.IdentityProvider], error) // DeleteIdentityProvider deletes an identity provider. - DeleteIdentityProvider(context.Context, *connect.Request[v1.DeleteIdentityProviderRequest]) (*connect.Response[emptypb.Empty], error) + // Requires the admin role. Providers configured by the deployment cannot be deleted. Fails with + // FAILED_PRECONDITION when password sign-in is disabled for regular users and no other effective provider remains. + DeleteIdentityProvider(context.Context, *connect.Request[api.DeleteIdentityProviderRequest]) (*connect.Response[emptypb.Empty], error) } // NewIdentityProviderServiceHandler builds an HTTP handler from the service implementation. It @@ -164,7 +178,7 @@ type IdentityProviderServiceHandler interface { // By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf // and JSON codecs. They also support gzip compression. func NewIdentityProviderServiceHandler(svc IdentityProviderServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) { - identityProviderServiceMethods := v1.File_api_v1_idp_service_proto.Services().ByName("IdentityProviderService").Methods() + identityProviderServiceMethods := api.File_api_idp_service_proto.Services().ByName("IdentityProviderService").Methods() identityProviderServiceListIdentityProvidersHandler := connect.NewUnaryHandler( IdentityProviderServiceListIdentityProvidersProcedure, svc.ListIdentityProviders, @@ -195,7 +209,7 @@ func NewIdentityProviderServiceHandler(svc IdentityProviderServiceHandler, opts connect.WithSchema(identityProviderServiceMethods.ByName("DeleteIdentityProvider")), connect.WithHandlerOptions(opts...), ) - return "/memos.api.v1.IdentityProviderService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + return "/memos.api.IdentityProviderService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { switch r.URL.Path { case IdentityProviderServiceListIdentityProvidersProcedure: identityProviderServiceListIdentityProvidersHandler.ServeHTTP(w, r) @@ -216,22 +230,22 @@ func NewIdentityProviderServiceHandler(svc IdentityProviderServiceHandler, opts // UnimplementedIdentityProviderServiceHandler returns CodeUnimplemented from all methods. type UnimplementedIdentityProviderServiceHandler struct{} -func (UnimplementedIdentityProviderServiceHandler) ListIdentityProviders(context.Context, *connect.Request[v1.ListIdentityProvidersRequest]) (*connect.Response[v1.ListIdentityProvidersResponse], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.IdentityProviderService.ListIdentityProviders is not implemented")) +func (UnimplementedIdentityProviderServiceHandler) ListIdentityProviders(context.Context, *connect.Request[api.ListIdentityProvidersRequest]) (*connect.Response[api.ListIdentityProvidersResponse], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.IdentityProviderService.ListIdentityProviders is not implemented")) } -func (UnimplementedIdentityProviderServiceHandler) GetIdentityProvider(context.Context, *connect.Request[v1.GetIdentityProviderRequest]) (*connect.Response[v1.IdentityProvider], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.IdentityProviderService.GetIdentityProvider is not implemented")) +func (UnimplementedIdentityProviderServiceHandler) GetIdentityProvider(context.Context, *connect.Request[api.GetIdentityProviderRequest]) (*connect.Response[api.IdentityProvider], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.IdentityProviderService.GetIdentityProvider is not implemented")) } -func (UnimplementedIdentityProviderServiceHandler) CreateIdentityProvider(context.Context, *connect.Request[v1.CreateIdentityProviderRequest]) (*connect.Response[v1.IdentityProvider], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.IdentityProviderService.CreateIdentityProvider is not implemented")) +func (UnimplementedIdentityProviderServiceHandler) CreateIdentityProvider(context.Context, *connect.Request[api.CreateIdentityProviderRequest]) (*connect.Response[api.IdentityProvider], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.IdentityProviderService.CreateIdentityProvider is not implemented")) } -func (UnimplementedIdentityProviderServiceHandler) UpdateIdentityProvider(context.Context, *connect.Request[v1.UpdateIdentityProviderRequest]) (*connect.Response[v1.IdentityProvider], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.IdentityProviderService.UpdateIdentityProvider is not implemented")) +func (UnimplementedIdentityProviderServiceHandler) UpdateIdentityProvider(context.Context, *connect.Request[api.UpdateIdentityProviderRequest]) (*connect.Response[api.IdentityProvider], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.IdentityProviderService.UpdateIdentityProvider is not implemented")) } -func (UnimplementedIdentityProviderServiceHandler) DeleteIdentityProvider(context.Context, *connect.Request[v1.DeleteIdentityProviderRequest]) (*connect.Response[emptypb.Empty], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.IdentityProviderService.DeleteIdentityProvider is not implemented")) +func (UnimplementedIdentityProviderServiceHandler) DeleteIdentityProvider(context.Context, *connect.Request[api.DeleteIdentityProviderRequest]) (*connect.Response[emptypb.Empty], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.IdentityProviderService.DeleteIdentityProvider is not implemented")) } diff --git a/proto/gen/api/v1/apiv1connect/instance_service.connect.go b/proto/gen/api/apiconnect/instance_service.connect.go similarity index 52% rename from proto/gen/api/v1/apiv1connect/instance_service.connect.go rename to proto/gen/api/apiconnect/instance_service.connect.go index 75466c402..0bc173a52 100644 --- a/proto/gen/api/v1/apiv1connect/instance_service.connect.go +++ b/proto/gen/api/apiconnect/instance_service.connect.go @@ -1,14 +1,14 @@ // Code generated by protoc-gen-connect-go. DO NOT EDIT. // -// Source: api/v1/instance_service.proto +// Source: api/instance_service.proto -package apiv1connect +package apiconnect import ( connect "connectrpc.com/connect" context "context" errors "errors" - v1 "github.com/usememos/memos/proto/gen/api/v1" + api "github.com/usememos/memos/proto/gen/api" emptypb "google.golang.org/protobuf/types/known/emptypb" http "net/http" strings "strings" @@ -23,7 +23,7 @@ const _ = connect.IsAtLeastVersion1_13_0 const ( // InstanceServiceName is the fully-qualified name of the InstanceService service. - InstanceServiceName = "memos.api.v1.InstanceService" + InstanceServiceName = "memos.api.InstanceService" ) // These constants are the fully-qualified names of the RPCs defined in this package. They're @@ -36,41 +36,44 @@ const ( const ( // InstanceServiceGetInstanceProfileProcedure is the fully-qualified name of the InstanceService's // GetInstanceProfile RPC. - InstanceServiceGetInstanceProfileProcedure = "/memos.api.v1.InstanceService/GetInstanceProfile" + InstanceServiceGetInstanceProfileProcedure = "/memos.api.InstanceService/GetInstanceProfile" // InstanceServiceGetInstanceSettingProcedure is the fully-qualified name of the InstanceService's // GetInstanceSetting RPC. - InstanceServiceGetInstanceSettingProcedure = "/memos.api.v1.InstanceService/GetInstanceSetting" + InstanceServiceGetInstanceSettingProcedure = "/memos.api.InstanceService/GetInstanceSetting" // InstanceServiceBatchGetInstanceSettingsProcedure is the fully-qualified name of the // InstanceService's BatchGetInstanceSettings RPC. - InstanceServiceBatchGetInstanceSettingsProcedure = "/memos.api.v1.InstanceService/BatchGetInstanceSettings" + InstanceServiceBatchGetInstanceSettingsProcedure = "/memos.api.InstanceService/BatchGetInstanceSettings" // InstanceServiceUpdateInstanceSettingProcedure is the fully-qualified name of the // InstanceService's UpdateInstanceSetting RPC. - InstanceServiceUpdateInstanceSettingProcedure = "/memos.api.v1.InstanceService/UpdateInstanceSetting" + InstanceServiceUpdateInstanceSettingProcedure = "/memos.api.InstanceService/UpdateInstanceSetting" // InstanceServiceTestInstanceEmailSettingProcedure is the fully-qualified name of the // InstanceService's TestInstanceEmailSetting RPC. - InstanceServiceTestInstanceEmailSettingProcedure = "/memos.api.v1.InstanceService/TestInstanceEmailSetting" + InstanceServiceTestInstanceEmailSettingProcedure = "/memos.api.InstanceService/TestInstanceEmailSetting" // InstanceServiceGetInstanceStatsProcedure is the fully-qualified name of the InstanceService's // GetInstanceStats RPC. - InstanceServiceGetInstanceStatsProcedure = "/memos.api.v1.InstanceService/GetInstanceStats" + InstanceServiceGetInstanceStatsProcedure = "/memos.api.InstanceService/GetInstanceStats" ) -// InstanceServiceClient is a client for the memos.api.v1.InstanceService service. +// InstanceServiceClient is a client for the memos.api.InstanceService service. type InstanceServiceClient interface { - // Gets the instance profile. - GetInstanceProfile(context.Context, *connect.Request[v1.GetInstanceProfileRequest]) (*connect.Response[v1.InstanceProfile], error) - // Gets an instance setting. - GetInstanceSetting(context.Context, *connect.Request[v1.GetInstanceSettingRequest]) (*connect.Response[v1.InstanceSetting], error) - // Batch gets instance settings. - BatchGetInstanceSettings(context.Context, *connect.Request[v1.BatchGetInstanceSettingsRequest]) (*connect.Response[v1.BatchGetInstanceSettingsResponse], error) - // Updates an instance setting. - UpdateInstanceSetting(context.Context, *connect.Request[v1.UpdateInstanceSettingRequest]) (*connect.Response[v1.InstanceSetting], error) - // Tests notification email delivery with the provided or stored SMTP settings. - TestInstanceEmailSetting(context.Context, *connect.Request[v1.TestInstanceEmailSettingRequest]) (*connect.Response[emptypb.Empty], error) - // GetInstanceStats returns resource usage statistics for the instance. Admin only. - GetInstanceStats(context.Context, *connect.Request[v1.GetInstanceStatsRequest]) (*connect.Response[v1.InstanceStats], error) + // GetInstanceProfile gets the instance profile. Available without authentication, including on a private instance. + GetInstanceProfile(context.Context, *connect.Request[api.GetInstanceProfileRequest]) (*connect.Response[api.InstanceProfile], error) + // GetInstanceSetting gets an instance setting. Available without authentication, except STORAGE and NOTIFICATION, + // which are admin only, and AI, which requires a signed-in user and hides transcription defaults from non-admins. + GetInstanceSetting(context.Context, *connect.Request[api.GetInstanceSettingRequest]) (*connect.Response[api.InstanceSetting], error) + // BatchGetInstanceSettings gets up to 100 instance settings in request order, with the same access rules as + // GetInstanceSetting. The call fails if any setting cannot be returned. + BatchGetInstanceSettings(context.Context, *connect.Request[api.BatchGetInstanceSettingsRequest]) (*connect.Response[api.BatchGetInstanceSettingsResponse], error) + // UpdateInstanceSetting replaces an instance setting. Admin only. Settings configured by the deployment cannot be + // updated. Empty write-only credentials keep the stored values. + UpdateInstanceSetting(context.Context, *connect.Request[api.UpdateInstanceSettingRequest]) (*connect.Response[api.InstanceSetting], error) + // TestInstanceEmailSetting sends a test email with the provided or stored SMTP settings. Admin only. + TestInstanceEmailSetting(context.Context, *connect.Request[api.TestInstanceEmailSettingRequest]) (*connect.Response[emptypb.Empty], error) + // GetInstanceStats gets resource usage statistics for the instance. Admin only. Results are cached for 60 seconds. + GetInstanceStats(context.Context, *connect.Request[api.GetInstanceStatsRequest]) (*connect.Response[api.InstanceStats], error) } -// NewInstanceServiceClient constructs a client for the memos.api.v1.InstanceService service. By +// NewInstanceServiceClient constructs a client for the memos.api.InstanceService 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. @@ -79,39 +82,39 @@ type InstanceServiceClient interface { // http://api.acme.com or https://acme.com/grpc). func NewInstanceServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) InstanceServiceClient { baseURL = strings.TrimRight(baseURL, "/") - instanceServiceMethods := v1.File_api_v1_instance_service_proto.Services().ByName("InstanceService").Methods() + instanceServiceMethods := api.File_api_instance_service_proto.Services().ByName("InstanceService").Methods() return &instanceServiceClient{ - getInstanceProfile: connect.NewClient[v1.GetInstanceProfileRequest, v1.InstanceProfile]( + getInstanceProfile: connect.NewClient[api.GetInstanceProfileRequest, api.InstanceProfile]( httpClient, baseURL+InstanceServiceGetInstanceProfileProcedure, connect.WithSchema(instanceServiceMethods.ByName("GetInstanceProfile")), connect.WithClientOptions(opts...), ), - getInstanceSetting: connect.NewClient[v1.GetInstanceSettingRequest, v1.InstanceSetting]( + getInstanceSetting: connect.NewClient[api.GetInstanceSettingRequest, api.InstanceSetting]( httpClient, baseURL+InstanceServiceGetInstanceSettingProcedure, connect.WithSchema(instanceServiceMethods.ByName("GetInstanceSetting")), connect.WithClientOptions(opts...), ), - batchGetInstanceSettings: connect.NewClient[v1.BatchGetInstanceSettingsRequest, v1.BatchGetInstanceSettingsResponse]( + batchGetInstanceSettings: connect.NewClient[api.BatchGetInstanceSettingsRequest, api.BatchGetInstanceSettingsResponse]( httpClient, baseURL+InstanceServiceBatchGetInstanceSettingsProcedure, connect.WithSchema(instanceServiceMethods.ByName("BatchGetInstanceSettings")), connect.WithClientOptions(opts...), ), - updateInstanceSetting: connect.NewClient[v1.UpdateInstanceSettingRequest, v1.InstanceSetting]( + updateInstanceSetting: connect.NewClient[api.UpdateInstanceSettingRequest, api.InstanceSetting]( httpClient, baseURL+InstanceServiceUpdateInstanceSettingProcedure, connect.WithSchema(instanceServiceMethods.ByName("UpdateInstanceSetting")), connect.WithClientOptions(opts...), ), - testInstanceEmailSetting: connect.NewClient[v1.TestInstanceEmailSettingRequest, emptypb.Empty]( + testInstanceEmailSetting: connect.NewClient[api.TestInstanceEmailSettingRequest, emptypb.Empty]( httpClient, baseURL+InstanceServiceTestInstanceEmailSettingProcedure, connect.WithSchema(instanceServiceMethods.ByName("TestInstanceEmailSetting")), connect.WithClientOptions(opts...), ), - getInstanceStats: connect.NewClient[v1.GetInstanceStatsRequest, v1.InstanceStats]( + getInstanceStats: connect.NewClient[api.GetInstanceStatsRequest, api.InstanceStats]( httpClient, baseURL+InstanceServiceGetInstanceStatsProcedure, connect.WithSchema(instanceServiceMethods.ByName("GetInstanceStats")), @@ -122,58 +125,61 @@ func NewInstanceServiceClient(httpClient connect.HTTPClient, baseURL string, opt // instanceServiceClient implements InstanceServiceClient. type instanceServiceClient struct { - getInstanceProfile *connect.Client[v1.GetInstanceProfileRequest, v1.InstanceProfile] - getInstanceSetting *connect.Client[v1.GetInstanceSettingRequest, v1.InstanceSetting] - batchGetInstanceSettings *connect.Client[v1.BatchGetInstanceSettingsRequest, v1.BatchGetInstanceSettingsResponse] - updateInstanceSetting *connect.Client[v1.UpdateInstanceSettingRequest, v1.InstanceSetting] - testInstanceEmailSetting *connect.Client[v1.TestInstanceEmailSettingRequest, emptypb.Empty] - getInstanceStats *connect.Client[v1.GetInstanceStatsRequest, v1.InstanceStats] + getInstanceProfile *connect.Client[api.GetInstanceProfileRequest, api.InstanceProfile] + getInstanceSetting *connect.Client[api.GetInstanceSettingRequest, api.InstanceSetting] + batchGetInstanceSettings *connect.Client[api.BatchGetInstanceSettingsRequest, api.BatchGetInstanceSettingsResponse] + updateInstanceSetting *connect.Client[api.UpdateInstanceSettingRequest, api.InstanceSetting] + testInstanceEmailSetting *connect.Client[api.TestInstanceEmailSettingRequest, emptypb.Empty] + getInstanceStats *connect.Client[api.GetInstanceStatsRequest, api.InstanceStats] } -// GetInstanceProfile calls memos.api.v1.InstanceService.GetInstanceProfile. -func (c *instanceServiceClient) GetInstanceProfile(ctx context.Context, req *connect.Request[v1.GetInstanceProfileRequest]) (*connect.Response[v1.InstanceProfile], error) { +// GetInstanceProfile calls memos.api.InstanceService.GetInstanceProfile. +func (c *instanceServiceClient) GetInstanceProfile(ctx context.Context, req *connect.Request[api.GetInstanceProfileRequest]) (*connect.Response[api.InstanceProfile], error) { return c.getInstanceProfile.CallUnary(ctx, req) } -// GetInstanceSetting calls memos.api.v1.InstanceService.GetInstanceSetting. -func (c *instanceServiceClient) GetInstanceSetting(ctx context.Context, req *connect.Request[v1.GetInstanceSettingRequest]) (*connect.Response[v1.InstanceSetting], error) { +// GetInstanceSetting calls memos.api.InstanceService.GetInstanceSetting. +func (c *instanceServiceClient) GetInstanceSetting(ctx context.Context, req *connect.Request[api.GetInstanceSettingRequest]) (*connect.Response[api.InstanceSetting], error) { return c.getInstanceSetting.CallUnary(ctx, req) } -// BatchGetInstanceSettings calls memos.api.v1.InstanceService.BatchGetInstanceSettings. -func (c *instanceServiceClient) BatchGetInstanceSettings(ctx context.Context, req *connect.Request[v1.BatchGetInstanceSettingsRequest]) (*connect.Response[v1.BatchGetInstanceSettingsResponse], error) { +// BatchGetInstanceSettings calls memos.api.InstanceService.BatchGetInstanceSettings. +func (c *instanceServiceClient) BatchGetInstanceSettings(ctx context.Context, req *connect.Request[api.BatchGetInstanceSettingsRequest]) (*connect.Response[api.BatchGetInstanceSettingsResponse], error) { return c.batchGetInstanceSettings.CallUnary(ctx, req) } -// UpdateInstanceSetting calls memos.api.v1.InstanceService.UpdateInstanceSetting. -func (c *instanceServiceClient) UpdateInstanceSetting(ctx context.Context, req *connect.Request[v1.UpdateInstanceSettingRequest]) (*connect.Response[v1.InstanceSetting], error) { +// UpdateInstanceSetting calls memos.api.InstanceService.UpdateInstanceSetting. +func (c *instanceServiceClient) UpdateInstanceSetting(ctx context.Context, req *connect.Request[api.UpdateInstanceSettingRequest]) (*connect.Response[api.InstanceSetting], error) { return c.updateInstanceSetting.CallUnary(ctx, req) } -// TestInstanceEmailSetting calls memos.api.v1.InstanceService.TestInstanceEmailSetting. -func (c *instanceServiceClient) TestInstanceEmailSetting(ctx context.Context, req *connect.Request[v1.TestInstanceEmailSettingRequest]) (*connect.Response[emptypb.Empty], error) { +// TestInstanceEmailSetting calls memos.api.InstanceService.TestInstanceEmailSetting. +func (c *instanceServiceClient) TestInstanceEmailSetting(ctx context.Context, req *connect.Request[api.TestInstanceEmailSettingRequest]) (*connect.Response[emptypb.Empty], error) { return c.testInstanceEmailSetting.CallUnary(ctx, req) } -// GetInstanceStats calls memos.api.v1.InstanceService.GetInstanceStats. -func (c *instanceServiceClient) GetInstanceStats(ctx context.Context, req *connect.Request[v1.GetInstanceStatsRequest]) (*connect.Response[v1.InstanceStats], error) { +// GetInstanceStats calls memos.api.InstanceService.GetInstanceStats. +func (c *instanceServiceClient) GetInstanceStats(ctx context.Context, req *connect.Request[api.GetInstanceStatsRequest]) (*connect.Response[api.InstanceStats], error) { return c.getInstanceStats.CallUnary(ctx, req) } -// InstanceServiceHandler is an implementation of the memos.api.v1.InstanceService service. +// InstanceServiceHandler is an implementation of the memos.api.InstanceService service. type InstanceServiceHandler interface { - // Gets the instance profile. - GetInstanceProfile(context.Context, *connect.Request[v1.GetInstanceProfileRequest]) (*connect.Response[v1.InstanceProfile], error) - // Gets an instance setting. - GetInstanceSetting(context.Context, *connect.Request[v1.GetInstanceSettingRequest]) (*connect.Response[v1.InstanceSetting], error) - // Batch gets instance settings. - BatchGetInstanceSettings(context.Context, *connect.Request[v1.BatchGetInstanceSettingsRequest]) (*connect.Response[v1.BatchGetInstanceSettingsResponse], error) - // Updates an instance setting. - UpdateInstanceSetting(context.Context, *connect.Request[v1.UpdateInstanceSettingRequest]) (*connect.Response[v1.InstanceSetting], error) - // Tests notification email delivery with the provided or stored SMTP settings. - TestInstanceEmailSetting(context.Context, *connect.Request[v1.TestInstanceEmailSettingRequest]) (*connect.Response[emptypb.Empty], error) - // GetInstanceStats returns resource usage statistics for the instance. Admin only. - GetInstanceStats(context.Context, *connect.Request[v1.GetInstanceStatsRequest]) (*connect.Response[v1.InstanceStats], error) + // GetInstanceProfile gets the instance profile. Available without authentication, including on a private instance. + GetInstanceProfile(context.Context, *connect.Request[api.GetInstanceProfileRequest]) (*connect.Response[api.InstanceProfile], error) + // GetInstanceSetting gets an instance setting. Available without authentication, except STORAGE and NOTIFICATION, + // which are admin only, and AI, which requires a signed-in user and hides transcription defaults from non-admins. + GetInstanceSetting(context.Context, *connect.Request[api.GetInstanceSettingRequest]) (*connect.Response[api.InstanceSetting], error) + // BatchGetInstanceSettings gets up to 100 instance settings in request order, with the same access rules as + // GetInstanceSetting. The call fails if any setting cannot be returned. + BatchGetInstanceSettings(context.Context, *connect.Request[api.BatchGetInstanceSettingsRequest]) (*connect.Response[api.BatchGetInstanceSettingsResponse], error) + // UpdateInstanceSetting replaces an instance setting. Admin only. Settings configured by the deployment cannot be + // updated. Empty write-only credentials keep the stored values. + UpdateInstanceSetting(context.Context, *connect.Request[api.UpdateInstanceSettingRequest]) (*connect.Response[api.InstanceSetting], error) + // TestInstanceEmailSetting sends a test email with the provided or stored SMTP settings. Admin only. + TestInstanceEmailSetting(context.Context, *connect.Request[api.TestInstanceEmailSettingRequest]) (*connect.Response[emptypb.Empty], error) + // GetInstanceStats gets resource usage statistics for the instance. Admin only. Results are cached for 60 seconds. + GetInstanceStats(context.Context, *connect.Request[api.GetInstanceStatsRequest]) (*connect.Response[api.InstanceStats], error) } // NewInstanceServiceHandler builds an HTTP handler from the service implementation. It returns the @@ -182,7 +188,7 @@ type InstanceServiceHandler interface { // By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf // and JSON codecs. They also support gzip compression. func NewInstanceServiceHandler(svc InstanceServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) { - instanceServiceMethods := v1.File_api_v1_instance_service_proto.Services().ByName("InstanceService").Methods() + instanceServiceMethods := api.File_api_instance_service_proto.Services().ByName("InstanceService").Methods() instanceServiceGetInstanceProfileHandler := connect.NewUnaryHandler( InstanceServiceGetInstanceProfileProcedure, svc.GetInstanceProfile, @@ -219,7 +225,7 @@ func NewInstanceServiceHandler(svc InstanceServiceHandler, opts ...connect.Handl connect.WithSchema(instanceServiceMethods.ByName("GetInstanceStats")), connect.WithHandlerOptions(opts...), ) - return "/memos.api.v1.InstanceService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + return "/memos.api.InstanceService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { switch r.URL.Path { case InstanceServiceGetInstanceProfileProcedure: instanceServiceGetInstanceProfileHandler.ServeHTTP(w, r) @@ -242,26 +248,26 @@ func NewInstanceServiceHandler(svc InstanceServiceHandler, opts ...connect.Handl // UnimplementedInstanceServiceHandler returns CodeUnimplemented from all methods. type UnimplementedInstanceServiceHandler struct{} -func (UnimplementedInstanceServiceHandler) GetInstanceProfile(context.Context, *connect.Request[v1.GetInstanceProfileRequest]) (*connect.Response[v1.InstanceProfile], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.InstanceService.GetInstanceProfile is not implemented")) +func (UnimplementedInstanceServiceHandler) GetInstanceProfile(context.Context, *connect.Request[api.GetInstanceProfileRequest]) (*connect.Response[api.InstanceProfile], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.InstanceService.GetInstanceProfile is not implemented")) } -func (UnimplementedInstanceServiceHandler) GetInstanceSetting(context.Context, *connect.Request[v1.GetInstanceSettingRequest]) (*connect.Response[v1.InstanceSetting], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.InstanceService.GetInstanceSetting is not implemented")) +func (UnimplementedInstanceServiceHandler) GetInstanceSetting(context.Context, *connect.Request[api.GetInstanceSettingRequest]) (*connect.Response[api.InstanceSetting], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.InstanceService.GetInstanceSetting is not implemented")) } -func (UnimplementedInstanceServiceHandler) BatchGetInstanceSettings(context.Context, *connect.Request[v1.BatchGetInstanceSettingsRequest]) (*connect.Response[v1.BatchGetInstanceSettingsResponse], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.InstanceService.BatchGetInstanceSettings is not implemented")) +func (UnimplementedInstanceServiceHandler) BatchGetInstanceSettings(context.Context, *connect.Request[api.BatchGetInstanceSettingsRequest]) (*connect.Response[api.BatchGetInstanceSettingsResponse], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.InstanceService.BatchGetInstanceSettings is not implemented")) } -func (UnimplementedInstanceServiceHandler) UpdateInstanceSetting(context.Context, *connect.Request[v1.UpdateInstanceSettingRequest]) (*connect.Response[v1.InstanceSetting], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.InstanceService.UpdateInstanceSetting is not implemented")) +func (UnimplementedInstanceServiceHandler) UpdateInstanceSetting(context.Context, *connect.Request[api.UpdateInstanceSettingRequest]) (*connect.Response[api.InstanceSetting], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.InstanceService.UpdateInstanceSetting is not implemented")) } -func (UnimplementedInstanceServiceHandler) TestInstanceEmailSetting(context.Context, *connect.Request[v1.TestInstanceEmailSettingRequest]) (*connect.Response[emptypb.Empty], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.InstanceService.TestInstanceEmailSetting is not implemented")) +func (UnimplementedInstanceServiceHandler) TestInstanceEmailSetting(context.Context, *connect.Request[api.TestInstanceEmailSettingRequest]) (*connect.Response[emptypb.Empty], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.InstanceService.TestInstanceEmailSetting is not implemented")) } -func (UnimplementedInstanceServiceHandler) GetInstanceStats(context.Context, *connect.Request[v1.GetInstanceStatsRequest]) (*connect.Response[v1.InstanceStats], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.InstanceService.GetInstanceStats is not implemented")) +func (UnimplementedInstanceServiceHandler) GetInstanceStats(context.Context, *connect.Request[api.GetInstanceStatsRequest]) (*connect.Response[api.InstanceStats], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.InstanceService.GetInstanceStats is not implemented")) } diff --git a/proto/gen/api/v1/apiv1connect/memo_service.connect.go b/proto/gen/api/apiconnect/memo_service.connect.go similarity index 51% rename from proto/gen/api/v1/apiv1connect/memo_service.connect.go rename to proto/gen/api/apiconnect/memo_service.connect.go index e145484a6..31b0252ef 100644 --- a/proto/gen/api/v1/apiv1connect/memo_service.connect.go +++ b/proto/gen/api/apiconnect/memo_service.connect.go @@ -1,14 +1,14 @@ // Code generated by protoc-gen-connect-go. DO NOT EDIT. // -// Source: api/v1/memo_service.proto +// Source: api/memo_service.proto -package apiv1connect +package apiconnect import ( connect "connectrpc.com/connect" context "context" errors "errors" - v1 "github.com/usememos/memos/proto/gen/api/v1" + api "github.com/usememos/memos/proto/gen/api" emptypb "google.golang.org/protobuf/types/known/emptypb" http "net/http" strings "strings" @@ -23,7 +23,7 @@ const _ = connect.IsAtLeastVersion1_13_0 const ( // MemoServiceName is the fully-qualified name of the MemoService service. - MemoServiceName = "memos.api.v1.MemoService" + MemoServiceName = "memos.api.MemoService" ) // These constants are the fully-qualified names of the RPCs defined in this package. They're @@ -34,120 +34,134 @@ const ( // reflection-formatted method names, remove the leading slash and convert the remaining slash to a // period. const ( - // MemoServiceCreateMemoProcedure is the fully-qualified name of the MemoService's CreateMemo RPC. - MemoServiceCreateMemoProcedure = "/memos.api.v1.MemoService/CreateMemo" // MemoServiceListMemosProcedure is the fully-qualified name of the MemoService's ListMemos RPC. - MemoServiceListMemosProcedure = "/memos.api.v1.MemoService/ListMemos" + MemoServiceListMemosProcedure = "/memos.api.MemoService/ListMemos" // MemoServiceGetMemoProcedure is the fully-qualified name of the MemoService's GetMemo RPC. - MemoServiceGetMemoProcedure = "/memos.api.v1.MemoService/GetMemo" + 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.v1.MemoService/UpdateMemo" + MemoServiceUpdateMemoProcedure = "/memos.api.MemoService/UpdateMemo" // MemoServiceDeleteMemoProcedure is the fully-qualified name of the MemoService's DeleteMemo RPC. - MemoServiceDeleteMemoProcedure = "/memos.api.v1.MemoService/DeleteMemo" - // MemoServiceSetMemoAttachmentsProcedure is the fully-qualified name of the MemoService's - // SetMemoAttachments RPC. - MemoServiceSetMemoAttachmentsProcedure = "/memos.api.v1.MemoService/SetMemoAttachments" + MemoServiceDeleteMemoProcedure = "/memos.api.MemoService/DeleteMemo" // MemoServiceListMemoAttachmentsProcedure is the fully-qualified name of the MemoService's // ListMemoAttachments RPC. - MemoServiceListMemoAttachmentsProcedure = "/memos.api.v1.MemoService/ListMemoAttachments" - // MemoServiceSetMemoRelationsProcedure is the fully-qualified name of the MemoService's - // SetMemoRelations RPC. - MemoServiceSetMemoRelationsProcedure = "/memos.api.v1.MemoService/SetMemoRelations" + 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.v1.MemoService/ListMemoRelations" - // MemoServiceCreateMemoCommentProcedure is the fully-qualified name of the MemoService's - // CreateMemoComment RPC. - MemoServiceCreateMemoCommentProcedure = "/memos.api.v1.MemoService/CreateMemoComment" + 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.v1.MemoService/ListMemoComments" + 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.v1.MemoService/ListMemoReactions" - // MemoServiceUpsertMemoReactionProcedure is the fully-qualified name of the MemoService's - // UpsertMemoReaction RPC. - MemoServiceUpsertMemoReactionProcedure = "/memos.api.v1.MemoService/UpsertMemoReaction" + MemoServiceListMemoReactionsProcedure = "/memos.api.MemoService/ListMemoReactions" // MemoServiceDeleteMemoReactionProcedure is the fully-qualified name of the MemoService's // DeleteMemoReaction RPC. - MemoServiceDeleteMemoReactionProcedure = "/memos.api.v1.MemoService/DeleteMemoReaction" - // MemoServiceCreateMemoShareProcedure is the fully-qualified name of the MemoService's - // CreateMemoShare RPC. - MemoServiceCreateMemoShareProcedure = "/memos.api.v1.MemoService/CreateMemoShare" + 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.v1.MemoService/ListMemoShares" + 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.v1.MemoService/DeleteMemoShare" + MemoServiceDeleteMemoShareProcedure = "/memos.api.MemoService/DeleteMemoShare" // MemoServiceGetSharedMemoProcedure is the fully-qualified name of the MemoService's GetSharedMemo // RPC. - MemoServiceGetSharedMemoProcedure = "/memos.api.v1.MemoService/GetSharedMemo" + MemoServiceGetSharedMemoProcedure = "/memos.api.MemoService/GetSharedMemo" // MemoServiceGetLinkMetadataProcedure is the fully-qualified name of the MemoService's // GetLinkMetadata RPC. - MemoServiceGetLinkMetadataProcedure = "/memos.api.v1.MemoService/GetLinkMetadata" + MemoServiceGetLinkMetadataProcedure = "/memos.api.MemoService/GetLinkMetadata" // MemoServiceBatchGetLinkMetadataProcedure is the fully-qualified name of the MemoService's // BatchGetLinkMetadata RPC. - MemoServiceBatchGetLinkMetadataProcedure = "/memos.api.v1.MemoService/BatchGetLinkMetadata" + MemoServiceBatchGetLinkMetadataProcedure = "/memos.api.MemoService/BatchGetLinkMetadata" ) -// MemoServiceClient is a client for the memos.api.v1.MemoService service. +// MemoServiceClient is a client for the memos.api.MemoService service. type MemoServiceClient interface { - // CreateMemo creates a memo. The request body is a Memo; set its content - // (Markdown) and visibility (PRIVATE | PROTECTED | PUBLIC | SPACE, - // default PRIVATE). - // The memo is owned by the authenticated user; requires authentication. - CreateMemo(context.Context, *connect.Request[v1.CreateMemoRequest]) (*connect.Response[v1.Memo], error) - // ListMemos lists readable non-comment memos with pagination and filter. - ListMemos(context.Context, *connect.Request[v1.ListMemosRequest]) (*connect.Response[v1.ListMemosResponse], error) - // GetMemo gets a memo. - GetMemo(context.Context, *connect.Request[v1.GetMemoRequest]) (*connect.Response[v1.Memo], error) - // UpdateMemo updates a memo. - UpdateMemo(context.Context, *connect.Request[v1.UpdateMemoRequest]) (*connect.Response[v1.Memo], error) + // 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. - DeleteMemo(context.Context, *connect.Request[v1.DeleteMemoRequest]) (*connect.Response[emptypb.Empty], error) + // 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. - SetMemoAttachments(context.Context, *connect.Request[v1.SetMemoAttachmentsRequest]) (*connect.Response[emptypb.Empty], error) - // ListMemoAttachments lists attachments for a memo. - ListMemoAttachments(context.Context, *connect.Request[v1.ListMemoAttachmentsRequest]) (*connect.Response[v1.ListMemoAttachmentsResponse], error) + // 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. - SetMemoRelations(context.Context, *connect.Request[v1.SetMemoRelationsRequest]) (*connect.Response[emptypb.Empty], error) - // ListMemoRelations lists relations for a memo. - ListMemoRelations(context.Context, *connect.Request[v1.ListMemoRelationsRequest]) (*connect.Response[v1.ListMemoRelationsResponse], error) + // 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. - CreateMemoComment(context.Context, *connect.Request[v1.CreateMemoCommentRequest]) (*connect.Response[v1.Memo], error) - // ListMemoComments lists comments for a memo. - ListMemoComments(context.Context, *connect.Request[v1.ListMemoCommentsRequest]) (*connect.Response[v1.ListMemoCommentsResponse], error) - // ListMemoReactions lists reactions for a memo. - ListMemoReactions(context.Context, *connect.Request[v1.ListMemoReactionsRequest]) (*connect.Response[v1.ListMemoReactionsResponse], error) - // UpsertMemoReaction adds or updates the authenticated user's reaction on a memo. - UpsertMemoReaction(context.Context, *connect.Request[v1.UpsertMemoReactionRequest]) (*connect.Response[v1.Reaction], error) - // DeleteMemoReaction deletes a reaction for a memo. - DeleteMemoReaction(context.Context, *connect.Request[v1.DeleteMemoReactionRequest]) (*connect.Response[emptypb.Empty], error) - // CreateMemoShare creates a share link for a memo. Requires the memo creator or an instance administrator. - CreateMemoShare(context.Context, *connect.Request[v1.CreateMemoShareRequest]) (*connect.Response[v1.MemoShare], error) - // ListMemoShares lists all share links for a memo. Requires the memo creator or an instance administrator. - ListMemoShares(context.Context, *connect.Request[v1.ListMemoSharesRequest]) (*connect.Response[v1.ListMemoSharesResponse], error) - // DeleteMemoShare revokes a share link. Requires the memo creator or an instance administrator. - DeleteMemoShare(context.Context, *connect.Request[v1.DeleteMemoShareRequest]) (*connect.Response[emptypb.Empty], error) - // GetSharedMemo resolves a share token to its memo. No authentication required. - // Returns NOT_FOUND if the token is invalid or expired. - GetSharedMemo(context.Context, *connect.Request[v1.GetSharedMemoRequest]) (*connect.Response[v1.Memo], error) - // GetLinkMetadata gets metadata for a link. - GetLinkMetadata(context.Context, *connect.Request[v1.GetLinkMetadataRequest]) (*connect.Response[v1.LinkMetadata], error) - // BatchGetLinkMetadata gets metadata for links. - BatchGetLinkMetadata(context.Context, *connect.Request[v1.BatchGetLinkMetadataRequest]) (*connect.Response[v1.BatchGetLinkMetadataResponse], error) + // 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.v1.MemoService service. By default, it +// 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. @@ -156,123 +170,123 @@ type MemoServiceClient interface { // 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 := v1.File_api_v1_memo_service_proto.Services().ByName("MemoService").Methods() + memoServiceMethods := api.File_api_memo_service_proto.Services().ByName("MemoService").Methods() return &memoServiceClient{ - createMemo: connect.NewClient[v1.CreateMemoRequest, v1.Memo]( - httpClient, - baseURL+MemoServiceCreateMemoProcedure, - connect.WithSchema(memoServiceMethods.ByName("CreateMemo")), - connect.WithClientOptions(opts...), - ), - listMemos: connect.NewClient[v1.ListMemosRequest, v1.ListMemosResponse]( + listMemos: connect.NewClient[api.ListMemosRequest, api.ListMemosResponse]( httpClient, baseURL+MemoServiceListMemosProcedure, connect.WithSchema(memoServiceMethods.ByName("ListMemos")), connect.WithClientOptions(opts...), ), - getMemo: connect.NewClient[v1.GetMemoRequest, v1.Memo]( + getMemo: connect.NewClient[api.GetMemoRequest, api.Memo]( httpClient, baseURL+MemoServiceGetMemoProcedure, connect.WithSchema(memoServiceMethods.ByName("GetMemo")), connect.WithClientOptions(opts...), ), - updateMemo: connect.NewClient[v1.UpdateMemoRequest, v1.Memo]( + 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[v1.DeleteMemoRequest, emptypb.Empty]( + deleteMemo: connect.NewClient[api.DeleteMemoRequest, emptypb.Empty]( httpClient, baseURL+MemoServiceDeleteMemoProcedure, connect.WithSchema(memoServiceMethods.ByName("DeleteMemo")), connect.WithClientOptions(opts...), ), - setMemoAttachments: connect.NewClient[v1.SetMemoAttachmentsRequest, emptypb.Empty]( - httpClient, - baseURL+MemoServiceSetMemoAttachmentsProcedure, - connect.WithSchema(memoServiceMethods.ByName("SetMemoAttachments")), - connect.WithClientOptions(opts...), - ), - listMemoAttachments: connect.NewClient[v1.ListMemoAttachmentsRequest, v1.ListMemoAttachmentsResponse]( + listMemoAttachments: connect.NewClient[api.ListMemoAttachmentsRequest, api.ListMemoAttachmentsResponse]( httpClient, baseURL+MemoServiceListMemoAttachmentsProcedure, connect.WithSchema(memoServiceMethods.ByName("ListMemoAttachments")), connect.WithClientOptions(opts...), ), - setMemoRelations: connect.NewClient[v1.SetMemoRelationsRequest, emptypb.Empty]( + setMemoAttachments: connect.NewClient[api.SetMemoAttachmentsRequest, emptypb.Empty]( httpClient, - baseURL+MemoServiceSetMemoRelationsProcedure, - connect.WithSchema(memoServiceMethods.ByName("SetMemoRelations")), + baseURL+MemoServiceSetMemoAttachmentsProcedure, + connect.WithSchema(memoServiceMethods.ByName("SetMemoAttachments")), connect.WithClientOptions(opts...), ), - listMemoRelations: connect.NewClient[v1.ListMemoRelationsRequest, v1.ListMemoRelationsResponse]( + listMemoRelations: connect.NewClient[api.ListMemoRelationsRequest, api.ListMemoRelationsResponse]( httpClient, baseURL+MemoServiceListMemoRelationsProcedure, connect.WithSchema(memoServiceMethods.ByName("ListMemoRelations")), connect.WithClientOptions(opts...), ), - createMemoComment: connect.NewClient[v1.CreateMemoCommentRequest, v1.Memo]( + setMemoRelations: connect.NewClient[api.SetMemoRelationsRequest, emptypb.Empty]( httpClient, - baseURL+MemoServiceCreateMemoCommentProcedure, - connect.WithSchema(memoServiceMethods.ByName("CreateMemoComment")), + baseURL+MemoServiceSetMemoRelationsProcedure, + connect.WithSchema(memoServiceMethods.ByName("SetMemoRelations")), connect.WithClientOptions(opts...), ), - listMemoComments: connect.NewClient[v1.ListMemoCommentsRequest, v1.ListMemoCommentsResponse]( + listMemoComments: connect.NewClient[api.ListMemoCommentsRequest, api.ListMemoCommentsResponse]( httpClient, baseURL+MemoServiceListMemoCommentsProcedure, connect.WithSchema(memoServiceMethods.ByName("ListMemoComments")), connect.WithClientOptions(opts...), ), - listMemoReactions: connect.NewClient[v1.ListMemoReactionsRequest, v1.ListMemoReactionsResponse]( + 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...), ), - upsertMemoReaction: connect.NewClient[v1.UpsertMemoReactionRequest, v1.Reaction]( - httpClient, - baseURL+MemoServiceUpsertMemoReactionProcedure, - connect.WithSchema(memoServiceMethods.ByName("UpsertMemoReaction")), - connect.WithClientOptions(opts...), - ), - deleteMemoReaction: connect.NewClient[v1.DeleteMemoReactionRequest, emptypb.Empty]( + deleteMemoReaction: connect.NewClient[api.DeleteMemoReactionRequest, emptypb.Empty]( httpClient, baseURL+MemoServiceDeleteMemoReactionProcedure, connect.WithSchema(memoServiceMethods.ByName("DeleteMemoReaction")), connect.WithClientOptions(opts...), ), - createMemoShare: connect.NewClient[v1.CreateMemoShareRequest, v1.MemoShare]( + upsertMemoReaction: connect.NewClient[api.UpsertMemoReactionRequest, api.Reaction]( httpClient, - baseURL+MemoServiceCreateMemoShareProcedure, - connect.WithSchema(memoServiceMethods.ByName("CreateMemoShare")), + baseURL+MemoServiceUpsertMemoReactionProcedure, + connect.WithSchema(memoServiceMethods.ByName("UpsertMemoReaction")), connect.WithClientOptions(opts...), ), - listMemoShares: connect.NewClient[v1.ListMemoSharesRequest, v1.ListMemoSharesResponse]( + listMemoShares: connect.NewClient[api.ListMemoSharesRequest, api.ListMemoSharesResponse]( httpClient, baseURL+MemoServiceListMemoSharesProcedure, connect.WithSchema(memoServiceMethods.ByName("ListMemoShares")), connect.WithClientOptions(opts...), ), - deleteMemoShare: connect.NewClient[v1.DeleteMemoShareRequest, emptypb.Empty]( + 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[v1.GetSharedMemoRequest, v1.Memo]( + getSharedMemo: connect.NewClient[api.GetSharedMemoRequest, api.Memo]( httpClient, baseURL+MemoServiceGetSharedMemoProcedure, connect.WithSchema(memoServiceMethods.ByName("GetSharedMemo")), connect.WithClientOptions(opts...), ), - getLinkMetadata: connect.NewClient[v1.GetLinkMetadataRequest, v1.LinkMetadata]( + getLinkMetadata: connect.NewClient[api.GetLinkMetadataRequest, api.LinkMetadata]( httpClient, baseURL+MemoServiceGetLinkMetadataProcedure, connect.WithSchema(memoServiceMethods.ByName("GetLinkMetadata")), connect.WithClientOptions(opts...), ), - batchGetLinkMetadata: connect.NewClient[v1.BatchGetLinkMetadataRequest, v1.BatchGetLinkMetadataResponse]( + batchGetLinkMetadata: connect.NewClient[api.BatchGetLinkMetadataRequest, api.BatchGetLinkMetadataResponse]( httpClient, baseURL+MemoServiceBatchGetLinkMetadataProcedure, connect.WithSchema(memoServiceMethods.ByName("BatchGetLinkMetadata")), @@ -283,182 +297,196 @@ func NewMemoServiceClient(httpClient connect.HTTPClient, baseURL string, opts .. // memoServiceClient implements MemoServiceClient. type memoServiceClient struct { - createMemo *connect.Client[v1.CreateMemoRequest, v1.Memo] - listMemos *connect.Client[v1.ListMemosRequest, v1.ListMemosResponse] - getMemo *connect.Client[v1.GetMemoRequest, v1.Memo] - updateMemo *connect.Client[v1.UpdateMemoRequest, v1.Memo] - deleteMemo *connect.Client[v1.DeleteMemoRequest, emptypb.Empty] - setMemoAttachments *connect.Client[v1.SetMemoAttachmentsRequest, emptypb.Empty] - listMemoAttachments *connect.Client[v1.ListMemoAttachmentsRequest, v1.ListMemoAttachmentsResponse] - setMemoRelations *connect.Client[v1.SetMemoRelationsRequest, emptypb.Empty] - listMemoRelations *connect.Client[v1.ListMemoRelationsRequest, v1.ListMemoRelationsResponse] - createMemoComment *connect.Client[v1.CreateMemoCommentRequest, v1.Memo] - listMemoComments *connect.Client[v1.ListMemoCommentsRequest, v1.ListMemoCommentsResponse] - listMemoReactions *connect.Client[v1.ListMemoReactionsRequest, v1.ListMemoReactionsResponse] - upsertMemoReaction *connect.Client[v1.UpsertMemoReactionRequest, v1.Reaction] - deleteMemoReaction *connect.Client[v1.DeleteMemoReactionRequest, emptypb.Empty] - createMemoShare *connect.Client[v1.CreateMemoShareRequest, v1.MemoShare] - listMemoShares *connect.Client[v1.ListMemoSharesRequest, v1.ListMemoSharesResponse] - deleteMemoShare *connect.Client[v1.DeleteMemoShareRequest, emptypb.Empty] - getSharedMemo *connect.Client[v1.GetSharedMemoRequest, v1.Memo] - getLinkMetadata *connect.Client[v1.GetLinkMetadataRequest, v1.LinkMetadata] - batchGetLinkMetadata *connect.Client[v1.BatchGetLinkMetadataRequest, v1.BatchGetLinkMetadataResponse] + 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] } -// CreateMemo calls memos.api.v1.MemoService.CreateMemo. -func (c *memoServiceClient) CreateMemo(ctx context.Context, req *connect.Request[v1.CreateMemoRequest]) (*connect.Response[v1.Memo], error) { - return c.createMemo.CallUnary(ctx, req) -} - -// ListMemos calls memos.api.v1.MemoService.ListMemos. -func (c *memoServiceClient) ListMemos(ctx context.Context, req *connect.Request[v1.ListMemosRequest]) (*connect.Response[v1.ListMemosResponse], error) { +// 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.v1.MemoService.GetMemo. -func (c *memoServiceClient) GetMemo(ctx context.Context, req *connect.Request[v1.GetMemoRequest]) (*connect.Response[v1.Memo], error) { +// 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) } -// UpdateMemo calls memos.api.v1.MemoService.UpdateMemo. -func (c *memoServiceClient) UpdateMemo(ctx context.Context, req *connect.Request[v1.UpdateMemoRequest]) (*connect.Response[v1.Memo], error) { +// 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.v1.MemoService.DeleteMemo. -func (c *memoServiceClient) DeleteMemo(ctx context.Context, req *connect.Request[v1.DeleteMemoRequest]) (*connect.Response[emptypb.Empty], error) { +// 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) } -// SetMemoAttachments calls memos.api.v1.MemoService.SetMemoAttachments. -func (c *memoServiceClient) SetMemoAttachments(ctx context.Context, req *connect.Request[v1.SetMemoAttachmentsRequest]) (*connect.Response[emptypb.Empty], error) { - return c.setMemoAttachments.CallUnary(ctx, req) -} - -// ListMemoAttachments calls memos.api.v1.MemoService.ListMemoAttachments. -func (c *memoServiceClient) ListMemoAttachments(ctx context.Context, req *connect.Request[v1.ListMemoAttachmentsRequest]) (*connect.Response[v1.ListMemoAttachmentsResponse], error) { +// 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) } -// SetMemoRelations calls memos.api.v1.MemoService.SetMemoRelations. -func (c *memoServiceClient) SetMemoRelations(ctx context.Context, req *connect.Request[v1.SetMemoRelationsRequest]) (*connect.Response[emptypb.Empty], error) { - return c.setMemoRelations.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.v1.MemoService.ListMemoRelations. -func (c *memoServiceClient) ListMemoRelations(ctx context.Context, req *connect.Request[v1.ListMemoRelationsRequest]) (*connect.Response[v1.ListMemoRelationsResponse], error) { +// 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) } -// CreateMemoComment calls memos.api.v1.MemoService.CreateMemoComment. -func (c *memoServiceClient) CreateMemoComment(ctx context.Context, req *connect.Request[v1.CreateMemoCommentRequest]) (*connect.Response[v1.Memo], error) { - return c.createMemoComment.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.v1.MemoService.ListMemoComments. -func (c *memoServiceClient) ListMemoComments(ctx context.Context, req *connect.Request[v1.ListMemoCommentsRequest]) (*connect.Response[v1.ListMemoCommentsResponse], error) { +// 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) } -// ListMemoReactions calls memos.api.v1.MemoService.ListMemoReactions. -func (c *memoServiceClient) ListMemoReactions(ctx context.Context, req *connect.Request[v1.ListMemoReactionsRequest]) (*connect.Response[v1.ListMemoReactionsResponse], error) { +// 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) } -// UpsertMemoReaction calls memos.api.v1.MemoService.UpsertMemoReaction. -func (c *memoServiceClient) UpsertMemoReaction(ctx context.Context, req *connect.Request[v1.UpsertMemoReactionRequest]) (*connect.Response[v1.Reaction], error) { - return c.upsertMemoReaction.CallUnary(ctx, req) -} - -// DeleteMemoReaction calls memos.api.v1.MemoService.DeleteMemoReaction. -func (c *memoServiceClient) DeleteMemoReaction(ctx context.Context, req *connect.Request[v1.DeleteMemoReactionRequest]) (*connect.Response[emptypb.Empty], error) { +// 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) } -// CreateMemoShare calls memos.api.v1.MemoService.CreateMemoShare. -func (c *memoServiceClient) CreateMemoShare(ctx context.Context, req *connect.Request[v1.CreateMemoShareRequest]) (*connect.Response[v1.MemoShare], error) { - return c.createMemoShare.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.v1.MemoService.ListMemoShares. -func (c *memoServiceClient) ListMemoShares(ctx context.Context, req *connect.Request[v1.ListMemoSharesRequest]) (*connect.Response[v1.ListMemoSharesResponse], error) { +// 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) } -// DeleteMemoShare calls memos.api.v1.MemoService.DeleteMemoShare. -func (c *memoServiceClient) DeleteMemoShare(ctx context.Context, req *connect.Request[v1.DeleteMemoShareRequest]) (*connect.Response[emptypb.Empty], error) { +// 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.v1.MemoService.GetSharedMemo. -func (c *memoServiceClient) GetSharedMemo(ctx context.Context, req *connect.Request[v1.GetSharedMemoRequest]) (*connect.Response[v1.Memo], error) { +// 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.v1.MemoService.GetLinkMetadata. -func (c *memoServiceClient) GetLinkMetadata(ctx context.Context, req *connect.Request[v1.GetLinkMetadataRequest]) (*connect.Response[v1.LinkMetadata], error) { +// 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.v1.MemoService.BatchGetLinkMetadata. -func (c *memoServiceClient) BatchGetLinkMetadata(ctx context.Context, req *connect.Request[v1.BatchGetLinkMetadataRequest]) (*connect.Response[v1.BatchGetLinkMetadataResponse], error) { +// 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.v1.MemoService service. +// MemoServiceHandler is an implementation of the memos.api.MemoService service. type MemoServiceHandler interface { - // CreateMemo creates a memo. The request body is a Memo; set its content - // (Markdown) and visibility (PRIVATE | PROTECTED | PUBLIC | SPACE, - // default PRIVATE). - // The memo is owned by the authenticated user; requires authentication. - CreateMemo(context.Context, *connect.Request[v1.CreateMemoRequest]) (*connect.Response[v1.Memo], error) - // ListMemos lists readable non-comment memos with pagination and filter. - ListMemos(context.Context, *connect.Request[v1.ListMemosRequest]) (*connect.Response[v1.ListMemosResponse], error) - // GetMemo gets a memo. - GetMemo(context.Context, *connect.Request[v1.GetMemoRequest]) (*connect.Response[v1.Memo], error) - // UpdateMemo updates a memo. - UpdateMemo(context.Context, *connect.Request[v1.UpdateMemoRequest]) (*connect.Response[v1.Memo], error) + // 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. - DeleteMemo(context.Context, *connect.Request[v1.DeleteMemoRequest]) (*connect.Response[emptypb.Empty], error) + // 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. - SetMemoAttachments(context.Context, *connect.Request[v1.SetMemoAttachmentsRequest]) (*connect.Response[emptypb.Empty], error) - // ListMemoAttachments lists attachments for a memo. - ListMemoAttachments(context.Context, *connect.Request[v1.ListMemoAttachmentsRequest]) (*connect.Response[v1.ListMemoAttachmentsResponse], error) + // 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. - SetMemoRelations(context.Context, *connect.Request[v1.SetMemoRelationsRequest]) (*connect.Response[emptypb.Empty], error) - // ListMemoRelations lists relations for a memo. - ListMemoRelations(context.Context, *connect.Request[v1.ListMemoRelationsRequest]) (*connect.Response[v1.ListMemoRelationsResponse], error) + // 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. - CreateMemoComment(context.Context, *connect.Request[v1.CreateMemoCommentRequest]) (*connect.Response[v1.Memo], error) - // ListMemoComments lists comments for a memo. - ListMemoComments(context.Context, *connect.Request[v1.ListMemoCommentsRequest]) (*connect.Response[v1.ListMemoCommentsResponse], error) - // ListMemoReactions lists reactions for a memo. - ListMemoReactions(context.Context, *connect.Request[v1.ListMemoReactionsRequest]) (*connect.Response[v1.ListMemoReactionsResponse], error) - // UpsertMemoReaction adds or updates the authenticated user's reaction on a memo. - UpsertMemoReaction(context.Context, *connect.Request[v1.UpsertMemoReactionRequest]) (*connect.Response[v1.Reaction], error) - // DeleteMemoReaction deletes a reaction for a memo. - DeleteMemoReaction(context.Context, *connect.Request[v1.DeleteMemoReactionRequest]) (*connect.Response[emptypb.Empty], error) - // CreateMemoShare creates a share link for a memo. Requires the memo creator or an instance administrator. - CreateMemoShare(context.Context, *connect.Request[v1.CreateMemoShareRequest]) (*connect.Response[v1.MemoShare], error) - // ListMemoShares lists all share links for a memo. Requires the memo creator or an instance administrator. - ListMemoShares(context.Context, *connect.Request[v1.ListMemoSharesRequest]) (*connect.Response[v1.ListMemoSharesResponse], error) - // DeleteMemoShare revokes a share link. Requires the memo creator or an instance administrator. - DeleteMemoShare(context.Context, *connect.Request[v1.DeleteMemoShareRequest]) (*connect.Response[emptypb.Empty], error) - // GetSharedMemo resolves a share token to its memo. No authentication required. - // Returns NOT_FOUND if the token is invalid or expired. - GetSharedMemo(context.Context, *connect.Request[v1.GetSharedMemoRequest]) (*connect.Response[v1.Memo], error) - // GetLinkMetadata gets metadata for a link. - GetLinkMetadata(context.Context, *connect.Request[v1.GetLinkMetadataRequest]) (*connect.Response[v1.LinkMetadata], error) - // BatchGetLinkMetadata gets metadata for links. - BatchGetLinkMetadata(context.Context, *connect.Request[v1.BatchGetLinkMetadataRequest]) (*connect.Response[v1.BatchGetLinkMetadataResponse], error) + // 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 @@ -467,13 +495,7 @@ type MemoServiceHandler interface { // 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 := v1.File_api_v1_memo_service_proto.Services().ByName("MemoService").Methods() - memoServiceCreateMemoHandler := connect.NewUnaryHandler( - MemoServiceCreateMemoProcedure, - svc.CreateMemo, - connect.WithSchema(memoServiceMethods.ByName("CreateMemo")), - connect.WithHandlerOptions(opts...), - ) + memoServiceMethods := api.File_api_memo_service_proto.Services().ByName("MemoService").Methods() memoServiceListMemosHandler := connect.NewUnaryHandler( MemoServiceListMemosProcedure, svc.ListMemos, @@ -486,6 +508,12 @@ func NewMemoServiceHandler(svc MemoServiceHandler, opts ...connect.HandlerOption 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, @@ -498,22 +526,16 @@ func NewMemoServiceHandler(svc MemoServiceHandler, opts ...connect.HandlerOption connect.WithSchema(memoServiceMethods.ByName("DeleteMemo")), connect.WithHandlerOptions(opts...), ) - memoServiceSetMemoAttachmentsHandler := connect.NewUnaryHandler( - MemoServiceSetMemoAttachmentsProcedure, - svc.SetMemoAttachments, - connect.WithSchema(memoServiceMethods.ByName("SetMemoAttachments")), - connect.WithHandlerOptions(opts...), - ) memoServiceListMemoAttachmentsHandler := connect.NewUnaryHandler( MemoServiceListMemoAttachmentsProcedure, svc.ListMemoAttachments, connect.WithSchema(memoServiceMethods.ByName("ListMemoAttachments")), connect.WithHandlerOptions(opts...), ) - memoServiceSetMemoRelationsHandler := connect.NewUnaryHandler( - MemoServiceSetMemoRelationsProcedure, - svc.SetMemoRelations, - connect.WithSchema(memoServiceMethods.ByName("SetMemoRelations")), + memoServiceSetMemoAttachmentsHandler := connect.NewUnaryHandler( + MemoServiceSetMemoAttachmentsProcedure, + svc.SetMemoAttachments, + connect.WithSchema(memoServiceMethods.ByName("SetMemoAttachments")), connect.WithHandlerOptions(opts...), ) memoServiceListMemoRelationsHandler := connect.NewUnaryHandler( @@ -522,10 +544,10 @@ func NewMemoServiceHandler(svc MemoServiceHandler, opts ...connect.HandlerOption connect.WithSchema(memoServiceMethods.ByName("ListMemoRelations")), connect.WithHandlerOptions(opts...), ) - memoServiceCreateMemoCommentHandler := connect.NewUnaryHandler( - MemoServiceCreateMemoCommentProcedure, - svc.CreateMemoComment, - connect.WithSchema(memoServiceMethods.ByName("CreateMemoComment")), + memoServiceSetMemoRelationsHandler := connect.NewUnaryHandler( + MemoServiceSetMemoRelationsProcedure, + svc.SetMemoRelations, + connect.WithSchema(memoServiceMethods.ByName("SetMemoRelations")), connect.WithHandlerOptions(opts...), ) memoServiceListMemoCommentsHandler := connect.NewUnaryHandler( @@ -534,28 +556,28 @@ func NewMemoServiceHandler(svc MemoServiceHandler, opts ...connect.HandlerOption 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...), ) - memoServiceUpsertMemoReactionHandler := connect.NewUnaryHandler( - MemoServiceUpsertMemoReactionProcedure, - svc.UpsertMemoReaction, - connect.WithSchema(memoServiceMethods.ByName("UpsertMemoReaction")), - connect.WithHandlerOptions(opts...), - ) memoServiceDeleteMemoReactionHandler := connect.NewUnaryHandler( MemoServiceDeleteMemoReactionProcedure, svc.DeleteMemoReaction, connect.WithSchema(memoServiceMethods.ByName("DeleteMemoReaction")), connect.WithHandlerOptions(opts...), ) - memoServiceCreateMemoShareHandler := connect.NewUnaryHandler( - MemoServiceCreateMemoShareProcedure, - svc.CreateMemoShare, - connect.WithSchema(memoServiceMethods.ByName("CreateMemoShare")), + memoServiceUpsertMemoReactionHandler := connect.NewUnaryHandler( + MemoServiceUpsertMemoReactionProcedure, + svc.UpsertMemoReaction, + connect.WithSchema(memoServiceMethods.ByName("UpsertMemoReaction")), connect.WithHandlerOptions(opts...), ) memoServiceListMemoSharesHandler := connect.NewUnaryHandler( @@ -564,6 +586,12 @@ func NewMemoServiceHandler(svc MemoServiceHandler, opts ...connect.HandlerOption 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, @@ -588,40 +616,40 @@ func NewMemoServiceHandler(svc MemoServiceHandler, opts ...connect.HandlerOption connect.WithSchema(memoServiceMethods.ByName("BatchGetLinkMetadata")), connect.WithHandlerOptions(opts...), ) - return "/memos.api.v1.MemoService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + return "/memos.api.MemoService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { switch r.URL.Path { - case MemoServiceCreateMemoProcedure: - memoServiceCreateMemoHandler.ServeHTTP(w, r) 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 MemoServiceSetMemoAttachmentsProcedure: - memoServiceSetMemoAttachmentsHandler.ServeHTTP(w, r) case MemoServiceListMemoAttachmentsProcedure: memoServiceListMemoAttachmentsHandler.ServeHTTP(w, r) - case MemoServiceSetMemoRelationsProcedure: - memoServiceSetMemoRelationsHandler.ServeHTTP(w, r) + case MemoServiceSetMemoAttachmentsProcedure: + memoServiceSetMemoAttachmentsHandler.ServeHTTP(w, r) case MemoServiceListMemoRelationsProcedure: memoServiceListMemoRelationsHandler.ServeHTTP(w, r) - case MemoServiceCreateMemoCommentProcedure: - memoServiceCreateMemoCommentHandler.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 MemoServiceUpsertMemoReactionProcedure: - memoServiceUpsertMemoReactionHandler.ServeHTTP(w, r) case MemoServiceDeleteMemoReactionProcedure: memoServiceDeleteMemoReactionHandler.ServeHTTP(w, r) - case MemoServiceCreateMemoShareProcedure: - memoServiceCreateMemoShareHandler.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: @@ -639,82 +667,82 @@ func NewMemoServiceHandler(svc MemoServiceHandler, opts ...connect.HandlerOption // UnimplementedMemoServiceHandler returns CodeUnimplemented from all methods. type UnimplementedMemoServiceHandler struct{} -func (UnimplementedMemoServiceHandler) CreateMemo(context.Context, *connect.Request[v1.CreateMemoRequest]) (*connect.Response[v1.Memo], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.MemoService.CreateMemo is not implemented")) +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) ListMemos(context.Context, *connect.Request[v1.ListMemosRequest]) (*connect.Response[v1.ListMemosResponse], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.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) GetMemo(context.Context, *connect.Request[v1.GetMemoRequest]) (*connect.Response[v1.Memo], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.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[v1.UpdateMemoRequest]) (*connect.Response[v1.Memo], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.MemoService.UpdateMemo 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[v1.DeleteMemoRequest]) (*connect.Response[emptypb.Empty], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.MemoService.DeleteMemo 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) SetMemoAttachments(context.Context, *connect.Request[v1.SetMemoAttachmentsRequest]) (*connect.Response[emptypb.Empty], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.MemoService.SetMemoAttachments 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) ListMemoAttachments(context.Context, *connect.Request[v1.ListMemoAttachmentsRequest]) (*connect.Response[v1.ListMemoAttachmentsResponse], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.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) SetMemoRelations(context.Context, *connect.Request[v1.SetMemoRelationsRequest]) (*connect.Response[emptypb.Empty], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.MemoService.SetMemoRelations 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) ListMemoRelations(context.Context, *connect.Request[v1.ListMemoRelationsRequest]) (*connect.Response[v1.ListMemoRelationsResponse], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.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) CreateMemoComment(context.Context, *connect.Request[v1.CreateMemoCommentRequest]) (*connect.Response[v1.Memo], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.MemoService.CreateMemoComment 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) ListMemoComments(context.Context, *connect.Request[v1.ListMemoCommentsRequest]) (*connect.Response[v1.ListMemoCommentsResponse], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.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[v1.ListMemoReactionsRequest]) (*connect.Response[v1.ListMemoReactionsResponse], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.MemoService.ListMemoReactions 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) UpsertMemoReaction(context.Context, *connect.Request[v1.UpsertMemoReactionRequest]) (*connect.Response[v1.Reaction], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.MemoService.UpsertMemoReaction 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) DeleteMemoReaction(context.Context, *connect.Request[v1.DeleteMemoReactionRequest]) (*connect.Response[emptypb.Empty], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.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) CreateMemoShare(context.Context, *connect.Request[v1.CreateMemoShareRequest]) (*connect.Response[v1.MemoShare], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.MemoService.CreateMemoShare 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) ListMemoShares(context.Context, *connect.Request[v1.ListMemoSharesRequest]) (*connect.Response[v1.ListMemoSharesResponse], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.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[v1.DeleteMemoShareRequest]) (*connect.Response[emptypb.Empty], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.MemoService.DeleteMemoShare 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[v1.GetSharedMemoRequest]) (*connect.Response[v1.Memo], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.MemoService.GetSharedMemo 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[v1.GetLinkMetadataRequest]) (*connect.Response[v1.LinkMetadata], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.MemoService.GetLinkMetadata 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[v1.BatchGetLinkMetadataRequest]) (*connect.Response[v1.BatchGetLinkMetadataResponse], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.MemoService.BatchGetLinkMetadata 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")) } diff --git a/proto/gen/api/v1/apiv1connect/space_service.connect.go b/proto/gen/api/apiconnect/space_service.connect.go similarity index 50% rename from proto/gen/api/v1/apiv1connect/space_service.connect.go rename to proto/gen/api/apiconnect/space_service.connect.go index 7b9211914..541d9837d 100644 --- a/proto/gen/api/v1/apiv1connect/space_service.connect.go +++ b/proto/gen/api/apiconnect/space_service.connect.go @@ -1,14 +1,14 @@ // Code generated by protoc-gen-connect-go. DO NOT EDIT. // -// Source: api/v1/space_service.proto +// Source: api/space_service.proto -package apiv1connect +package apiconnect import ( connect "connectrpc.com/connect" context "context" errors "errors" - v1 "github.com/usememos/memos/proto/gen/api/v1" + api "github.com/usememos/memos/proto/gen/api" emptypb "google.golang.org/protobuf/types/known/emptypb" http "net/http" strings "strings" @@ -23,7 +23,7 @@ const _ = connect.IsAtLeastVersion1_13_0 const ( // SpaceServiceName is the fully-qualified name of the SpaceService service. - SpaceServiceName = "memos.api.v1.SpaceService" + SpaceServiceName = "memos.api.SpaceService" ) // These constants are the fully-qualified names of the RPCs defined in this package. They're @@ -34,340 +34,370 @@ const ( // reflection-formatted method names, remove the leading slash and convert the remaining slash to a // period. const ( + // SpaceServiceListSpacesProcedure is the fully-qualified name of the SpaceService's ListSpaces RPC. + SpaceServiceListSpacesProcedure = "/memos.api.SpaceService/ListSpaces" + // SpaceServiceGetSpaceProcedure is the fully-qualified name of the SpaceService's GetSpace RPC. + SpaceServiceGetSpaceProcedure = "/memos.api.SpaceService/GetSpace" // SpaceServiceCreateSpaceProcedure is the fully-qualified name of the SpaceService's CreateSpace // RPC. - SpaceServiceCreateSpaceProcedure = "/memos.api.v1.SpaceService/CreateSpace" - // SpaceServiceListSpacesProcedure is the fully-qualified name of the SpaceService's ListSpaces RPC. - SpaceServiceListSpacesProcedure = "/memos.api.v1.SpaceService/ListSpaces" - // SpaceServiceGetSpaceProcedure is the fully-qualified name of the SpaceService's GetSpace RPC. - SpaceServiceGetSpaceProcedure = "/memos.api.v1.SpaceService/GetSpace" + SpaceServiceCreateSpaceProcedure = "/memos.api.SpaceService/CreateSpace" // SpaceServiceUpdateSpaceProcedure is the fully-qualified name of the SpaceService's UpdateSpace // RPC. - SpaceServiceUpdateSpaceProcedure = "/memos.api.v1.SpaceService/UpdateSpace" + SpaceServiceUpdateSpaceProcedure = "/memos.api.SpaceService/UpdateSpace" // SpaceServiceDeleteSpaceProcedure is the fully-qualified name of the SpaceService's DeleteSpace // RPC. - SpaceServiceDeleteSpaceProcedure = "/memos.api.v1.SpaceService/DeleteSpace" - // SpaceServiceCreateSpaceInvitationProcedure is the fully-qualified name of the SpaceService's - // CreateSpaceInvitation RPC. - SpaceServiceCreateSpaceInvitationProcedure = "/memos.api.v1.SpaceService/CreateSpaceInvitation" - // SpaceServiceListSpaceInvitationsProcedure is the fully-qualified name of the SpaceService's - // ListSpaceInvitations RPC. - SpaceServiceListSpaceInvitationsProcedure = "/memos.api.v1.SpaceService/ListSpaceInvitations" - // SpaceServiceListUserSpaceInvitationsProcedure is the fully-qualified name of the SpaceService's - // ListUserSpaceInvitations RPC. - SpaceServiceListUserSpaceInvitationsProcedure = "/memos.api.v1.SpaceService/ListUserSpaceInvitations" - // SpaceServiceGetSpaceInvitationProcedure is the fully-qualified name of the SpaceService's - // GetSpaceInvitation RPC. - SpaceServiceGetSpaceInvitationProcedure = "/memos.api.v1.SpaceService/GetSpaceInvitation" - // SpaceServiceDeleteSpaceInvitationProcedure is the fully-qualified name of the SpaceService's - // DeleteSpaceInvitation RPC. - SpaceServiceDeleteSpaceInvitationProcedure = "/memos.api.v1.SpaceService/DeleteSpaceInvitation" - // SpaceServiceAcceptSpaceInvitationProcedure is the fully-qualified name of the SpaceService's - // AcceptSpaceInvitation RPC. - SpaceServiceAcceptSpaceInvitationProcedure = "/memos.api.v1.SpaceService/AcceptSpaceInvitation" - // SpaceServiceDeclineSpaceInvitationProcedure is the fully-qualified name of the SpaceService's - // DeclineSpaceInvitation RPC. - SpaceServiceDeclineSpaceInvitationProcedure = "/memos.api.v1.SpaceService/DeclineSpaceInvitation" + SpaceServiceDeleteSpaceProcedure = "/memos.api.SpaceService/DeleteSpace" // SpaceServiceListSpaceMembersProcedure is the fully-qualified name of the SpaceService's // ListSpaceMembers RPC. - SpaceServiceListSpaceMembersProcedure = "/memos.api.v1.SpaceService/ListSpaceMembers" + SpaceServiceListSpaceMembersProcedure = "/memos.api.SpaceService/ListSpaceMembers" // SpaceServiceGetSpaceMemberProcedure is the fully-qualified name of the SpaceService's // GetSpaceMember RPC. - SpaceServiceGetSpaceMemberProcedure = "/memos.api.v1.SpaceService/GetSpaceMember" + SpaceServiceGetSpaceMemberProcedure = "/memos.api.SpaceService/GetSpaceMember" // SpaceServiceUpdateSpaceMemberProcedure is the fully-qualified name of the SpaceService's // UpdateSpaceMember RPC. - SpaceServiceUpdateSpaceMemberProcedure = "/memos.api.v1.SpaceService/UpdateSpaceMember" + SpaceServiceUpdateSpaceMemberProcedure = "/memos.api.SpaceService/UpdateSpaceMember" // SpaceServiceDeleteSpaceMemberProcedure is the fully-qualified name of the SpaceService's // DeleteSpaceMember RPC. - SpaceServiceDeleteSpaceMemberProcedure = "/memos.api.v1.SpaceService/DeleteSpaceMember" + SpaceServiceDeleteSpaceMemberProcedure = "/memos.api.SpaceService/DeleteSpaceMember" + // SpaceServiceListSpaceInvitationsProcedure is the fully-qualified name of the SpaceService's + // ListSpaceInvitations RPC. + SpaceServiceListSpaceInvitationsProcedure = "/memos.api.SpaceService/ListSpaceInvitations" + // SpaceServiceListUserSpaceInvitationsProcedure is the fully-qualified name of the SpaceService's + // ListUserSpaceInvitations RPC. + SpaceServiceListUserSpaceInvitationsProcedure = "/memos.api.SpaceService/ListUserSpaceInvitations" + // SpaceServiceGetSpaceInvitationProcedure is the fully-qualified name of the SpaceService's + // GetSpaceInvitation RPC. + SpaceServiceGetSpaceInvitationProcedure = "/memos.api.SpaceService/GetSpaceInvitation" + // SpaceServiceCreateSpaceInvitationProcedure is the fully-qualified name of the SpaceService's + // CreateSpaceInvitation RPC. + SpaceServiceCreateSpaceInvitationProcedure = "/memos.api.SpaceService/CreateSpaceInvitation" + // SpaceServiceDeleteSpaceInvitationProcedure is the fully-qualified name of the SpaceService's + // DeleteSpaceInvitation RPC. + SpaceServiceDeleteSpaceInvitationProcedure = "/memos.api.SpaceService/DeleteSpaceInvitation" + // SpaceServiceAcceptSpaceInvitationProcedure is the fully-qualified name of the SpaceService's + // AcceptSpaceInvitation RPC. + SpaceServiceAcceptSpaceInvitationProcedure = "/memos.api.SpaceService/AcceptSpaceInvitation" + // SpaceServiceDeclineSpaceInvitationProcedure is the fully-qualified name of the SpaceService's + // DeclineSpaceInvitation RPC. + SpaceServiceDeclineSpaceInvitationProcedure = "/memos.api.SpaceService/DeclineSpaceInvitation" ) -// SpaceServiceClient is a client for the memos.api.v1.SpaceService service. +// SpaceServiceClient is a client for the memos.api.SpaceService service. type SpaceServiceClient interface { + // ListSpaces lists the spaces of which the authenticated caller is a member. + ListSpaces(context.Context, *connect.Request[api.ListSpacesRequest]) (*connect.Response[api.ListSpacesResponse], error) + // GetSpace gets a space of which the authenticated caller is a member. + // Spaces the caller is not a member of are reported as not found. + GetSpace(context.Context, *connect.Request[api.GetSpaceRequest]) (*connect.Response[api.Space], error) // CreateSpace creates a space and makes the authenticated caller its first // administrator. - CreateSpace(context.Context, *connect.Request[v1.CreateSpaceRequest]) (*connect.Response[v1.Space], error) - // ListSpaces lists spaces of which the authenticated caller is a member. - ListSpaces(context.Context, *connect.Request[v1.ListSpacesRequest]) (*connect.Response[v1.ListSpacesResponse], error) - // GetSpace gets a space of which the authenticated caller is a member. - GetSpace(context.Context, *connect.Request[v1.GetSpaceRequest]) (*connect.Response[v1.Space], error) - // UpdateSpace updates space metadata. - UpdateSpace(context.Context, *connect.Request[v1.UpdateSpaceRequest]) (*connect.Response[v1.Space], error) + CreateSpace(context.Context, *connect.Request[api.CreateSpaceRequest]) (*connect.Response[api.Space], error) + // UpdateSpace updates space metadata. Only a space administrator can update + // a space. + UpdateSpace(context.Context, *connect.Request[api.UpdateSpaceRequest]) (*connect.Response[api.Space], error) // DeleteSpace permanently deletes a space and every memo currently placed - // in it. It never follows memo relations to other memos. - DeleteSpace(context.Context, *connect.Request[v1.DeleteSpaceRequest]) (*connect.Response[emptypb.Empty], error) - // CreateSpaceInvitation invites an existing active user to a space. - CreateSpaceInvitation(context.Context, *connect.Request[v1.CreateSpaceInvitationRequest]) (*connect.Response[v1.SpaceInvitation], error) - // ListSpaceInvitations lists the pending invitations for a space. - ListSpaceInvitations(context.Context, *connect.Request[v1.ListSpaceInvitationsRequest]) (*connect.Response[v1.ListSpaceInvitationsResponse], error) - // ListUserSpaceInvitations lists the authenticated user's pending space invitations. - ListUserSpaceInvitations(context.Context, *connect.Request[v1.ListUserSpaceInvitationsRequest]) (*connect.Response[v1.ListUserSpaceInvitationsResponse], error) - // GetSpaceInvitation gets one pending invitation. - GetSpaceInvitation(context.Context, *connect.Request[v1.GetSpaceInvitationRequest]) (*connect.Response[v1.SpaceInvitation], error) - // DeleteSpaceInvitation revokes a pending invitation. - DeleteSpaceInvitation(context.Context, *connect.Request[v1.DeleteSpaceInvitationRequest]) (*connect.Response[emptypb.Empty], error) - // AcceptSpaceInvitation accepts a pending invitation and creates a membership. - AcceptSpaceInvitation(context.Context, *connect.Request[v1.AcceptSpaceInvitationRequest]) (*connect.Response[v1.SpaceMember], error) - // DeclineSpaceInvitation declines a pending invitation. - DeclineSpaceInvitation(context.Context, *connect.Request[v1.DeclineSpaceInvitationRequest]) (*connect.Response[emptypb.Empty], error) - // ListSpaceMembers lists the members of a space. - ListSpaceMembers(context.Context, *connect.Request[v1.ListSpaceMembersRequest]) (*connect.Response[v1.ListSpaceMembersResponse], error) - // GetSpaceMember gets one membership in a space. - GetSpaceMember(context.Context, *connect.Request[v1.GetSpaceMemberRequest]) (*connect.Response[v1.SpaceMember], error) - // UpdateSpaceMember changes a member's space role. - UpdateSpaceMember(context.Context, *connect.Request[v1.UpdateSpaceMemberRequest]) (*connect.Response[v1.SpaceMember], error) - // DeleteSpaceMember removes a member. A member may delete their own - // membership to leave the space. - DeleteSpaceMember(context.Context, *connect.Request[v1.DeleteSpaceMemberRequest]) (*connect.Response[emptypb.Empty], error) + // in it. It never follows memo relations to other memos. Only a space + // administrator can delete a space. + DeleteSpace(context.Context, *connect.Request[api.DeleteSpaceRequest]) (*connect.Response[emptypb.Empty], error) + // ListSpaceMembers lists the members of a space. The caller must be a member + // of the space. + ListSpaceMembers(context.Context, *connect.Request[api.ListSpaceMembersRequest]) (*connect.Response[api.ListSpaceMembersResponse], error) + // GetSpaceMember gets one membership in a space. The caller must be a member + // of the space. + GetSpaceMember(context.Context, *connect.Request[api.GetSpaceMemberRequest]) (*connect.Response[api.SpaceMember], error) + // UpdateSpaceMember changes a member's space role. Only a space administrator + // can change roles, and a space must keep at least one administrator. + UpdateSpaceMember(context.Context, *connect.Request[api.UpdateSpaceMemberRequest]) (*connect.Response[api.SpaceMember], error) + // DeleteSpaceMember removes a member. A space administrator can remove any + // member, and a member may delete their own membership to leave the space. + // A space must keep at least one administrator. + DeleteSpaceMember(context.Context, *connect.Request[api.DeleteSpaceMemberRequest]) (*connect.Response[emptypb.Empty], error) + // ListSpaceInvitations lists the pending invitations for a space. Only a + // space administrator can list them. + ListSpaceInvitations(context.Context, *connect.Request[api.ListSpaceInvitationsRequest]) (*connect.Response[api.ListSpaceInvitationsResponse], error) + // ListUserSpaceInvitations lists the authenticated user's pending space + // invitations. A user cannot list another user's invitations. + ListUserSpaceInvitations(context.Context, *connect.Request[api.ListUserSpaceInvitationsRequest]) (*connect.Response[api.ListUserSpaceInvitationsResponse], error) + // GetSpaceInvitation gets one pending invitation. Only the invitee or a + // space administrator can get it. + GetSpaceInvitation(context.Context, *connect.Request[api.GetSpaceInvitationRequest]) (*connect.Response[api.SpaceInvitation], error) + // CreateSpaceInvitation invites an existing active user to a space. Only a + // space administrator can invite. The invitee gets no space access until + // they accept. + CreateSpaceInvitation(context.Context, *connect.Request[api.CreateSpaceInvitationRequest]) (*connect.Response[api.SpaceInvitation], error) + // DeleteSpaceInvitation revokes a pending invitation. Only a space + // administrator can revoke it. + DeleteSpaceInvitation(context.Context, *connect.Request[api.DeleteSpaceInvitationRequest]) (*connect.Response[emptypb.Empty], error) + // AcceptSpaceInvitation accepts a pending invitation and creates a + // membership with the invited role. Only the invitee can accept it. + AcceptSpaceInvitation(context.Context, *connect.Request[api.AcceptSpaceInvitationRequest]) (*connect.Response[api.SpaceMember], error) + // DeclineSpaceInvitation declines a pending invitation without creating a + // membership. Only the invitee can decline it. + DeclineSpaceInvitation(context.Context, *connect.Request[api.DeclineSpaceInvitationRequest]) (*connect.Response[emptypb.Empty], error) } -// NewSpaceServiceClient constructs a client for the memos.api.v1.SpaceService 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. +// NewSpaceServiceClient constructs a client for the memos.api.SpaceService 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 NewSpaceServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) SpaceServiceClient { baseURL = strings.TrimRight(baseURL, "/") - spaceServiceMethods := v1.File_api_v1_space_service_proto.Services().ByName("SpaceService").Methods() + spaceServiceMethods := api.File_api_space_service_proto.Services().ByName("SpaceService").Methods() return &spaceServiceClient{ - createSpace: connect.NewClient[v1.CreateSpaceRequest, v1.Space]( - httpClient, - baseURL+SpaceServiceCreateSpaceProcedure, - connect.WithSchema(spaceServiceMethods.ByName("CreateSpace")), - connect.WithClientOptions(opts...), - ), - listSpaces: connect.NewClient[v1.ListSpacesRequest, v1.ListSpacesResponse]( + listSpaces: connect.NewClient[api.ListSpacesRequest, api.ListSpacesResponse]( httpClient, baseURL+SpaceServiceListSpacesProcedure, connect.WithSchema(spaceServiceMethods.ByName("ListSpaces")), connect.WithClientOptions(opts...), ), - getSpace: connect.NewClient[v1.GetSpaceRequest, v1.Space]( + getSpace: connect.NewClient[api.GetSpaceRequest, api.Space]( httpClient, baseURL+SpaceServiceGetSpaceProcedure, connect.WithSchema(spaceServiceMethods.ByName("GetSpace")), connect.WithClientOptions(opts...), ), - updateSpace: connect.NewClient[v1.UpdateSpaceRequest, v1.Space]( + createSpace: connect.NewClient[api.CreateSpaceRequest, api.Space]( + httpClient, + baseURL+SpaceServiceCreateSpaceProcedure, + connect.WithSchema(spaceServiceMethods.ByName("CreateSpace")), + connect.WithClientOptions(opts...), + ), + updateSpace: connect.NewClient[api.UpdateSpaceRequest, api.Space]( httpClient, baseURL+SpaceServiceUpdateSpaceProcedure, connect.WithSchema(spaceServiceMethods.ByName("UpdateSpace")), connect.WithClientOptions(opts...), ), - deleteSpace: connect.NewClient[v1.DeleteSpaceRequest, emptypb.Empty]( + deleteSpace: connect.NewClient[api.DeleteSpaceRequest, emptypb.Empty]( httpClient, baseURL+SpaceServiceDeleteSpaceProcedure, connect.WithSchema(spaceServiceMethods.ByName("DeleteSpace")), connect.WithClientOptions(opts...), ), - createSpaceInvitation: connect.NewClient[v1.CreateSpaceInvitationRequest, v1.SpaceInvitation]( - httpClient, - baseURL+SpaceServiceCreateSpaceInvitationProcedure, - connect.WithSchema(spaceServiceMethods.ByName("CreateSpaceInvitation")), - connect.WithClientOptions(opts...), - ), - listSpaceInvitations: connect.NewClient[v1.ListSpaceInvitationsRequest, v1.ListSpaceInvitationsResponse]( - httpClient, - baseURL+SpaceServiceListSpaceInvitationsProcedure, - connect.WithSchema(spaceServiceMethods.ByName("ListSpaceInvitations")), - connect.WithClientOptions(opts...), - ), - listUserSpaceInvitations: connect.NewClient[v1.ListUserSpaceInvitationsRequest, v1.ListUserSpaceInvitationsResponse]( - httpClient, - baseURL+SpaceServiceListUserSpaceInvitationsProcedure, - connect.WithSchema(spaceServiceMethods.ByName("ListUserSpaceInvitations")), - connect.WithClientOptions(opts...), - ), - getSpaceInvitation: connect.NewClient[v1.GetSpaceInvitationRequest, v1.SpaceInvitation]( - httpClient, - baseURL+SpaceServiceGetSpaceInvitationProcedure, - connect.WithSchema(spaceServiceMethods.ByName("GetSpaceInvitation")), - connect.WithClientOptions(opts...), - ), - deleteSpaceInvitation: connect.NewClient[v1.DeleteSpaceInvitationRequest, emptypb.Empty]( - httpClient, - baseURL+SpaceServiceDeleteSpaceInvitationProcedure, - connect.WithSchema(spaceServiceMethods.ByName("DeleteSpaceInvitation")), - connect.WithClientOptions(opts...), - ), - acceptSpaceInvitation: connect.NewClient[v1.AcceptSpaceInvitationRequest, v1.SpaceMember]( - httpClient, - baseURL+SpaceServiceAcceptSpaceInvitationProcedure, - connect.WithSchema(spaceServiceMethods.ByName("AcceptSpaceInvitation")), - connect.WithClientOptions(opts...), - ), - declineSpaceInvitation: connect.NewClient[v1.DeclineSpaceInvitationRequest, emptypb.Empty]( - httpClient, - baseURL+SpaceServiceDeclineSpaceInvitationProcedure, - connect.WithSchema(spaceServiceMethods.ByName("DeclineSpaceInvitation")), - connect.WithClientOptions(opts...), - ), - listSpaceMembers: connect.NewClient[v1.ListSpaceMembersRequest, v1.ListSpaceMembersResponse]( + listSpaceMembers: connect.NewClient[api.ListSpaceMembersRequest, api.ListSpaceMembersResponse]( httpClient, baseURL+SpaceServiceListSpaceMembersProcedure, connect.WithSchema(spaceServiceMethods.ByName("ListSpaceMembers")), connect.WithClientOptions(opts...), ), - getSpaceMember: connect.NewClient[v1.GetSpaceMemberRequest, v1.SpaceMember]( + getSpaceMember: connect.NewClient[api.GetSpaceMemberRequest, api.SpaceMember]( httpClient, baseURL+SpaceServiceGetSpaceMemberProcedure, connect.WithSchema(spaceServiceMethods.ByName("GetSpaceMember")), connect.WithClientOptions(opts...), ), - updateSpaceMember: connect.NewClient[v1.UpdateSpaceMemberRequest, v1.SpaceMember]( + updateSpaceMember: connect.NewClient[api.UpdateSpaceMemberRequest, api.SpaceMember]( httpClient, baseURL+SpaceServiceUpdateSpaceMemberProcedure, connect.WithSchema(spaceServiceMethods.ByName("UpdateSpaceMember")), connect.WithClientOptions(opts...), ), - deleteSpaceMember: connect.NewClient[v1.DeleteSpaceMemberRequest, emptypb.Empty]( + deleteSpaceMember: connect.NewClient[api.DeleteSpaceMemberRequest, emptypb.Empty]( httpClient, baseURL+SpaceServiceDeleteSpaceMemberProcedure, connect.WithSchema(spaceServiceMethods.ByName("DeleteSpaceMember")), connect.WithClientOptions(opts...), ), + listSpaceInvitations: connect.NewClient[api.ListSpaceInvitationsRequest, api.ListSpaceInvitationsResponse]( + httpClient, + baseURL+SpaceServiceListSpaceInvitationsProcedure, + connect.WithSchema(spaceServiceMethods.ByName("ListSpaceInvitations")), + connect.WithClientOptions(opts...), + ), + listUserSpaceInvitations: connect.NewClient[api.ListUserSpaceInvitationsRequest, api.ListUserSpaceInvitationsResponse]( + httpClient, + baseURL+SpaceServiceListUserSpaceInvitationsProcedure, + connect.WithSchema(spaceServiceMethods.ByName("ListUserSpaceInvitations")), + connect.WithClientOptions(opts...), + ), + getSpaceInvitation: connect.NewClient[api.GetSpaceInvitationRequest, api.SpaceInvitation]( + httpClient, + baseURL+SpaceServiceGetSpaceInvitationProcedure, + connect.WithSchema(spaceServiceMethods.ByName("GetSpaceInvitation")), + connect.WithClientOptions(opts...), + ), + createSpaceInvitation: connect.NewClient[api.CreateSpaceInvitationRequest, api.SpaceInvitation]( + httpClient, + baseURL+SpaceServiceCreateSpaceInvitationProcedure, + connect.WithSchema(spaceServiceMethods.ByName("CreateSpaceInvitation")), + connect.WithClientOptions(opts...), + ), + deleteSpaceInvitation: connect.NewClient[api.DeleteSpaceInvitationRequest, emptypb.Empty]( + httpClient, + baseURL+SpaceServiceDeleteSpaceInvitationProcedure, + connect.WithSchema(spaceServiceMethods.ByName("DeleteSpaceInvitation")), + connect.WithClientOptions(opts...), + ), + acceptSpaceInvitation: connect.NewClient[api.AcceptSpaceInvitationRequest, api.SpaceMember]( + httpClient, + baseURL+SpaceServiceAcceptSpaceInvitationProcedure, + connect.WithSchema(spaceServiceMethods.ByName("AcceptSpaceInvitation")), + connect.WithClientOptions(opts...), + ), + declineSpaceInvitation: connect.NewClient[api.DeclineSpaceInvitationRequest, emptypb.Empty]( + httpClient, + baseURL+SpaceServiceDeclineSpaceInvitationProcedure, + connect.WithSchema(spaceServiceMethods.ByName("DeclineSpaceInvitation")), + connect.WithClientOptions(opts...), + ), } } // spaceServiceClient implements SpaceServiceClient. type spaceServiceClient struct { - createSpace *connect.Client[v1.CreateSpaceRequest, v1.Space] - listSpaces *connect.Client[v1.ListSpacesRequest, v1.ListSpacesResponse] - getSpace *connect.Client[v1.GetSpaceRequest, v1.Space] - updateSpace *connect.Client[v1.UpdateSpaceRequest, v1.Space] - deleteSpace *connect.Client[v1.DeleteSpaceRequest, emptypb.Empty] - createSpaceInvitation *connect.Client[v1.CreateSpaceInvitationRequest, v1.SpaceInvitation] - listSpaceInvitations *connect.Client[v1.ListSpaceInvitationsRequest, v1.ListSpaceInvitationsResponse] - listUserSpaceInvitations *connect.Client[v1.ListUserSpaceInvitationsRequest, v1.ListUserSpaceInvitationsResponse] - getSpaceInvitation *connect.Client[v1.GetSpaceInvitationRequest, v1.SpaceInvitation] - deleteSpaceInvitation *connect.Client[v1.DeleteSpaceInvitationRequest, emptypb.Empty] - acceptSpaceInvitation *connect.Client[v1.AcceptSpaceInvitationRequest, v1.SpaceMember] - declineSpaceInvitation *connect.Client[v1.DeclineSpaceInvitationRequest, emptypb.Empty] - listSpaceMembers *connect.Client[v1.ListSpaceMembersRequest, v1.ListSpaceMembersResponse] - getSpaceMember *connect.Client[v1.GetSpaceMemberRequest, v1.SpaceMember] - updateSpaceMember *connect.Client[v1.UpdateSpaceMemberRequest, v1.SpaceMember] - deleteSpaceMember *connect.Client[v1.DeleteSpaceMemberRequest, emptypb.Empty] + listSpaces *connect.Client[api.ListSpacesRequest, api.ListSpacesResponse] + getSpace *connect.Client[api.GetSpaceRequest, api.Space] + createSpace *connect.Client[api.CreateSpaceRequest, api.Space] + updateSpace *connect.Client[api.UpdateSpaceRequest, api.Space] + deleteSpace *connect.Client[api.DeleteSpaceRequest, emptypb.Empty] + listSpaceMembers *connect.Client[api.ListSpaceMembersRequest, api.ListSpaceMembersResponse] + getSpaceMember *connect.Client[api.GetSpaceMemberRequest, api.SpaceMember] + updateSpaceMember *connect.Client[api.UpdateSpaceMemberRequest, api.SpaceMember] + deleteSpaceMember *connect.Client[api.DeleteSpaceMemberRequest, emptypb.Empty] + listSpaceInvitations *connect.Client[api.ListSpaceInvitationsRequest, api.ListSpaceInvitationsResponse] + listUserSpaceInvitations *connect.Client[api.ListUserSpaceInvitationsRequest, api.ListUserSpaceInvitationsResponse] + getSpaceInvitation *connect.Client[api.GetSpaceInvitationRequest, api.SpaceInvitation] + createSpaceInvitation *connect.Client[api.CreateSpaceInvitationRequest, api.SpaceInvitation] + deleteSpaceInvitation *connect.Client[api.DeleteSpaceInvitationRequest, emptypb.Empty] + acceptSpaceInvitation *connect.Client[api.AcceptSpaceInvitationRequest, api.SpaceMember] + declineSpaceInvitation *connect.Client[api.DeclineSpaceInvitationRequest, emptypb.Empty] } -// CreateSpace calls memos.api.v1.SpaceService.CreateSpace. -func (c *spaceServiceClient) CreateSpace(ctx context.Context, req *connect.Request[v1.CreateSpaceRequest]) (*connect.Response[v1.Space], error) { - return c.createSpace.CallUnary(ctx, req) -} - -// ListSpaces calls memos.api.v1.SpaceService.ListSpaces. -func (c *spaceServiceClient) ListSpaces(ctx context.Context, req *connect.Request[v1.ListSpacesRequest]) (*connect.Response[v1.ListSpacesResponse], error) { +// ListSpaces calls memos.api.SpaceService.ListSpaces. +func (c *spaceServiceClient) ListSpaces(ctx context.Context, req *connect.Request[api.ListSpacesRequest]) (*connect.Response[api.ListSpacesResponse], error) { return c.listSpaces.CallUnary(ctx, req) } -// GetSpace calls memos.api.v1.SpaceService.GetSpace. -func (c *spaceServiceClient) GetSpace(ctx context.Context, req *connect.Request[v1.GetSpaceRequest]) (*connect.Response[v1.Space], error) { +// GetSpace calls memos.api.SpaceService.GetSpace. +func (c *spaceServiceClient) GetSpace(ctx context.Context, req *connect.Request[api.GetSpaceRequest]) (*connect.Response[api.Space], error) { return c.getSpace.CallUnary(ctx, req) } -// UpdateSpace calls memos.api.v1.SpaceService.UpdateSpace. -func (c *spaceServiceClient) UpdateSpace(ctx context.Context, req *connect.Request[v1.UpdateSpaceRequest]) (*connect.Response[v1.Space], error) { +// CreateSpace calls memos.api.SpaceService.CreateSpace. +func (c *spaceServiceClient) CreateSpace(ctx context.Context, req *connect.Request[api.CreateSpaceRequest]) (*connect.Response[api.Space], error) { + return c.createSpace.CallUnary(ctx, req) +} + +// UpdateSpace calls memos.api.SpaceService.UpdateSpace. +func (c *spaceServiceClient) UpdateSpace(ctx context.Context, req *connect.Request[api.UpdateSpaceRequest]) (*connect.Response[api.Space], error) { return c.updateSpace.CallUnary(ctx, req) } -// DeleteSpace calls memos.api.v1.SpaceService.DeleteSpace. -func (c *spaceServiceClient) DeleteSpace(ctx context.Context, req *connect.Request[v1.DeleteSpaceRequest]) (*connect.Response[emptypb.Empty], error) { +// DeleteSpace calls memos.api.SpaceService.DeleteSpace. +func (c *spaceServiceClient) DeleteSpace(ctx context.Context, req *connect.Request[api.DeleteSpaceRequest]) (*connect.Response[emptypb.Empty], error) { return c.deleteSpace.CallUnary(ctx, req) } -// CreateSpaceInvitation calls memos.api.v1.SpaceService.CreateSpaceInvitation. -func (c *spaceServiceClient) CreateSpaceInvitation(ctx context.Context, req *connect.Request[v1.CreateSpaceInvitationRequest]) (*connect.Response[v1.SpaceInvitation], error) { - return c.createSpaceInvitation.CallUnary(ctx, req) -} - -// ListSpaceInvitations calls memos.api.v1.SpaceService.ListSpaceInvitations. -func (c *spaceServiceClient) ListSpaceInvitations(ctx context.Context, req *connect.Request[v1.ListSpaceInvitationsRequest]) (*connect.Response[v1.ListSpaceInvitationsResponse], error) { - return c.listSpaceInvitations.CallUnary(ctx, req) -} - -// ListUserSpaceInvitations calls memos.api.v1.SpaceService.ListUserSpaceInvitations. -func (c *spaceServiceClient) ListUserSpaceInvitations(ctx context.Context, req *connect.Request[v1.ListUserSpaceInvitationsRequest]) (*connect.Response[v1.ListUserSpaceInvitationsResponse], error) { - return c.listUserSpaceInvitations.CallUnary(ctx, req) -} - -// GetSpaceInvitation calls memos.api.v1.SpaceService.GetSpaceInvitation. -func (c *spaceServiceClient) GetSpaceInvitation(ctx context.Context, req *connect.Request[v1.GetSpaceInvitationRequest]) (*connect.Response[v1.SpaceInvitation], error) { - return c.getSpaceInvitation.CallUnary(ctx, req) -} - -// DeleteSpaceInvitation calls memos.api.v1.SpaceService.DeleteSpaceInvitation. -func (c *spaceServiceClient) DeleteSpaceInvitation(ctx context.Context, req *connect.Request[v1.DeleteSpaceInvitationRequest]) (*connect.Response[emptypb.Empty], error) { - return c.deleteSpaceInvitation.CallUnary(ctx, req) -} - -// AcceptSpaceInvitation calls memos.api.v1.SpaceService.AcceptSpaceInvitation. -func (c *spaceServiceClient) AcceptSpaceInvitation(ctx context.Context, req *connect.Request[v1.AcceptSpaceInvitationRequest]) (*connect.Response[v1.SpaceMember], error) { - return c.acceptSpaceInvitation.CallUnary(ctx, req) -} - -// DeclineSpaceInvitation calls memos.api.v1.SpaceService.DeclineSpaceInvitation. -func (c *spaceServiceClient) DeclineSpaceInvitation(ctx context.Context, req *connect.Request[v1.DeclineSpaceInvitationRequest]) (*connect.Response[emptypb.Empty], error) { - return c.declineSpaceInvitation.CallUnary(ctx, req) -} - -// ListSpaceMembers calls memos.api.v1.SpaceService.ListSpaceMembers. -func (c *spaceServiceClient) ListSpaceMembers(ctx context.Context, req *connect.Request[v1.ListSpaceMembersRequest]) (*connect.Response[v1.ListSpaceMembersResponse], error) { +// ListSpaceMembers calls memos.api.SpaceService.ListSpaceMembers. +func (c *spaceServiceClient) ListSpaceMembers(ctx context.Context, req *connect.Request[api.ListSpaceMembersRequest]) (*connect.Response[api.ListSpaceMembersResponse], error) { return c.listSpaceMembers.CallUnary(ctx, req) } -// GetSpaceMember calls memos.api.v1.SpaceService.GetSpaceMember. -func (c *spaceServiceClient) GetSpaceMember(ctx context.Context, req *connect.Request[v1.GetSpaceMemberRequest]) (*connect.Response[v1.SpaceMember], error) { +// GetSpaceMember calls memos.api.SpaceService.GetSpaceMember. +func (c *spaceServiceClient) GetSpaceMember(ctx context.Context, req *connect.Request[api.GetSpaceMemberRequest]) (*connect.Response[api.SpaceMember], error) { return c.getSpaceMember.CallUnary(ctx, req) } -// UpdateSpaceMember calls memos.api.v1.SpaceService.UpdateSpaceMember. -func (c *spaceServiceClient) UpdateSpaceMember(ctx context.Context, req *connect.Request[v1.UpdateSpaceMemberRequest]) (*connect.Response[v1.SpaceMember], error) { +// UpdateSpaceMember calls memos.api.SpaceService.UpdateSpaceMember. +func (c *spaceServiceClient) UpdateSpaceMember(ctx context.Context, req *connect.Request[api.UpdateSpaceMemberRequest]) (*connect.Response[api.SpaceMember], error) { return c.updateSpaceMember.CallUnary(ctx, req) } -// DeleteSpaceMember calls memos.api.v1.SpaceService.DeleteSpaceMember. -func (c *spaceServiceClient) DeleteSpaceMember(ctx context.Context, req *connect.Request[v1.DeleteSpaceMemberRequest]) (*connect.Response[emptypb.Empty], error) { +// DeleteSpaceMember calls memos.api.SpaceService.DeleteSpaceMember. +func (c *spaceServiceClient) DeleteSpaceMember(ctx context.Context, req *connect.Request[api.DeleteSpaceMemberRequest]) (*connect.Response[emptypb.Empty], error) { return c.deleteSpaceMember.CallUnary(ctx, req) } -// SpaceServiceHandler is an implementation of the memos.api.v1.SpaceService service. +// ListSpaceInvitations calls memos.api.SpaceService.ListSpaceInvitations. +func (c *spaceServiceClient) ListSpaceInvitations(ctx context.Context, req *connect.Request[api.ListSpaceInvitationsRequest]) (*connect.Response[api.ListSpaceInvitationsResponse], error) { + return c.listSpaceInvitations.CallUnary(ctx, req) +} + +// ListUserSpaceInvitations calls memos.api.SpaceService.ListUserSpaceInvitations. +func (c *spaceServiceClient) ListUserSpaceInvitations(ctx context.Context, req *connect.Request[api.ListUserSpaceInvitationsRequest]) (*connect.Response[api.ListUserSpaceInvitationsResponse], error) { + return c.listUserSpaceInvitations.CallUnary(ctx, req) +} + +// GetSpaceInvitation calls memos.api.SpaceService.GetSpaceInvitation. +func (c *spaceServiceClient) GetSpaceInvitation(ctx context.Context, req *connect.Request[api.GetSpaceInvitationRequest]) (*connect.Response[api.SpaceInvitation], error) { + return c.getSpaceInvitation.CallUnary(ctx, req) +} + +// CreateSpaceInvitation calls memos.api.SpaceService.CreateSpaceInvitation. +func (c *spaceServiceClient) CreateSpaceInvitation(ctx context.Context, req *connect.Request[api.CreateSpaceInvitationRequest]) (*connect.Response[api.SpaceInvitation], error) { + return c.createSpaceInvitation.CallUnary(ctx, req) +} + +// DeleteSpaceInvitation calls memos.api.SpaceService.DeleteSpaceInvitation. +func (c *spaceServiceClient) DeleteSpaceInvitation(ctx context.Context, req *connect.Request[api.DeleteSpaceInvitationRequest]) (*connect.Response[emptypb.Empty], error) { + return c.deleteSpaceInvitation.CallUnary(ctx, req) +} + +// AcceptSpaceInvitation calls memos.api.SpaceService.AcceptSpaceInvitation. +func (c *spaceServiceClient) AcceptSpaceInvitation(ctx context.Context, req *connect.Request[api.AcceptSpaceInvitationRequest]) (*connect.Response[api.SpaceMember], error) { + return c.acceptSpaceInvitation.CallUnary(ctx, req) +} + +// DeclineSpaceInvitation calls memos.api.SpaceService.DeclineSpaceInvitation. +func (c *spaceServiceClient) DeclineSpaceInvitation(ctx context.Context, req *connect.Request[api.DeclineSpaceInvitationRequest]) (*connect.Response[emptypb.Empty], error) { + return c.declineSpaceInvitation.CallUnary(ctx, req) +} + +// SpaceServiceHandler is an implementation of the memos.api.SpaceService service. type SpaceServiceHandler interface { + // ListSpaces lists the spaces of which the authenticated caller is a member. + ListSpaces(context.Context, *connect.Request[api.ListSpacesRequest]) (*connect.Response[api.ListSpacesResponse], error) + // GetSpace gets a space of which the authenticated caller is a member. + // Spaces the caller is not a member of are reported as not found. + GetSpace(context.Context, *connect.Request[api.GetSpaceRequest]) (*connect.Response[api.Space], error) // CreateSpace creates a space and makes the authenticated caller its first // administrator. - CreateSpace(context.Context, *connect.Request[v1.CreateSpaceRequest]) (*connect.Response[v1.Space], error) - // ListSpaces lists spaces of which the authenticated caller is a member. - ListSpaces(context.Context, *connect.Request[v1.ListSpacesRequest]) (*connect.Response[v1.ListSpacesResponse], error) - // GetSpace gets a space of which the authenticated caller is a member. - GetSpace(context.Context, *connect.Request[v1.GetSpaceRequest]) (*connect.Response[v1.Space], error) - // UpdateSpace updates space metadata. - UpdateSpace(context.Context, *connect.Request[v1.UpdateSpaceRequest]) (*connect.Response[v1.Space], error) + CreateSpace(context.Context, *connect.Request[api.CreateSpaceRequest]) (*connect.Response[api.Space], error) + // UpdateSpace updates space metadata. Only a space administrator can update + // a space. + UpdateSpace(context.Context, *connect.Request[api.UpdateSpaceRequest]) (*connect.Response[api.Space], error) // DeleteSpace permanently deletes a space and every memo currently placed - // in it. It never follows memo relations to other memos. - DeleteSpace(context.Context, *connect.Request[v1.DeleteSpaceRequest]) (*connect.Response[emptypb.Empty], error) - // CreateSpaceInvitation invites an existing active user to a space. - CreateSpaceInvitation(context.Context, *connect.Request[v1.CreateSpaceInvitationRequest]) (*connect.Response[v1.SpaceInvitation], error) - // ListSpaceInvitations lists the pending invitations for a space. - ListSpaceInvitations(context.Context, *connect.Request[v1.ListSpaceInvitationsRequest]) (*connect.Response[v1.ListSpaceInvitationsResponse], error) - // ListUserSpaceInvitations lists the authenticated user's pending space invitations. - ListUserSpaceInvitations(context.Context, *connect.Request[v1.ListUserSpaceInvitationsRequest]) (*connect.Response[v1.ListUserSpaceInvitationsResponse], error) - // GetSpaceInvitation gets one pending invitation. - GetSpaceInvitation(context.Context, *connect.Request[v1.GetSpaceInvitationRequest]) (*connect.Response[v1.SpaceInvitation], error) - // DeleteSpaceInvitation revokes a pending invitation. - DeleteSpaceInvitation(context.Context, *connect.Request[v1.DeleteSpaceInvitationRequest]) (*connect.Response[emptypb.Empty], error) - // AcceptSpaceInvitation accepts a pending invitation and creates a membership. - AcceptSpaceInvitation(context.Context, *connect.Request[v1.AcceptSpaceInvitationRequest]) (*connect.Response[v1.SpaceMember], error) - // DeclineSpaceInvitation declines a pending invitation. - DeclineSpaceInvitation(context.Context, *connect.Request[v1.DeclineSpaceInvitationRequest]) (*connect.Response[emptypb.Empty], error) - // ListSpaceMembers lists the members of a space. - ListSpaceMembers(context.Context, *connect.Request[v1.ListSpaceMembersRequest]) (*connect.Response[v1.ListSpaceMembersResponse], error) - // GetSpaceMember gets one membership in a space. - GetSpaceMember(context.Context, *connect.Request[v1.GetSpaceMemberRequest]) (*connect.Response[v1.SpaceMember], error) - // UpdateSpaceMember changes a member's space role. - UpdateSpaceMember(context.Context, *connect.Request[v1.UpdateSpaceMemberRequest]) (*connect.Response[v1.SpaceMember], error) - // DeleteSpaceMember removes a member. A member may delete their own - // membership to leave the space. - DeleteSpaceMember(context.Context, *connect.Request[v1.DeleteSpaceMemberRequest]) (*connect.Response[emptypb.Empty], error) + // in it. It never follows memo relations to other memos. Only a space + // administrator can delete a space. + DeleteSpace(context.Context, *connect.Request[api.DeleteSpaceRequest]) (*connect.Response[emptypb.Empty], error) + // ListSpaceMembers lists the members of a space. The caller must be a member + // of the space. + ListSpaceMembers(context.Context, *connect.Request[api.ListSpaceMembersRequest]) (*connect.Response[api.ListSpaceMembersResponse], error) + // GetSpaceMember gets one membership in a space. The caller must be a member + // of the space. + GetSpaceMember(context.Context, *connect.Request[api.GetSpaceMemberRequest]) (*connect.Response[api.SpaceMember], error) + // UpdateSpaceMember changes a member's space role. Only a space administrator + // can change roles, and a space must keep at least one administrator. + UpdateSpaceMember(context.Context, *connect.Request[api.UpdateSpaceMemberRequest]) (*connect.Response[api.SpaceMember], error) + // DeleteSpaceMember removes a member. A space administrator can remove any + // member, and a member may delete their own membership to leave the space. + // A space must keep at least one administrator. + DeleteSpaceMember(context.Context, *connect.Request[api.DeleteSpaceMemberRequest]) (*connect.Response[emptypb.Empty], error) + // ListSpaceInvitations lists the pending invitations for a space. Only a + // space administrator can list them. + ListSpaceInvitations(context.Context, *connect.Request[api.ListSpaceInvitationsRequest]) (*connect.Response[api.ListSpaceInvitationsResponse], error) + // ListUserSpaceInvitations lists the authenticated user's pending space + // invitations. A user cannot list another user's invitations. + ListUserSpaceInvitations(context.Context, *connect.Request[api.ListUserSpaceInvitationsRequest]) (*connect.Response[api.ListUserSpaceInvitationsResponse], error) + // GetSpaceInvitation gets one pending invitation. Only the invitee or a + // space administrator can get it. + GetSpaceInvitation(context.Context, *connect.Request[api.GetSpaceInvitationRequest]) (*connect.Response[api.SpaceInvitation], error) + // CreateSpaceInvitation invites an existing active user to a space. Only a + // space administrator can invite. The invitee gets no space access until + // they accept. + CreateSpaceInvitation(context.Context, *connect.Request[api.CreateSpaceInvitationRequest]) (*connect.Response[api.SpaceInvitation], error) + // DeleteSpaceInvitation revokes a pending invitation. Only a space + // administrator can revoke it. + DeleteSpaceInvitation(context.Context, *connect.Request[api.DeleteSpaceInvitationRequest]) (*connect.Response[emptypb.Empty], error) + // AcceptSpaceInvitation accepts a pending invitation and creates a + // membership with the invited role. Only the invitee can accept it. + AcceptSpaceInvitation(context.Context, *connect.Request[api.AcceptSpaceInvitationRequest]) (*connect.Response[api.SpaceMember], error) + // DeclineSpaceInvitation declines a pending invitation without creating a + // membership. Only the invitee can decline it. + DeclineSpaceInvitation(context.Context, *connect.Request[api.DeclineSpaceInvitationRequest]) (*connect.Response[emptypb.Empty], error) } // NewSpaceServiceHandler builds an HTTP handler from the service implementation. It returns the @@ -376,13 +406,7 @@ type SpaceServiceHandler interface { // By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf // and JSON codecs. They also support gzip compression. func NewSpaceServiceHandler(svc SpaceServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) { - spaceServiceMethods := v1.File_api_v1_space_service_proto.Services().ByName("SpaceService").Methods() - spaceServiceCreateSpaceHandler := connect.NewUnaryHandler( - SpaceServiceCreateSpaceProcedure, - svc.CreateSpace, - connect.WithSchema(spaceServiceMethods.ByName("CreateSpace")), - connect.WithHandlerOptions(opts...), - ) + spaceServiceMethods := api.File_api_space_service_proto.Services().ByName("SpaceService").Methods() spaceServiceListSpacesHandler := connect.NewUnaryHandler( SpaceServiceListSpacesProcedure, svc.ListSpaces, @@ -395,6 +419,12 @@ func NewSpaceServiceHandler(svc SpaceServiceHandler, opts ...connect.HandlerOpti connect.WithSchema(spaceServiceMethods.ByName("GetSpace")), connect.WithHandlerOptions(opts...), ) + spaceServiceCreateSpaceHandler := connect.NewUnaryHandler( + SpaceServiceCreateSpaceProcedure, + svc.CreateSpace, + connect.WithSchema(spaceServiceMethods.ByName("CreateSpace")), + connect.WithHandlerOptions(opts...), + ) spaceServiceUpdateSpaceHandler := connect.NewUnaryHandler( SpaceServiceUpdateSpaceProcedure, svc.UpdateSpace, @@ -407,48 +437,6 @@ func NewSpaceServiceHandler(svc SpaceServiceHandler, opts ...connect.HandlerOpti connect.WithSchema(spaceServiceMethods.ByName("DeleteSpace")), connect.WithHandlerOptions(opts...), ) - spaceServiceCreateSpaceInvitationHandler := connect.NewUnaryHandler( - SpaceServiceCreateSpaceInvitationProcedure, - svc.CreateSpaceInvitation, - connect.WithSchema(spaceServiceMethods.ByName("CreateSpaceInvitation")), - connect.WithHandlerOptions(opts...), - ) - spaceServiceListSpaceInvitationsHandler := connect.NewUnaryHandler( - SpaceServiceListSpaceInvitationsProcedure, - svc.ListSpaceInvitations, - connect.WithSchema(spaceServiceMethods.ByName("ListSpaceInvitations")), - connect.WithHandlerOptions(opts...), - ) - spaceServiceListUserSpaceInvitationsHandler := connect.NewUnaryHandler( - SpaceServiceListUserSpaceInvitationsProcedure, - svc.ListUserSpaceInvitations, - connect.WithSchema(spaceServiceMethods.ByName("ListUserSpaceInvitations")), - connect.WithHandlerOptions(opts...), - ) - spaceServiceGetSpaceInvitationHandler := connect.NewUnaryHandler( - SpaceServiceGetSpaceInvitationProcedure, - svc.GetSpaceInvitation, - connect.WithSchema(spaceServiceMethods.ByName("GetSpaceInvitation")), - connect.WithHandlerOptions(opts...), - ) - spaceServiceDeleteSpaceInvitationHandler := connect.NewUnaryHandler( - SpaceServiceDeleteSpaceInvitationProcedure, - svc.DeleteSpaceInvitation, - connect.WithSchema(spaceServiceMethods.ByName("DeleteSpaceInvitation")), - connect.WithHandlerOptions(opts...), - ) - spaceServiceAcceptSpaceInvitationHandler := connect.NewUnaryHandler( - SpaceServiceAcceptSpaceInvitationProcedure, - svc.AcceptSpaceInvitation, - connect.WithSchema(spaceServiceMethods.ByName("AcceptSpaceInvitation")), - connect.WithHandlerOptions(opts...), - ) - spaceServiceDeclineSpaceInvitationHandler := connect.NewUnaryHandler( - SpaceServiceDeclineSpaceInvitationProcedure, - svc.DeclineSpaceInvitation, - connect.WithSchema(spaceServiceMethods.ByName("DeclineSpaceInvitation")), - connect.WithHandlerOptions(opts...), - ) spaceServiceListSpaceMembersHandler := connect.NewUnaryHandler( SpaceServiceListSpaceMembersProcedure, svc.ListSpaceMembers, @@ -473,32 +461,60 @@ func NewSpaceServiceHandler(svc SpaceServiceHandler, opts ...connect.HandlerOpti connect.WithSchema(spaceServiceMethods.ByName("DeleteSpaceMember")), connect.WithHandlerOptions(opts...), ) - return "/memos.api.v1.SpaceService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + spaceServiceListSpaceInvitationsHandler := connect.NewUnaryHandler( + SpaceServiceListSpaceInvitationsProcedure, + svc.ListSpaceInvitations, + connect.WithSchema(spaceServiceMethods.ByName("ListSpaceInvitations")), + connect.WithHandlerOptions(opts...), + ) + spaceServiceListUserSpaceInvitationsHandler := connect.NewUnaryHandler( + SpaceServiceListUserSpaceInvitationsProcedure, + svc.ListUserSpaceInvitations, + connect.WithSchema(spaceServiceMethods.ByName("ListUserSpaceInvitations")), + connect.WithHandlerOptions(opts...), + ) + spaceServiceGetSpaceInvitationHandler := connect.NewUnaryHandler( + SpaceServiceGetSpaceInvitationProcedure, + svc.GetSpaceInvitation, + connect.WithSchema(spaceServiceMethods.ByName("GetSpaceInvitation")), + connect.WithHandlerOptions(opts...), + ) + spaceServiceCreateSpaceInvitationHandler := connect.NewUnaryHandler( + SpaceServiceCreateSpaceInvitationProcedure, + svc.CreateSpaceInvitation, + connect.WithSchema(spaceServiceMethods.ByName("CreateSpaceInvitation")), + connect.WithHandlerOptions(opts...), + ) + spaceServiceDeleteSpaceInvitationHandler := connect.NewUnaryHandler( + SpaceServiceDeleteSpaceInvitationProcedure, + svc.DeleteSpaceInvitation, + connect.WithSchema(spaceServiceMethods.ByName("DeleteSpaceInvitation")), + connect.WithHandlerOptions(opts...), + ) + spaceServiceAcceptSpaceInvitationHandler := connect.NewUnaryHandler( + SpaceServiceAcceptSpaceInvitationProcedure, + svc.AcceptSpaceInvitation, + connect.WithSchema(spaceServiceMethods.ByName("AcceptSpaceInvitation")), + connect.WithHandlerOptions(opts...), + ) + spaceServiceDeclineSpaceInvitationHandler := connect.NewUnaryHandler( + SpaceServiceDeclineSpaceInvitationProcedure, + svc.DeclineSpaceInvitation, + connect.WithSchema(spaceServiceMethods.ByName("DeclineSpaceInvitation")), + connect.WithHandlerOptions(opts...), + ) + return "/memos.api.SpaceService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { switch r.URL.Path { - case SpaceServiceCreateSpaceProcedure: - spaceServiceCreateSpaceHandler.ServeHTTP(w, r) case SpaceServiceListSpacesProcedure: spaceServiceListSpacesHandler.ServeHTTP(w, r) case SpaceServiceGetSpaceProcedure: spaceServiceGetSpaceHandler.ServeHTTP(w, r) + case SpaceServiceCreateSpaceProcedure: + spaceServiceCreateSpaceHandler.ServeHTTP(w, r) case SpaceServiceUpdateSpaceProcedure: spaceServiceUpdateSpaceHandler.ServeHTTP(w, r) case SpaceServiceDeleteSpaceProcedure: spaceServiceDeleteSpaceHandler.ServeHTTP(w, r) - case SpaceServiceCreateSpaceInvitationProcedure: - spaceServiceCreateSpaceInvitationHandler.ServeHTTP(w, r) - case SpaceServiceListSpaceInvitationsProcedure: - spaceServiceListSpaceInvitationsHandler.ServeHTTP(w, r) - case SpaceServiceListUserSpaceInvitationsProcedure: - spaceServiceListUserSpaceInvitationsHandler.ServeHTTP(w, r) - case SpaceServiceGetSpaceInvitationProcedure: - spaceServiceGetSpaceInvitationHandler.ServeHTTP(w, r) - case SpaceServiceDeleteSpaceInvitationProcedure: - spaceServiceDeleteSpaceInvitationHandler.ServeHTTP(w, r) - case SpaceServiceAcceptSpaceInvitationProcedure: - spaceServiceAcceptSpaceInvitationHandler.ServeHTTP(w, r) - case SpaceServiceDeclineSpaceInvitationProcedure: - spaceServiceDeclineSpaceInvitationHandler.ServeHTTP(w, r) case SpaceServiceListSpaceMembersProcedure: spaceServiceListSpaceMembersHandler.ServeHTTP(w, r) case SpaceServiceGetSpaceMemberProcedure: @@ -507,6 +523,20 @@ func NewSpaceServiceHandler(svc SpaceServiceHandler, opts ...connect.HandlerOpti spaceServiceUpdateSpaceMemberHandler.ServeHTTP(w, r) case SpaceServiceDeleteSpaceMemberProcedure: spaceServiceDeleteSpaceMemberHandler.ServeHTTP(w, r) + case SpaceServiceListSpaceInvitationsProcedure: + spaceServiceListSpaceInvitationsHandler.ServeHTTP(w, r) + case SpaceServiceListUserSpaceInvitationsProcedure: + spaceServiceListUserSpaceInvitationsHandler.ServeHTTP(w, r) + case SpaceServiceGetSpaceInvitationProcedure: + spaceServiceGetSpaceInvitationHandler.ServeHTTP(w, r) + case SpaceServiceCreateSpaceInvitationProcedure: + spaceServiceCreateSpaceInvitationHandler.ServeHTTP(w, r) + case SpaceServiceDeleteSpaceInvitationProcedure: + spaceServiceDeleteSpaceInvitationHandler.ServeHTTP(w, r) + case SpaceServiceAcceptSpaceInvitationProcedure: + spaceServiceAcceptSpaceInvitationHandler.ServeHTTP(w, r) + case SpaceServiceDeclineSpaceInvitationProcedure: + spaceServiceDeclineSpaceInvitationHandler.ServeHTTP(w, r) default: http.NotFound(w, r) } @@ -516,66 +546,66 @@ func NewSpaceServiceHandler(svc SpaceServiceHandler, opts ...connect.HandlerOpti // UnimplementedSpaceServiceHandler returns CodeUnimplemented from all methods. type UnimplementedSpaceServiceHandler struct{} -func (UnimplementedSpaceServiceHandler) CreateSpace(context.Context, *connect.Request[v1.CreateSpaceRequest]) (*connect.Response[v1.Space], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.SpaceService.CreateSpace is not implemented")) +func (UnimplementedSpaceServiceHandler) ListSpaces(context.Context, *connect.Request[api.ListSpacesRequest]) (*connect.Response[api.ListSpacesResponse], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.SpaceService.ListSpaces is not implemented")) } -func (UnimplementedSpaceServiceHandler) ListSpaces(context.Context, *connect.Request[v1.ListSpacesRequest]) (*connect.Response[v1.ListSpacesResponse], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.SpaceService.ListSpaces is not implemented")) +func (UnimplementedSpaceServiceHandler) GetSpace(context.Context, *connect.Request[api.GetSpaceRequest]) (*connect.Response[api.Space], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.SpaceService.GetSpace is not implemented")) } -func (UnimplementedSpaceServiceHandler) GetSpace(context.Context, *connect.Request[v1.GetSpaceRequest]) (*connect.Response[v1.Space], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.SpaceService.GetSpace is not implemented")) +func (UnimplementedSpaceServiceHandler) CreateSpace(context.Context, *connect.Request[api.CreateSpaceRequest]) (*connect.Response[api.Space], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.SpaceService.CreateSpace is not implemented")) } -func (UnimplementedSpaceServiceHandler) UpdateSpace(context.Context, *connect.Request[v1.UpdateSpaceRequest]) (*connect.Response[v1.Space], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.SpaceService.UpdateSpace is not implemented")) +func (UnimplementedSpaceServiceHandler) UpdateSpace(context.Context, *connect.Request[api.UpdateSpaceRequest]) (*connect.Response[api.Space], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.SpaceService.UpdateSpace is not implemented")) } -func (UnimplementedSpaceServiceHandler) DeleteSpace(context.Context, *connect.Request[v1.DeleteSpaceRequest]) (*connect.Response[emptypb.Empty], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.SpaceService.DeleteSpace is not implemented")) +func (UnimplementedSpaceServiceHandler) DeleteSpace(context.Context, *connect.Request[api.DeleteSpaceRequest]) (*connect.Response[emptypb.Empty], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.SpaceService.DeleteSpace is not implemented")) } -func (UnimplementedSpaceServiceHandler) CreateSpaceInvitation(context.Context, *connect.Request[v1.CreateSpaceInvitationRequest]) (*connect.Response[v1.SpaceInvitation], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.SpaceService.CreateSpaceInvitation is not implemented")) +func (UnimplementedSpaceServiceHandler) ListSpaceMembers(context.Context, *connect.Request[api.ListSpaceMembersRequest]) (*connect.Response[api.ListSpaceMembersResponse], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.SpaceService.ListSpaceMembers is not implemented")) } -func (UnimplementedSpaceServiceHandler) ListSpaceInvitations(context.Context, *connect.Request[v1.ListSpaceInvitationsRequest]) (*connect.Response[v1.ListSpaceInvitationsResponse], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.SpaceService.ListSpaceInvitations is not implemented")) +func (UnimplementedSpaceServiceHandler) GetSpaceMember(context.Context, *connect.Request[api.GetSpaceMemberRequest]) (*connect.Response[api.SpaceMember], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.SpaceService.GetSpaceMember is not implemented")) } -func (UnimplementedSpaceServiceHandler) ListUserSpaceInvitations(context.Context, *connect.Request[v1.ListUserSpaceInvitationsRequest]) (*connect.Response[v1.ListUserSpaceInvitationsResponse], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.SpaceService.ListUserSpaceInvitations is not implemented")) +func (UnimplementedSpaceServiceHandler) UpdateSpaceMember(context.Context, *connect.Request[api.UpdateSpaceMemberRequest]) (*connect.Response[api.SpaceMember], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.SpaceService.UpdateSpaceMember is not implemented")) } -func (UnimplementedSpaceServiceHandler) GetSpaceInvitation(context.Context, *connect.Request[v1.GetSpaceInvitationRequest]) (*connect.Response[v1.SpaceInvitation], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.SpaceService.GetSpaceInvitation is not implemented")) +func (UnimplementedSpaceServiceHandler) DeleteSpaceMember(context.Context, *connect.Request[api.DeleteSpaceMemberRequest]) (*connect.Response[emptypb.Empty], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.SpaceService.DeleteSpaceMember is not implemented")) } -func (UnimplementedSpaceServiceHandler) DeleteSpaceInvitation(context.Context, *connect.Request[v1.DeleteSpaceInvitationRequest]) (*connect.Response[emptypb.Empty], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.SpaceService.DeleteSpaceInvitation is not implemented")) +func (UnimplementedSpaceServiceHandler) ListSpaceInvitations(context.Context, *connect.Request[api.ListSpaceInvitationsRequest]) (*connect.Response[api.ListSpaceInvitationsResponse], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.SpaceService.ListSpaceInvitations is not implemented")) } -func (UnimplementedSpaceServiceHandler) AcceptSpaceInvitation(context.Context, *connect.Request[v1.AcceptSpaceInvitationRequest]) (*connect.Response[v1.SpaceMember], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.SpaceService.AcceptSpaceInvitation is not implemented")) +func (UnimplementedSpaceServiceHandler) ListUserSpaceInvitations(context.Context, *connect.Request[api.ListUserSpaceInvitationsRequest]) (*connect.Response[api.ListUserSpaceInvitationsResponse], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.SpaceService.ListUserSpaceInvitations is not implemented")) } -func (UnimplementedSpaceServiceHandler) DeclineSpaceInvitation(context.Context, *connect.Request[v1.DeclineSpaceInvitationRequest]) (*connect.Response[emptypb.Empty], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.SpaceService.DeclineSpaceInvitation is not implemented")) +func (UnimplementedSpaceServiceHandler) GetSpaceInvitation(context.Context, *connect.Request[api.GetSpaceInvitationRequest]) (*connect.Response[api.SpaceInvitation], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.SpaceService.GetSpaceInvitation is not implemented")) } -func (UnimplementedSpaceServiceHandler) ListSpaceMembers(context.Context, *connect.Request[v1.ListSpaceMembersRequest]) (*connect.Response[v1.ListSpaceMembersResponse], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.SpaceService.ListSpaceMembers is not implemented")) +func (UnimplementedSpaceServiceHandler) CreateSpaceInvitation(context.Context, *connect.Request[api.CreateSpaceInvitationRequest]) (*connect.Response[api.SpaceInvitation], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.SpaceService.CreateSpaceInvitation is not implemented")) } -func (UnimplementedSpaceServiceHandler) GetSpaceMember(context.Context, *connect.Request[v1.GetSpaceMemberRequest]) (*connect.Response[v1.SpaceMember], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.SpaceService.GetSpaceMember is not implemented")) +func (UnimplementedSpaceServiceHandler) DeleteSpaceInvitation(context.Context, *connect.Request[api.DeleteSpaceInvitationRequest]) (*connect.Response[emptypb.Empty], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.SpaceService.DeleteSpaceInvitation is not implemented")) } -func (UnimplementedSpaceServiceHandler) UpdateSpaceMember(context.Context, *connect.Request[v1.UpdateSpaceMemberRequest]) (*connect.Response[v1.SpaceMember], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.SpaceService.UpdateSpaceMember is not implemented")) +func (UnimplementedSpaceServiceHandler) AcceptSpaceInvitation(context.Context, *connect.Request[api.AcceptSpaceInvitationRequest]) (*connect.Response[api.SpaceMember], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.SpaceService.AcceptSpaceInvitation is not implemented")) } -func (UnimplementedSpaceServiceHandler) DeleteSpaceMember(context.Context, *connect.Request[v1.DeleteSpaceMemberRequest]) (*connect.Response[emptypb.Empty], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.SpaceService.DeleteSpaceMember is not implemented")) +func (UnimplementedSpaceServiceHandler) DeclineSpaceInvitation(context.Context, *connect.Request[api.DeclineSpaceInvitationRequest]) (*connect.Response[emptypb.Empty], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.SpaceService.DeclineSpaceInvitation is not implemented")) } diff --git a/proto/gen/api/apiconnect/user_service.connect.go b/proto/gen/api/apiconnect/user_service.connect.go new file mode 100644 index 000000000..e626bbd5d --- /dev/null +++ b/proto/gen/api/apiconnect/user_service.connect.go @@ -0,0 +1,1175 @@ +// 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" + httpbody "google.golang.org/genproto/googleapis/api/httpbody" + 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" + // 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" + // UserServiceExportMemosProcedure is the fully-qualified name of the UserService's ExportMemos RPC. + UserServiceExportMemosProcedure = "/memos.api.UserService/ExportMemos" + // 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) + // 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) + // ExportMemos writes every memo the user created, with comments, archived + // memos, and attachment files, as a Memos export file (a ZIP file, see + // docs/design/memos-export-format.md). Only the user may export their own + // memos. The body is the archive; content_type is its media type. + ExportMemos(context.Context, *connect.Request[api.ExportMemosRequest]) (*connect.Response[httpbody.HttpBody], 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...), + ), + 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...), + ), + exportMemos: connect.NewClient[api.ExportMemosRequest, httpbody.HttpBody]( + httpClient, + baseURL+UserServiceExportMemosProcedure, + connect.WithSchema(userServiceMethods.ByName("ExportMemos")), + 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] + 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] + exportMemos *connect.Client[api.ExportMemosRequest, httpbody.HttpBody] + 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) +} + +// 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) +} + +// ExportMemos calls memos.api.UserService.ExportMemos. +func (c *userServiceClient) ExportMemos(ctx context.Context, req *connect.Request[api.ExportMemosRequest]) (*connect.Response[httpbody.HttpBody], error) { + return c.exportMemos.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) + // 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) + // ExportMemos writes every memo the user created, with comments, archived + // memos, and attachment files, as a Memos export file (a ZIP file, see + // docs/design/memos-export-format.md). Only the user may export their own + // memos. The body is the archive; content_type is its media type. + ExportMemos(context.Context, *connect.Request[api.ExportMemosRequest]) (*connect.Response[httpbody.HttpBody], 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...), + ) + 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...), + ) + userServiceExportMemosHandler := connect.NewUnaryHandler( + UserServiceExportMemosProcedure, + svc.ExportMemos, + connect.WithSchema(userServiceMethods.ByName("ExportMemos")), + 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 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 UserServiceExportMemosProcedure: + userServiceExportMemosHandler.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) 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) ExportMemos(context.Context, *connect.Request[api.ExportMemosRequest]) (*connect.Response[httpbody.HttpBody], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.UserService.ExportMemos 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")) +} diff --git a/proto/gen/api/v1/attachment_service.pb.go b/proto/gen/api/attachment_service.pb.go similarity index 58% rename from proto/gen/api/v1/attachment_service.pb.go rename to proto/gen/api/attachment_service.pb.go index 9c703c26a..8126f905b 100644 --- a/proto/gen/api/v1/attachment_service.pb.go +++ b/proto/gen/api/attachment_service.pb.go @@ -2,9 +2,9 @@ // versions: // protoc-gen-go v1.36.12 // protoc (unknown) -// source: api/v1/attachment_service.proto +// source: api/attachment_service.proto -package apiv1 +package api import ( _ "google.golang.org/genproto/googleapis/api/annotations" @@ -25,12 +25,15 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) +// MotionMediaFamily is the format of a motion photo. type MotionMediaFamily int32 const ( MotionMediaFamily_MOTION_MEDIA_FAMILY_UNSPECIFIED MotionMediaFamily = 0 - MotionMediaFamily_APPLE_LIVE_PHOTO MotionMediaFamily = 1 - MotionMediaFamily_ANDROID_MOTION_PHOTO MotionMediaFamily = 2 + // An Apple Live Photo: a still image and a video stored as separate attachments. + MotionMediaFamily_APPLE_LIVE_PHOTO MotionMediaFamily = 1 + // An Android motion photo: a JPEG with an embedded video. + MotionMediaFamily_ANDROID_MOTION_PHOTO MotionMediaFamily = 2 ) // Enum value maps for MotionMediaFamily. @@ -58,11 +61,11 @@ func (x MotionMediaFamily) String() string { } func (MotionMediaFamily) Descriptor() protoreflect.EnumDescriptor { - return file_api_v1_attachment_service_proto_enumTypes[0].Descriptor() + return file_api_attachment_service_proto_enumTypes[0].Descriptor() } func (MotionMediaFamily) Type() protoreflect.EnumType { - return &file_api_v1_attachment_service_proto_enumTypes[0] + return &file_api_attachment_service_proto_enumTypes[0] } func (x MotionMediaFamily) Number() protoreflect.EnumNumber { @@ -71,16 +74,20 @@ func (x MotionMediaFamily) Number() protoreflect.EnumNumber { // Deprecated: Use MotionMediaFamily.Descriptor instead. func (MotionMediaFamily) EnumDescriptor() ([]byte, []int) { - return file_api_v1_attachment_service_proto_rawDescGZIP(), []int{0} + return file_api_attachment_service_proto_rawDescGZIP(), []int{0} } +// MotionMediaRole is the part an attachment plays in a motion photo. type MotionMediaRole int32 const ( MotionMediaRole_MOTION_MEDIA_ROLE_UNSPECIFIED MotionMediaRole = 0 - MotionMediaRole_STILL MotionMediaRole = 1 - MotionMediaRole_VIDEO MotionMediaRole = 2 - MotionMediaRole_CONTAINER MotionMediaRole = 3 + // The still image of an Apple Live Photo. + MotionMediaRole_STILL MotionMediaRole = 1 + // The video of an Apple Live Photo. + MotionMediaRole_VIDEO MotionMediaRole = 2 + // A single file holding both the still image and the video. + MotionMediaRole_CONTAINER MotionMediaRole = 3 ) // Enum value maps for MotionMediaRole. @@ -110,11 +117,11 @@ func (x MotionMediaRole) String() string { } func (MotionMediaRole) Descriptor() protoreflect.EnumDescriptor { - return file_api_v1_attachment_service_proto_enumTypes[1].Descriptor() + return file_api_attachment_service_proto_enumTypes[1].Descriptor() } func (MotionMediaRole) Type() protoreflect.EnumType { - return &file_api_v1_attachment_service_proto_enumTypes[1] + return &file_api_attachment_service_proto_enumTypes[1] } func (x MotionMediaRole) Number() protoreflect.EnumNumber { @@ -123,23 +130,815 @@ func (x MotionMediaRole) Number() protoreflect.EnumNumber { // Deprecated: Use MotionMediaRole.Descriptor instead. func (MotionMediaRole) EnumDescriptor() ([]byte, []int) { - return file_api_v1_attachment_service_proto_rawDescGZIP(), []int{1} + return file_api_attachment_service_proto_rawDescGZIP(), []int{1} } +// Attachment is a file uploaded by a user, optionally linked to a memo. +type Attachment struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Identifier. The resource name of the attachment. + // Format: attachments/{attachment} + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // Output only. The user who uploaded the attachment, which may differ from the creator of the linked memo. + // Format: users/{user} + Creator string `protobuf:"bytes,2,opt,name=creator,proto3" json:"creator,omitempty"` + // Required. The filename of the attachment. + Filename string `protobuf:"bytes,3,opt,name=filename,proto3" json:"filename,omitempty"` + // Required. The MIME type of the attachment. If empty on create, the service detects it from the filename and + // content. + Type string `protobuf:"bytes,4,opt,name=type,proto3" json:"type,omitempty"` + // Input only. The content of the attachment. + Content []byte `protobuf:"bytes,5,opt,name=content,proto3" json:"content,omitempty"` + // Optional. The external link of the attachment. Set only for externally stored attachments; ignored on create. + ExternalLink string `protobuf:"bytes,6,opt,name=external_link,json=externalLink,proto3" json:"external_link,omitempty"` + // Optional. Motion photo metadata. Clients may only supply Apple Live Photo metadata; the service detects Android + // motion photos in JPEG content. + MotionMedia *MotionMedia `protobuf:"bytes,7,opt,name=motion_media,json=motionMedia,proto3" json:"motion_media,omitempty"` + // Optional. Normalized media metadata supplied by the client at creation time. Immutable after creation. + MediaMetadata *MediaMetadata `protobuf:"bytes,8,opt,name=media_metadata,json=mediaMetadata,proto3" json:"media_metadata,omitempty"` + // Optional. The memo the attachment is linked to. On create, the caller must be able to manage the memo. + // Format: memos/{memo} + Memo *string `protobuf:"bytes,9,opt,name=memo,proto3,oneof" json:"memo,omitempty"` + // Output only. The size of the stored content in bytes. + Size int64 `protobuf:"varint,10,opt,name=size,proto3" json:"size,omitempty"` + // Output only. The creation time. + CreateTime *timestamppb.Timestamp `protobuf:"bytes,11,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Attachment) Reset() { + *x = Attachment{} + mi := &file_api_attachment_service_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Attachment) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Attachment) ProtoMessage() {} + +func (x *Attachment) ProtoReflect() protoreflect.Message { + mi := &file_api_attachment_service_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Attachment.ProtoReflect.Descriptor instead. +func (*Attachment) Descriptor() ([]byte, []int) { + return file_api_attachment_service_proto_rawDescGZIP(), []int{0} +} + +func (x *Attachment) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Attachment) GetCreator() string { + if x != nil { + return x.Creator + } + return "" +} + +func (x *Attachment) GetFilename() string { + if x != nil { + return x.Filename + } + return "" +} + +func (x *Attachment) GetType() string { + if x != nil { + return x.Type + } + return "" +} + +func (x *Attachment) GetContent() []byte { + if x != nil { + return x.Content + } + return nil +} + +func (x *Attachment) GetExternalLink() string { + if x != nil { + return x.ExternalLink + } + return "" +} + +func (x *Attachment) GetMotionMedia() *MotionMedia { + if x != nil { + return x.MotionMedia + } + return nil +} + +func (x *Attachment) GetMediaMetadata() *MediaMetadata { + if x != nil { + return x.MediaMetadata + } + return nil +} + +func (x *Attachment) GetMemo() string { + if x != nil && x.Memo != nil { + return *x.Memo + } + return "" +} + +func (x *Attachment) GetSize() int64 { + if x != nil { + return x.Size + } + return 0 +} + +func (x *Attachment) GetCreateTime() *timestamppb.Timestamp { + if x != nil { + return x.CreateTime + } + return nil +} + +// Request message for AttachmentService.ListAttachments. +type ListAttachmentsRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Optional. The maximum number of attachments to return. The service may return fewer. + // If unspecified, at most 50 attachments are returned. Values above 1000 are coerced to 1000. + PageSize int32 `protobuf:"varint,1,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + // Optional. A page token from a previous call. Provide it to retrieve the next page. + PageToken string `protobuf:"bytes,2,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` + // Optional. A CEL filter over the results. + // Example: `mime_type == "image/png"` or `filename.contains("test")`. + // Supported operators: ==, !=, <, <=, >, >=, : (contains), in. + // Supported fields: creator, filename, mime_type, create_time, memo_id, space. + // `creator` is the linked memo's creator, or the uploader for an unlinked attachment. It supports equality with a + // User resource name. + // `space` is the linked memo's Space resource name, or null when the attachment is unlinked or its memo has no + // space. It supports only a non-negated `==` comparison with a Space resource name or null. + Filter string `protobuf:"bytes,3,opt,name=filter,proto3" json:"filter,omitempty"` + // Optional. The order to sort results by, such as "create_time desc" or "filename asc". The service does not apply + // it yet. + OrderBy string `protobuf:"bytes,4,opt,name=order_by,json=orderBy,proto3" json:"order_by,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListAttachmentsRequest) Reset() { + *x = ListAttachmentsRequest{} + mi := &file_api_attachment_service_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListAttachmentsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListAttachmentsRequest) ProtoMessage() {} + +func (x *ListAttachmentsRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_attachment_service_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListAttachmentsRequest.ProtoReflect.Descriptor instead. +func (*ListAttachmentsRequest) Descriptor() ([]byte, []int) { + return file_api_attachment_service_proto_rawDescGZIP(), []int{1} +} + +func (x *ListAttachmentsRequest) GetPageSize() int32 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *ListAttachmentsRequest) GetPageToken() string { + if x != nil { + return x.PageToken + } + return "" +} + +func (x *ListAttachmentsRequest) GetFilter() string { + if x != nil { + return x.Filter + } + return "" +} + +func (x *ListAttachmentsRequest) GetOrderBy() string { + if x != nil { + return x.OrderBy + } + return "" +} + +// Response message for AttachmentService.ListAttachments. +type ListAttachmentsResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The attachments. + Attachments []*Attachment `protobuf:"bytes,1,rep,name=attachments,proto3" json:"attachments,omitempty"` + // A token to retrieve the next page. Empty when there are no more pages. + NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListAttachmentsResponse) Reset() { + *x = ListAttachmentsResponse{} + mi := &file_api_attachment_service_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListAttachmentsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListAttachmentsResponse) ProtoMessage() {} + +func (x *ListAttachmentsResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_attachment_service_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListAttachmentsResponse.ProtoReflect.Descriptor instead. +func (*ListAttachmentsResponse) Descriptor() ([]byte, []int) { + return file_api_attachment_service_proto_rawDescGZIP(), []int{2} +} + +func (x *ListAttachmentsResponse) GetAttachments() []*Attachment { + if x != nil { + return x.Attachments + } + return nil +} + +func (x *ListAttachmentsResponse) GetNextPageToken() string { + if x != nil { + return x.NextPageToken + } + return "" +} + +// Request message for AttachmentService.GetAttachment. +type GetAttachmentRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Required. The name of the attachment to get. + // Format: attachments/{attachment} + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetAttachmentRequest) Reset() { + *x = GetAttachmentRequest{} + mi := &file_api_attachment_service_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetAttachmentRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetAttachmentRequest) ProtoMessage() {} + +func (x *GetAttachmentRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_attachment_service_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetAttachmentRequest.ProtoReflect.Descriptor instead. +func (*GetAttachmentRequest) Descriptor() ([]byte, []int) { + return file_api_attachment_service_proto_rawDescGZIP(), []int{3} +} + +func (x *GetAttachmentRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +// Request message for AttachmentService.CreateAttachment. +type CreateAttachmentRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Required. The attachment to create. + Attachment *Attachment `protobuf:"bytes,1,opt,name=attachment,proto3" json:"attachment,omitempty"` + // Optional. The ID to use for the attachment. If empty, a unique ID is generated. + // Format: ^[a-zA-Z0-9]([a-zA-Z0-9-]{0,34}[a-zA-Z0-9])?$ + AttachmentId string `protobuf:"bytes,2,opt,name=attachment_id,json=attachmentId,proto3" json:"attachment_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateAttachmentRequest) Reset() { + *x = CreateAttachmentRequest{} + mi := &file_api_attachment_service_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateAttachmentRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateAttachmentRequest) ProtoMessage() {} + +func (x *CreateAttachmentRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_attachment_service_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateAttachmentRequest.ProtoReflect.Descriptor instead. +func (*CreateAttachmentRequest) Descriptor() ([]byte, []int) { + return file_api_attachment_service_proto_rawDescGZIP(), []int{4} +} + +func (x *CreateAttachmentRequest) GetAttachment() *Attachment { + if x != nil { + return x.Attachment + } + return nil +} + +func (x *CreateAttachmentRequest) GetAttachmentId() string { + if x != nil { + return x.AttachmentId + } + return "" +} + +// Request message for AttachmentService.UpdateAttachment. +type UpdateAttachmentRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Required. The attachment to update. Its `name` identifies the attachment. + Attachment *Attachment `protobuf:"bytes,1,opt,name=attachment,proto3" json:"attachment,omitempty"` + // Required. The fields to update. Only `filename` is supported. + UpdateMask *fieldmaskpb.FieldMask `protobuf:"bytes,2,opt,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UpdateAttachmentRequest) Reset() { + *x = UpdateAttachmentRequest{} + mi := &file_api_attachment_service_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UpdateAttachmentRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateAttachmentRequest) ProtoMessage() {} + +func (x *UpdateAttachmentRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_attachment_service_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateAttachmentRequest.ProtoReflect.Descriptor instead. +func (*UpdateAttachmentRequest) Descriptor() ([]byte, []int) { + return file_api_attachment_service_proto_rawDescGZIP(), []int{5} +} + +func (x *UpdateAttachmentRequest) GetAttachment() *Attachment { + if x != nil { + return x.Attachment + } + return nil +} + +func (x *UpdateAttachmentRequest) GetUpdateMask() *fieldmaskpb.FieldMask { + if x != nil { + return x.UpdateMask + } + return nil +} + +// Request message for AttachmentService.DeleteAttachment. +type DeleteAttachmentRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Required. The name of the attachment to delete. + // Format: attachments/{attachment} + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteAttachmentRequest) Reset() { + *x = DeleteAttachmentRequest{} + mi := &file_api_attachment_service_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteAttachmentRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteAttachmentRequest) ProtoMessage() {} + +func (x *DeleteAttachmentRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_attachment_service_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteAttachmentRequest.ProtoReflect.Descriptor instead. +func (*DeleteAttachmentRequest) Descriptor() ([]byte, []int) { + return file_api_attachment_service_proto_rawDescGZIP(), []int{6} +} + +func (x *DeleteAttachmentRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +// Request message for AttachmentService.BatchDeleteAttachments. +type BatchDeleteAttachmentsRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Required. The names of the attachments to delete, at most 100. Duplicate names are ignored. + // Format: attachments/{attachment} + Names []string `protobuf:"bytes,1,rep,name=names,proto3" json:"names,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *BatchDeleteAttachmentsRequest) Reset() { + *x = BatchDeleteAttachmentsRequest{} + mi := &file_api_attachment_service_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *BatchDeleteAttachmentsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BatchDeleteAttachmentsRequest) ProtoMessage() {} + +func (x *BatchDeleteAttachmentsRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_attachment_service_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BatchDeleteAttachmentsRequest.ProtoReflect.Descriptor instead. +func (*BatchDeleteAttachmentsRequest) Descriptor() ([]byte, []int) { + return file_api_attachment_service_proto_rawDescGZIP(), []int{7} +} + +func (x *BatchDeleteAttachmentsRequest) GetNames() []string { + if x != nil { + return x.Names + } + return nil +} + +// Request message for AttachmentService.UploadAttachment. +type UploadAttachmentRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Starts a new upload or continues an existing one. Exactly one must be set. + // + // Types that are valid to be assigned to Upload: + // + // *UploadAttachmentRequest_Spec + // *UploadAttachmentRequest_UploadId + Upload isUploadAttachmentRequest_Upload `protobuf_oneof:"upload"` + // Required. Zero-based byte offset at which data is written. Must equal the committed size, except when retrying + // the most recently accepted chunk with identical bytes and offset, which is accepted without writing again. + WriteOffset int64 `protobuf:"varint,3,opt,name=write_offset,json=writeOffset,proto3" json:"write_offset,omitempty"` + // Optional. File bytes, at most max_chunk_size long. With no data and finish_write false, the call reports + // progress without writing, and write_offset is ignored. + Data []byte `protobuf:"bytes,4,opt,name=data,proto3" json:"data,omitempty"` + // Optional. Finalize the upload after writing data. The committed size must then equal total_size. Any later call + // for the same upload_id returns the created attachment. + FinishWrite bool `protobuf:"varint,5,opt,name=finish_write,json=finishWrite,proto3" json:"finish_write,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UploadAttachmentRequest) Reset() { + *x = UploadAttachmentRequest{} + mi := &file_api_attachment_service_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UploadAttachmentRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UploadAttachmentRequest) ProtoMessage() {} + +func (x *UploadAttachmentRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_attachment_service_proto_msgTypes[8] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UploadAttachmentRequest.ProtoReflect.Descriptor instead. +func (*UploadAttachmentRequest) Descriptor() ([]byte, []int) { + return file_api_attachment_service_proto_rawDescGZIP(), []int{8} +} + +func (x *UploadAttachmentRequest) GetUpload() isUploadAttachmentRequest_Upload { + if x != nil { + return x.Upload + } + return nil +} + +func (x *UploadAttachmentRequest) GetSpec() *UploadAttachmentSpec { + if x != nil { + if x, ok := x.Upload.(*UploadAttachmentRequest_Spec); ok { + return x.Spec + } + } + return nil +} + +func (x *UploadAttachmentRequest) GetUploadId() string { + if x != nil { + if x, ok := x.Upload.(*UploadAttachmentRequest_UploadId); ok { + return x.UploadId + } + } + return "" +} + +func (x *UploadAttachmentRequest) GetWriteOffset() int64 { + if x != nil { + return x.WriteOffset + } + return 0 +} + +func (x *UploadAttachmentRequest) GetData() []byte { + if x != nil { + return x.Data + } + return nil +} + +func (x *UploadAttachmentRequest) GetFinishWrite() bool { + if x != nil { + return x.FinishWrite + } + return false +} + +type isUploadAttachmentRequest_Upload interface { + isUploadAttachmentRequest_Upload() +} + +type UploadAttachmentRequest_Spec struct { + // Starts a new upload. The same call may also carry data and finish_write. + Spec *UploadAttachmentSpec `protobuf:"bytes,1,opt,name=spec,proto3,oneof"` +} + +type UploadAttachmentRequest_UploadId struct { + // Continues the upload identified by a previous response. + UploadId string `protobuf:"bytes,2,opt,name=upload_id,json=uploadId,proto3,oneof"` +} + +func (*UploadAttachmentRequest_Spec) isUploadAttachmentRequest_Upload() {} + +func (*UploadAttachmentRequest_UploadId) isUploadAttachmentRequest_Upload() {} + +// Response message for AttachmentService.UploadAttachment. +type UploadAttachmentResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Opaque ID for subsequent calls. This is not a resource name. + UploadId string `protobuf:"bytes,1,opt,name=upload_id,json=uploadId,proto3" json:"upload_id,omitempty"` + // Number of file bytes committed so far. + CommittedSize int64 `protobuf:"varint,2,opt,name=committed_size,json=committedSize,proto3" json:"committed_size,omitempty"` + // Maximum number of data bytes accepted in one call. + MaxChunkSize int32 `protobuf:"varint,3,opt,name=max_chunk_size,json=maxChunkSize,proto3" json:"max_chunk_size,omitempty"` + // The created attachment. Set once the upload has been finalized. + Attachment *Attachment `protobuf:"bytes,4,opt,name=attachment,proto3" json:"attachment,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UploadAttachmentResponse) Reset() { + *x = UploadAttachmentResponse{} + mi := &file_api_attachment_service_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UploadAttachmentResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UploadAttachmentResponse) ProtoMessage() {} + +func (x *UploadAttachmentResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_attachment_service_proto_msgTypes[9] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UploadAttachmentResponse.ProtoReflect.Descriptor instead. +func (*UploadAttachmentResponse) Descriptor() ([]byte, []int) { + return file_api_attachment_service_proto_rawDescGZIP(), []int{9} +} + +func (x *UploadAttachmentResponse) GetUploadId() string { + if x != nil { + return x.UploadId + } + return "" +} + +func (x *UploadAttachmentResponse) GetCommittedSize() int64 { + if x != nil { + return x.CommittedSize + } + return 0 +} + +func (x *UploadAttachmentResponse) GetMaxChunkSize() int32 { + if x != nil { + return x.MaxChunkSize + } + return 0 +} + +func (x *UploadAttachmentResponse) GetAttachment() *Attachment { + if x != nil { + return x.Attachment + } + return nil +} + +// UploadAttachmentSpec describes the attachment that a new upload creates. +type UploadAttachmentSpec struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Required. Metadata for the attachment to create. content must be empty; file bytes are sent in data. + Attachment *Attachment `protobuf:"bytes,1,opt,name=attachment,proto3" json:"attachment,omitempty"` + // Optional. The ID to use for the attachment. If empty, a unique ID is generated. + // Format: ^[a-zA-Z0-9]([a-zA-Z0-9-]{0,34}[a-zA-Z0-9])?$ + AttachmentId string `protobuf:"bytes,2,opt,name=attachment_id,json=attachmentId,proto3" json:"attachment_id,omitempty"` + // Optional. Total size of the file in bytes before media processing. Zero represents an empty file. + TotalSize int64 `protobuf:"varint,3,opt,name=total_size,json=totalSize,proto3" json:"total_size,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UploadAttachmentSpec) Reset() { + *x = UploadAttachmentSpec{} + mi := &file_api_attachment_service_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UploadAttachmentSpec) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UploadAttachmentSpec) ProtoMessage() {} + +func (x *UploadAttachmentSpec) ProtoReflect() protoreflect.Message { + mi := &file_api_attachment_service_proto_msgTypes[10] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UploadAttachmentSpec.ProtoReflect.Descriptor instead. +func (*UploadAttachmentSpec) Descriptor() ([]byte, []int) { + return file_api_attachment_service_proto_rawDescGZIP(), []int{10} +} + +func (x *UploadAttachmentSpec) GetAttachment() *Attachment { + if x != nil { + return x.Attachment + } + return nil +} + +func (x *UploadAttachmentSpec) GetAttachmentId() string { + if x != nil { + return x.AttachmentId + } + return "" +} + +func (x *UploadAttachmentSpec) GetTotalSize() int64 { + if x != nil { + return x.TotalSize + } + return 0 +} + +// MotionMedia links the parts of a motion photo. type MotionMedia struct { - state protoimpl.MessageState `protogen:"open.v1"` - Family MotionMediaFamily `protobuf:"varint,1,opt,name=family,proto3,enum=memos.api.v1.MotionMediaFamily" json:"family,omitempty"` - Role MotionMediaRole `protobuf:"varint,2,opt,name=role,proto3,enum=memos.api.v1.MotionMediaRole" json:"role,omitempty"` - GroupId string `protobuf:"bytes,3,opt,name=group_id,json=groupId,proto3" json:"group_id,omitempty"` - PresentationTimestampUs int64 `protobuf:"varint,4,opt,name=presentation_timestamp_us,json=presentationTimestampUs,proto3" json:"presentation_timestamp_us,omitempty"` - HasEmbeddedVideo bool `protobuf:"varint,5,opt,name=has_embedded_video,json=hasEmbeddedVideo,proto3" json:"has_embedded_video,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + // The motion photo format. + Family MotionMediaFamily `protobuf:"varint,1,opt,name=family,proto3,enum=memos.api.MotionMediaFamily" json:"family,omitempty"` + // The part this attachment plays in the motion photo. + Role MotionMediaRole `protobuf:"varint,2,opt,name=role,proto3,enum=memos.api.MotionMediaRole" json:"role,omitempty"` + // Groups the attachments that belong to one motion photo. Required for client-supplied Apple Live Photo metadata; + // for an Android motion photo it is the attachment's own ID. + GroupId string `protobuf:"bytes,3,opt,name=group_id,json=groupId,proto3" json:"group_id,omitempty"` + // Presentation timestamp of the still frame within the video, in microseconds. + PresentationTimestampUs int64 `protobuf:"varint,4,opt,name=presentation_timestamp_us,json=presentationTimestampUs,proto3" json:"presentation_timestamp_us,omitempty"` + // Whether the file embeds the motion video, as in an Android motion photo container. + HasEmbeddedVideo bool `protobuf:"varint,5,opt,name=has_embedded_video,json=hasEmbeddedVideo,proto3" json:"has_embedded_video,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *MotionMedia) Reset() { *x = MotionMedia{} - mi := &file_api_v1_attachment_service_proto_msgTypes[0] + mi := &file_api_attachment_service_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -151,7 +950,7 @@ func (x *MotionMedia) String() string { func (*MotionMedia) ProtoMessage() {} func (x *MotionMedia) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_attachment_service_proto_msgTypes[0] + mi := &file_api_attachment_service_proto_msgTypes[11] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -164,7 +963,7 @@ func (x *MotionMedia) ProtoReflect() protoreflect.Message { // Deprecated: Use MotionMedia.ProtoReflect.Descriptor instead. func (*MotionMedia) Descriptor() ([]byte, []int) { - return file_api_v1_attachment_service_proto_rawDescGZIP(), []int{0} + return file_api_attachment_service_proto_rawDescGZIP(), []int{11} } func (x *MotionMedia) GetFamily() MotionMediaFamily { @@ -203,13 +1002,15 @@ func (x *MotionMedia) GetHasEmbeddedVideo() bool { } // MediaMetadata contains normalized metadata explicitly supplied by a client. -// The server validates and stores this data but does not extract it from the media file. +// The service validates and stores this data but does not extract it from the media file. type MediaMetadata struct { state protoimpl.MessageState `protogen:"open.v1"` - // Optional. Display-oriented width in pixels. + // Display-oriented width in pixels. Must be provided with height. Width *int32 `protobuf:"varint,1,opt,name=width,proto3,oneof" json:"width,omitempty"` - // Optional. Display-oriented height in pixels. + // Display-oriented height in pixels. Must be provided with width. Height *int32 `protobuf:"varint,2,opt,name=height,proto3,oneof" json:"height,omitempty"` + // Type-specific metadata. Must match the attachment's MIME type. + // // Types that are valid to be assigned to Details: // // *MediaMetadata_Photo @@ -221,7 +1022,7 @@ type MediaMetadata struct { func (x *MediaMetadata) Reset() { *x = MediaMetadata{} - mi := &file_api_v1_attachment_service_proto_msgTypes[1] + mi := &file_api_attachment_service_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -233,7 +1034,7 @@ func (x *MediaMetadata) String() string { func (*MediaMetadata) ProtoMessage() {} func (x *MediaMetadata) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_attachment_service_proto_msgTypes[1] + mi := &file_api_attachment_service_proto_msgTypes[12] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -246,7 +1047,7 @@ func (x *MediaMetadata) ProtoReflect() protoreflect.Message { // Deprecated: Use MediaMetadata.ProtoReflect.Descriptor instead. func (*MediaMetadata) Descriptor() ([]byte, []int) { - return file_api_v1_attachment_service_proto_rawDescGZIP(), []int{1} + return file_api_attachment_service_proto_rawDescGZIP(), []int{12} } func (x *MediaMetadata) GetWidth() int32 { @@ -293,10 +1094,12 @@ type isMediaMetadata_Details interface { } type MediaMetadata_Photo struct { + // Photo metadata, for image attachments. Photo *PhotoMetadata `protobuf:"bytes,3,opt,name=photo,proto3,oneof"` } type MediaMetadata_Video struct { + // Video metadata, for video attachments. Video *VideoMetadata `protobuf:"bytes,4,opt,name=video,proto3,oneof"` } @@ -304,30 +1107,38 @@ func (*MediaMetadata_Photo) isMediaMetadata_Details() {} func (*MediaMetadata_Video) isMediaMetadata_Details() {} +// PhotoMetadata is metadata recorded by the source of a photo. type PhotoMetadata struct { state protoimpl.MessageState `protogen:"open.v1"` - // Optional. Capture time as recorded by the source media. + // Capture time as recorded by the source media. CaptureTime *MediaCaptureTime `protobuf:"bytes,1,opt,name=capture_time,json=captureTime,proto3" json:"capture_time,omitempty"` - // Optional. Geographic location recorded by the source media. + // Geographic location recorded by the source media. Location *MediaLocation `protobuf:"bytes,2,opt,name=location,proto3" json:"location,omitempty"` - // Optional. EXIF orientation value from 1 through 8 as recorded by the source file. + // EXIF orientation value from 1 through 8 as recorded by the source file. // This value is informational and must not be reapplied to the stored attachment; // width and height already describe its display-oriented dimensions. - SourceExifOrientation *int32 `protobuf:"varint,3,opt,name=source_exif_orientation,json=sourceExifOrientation,proto3,oneof" json:"source_exif_orientation,omitempty"` - CameraMake string `protobuf:"bytes,4,opt,name=camera_make,json=cameraMake,proto3" json:"camera_make,omitempty"` - CameraModel string `protobuf:"bytes,5,opt,name=camera_model,json=cameraModel,proto3" json:"camera_model,omitempty"` - LensModel string `protobuf:"bytes,6,opt,name=lens_model,json=lensModel,proto3" json:"lens_model,omitempty"` - FNumber *float64 `protobuf:"fixed64,7,opt,name=f_number,json=fNumber,proto3,oneof" json:"f_number,omitempty"` - ExposureTimeSeconds *float64 `protobuf:"fixed64,8,opt,name=exposure_time_seconds,json=exposureTimeSeconds,proto3,oneof" json:"exposure_time_seconds,omitempty"` - Iso *int32 `protobuf:"varint,9,opt,name=iso,proto3,oneof" json:"iso,omitempty"` - FocalLengthMm *float64 `protobuf:"fixed64,10,opt,name=focal_length_mm,json=focalLengthMm,proto3,oneof" json:"focal_length_mm,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache + SourceExifOrientation *int32 `protobuf:"varint,3,opt,name=source_exif_orientation,json=sourceExifOrientation,proto3,oneof" json:"source_exif_orientation,omitempty"` + // The camera manufacturer. + CameraMake string `protobuf:"bytes,4,opt,name=camera_make,json=cameraMake,proto3" json:"camera_make,omitempty"` + // The camera model. + CameraModel string `protobuf:"bytes,5,opt,name=camera_model,json=cameraModel,proto3" json:"camera_model,omitempty"` + // The lens model. + LensModel string `protobuf:"bytes,6,opt,name=lens_model,json=lensModel,proto3" json:"lens_model,omitempty"` + // The aperture f-number. + FNumber *float64 `protobuf:"fixed64,7,opt,name=f_number,json=fNumber,proto3,oneof" json:"f_number,omitempty"` + // The exposure time in seconds. + ExposureTimeSeconds *float64 `protobuf:"fixed64,8,opt,name=exposure_time_seconds,json=exposureTimeSeconds,proto3,oneof" json:"exposure_time_seconds,omitempty"` + // The ISO sensitivity. + Iso *int32 `protobuf:"varint,9,opt,name=iso,proto3,oneof" json:"iso,omitempty"` + // The focal length in millimeters. + FocalLengthMm *float64 `protobuf:"fixed64,10,opt,name=focal_length_mm,json=focalLengthMm,proto3,oneof" json:"focal_length_mm,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *PhotoMetadata) Reset() { *x = PhotoMetadata{} - mi := &file_api_v1_attachment_service_proto_msgTypes[2] + mi := &file_api_attachment_service_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -339,7 +1150,7 @@ func (x *PhotoMetadata) String() string { func (*PhotoMetadata) ProtoMessage() {} func (x *PhotoMetadata) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_attachment_service_proto_msgTypes[2] + mi := &file_api_attachment_service_proto_msgTypes[13] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -352,7 +1163,7 @@ func (x *PhotoMetadata) ProtoReflect() protoreflect.Message { // Deprecated: Use PhotoMetadata.ProtoReflect.Descriptor instead. func (*PhotoMetadata) Descriptor() ([]byte, []int) { - return file_api_v1_attachment_service_proto_rawDescGZIP(), []int{2} + return file_api_attachment_service_proto_rawDescGZIP(), []int{13} } func (x *PhotoMetadata) GetCaptureTime() *MediaCaptureTime { @@ -425,11 +1236,12 @@ func (x *PhotoMetadata) GetFocalLengthMm() float64 { return 0 } +// MediaCaptureTime is the local time at which media was captured. type MediaCaptureTime struct { state protoimpl.MessageState `protogen:"open.v1"` // Local date and time without a time zone, formatted as YYYY-MM-DDTHH:mm:ss[.fraction]. LocalDateTime string `protobuf:"bytes,1,opt,name=local_date_time,json=localDateTime,proto3" json:"local_date_time,omitempty"` - // Optional. UTC offset formatted as Z or +/-HH:MM. + // UTC offset formatted as Z or +/-HH:MM. UtcOffset *string `protobuf:"bytes,2,opt,name=utc_offset,json=utcOffset,proto3,oneof" json:"utc_offset,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache @@ -437,7 +1249,7 @@ type MediaCaptureTime struct { func (x *MediaCaptureTime) Reset() { *x = MediaCaptureTime{} - mi := &file_api_v1_attachment_service_proto_msgTypes[3] + mi := &file_api_attachment_service_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -449,7 +1261,7 @@ func (x *MediaCaptureTime) String() string { func (*MediaCaptureTime) ProtoMessage() {} func (x *MediaCaptureTime) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_attachment_service_proto_msgTypes[3] + mi := &file_api_attachment_service_proto_msgTypes[14] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -462,7 +1274,7 @@ func (x *MediaCaptureTime) ProtoReflect() protoreflect.Message { // Deprecated: Use MediaCaptureTime.ProtoReflect.Descriptor instead. func (*MediaCaptureTime) Descriptor() ([]byte, []int) { - return file_api_v1_attachment_service_proto_rawDescGZIP(), []int{3} + return file_api_attachment_service_proto_rawDescGZIP(), []int{14} } func (x *MediaCaptureTime) GetLocalDateTime() string { @@ -479,13 +1291,14 @@ func (x *MediaCaptureTime) GetUtcOffset() string { return "" } +// MediaLocation is the geographic location at which media was captured. type MediaLocation struct { state protoimpl.MessageState `protogen:"open.v1"` - // Optional. WGS84 latitude in decimal degrees. Must be provided with longitude. + // WGS84 latitude in decimal degrees. Must be provided with longitude. Latitude *float64 `protobuf:"fixed64,1,opt,name=latitude,proto3,oneof" json:"latitude,omitempty"` - // Optional. WGS84 longitude in decimal degrees. Must be provided with latitude. + // WGS84 longitude in decimal degrees. Must be provided with latitude. Longitude *float64 `protobuf:"fixed64,2,opt,name=longitude,proto3,oneof" json:"longitude,omitempty"` - // Optional. Signed altitude in meters relative to sea level. + // Signed altitude in meters relative to sea level. AltitudeMeters *float64 `protobuf:"fixed64,3,opt,name=altitude_meters,json=altitudeMeters,proto3,oneof" json:"altitude_meters,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache @@ -493,7 +1306,7 @@ type MediaLocation struct { func (x *MediaLocation) Reset() { *x = MediaLocation{} - mi := &file_api_v1_attachment_service_proto_msgTypes[4] + mi := &file_api_attachment_service_proto_msgTypes[15] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -505,7 +1318,7 @@ func (x *MediaLocation) String() string { func (*MediaLocation) ProtoMessage() {} func (x *MediaLocation) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_attachment_service_proto_msgTypes[4] + mi := &file_api_attachment_service_proto_msgTypes[15] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -518,7 +1331,7 @@ func (x *MediaLocation) ProtoReflect() protoreflect.Message { // Deprecated: Use MediaLocation.ProtoReflect.Descriptor instead. func (*MediaLocation) Descriptor() ([]byte, []int) { - return file_api_v1_attachment_service_proto_rawDescGZIP(), []int{4} + return file_api_attachment_service_proto_rawDescGZIP(), []int{15} } func (x *MediaLocation) GetLatitude() float64 { @@ -542,16 +1355,18 @@ func (x *MediaLocation) GetAltitudeMeters() float64 { return 0 } +// VideoMetadata is metadata recorded by the source of a video. type VideoMetadata struct { - state protoimpl.MessageState `protogen:"open.v1"` - DurationSeconds *float64 `protobuf:"fixed64,1,opt,name=duration_seconds,json=durationSeconds,proto3,oneof" json:"duration_seconds,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + // The duration of the video in seconds. + DurationSeconds *float64 `protobuf:"fixed64,1,opt,name=duration_seconds,json=durationSeconds,proto3,oneof" json:"duration_seconds,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } func (x *VideoMetadata) Reset() { *x = VideoMetadata{} - mi := &file_api_v1_attachment_service_proto_msgTypes[5] + mi := &file_api_attachment_service_proto_msgTypes[16] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -563,7 +1378,7 @@ func (x *VideoMetadata) String() string { func (*VideoMetadata) ProtoMessage() {} func (x *VideoMetadata) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_attachment_service_proto_msgTypes[5] + mi := &file_api_attachment_service_proto_msgTypes[16] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -576,7 +1391,7 @@ func (x *VideoMetadata) ProtoReflect() protoreflect.Message { // Deprecated: Use VideoMetadata.ProtoReflect.Descriptor instead. func (*VideoMetadata) Descriptor() ([]byte, []int) { - return file_api_v1_attachment_service_proto_rawDescGZIP(), []int{5} + return file_api_attachment_service_proto_rawDescGZIP(), []int{16} } func (x *VideoMetadata) GetDurationSeconds() float64 { @@ -586,811 +1401,96 @@ func (x *VideoMetadata) GetDurationSeconds() float64 { return 0 } -type Attachment struct { - state protoimpl.MessageState `protogen:"open.v1"` - // The name of the attachment. - // Format: attachments/{attachment} - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Output only. The creation timestamp. - CreateTime *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty"` - // The filename of the attachment. - Filename string `protobuf:"bytes,3,opt,name=filename,proto3" json:"filename,omitempty"` - // Input only. The content of the attachment. - Content []byte `protobuf:"bytes,4,opt,name=content,proto3" json:"content,omitempty"` - // Optional. The external link of the attachment. - ExternalLink string `protobuf:"bytes,5,opt,name=external_link,json=externalLink,proto3" json:"external_link,omitempty"` - // The MIME type of the attachment. - Type string `protobuf:"bytes,6,opt,name=type,proto3" json:"type,omitempty"` - // Output only. The size of the attachment in bytes. - Size int64 `protobuf:"varint,7,opt,name=size,proto3" json:"size,omitempty"` - // Optional. The related memo. Refer to `Memo.name`. - // Format: memos/{memo} - Memo *string `protobuf:"bytes,8,opt,name=memo,proto3,oneof" json:"memo,omitempty"` - // Optional. Motion media metadata. - MotionMedia *MotionMedia `protobuf:"bytes,9,opt,name=motion_media,json=motionMedia,proto3" json:"motion_media,omitempty"` - // Optional. Immutable normalized media metadata explicitly supplied by the client at creation time. - MediaMetadata *MediaMetadata `protobuf:"bytes,10,opt,name=media_metadata,json=mediaMetadata,proto3" json:"media_metadata,omitempty"` - // Output only. The user who uploaded this attachment, which may differ from - // the creator of the linked memo. Format: users/{user}. - Creator string `protobuf:"bytes,11,opt,name=creator,proto3" json:"creator,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} +var File_api_attachment_service_proto protoreflect.FileDescriptor -func (x *Attachment) Reset() { - *x = Attachment{} - mi := &file_api_v1_attachment_service_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *Attachment) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Attachment) ProtoMessage() {} - -func (x *Attachment) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_attachment_service_proto_msgTypes[6] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Attachment.ProtoReflect.Descriptor instead. -func (*Attachment) Descriptor() ([]byte, []int) { - return file_api_v1_attachment_service_proto_rawDescGZIP(), []int{6} -} - -func (x *Attachment) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *Attachment) GetCreateTime() *timestamppb.Timestamp { - if x != nil { - return x.CreateTime - } - return nil -} - -func (x *Attachment) GetFilename() string { - if x != nil { - return x.Filename - } - return "" -} - -func (x *Attachment) GetContent() []byte { - if x != nil { - return x.Content - } - return nil -} - -func (x *Attachment) GetExternalLink() string { - if x != nil { - return x.ExternalLink - } - return "" -} - -func (x *Attachment) GetType() string { - if x != nil { - return x.Type - } - return "" -} - -func (x *Attachment) GetSize() int64 { - if x != nil { - return x.Size - } - return 0 -} - -func (x *Attachment) GetMemo() string { - if x != nil && x.Memo != nil { - return *x.Memo - } - return "" -} - -func (x *Attachment) GetMotionMedia() *MotionMedia { - if x != nil { - return x.MotionMedia - } - return nil -} - -func (x *Attachment) GetMediaMetadata() *MediaMetadata { - if x != nil { - return x.MediaMetadata - } - return nil -} - -func (x *Attachment) GetCreator() string { - if x != nil { - return x.Creator - } - return "" -} - -type CreateAttachmentRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Required. The attachment to create. - Attachment *Attachment `protobuf:"bytes,1,opt,name=attachment,proto3" json:"attachment,omitempty"` - // Optional. The attachment ID to use for this attachment. - // If empty, a unique ID will be generated. - // Format: ^[a-zA-Z0-9]([a-zA-Z0-9-]{0,34}[a-zA-Z0-9])?$ - AttachmentId string `protobuf:"bytes,2,opt,name=attachment_id,json=attachmentId,proto3" json:"attachment_id,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *CreateAttachmentRequest) Reset() { - *x = CreateAttachmentRequest{} - mi := &file_api_v1_attachment_service_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *CreateAttachmentRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CreateAttachmentRequest) ProtoMessage() {} - -func (x *CreateAttachmentRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_attachment_service_proto_msgTypes[7] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CreateAttachmentRequest.ProtoReflect.Descriptor instead. -func (*CreateAttachmentRequest) Descriptor() ([]byte, []int) { - return file_api_v1_attachment_service_proto_rawDescGZIP(), []int{7} -} - -func (x *CreateAttachmentRequest) GetAttachment() *Attachment { - if x != nil { - return x.Attachment - } - return nil -} - -func (x *CreateAttachmentRequest) GetAttachmentId() string { - if x != nil { - return x.AttachmentId - } - return "" -} - -type UploadAttachmentRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Required. Start a new upload or continue an existing one. - // - // Types that are valid to be assigned to Upload: - // - // *UploadAttachmentRequest_Spec - // *UploadAttachmentRequest_UploadId - Upload isUploadAttachmentRequest_Upload `protobuf_oneof:"upload"` - // Required. Zero-based byte offset at which data is written. Must equal the - // committed size, except when retrying the most recently accepted chunk - // with identical bytes and offset, which is accepted without writing again. - WriteOffset int64 `protobuf:"varint,3,opt,name=write_offset,json=writeOffset,proto3" json:"write_offset,omitempty"` - // Optional. File bytes, at most max_chunk_size long. With no data and - // finish_write false, the call reports progress without writing, and - // write_offset is ignored. - Data []byte `protobuf:"bytes,4,opt,name=data,proto3" json:"data,omitempty"` - // Optional. Finalize the upload after writing data. The committed size must - // then equal total_size. Any later call for the same upload_id returns the - // created attachment. - FinishWrite bool `protobuf:"varint,5,opt,name=finish_write,json=finishWrite,proto3" json:"finish_write,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *UploadAttachmentRequest) Reset() { - *x = UploadAttachmentRequest{} - mi := &file_api_v1_attachment_service_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *UploadAttachmentRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UploadAttachmentRequest) ProtoMessage() {} - -func (x *UploadAttachmentRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_attachment_service_proto_msgTypes[8] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UploadAttachmentRequest.ProtoReflect.Descriptor instead. -func (*UploadAttachmentRequest) Descriptor() ([]byte, []int) { - return file_api_v1_attachment_service_proto_rawDescGZIP(), []int{8} -} - -func (x *UploadAttachmentRequest) GetUpload() isUploadAttachmentRequest_Upload { - if x != nil { - return x.Upload - } - return nil -} - -func (x *UploadAttachmentRequest) GetSpec() *UploadAttachmentSpec { - if x != nil { - if x, ok := x.Upload.(*UploadAttachmentRequest_Spec); ok { - return x.Spec - } - } - return nil -} - -func (x *UploadAttachmentRequest) GetUploadId() string { - if x != nil { - if x, ok := x.Upload.(*UploadAttachmentRequest_UploadId); ok { - return x.UploadId - } - } - return "" -} - -func (x *UploadAttachmentRequest) GetWriteOffset() int64 { - if x != nil { - return x.WriteOffset - } - return 0 -} - -func (x *UploadAttachmentRequest) GetData() []byte { - if x != nil { - return x.Data - } - return nil -} - -func (x *UploadAttachmentRequest) GetFinishWrite() bool { - if x != nil { - return x.FinishWrite - } - return false -} - -type isUploadAttachmentRequest_Upload interface { - isUploadAttachmentRequest_Upload() -} - -type UploadAttachmentRequest_Spec struct { - // Starts a new upload. The same call may also carry data and finish_write. - Spec *UploadAttachmentSpec `protobuf:"bytes,1,opt,name=spec,proto3,oneof"` -} - -type UploadAttachmentRequest_UploadId struct { - // Continues the upload identified by a previous response. - UploadId string `protobuf:"bytes,2,opt,name=upload_id,json=uploadId,proto3,oneof"` -} - -func (*UploadAttachmentRequest_Spec) isUploadAttachmentRequest_Upload() {} - -func (*UploadAttachmentRequest_UploadId) isUploadAttachmentRequest_Upload() {} - -type UploadAttachmentSpec struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Required. Metadata for the attachment to create. content must be empty; - // file bytes are sent in data. - Attachment *Attachment `protobuf:"bytes,1,opt,name=attachment,proto3" json:"attachment,omitempty"` - // Optional. The attachment ID to use for this attachment. - // If empty, a unique ID will be generated. - // Format: ^[a-zA-Z0-9]([a-zA-Z0-9-]{0,34}[a-zA-Z0-9])?$ - AttachmentId string `protobuf:"bytes,2,opt,name=attachment_id,json=attachmentId,proto3" json:"attachment_id,omitempty"` - // Optional. Total size of the file in bytes before media processing. - // Zero represents an empty file. - TotalSize int64 `protobuf:"varint,3,opt,name=total_size,json=totalSize,proto3" json:"total_size,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *UploadAttachmentSpec) Reset() { - *x = UploadAttachmentSpec{} - mi := &file_api_v1_attachment_service_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *UploadAttachmentSpec) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UploadAttachmentSpec) ProtoMessage() {} - -func (x *UploadAttachmentSpec) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_attachment_service_proto_msgTypes[9] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UploadAttachmentSpec.ProtoReflect.Descriptor instead. -func (*UploadAttachmentSpec) Descriptor() ([]byte, []int) { - return file_api_v1_attachment_service_proto_rawDescGZIP(), []int{9} -} - -func (x *UploadAttachmentSpec) GetAttachment() *Attachment { - if x != nil { - return x.Attachment - } - return nil -} - -func (x *UploadAttachmentSpec) GetAttachmentId() string { - if x != nil { - return x.AttachmentId - } - return "" -} - -func (x *UploadAttachmentSpec) GetTotalSize() int64 { - if x != nil { - return x.TotalSize - } - return 0 -} - -type UploadAttachmentResponse struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Opaque ID for subsequent calls. This is not a resource name. - UploadId string `protobuf:"bytes,1,opt,name=upload_id,json=uploadId,proto3" json:"upload_id,omitempty"` - // Number of file bytes committed so far. - CommittedSize int64 `protobuf:"varint,2,opt,name=committed_size,json=committedSize,proto3" json:"committed_size,omitempty"` - // Set once the upload has been finalized. - Attachment *Attachment `protobuf:"bytes,3,opt,name=attachment,proto3" json:"attachment,omitempty"` - // Maximum number of data bytes accepted in one call. - MaxChunkSize int32 `protobuf:"varint,4,opt,name=max_chunk_size,json=maxChunkSize,proto3" json:"max_chunk_size,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *UploadAttachmentResponse) Reset() { - *x = UploadAttachmentResponse{} - mi := &file_api_v1_attachment_service_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *UploadAttachmentResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UploadAttachmentResponse) ProtoMessage() {} - -func (x *UploadAttachmentResponse) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_attachment_service_proto_msgTypes[10] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UploadAttachmentResponse.ProtoReflect.Descriptor instead. -func (*UploadAttachmentResponse) Descriptor() ([]byte, []int) { - return file_api_v1_attachment_service_proto_rawDescGZIP(), []int{10} -} - -func (x *UploadAttachmentResponse) GetUploadId() string { - if x != nil { - return x.UploadId - } - return "" -} - -func (x *UploadAttachmentResponse) GetCommittedSize() int64 { - if x != nil { - return x.CommittedSize - } - return 0 -} - -func (x *UploadAttachmentResponse) GetAttachment() *Attachment { - if x != nil { - return x.Attachment - } - return nil -} - -func (x *UploadAttachmentResponse) GetMaxChunkSize() int32 { - if x != nil { - return x.MaxChunkSize - } - return 0 -} - -type ListAttachmentsRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Optional. The maximum number of attachments to return. - // The service may return fewer than this value. - // If unspecified, at most 50 attachments will be returned. - // The maximum value is 1000; values above 1000 will be coerced to 1000. - PageSize int32 `protobuf:"varint,1,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` - // Optional. A page token, received from a previous `ListAttachments` call. - // Provide this to retrieve the subsequent page. - PageToken string `protobuf:"bytes,2,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` - // Optional. Filter to apply to the list results. - // Example: "mime_type==\"image/png\"" or "filename.contains(\"test\")" - // Supported operators: =, !=, <, <=, >, >=, : (contains), in - // Supported fields: creator, filename, mime_type, create_time, memo_id, space. - // `creator` is the linked memo's creator, or the uploader for an unlinked - // attachment. It supports equality with a User resource name. - // `space` only supports a non-negated `==` comparison with a Space resource - // name or null. - // `space` is the linked memo's space resource name, or null when the - // attachment is unlinked or its linked memo has no space. - Filter string `protobuf:"bytes,3,opt,name=filter,proto3" json:"filter,omitempty"` - // Optional. The order to sort results by. - // Example: "create_time desc" or "filename asc" - OrderBy string `protobuf:"bytes,4,opt,name=order_by,json=orderBy,proto3" json:"order_by,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ListAttachmentsRequest) Reset() { - *x = ListAttachmentsRequest{} - mi := &file_api_v1_attachment_service_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ListAttachmentsRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ListAttachmentsRequest) ProtoMessage() {} - -func (x *ListAttachmentsRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_attachment_service_proto_msgTypes[11] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ListAttachmentsRequest.ProtoReflect.Descriptor instead. -func (*ListAttachmentsRequest) Descriptor() ([]byte, []int) { - return file_api_v1_attachment_service_proto_rawDescGZIP(), []int{11} -} - -func (x *ListAttachmentsRequest) GetPageSize() int32 { - if x != nil { - return x.PageSize - } - return 0 -} - -func (x *ListAttachmentsRequest) GetPageToken() string { - if x != nil { - return x.PageToken - } - return "" -} - -func (x *ListAttachmentsRequest) GetFilter() string { - if x != nil { - return x.Filter - } - return "" -} - -func (x *ListAttachmentsRequest) GetOrderBy() string { - if x != nil { - return x.OrderBy - } - return "" -} - -type ListAttachmentsResponse struct { - state protoimpl.MessageState `protogen:"open.v1"` - // The list of attachments. - Attachments []*Attachment `protobuf:"bytes,1,rep,name=attachments,proto3" json:"attachments,omitempty"` - // A token that can be sent as `page_token` to retrieve the next page. - // If this field is omitted, there are no subsequent pages. - NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ListAttachmentsResponse) Reset() { - *x = ListAttachmentsResponse{} - mi := &file_api_v1_attachment_service_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ListAttachmentsResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ListAttachmentsResponse) ProtoMessage() {} - -func (x *ListAttachmentsResponse) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_attachment_service_proto_msgTypes[12] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ListAttachmentsResponse.ProtoReflect.Descriptor instead. -func (*ListAttachmentsResponse) Descriptor() ([]byte, []int) { - return file_api_v1_attachment_service_proto_rawDescGZIP(), []int{12} -} - -func (x *ListAttachmentsResponse) GetAttachments() []*Attachment { - if x != nil { - return x.Attachments - } - return nil -} - -func (x *ListAttachmentsResponse) GetNextPageToken() string { - if x != nil { - return x.NextPageToken - } - return "" -} - -type GetAttachmentRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Required. The attachment name of the attachment to retrieve. - // Format: attachments/{attachment} - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *GetAttachmentRequest) Reset() { - *x = GetAttachmentRequest{} - mi := &file_api_v1_attachment_service_proto_msgTypes[13] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *GetAttachmentRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetAttachmentRequest) ProtoMessage() {} - -func (x *GetAttachmentRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_attachment_service_proto_msgTypes[13] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetAttachmentRequest.ProtoReflect.Descriptor instead. -func (*GetAttachmentRequest) Descriptor() ([]byte, []int) { - return file_api_v1_attachment_service_proto_rawDescGZIP(), []int{13} -} - -func (x *GetAttachmentRequest) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -type UpdateAttachmentRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Required. The attachment which replaces the attachment on the server. - Attachment *Attachment `protobuf:"bytes,1,opt,name=attachment,proto3" json:"attachment,omitempty"` - // Required. The list of fields to update. - UpdateMask *fieldmaskpb.FieldMask `protobuf:"bytes,2,opt,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *UpdateAttachmentRequest) Reset() { - *x = UpdateAttachmentRequest{} - mi := &file_api_v1_attachment_service_proto_msgTypes[14] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *UpdateAttachmentRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateAttachmentRequest) ProtoMessage() {} - -func (x *UpdateAttachmentRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_attachment_service_proto_msgTypes[14] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateAttachmentRequest.ProtoReflect.Descriptor instead. -func (*UpdateAttachmentRequest) Descriptor() ([]byte, []int) { - return file_api_v1_attachment_service_proto_rawDescGZIP(), []int{14} -} - -func (x *UpdateAttachmentRequest) GetAttachment() *Attachment { - if x != nil { - return x.Attachment - } - return nil -} - -func (x *UpdateAttachmentRequest) GetUpdateMask() *fieldmaskpb.FieldMask { - if x != nil { - return x.UpdateMask - } - return nil -} - -type DeleteAttachmentRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Required. The attachment name of the attachment to delete. - // Format: attachments/{attachment} - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *DeleteAttachmentRequest) Reset() { - *x = DeleteAttachmentRequest{} - mi := &file_api_v1_attachment_service_proto_msgTypes[15] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *DeleteAttachmentRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DeleteAttachmentRequest) ProtoMessage() {} - -func (x *DeleteAttachmentRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_attachment_service_proto_msgTypes[15] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DeleteAttachmentRequest.ProtoReflect.Descriptor instead. -func (*DeleteAttachmentRequest) Descriptor() ([]byte, []int) { - return file_api_v1_attachment_service_proto_rawDescGZIP(), []int{15} -} - -func (x *DeleteAttachmentRequest) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -type BatchDeleteAttachmentsRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - Names []string `protobuf:"bytes,1,rep,name=names,proto3" json:"names,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *BatchDeleteAttachmentsRequest) Reset() { - *x = BatchDeleteAttachmentsRequest{} - mi := &file_api_v1_attachment_service_proto_msgTypes[16] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *BatchDeleteAttachmentsRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*BatchDeleteAttachmentsRequest) ProtoMessage() {} - -func (x *BatchDeleteAttachmentsRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_attachment_service_proto_msgTypes[16] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use BatchDeleteAttachmentsRequest.ProtoReflect.Descriptor instead. -func (*BatchDeleteAttachmentsRequest) Descriptor() ([]byte, []int) { - return file_api_v1_attachment_service_proto_rawDescGZIP(), []int{16} -} - -func (x *BatchDeleteAttachmentsRequest) GetNames() []string { - if x != nil { - return x.Names - } - return nil -} - -var File_api_v1_attachment_service_proto protoreflect.FileDescriptor - -const file_api_v1_attachment_service_proto_rawDesc = "" + +const file_api_attachment_service_proto_rawDesc = "" + "\n" + - "\x1fapi/v1/attachment_service.proto\x12\fmemos.api.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"\xfe\x01\n" + - "\vMotionMedia\x127\n" + - "\x06family\x18\x01 \x01(\x0e2\x1f.memos.api.v1.MotionMediaFamilyR\x06family\x121\n" + - "\x04role\x18\x02 \x01(\x0e2\x1d.memos.api.v1.MotionMediaRoleR\x04role\x12\x19\n" + + "\x1capi/attachment_service.proto\x12\tmemos.api\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"\xb3\x04\n" + + "\n" + + "Attachment\x12\x17\n" + + "\x04name\x18\x01 \x01(\tB\x03\xe0A\bR\x04name\x120\n" + + "\acreator\x18\x02 \x01(\tB\x16\xe0A\x03\xfaA\x10\n" + + "\x0ememos.api/UserR\acreator\x12\x1f\n" + + "\bfilename\x18\x03 \x01(\tB\x03\xe0A\x02R\bfilename\x12\x17\n" + + "\x04type\x18\x04 \x01(\tB\x03\xe0A\x02R\x04type\x12\x1d\n" + + "\acontent\x18\x05 \x01(\fB\x03\xe0A\x04R\acontent\x12(\n" + + "\rexternal_link\x18\x06 \x01(\tB\x03\xe0A\x01R\fexternalLink\x12>\n" + + "\fmotion_media\x18\a \x01(\v2\x16.memos.api.MotionMediaB\x03\xe0A\x01R\vmotionMedia\x12G\n" + + "\x0emedia_metadata\x18\b \x01(\v2\x18.memos.api.MediaMetadataB\x06\xe0A\x01\xe0A\x05R\rmediaMetadata\x12\x1c\n" + + "\x04memo\x18\t \x01(\tB\x03\xe0A\x01H\x00R\x04memo\x88\x01\x01\x12\x17\n" + + "\x04size\x18\n" + + " \x01(\x03B\x03\xe0A\x03R\x04size\x12@\n" + + "\vcreate_time\x18\v \x01(\v2\x1a.google.protobuf.TimestampB\x03\xe0A\x03R\n" + + "createTime:L\xeaAI\n" + + "\x14memos.api/Attachment\x12\x18attachments/{attachment}*\vattachments2\n" + + "attachmentB\a\n" + + "\x05_memo\"\x9b\x01\n" + + "\x16ListAttachmentsRequest\x12 \n" + + "\tpage_size\x18\x01 \x01(\x05B\x03\xe0A\x01R\bpageSize\x12\"\n" + + "\n" + + "page_token\x18\x02 \x01(\tB\x03\xe0A\x01R\tpageToken\x12\x1b\n" + + "\x06filter\x18\x03 \x01(\tB\x03\xe0A\x01R\x06filter\x12\x1e\n" + + "\border_by\x18\x04 \x01(\tB\x03\xe0A\x01R\aorderBy\"z\n" + + "\x17ListAttachmentsResponse\x127\n" + + "\vattachments\x18\x01 \x03(\v2\x15.memos.api.AttachmentR\vattachments\x12&\n" + + "\x0fnext_page_token\x18\x02 \x01(\tR\rnextPageToken\"H\n" + + "\x14GetAttachmentRequest\x120\n" + + "\x04name\x18\x01 \x01(\tB\x1c\xe0A\x02\xfaA\x16\n" + + "\x14memos.api/AttachmentR\x04name\"\x7f\n" + + "\x17CreateAttachmentRequest\x12:\n" + + "\n" + + "attachment\x18\x01 \x01(\v2\x15.memos.api.AttachmentB\x03\xe0A\x02R\n" + + "attachment\x12(\n" + + "\rattachment_id\x18\x02 \x01(\tB\x03\xe0A\x01R\fattachmentId\"\x97\x01\n" + + "\x17UpdateAttachmentRequest\x12:\n" + + "\n" + + "attachment\x18\x01 \x01(\v2\x15.memos.api.AttachmentB\x03\xe0A\x02R\n" + + "attachment\x12@\n" + + "\vupdate_mask\x18\x02 \x01(\v2\x1a.google.protobuf.FieldMaskB\x03\xe0A\x02R\n" + + "updateMask\"K\n" + + "\x17DeleteAttachmentRequest\x120\n" + + "\x04name\x18\x01 \x01(\tB\x1c\xe0A\x02\xfaA\x16\n" + + "\x14memos.api/AttachmentR\x04name\":\n" + + "\x1dBatchDeleteAttachmentsRequest\x12\x19\n" + + "\x05names\x18\x01 \x03(\tB\x03\xe0A\x02R\x05names\"\xe2\x01\n" + + "\x17UploadAttachmentRequest\x125\n" + + "\x04spec\x18\x01 \x01(\v2\x1f.memos.api.UploadAttachmentSpecH\x00R\x04spec\x12\x1d\n" + + "\tupload_id\x18\x02 \x01(\tH\x00R\buploadId\x12&\n" + + "\fwrite_offset\x18\x03 \x01(\x03B\x03\xe0A\x02R\vwriteOffset\x12\x17\n" + + "\x04data\x18\x04 \x01(\fB\x03\xe0A\x01R\x04data\x12&\n" + + "\ffinish_write\x18\x05 \x01(\bB\x03\xe0A\x01R\vfinishWriteB\b\n" + + "\x06upload\"\xbb\x01\n" + + "\x18UploadAttachmentResponse\x12\x1b\n" + + "\tupload_id\x18\x01 \x01(\tR\buploadId\x12%\n" + + "\x0ecommitted_size\x18\x02 \x01(\x03R\rcommittedSize\x12$\n" + + "\x0emax_chunk_size\x18\x03 \x01(\x05R\fmaxChunkSize\x125\n" + + "\n" + + "attachment\x18\x04 \x01(\v2\x15.memos.api.AttachmentR\n" + + "attachment\"\xa0\x01\n" + + "\x14UploadAttachmentSpec\x12:\n" + + "\n" + + "attachment\x18\x01 \x01(\v2\x15.memos.api.AttachmentB\x03\xe0A\x02R\n" + + "attachment\x12(\n" + + "\rattachment_id\x18\x02 \x01(\tB\x03\xe0A\x01R\fattachmentId\x12\"\n" + + "\n" + + "total_size\x18\x03 \x01(\x03B\x03\xe0A\x01R\ttotalSize\"\xf8\x01\n" + + "\vMotionMedia\x124\n" + + "\x06family\x18\x01 \x01(\x0e2\x1c.memos.api.MotionMediaFamilyR\x06family\x12.\n" + + "\x04role\x18\x02 \x01(\x0e2\x1a.memos.api.MotionMediaRoleR\x04role\x12\x19\n" + "\bgroup_id\x18\x03 \x01(\tR\agroupId\x12:\n" + "\x19presentation_timestamp_us\x18\x04 \x01(\x03R\x17presentationTimestampUs\x12,\n" + - "\x12has_embedded_video\x18\x05 \x01(\bR\x10hasEmbeddedVideo\"\xd1\x01\n" + + "\x12has_embedded_video\x18\x05 \x01(\bR\x10hasEmbeddedVideo\"\xcb\x01\n" + "\rMediaMetadata\x12\x19\n" + "\x05width\x18\x01 \x01(\x05H\x01R\x05width\x88\x01\x01\x12\x1b\n" + - "\x06height\x18\x02 \x01(\x05H\x02R\x06height\x88\x01\x01\x123\n" + - "\x05photo\x18\x03 \x01(\v2\x1b.memos.api.v1.PhotoMetadataH\x00R\x05photo\x123\n" + - "\x05video\x18\x04 \x01(\v2\x1b.memos.api.v1.VideoMetadataH\x00R\x05videoB\t\n" + + "\x06height\x18\x02 \x01(\x05H\x02R\x06height\x88\x01\x01\x120\n" + + "\x05photo\x18\x03 \x01(\v2\x18.memos.api.PhotoMetadataH\x00R\x05photo\x120\n" + + "\x05video\x18\x04 \x01(\v2\x18.memos.api.VideoMetadataH\x00R\x05videoB\t\n" + "\adetailsB\b\n" + "\x06_widthB\t\n" + - "\a_height\"\xa7\x04\n" + - "\rPhotoMetadata\x12A\n" + - "\fcapture_time\x18\x01 \x01(\v2\x1e.memos.api.v1.MediaCaptureTimeR\vcaptureTime\x127\n" + - "\blocation\x18\x02 \x01(\v2\x1b.memos.api.v1.MediaLocationR\blocation\x12;\n" + + "\a_height\"\xa1\x04\n" + + "\rPhotoMetadata\x12>\n" + + "\fcapture_time\x18\x01 \x01(\v2\x1b.memos.api.MediaCaptureTimeR\vcaptureTime\x124\n" + + "\blocation\x18\x02 \x01(\v2\x18.memos.api.MediaLocationR\blocation\x12;\n" + "\x17source_exif_orientation\x18\x03 \x01(\x05H\x00R\x15sourceExifOrientation\x88\x01\x01\x12\x1f\n" + "\vcamera_make\x18\x04 \x01(\tR\n" + "cameraMake\x12!\n" + @@ -1422,76 +1522,7 @@ const file_api_v1_attachment_service_proto_rawDesc = "" + "\x10_altitude_meters\"T\n" + "\rVideoMetadata\x12.\n" + "\x10duration_seconds\x18\x01 \x01(\x01H\x00R\x0fdurationSeconds\x88\x01\x01B\x13\n" + - "\x11_duration_seconds\"\xbf\x04\n" + - "\n" + - "Attachment\x12\x17\n" + - "\x04name\x18\x01 \x01(\tB\x03\xe0A\bR\x04name\x12@\n" + - "\vcreate_time\x18\x02 \x01(\v2\x1a.google.protobuf.TimestampB\x03\xe0A\x03R\n" + - "createTime\x12\x1f\n" + - "\bfilename\x18\x03 \x01(\tB\x03\xe0A\x02R\bfilename\x12\x1d\n" + - "\acontent\x18\x04 \x01(\fB\x03\xe0A\x04R\acontent\x12(\n" + - "\rexternal_link\x18\x05 \x01(\tB\x03\xe0A\x01R\fexternalLink\x12\x17\n" + - "\x04type\x18\x06 \x01(\tB\x03\xe0A\x02R\x04type\x12\x17\n" + - "\x04size\x18\a \x01(\x03B\x03\xe0A\x03R\x04size\x12\x1c\n" + - "\x04memo\x18\b \x01(\tB\x03\xe0A\x01H\x00R\x04memo\x88\x01\x01\x12A\n" + - "\fmotion_media\x18\t \x01(\v2\x19.memos.api.v1.MotionMediaB\x03\xe0A\x01R\vmotionMedia\x12J\n" + - "\x0emedia_metadata\x18\n" + - " \x01(\v2\x1b.memos.api.v1.MediaMetadataB\x06\xe0A\x01\xe0A\x05R\rmediaMetadata\x123\n" + - "\acreator\x18\v \x01(\tB\x19\xe0A\x03\xfaA\x13\n" + - "\x11memos.api.v1/UserR\acreator:O\xeaAL\n" + - "\x17memos.api.v1/Attachment\x12\x18attachments/{attachment}*\vattachments2\n" + - "attachmentB\a\n" + - "\x05_memo\"\x82\x01\n" + - "\x17CreateAttachmentRequest\x12=\n" + - "\n" + - "attachment\x18\x01 \x01(\v2\x18.memos.api.v1.AttachmentB\x03\xe0A\x02R\n" + - "attachment\x12(\n" + - "\rattachment_id\x18\x02 \x01(\tB\x03\xe0A\x01R\fattachmentId\"\xe5\x01\n" + - "\x17UploadAttachmentRequest\x128\n" + - "\x04spec\x18\x01 \x01(\v2\".memos.api.v1.UploadAttachmentSpecH\x00R\x04spec\x12\x1d\n" + - "\tupload_id\x18\x02 \x01(\tH\x00R\buploadId\x12&\n" + - "\fwrite_offset\x18\x03 \x01(\x03B\x03\xe0A\x02R\vwriteOffset\x12\x17\n" + - "\x04data\x18\x04 \x01(\fB\x03\xe0A\x01R\x04data\x12&\n" + - "\ffinish_write\x18\x05 \x01(\bB\x03\xe0A\x01R\vfinishWriteB\b\n" + - "\x06upload\"\xa3\x01\n" + - "\x14UploadAttachmentSpec\x12=\n" + - "\n" + - "attachment\x18\x01 \x01(\v2\x18.memos.api.v1.AttachmentB\x03\xe0A\x02R\n" + - "attachment\x12(\n" + - "\rattachment_id\x18\x02 \x01(\tB\x03\xe0A\x01R\fattachmentId\x12\"\n" + - "\n" + - "total_size\x18\x03 \x01(\x03B\x03\xe0A\x01R\ttotalSize\"\xbe\x01\n" + - "\x18UploadAttachmentResponse\x12\x1b\n" + - "\tupload_id\x18\x01 \x01(\tR\buploadId\x12%\n" + - "\x0ecommitted_size\x18\x02 \x01(\x03R\rcommittedSize\x128\n" + - "\n" + - "attachment\x18\x03 \x01(\v2\x18.memos.api.v1.AttachmentR\n" + - "attachment\x12$\n" + - "\x0emax_chunk_size\x18\x04 \x01(\x05R\fmaxChunkSize\"\xba\x01\n" + - "\x16ListAttachmentsRequest\x12 \n" + - "\tpage_size\x18\x01 \x01(\x05B\x03\xe0A\x01R\bpageSize\x12\"\n" + - "\n" + - "page_token\x18\x02 \x01(\tB\x03\xe0A\x01R\tpageToken\x12\x1b\n" + - "\x06filter\x18\x03 \x01(\tB\x03\xe0A\x01R\x06filter\x12\x1e\n" + - "\border_by\x18\x04 \x01(\tB\x03\xe0A\x01R\aorderByJ\x04\b\x05\x10\x06J\x04\b\x06\x10\aR\x05spaceR\n" + - "unassigned\"}\n" + - "\x17ListAttachmentsResponse\x12:\n" + - "\vattachments\x18\x01 \x03(\v2\x18.memos.api.v1.AttachmentR\vattachments\x12&\n" + - "\x0fnext_page_token\x18\x02 \x01(\tR\rnextPageToken\"K\n" + - "\x14GetAttachmentRequest\x123\n" + - "\x04name\x18\x01 \x01(\tB\x1f\xe0A\x02\xfaA\x19\n" + - "\x17memos.api.v1/AttachmentR\x04name\"\x9a\x01\n" + - "\x17UpdateAttachmentRequest\x12=\n" + - "\n" + - "attachment\x18\x01 \x01(\v2\x18.memos.api.v1.AttachmentB\x03\xe0A\x02R\n" + - "attachment\x12@\n" + - "\vupdate_mask\x18\x02 \x01(\v2\x1a.google.protobuf.FieldMaskB\x03\xe0A\x02R\n" + - "updateMask\"N\n" + - "\x17DeleteAttachmentRequest\x123\n" + - "\x04name\x18\x01 \x01(\tB\x1f\xe0A\x02\xfaA\x19\n" + - "\x17memos.api.v1/AttachmentR\x04name\":\n" + - "\x1dBatchDeleteAttachmentsRequest\x12\x19\n" + - "\x05names\x18\x01 \x03(\tB\x03\xe0A\x02R\x05names*h\n" + + "\x11_duration_seconds*h\n" + "\x11MotionMediaFamily\x12#\n" + "\x1fMOTION_MEDIA_FAMILY_UNSPECIFIED\x10\x00\x12\x14\n" + "\x10APPLE_LIVE_PHOTO\x10\x01\x12\x18\n" + @@ -1500,89 +1531,90 @@ const file_api_v1_attachment_service_proto_rawDesc = "" + "\x1dMOTION_MEDIA_ROLE_UNSPECIFIED\x10\x00\x12\t\n" + "\x05STILL\x10\x01\x12\t\n" + "\x05VIDEO\x10\x02\x12\r\n" + - "\tCONTAINER\x10\x032\xdb\a\n" + - "\x11AttachmentService\x12\x89\x01\n" + - "\x10CreateAttachment\x12%.memos.api.v1.CreateAttachmentRequest\x1a\x18.memos.api.v1.Attachment\"4\xdaA\n" + - "attachment\x82\xd3\xe4\x93\x02!:\n" + - "attachment\"\x13/api/v1/attachments\x12\x88\x01\n" + - "\x10UploadAttachment\x12%.memos.api.v1.UploadAttachmentRequest\x1a&.memos.api.v1.UploadAttachmentResponse\"%\x82\xd3\xe4\x93\x02\x1f:\x01*\"\x1a/api/v1/attachments:upload\x12{\n" + - "\x0fListAttachments\x12$.memos.api.v1.ListAttachmentsRequest\x1a%.memos.api.v1.ListAttachmentsResponse\"\x1b\x82\xd3\xe4\x93\x02\x15\x12\x13/api/v1/attachments\x12z\n" + - "\rGetAttachment\x12\".memos.api.v1.GetAttachmentRequest\x1a\x18.memos.api.v1.Attachment\"+\xdaA\x04name\x82\xd3\xe4\x93\x02\x1e\x12\x1c/api/v1/{name=attachments/*}\x12\xa9\x01\n" + - "\x10UpdateAttachment\x12%.memos.api.v1.UpdateAttachmentRequest\x1a\x18.memos.api.v1.Attachment\"T\xdaA\x16attachment,update_mask\x82\xd3\xe4\x93\x025:\n" + - "attachment2'/api/v1/{attachment.name=attachments/*}\x12~\n" + - "\x10DeleteAttachment\x12%.memos.api.v1.DeleteAttachmentRequest\x1a\x16.google.protobuf.Empty\"+\xdaA\x04name\x82\xd3\xe4\x93\x02\x1e*\x1c/api/v1/{name=attachments/*}\x12\x89\x01\n" + - "\x16BatchDeleteAttachments\x12+.memos.api.v1.BatchDeleteAttachmentsRequest\x1a\x16.google.protobuf.Empty\"*\x82\xd3\xe4\x93\x02$:\x01*\"\x1f/api/v1/attachments:batchDeleteB\xae\x01\n" + - "\x10com.memos.api.v1B\x16AttachmentServiceProtoP\x01Z0github.com/usememos/memos/proto/gen/api/v1;apiv1\xa2\x02\x03MAX\xaa\x02\fMemos.Api.V1\xca\x02\fMemos\\Api\\V1\xe2\x02\x18Memos\\Api\\V1\\GPBMetadata\xea\x02\x0eMemos::Api::V1b\x06proto3" + "\tCONTAINER\x10\x032\xa1\a\n" + + "\x11AttachmentService\x12r\n" + + "\x0fListAttachments\x12!.memos.api.ListAttachmentsRequest\x1a\".memos.api.ListAttachmentsResponse\"\x18\x82\xd3\xe4\x93\x02\x12\x12\x10/api/attachments\x12q\n" + + "\rGetAttachment\x12\x1f.memos.api.GetAttachmentRequest\x1a\x15.memos.api.Attachment\"(\xdaA\x04name\x82\xd3\xe4\x93\x02\x1b\x12\x19/api/{name=attachments/*}\x12\x80\x01\n" + + "\x10CreateAttachment\x12\".memos.api.CreateAttachmentRequest\x1a\x15.memos.api.Attachment\"1\xdaA\n" + + "attachment\x82\xd3\xe4\x93\x02\x1e:\n" + + "attachment\"\x10/api/attachments\x12\xa0\x01\n" + + "\x10UpdateAttachment\x12\".memos.api.UpdateAttachmentRequest\x1a\x15.memos.api.Attachment\"Q\xdaA\x16attachment,update_mask\x82\xd3\xe4\x93\x022:\n" + + "attachment2$/api/{attachment.name=attachments/*}\x12x\n" + + "\x10DeleteAttachment\x12\".memos.api.DeleteAttachmentRequest\x1a\x16.google.protobuf.Empty\"(\xdaA\x04name\x82\xd3\xe4\x93\x02\x1b*\x19/api/{name=attachments/*}\x12\x83\x01\n" + + "\x16BatchDeleteAttachments\x12(.memos.api.BatchDeleteAttachmentsRequest\x1a\x16.google.protobuf.Empty\"'\x82\xd3\xe4\x93\x02!:\x01*\"\x1c/api/attachments:batchDelete\x12\x7f\n" + + "\x10UploadAttachment\x12\".memos.api.UploadAttachmentRequest\x1a#.memos.api.UploadAttachmentResponse\"\"\x82\xd3\xe4\x93\x02\x1c:\x01*\"\x17/api/attachments:uploadB\x95\x01\n" + + "\rcom.memos.apiB\x16AttachmentServiceProtoP\x01Z'github.com/usememos/memos/proto/gen/api\xa2\x02\x03MAX\xaa\x02\tMemos.Api\xca\x02\tMemos\\Api\xe2\x02\x15Memos\\Api\\GPBMetadata\xea\x02\n" + + "Memos::Apib\x06proto3" var ( - file_api_v1_attachment_service_proto_rawDescOnce sync.Once - file_api_v1_attachment_service_proto_rawDescData []byte + file_api_attachment_service_proto_rawDescOnce sync.Once + file_api_attachment_service_proto_rawDescData []byte ) -func file_api_v1_attachment_service_proto_rawDescGZIP() []byte { - file_api_v1_attachment_service_proto_rawDescOnce.Do(func() { - file_api_v1_attachment_service_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_api_v1_attachment_service_proto_rawDesc), len(file_api_v1_attachment_service_proto_rawDesc))) +func file_api_attachment_service_proto_rawDescGZIP() []byte { + file_api_attachment_service_proto_rawDescOnce.Do(func() { + file_api_attachment_service_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_api_attachment_service_proto_rawDesc), len(file_api_attachment_service_proto_rawDesc))) }) - return file_api_v1_attachment_service_proto_rawDescData + return file_api_attachment_service_proto_rawDescData } -var file_api_v1_attachment_service_proto_enumTypes = make([]protoimpl.EnumInfo, 2) -var file_api_v1_attachment_service_proto_msgTypes = make([]protoimpl.MessageInfo, 17) -var file_api_v1_attachment_service_proto_goTypes = []any{ - (MotionMediaFamily)(0), // 0: memos.api.v1.MotionMediaFamily - (MotionMediaRole)(0), // 1: memos.api.v1.MotionMediaRole - (*MotionMedia)(nil), // 2: memos.api.v1.MotionMedia - (*MediaMetadata)(nil), // 3: memos.api.v1.MediaMetadata - (*PhotoMetadata)(nil), // 4: memos.api.v1.PhotoMetadata - (*MediaCaptureTime)(nil), // 5: memos.api.v1.MediaCaptureTime - (*MediaLocation)(nil), // 6: memos.api.v1.MediaLocation - (*VideoMetadata)(nil), // 7: memos.api.v1.VideoMetadata - (*Attachment)(nil), // 8: memos.api.v1.Attachment - (*CreateAttachmentRequest)(nil), // 9: memos.api.v1.CreateAttachmentRequest - (*UploadAttachmentRequest)(nil), // 10: memos.api.v1.UploadAttachmentRequest - (*UploadAttachmentSpec)(nil), // 11: memos.api.v1.UploadAttachmentSpec - (*UploadAttachmentResponse)(nil), // 12: memos.api.v1.UploadAttachmentResponse - (*ListAttachmentsRequest)(nil), // 13: memos.api.v1.ListAttachmentsRequest - (*ListAttachmentsResponse)(nil), // 14: memos.api.v1.ListAttachmentsResponse - (*GetAttachmentRequest)(nil), // 15: memos.api.v1.GetAttachmentRequest - (*UpdateAttachmentRequest)(nil), // 16: memos.api.v1.UpdateAttachmentRequest - (*DeleteAttachmentRequest)(nil), // 17: memos.api.v1.DeleteAttachmentRequest - (*BatchDeleteAttachmentsRequest)(nil), // 18: memos.api.v1.BatchDeleteAttachmentsRequest +var file_api_attachment_service_proto_enumTypes = make([]protoimpl.EnumInfo, 2) +var file_api_attachment_service_proto_msgTypes = make([]protoimpl.MessageInfo, 17) +var file_api_attachment_service_proto_goTypes = []any{ + (MotionMediaFamily)(0), // 0: memos.api.MotionMediaFamily + (MotionMediaRole)(0), // 1: memos.api.MotionMediaRole + (*Attachment)(nil), // 2: memos.api.Attachment + (*ListAttachmentsRequest)(nil), // 3: memos.api.ListAttachmentsRequest + (*ListAttachmentsResponse)(nil), // 4: memos.api.ListAttachmentsResponse + (*GetAttachmentRequest)(nil), // 5: memos.api.GetAttachmentRequest + (*CreateAttachmentRequest)(nil), // 6: memos.api.CreateAttachmentRequest + (*UpdateAttachmentRequest)(nil), // 7: memos.api.UpdateAttachmentRequest + (*DeleteAttachmentRequest)(nil), // 8: memos.api.DeleteAttachmentRequest + (*BatchDeleteAttachmentsRequest)(nil), // 9: memos.api.BatchDeleteAttachmentsRequest + (*UploadAttachmentRequest)(nil), // 10: memos.api.UploadAttachmentRequest + (*UploadAttachmentResponse)(nil), // 11: memos.api.UploadAttachmentResponse + (*UploadAttachmentSpec)(nil), // 12: memos.api.UploadAttachmentSpec + (*MotionMedia)(nil), // 13: memos.api.MotionMedia + (*MediaMetadata)(nil), // 14: memos.api.MediaMetadata + (*PhotoMetadata)(nil), // 15: memos.api.PhotoMetadata + (*MediaCaptureTime)(nil), // 16: memos.api.MediaCaptureTime + (*MediaLocation)(nil), // 17: memos.api.MediaLocation + (*VideoMetadata)(nil), // 18: memos.api.VideoMetadata (*timestamppb.Timestamp)(nil), // 19: google.protobuf.Timestamp (*fieldmaskpb.FieldMask)(nil), // 20: google.protobuf.FieldMask (*emptypb.Empty)(nil), // 21: google.protobuf.Empty } -var file_api_v1_attachment_service_proto_depIdxs = []int32{ - 0, // 0: memos.api.v1.MotionMedia.family:type_name -> memos.api.v1.MotionMediaFamily - 1, // 1: memos.api.v1.MotionMedia.role:type_name -> memos.api.v1.MotionMediaRole - 4, // 2: memos.api.v1.MediaMetadata.photo:type_name -> memos.api.v1.PhotoMetadata - 7, // 3: memos.api.v1.MediaMetadata.video:type_name -> memos.api.v1.VideoMetadata - 5, // 4: memos.api.v1.PhotoMetadata.capture_time:type_name -> memos.api.v1.MediaCaptureTime - 6, // 5: memos.api.v1.PhotoMetadata.location:type_name -> memos.api.v1.MediaLocation - 19, // 6: memos.api.v1.Attachment.create_time:type_name -> google.protobuf.Timestamp - 2, // 7: memos.api.v1.Attachment.motion_media:type_name -> memos.api.v1.MotionMedia - 3, // 8: memos.api.v1.Attachment.media_metadata:type_name -> memos.api.v1.MediaMetadata - 8, // 9: memos.api.v1.CreateAttachmentRequest.attachment:type_name -> memos.api.v1.Attachment - 11, // 10: memos.api.v1.UploadAttachmentRequest.spec:type_name -> memos.api.v1.UploadAttachmentSpec - 8, // 11: memos.api.v1.UploadAttachmentSpec.attachment:type_name -> memos.api.v1.Attachment - 8, // 12: memos.api.v1.UploadAttachmentResponse.attachment:type_name -> memos.api.v1.Attachment - 8, // 13: memos.api.v1.ListAttachmentsResponse.attachments:type_name -> memos.api.v1.Attachment - 8, // 14: memos.api.v1.UpdateAttachmentRequest.attachment:type_name -> memos.api.v1.Attachment - 20, // 15: memos.api.v1.UpdateAttachmentRequest.update_mask:type_name -> google.protobuf.FieldMask - 9, // 16: memos.api.v1.AttachmentService.CreateAttachment:input_type -> memos.api.v1.CreateAttachmentRequest - 10, // 17: memos.api.v1.AttachmentService.UploadAttachment:input_type -> memos.api.v1.UploadAttachmentRequest - 13, // 18: memos.api.v1.AttachmentService.ListAttachments:input_type -> memos.api.v1.ListAttachmentsRequest - 15, // 19: memos.api.v1.AttachmentService.GetAttachment:input_type -> memos.api.v1.GetAttachmentRequest - 16, // 20: memos.api.v1.AttachmentService.UpdateAttachment:input_type -> memos.api.v1.UpdateAttachmentRequest - 17, // 21: memos.api.v1.AttachmentService.DeleteAttachment:input_type -> memos.api.v1.DeleteAttachmentRequest - 18, // 22: memos.api.v1.AttachmentService.BatchDeleteAttachments:input_type -> memos.api.v1.BatchDeleteAttachmentsRequest - 8, // 23: memos.api.v1.AttachmentService.CreateAttachment:output_type -> memos.api.v1.Attachment - 12, // 24: memos.api.v1.AttachmentService.UploadAttachment:output_type -> memos.api.v1.UploadAttachmentResponse - 14, // 25: memos.api.v1.AttachmentService.ListAttachments:output_type -> memos.api.v1.ListAttachmentsResponse - 8, // 26: memos.api.v1.AttachmentService.GetAttachment:output_type -> memos.api.v1.Attachment - 8, // 27: memos.api.v1.AttachmentService.UpdateAttachment:output_type -> memos.api.v1.Attachment - 21, // 28: memos.api.v1.AttachmentService.DeleteAttachment:output_type -> google.protobuf.Empty - 21, // 29: memos.api.v1.AttachmentService.BatchDeleteAttachments:output_type -> google.protobuf.Empty +var file_api_attachment_service_proto_depIdxs = []int32{ + 13, // 0: memos.api.Attachment.motion_media:type_name -> memos.api.MotionMedia + 14, // 1: memos.api.Attachment.media_metadata:type_name -> memos.api.MediaMetadata + 19, // 2: memos.api.Attachment.create_time:type_name -> google.protobuf.Timestamp + 2, // 3: memos.api.ListAttachmentsResponse.attachments:type_name -> memos.api.Attachment + 2, // 4: memos.api.CreateAttachmentRequest.attachment:type_name -> memos.api.Attachment + 2, // 5: memos.api.UpdateAttachmentRequest.attachment:type_name -> memos.api.Attachment + 20, // 6: memos.api.UpdateAttachmentRequest.update_mask:type_name -> google.protobuf.FieldMask + 12, // 7: memos.api.UploadAttachmentRequest.spec:type_name -> memos.api.UploadAttachmentSpec + 2, // 8: memos.api.UploadAttachmentResponse.attachment:type_name -> memos.api.Attachment + 2, // 9: memos.api.UploadAttachmentSpec.attachment:type_name -> memos.api.Attachment + 0, // 10: memos.api.MotionMedia.family:type_name -> memos.api.MotionMediaFamily + 1, // 11: memos.api.MotionMedia.role:type_name -> memos.api.MotionMediaRole + 15, // 12: memos.api.MediaMetadata.photo:type_name -> memos.api.PhotoMetadata + 18, // 13: memos.api.MediaMetadata.video:type_name -> memos.api.VideoMetadata + 16, // 14: memos.api.PhotoMetadata.capture_time:type_name -> memos.api.MediaCaptureTime + 17, // 15: memos.api.PhotoMetadata.location:type_name -> memos.api.MediaLocation + 3, // 16: memos.api.AttachmentService.ListAttachments:input_type -> memos.api.ListAttachmentsRequest + 5, // 17: memos.api.AttachmentService.GetAttachment:input_type -> memos.api.GetAttachmentRequest + 6, // 18: memos.api.AttachmentService.CreateAttachment:input_type -> memos.api.CreateAttachmentRequest + 7, // 19: memos.api.AttachmentService.UpdateAttachment:input_type -> memos.api.UpdateAttachmentRequest + 8, // 20: memos.api.AttachmentService.DeleteAttachment:input_type -> memos.api.DeleteAttachmentRequest + 9, // 21: memos.api.AttachmentService.BatchDeleteAttachments:input_type -> memos.api.BatchDeleteAttachmentsRequest + 10, // 22: memos.api.AttachmentService.UploadAttachment:input_type -> memos.api.UploadAttachmentRequest + 4, // 23: memos.api.AttachmentService.ListAttachments:output_type -> memos.api.ListAttachmentsResponse + 2, // 24: memos.api.AttachmentService.GetAttachment:output_type -> memos.api.Attachment + 2, // 25: memos.api.AttachmentService.CreateAttachment:output_type -> memos.api.Attachment + 2, // 26: memos.api.AttachmentService.UpdateAttachment:output_type -> memos.api.Attachment + 21, // 27: memos.api.AttachmentService.DeleteAttachment:output_type -> google.protobuf.Empty + 21, // 28: memos.api.AttachmentService.BatchDeleteAttachments:output_type -> google.protobuf.Empty + 11, // 29: memos.api.AttachmentService.UploadAttachment:output_type -> memos.api.UploadAttachmentResponse 23, // [23:30] is the sub-list for method output_type 16, // [16:23] is the sub-list for method input_type 16, // [16:16] is the sub-list for extension type_name @@ -1590,40 +1622,40 @@ var file_api_v1_attachment_service_proto_depIdxs = []int32{ 0, // [0:16] is the sub-list for field type_name } -func init() { file_api_v1_attachment_service_proto_init() } -func file_api_v1_attachment_service_proto_init() { - if File_api_v1_attachment_service_proto != nil { +func init() { file_api_attachment_service_proto_init() } +func file_api_attachment_service_proto_init() { + if File_api_attachment_service_proto != nil { return } - file_api_v1_attachment_service_proto_msgTypes[1].OneofWrappers = []any{ - (*MediaMetadata_Photo)(nil), - (*MediaMetadata_Video)(nil), - } - file_api_v1_attachment_service_proto_msgTypes[2].OneofWrappers = []any{} - file_api_v1_attachment_service_proto_msgTypes[3].OneofWrappers = []any{} - file_api_v1_attachment_service_proto_msgTypes[4].OneofWrappers = []any{} - file_api_v1_attachment_service_proto_msgTypes[5].OneofWrappers = []any{} - file_api_v1_attachment_service_proto_msgTypes[6].OneofWrappers = []any{} - file_api_v1_attachment_service_proto_msgTypes[8].OneofWrappers = []any{ + file_api_attachment_service_proto_msgTypes[0].OneofWrappers = []any{} + file_api_attachment_service_proto_msgTypes[8].OneofWrappers = []any{ (*UploadAttachmentRequest_Spec)(nil), (*UploadAttachmentRequest_UploadId)(nil), } + file_api_attachment_service_proto_msgTypes[12].OneofWrappers = []any{ + (*MediaMetadata_Photo)(nil), + (*MediaMetadata_Video)(nil), + } + file_api_attachment_service_proto_msgTypes[13].OneofWrappers = []any{} + file_api_attachment_service_proto_msgTypes[14].OneofWrappers = []any{} + file_api_attachment_service_proto_msgTypes[15].OneofWrappers = []any{} + file_api_attachment_service_proto_msgTypes[16].OneofWrappers = []any{} type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: unsafe.Slice(unsafe.StringData(file_api_v1_attachment_service_proto_rawDesc), len(file_api_v1_attachment_service_proto_rawDesc)), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_api_attachment_service_proto_rawDesc), len(file_api_attachment_service_proto_rawDesc)), NumEnums: 2, NumMessages: 17, NumExtensions: 0, NumServices: 1, }, - GoTypes: file_api_v1_attachment_service_proto_goTypes, - DependencyIndexes: file_api_v1_attachment_service_proto_depIdxs, - EnumInfos: file_api_v1_attachment_service_proto_enumTypes, - MessageInfos: file_api_v1_attachment_service_proto_msgTypes, + GoTypes: file_api_attachment_service_proto_goTypes, + DependencyIndexes: file_api_attachment_service_proto_depIdxs, + EnumInfos: file_api_attachment_service_proto_enumTypes, + MessageInfos: file_api_attachment_service_proto_msgTypes, }.Build() - File_api_v1_attachment_service_proto = out.File - file_api_v1_attachment_service_proto_goTypes = nil - file_api_v1_attachment_service_proto_depIdxs = nil + File_api_attachment_service_proto = out.File + file_api_attachment_service_proto_goTypes = nil + file_api_attachment_service_proto_depIdxs = nil } diff --git a/proto/gen/api/v1/attachment_service.pb.gw.go b/proto/gen/api/attachment_service.pb.gw.go similarity index 92% rename from proto/gen/api/v1/attachment_service.pb.gw.go rename to proto/gen/api/attachment_service.pb.gw.go index 91afdaa7b..cba1b9e61 100644 --- a/proto/gen/api/v1/attachment_service.pb.gw.go +++ b/proto/gen/api/attachment_service.pb.gw.go @@ -1,12 +1,12 @@ // Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: api/v1/attachment_service.proto +// source: api/attachment_service.proto /* -Package apiv1 is a reverse proxy. +Package api is a reverse proxy. It translates gRPC into RESTful JSON APIs. */ -package apiv1 +package api import ( "context" @@ -35,74 +35,6 @@ var ( _ = metadata.Join ) -var filter_AttachmentService_CreateAttachment_0 = &utilities.DoubleArray{Encoding: map[string]int{"attachment": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} - -func request_AttachmentService_CreateAttachment_0(ctx context.Context, marshaler runtime.Marshaler, client AttachmentServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var ( - protoReq CreateAttachmentRequest - metadata runtime.ServerMetadata - ) - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.Attachment); err != nil && !errors.Is(err, io.EOF) { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_AttachmentService_CreateAttachment_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if req.Body != nil { - _, _ = io.Copy(io.Discard, req.Body) - } - msg, err := client.CreateAttachment(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err -} - -func local_request_AttachmentService_CreateAttachment_0(ctx context.Context, marshaler runtime.Marshaler, server AttachmentServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var ( - protoReq CreateAttachmentRequest - metadata runtime.ServerMetadata - ) - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.Attachment); err != nil && !errors.Is(err, io.EOF) { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_AttachmentService_CreateAttachment_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - msg, err := server.CreateAttachment(ctx, &protoReq) - return msg, metadata, err -} - -func request_AttachmentService_UploadAttachment_0(ctx context.Context, marshaler runtime.Marshaler, client AttachmentServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var ( - protoReq UploadAttachmentRequest - metadata runtime.ServerMetadata - ) - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if req.Body != nil { - _, _ = io.Copy(io.Discard, req.Body) - } - msg, err := client.UploadAttachment(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err -} - -func local_request_AttachmentService_UploadAttachment_0(ctx context.Context, marshaler runtime.Marshaler, server AttachmentServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var ( - protoReq UploadAttachmentRequest - metadata runtime.ServerMetadata - ) - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - msg, err := server.UploadAttachment(ctx, &protoReq) - return msg, metadata, err -} - var filter_AttachmentService_ListAttachments_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} func request_AttachmentService_ListAttachments_0(ctx context.Context, marshaler runtime.Marshaler, client AttachmentServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -177,6 +109,47 @@ func local_request_AttachmentService_GetAttachment_0(ctx context.Context, marsha return msg, metadata, err } +var filter_AttachmentService_CreateAttachment_0 = &utilities.DoubleArray{Encoding: map[string]int{"attachment": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} + +func request_AttachmentService_CreateAttachment_0(ctx context.Context, marshaler runtime.Marshaler, client AttachmentServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq CreateAttachmentRequest + metadata runtime.ServerMetadata + ) + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.Attachment); err != nil && !errors.Is(err, io.EOF) { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_AttachmentService_CreateAttachment_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if req.Body != nil { + _, _ = io.Copy(io.Discard, req.Body) + } + msg, err := client.CreateAttachment(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err +} + +func local_request_AttachmentService_CreateAttachment_0(ctx context.Context, marshaler runtime.Marshaler, server AttachmentServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq CreateAttachmentRequest + metadata runtime.ServerMetadata + ) + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.Attachment); err != nil && !errors.Is(err, io.EOF) { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_AttachmentService_CreateAttachment_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + msg, err := server.CreateAttachment(ctx, &protoReq) + return msg, metadata, err +} + var filter_AttachmentService_UpdateAttachment_0 = &utilities.DoubleArray{Encoding: map[string]int{"attachment": 0, "name": 1}, Base: []int{1, 2, 1, 0, 0}, Check: []int{0, 1, 2, 3, 2}} func request_AttachmentService_UpdateAttachment_0(ctx context.Context, marshaler runtime.Marshaler, client AttachmentServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -324,59 +297,46 @@ func local_request_AttachmentService_BatchDeleteAttachments_0(ctx context.Contex return msg, metadata, err } +func request_AttachmentService_UploadAttachment_0(ctx context.Context, marshaler runtime.Marshaler, client AttachmentServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq UploadAttachmentRequest + metadata runtime.ServerMetadata + ) + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if req.Body != nil { + _, _ = io.Copy(io.Discard, req.Body) + } + msg, err := client.UploadAttachment(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err +} + +func local_request_AttachmentService_UploadAttachment_0(ctx context.Context, marshaler runtime.Marshaler, server AttachmentServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq UploadAttachmentRequest + metadata runtime.ServerMetadata + ) + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + msg, err := server.UploadAttachment(ctx, &protoReq) + return msg, metadata, err +} + // RegisterAttachmentServiceHandlerServer registers the http handlers for service AttachmentService to "mux". // UnaryRPC :call AttachmentServiceServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterAttachmentServiceHandlerFromEndpoint instead. // GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call. func RegisterAttachmentServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server AttachmentServiceServer) error { - mux.Handle(http.MethodPost, pattern_AttachmentService_CreateAttachment_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.AttachmentService/CreateAttachment", runtime.WithHTTPPathPattern("/api/v1/attachments")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_AttachmentService_CreateAttachment_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - forward_AttachmentService_CreateAttachment_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - mux.Handle(http.MethodPost, pattern_AttachmentService_UploadAttachment_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.AttachmentService/UploadAttachment", runtime.WithHTTPPathPattern("/api/v1/attachments:upload")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_AttachmentService_UploadAttachment_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - forward_AttachmentService_UploadAttachment_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle(http.MethodGet, pattern_AttachmentService_ListAttachments_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.AttachmentService/ListAttachments", runtime.WithHTTPPathPattern("/api/v1/attachments")) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.AttachmentService/ListAttachments", runtime.WithHTTPPathPattern("/api/attachments")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -396,7 +356,7 @@ func RegisterAttachmentServiceHandlerServer(ctx context.Context, mux *runtime.Se var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.AttachmentService/GetAttachment", runtime.WithHTTPPathPattern("/api/v1/{name=attachments/*}")) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.AttachmentService/GetAttachment", runtime.WithHTTPPathPattern("/api/{name=attachments/*}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -410,13 +370,33 @@ func RegisterAttachmentServiceHandlerServer(ctx context.Context, mux *runtime.Se } forward_AttachmentService_GetAttachment_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) + mux.Handle(http.MethodPost, pattern_AttachmentService_CreateAttachment_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.AttachmentService/CreateAttachment", runtime.WithHTTPPathPattern("/api/attachments")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_AttachmentService_CreateAttachment_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_AttachmentService_CreateAttachment_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) mux.Handle(http.MethodPatch, pattern_AttachmentService_UpdateAttachment_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.AttachmentService/UpdateAttachment", runtime.WithHTTPPathPattern("/api/v1/{attachment.name=attachments/*}")) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.AttachmentService/UpdateAttachment", runtime.WithHTTPPathPattern("/api/{attachment.name=attachments/*}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -436,7 +416,7 @@ func RegisterAttachmentServiceHandlerServer(ctx context.Context, mux *runtime.Se var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.AttachmentService/DeleteAttachment", runtime.WithHTTPPathPattern("/api/v1/{name=attachments/*}")) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.AttachmentService/DeleteAttachment", runtime.WithHTTPPathPattern("/api/{name=attachments/*}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -456,7 +436,7 @@ func RegisterAttachmentServiceHandlerServer(ctx context.Context, mux *runtime.Se var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.AttachmentService/BatchDeleteAttachments", runtime.WithHTTPPathPattern("/api/v1/attachments:batchDelete")) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.AttachmentService/BatchDeleteAttachments", runtime.WithHTTPPathPattern("/api/attachments:batchDelete")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -470,6 +450,26 @@ func RegisterAttachmentServiceHandlerServer(ctx context.Context, mux *runtime.Se } forward_AttachmentService_BatchDeleteAttachments_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) + mux.Handle(http.MethodPost, pattern_AttachmentService_UploadAttachment_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.AttachmentService/UploadAttachment", runtime.WithHTTPPathPattern("/api/attachments:upload")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_AttachmentService_UploadAttachment_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_AttachmentService_UploadAttachment_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) return nil } @@ -510,45 +510,11 @@ func RegisterAttachmentServiceHandler(ctx context.Context, mux *runtime.ServeMux // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in // "AttachmentServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares. func RegisterAttachmentServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client AttachmentServiceClient) error { - mux.Handle(http.MethodPost, pattern_AttachmentService_CreateAttachment_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.AttachmentService/CreateAttachment", runtime.WithHTTPPathPattern("/api/v1/attachments")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_AttachmentService_CreateAttachment_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - forward_AttachmentService_CreateAttachment_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - mux.Handle(http.MethodPost, pattern_AttachmentService_UploadAttachment_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.AttachmentService/UploadAttachment", runtime.WithHTTPPathPattern("/api/v1/attachments:upload")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_AttachmentService_UploadAttachment_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - forward_AttachmentService_UploadAttachment_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle(http.MethodGet, pattern_AttachmentService_ListAttachments_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.AttachmentService/ListAttachments", runtime.WithHTTPPathPattern("/api/v1/attachments")) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.AttachmentService/ListAttachments", runtime.WithHTTPPathPattern("/api/attachments")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -565,7 +531,7 @@ func RegisterAttachmentServiceHandlerClient(ctx context.Context, mux *runtime.Se ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.AttachmentService/GetAttachment", runtime.WithHTTPPathPattern("/api/v1/{name=attachments/*}")) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.AttachmentService/GetAttachment", runtime.WithHTTPPathPattern("/api/{name=attachments/*}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -578,11 +544,28 @@ func RegisterAttachmentServiceHandlerClient(ctx context.Context, mux *runtime.Se } forward_AttachmentService_GetAttachment_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) + mux.Handle(http.MethodPost, pattern_AttachmentService_CreateAttachment_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.AttachmentService/CreateAttachment", runtime.WithHTTPPathPattern("/api/attachments")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_AttachmentService_CreateAttachment_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_AttachmentService_CreateAttachment_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) mux.Handle(http.MethodPatch, pattern_AttachmentService_UpdateAttachment_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.AttachmentService/UpdateAttachment", runtime.WithHTTPPathPattern("/api/v1/{attachment.name=attachments/*}")) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.AttachmentService/UpdateAttachment", runtime.WithHTTPPathPattern("/api/{attachment.name=attachments/*}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -599,7 +582,7 @@ func RegisterAttachmentServiceHandlerClient(ctx context.Context, mux *runtime.Se ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.AttachmentService/DeleteAttachment", runtime.WithHTTPPathPattern("/api/v1/{name=attachments/*}")) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.AttachmentService/DeleteAttachment", runtime.WithHTTPPathPattern("/api/{name=attachments/*}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -616,7 +599,7 @@ func RegisterAttachmentServiceHandlerClient(ctx context.Context, mux *runtime.Se ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.AttachmentService/BatchDeleteAttachments", runtime.WithHTTPPathPattern("/api/v1/attachments:batchDelete")) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.AttachmentService/BatchDeleteAttachments", runtime.WithHTTPPathPattern("/api/attachments:batchDelete")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -629,25 +612,42 @@ func RegisterAttachmentServiceHandlerClient(ctx context.Context, mux *runtime.Se } forward_AttachmentService_BatchDeleteAttachments_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) + mux.Handle(http.MethodPost, pattern_AttachmentService_UploadAttachment_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.AttachmentService/UploadAttachment", runtime.WithHTTPPathPattern("/api/attachments:upload")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_AttachmentService_UploadAttachment_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_AttachmentService_UploadAttachment_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) return nil } var ( - pattern_AttachmentService_CreateAttachment_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "v1", "attachments"}, "")) - pattern_AttachmentService_UploadAttachment_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "v1", "attachments"}, "upload")) - pattern_AttachmentService_ListAttachments_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "v1", "attachments"}, "")) - pattern_AttachmentService_GetAttachment_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3}, []string{"api", "v1", "attachments", "name"}, "")) - pattern_AttachmentService_UpdateAttachment_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3}, []string{"api", "v1", "attachments", "attachment.name"}, "")) - pattern_AttachmentService_DeleteAttachment_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3}, []string{"api", "v1", "attachments", "name"}, "")) - pattern_AttachmentService_BatchDeleteAttachments_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "v1", "attachments"}, "batchDelete")) + pattern_AttachmentService_ListAttachments_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"api", "attachments"}, "")) + pattern_AttachmentService_GetAttachment_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"api", "attachments", "name"}, "")) + pattern_AttachmentService_CreateAttachment_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"api", "attachments"}, "")) + pattern_AttachmentService_UpdateAttachment_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"api", "attachments", "attachment.name"}, "")) + pattern_AttachmentService_DeleteAttachment_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"api", "attachments", "name"}, "")) + pattern_AttachmentService_BatchDeleteAttachments_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"api", "attachments"}, "batchDelete")) + pattern_AttachmentService_UploadAttachment_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"api", "attachments"}, "upload")) ) var ( - forward_AttachmentService_CreateAttachment_0 = runtime.ForwardResponseMessage - forward_AttachmentService_UploadAttachment_0 = runtime.ForwardResponseMessage forward_AttachmentService_ListAttachments_0 = runtime.ForwardResponseMessage forward_AttachmentService_GetAttachment_0 = runtime.ForwardResponseMessage + forward_AttachmentService_CreateAttachment_0 = runtime.ForwardResponseMessage forward_AttachmentService_UpdateAttachment_0 = runtime.ForwardResponseMessage forward_AttachmentService_DeleteAttachment_0 = runtime.ForwardResponseMessage forward_AttachmentService_BatchDeleteAttachments_0 = runtime.ForwardResponseMessage + forward_AttachmentService_UploadAttachment_0 = runtime.ForwardResponseMessage ) diff --git a/proto/gen/api/v1/attachment_service_grpc.pb.go b/proto/gen/api/attachment_service_grpc.pb.go similarity index 87% rename from proto/gen/api/v1/attachment_service_grpc.pb.go rename to proto/gen/api/attachment_service_grpc.pb.go index 41ba8a44c..11609f33c 100644 --- a/proto/gen/api/v1/attachment_service_grpc.pb.go +++ b/proto/gen/api/attachment_service_grpc.pb.go @@ -2,9 +2,9 @@ // versions: // - protoc-gen-go-grpc v1.6.2 // - protoc (unknown) -// source: api/v1/attachment_service.proto +// source: api/attachment_service.proto -package apiv1 +package api import ( context "context" @@ -20,36 +20,40 @@ import ( const _ = grpc.SupportPackageIsVersion9 const ( - AttachmentService_CreateAttachment_FullMethodName = "/memos.api.v1.AttachmentService/CreateAttachment" - AttachmentService_UploadAttachment_FullMethodName = "/memos.api.v1.AttachmentService/UploadAttachment" - AttachmentService_ListAttachments_FullMethodName = "/memos.api.v1.AttachmentService/ListAttachments" - AttachmentService_GetAttachment_FullMethodName = "/memos.api.v1.AttachmentService/GetAttachment" - AttachmentService_UpdateAttachment_FullMethodName = "/memos.api.v1.AttachmentService/UpdateAttachment" - AttachmentService_DeleteAttachment_FullMethodName = "/memos.api.v1.AttachmentService/DeleteAttachment" - AttachmentService_BatchDeleteAttachments_FullMethodName = "/memos.api.v1.AttachmentService/BatchDeleteAttachments" + AttachmentService_ListAttachments_FullMethodName = "/memos.api.AttachmentService/ListAttachments" + AttachmentService_GetAttachment_FullMethodName = "/memos.api.AttachmentService/GetAttachment" + AttachmentService_CreateAttachment_FullMethodName = "/memos.api.AttachmentService/CreateAttachment" + AttachmentService_UpdateAttachment_FullMethodName = "/memos.api.AttachmentService/UpdateAttachment" + AttachmentService_DeleteAttachment_FullMethodName = "/memos.api.AttachmentService/DeleteAttachment" + AttachmentService_BatchDeleteAttachments_FullMethodName = "/memos.api.AttachmentService/BatchDeleteAttachments" + AttachmentService_UploadAttachment_FullMethodName = "/memos.api.AttachmentService/UploadAttachment" ) // AttachmentServiceClient is the client API for AttachmentService service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +// +// AttachmentService manages files attached to memos. type AttachmentServiceClient interface { - // CreateAttachment creates a new attachment. + // ListAttachments lists attachments linked to memos the caller can read, plus the caller's unlinked uploads. + ListAttachments(ctx context.Context, in *ListAttachmentsRequest, opts ...grpc.CallOption) (*ListAttachmentsResponse, error) + // GetAttachment gets an attachment by name. An unlinked attachment is visible only to its uploader and admins; + // a linked attachment follows the read access of its memo. + GetAttachment(ctx context.Context, in *GetAttachmentRequest, opts ...grpc.CallOption) (*Attachment, error) + // CreateAttachment creates an attachment from inline content. CreateAttachment(ctx context.Context, in *CreateAttachmentRequest, opts ...grpc.CallOption) (*Attachment, error) - // UploadAttachment uploads a file in bounded chunks. The first call carries - // the spec and returns an upload_id; later calls carry that upload_id. - // Uploads are bound to the authenticated user, expire after 30 minutes of + // UpdateAttachment updates an attachment. Only `filename` can be updated. The caller must be the uploader or an + // admin. + UpdateAttachment(ctx context.Context, in *UpdateAttachmentRequest, opts ...grpc.CallOption) (*Attachment, error) + // DeleteAttachment deletes an attachment uploaded by the caller. + DeleteAttachment(ctx context.Context, in *DeleteAttachmentRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) + // BatchDeleteAttachments deletes up to 100 attachments in one atomic request. The caller must be the uploader of + // each attachment or an admin. + BatchDeleteAttachments(ctx context.Context, in *BatchDeleteAttachmentsRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) + // UploadAttachment uploads a file in bounded chunks. The first call carries the spec and returns an upload_id; + // later calls carry that upload_id. Uploads are bound to the authenticated user, expire after 30 minutes of // inactivity, and do not survive a server restart. UploadAttachment(ctx context.Context, in *UploadAttachmentRequest, opts ...grpc.CallOption) (*UploadAttachmentResponse, error) - // ListAttachments lists attachments linked to readable memos and the caller's unlinked uploads. - ListAttachments(ctx context.Context, in *ListAttachmentsRequest, opts ...grpc.CallOption) (*ListAttachmentsResponse, error) - // GetAttachment returns an attachment by name. - GetAttachment(ctx context.Context, in *GetAttachmentRequest, opts ...grpc.CallOption) (*Attachment, error) - // UpdateAttachment updates an attachment. - UpdateAttachment(ctx context.Context, in *UpdateAttachmentRequest, opts ...grpc.CallOption) (*Attachment, error) - // DeleteAttachment deletes an attachment by name. - DeleteAttachment(ctx context.Context, in *DeleteAttachmentRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) - // BatchDeleteAttachments deletes multiple attachments in one request. - BatchDeleteAttachments(ctx context.Context, in *BatchDeleteAttachmentsRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) } type attachmentServiceClient struct { @@ -60,26 +64,6 @@ func NewAttachmentServiceClient(cc grpc.ClientConnInterface) AttachmentServiceCl return &attachmentServiceClient{cc} } -func (c *attachmentServiceClient) CreateAttachment(ctx context.Context, in *CreateAttachmentRequest, opts ...grpc.CallOption) (*Attachment, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(Attachment) - err := c.cc.Invoke(ctx, AttachmentService_CreateAttachment_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *attachmentServiceClient) UploadAttachment(ctx context.Context, in *UploadAttachmentRequest, opts ...grpc.CallOption) (*UploadAttachmentResponse, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(UploadAttachmentResponse) - err := c.cc.Invoke(ctx, AttachmentService_UploadAttachment_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - func (c *attachmentServiceClient) ListAttachments(ctx context.Context, in *ListAttachmentsRequest, opts ...grpc.CallOption) (*ListAttachmentsResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(ListAttachmentsResponse) @@ -100,6 +84,16 @@ func (c *attachmentServiceClient) GetAttachment(ctx context.Context, in *GetAtta return out, nil } +func (c *attachmentServiceClient) CreateAttachment(ctx context.Context, in *CreateAttachmentRequest, opts ...grpc.CallOption) (*Attachment, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(Attachment) + err := c.cc.Invoke(ctx, AttachmentService_CreateAttachment_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *attachmentServiceClient) UpdateAttachment(ctx context.Context, in *UpdateAttachmentRequest, opts ...grpc.CallOption) (*Attachment, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(Attachment) @@ -130,27 +124,41 @@ func (c *attachmentServiceClient) BatchDeleteAttachments(ctx context.Context, in return out, nil } +func (c *attachmentServiceClient) UploadAttachment(ctx context.Context, in *UploadAttachmentRequest, opts ...grpc.CallOption) (*UploadAttachmentResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(UploadAttachmentResponse) + err := c.cc.Invoke(ctx, AttachmentService_UploadAttachment_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + // AttachmentServiceServer is the server API for AttachmentService service. // All implementations must embed UnimplementedAttachmentServiceServer // for forward compatibility. +// +// AttachmentService manages files attached to memos. type AttachmentServiceServer interface { - // CreateAttachment creates a new attachment. + // ListAttachments lists attachments linked to memos the caller can read, plus the caller's unlinked uploads. + ListAttachments(context.Context, *ListAttachmentsRequest) (*ListAttachmentsResponse, error) + // GetAttachment gets an attachment by name. An unlinked attachment is visible only to its uploader and admins; + // a linked attachment follows the read access of its memo. + GetAttachment(context.Context, *GetAttachmentRequest) (*Attachment, error) + // CreateAttachment creates an attachment from inline content. CreateAttachment(context.Context, *CreateAttachmentRequest) (*Attachment, error) - // UploadAttachment uploads a file in bounded chunks. The first call carries - // the spec and returns an upload_id; later calls carry that upload_id. - // Uploads are bound to the authenticated user, expire after 30 minutes of + // UpdateAttachment updates an attachment. Only `filename` can be updated. The caller must be the uploader or an + // admin. + UpdateAttachment(context.Context, *UpdateAttachmentRequest) (*Attachment, error) + // DeleteAttachment deletes an attachment uploaded by the caller. + DeleteAttachment(context.Context, *DeleteAttachmentRequest) (*emptypb.Empty, error) + // BatchDeleteAttachments deletes up to 100 attachments in one atomic request. The caller must be the uploader of + // each attachment or an admin. + BatchDeleteAttachments(context.Context, *BatchDeleteAttachmentsRequest) (*emptypb.Empty, error) + // UploadAttachment uploads a file in bounded chunks. The first call carries the spec and returns an upload_id; + // later calls carry that upload_id. Uploads are bound to the authenticated user, expire after 30 minutes of // inactivity, and do not survive a server restart. UploadAttachment(context.Context, *UploadAttachmentRequest) (*UploadAttachmentResponse, error) - // ListAttachments lists attachments linked to readable memos and the caller's unlinked uploads. - ListAttachments(context.Context, *ListAttachmentsRequest) (*ListAttachmentsResponse, error) - // GetAttachment returns an attachment by name. - GetAttachment(context.Context, *GetAttachmentRequest) (*Attachment, error) - // UpdateAttachment updates an attachment. - UpdateAttachment(context.Context, *UpdateAttachmentRequest) (*Attachment, error) - // DeleteAttachment deletes an attachment by name. - DeleteAttachment(context.Context, *DeleteAttachmentRequest) (*emptypb.Empty, error) - // BatchDeleteAttachments deletes multiple attachments in one request. - BatchDeleteAttachments(context.Context, *BatchDeleteAttachmentsRequest) (*emptypb.Empty, error) mustEmbedUnimplementedAttachmentServiceServer() } @@ -161,18 +169,15 @@ type AttachmentServiceServer interface { // pointer dereference when methods are called. type UnimplementedAttachmentServiceServer struct{} -func (UnimplementedAttachmentServiceServer) CreateAttachment(context.Context, *CreateAttachmentRequest) (*Attachment, error) { - return nil, status.Error(codes.Unimplemented, "method CreateAttachment not implemented") -} -func (UnimplementedAttachmentServiceServer) UploadAttachment(context.Context, *UploadAttachmentRequest) (*UploadAttachmentResponse, error) { - return nil, status.Error(codes.Unimplemented, "method UploadAttachment not implemented") -} func (UnimplementedAttachmentServiceServer) ListAttachments(context.Context, *ListAttachmentsRequest) (*ListAttachmentsResponse, error) { return nil, status.Error(codes.Unimplemented, "method ListAttachments not implemented") } func (UnimplementedAttachmentServiceServer) GetAttachment(context.Context, *GetAttachmentRequest) (*Attachment, error) { return nil, status.Error(codes.Unimplemented, "method GetAttachment not implemented") } +func (UnimplementedAttachmentServiceServer) CreateAttachment(context.Context, *CreateAttachmentRequest) (*Attachment, error) { + return nil, status.Error(codes.Unimplemented, "method CreateAttachment not implemented") +} func (UnimplementedAttachmentServiceServer) UpdateAttachment(context.Context, *UpdateAttachmentRequest) (*Attachment, error) { return nil, status.Error(codes.Unimplemented, "method UpdateAttachment not implemented") } @@ -182,6 +187,9 @@ func (UnimplementedAttachmentServiceServer) DeleteAttachment(context.Context, *D func (UnimplementedAttachmentServiceServer) BatchDeleteAttachments(context.Context, *BatchDeleteAttachmentsRequest) (*emptypb.Empty, error) { return nil, status.Error(codes.Unimplemented, "method BatchDeleteAttachments not implemented") } +func (UnimplementedAttachmentServiceServer) UploadAttachment(context.Context, *UploadAttachmentRequest) (*UploadAttachmentResponse, error) { + return nil, status.Error(codes.Unimplemented, "method UploadAttachment not implemented") +} func (UnimplementedAttachmentServiceServer) mustEmbedUnimplementedAttachmentServiceServer() {} func (UnimplementedAttachmentServiceServer) testEmbeddedByValue() {} @@ -203,42 +211,6 @@ func RegisterAttachmentServiceServer(s grpc.ServiceRegistrar, srv AttachmentServ s.RegisterService(&AttachmentService_ServiceDesc, srv) } -func _AttachmentService_CreateAttachment_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CreateAttachmentRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(AttachmentServiceServer).CreateAttachment(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: AttachmentService_CreateAttachment_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(AttachmentServiceServer).CreateAttachment(ctx, req.(*CreateAttachmentRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _AttachmentService_UploadAttachment_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(UploadAttachmentRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(AttachmentServiceServer).UploadAttachment(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: AttachmentService_UploadAttachment_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(AttachmentServiceServer).UploadAttachment(ctx, req.(*UploadAttachmentRequest)) - } - return interceptor(ctx, in, info, handler) -} - func _AttachmentService_ListAttachments_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ListAttachmentsRequest) if err := dec(in); err != nil { @@ -275,6 +247,24 @@ func _AttachmentService_GetAttachment_Handler(srv interface{}, ctx context.Conte return interceptor(ctx, in, info, handler) } +func _AttachmentService_CreateAttachment_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateAttachmentRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AttachmentServiceServer).CreateAttachment(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AttachmentService_CreateAttachment_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AttachmentServiceServer).CreateAttachment(ctx, req.(*CreateAttachmentRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _AttachmentService_UpdateAttachment_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(UpdateAttachmentRequest) if err := dec(in); err != nil { @@ -329,21 +319,31 @@ func _AttachmentService_BatchDeleteAttachments_Handler(srv interface{}, ctx cont return interceptor(ctx, in, info, handler) } +func _AttachmentService_UploadAttachment_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UploadAttachmentRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AttachmentServiceServer).UploadAttachment(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AttachmentService_UploadAttachment_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AttachmentServiceServer).UploadAttachment(ctx, req.(*UploadAttachmentRequest)) + } + return interceptor(ctx, in, info, handler) +} + // AttachmentService_ServiceDesc is the grpc.ServiceDesc for AttachmentService service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) var AttachmentService_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "memos.api.v1.AttachmentService", + ServiceName: "memos.api.AttachmentService", HandlerType: (*AttachmentServiceServer)(nil), Methods: []grpc.MethodDesc{ - { - MethodName: "CreateAttachment", - Handler: _AttachmentService_CreateAttachment_Handler, - }, - { - MethodName: "UploadAttachment", - Handler: _AttachmentService_UploadAttachment_Handler, - }, { MethodName: "ListAttachments", Handler: _AttachmentService_ListAttachments_Handler, @@ -352,6 +352,10 @@ var AttachmentService_ServiceDesc = grpc.ServiceDesc{ MethodName: "GetAttachment", Handler: _AttachmentService_GetAttachment_Handler, }, + { + MethodName: "CreateAttachment", + Handler: _AttachmentService_CreateAttachment_Handler, + }, { MethodName: "UpdateAttachment", Handler: _AttachmentService_UpdateAttachment_Handler, @@ -364,7 +368,11 @@ var AttachmentService_ServiceDesc = grpc.ServiceDesc{ MethodName: "BatchDeleteAttachments", Handler: _AttachmentService_BatchDeleteAttachments_Handler, }, + { + MethodName: "UploadAttachment", + Handler: _AttachmentService_UploadAttachment_Handler, + }, }, Streams: []grpc.StreamDesc{}, - Metadata: "api/v1/attachment_service.proto", + Metadata: "api/attachment_service.proto", } diff --git a/proto/gen/api/v1/auth_service.pb.go b/proto/gen/api/auth_service.pb.go similarity index 52% rename from proto/gen/api/v1/auth_service.pb.go rename to proto/gen/api/auth_service.pb.go index 19dac0c9c..0627de751 100644 --- a/proto/gen/api/v1/auth_service.pb.go +++ b/proto/gen/api/auth_service.pb.go @@ -2,9 +2,9 @@ // versions: // protoc-gen-go v1.36.12 // protoc (unknown) -// source: api/v1/auth_service.proto +// source: api/auth_service.proto -package apiv1 +package api import ( _ "google.golang.org/genproto/googleapis/api/annotations" @@ -24,95 +24,15 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -type GetCurrentUserRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *GetCurrentUserRequest) Reset() { - *x = GetCurrentUserRequest{} - mi := &file_api_v1_auth_service_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *GetCurrentUserRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetCurrentUserRequest) ProtoMessage() {} - -func (x *GetCurrentUserRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_auth_service_proto_msgTypes[0] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetCurrentUserRequest.ProtoReflect.Descriptor instead. -func (*GetCurrentUserRequest) Descriptor() ([]byte, []int) { - return file_api_v1_auth_service_proto_rawDescGZIP(), []int{0} -} - -type GetCurrentUserResponse struct { - state protoimpl.MessageState `protogen:"open.v1"` - // The authenticated user's information. - User *User `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *GetCurrentUserResponse) Reset() { - *x = GetCurrentUserResponse{} - mi := &file_api_v1_auth_service_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *GetCurrentUserResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetCurrentUserResponse) ProtoMessage() {} - -func (x *GetCurrentUserResponse) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_auth_service_proto_msgTypes[1] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetCurrentUserResponse.ProtoReflect.Descriptor instead. -func (*GetCurrentUserResponse) Descriptor() ([]byte, []int) { - return file_api_v1_auth_service_proto_rawDescGZIP(), []int{1} -} - -func (x *GetCurrentUserResponse) GetUser() *User { - if x != nil { - return x.User - } - return nil -} - +// Request message for AuthService.SignIn. type SignInRequest struct { state protoimpl.MessageState `protogen:"open.v1"` - // Authentication credentials. Provide one method. + // The credentials to authenticate with. Provide exactly one. // // Types that are valid to be assigned to Credentials: // // *SignInRequest_PasswordCredentials_ - // *SignInRequest_SsoCredentials + // *SignInRequest_SsoCredentials_ Credentials isSignInRequest_Credentials `protobuf_oneof:"credentials"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache @@ -120,7 +40,7 @@ type SignInRequest struct { func (x *SignInRequest) Reset() { *x = SignInRequest{} - mi := &file_api_v1_auth_service_proto_msgTypes[2] + mi := &file_api_auth_service_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -132,7 +52,7 @@ func (x *SignInRequest) String() string { func (*SignInRequest) ProtoMessage() {} func (x *SignInRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_auth_service_proto_msgTypes[2] + mi := &file_api_auth_service_proto_msgTypes[0] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -145,7 +65,7 @@ func (x *SignInRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use SignInRequest.ProtoReflect.Descriptor instead. func (*SignInRequest) Descriptor() ([]byte, []int) { - return file_api_v1_auth_service_proto_rawDescGZIP(), []int{2} + return file_api_auth_service_proto_rawDescGZIP(), []int{0} } func (x *SignInRequest) GetCredentials() isSignInRequest_Credentials { @@ -164,9 +84,9 @@ func (x *SignInRequest) GetPasswordCredentials() *SignInRequest_PasswordCredenti return nil } -func (x *SignInRequest) GetSsoCredentials() *SignInRequest_SSOCredentials { +func (x *SignInRequest) GetSsoCredentials() *SignInRequest_SsoCredentials { if x != nil { - if x, ok := x.Credentials.(*SignInRequest_SsoCredentials); ok { + if x, ok := x.Credentials.(*SignInRequest_SsoCredentials_); ok { return x.SsoCredentials } } @@ -178,36 +98,37 @@ type isSignInRequest_Credentials interface { } type SignInRequest_PasswordCredentials_ struct { - // Username and password authentication. + // Username and password credentials. PasswordCredentials *SignInRequest_PasswordCredentials `protobuf:"bytes,1,opt,name=password_credentials,json=passwordCredentials,proto3,oneof"` } -type SignInRequest_SsoCredentials struct { - // SSO provider authentication. - SsoCredentials *SignInRequest_SSOCredentials `protobuf:"bytes,2,opt,name=sso_credentials,json=ssoCredentials,proto3,oneof"` +type SignInRequest_SsoCredentials_ struct { + // SSO credentials from an OAuth2 authorization code flow. + SsoCredentials *SignInRequest_SsoCredentials `protobuf:"bytes,2,opt,name=sso_credentials,json=ssoCredentials,proto3,oneof"` } func (*SignInRequest_PasswordCredentials_) isSignInRequest_Credentials() {} -func (*SignInRequest_SsoCredentials) isSignInRequest_Credentials() {} +func (*SignInRequest_SsoCredentials_) isSignInRequest_Credentials() {} +// Response message for AuthService.SignIn. type SignInResponse struct { state protoimpl.MessageState `protogen:"open.v1"` - // The authenticated user's information. + // The signed-in user. User *User `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` // The short-lived access token for API requests. - // Store in memory only, not in localStorage. + // Keep it in memory only, not in localStorage. AccessToken string `protobuf:"bytes,2,opt,name=access_token,json=accessToken,proto3" json:"access_token,omitempty"` // When the access token expires. - // Client should call RefreshToken before this time. - AccessTokenExpiresAt *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=access_token_expires_at,json=accessTokenExpiresAt,proto3" json:"access_token_expires_at,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache + // Call RefreshToken before this time. + AccessTokenExpireTime *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=access_token_expire_time,json=accessTokenExpireTime,proto3" json:"access_token_expire_time,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *SignInResponse) Reset() { *x = SignInResponse{} - mi := &file_api_v1_auth_service_proto_msgTypes[3] + mi := &file_api_auth_service_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -219,7 +140,7 @@ func (x *SignInResponse) String() string { func (*SignInResponse) ProtoMessage() {} func (x *SignInResponse) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_auth_service_proto_msgTypes[3] + mi := &file_api_auth_service_proto_msgTypes[1] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -232,7 +153,7 @@ func (x *SignInResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use SignInResponse.ProtoReflect.Descriptor instead. func (*SignInResponse) Descriptor() ([]byte, []int) { - return file_api_v1_auth_service_proto_rawDescGZIP(), []int{3} + return file_api_auth_service_proto_rawDescGZIP(), []int{1} } func (x *SignInResponse) GetUser() *User { @@ -249,49 +170,15 @@ func (x *SignInResponse) GetAccessToken() string { return "" } -func (x *SignInResponse) GetAccessTokenExpiresAt() *timestamppb.Timestamp { +func (x *SignInResponse) GetAccessTokenExpireTime() *timestamppb.Timestamp { if x != nil { - return x.AccessTokenExpiresAt + return x.AccessTokenExpireTime } return nil } -type SignOutRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *SignOutRequest) Reset() { - *x = SignOutRequest{} - mi := &file_api_v1_auth_service_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *SignOutRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SignOutRequest) ProtoMessage() {} - -func (x *SignOutRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_auth_service_proto_msgTypes[4] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SignOutRequest.ProtoReflect.Descriptor instead. -func (*SignOutRequest) Descriptor() ([]byte, []int) { - return file_api_v1_auth_service_proto_rawDescGZIP(), []int{4} -} - +// Request message for AuthService.RefreshToken. +// It has no fields: the refresh token is read from the HttpOnly cookie. type RefreshTokenRequest struct { state protoimpl.MessageState `protogen:"open.v1"` unknownFields protoimpl.UnknownFields @@ -300,7 +187,7 @@ type RefreshTokenRequest struct { func (x *RefreshTokenRequest) Reset() { *x = RefreshTokenRequest{} - mi := &file_api_v1_auth_service_proto_msgTypes[5] + mi := &file_api_auth_service_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -312,7 +199,7 @@ func (x *RefreshTokenRequest) String() string { func (*RefreshTokenRequest) ProtoMessage() {} func (x *RefreshTokenRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_auth_service_proto_msgTypes[5] + mi := &file_api_auth_service_proto_msgTypes[2] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -325,22 +212,23 @@ func (x *RefreshTokenRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use RefreshTokenRequest.ProtoReflect.Descriptor instead. func (*RefreshTokenRequest) Descriptor() ([]byte, []int) { - return file_api_v1_auth_service_proto_rawDescGZIP(), []int{5} + return file_api_auth_service_proto_rawDescGZIP(), []int{2} } +// Response message for AuthService.RefreshToken. type RefreshTokenResponse struct { state protoimpl.MessageState `protogen:"open.v1"` // The new short-lived access token. AccessToken string `protobuf:"bytes,1,opt,name=access_token,json=accessToken,proto3" json:"access_token,omitempty"` - // When the access token expires. - ExpiresAt *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=expires_at,json=expiresAt,proto3" json:"expires_at,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache + // When the new access token expires. + AccessTokenExpireTime *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=access_token_expire_time,json=accessTokenExpireTime,proto3" json:"access_token_expire_time,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *RefreshTokenResponse) Reset() { *x = RefreshTokenResponse{} - mi := &file_api_v1_auth_service_proto_msgTypes[6] + mi := &file_api_auth_service_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -352,7 +240,7 @@ func (x *RefreshTokenResponse) String() string { func (*RefreshTokenResponse) ProtoMessage() {} func (x *RefreshTokenResponse) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_auth_service_proto_msgTypes[6] + mi := &file_api_auth_service_proto_msgTypes[3] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -365,7 +253,7 @@ func (x *RefreshTokenResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use RefreshTokenResponse.ProtoReflect.Descriptor instead. func (*RefreshTokenResponse) Descriptor() ([]byte, []int) { - return file_api_v1_auth_service_proto_rawDescGZIP(), []int{6} + return file_api_auth_service_proto_rawDescGZIP(), []int{3} } func (x *RefreshTokenResponse) GetAccessToken() string { @@ -375,19 +263,140 @@ func (x *RefreshTokenResponse) GetAccessToken() string { return "" } -func (x *RefreshTokenResponse) GetExpiresAt() *timestamppb.Timestamp { +func (x *RefreshTokenResponse) GetAccessTokenExpireTime() *timestamppb.Timestamp { if x != nil { - return x.ExpiresAt + return x.AccessTokenExpireTime } return nil } -// Nested message for password-based authentication credentials. +// Request message for AuthService.GetCurrentUser. +type GetCurrentUserRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetCurrentUserRequest) Reset() { + *x = GetCurrentUserRequest{} + mi := &file_api_auth_service_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetCurrentUserRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetCurrentUserRequest) ProtoMessage() {} + +func (x *GetCurrentUserRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_auth_service_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetCurrentUserRequest.ProtoReflect.Descriptor instead. +func (*GetCurrentUserRequest) Descriptor() ([]byte, []int) { + return file_api_auth_service_proto_rawDescGZIP(), []int{4} +} + +// Response message for AuthService.GetCurrentUser. +type GetCurrentUserResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The authenticated user. + User *User `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetCurrentUserResponse) Reset() { + *x = GetCurrentUserResponse{} + mi := &file_api_auth_service_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetCurrentUserResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetCurrentUserResponse) ProtoMessage() {} + +func (x *GetCurrentUserResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_auth_service_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetCurrentUserResponse.ProtoReflect.Descriptor instead. +func (*GetCurrentUserResponse) Descriptor() ([]byte, []int) { + return file_api_auth_service_proto_rawDescGZIP(), []int{5} +} + +func (x *GetCurrentUserResponse) GetUser() *User { + if x != nil { + return x.User + } + return nil +} + +// Request message for AuthService.SignOut. +type SignOutRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SignOutRequest) Reset() { + *x = SignOutRequest{} + mi := &file_api_auth_service_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SignOutRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SignOutRequest) ProtoMessage() {} + +func (x *SignOutRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_auth_service_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SignOutRequest.ProtoReflect.Descriptor instead. +func (*SignOutRequest) Descriptor() ([]byte, []int) { + return file_api_auth_service_proto_rawDescGZIP(), []int{6} +} + +// PasswordCredentials are a username and password. +// Regular users cannot use them when the instance disallows password sign-in. type SignInRequest_PasswordCredentials struct { state protoimpl.MessageState `protogen:"open.v1"` - // The username to sign in with. + // Required. The username to sign in with. Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"` - // The password to sign in with. + // Required. The password to sign in with. Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache @@ -395,7 +404,7 @@ type SignInRequest_PasswordCredentials struct { func (x *SignInRequest_PasswordCredentials) Reset() { *x = SignInRequest_PasswordCredentials{} - mi := &file_api_v1_auth_service_proto_msgTypes[7] + mi := &file_api_auth_service_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -407,7 +416,7 @@ func (x *SignInRequest_PasswordCredentials) String() string { func (*SignInRequest_PasswordCredentials) ProtoMessage() {} func (x *SignInRequest_PasswordCredentials) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_auth_service_proto_msgTypes[7] + mi := &file_api_auth_service_proto_msgTypes[7] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -420,7 +429,7 @@ func (x *SignInRequest_PasswordCredentials) ProtoReflect() protoreflect.Message // Deprecated: Use SignInRequest_PasswordCredentials.ProtoReflect.Descriptor instead. func (*SignInRequest_PasswordCredentials) Descriptor() ([]byte, []int) { - return file_api_v1_auth_service_proto_rawDescGZIP(), []int{2, 0} + return file_api_auth_service_proto_rawDescGZIP(), []int{0, 0} } func (x *SignInRequest_PasswordCredentials) GetUsername() string { @@ -437,38 +446,38 @@ func (x *SignInRequest_PasswordCredentials) GetPassword() string { return "" } -// Nested message for SSO authentication credentials. -type SignInRequest_SSOCredentials struct { +// SsoCredentials are the result of an OAuth2 authorization code flow with an identity provider. +// A first sign-in creates a local user unless the instance disallows user registration. +type SignInRequest_SsoCredentials struct { state protoimpl.MessageState `protogen:"open.v1"` - // The resource name of the SSO provider. + // Required. The resource name of the identity provider. // Format: identity-providers/{idp} - IdpName string `protobuf:"bytes,1,opt,name=idp_name,json=idpName,proto3" json:"idp_name,omitempty"` - // The authorization code from the SSO provider. + IdentityProvider string `protobuf:"bytes,1,opt,name=identity_provider,json=identityProvider,proto3" json:"identity_provider,omitempty"` + // Required. The authorization code returned by the identity provider. Code string `protobuf:"bytes,2,opt,name=code,proto3" json:"code,omitempty"` - // The redirect URI used in the SSO flow. + // Required. The redirect URI used in the authorization request. RedirectUri string `protobuf:"bytes,3,opt,name=redirect_uri,json=redirectUri,proto3" json:"redirect_uri,omitempty"` - // The PKCE code verifier for enhanced security (RFC 7636). - // Optional - enables PKCE flow protection against authorization code interception. + // Optional. The PKCE code verifier (RFC 7636). Set it when the authorization request used a code challenge. CodeVerifier string `protobuf:"bytes,4,opt,name=code_verifier,json=codeVerifier,proto3" json:"code_verifier,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } -func (x *SignInRequest_SSOCredentials) Reset() { - *x = SignInRequest_SSOCredentials{} - mi := &file_api_v1_auth_service_proto_msgTypes[8] +func (x *SignInRequest_SsoCredentials) Reset() { + *x = SignInRequest_SsoCredentials{} + mi := &file_api_auth_service_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } -func (x *SignInRequest_SSOCredentials) String() string { +func (x *SignInRequest_SsoCredentials) String() string { return protoimpl.X.MessageStringOf(x) } -func (*SignInRequest_SSOCredentials) ProtoMessage() {} +func (*SignInRequest_SsoCredentials) ProtoMessage() {} -func (x *SignInRequest_SSOCredentials) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_auth_service_proto_msgTypes[8] +func (x *SignInRequest_SsoCredentials) ProtoReflect() protoreflect.Message { + mi := &file_api_auth_service_proto_msgTypes[8] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -479,118 +488,119 @@ func (x *SignInRequest_SSOCredentials) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use SignInRequest_SSOCredentials.ProtoReflect.Descriptor instead. -func (*SignInRequest_SSOCredentials) Descriptor() ([]byte, []int) { - return file_api_v1_auth_service_proto_rawDescGZIP(), []int{2, 1} +// Deprecated: Use SignInRequest_SsoCredentials.ProtoReflect.Descriptor instead. +func (*SignInRequest_SsoCredentials) Descriptor() ([]byte, []int) { + return file_api_auth_service_proto_rawDescGZIP(), []int{0, 1} } -func (x *SignInRequest_SSOCredentials) GetIdpName() string { +func (x *SignInRequest_SsoCredentials) GetIdentityProvider() string { if x != nil { - return x.IdpName + return x.IdentityProvider } return "" } -func (x *SignInRequest_SSOCredentials) GetCode() string { +func (x *SignInRequest_SsoCredentials) GetCode() string { if x != nil { return x.Code } return "" } -func (x *SignInRequest_SSOCredentials) GetRedirectUri() string { +func (x *SignInRequest_SsoCredentials) GetRedirectUri() string { if x != nil { return x.RedirectUri } return "" } -func (x *SignInRequest_SSOCredentials) GetCodeVerifier() string { +func (x *SignInRequest_SsoCredentials) GetCodeVerifier() string { if x != nil { return x.CodeVerifier } return "" } -var File_api_v1_auth_service_proto protoreflect.FileDescriptor +var File_api_auth_service_proto protoreflect.FileDescriptor -const file_api_v1_auth_service_proto_rawDesc = "" + +const file_api_auth_service_proto_rawDesc = "" + "\n" + - "\x19api/v1/auth_service.proto\x12\fmemos.api.v1\x1a\x19api/v1/user_service.proto\x1a\x1cgoogle/api/annotations.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"\x17\n" + - "\x15GetCurrentUserRequest\"@\n" + - "\x16GetCurrentUserResponse\x12&\n" + - "\x04user\x18\x01 \x01(\v2\x12.memos.api.v1.UserR\x04user\"\xd2\x03\n" + - "\rSignInRequest\x12d\n" + - "\x14password_credentials\x18\x01 \x01(\v2/.memos.api.v1.SignInRequest.PasswordCredentialsH\x00R\x13passwordCredentials\x12U\n" + - "\x0fsso_credentials\x18\x02 \x01(\v2*.memos.api.v1.SignInRequest.SSOCredentialsH\x00R\x0essoCredentials\x1aW\n" + + "\x16api/auth_service.proto\x12\tmemos.api\x1a\x16api/user_service.proto\x1a\x1cgoogle/api/annotations.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"\xfd\x03\n" + + "\rSignInRequest\x12a\n" + + "\x14password_credentials\x18\x01 \x01(\v2,.memos.api.SignInRequest.PasswordCredentialsH\x00R\x13passwordCredentials\x12R\n" + + "\x0fsso_credentials\x18\x02 \x01(\v2'.memos.api.SignInRequest.SsoCredentialsH\x00R\x0essoCredentials\x1aW\n" + "\x13PasswordCredentials\x12\x1f\n" + "\busername\x18\x01 \x01(\tB\x03\xe0A\x02R\busername\x12\x1f\n" + - "\bpassword\x18\x02 \x01(\tB\x03\xe0A\x02R\bpassword\x1a\x9b\x01\n" + - "\x0eSSOCredentials\x12\x1e\n" + - "\bidp_name\x18\x01 \x01(\tB\x03\xe0A\x02R\aidpName\x12\x17\n" + + "\bpassword\x18\x02 \x01(\tB\x03\xe0A\x02R\bpassword\x1a\xcc\x01\n" + + "\x0eSsoCredentials\x12O\n" + + "\x11identity_provider\x18\x01 \x01(\tB\"\xe0A\x02\xfaA\x1c\n" + + "\x1amemos.api/IdentityProviderR\x10identityProvider\x12\x17\n" + "\x04code\x18\x02 \x01(\tB\x03\xe0A\x02R\x04code\x12&\n" + "\fredirect_uri\x18\x03 \x01(\tB\x03\xe0A\x02R\vredirectUri\x12(\n" + "\rcode_verifier\x18\x04 \x01(\tB\x03\xe0A\x01R\fcodeVerifierB\r\n" + - "\vcredentials\"\xae\x01\n" + - "\x0eSignInResponse\x12&\n" + - "\x04user\x18\x01 \x01(\v2\x12.memos.api.v1.UserR\x04user\x12!\n" + - "\faccess_token\x18\x02 \x01(\tR\vaccessToken\x12Q\n" + - "\x17access_token_expires_at\x18\x03 \x01(\v2\x1a.google.protobuf.TimestampR\x14accessTokenExpiresAt\"\x10\n" + - "\x0eSignOutRequest\"\x15\n" + - "\x13RefreshTokenRequest\"t\n" + + "\vcredentials\"\xad\x01\n" + + "\x0eSignInResponse\x12#\n" + + "\x04user\x18\x01 \x01(\v2\x0f.memos.api.UserR\x04user\x12!\n" + + "\faccess_token\x18\x02 \x01(\tR\vaccessToken\x12S\n" + + "\x18access_token_expire_time\x18\x03 \x01(\v2\x1a.google.protobuf.TimestampR\x15accessTokenExpireTime\"\x15\n" + + "\x13RefreshTokenRequest\"\x8e\x01\n" + "\x14RefreshTokenResponse\x12!\n" + - "\faccess_token\x18\x01 \x01(\tR\vaccessToken\x129\n" + - "\n" + - "expires_at\x18\x02 \x01(\v2\x1a.google.protobuf.TimestampR\texpiresAt2\xbf\x03\n" + - "\vAuthService\x12t\n" + - "\x0eGetCurrentUser\x12#.memos.api.v1.GetCurrentUserRequest\x1a$.memos.api.v1.GetCurrentUserResponse\"\x17\x82\xd3\xe4\x93\x02\x11\x12\x0f/api/v1/auth/me\x12c\n" + - "\x06SignIn\x12\x1b.memos.api.v1.SignInRequest\x1a\x1c.memos.api.v1.SignInResponse\"\x1e\x82\xd3\xe4\x93\x02\x18:\x01*\"\x13/api/v1/auth/signin\x12]\n" + - "\aSignOut\x12\x1c.memos.api.v1.SignOutRequest\x1a\x16.google.protobuf.Empty\"\x1c\x82\xd3\xe4\x93\x02\x16\"\x14/api/v1/auth/signout\x12v\n" + - "\fRefreshToken\x12!.memos.api.v1.RefreshTokenRequest\x1a\".memos.api.v1.RefreshTokenResponse\"\x1f\x82\xd3\xe4\x93\x02\x19:\x01*\"\x14/api/v1/auth/refreshB\xa8\x01\n" + - "\x10com.memos.api.v1B\x10AuthServiceProtoP\x01Z0github.com/usememos/memos/proto/gen/api/v1;apiv1\xa2\x02\x03MAX\xaa\x02\fMemos.Api.V1\xca\x02\fMemos\\Api\\V1\xe2\x02\x18Memos\\Api\\V1\\GPBMetadata\xea\x02\x0eMemos::Api::V1b\x06proto3" + "\faccess_token\x18\x01 \x01(\tR\vaccessToken\x12S\n" + + "\x18access_token_expire_time\x18\x02 \x01(\v2\x1a.google.protobuf.TimestampR\x15accessTokenExpireTime\"\x17\n" + + "\x15GetCurrentUserRequest\"=\n" + + "\x16GetCurrentUserResponse\x12#\n" + + "\x04user\x18\x01 \x01(\v2\x0f.memos.api.UserR\x04user\"\x10\n" + + "\x0eSignOutRequest2\x9e\x03\n" + + "\vAuthService\x12Z\n" + + "\x06SignIn\x12\x18.memos.api.SignInRequest\x1a\x19.memos.api.SignInResponse\"\x1b\x82\xd3\xe4\x93\x02\x15:\x01*\"\x10/api/auth/signin\x12m\n" + + "\fRefreshToken\x12\x1e.memos.api.RefreshTokenRequest\x1a\x1f.memos.api.RefreshTokenResponse\"\x1c\x82\xd3\xe4\x93\x02\x16:\x01*\"\x11/api/auth/refresh\x12k\n" + + "\x0eGetCurrentUser\x12 .memos.api.GetCurrentUserRequest\x1a!.memos.api.GetCurrentUserResponse\"\x14\x82\xd3\xe4\x93\x02\x0e\x12\f/api/auth/me\x12W\n" + + "\aSignOut\x12\x19.memos.api.SignOutRequest\x1a\x16.google.protobuf.Empty\"\x19\x82\xd3\xe4\x93\x02\x13\"\x11/api/auth/signoutB\x8f\x01\n" + + "\rcom.memos.apiB\x10AuthServiceProtoP\x01Z'github.com/usememos/memos/proto/gen/api\xa2\x02\x03MAX\xaa\x02\tMemos.Api\xca\x02\tMemos\\Api\xe2\x02\x15Memos\\Api\\GPBMetadata\xea\x02\n" + + "Memos::Apib\x06proto3" var ( - file_api_v1_auth_service_proto_rawDescOnce sync.Once - file_api_v1_auth_service_proto_rawDescData []byte + file_api_auth_service_proto_rawDescOnce sync.Once + file_api_auth_service_proto_rawDescData []byte ) -func file_api_v1_auth_service_proto_rawDescGZIP() []byte { - file_api_v1_auth_service_proto_rawDescOnce.Do(func() { - file_api_v1_auth_service_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_api_v1_auth_service_proto_rawDesc), len(file_api_v1_auth_service_proto_rawDesc))) +func file_api_auth_service_proto_rawDescGZIP() []byte { + file_api_auth_service_proto_rawDescOnce.Do(func() { + file_api_auth_service_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_api_auth_service_proto_rawDesc), len(file_api_auth_service_proto_rawDesc))) }) - return file_api_v1_auth_service_proto_rawDescData + return file_api_auth_service_proto_rawDescData } -var file_api_v1_auth_service_proto_msgTypes = make([]protoimpl.MessageInfo, 9) -var file_api_v1_auth_service_proto_goTypes = []any{ - (*GetCurrentUserRequest)(nil), // 0: memos.api.v1.GetCurrentUserRequest - (*GetCurrentUserResponse)(nil), // 1: memos.api.v1.GetCurrentUserResponse - (*SignInRequest)(nil), // 2: memos.api.v1.SignInRequest - (*SignInResponse)(nil), // 3: memos.api.v1.SignInResponse - (*SignOutRequest)(nil), // 4: memos.api.v1.SignOutRequest - (*RefreshTokenRequest)(nil), // 5: memos.api.v1.RefreshTokenRequest - (*RefreshTokenResponse)(nil), // 6: memos.api.v1.RefreshTokenResponse - (*SignInRequest_PasswordCredentials)(nil), // 7: memos.api.v1.SignInRequest.PasswordCredentials - (*SignInRequest_SSOCredentials)(nil), // 8: memos.api.v1.SignInRequest.SSOCredentials - (*User)(nil), // 9: memos.api.v1.User +var file_api_auth_service_proto_msgTypes = make([]protoimpl.MessageInfo, 9) +var file_api_auth_service_proto_goTypes = []any{ + (*SignInRequest)(nil), // 0: memos.api.SignInRequest + (*SignInResponse)(nil), // 1: memos.api.SignInResponse + (*RefreshTokenRequest)(nil), // 2: memos.api.RefreshTokenRequest + (*RefreshTokenResponse)(nil), // 3: memos.api.RefreshTokenResponse + (*GetCurrentUserRequest)(nil), // 4: memos.api.GetCurrentUserRequest + (*GetCurrentUserResponse)(nil), // 5: memos.api.GetCurrentUserResponse + (*SignOutRequest)(nil), // 6: memos.api.SignOutRequest + (*SignInRequest_PasswordCredentials)(nil), // 7: memos.api.SignInRequest.PasswordCredentials + (*SignInRequest_SsoCredentials)(nil), // 8: memos.api.SignInRequest.SsoCredentials + (*User)(nil), // 9: memos.api.User (*timestamppb.Timestamp)(nil), // 10: google.protobuf.Timestamp (*emptypb.Empty)(nil), // 11: google.protobuf.Empty } -var file_api_v1_auth_service_proto_depIdxs = []int32{ - 9, // 0: memos.api.v1.GetCurrentUserResponse.user:type_name -> memos.api.v1.User - 7, // 1: memos.api.v1.SignInRequest.password_credentials:type_name -> memos.api.v1.SignInRequest.PasswordCredentials - 8, // 2: memos.api.v1.SignInRequest.sso_credentials:type_name -> memos.api.v1.SignInRequest.SSOCredentials - 9, // 3: memos.api.v1.SignInResponse.user:type_name -> memos.api.v1.User - 10, // 4: memos.api.v1.SignInResponse.access_token_expires_at:type_name -> google.protobuf.Timestamp - 10, // 5: memos.api.v1.RefreshTokenResponse.expires_at:type_name -> google.protobuf.Timestamp - 0, // 6: memos.api.v1.AuthService.GetCurrentUser:input_type -> memos.api.v1.GetCurrentUserRequest - 2, // 7: memos.api.v1.AuthService.SignIn:input_type -> memos.api.v1.SignInRequest - 4, // 8: memos.api.v1.AuthService.SignOut:input_type -> memos.api.v1.SignOutRequest - 5, // 9: memos.api.v1.AuthService.RefreshToken:input_type -> memos.api.v1.RefreshTokenRequest - 1, // 10: memos.api.v1.AuthService.GetCurrentUser:output_type -> memos.api.v1.GetCurrentUserResponse - 3, // 11: memos.api.v1.AuthService.SignIn:output_type -> memos.api.v1.SignInResponse - 11, // 12: memos.api.v1.AuthService.SignOut:output_type -> google.protobuf.Empty - 6, // 13: memos.api.v1.AuthService.RefreshToken:output_type -> memos.api.v1.RefreshTokenResponse +var file_api_auth_service_proto_depIdxs = []int32{ + 7, // 0: memos.api.SignInRequest.password_credentials:type_name -> memos.api.SignInRequest.PasswordCredentials + 8, // 1: memos.api.SignInRequest.sso_credentials:type_name -> memos.api.SignInRequest.SsoCredentials + 9, // 2: memos.api.SignInResponse.user:type_name -> memos.api.User + 10, // 3: memos.api.SignInResponse.access_token_expire_time:type_name -> google.protobuf.Timestamp + 10, // 4: memos.api.RefreshTokenResponse.access_token_expire_time:type_name -> google.protobuf.Timestamp + 9, // 5: memos.api.GetCurrentUserResponse.user:type_name -> memos.api.User + 0, // 6: memos.api.AuthService.SignIn:input_type -> memos.api.SignInRequest + 2, // 7: memos.api.AuthService.RefreshToken:input_type -> memos.api.RefreshTokenRequest + 4, // 8: memos.api.AuthService.GetCurrentUser:input_type -> memos.api.GetCurrentUserRequest + 6, // 9: memos.api.AuthService.SignOut:input_type -> memos.api.SignOutRequest + 1, // 10: memos.api.AuthService.SignIn:output_type -> memos.api.SignInResponse + 3, // 11: memos.api.AuthService.RefreshToken:output_type -> memos.api.RefreshTokenResponse + 5, // 12: memos.api.AuthService.GetCurrentUser:output_type -> memos.api.GetCurrentUserResponse + 11, // 13: memos.api.AuthService.SignOut:output_type -> google.protobuf.Empty 10, // [10:14] is the sub-list for method output_type 6, // [6:10] is the sub-list for method input_type 6, // [6:6] is the sub-list for extension type_name @@ -598,31 +608,31 @@ var file_api_v1_auth_service_proto_depIdxs = []int32{ 0, // [0:6] is the sub-list for field type_name } -func init() { file_api_v1_auth_service_proto_init() } -func file_api_v1_auth_service_proto_init() { - if File_api_v1_auth_service_proto != nil { +func init() { file_api_auth_service_proto_init() } +func file_api_auth_service_proto_init() { + if File_api_auth_service_proto != nil { return } - file_api_v1_user_service_proto_init() - file_api_v1_auth_service_proto_msgTypes[2].OneofWrappers = []any{ + file_api_user_service_proto_init() + file_api_auth_service_proto_msgTypes[0].OneofWrappers = []any{ (*SignInRequest_PasswordCredentials_)(nil), - (*SignInRequest_SsoCredentials)(nil), + (*SignInRequest_SsoCredentials_)(nil), } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: unsafe.Slice(unsafe.StringData(file_api_v1_auth_service_proto_rawDesc), len(file_api_v1_auth_service_proto_rawDesc)), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_api_auth_service_proto_rawDesc), len(file_api_auth_service_proto_rawDesc)), NumEnums: 0, NumMessages: 9, NumExtensions: 0, NumServices: 1, }, - GoTypes: file_api_v1_auth_service_proto_goTypes, - DependencyIndexes: file_api_v1_auth_service_proto_depIdxs, - MessageInfos: file_api_v1_auth_service_proto_msgTypes, + GoTypes: file_api_auth_service_proto_goTypes, + DependencyIndexes: file_api_auth_service_proto_depIdxs, + MessageInfos: file_api_auth_service_proto_msgTypes, }.Build() - File_api_v1_auth_service_proto = out.File - file_api_v1_auth_service_proto_goTypes = nil - file_api_v1_auth_service_proto_depIdxs = nil + File_api_auth_service_proto = out.File + file_api_auth_service_proto_goTypes = nil + file_api_auth_service_proto_depIdxs = nil } diff --git a/proto/gen/api/v1/auth_service.pb.gw.go b/proto/gen/api/auth_service.pb.gw.go similarity index 92% rename from proto/gen/api/v1/auth_service.pb.gw.go rename to proto/gen/api/auth_service.pb.gw.go index 77abeeda8..e77b07da8 100644 --- a/proto/gen/api/v1/auth_service.pb.gw.go +++ b/proto/gen/api/auth_service.pb.gw.go @@ -1,12 +1,12 @@ // Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: api/v1/auth_service.proto +// source: api/auth_service.proto /* -Package apiv1 is a reverse proxy. +Package api is a reverse proxy. It translates gRPC into RESTful JSON APIs. */ -package apiv1 +package api import ( "context" @@ -35,27 +35,6 @@ var ( _ = metadata.Join ) -func request_AuthService_GetCurrentUser_0(ctx context.Context, marshaler runtime.Marshaler, client AuthServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var ( - protoReq GetCurrentUserRequest - metadata runtime.ServerMetadata - ) - if req.Body != nil { - _, _ = io.Copy(io.Discard, req.Body) - } - msg, err := client.GetCurrentUser(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err -} - -func local_request_AuthService_GetCurrentUser_0(ctx context.Context, marshaler runtime.Marshaler, server AuthServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var ( - protoReq GetCurrentUserRequest - metadata runtime.ServerMetadata - ) - msg, err := server.GetCurrentUser(ctx, &protoReq) - return msg, metadata, err -} - func request_AuthService_SignIn_0(ctx context.Context, marshaler runtime.Marshaler, client AuthServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var ( protoReq SignInRequest @@ -83,27 +62,6 @@ func local_request_AuthService_SignIn_0(ctx context.Context, marshaler runtime.M return msg, metadata, err } -func request_AuthService_SignOut_0(ctx context.Context, marshaler runtime.Marshaler, client AuthServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var ( - protoReq SignOutRequest - metadata runtime.ServerMetadata - ) - if req.Body != nil { - _, _ = io.Copy(io.Discard, req.Body) - } - msg, err := client.SignOut(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err -} - -func local_request_AuthService_SignOut_0(ctx context.Context, marshaler runtime.Marshaler, server AuthServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var ( - protoReq SignOutRequest - metadata runtime.ServerMetadata - ) - msg, err := server.SignOut(ctx, &protoReq) - return msg, metadata, err -} - func request_AuthService_RefreshToken_0(ctx context.Context, marshaler runtime.Marshaler, client AuthServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var ( protoReq RefreshTokenRequest @@ -131,39 +89,61 @@ func local_request_AuthService_RefreshToken_0(ctx context.Context, marshaler run return msg, metadata, err } +func request_AuthService_GetCurrentUser_0(ctx context.Context, marshaler runtime.Marshaler, client AuthServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq GetCurrentUserRequest + metadata runtime.ServerMetadata + ) + if req.Body != nil { + _, _ = io.Copy(io.Discard, req.Body) + } + msg, err := client.GetCurrentUser(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err +} + +func local_request_AuthService_GetCurrentUser_0(ctx context.Context, marshaler runtime.Marshaler, server AuthServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq GetCurrentUserRequest + metadata runtime.ServerMetadata + ) + msg, err := server.GetCurrentUser(ctx, &protoReq) + return msg, metadata, err +} + +func request_AuthService_SignOut_0(ctx context.Context, marshaler runtime.Marshaler, client AuthServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq SignOutRequest + metadata runtime.ServerMetadata + ) + if req.Body != nil { + _, _ = io.Copy(io.Discard, req.Body) + } + msg, err := client.SignOut(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err +} + +func local_request_AuthService_SignOut_0(ctx context.Context, marshaler runtime.Marshaler, server AuthServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq SignOutRequest + metadata runtime.ServerMetadata + ) + msg, err := server.SignOut(ctx, &protoReq) + return msg, metadata, err +} + // RegisterAuthServiceHandlerServer registers the http handlers for service AuthService to "mux". // UnaryRPC :call AuthServiceServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterAuthServiceHandlerFromEndpoint instead. // GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call. func RegisterAuthServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server AuthServiceServer) error { - mux.Handle(http.MethodGet, pattern_AuthService_GetCurrentUser_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.AuthService/GetCurrentUser", runtime.WithHTTPPathPattern("/api/v1/auth/me")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_AuthService_GetCurrentUser_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - forward_AuthService_GetCurrentUser_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle(http.MethodPost, pattern_AuthService_SignIn_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.AuthService/SignIn", runtime.WithHTTPPathPattern("/api/v1/auth/signin")) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.AuthService/SignIn", runtime.WithHTTPPathPattern("/api/auth/signin")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -177,33 +157,13 @@ func RegisterAuthServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux } forward_AuthService_SignIn_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle(http.MethodPost, pattern_AuthService_SignOut_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.AuthService/SignOut", runtime.WithHTTPPathPattern("/api/v1/auth/signout")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_AuthService_SignOut_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - forward_AuthService_SignOut_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle(http.MethodPost, pattern_AuthService_RefreshToken_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.AuthService/RefreshToken", runtime.WithHTTPPathPattern("/api/v1/auth/refresh")) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.AuthService/RefreshToken", runtime.WithHTTPPathPattern("/api/auth/refresh")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -217,6 +177,46 @@ func RegisterAuthServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux } forward_AuthService_RefreshToken_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) + mux.Handle(http.MethodGet, pattern_AuthService_GetCurrentUser_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.AuthService/GetCurrentUser", runtime.WithHTTPPathPattern("/api/auth/me")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_AuthService_GetCurrentUser_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_AuthService_GetCurrentUser_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) + mux.Handle(http.MethodPost, pattern_AuthService_SignOut_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.AuthService/SignOut", runtime.WithHTTPPathPattern("/api/auth/signout")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_AuthService_SignOut_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_AuthService_SignOut_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) return nil } @@ -257,28 +257,11 @@ func RegisterAuthServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in // "AuthServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares. func RegisterAuthServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client AuthServiceClient) error { - mux.Handle(http.MethodGet, pattern_AuthService_GetCurrentUser_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.AuthService/GetCurrentUser", runtime.WithHTTPPathPattern("/api/v1/auth/me")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_AuthService_GetCurrentUser_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - forward_AuthService_GetCurrentUser_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle(http.MethodPost, pattern_AuthService_SignIn_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.AuthService/SignIn", runtime.WithHTTPPathPattern("/api/v1/auth/signin")) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.AuthService/SignIn", runtime.WithHTTPPathPattern("/api/auth/signin")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -291,28 +274,11 @@ func RegisterAuthServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux } forward_AuthService_SignIn_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle(http.MethodPost, pattern_AuthService_SignOut_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.AuthService/SignOut", runtime.WithHTTPPathPattern("/api/v1/auth/signout")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_AuthService_SignOut_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - forward_AuthService_SignOut_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle(http.MethodPost, pattern_AuthService_RefreshToken_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.AuthService/RefreshToken", runtime.WithHTTPPathPattern("/api/v1/auth/refresh")) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.AuthService/RefreshToken", runtime.WithHTTPPathPattern("/api/auth/refresh")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -325,19 +291,53 @@ func RegisterAuthServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux } forward_AuthService_RefreshToken_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) + mux.Handle(http.MethodGet, pattern_AuthService_GetCurrentUser_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.AuthService/GetCurrentUser", runtime.WithHTTPPathPattern("/api/auth/me")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_AuthService_GetCurrentUser_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_AuthService_GetCurrentUser_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) + mux.Handle(http.MethodPost, pattern_AuthService_SignOut_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.AuthService/SignOut", runtime.WithHTTPPathPattern("/api/auth/signout")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_AuthService_SignOut_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_AuthService_SignOut_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) return nil } var ( - pattern_AuthService_GetCurrentUser_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"api", "v1", "auth", "me"}, "")) - pattern_AuthService_SignIn_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"api", "v1", "auth", "signin"}, "")) - pattern_AuthService_SignOut_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"api", "v1", "auth", "signout"}, "")) - pattern_AuthService_RefreshToken_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"api", "v1", "auth", "refresh"}, "")) + pattern_AuthService_SignIn_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "auth", "signin"}, "")) + pattern_AuthService_RefreshToken_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "auth", "refresh"}, "")) + pattern_AuthService_GetCurrentUser_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "auth", "me"}, "")) + pattern_AuthService_SignOut_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "auth", "signout"}, "")) ) var ( - forward_AuthService_GetCurrentUser_0 = runtime.ForwardResponseMessage forward_AuthService_SignIn_0 = runtime.ForwardResponseMessage - forward_AuthService_SignOut_0 = runtime.ForwardResponseMessage forward_AuthService_RefreshToken_0 = runtime.ForwardResponseMessage + forward_AuthService_GetCurrentUser_0 = runtime.ForwardResponseMessage + forward_AuthService_SignOut_0 = runtime.ForwardResponseMessage ) diff --git a/proto/gen/api/v1/auth_service_grpc.pb.go b/proto/gen/api/auth_service_grpc.pb.go similarity index 78% rename from proto/gen/api/v1/auth_service_grpc.pb.go rename to proto/gen/api/auth_service_grpc.pb.go index 82fdd0943..501799791 100644 --- a/proto/gen/api/v1/auth_service_grpc.pb.go +++ b/proto/gen/api/auth_service_grpc.pb.go @@ -2,9 +2,9 @@ // versions: // - protoc-gen-go-grpc v1.6.2 // - protoc (unknown) -// source: api/v1/auth_service.proto +// source: api/auth_service.proto -package apiv1 +package api import ( context "context" @@ -20,31 +20,34 @@ import ( const _ = grpc.SupportPackageIsVersion9 const ( - AuthService_GetCurrentUser_FullMethodName = "/memos.api.v1.AuthService/GetCurrentUser" - AuthService_SignIn_FullMethodName = "/memos.api.v1.AuthService/SignIn" - AuthService_SignOut_FullMethodName = "/memos.api.v1.AuthService/SignOut" - AuthService_RefreshToken_FullMethodName = "/memos.api.v1.AuthService/RefreshToken" + AuthService_SignIn_FullMethodName = "/memos.api.AuthService/SignIn" + AuthService_RefreshToken_FullMethodName = "/memos.api.AuthService/RefreshToken" + AuthService_GetCurrentUser_FullMethodName = "/memos.api.AuthService/GetCurrentUser" + AuthService_SignOut_FullMethodName = "/memos.api.AuthService/SignOut" ) // AuthServiceClient is the client API for AuthService service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +// +// AuthService manages sign-in sessions: it issues, refreshes, and revokes the tokens that authenticate API calls. type AuthServiceClient interface { - // GetCurrentUser returns the authenticated user's information. - // Validates the access token and returns user details. - // Similar to OIDC's /userinfo endpoint. - GetCurrentUser(ctx context.Context, in *GetCurrentUserRequest, opts ...grpc.CallOption) (*GetCurrentUserResponse, error) - // SignIn authenticates a user with credentials and returns tokens. - // On success, returns an access token and sets a refresh token cookie. - // Supports password-based and SSO authentication methods. + // SignIn authenticates a user with password or SSO credentials. + // On success, returns a short-lived access token and sets a refresh token in an HttpOnly cookie. + // Public. Attempts are rate limited. Archived users cannot sign in. SignIn(ctx context.Context, in *SignInRequest, opts ...grpc.CallOption) (*SignInResponse, error) - // SignOut terminates the user's authentication. - // Revokes the refresh token and clears the authentication cookie. - SignOut(ctx context.Context, in *SignOutRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) - // RefreshToken exchanges a valid refresh token for a new access token. - // The refresh token is read from the HttpOnly cookie. - // Returns a new short-lived access token. + // RefreshToken exchanges the refresh token for a new access token. + // The refresh token is read from the HttpOnly cookie and rotated: the old token is revoked and a new one with a + // fresh 30-day expiry is set in the cookie. + // Public, so it can be called after the access token has expired. RefreshToken(ctx context.Context, in *RefreshTokenRequest, opts ...grpc.CallOption) (*RefreshTokenResponse, error) + // GetCurrentUser returns the authenticated user, similar to OIDC's /userinfo endpoint. + // When the caller is not signed in or the account is no longer active, clears the refresh token cookie and returns + // UNAUTHENTICATED. + GetCurrentUser(ctx context.Context, in *GetCurrentUserRequest, opts ...grpc.CallOption) (*GetCurrentUserResponse, error) + // SignOut ends the current session. + // Revokes the refresh token from the cookie and clears the cookie. + SignOut(ctx context.Context, in *SignOutRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) } type authServiceClient struct { @@ -55,16 +58,6 @@ func NewAuthServiceClient(cc grpc.ClientConnInterface) AuthServiceClient { return &authServiceClient{cc} } -func (c *authServiceClient) GetCurrentUser(ctx context.Context, in *GetCurrentUserRequest, opts ...grpc.CallOption) (*GetCurrentUserResponse, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(GetCurrentUserResponse) - err := c.cc.Invoke(ctx, AuthService_GetCurrentUser_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - func (c *authServiceClient) SignIn(ctx context.Context, in *SignInRequest, opts ...grpc.CallOption) (*SignInResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(SignInResponse) @@ -75,16 +68,6 @@ func (c *authServiceClient) SignIn(ctx context.Context, in *SignInRequest, opts return out, nil } -func (c *authServiceClient) SignOut(ctx context.Context, in *SignOutRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(emptypb.Empty) - err := c.cc.Invoke(ctx, AuthService_SignOut_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - func (c *authServiceClient) RefreshToken(ctx context.Context, in *RefreshTokenRequest, opts ...grpc.CallOption) (*RefreshTokenResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(RefreshTokenResponse) @@ -95,25 +78,48 @@ func (c *authServiceClient) RefreshToken(ctx context.Context, in *RefreshTokenRe return out, nil } +func (c *authServiceClient) GetCurrentUser(ctx context.Context, in *GetCurrentUserRequest, opts ...grpc.CallOption) (*GetCurrentUserResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetCurrentUserResponse) + err := c.cc.Invoke(ctx, AuthService_GetCurrentUser_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *authServiceClient) SignOut(ctx context.Context, in *SignOutRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(emptypb.Empty) + err := c.cc.Invoke(ctx, AuthService_SignOut_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + // AuthServiceServer is the server API for AuthService service. // All implementations must embed UnimplementedAuthServiceServer // for forward compatibility. +// +// AuthService manages sign-in sessions: it issues, refreshes, and revokes the tokens that authenticate API calls. type AuthServiceServer interface { - // GetCurrentUser returns the authenticated user's information. - // Validates the access token and returns user details. - // Similar to OIDC's /userinfo endpoint. - GetCurrentUser(context.Context, *GetCurrentUserRequest) (*GetCurrentUserResponse, error) - // SignIn authenticates a user with credentials and returns tokens. - // On success, returns an access token and sets a refresh token cookie. - // Supports password-based and SSO authentication methods. + // SignIn authenticates a user with password or SSO credentials. + // On success, returns a short-lived access token and sets a refresh token in an HttpOnly cookie. + // Public. Attempts are rate limited. Archived users cannot sign in. SignIn(context.Context, *SignInRequest) (*SignInResponse, error) - // SignOut terminates the user's authentication. - // Revokes the refresh token and clears the authentication cookie. - SignOut(context.Context, *SignOutRequest) (*emptypb.Empty, error) - // RefreshToken exchanges a valid refresh token for a new access token. - // The refresh token is read from the HttpOnly cookie. - // Returns a new short-lived access token. + // RefreshToken exchanges the refresh token for a new access token. + // The refresh token is read from the HttpOnly cookie and rotated: the old token is revoked and a new one with a + // fresh 30-day expiry is set in the cookie. + // Public, so it can be called after the access token has expired. RefreshToken(context.Context, *RefreshTokenRequest) (*RefreshTokenResponse, error) + // GetCurrentUser returns the authenticated user, similar to OIDC's /userinfo endpoint. + // When the caller is not signed in or the account is no longer active, clears the refresh token cookie and returns + // UNAUTHENTICATED. + GetCurrentUser(context.Context, *GetCurrentUserRequest) (*GetCurrentUserResponse, error) + // SignOut ends the current session. + // Revokes the refresh token from the cookie and clears the cookie. + SignOut(context.Context, *SignOutRequest) (*emptypb.Empty, error) mustEmbedUnimplementedAuthServiceServer() } @@ -124,18 +130,18 @@ type AuthServiceServer interface { // pointer dereference when methods are called. type UnimplementedAuthServiceServer struct{} -func (UnimplementedAuthServiceServer) GetCurrentUser(context.Context, *GetCurrentUserRequest) (*GetCurrentUserResponse, error) { - return nil, status.Error(codes.Unimplemented, "method GetCurrentUser not implemented") -} func (UnimplementedAuthServiceServer) SignIn(context.Context, *SignInRequest) (*SignInResponse, error) { return nil, status.Error(codes.Unimplemented, "method SignIn not implemented") } -func (UnimplementedAuthServiceServer) SignOut(context.Context, *SignOutRequest) (*emptypb.Empty, error) { - return nil, status.Error(codes.Unimplemented, "method SignOut not implemented") -} func (UnimplementedAuthServiceServer) RefreshToken(context.Context, *RefreshTokenRequest) (*RefreshTokenResponse, error) { return nil, status.Error(codes.Unimplemented, "method RefreshToken not implemented") } +func (UnimplementedAuthServiceServer) GetCurrentUser(context.Context, *GetCurrentUserRequest) (*GetCurrentUserResponse, error) { + return nil, status.Error(codes.Unimplemented, "method GetCurrentUser not implemented") +} +func (UnimplementedAuthServiceServer) SignOut(context.Context, *SignOutRequest) (*emptypb.Empty, error) { + return nil, status.Error(codes.Unimplemented, "method SignOut not implemented") +} func (UnimplementedAuthServiceServer) mustEmbedUnimplementedAuthServiceServer() {} func (UnimplementedAuthServiceServer) testEmbeddedByValue() {} @@ -157,24 +163,6 @@ func RegisterAuthServiceServer(s grpc.ServiceRegistrar, srv AuthServiceServer) { s.RegisterService(&AuthService_ServiceDesc, srv) } -func _AuthService_GetCurrentUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetCurrentUserRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(AuthServiceServer).GetCurrentUser(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: AuthService_GetCurrentUser_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(AuthServiceServer).GetCurrentUser(ctx, req.(*GetCurrentUserRequest)) - } - return interceptor(ctx, in, info, handler) -} - func _AuthService_SignIn_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(SignInRequest) if err := dec(in); err != nil { @@ -193,24 +181,6 @@ func _AuthService_SignIn_Handler(srv interface{}, ctx context.Context, dec func( return interceptor(ctx, in, info, handler) } -func _AuthService_SignOut_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(SignOutRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(AuthServiceServer).SignOut(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: AuthService_SignOut_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(AuthServiceServer).SignOut(ctx, req.(*SignOutRequest)) - } - return interceptor(ctx, in, info, handler) -} - func _AuthService_RefreshToken_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(RefreshTokenRequest) if err := dec(in); err != nil { @@ -229,30 +199,66 @@ func _AuthService_RefreshToken_Handler(srv interface{}, ctx context.Context, dec return interceptor(ctx, in, info, handler) } +func _AuthService_GetCurrentUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetCurrentUserRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuthServiceServer).GetCurrentUser(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AuthService_GetCurrentUser_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthServiceServer).GetCurrentUser(ctx, req.(*GetCurrentUserRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AuthService_SignOut_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SignOutRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuthServiceServer).SignOut(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AuthService_SignOut_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthServiceServer).SignOut(ctx, req.(*SignOutRequest)) + } + return interceptor(ctx, in, info, handler) +} + // AuthService_ServiceDesc is the grpc.ServiceDesc for AuthService service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) var AuthService_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "memos.api.v1.AuthService", + ServiceName: "memos.api.AuthService", HandlerType: (*AuthServiceServer)(nil), Methods: []grpc.MethodDesc{ - { - MethodName: "GetCurrentUser", - Handler: _AuthService_GetCurrentUser_Handler, - }, { MethodName: "SignIn", Handler: _AuthService_SignIn_Handler, }, - { - MethodName: "SignOut", - Handler: _AuthService_SignOut_Handler, - }, { MethodName: "RefreshToken", Handler: _AuthService_RefreshToken_Handler, }, + { + MethodName: "GetCurrentUser", + Handler: _AuthService_GetCurrentUser_Handler, + }, + { + MethodName: "SignOut", + Handler: _AuthService_SignOut_Handler, + }, }, Streams: []grpc.StreamDesc{}, - Metadata: "api/v1/auth_service.proto", + Metadata: "api/auth_service.proto", } diff --git a/proto/gen/api/v1/common.pb.go b/proto/gen/api/common.pb.go similarity index 57% rename from proto/gen/api/v1/common.pb.go rename to proto/gen/api/common.pb.go index fcb0bdddf..df77c5577 100644 --- a/proto/gen/api/v1/common.pb.go +++ b/proto/gen/api/common.pb.go @@ -2,9 +2,9 @@ // versions: // protoc-gen-go v1.36.12 // protoc (unknown) -// source: api/v1/common.proto +// source: api/common.proto -package apiv1 +package api import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" @@ -21,12 +21,15 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) +// State is the lifecycle state of a resource. type State int32 const ( State_STATE_UNSPECIFIED State = 0 - State_NORMAL State = 1 - State_ARCHIVED State = 2 + // The resource is active. + State_NORMAL State = 1 + // The resource is archived. + State_ARCHIVED State = 2 ) // Enum value maps for State. @@ -54,11 +57,11 @@ func (x State) String() string { } func (State) Descriptor() protoreflect.EnumDescriptor { - return file_api_v1_common_proto_enumTypes[0].Descriptor() + return file_api_common_proto_enumTypes[0].Descriptor() } func (State) Type() protoreflect.EnumType { - return &file_api_v1_common_proto_enumTypes[0] + return &file_api_common_proto_enumTypes[0] } func (x State) Number() protoreflect.EnumNumber { @@ -67,15 +70,18 @@ func (x State) Number() protoreflect.EnumNumber { // Deprecated: Use State.Descriptor instead. func (State) EnumDescriptor() ([]byte, []int) { - return file_api_v1_common_proto_rawDescGZIP(), []int{0} + return file_api_common_proto_rawDescGZIP(), []int{0} } +// Direction is a sort direction. type Direction int32 const ( Direction_DIRECTION_UNSPECIFIED Direction = 0 - Direction_ASC Direction = 1 - Direction_DESC Direction = 2 + // Ascending order. + Direction_ASC Direction = 1 + // Descending order. + Direction_DESC Direction = 2 ) // Enum value maps for Direction. @@ -103,11 +109,11 @@ func (x Direction) String() string { } func (Direction) Descriptor() protoreflect.EnumDescriptor { - return file_api_v1_common_proto_enumTypes[1].Descriptor() + return file_api_common_proto_enumTypes[1].Descriptor() } func (Direction) Type() protoreflect.EnumType { - return &file_api_v1_common_proto_enumTypes[1] + return &file_api_common_proto_enumTypes[1] } func (x Direction) Number() protoreflect.EnumNumber { @@ -116,21 +122,24 @@ func (x Direction) Number() protoreflect.EnumNumber { // Deprecated: Use Direction.Descriptor instead. func (Direction) EnumDescriptor() ([]byte, []int) { - return file_api_v1_common_proto_rawDescGZIP(), []int{1} + return file_api_common_proto_rawDescGZIP(), []int{1} } -// Used internally for obfuscating the page token. +// PageToken is the internal content of an opaque page token. The service +// serializes it and encodes it as base64; clients must not parse it. type PageToken struct { - state protoimpl.MessageState `protogen:"open.v1"` - Limit int32 `protobuf:"varint,1,opt,name=limit,proto3" json:"limit,omitempty"` - Offset int32 `protobuf:"varint,2,opt,name=offset,proto3" json:"offset,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + // The page size used for the next page. + Limit int32 `protobuf:"varint,1,opt,name=limit,proto3" json:"limit,omitempty"` + // The number of items to skip before the next page. + Offset int32 `protobuf:"varint,2,opt,name=offset,proto3" json:"offset,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } func (x *PageToken) Reset() { *x = PageToken{} - mi := &file_api_v1_common_proto_msgTypes[0] + mi := &file_api_common_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -142,7 +151,7 @@ func (x *PageToken) String() string { func (*PageToken) ProtoMessage() {} func (x *PageToken) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_common_proto_msgTypes[0] + mi := &file_api_common_proto_msgTypes[0] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -155,7 +164,7 @@ func (x *PageToken) ProtoReflect() protoreflect.Message { // Deprecated: Use PageToken.ProtoReflect.Descriptor instead. func (*PageToken) Descriptor() ([]byte, []int) { - return file_api_v1_common_proto_rawDescGZIP(), []int{0} + return file_api_common_proto_rawDescGZIP(), []int{0} } func (x *PageToken) GetLimit() int32 { @@ -172,11 +181,11 @@ func (x *PageToken) GetOffset() int32 { return 0 } -var File_api_v1_common_proto protoreflect.FileDescriptor +var File_api_common_proto protoreflect.FileDescriptor -const file_api_v1_common_proto_rawDesc = "" + +const file_api_common_proto_rawDesc = "" + "\n" + - "\x13api/v1/common.proto\x12\fmemos.api.v1\"9\n" + + "\x10api/common.proto\x12\tmemos.api\"9\n" + "\tPageToken\x12\x14\n" + "\x05limit\x18\x01 \x01(\x05R\x05limit\x12\x16\n" + "\x06offset\x18\x02 \x01(\x05R\x06offset*8\n" + @@ -188,29 +197,30 @@ const file_api_v1_common_proto_rawDesc = "" + "\tDirection\x12\x19\n" + "\x15DIRECTION_UNSPECIFIED\x10\x00\x12\a\n" + "\x03ASC\x10\x01\x12\b\n" + - "\x04DESC\x10\x02B\xa3\x01\n" + - "\x10com.memos.api.v1B\vCommonProtoP\x01Z0github.com/usememos/memos/proto/gen/api/v1;apiv1\xa2\x02\x03MAX\xaa\x02\fMemos.Api.V1\xca\x02\fMemos\\Api\\V1\xe2\x02\x18Memos\\Api\\V1\\GPBMetadata\xea\x02\x0eMemos::Api::V1b\x06proto3" + "\x04DESC\x10\x02B\x8a\x01\n" + + "\rcom.memos.apiB\vCommonProtoP\x01Z'github.com/usememos/memos/proto/gen/api\xa2\x02\x03MAX\xaa\x02\tMemos.Api\xca\x02\tMemos\\Api\xe2\x02\x15Memos\\Api\\GPBMetadata\xea\x02\n" + + "Memos::Apib\x06proto3" var ( - file_api_v1_common_proto_rawDescOnce sync.Once - file_api_v1_common_proto_rawDescData []byte + file_api_common_proto_rawDescOnce sync.Once + file_api_common_proto_rawDescData []byte ) -func file_api_v1_common_proto_rawDescGZIP() []byte { - file_api_v1_common_proto_rawDescOnce.Do(func() { - file_api_v1_common_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_api_v1_common_proto_rawDesc), len(file_api_v1_common_proto_rawDesc))) +func file_api_common_proto_rawDescGZIP() []byte { + file_api_common_proto_rawDescOnce.Do(func() { + file_api_common_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_api_common_proto_rawDesc), len(file_api_common_proto_rawDesc))) }) - return file_api_v1_common_proto_rawDescData + return file_api_common_proto_rawDescData } -var file_api_v1_common_proto_enumTypes = make([]protoimpl.EnumInfo, 2) -var file_api_v1_common_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_api_v1_common_proto_goTypes = []any{ - (State)(0), // 0: memos.api.v1.State - (Direction)(0), // 1: memos.api.v1.Direction - (*PageToken)(nil), // 2: memos.api.v1.PageToken +var file_api_common_proto_enumTypes = make([]protoimpl.EnumInfo, 2) +var file_api_common_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_api_common_proto_goTypes = []any{ + (State)(0), // 0: memos.api.State + (Direction)(0), // 1: memos.api.Direction + (*PageToken)(nil), // 2: memos.api.PageToken } -var file_api_v1_common_proto_depIdxs = []int32{ +var file_api_common_proto_depIdxs = []int32{ 0, // [0:0] is the sub-list for method output_type 0, // [0:0] is the sub-list for method input_type 0, // [0:0] is the sub-list for extension type_name @@ -218,27 +228,27 @@ var file_api_v1_common_proto_depIdxs = []int32{ 0, // [0:0] is the sub-list for field type_name } -func init() { file_api_v1_common_proto_init() } -func file_api_v1_common_proto_init() { - if File_api_v1_common_proto != nil { +func init() { file_api_common_proto_init() } +func file_api_common_proto_init() { + if File_api_common_proto != nil { return } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: unsafe.Slice(unsafe.StringData(file_api_v1_common_proto_rawDesc), len(file_api_v1_common_proto_rawDesc)), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_api_common_proto_rawDesc), len(file_api_common_proto_rawDesc)), NumEnums: 2, NumMessages: 1, NumExtensions: 0, NumServices: 0, }, - GoTypes: file_api_v1_common_proto_goTypes, - DependencyIndexes: file_api_v1_common_proto_depIdxs, - EnumInfos: file_api_v1_common_proto_enumTypes, - MessageInfos: file_api_v1_common_proto_msgTypes, + GoTypes: file_api_common_proto_goTypes, + DependencyIndexes: file_api_common_proto_depIdxs, + EnumInfos: file_api_common_proto_enumTypes, + MessageInfos: file_api_common_proto_msgTypes, }.Build() - File_api_v1_common_proto = out.File - file_api_v1_common_proto_goTypes = nil - file_api_v1_common_proto_depIdxs = nil + File_api_common_proto = out.File + file_api_common_proto_goTypes = nil + file_api_common_proto_depIdxs = nil } diff --git a/proto/gen/api/v1/idp_service.pb.go b/proto/gen/api/idp_service.pb.go similarity index 57% rename from proto/gen/api/v1/idp_service.pb.go rename to proto/gen/api/idp_service.pb.go index 6b980df45..1f6d4855a 100644 --- a/proto/gen/api/v1/idp_service.pb.go +++ b/proto/gen/api/idp_service.pb.go @@ -2,9 +2,9 @@ // versions: // protoc-gen-go v1.36.12 // protoc (unknown) -// source: api/v1/idp_service.proto +// source: api/idp_service.proto -package apiv1 +package api import ( _ "google.golang.org/genproto/googleapis/api/annotations" @@ -24,6 +24,7 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) +// Type is the protocol of an identity provider. type IdentityProvider_Type int32 const ( @@ -55,11 +56,11 @@ func (x IdentityProvider_Type) String() string { } func (IdentityProvider_Type) Descriptor() protoreflect.EnumDescriptor { - return file_api_v1_idp_service_proto_enumTypes[0].Descriptor() + return file_api_idp_service_proto_enumTypes[0].Descriptor() } func (IdentityProvider_Type) Type() protoreflect.EnumType { - return &file_api_v1_idp_service_proto_enumTypes[0] + return &file_api_idp_service_proto_enumTypes[0] } func (x IdentityProvider_Type) Number() protoreflect.EnumNumber { @@ -68,21 +69,22 @@ func (x IdentityProvider_Type) Number() protoreflect.EnumNumber { // Deprecated: Use IdentityProvider_Type.Descriptor instead. func (IdentityProvider_Type) EnumDescriptor() ([]byte, []int) { - return file_api_v1_idp_service_proto_rawDescGZIP(), []int{0, 0} + return file_api_idp_service_proto_rawDescGZIP(), []int{0, 0} } +// IdentityProvider is an external identity provider users can sign in with. type IdentityProvider struct { state protoimpl.MessageState `protogen:"open.v1"` - // The resource name of the identity provider. + // Identifier. The resource name of the identity provider. // Format: identity-providers/{idp} Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // Required. The type of the identity provider. - Type IdentityProvider_Type `protobuf:"varint,2,opt,name=type,proto3,enum=memos.api.v1.IdentityProvider_Type" json:"type,omitempty"` + Type IdentityProvider_Type `protobuf:"varint,2,opt,name=type,proto3,enum=memos.api.IdentityProvider_Type" json:"type,omitempty"` // Required. The display title of the identity provider. Title string `protobuf:"bytes,3,opt,name=title,proto3" json:"title,omitempty"` - // Optional. Filter applied to user identifiers. + // Optional. A regular expression the user identifier must match to sign in. Empty allows every identifier. IdentifierFilter string `protobuf:"bytes,4,opt,name=identifier_filter,json=identifierFilter,proto3" json:"identifier_filter,omitempty"` - // Required. Configuration for the identity provider. + // Required. The type-specific configuration of the identity provider. Config *IdentityProviderConfig `protobuf:"bytes,5,opt,name=config,proto3" json:"config,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache @@ -90,7 +92,7 @@ type IdentityProvider struct { func (x *IdentityProvider) Reset() { *x = IdentityProvider{} - mi := &file_api_v1_idp_service_proto_msgTypes[0] + mi := &file_api_idp_service_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -102,7 +104,7 @@ func (x *IdentityProvider) String() string { func (*IdentityProvider) ProtoMessage() {} func (x *IdentityProvider) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_idp_service_proto_msgTypes[0] + mi := &file_api_idp_service_proto_msgTypes[0] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -115,7 +117,7 @@ func (x *IdentityProvider) ProtoReflect() protoreflect.Message { // Deprecated: Use IdentityProvider.ProtoReflect.Descriptor instead. func (*IdentityProvider) Descriptor() ([]byte, []int) { - return file_api_v1_idp_service_proto_rawDescGZIP(), []int{0} + return file_api_idp_service_proto_rawDescGZIP(), []int{0} } func (x *IdentityProvider) GetName() string { @@ -153,8 +155,301 @@ func (x *IdentityProvider) GetConfig() *IdentityProviderConfig { return nil } +// Request message for IdentityProviderService.ListIdentityProviders. +type ListIdentityProvidersRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListIdentityProvidersRequest) Reset() { + *x = ListIdentityProvidersRequest{} + mi := &file_api_idp_service_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListIdentityProvidersRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListIdentityProvidersRequest) ProtoMessage() {} + +func (x *ListIdentityProvidersRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_idp_service_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListIdentityProvidersRequest.ProtoReflect.Descriptor instead. +func (*ListIdentityProvidersRequest) Descriptor() ([]byte, []int) { + return file_api_idp_service_proto_rawDescGZIP(), []int{1} +} + +// Response message for IdentityProviderService.ListIdentityProviders. +type ListIdentityProvidersResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The identity providers. + IdentityProviders []*IdentityProvider `protobuf:"bytes,1,rep,name=identity_providers,json=identityProviders,proto3" json:"identity_providers,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListIdentityProvidersResponse) Reset() { + *x = ListIdentityProvidersResponse{} + mi := &file_api_idp_service_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListIdentityProvidersResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListIdentityProvidersResponse) ProtoMessage() {} + +func (x *ListIdentityProvidersResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_idp_service_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListIdentityProvidersResponse.ProtoReflect.Descriptor instead. +func (*ListIdentityProvidersResponse) Descriptor() ([]byte, []int) { + return file_api_idp_service_proto_rawDescGZIP(), []int{2} +} + +func (x *ListIdentityProvidersResponse) GetIdentityProviders() []*IdentityProvider { + if x != nil { + return x.IdentityProviders + } + return nil +} + +// Request message for IdentityProviderService.GetIdentityProvider. +type GetIdentityProviderRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Required. The resource name of the identity provider to get. + // Format: identity-providers/{idp} + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetIdentityProviderRequest) Reset() { + *x = GetIdentityProviderRequest{} + mi := &file_api_idp_service_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetIdentityProviderRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetIdentityProviderRequest) ProtoMessage() {} + +func (x *GetIdentityProviderRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_idp_service_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetIdentityProviderRequest.ProtoReflect.Descriptor instead. +func (*GetIdentityProviderRequest) Descriptor() ([]byte, []int) { + return file_api_idp_service_proto_rawDescGZIP(), []int{3} +} + +func (x *GetIdentityProviderRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +// Request message for IdentityProviderService.CreateIdentityProvider. +type CreateIdentityProviderRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Required. The identity provider to create. + IdentityProvider *IdentityProvider `protobuf:"bytes,1,opt,name=identity_provider,json=identityProvider,proto3" json:"identity_provider,omitempty"` + // Optional. The ID to use for the identity provider, which becomes the final component of the resource name. + // If empty, the server generates one. + // Format: ^[a-zA-Z0-9]([a-zA-Z0-9-]{0,34}[a-zA-Z0-9])?$ + IdentityProviderId string `protobuf:"bytes,2,opt,name=identity_provider_id,json=identityProviderId,proto3" json:"identity_provider_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateIdentityProviderRequest) Reset() { + *x = CreateIdentityProviderRequest{} + mi := &file_api_idp_service_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateIdentityProviderRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateIdentityProviderRequest) ProtoMessage() {} + +func (x *CreateIdentityProviderRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_idp_service_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateIdentityProviderRequest.ProtoReflect.Descriptor instead. +func (*CreateIdentityProviderRequest) Descriptor() ([]byte, []int) { + return file_api_idp_service_proto_rawDescGZIP(), []int{4} +} + +func (x *CreateIdentityProviderRequest) GetIdentityProvider() *IdentityProvider { + if x != nil { + return x.IdentityProvider + } + return nil +} + +func (x *CreateIdentityProviderRequest) GetIdentityProviderId() string { + if x != nil { + return x.IdentityProviderId + } + return "" +} + +// Request message for IdentityProviderService.UpdateIdentityProvider. +type UpdateIdentityProviderRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Required. The identity provider to update. Its name identifies the provider. + IdentityProvider *IdentityProvider `protobuf:"bytes,1,opt,name=identity_provider,json=identityProvider,proto3" json:"identity_provider,omitempty"` + // Required. The fields to update. Supported paths: title, identifier_filter, config; other paths are ignored. + // An empty OAuth2 client secret in config keeps the stored secret. + UpdateMask *fieldmaskpb.FieldMask `protobuf:"bytes,2,opt,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UpdateIdentityProviderRequest) Reset() { + *x = UpdateIdentityProviderRequest{} + mi := &file_api_idp_service_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UpdateIdentityProviderRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateIdentityProviderRequest) ProtoMessage() {} + +func (x *UpdateIdentityProviderRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_idp_service_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateIdentityProviderRequest.ProtoReflect.Descriptor instead. +func (*UpdateIdentityProviderRequest) Descriptor() ([]byte, []int) { + return file_api_idp_service_proto_rawDescGZIP(), []int{5} +} + +func (x *UpdateIdentityProviderRequest) GetIdentityProvider() *IdentityProvider { + if x != nil { + return x.IdentityProvider + } + return nil +} + +func (x *UpdateIdentityProviderRequest) GetUpdateMask() *fieldmaskpb.FieldMask { + if x != nil { + return x.UpdateMask + } + return nil +} + +// Request message for IdentityProviderService.DeleteIdentityProvider. +type DeleteIdentityProviderRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Required. The resource name of the identity provider to delete. + // Format: identity-providers/{idp} + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteIdentityProviderRequest) Reset() { + *x = DeleteIdentityProviderRequest{} + mi := &file_api_idp_service_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteIdentityProviderRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteIdentityProviderRequest) ProtoMessage() {} + +func (x *DeleteIdentityProviderRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_idp_service_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteIdentityProviderRequest.ProtoReflect.Descriptor instead. +func (*DeleteIdentityProviderRequest) Descriptor() ([]byte, []int) { + return file_api_idp_service_proto_rawDescGZIP(), []int{6} +} + +func (x *DeleteIdentityProviderRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +// IdentityProviderConfig is the type-specific configuration of an identity provider. type IdentityProviderConfig struct { state protoimpl.MessageState `protogen:"open.v1"` + // The configuration, matching the provider type. + // // Types that are valid to be assigned to Config: // // *IdentityProviderConfig_Oauth2Config @@ -165,7 +460,7 @@ type IdentityProviderConfig struct { func (x *IdentityProviderConfig) Reset() { *x = IdentityProviderConfig{} - mi := &file_api_v1_idp_service_proto_msgTypes[1] + mi := &file_api_idp_service_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -177,7 +472,7 @@ func (x *IdentityProviderConfig) String() string { func (*IdentityProviderConfig) ProtoMessage() {} func (x *IdentityProviderConfig) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_idp_service_proto_msgTypes[1] + mi := &file_api_idp_service_proto_msgTypes[7] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -190,7 +485,7 @@ func (x *IdentityProviderConfig) ProtoReflect() protoreflect.Message { // Deprecated: Use IdentityProviderConfig.ProtoReflect.Descriptor instead. func (*IdentityProviderConfig) Descriptor() ([]byte, []int) { - return file_api_v1_idp_service_proto_rawDescGZIP(), []int{1} + return file_api_idp_service_proto_rawDescGZIP(), []int{7} } func (x *IdentityProviderConfig) GetConfig() isIdentityProviderConfig_Config { @@ -214,95 +509,36 @@ type isIdentityProviderConfig_Config interface { } type IdentityProviderConfig_Oauth2Config struct { + // The configuration of an OAuth2 identity provider. Oauth2Config *OAuth2Config `protobuf:"bytes,1,opt,name=oauth2_config,json=oauth2Config,proto3,oneof"` } func (*IdentityProviderConfig_Oauth2Config) isIdentityProviderConfig_Config() {} -type FieldMapping struct { - state protoimpl.MessageState `protogen:"open.v1"` - Identifier string `protobuf:"bytes,1,opt,name=identifier,proto3" json:"identifier,omitempty"` - DisplayName string `protobuf:"bytes,2,opt,name=display_name,json=displayName,proto3" json:"display_name,omitempty"` - Email string `protobuf:"bytes,3,opt,name=email,proto3" json:"email,omitempty"` - AvatarUrl string `protobuf:"bytes,4,opt,name=avatar_url,json=avatarUrl,proto3" json:"avatar_url,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *FieldMapping) Reset() { - *x = FieldMapping{} - mi := &file_api_v1_idp_service_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *FieldMapping) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*FieldMapping) ProtoMessage() {} - -func (x *FieldMapping) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_idp_service_proto_msgTypes[2] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use FieldMapping.ProtoReflect.Descriptor instead. -func (*FieldMapping) Descriptor() ([]byte, []int) { - return file_api_v1_idp_service_proto_rawDescGZIP(), []int{2} -} - -func (x *FieldMapping) GetIdentifier() string { - if x != nil { - return x.Identifier - } - return "" -} - -func (x *FieldMapping) GetDisplayName() string { - if x != nil { - return x.DisplayName - } - return "" -} - -func (x *FieldMapping) GetEmail() string { - if x != nil { - return x.Email - } - return "" -} - -func (x *FieldMapping) GetAvatarUrl() string { - if x != nil { - return x.AvatarUrl - } - return "" -} - +// OAuth2Config is the configuration of an OAuth2 identity provider. type OAuth2Config struct { - state protoimpl.MessageState `protogen:"open.v1"` - ClientId string `protobuf:"bytes,1,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"` - ClientSecret string `protobuf:"bytes,2,opt,name=client_secret,json=clientSecret,proto3" json:"client_secret,omitempty"` - AuthUrl string `protobuf:"bytes,3,opt,name=auth_url,json=authUrl,proto3" json:"auth_url,omitempty"` - TokenUrl string `protobuf:"bytes,4,opt,name=token_url,json=tokenUrl,proto3" json:"token_url,omitempty"` - UserInfoUrl string `protobuf:"bytes,5,opt,name=user_info_url,json=userInfoUrl,proto3" json:"user_info_url,omitempty"` - Scopes []string `protobuf:"bytes,6,rep,name=scopes,proto3" json:"scopes,omitempty"` - FieldMapping *FieldMapping `protobuf:"bytes,7,opt,name=field_mapping,json=fieldMapping,proto3" json:"field_mapping,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + // The OAuth2 client ID. + ClientId string `protobuf:"bytes,1,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"` + // The OAuth2 client secret. Write-only: it is never returned in responses. + ClientSecret string `protobuf:"bytes,2,opt,name=client_secret,json=clientSecret,proto3" json:"client_secret,omitempty"` + // The authorization endpoint URL. + AuthUrl string `protobuf:"bytes,3,opt,name=auth_url,json=authUrl,proto3" json:"auth_url,omitempty"` + // The token endpoint URL, used to exchange the authorization code for an access token. + TokenUrl string `protobuf:"bytes,4,opt,name=token_url,json=tokenUrl,proto3" json:"token_url,omitempty"` + // The user info endpoint URL, used to fetch the claims of the signed-in user. + UserInfoUrl string `protobuf:"bytes,5,opt,name=user_info_url,json=userInfoUrl,proto3" json:"user_info_url,omitempty"` + // The scopes to request. + Scopes []string `protobuf:"bytes,6,rep,name=scopes,proto3" json:"scopes,omitempty"` + // How user info claims map to user fields. + FieldMapping *FieldMapping `protobuf:"bytes,7,opt,name=field_mapping,json=fieldMapping,proto3" json:"field_mapping,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } func (x *OAuth2Config) Reset() { *x = OAuth2Config{} - mi := &file_api_v1_idp_service_proto_msgTypes[3] + mi := &file_api_idp_service_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -314,7 +550,7 @@ func (x *OAuth2Config) String() string { func (*OAuth2Config) ProtoMessage() {} func (x *OAuth2Config) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_idp_service_proto_msgTypes[3] + mi := &file_api_idp_service_proto_msgTypes[8] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -327,7 +563,7 @@ func (x *OAuth2Config) ProtoReflect() protoreflect.Message { // Deprecated: Use OAuth2Config.ProtoReflect.Descriptor instead. func (*OAuth2Config) Descriptor() ([]byte, []int) { - return file_api_v1_idp_service_proto_rawDescGZIP(), []int{3} + return file_api_idp_service_proto_rawDescGZIP(), []int{8} } func (x *OAuth2Config) GetClientId() string { @@ -379,27 +615,37 @@ func (x *OAuth2Config) GetFieldMapping() *FieldMapping { return nil } -type ListIdentityProvidersRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` +// FieldMapping maps user info claims of an OAuth2 identity provider to user fields. +// Each field holds the name of a claim. +type FieldMapping struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The claim that uniquely identifies the user. Sign-in fails when it is missing or empty. + Identifier string `protobuf:"bytes,1,opt,name=identifier,proto3" json:"identifier,omitempty"` + // The claim used as the display name. Falls back to the identifier when unset. + DisplayName string `protobuf:"bytes,2,opt,name=display_name,json=displayName,proto3" json:"display_name,omitempty"` + // The claim used as the email address. + Email string `protobuf:"bytes,3,opt,name=email,proto3" json:"email,omitempty"` + // The claim used as the avatar URL. + AvatarUrl string `protobuf:"bytes,4,opt,name=avatar_url,json=avatarUrl,proto3" json:"avatar_url,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } -func (x *ListIdentityProvidersRequest) Reset() { - *x = ListIdentityProvidersRequest{} - mi := &file_api_v1_idp_service_proto_msgTypes[4] +func (x *FieldMapping) Reset() { + *x = FieldMapping{} + mi := &file_api_idp_service_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } -func (x *ListIdentityProvidersRequest) String() string { +func (x *FieldMapping) String() string { return protoimpl.X.MessageStringOf(x) } -func (*ListIdentityProvidersRequest) ProtoMessage() {} +func (*FieldMapping) ProtoMessage() {} -func (x *ListIdentityProvidersRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_idp_service_proto_msgTypes[4] +func (x *FieldMapping) ProtoReflect() protoreflect.Message { + mi := &file_api_idp_service_proto_msgTypes[9] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -410,278 +656,82 @@ func (x *ListIdentityProvidersRequest) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use ListIdentityProvidersRequest.ProtoReflect.Descriptor instead. -func (*ListIdentityProvidersRequest) Descriptor() ([]byte, []int) { - return file_api_v1_idp_service_proto_rawDescGZIP(), []int{4} +// Deprecated: Use FieldMapping.ProtoReflect.Descriptor instead. +func (*FieldMapping) Descriptor() ([]byte, []int) { + return file_api_idp_service_proto_rawDescGZIP(), []int{9} } -type ListIdentityProvidersResponse struct { - state protoimpl.MessageState `protogen:"open.v1"` - // The list of identity providers. - IdentityProviders []*IdentityProvider `protobuf:"bytes,1,rep,name=identity_providers,json=identityProviders,proto3" json:"identity_providers,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ListIdentityProvidersResponse) Reset() { - *x = ListIdentityProvidersResponse{} - mi := &file_api_v1_idp_service_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ListIdentityProvidersResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ListIdentityProvidersResponse) ProtoMessage() {} - -func (x *ListIdentityProvidersResponse) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_idp_service_proto_msgTypes[5] +func (x *FieldMapping) GetIdentifier() string { if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ListIdentityProvidersResponse.ProtoReflect.Descriptor instead. -func (*ListIdentityProvidersResponse) Descriptor() ([]byte, []int) { - return file_api_v1_idp_service_proto_rawDescGZIP(), []int{5} -} - -func (x *ListIdentityProvidersResponse) GetIdentityProviders() []*IdentityProvider { - if x != nil { - return x.IdentityProviders - } - return nil -} - -type GetIdentityProviderRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Required. The resource name of the identity provider to get. - // Format: identity-providers/{idp} - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *GetIdentityProviderRequest) Reset() { - *x = GetIdentityProviderRequest{} - mi := &file_api_v1_idp_service_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *GetIdentityProviderRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetIdentityProviderRequest) ProtoMessage() {} - -func (x *GetIdentityProviderRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_idp_service_proto_msgTypes[6] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetIdentityProviderRequest.ProtoReflect.Descriptor instead. -func (*GetIdentityProviderRequest) Descriptor() ([]byte, []int) { - return file_api_v1_idp_service_proto_rawDescGZIP(), []int{6} -} - -func (x *GetIdentityProviderRequest) GetName() string { - if x != nil { - return x.Name + return x.Identifier } return "" } -type CreateIdentityProviderRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Required. The identity provider to create. - IdentityProvider *IdentityProvider `protobuf:"bytes,1,opt,name=identity_provider,json=identityProvider,proto3" json:"identity_provider,omitempty"` - // Optional. The ID to use for the identity provider, which will become the final component of the resource name. - // If not provided, the system will generate one. - // Format: ^[a-zA-Z0-9]([a-zA-Z0-9-]{0,34}[a-zA-Z0-9])?$ - IdentityProviderId string `protobuf:"bytes,2,opt,name=identity_provider_id,json=identityProviderId,proto3" json:"identity_provider_id,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *CreateIdentityProviderRequest) Reset() { - *x = CreateIdentityProviderRequest{} - mi := &file_api_v1_idp_service_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *CreateIdentityProviderRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CreateIdentityProviderRequest) ProtoMessage() {} - -func (x *CreateIdentityProviderRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_idp_service_proto_msgTypes[7] +func (x *FieldMapping) GetDisplayName() string { if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CreateIdentityProviderRequest.ProtoReflect.Descriptor instead. -func (*CreateIdentityProviderRequest) Descriptor() ([]byte, []int) { - return file_api_v1_idp_service_proto_rawDescGZIP(), []int{7} -} - -func (x *CreateIdentityProviderRequest) GetIdentityProvider() *IdentityProvider { - if x != nil { - return x.IdentityProvider - } - return nil -} - -func (x *CreateIdentityProviderRequest) GetIdentityProviderId() string { - if x != nil { - return x.IdentityProviderId + return x.DisplayName } return "" } -type UpdateIdentityProviderRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Required. The identity provider to update. - IdentityProvider *IdentityProvider `protobuf:"bytes,1,opt,name=identity_provider,json=identityProvider,proto3" json:"identity_provider,omitempty"` - // Required. The update mask applies to the resource. Only the top level fields of - // IdentityProvider are supported. - UpdateMask *fieldmaskpb.FieldMask `protobuf:"bytes,2,opt,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *UpdateIdentityProviderRequest) Reset() { - *x = UpdateIdentityProviderRequest{} - mi := &file_api_v1_idp_service_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *UpdateIdentityProviderRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateIdentityProviderRequest) ProtoMessage() {} - -func (x *UpdateIdentityProviderRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_idp_service_proto_msgTypes[8] +func (x *FieldMapping) GetEmail() string { if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateIdentityProviderRequest.ProtoReflect.Descriptor instead. -func (*UpdateIdentityProviderRequest) Descriptor() ([]byte, []int) { - return file_api_v1_idp_service_proto_rawDescGZIP(), []int{8} -} - -func (x *UpdateIdentityProviderRequest) GetIdentityProvider() *IdentityProvider { - if x != nil { - return x.IdentityProvider - } - return nil -} - -func (x *UpdateIdentityProviderRequest) GetUpdateMask() *fieldmaskpb.FieldMask { - if x != nil { - return x.UpdateMask - } - return nil -} - -type DeleteIdentityProviderRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Required. The resource name of the identity provider to delete. - // Format: identity-providers/{idp} - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *DeleteIdentityProviderRequest) Reset() { - *x = DeleteIdentityProviderRequest{} - mi := &file_api_v1_idp_service_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *DeleteIdentityProviderRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DeleteIdentityProviderRequest) ProtoMessage() {} - -func (x *DeleteIdentityProviderRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_idp_service_proto_msgTypes[9] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DeleteIdentityProviderRequest.ProtoReflect.Descriptor instead. -func (*DeleteIdentityProviderRequest) Descriptor() ([]byte, []int) { - return file_api_v1_idp_service_proto_rawDescGZIP(), []int{9} -} - -func (x *DeleteIdentityProviderRequest) GetName() string { - if x != nil { - return x.Name + return x.Email } return "" } -var File_api_v1_idp_service_proto protoreflect.FileDescriptor +func (x *FieldMapping) GetAvatarUrl() string { + if x != nil { + return x.AvatarUrl + } + return "" +} -const file_api_v1_idp_service_proto_rawDesc = "" + +var File_api_idp_service_proto protoreflect.FileDescriptor + +const file_api_idp_service_proto_rawDesc = "" + "\n" + - "\x18api/v1/idp_service.proto\x12\fmemos.api.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto\"\x8c\x03\n" + + "\x15api/idp_service.proto\x12\tmemos.api\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto\"\xfd\x02\n" + "\x10IdentityProvider\x12\x17\n" + - "\x04name\x18\x01 \x01(\tB\x03\xe0A\bR\x04name\x12<\n" + - "\x04type\x18\x02 \x01(\x0e2#.memos.api.v1.IdentityProvider.TypeB\x03\xe0A\x02R\x04type\x12\x19\n" + + "\x04name\x18\x01 \x01(\tB\x03\xe0A\bR\x04name\x129\n" + + "\x04type\x18\x02 \x01(\x0e2 .memos.api.IdentityProvider.TypeB\x03\xe0A\x02R\x04type\x12\x19\n" + "\x05title\x18\x03 \x01(\tB\x03\xe0A\x02R\x05title\x120\n" + - "\x11identifier_filter\x18\x04 \x01(\tB\x03\xe0A\x01R\x10identifierFilter\x12A\n" + - "\x06config\x18\x05 \x01(\v2$.memos.api.v1.IdentityProviderConfigB\x03\xe0A\x02R\x06config\"(\n" + + "\x11identifier_filter\x18\x04 \x01(\tB\x03\xe0A\x01R\x10identifierFilter\x12>\n" + + "\x06config\x18\x05 \x01(\v2!.memos.api.IdentityProviderConfigB\x03\xe0A\x02R\x06config\"(\n" + "\x04Type\x12\x14\n" + "\x10TYPE_UNSPECIFIED\x10\x00\x12\n" + "\n" + - "\x06OAUTH2\x10\x01:g\xeaAd\n" + - "\x1dmemos.api.v1/IdentityProvider\x12\x18identity-providers/{idp}\x1a\x04name*\x11identityProviders2\x10identityProvider\"e\n" + - "\x16IdentityProviderConfig\x12A\n" + - "\roauth2_config\x18\x01 \x01(\v2\x1a.memos.api.v1.OAuth2ConfigH\x00R\foauth2ConfigB\b\n" + - "\x06config\"\x86\x01\n" + + "\x06OAUTH2\x10\x01:^\xeaA[\n" + + "\x1amemos.api/IdentityProvider\x12\x18identity-providers/{idp}*\x11identityProviders2\x10identityProvider\"\x1e\n" + + "\x1cListIdentityProvidersRequest\"k\n" + + "\x1dListIdentityProvidersResponse\x12J\n" + + "\x12identity_providers\x18\x01 \x03(\v2\x1b.memos.api.IdentityProviderR\x11identityProviders\"T\n" + + "\x1aGetIdentityProviderRequest\x126\n" + + "\x04name\x18\x01 \x01(\tB\"\xe0A\x02\xfaA\x1c\n" + + "\x1amemos.api/IdentityProviderR\x04name\"\xa5\x01\n" + + "\x1dCreateIdentityProviderRequest\x12M\n" + + "\x11identity_provider\x18\x01 \x01(\v2\x1b.memos.api.IdentityProviderB\x03\xe0A\x02R\x10identityProvider\x125\n" + + "\x14identity_provider_id\x18\x02 \x01(\tB\x03\xe0A\x01R\x12identityProviderId\"\xb0\x01\n" + + "\x1dUpdateIdentityProviderRequest\x12M\n" + + "\x11identity_provider\x18\x01 \x01(\v2\x1b.memos.api.IdentityProviderB\x03\xe0A\x02R\x10identityProvider\x12@\n" + + "\vupdate_mask\x18\x02 \x01(\v2\x1a.google.protobuf.FieldMaskB\x03\xe0A\x02R\n" + + "updateMask\"W\n" + + "\x1dDeleteIdentityProviderRequest\x126\n" + + "\x04name\x18\x01 \x01(\tB\"\xe0A\x02\xfaA\x1c\n" + + "\x1amemos.api/IdentityProviderR\x04name\"b\n" + + "\x16IdentityProviderConfig\x12>\n" + + "\roauth2_config\x18\x01 \x01(\v2\x17.memos.api.OAuth2ConfigH\x00R\foauth2ConfigB\b\n" + + "\x06config\"\x82\x02\n" + + "\fOAuth2Config\x12\x1b\n" + + "\tclient_id\x18\x01 \x01(\tR\bclientId\x12#\n" + + "\rclient_secret\x18\x02 \x01(\tR\fclientSecret\x12\x19\n" + + "\bauth_url\x18\x03 \x01(\tR\aauthUrl\x12\x1b\n" + + "\ttoken_url\x18\x04 \x01(\tR\btokenUrl\x12\"\n" + + "\ruser_info_url\x18\x05 \x01(\tR\vuserInfoUrl\x12\x16\n" + + "\x06scopes\x18\x06 \x03(\tR\x06scopes\x12<\n" + + "\rfield_mapping\x18\a \x01(\v2\x17.memos.api.FieldMappingR\ffieldMapping\"\x86\x01\n" + "\fFieldMapping\x12\x1e\n" + "\n" + "identifier\x18\x01 \x01(\tR\n" + @@ -689,87 +739,64 @@ const file_api_v1_idp_service_proto_rawDesc = "" + "\fdisplay_name\x18\x02 \x01(\tR\vdisplayName\x12\x14\n" + "\x05email\x18\x03 \x01(\tR\x05email\x12\x1d\n" + "\n" + - "avatar_url\x18\x04 \x01(\tR\tavatarUrl\"\x85\x02\n" + - "\fOAuth2Config\x12\x1b\n" + - "\tclient_id\x18\x01 \x01(\tR\bclientId\x12#\n" + - "\rclient_secret\x18\x02 \x01(\tR\fclientSecret\x12\x19\n" + - "\bauth_url\x18\x03 \x01(\tR\aauthUrl\x12\x1b\n" + - "\ttoken_url\x18\x04 \x01(\tR\btokenUrl\x12\"\n" + - "\ruser_info_url\x18\x05 \x01(\tR\vuserInfoUrl\x12\x16\n" + - "\x06scopes\x18\x06 \x03(\tR\x06scopes\x12?\n" + - "\rfield_mapping\x18\a \x01(\v2\x1a.memos.api.v1.FieldMappingR\ffieldMapping\"\x1e\n" + - "\x1cListIdentityProvidersRequest\"n\n" + - "\x1dListIdentityProvidersResponse\x12M\n" + - "\x12identity_providers\x18\x01 \x03(\v2\x1e.memos.api.v1.IdentityProviderR\x11identityProviders\"W\n" + - "\x1aGetIdentityProviderRequest\x129\n" + - "\x04name\x18\x01 \x01(\tB%\xe0A\x02\xfaA\x1f\n" + - "\x1dmemos.api.v1/IdentityProviderR\x04name\"\xa8\x01\n" + - "\x1dCreateIdentityProviderRequest\x12P\n" + - "\x11identity_provider\x18\x01 \x01(\v2\x1e.memos.api.v1.IdentityProviderB\x03\xe0A\x02R\x10identityProvider\x125\n" + - "\x14identity_provider_id\x18\x02 \x01(\tB\x03\xe0A\x01R\x12identityProviderId\"\xb3\x01\n" + - "\x1dUpdateIdentityProviderRequest\x12P\n" + - "\x11identity_provider\x18\x01 \x01(\v2\x1e.memos.api.v1.IdentityProviderB\x03\xe0A\x02R\x10identityProvider\x12@\n" + - "\vupdate_mask\x18\x02 \x01(\v2\x1a.google.protobuf.FieldMaskB\x03\xe0A\x02R\n" + - "updateMask\"Z\n" + - "\x1dDeleteIdentityProviderRequest\x129\n" + - "\x04name\x18\x01 \x01(\tB%\xe0A\x02\xfaA\x1f\n" + - "\x1dmemos.api.v1/IdentityProviderR\x04name2\xe7\x06\n" + - "\x17IdentityProviderService\x12\x94\x01\n" + - "\x15ListIdentityProviders\x12*.memos.api.v1.ListIdentityProvidersRequest\x1a+.memos.api.v1.ListIdentityProvidersResponse\"\"\x82\xd3\xe4\x93\x02\x1c\x12\x1a/api/v1/identity-providers\x12\x93\x01\n" + - "\x13GetIdentityProvider\x12(.memos.api.v1.GetIdentityProviderRequest\x1a\x1e.memos.api.v1.IdentityProvider\"2\xdaA\x04name\x82\xd3\xe4\x93\x02%\x12#/api/v1/{name=identity-providers/*}\x12\xb0\x01\n" + - "\x16CreateIdentityProvider\x12+.memos.api.v1.CreateIdentityProviderRequest\x1a\x1e.memos.api.v1.IdentityProvider\"I\xdaA\x11identity_provider\x82\xd3\xe4\x93\x02/:\x11identity_provider\"\x1a/api/v1/identity-providers\x12\xd7\x01\n" + - "\x16UpdateIdentityProvider\x12+.memos.api.v1.UpdateIdentityProviderRequest\x1a\x1e.memos.api.v1.IdentityProvider\"p\xdaA\x1didentity_provider,update_mask\x82\xd3\xe4\x93\x02J:\x11identity_provider25/api/v1/{identity_provider.name=identity-providers/*}\x12\x91\x01\n" + - "\x16DeleteIdentityProvider\x12+.memos.api.v1.DeleteIdentityProviderRequest\x1a\x16.google.protobuf.Empty\"2\xdaA\x04name\x82\xd3\xe4\x93\x02%*#/api/v1/{name=identity-providers/*}B\xa7\x01\n" + - "\x10com.memos.api.v1B\x0fIdpServiceProtoP\x01Z0github.com/usememos/memos/proto/gen/api/v1;apiv1\xa2\x02\x03MAX\xaa\x02\fMemos.Api.V1\xca\x02\fMemos\\Api\\V1\xe2\x02\x18Memos\\Api\\V1\\GPBMetadata\xea\x02\x0eMemos::Api::V1b\x06proto3" + "avatar_url\x18\x04 \x01(\tR\tavatarUrl2\xbd\x06\n" + + "\x17IdentityProviderService\x12\x8b\x01\n" + + "\x15ListIdentityProviders\x12'.memos.api.ListIdentityProvidersRequest\x1a(.memos.api.ListIdentityProvidersResponse\"\x1f\x82\xd3\xe4\x93\x02\x19\x12\x17/api/identity-providers\x12\x8a\x01\n" + + "\x13GetIdentityProvider\x12%.memos.api.GetIdentityProviderRequest\x1a\x1b.memos.api.IdentityProvider\"/\xdaA\x04name\x82\xd3\xe4\x93\x02\"\x12 /api/{name=identity-providers/*}\x12\xa7\x01\n" + + "\x16CreateIdentityProvider\x12(.memos.api.CreateIdentityProviderRequest\x1a\x1b.memos.api.IdentityProvider\"F\xdaA\x11identity_provider\x82\xd3\xe4\x93\x02,:\x11identity_provider\"\x17/api/identity-providers\x12\xce\x01\n" + + "\x16UpdateIdentityProvider\x12(.memos.api.UpdateIdentityProviderRequest\x1a\x1b.memos.api.IdentityProvider\"m\xdaA\x1didentity_provider,update_mask\x82\xd3\xe4\x93\x02G:\x11identity_provider22/api/{identity_provider.name=identity-providers/*}\x12\x8b\x01\n" + + "\x16DeleteIdentityProvider\x12(.memos.api.DeleteIdentityProviderRequest\x1a\x16.google.protobuf.Empty\"/\xdaA\x04name\x82\xd3\xe4\x93\x02\"* /api/{name=identity-providers/*}B\x8e\x01\n" + + "\rcom.memos.apiB\x0fIdpServiceProtoP\x01Z'github.com/usememos/memos/proto/gen/api\xa2\x02\x03MAX\xaa\x02\tMemos.Api\xca\x02\tMemos\\Api\xe2\x02\x15Memos\\Api\\GPBMetadata\xea\x02\n" + + "Memos::Apib\x06proto3" var ( - file_api_v1_idp_service_proto_rawDescOnce sync.Once - file_api_v1_idp_service_proto_rawDescData []byte + file_api_idp_service_proto_rawDescOnce sync.Once + file_api_idp_service_proto_rawDescData []byte ) -func file_api_v1_idp_service_proto_rawDescGZIP() []byte { - file_api_v1_idp_service_proto_rawDescOnce.Do(func() { - file_api_v1_idp_service_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_api_v1_idp_service_proto_rawDesc), len(file_api_v1_idp_service_proto_rawDesc))) +func file_api_idp_service_proto_rawDescGZIP() []byte { + file_api_idp_service_proto_rawDescOnce.Do(func() { + file_api_idp_service_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_api_idp_service_proto_rawDesc), len(file_api_idp_service_proto_rawDesc))) }) - return file_api_v1_idp_service_proto_rawDescData + return file_api_idp_service_proto_rawDescData } -var file_api_v1_idp_service_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_api_v1_idp_service_proto_msgTypes = make([]protoimpl.MessageInfo, 10) -var file_api_v1_idp_service_proto_goTypes = []any{ - (IdentityProvider_Type)(0), // 0: memos.api.v1.IdentityProvider.Type - (*IdentityProvider)(nil), // 1: memos.api.v1.IdentityProvider - (*IdentityProviderConfig)(nil), // 2: memos.api.v1.IdentityProviderConfig - (*FieldMapping)(nil), // 3: memos.api.v1.FieldMapping - (*OAuth2Config)(nil), // 4: memos.api.v1.OAuth2Config - (*ListIdentityProvidersRequest)(nil), // 5: memos.api.v1.ListIdentityProvidersRequest - (*ListIdentityProvidersResponse)(nil), // 6: memos.api.v1.ListIdentityProvidersResponse - (*GetIdentityProviderRequest)(nil), // 7: memos.api.v1.GetIdentityProviderRequest - (*CreateIdentityProviderRequest)(nil), // 8: memos.api.v1.CreateIdentityProviderRequest - (*UpdateIdentityProviderRequest)(nil), // 9: memos.api.v1.UpdateIdentityProviderRequest - (*DeleteIdentityProviderRequest)(nil), // 10: memos.api.v1.DeleteIdentityProviderRequest +var file_api_idp_service_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_api_idp_service_proto_msgTypes = make([]protoimpl.MessageInfo, 10) +var file_api_idp_service_proto_goTypes = []any{ + (IdentityProvider_Type)(0), // 0: memos.api.IdentityProvider.Type + (*IdentityProvider)(nil), // 1: memos.api.IdentityProvider + (*ListIdentityProvidersRequest)(nil), // 2: memos.api.ListIdentityProvidersRequest + (*ListIdentityProvidersResponse)(nil), // 3: memos.api.ListIdentityProvidersResponse + (*GetIdentityProviderRequest)(nil), // 4: memos.api.GetIdentityProviderRequest + (*CreateIdentityProviderRequest)(nil), // 5: memos.api.CreateIdentityProviderRequest + (*UpdateIdentityProviderRequest)(nil), // 6: memos.api.UpdateIdentityProviderRequest + (*DeleteIdentityProviderRequest)(nil), // 7: memos.api.DeleteIdentityProviderRequest + (*IdentityProviderConfig)(nil), // 8: memos.api.IdentityProviderConfig + (*OAuth2Config)(nil), // 9: memos.api.OAuth2Config + (*FieldMapping)(nil), // 10: memos.api.FieldMapping (*fieldmaskpb.FieldMask)(nil), // 11: google.protobuf.FieldMask (*emptypb.Empty)(nil), // 12: google.protobuf.Empty } -var file_api_v1_idp_service_proto_depIdxs = []int32{ - 0, // 0: memos.api.v1.IdentityProvider.type:type_name -> memos.api.v1.IdentityProvider.Type - 2, // 1: memos.api.v1.IdentityProvider.config:type_name -> memos.api.v1.IdentityProviderConfig - 4, // 2: memos.api.v1.IdentityProviderConfig.oauth2_config:type_name -> memos.api.v1.OAuth2Config - 3, // 3: memos.api.v1.OAuth2Config.field_mapping:type_name -> memos.api.v1.FieldMapping - 1, // 4: memos.api.v1.ListIdentityProvidersResponse.identity_providers:type_name -> memos.api.v1.IdentityProvider - 1, // 5: memos.api.v1.CreateIdentityProviderRequest.identity_provider:type_name -> memos.api.v1.IdentityProvider - 1, // 6: memos.api.v1.UpdateIdentityProviderRequest.identity_provider:type_name -> memos.api.v1.IdentityProvider - 11, // 7: memos.api.v1.UpdateIdentityProviderRequest.update_mask:type_name -> google.protobuf.FieldMask - 5, // 8: memos.api.v1.IdentityProviderService.ListIdentityProviders:input_type -> memos.api.v1.ListIdentityProvidersRequest - 7, // 9: memos.api.v1.IdentityProviderService.GetIdentityProvider:input_type -> memos.api.v1.GetIdentityProviderRequest - 8, // 10: memos.api.v1.IdentityProviderService.CreateIdentityProvider:input_type -> memos.api.v1.CreateIdentityProviderRequest - 9, // 11: memos.api.v1.IdentityProviderService.UpdateIdentityProvider:input_type -> memos.api.v1.UpdateIdentityProviderRequest - 10, // 12: memos.api.v1.IdentityProviderService.DeleteIdentityProvider:input_type -> memos.api.v1.DeleteIdentityProviderRequest - 6, // 13: memos.api.v1.IdentityProviderService.ListIdentityProviders:output_type -> memos.api.v1.ListIdentityProvidersResponse - 1, // 14: memos.api.v1.IdentityProviderService.GetIdentityProvider:output_type -> memos.api.v1.IdentityProvider - 1, // 15: memos.api.v1.IdentityProviderService.CreateIdentityProvider:output_type -> memos.api.v1.IdentityProvider - 1, // 16: memos.api.v1.IdentityProviderService.UpdateIdentityProvider:output_type -> memos.api.v1.IdentityProvider - 12, // 17: memos.api.v1.IdentityProviderService.DeleteIdentityProvider:output_type -> google.protobuf.Empty +var file_api_idp_service_proto_depIdxs = []int32{ + 0, // 0: memos.api.IdentityProvider.type:type_name -> memos.api.IdentityProvider.Type + 8, // 1: memos.api.IdentityProvider.config:type_name -> memos.api.IdentityProviderConfig + 1, // 2: memos.api.ListIdentityProvidersResponse.identity_providers:type_name -> memos.api.IdentityProvider + 1, // 3: memos.api.CreateIdentityProviderRequest.identity_provider:type_name -> memos.api.IdentityProvider + 1, // 4: memos.api.UpdateIdentityProviderRequest.identity_provider:type_name -> memos.api.IdentityProvider + 11, // 5: memos.api.UpdateIdentityProviderRequest.update_mask:type_name -> google.protobuf.FieldMask + 9, // 6: memos.api.IdentityProviderConfig.oauth2_config:type_name -> memos.api.OAuth2Config + 10, // 7: memos.api.OAuth2Config.field_mapping:type_name -> memos.api.FieldMapping + 2, // 8: memos.api.IdentityProviderService.ListIdentityProviders:input_type -> memos.api.ListIdentityProvidersRequest + 4, // 9: memos.api.IdentityProviderService.GetIdentityProvider:input_type -> memos.api.GetIdentityProviderRequest + 5, // 10: memos.api.IdentityProviderService.CreateIdentityProvider:input_type -> memos.api.CreateIdentityProviderRequest + 6, // 11: memos.api.IdentityProviderService.UpdateIdentityProvider:input_type -> memos.api.UpdateIdentityProviderRequest + 7, // 12: memos.api.IdentityProviderService.DeleteIdentityProvider:input_type -> memos.api.DeleteIdentityProviderRequest + 3, // 13: memos.api.IdentityProviderService.ListIdentityProviders:output_type -> memos.api.ListIdentityProvidersResponse + 1, // 14: memos.api.IdentityProviderService.GetIdentityProvider:output_type -> memos.api.IdentityProvider + 1, // 15: memos.api.IdentityProviderService.CreateIdentityProvider:output_type -> memos.api.IdentityProvider + 1, // 16: memos.api.IdentityProviderService.UpdateIdentityProvider:output_type -> memos.api.IdentityProvider + 12, // 17: memos.api.IdentityProviderService.DeleteIdentityProvider:output_type -> google.protobuf.Empty 13, // [13:18] is the sub-list for method output_type 8, // [8:13] is the sub-list for method input_type 8, // [8:8] is the sub-list for extension type_name @@ -777,30 +804,30 @@ var file_api_v1_idp_service_proto_depIdxs = []int32{ 0, // [0:8] is the sub-list for field type_name } -func init() { file_api_v1_idp_service_proto_init() } -func file_api_v1_idp_service_proto_init() { - if File_api_v1_idp_service_proto != nil { +func init() { file_api_idp_service_proto_init() } +func file_api_idp_service_proto_init() { + if File_api_idp_service_proto != nil { return } - file_api_v1_idp_service_proto_msgTypes[1].OneofWrappers = []any{ + file_api_idp_service_proto_msgTypes[7].OneofWrappers = []any{ (*IdentityProviderConfig_Oauth2Config)(nil), } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: unsafe.Slice(unsafe.StringData(file_api_v1_idp_service_proto_rawDesc), len(file_api_v1_idp_service_proto_rawDesc)), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_api_idp_service_proto_rawDesc), len(file_api_idp_service_proto_rawDesc)), NumEnums: 1, NumMessages: 10, NumExtensions: 0, NumServices: 1, }, - GoTypes: file_api_v1_idp_service_proto_goTypes, - DependencyIndexes: file_api_v1_idp_service_proto_depIdxs, - EnumInfos: file_api_v1_idp_service_proto_enumTypes, - MessageInfos: file_api_v1_idp_service_proto_msgTypes, + GoTypes: file_api_idp_service_proto_goTypes, + DependencyIndexes: file_api_idp_service_proto_depIdxs, + EnumInfos: file_api_idp_service_proto_enumTypes, + MessageInfos: file_api_idp_service_proto_msgTypes, }.Build() - File_api_v1_idp_service_proto = out.File - file_api_v1_idp_service_proto_goTypes = nil - file_api_v1_idp_service_proto_depIdxs = nil + File_api_idp_service_proto = out.File + file_api_idp_service_proto_goTypes = nil + file_api_idp_service_proto_depIdxs = nil } diff --git a/proto/gen/api/v1/idp_service.pb.gw.go b/proto/gen/api/idp_service.pb.gw.go similarity index 92% rename from proto/gen/api/v1/idp_service.pb.gw.go rename to proto/gen/api/idp_service.pb.gw.go index d407bc87b..167037457 100644 --- a/proto/gen/api/v1/idp_service.pb.gw.go +++ b/proto/gen/api/idp_service.pb.gw.go @@ -1,12 +1,12 @@ // Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: api/v1/idp_service.proto +// source: api/idp_service.proto /* -Package apiv1 is a reverse proxy. +Package api is a reverse proxy. It translates gRPC into RESTful JSON APIs. */ -package apiv1 +package api import ( "context" @@ -268,7 +268,7 @@ func RegisterIdentityProviderServiceHandlerServer(ctx context.Context, mux *runt var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.IdentityProviderService/ListIdentityProviders", runtime.WithHTTPPathPattern("/api/v1/identity-providers")) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.IdentityProviderService/ListIdentityProviders", runtime.WithHTTPPathPattern("/api/identity-providers")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -288,7 +288,7 @@ func RegisterIdentityProviderServiceHandlerServer(ctx context.Context, mux *runt var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.IdentityProviderService/GetIdentityProvider", runtime.WithHTTPPathPattern("/api/v1/{name=identity-providers/*}")) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.IdentityProviderService/GetIdentityProvider", runtime.WithHTTPPathPattern("/api/{name=identity-providers/*}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -308,7 +308,7 @@ func RegisterIdentityProviderServiceHandlerServer(ctx context.Context, mux *runt var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.IdentityProviderService/CreateIdentityProvider", runtime.WithHTTPPathPattern("/api/v1/identity-providers")) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.IdentityProviderService/CreateIdentityProvider", runtime.WithHTTPPathPattern("/api/identity-providers")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -328,7 +328,7 @@ func RegisterIdentityProviderServiceHandlerServer(ctx context.Context, mux *runt var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.IdentityProviderService/UpdateIdentityProvider", runtime.WithHTTPPathPattern("/api/v1/{identity_provider.name=identity-providers/*}")) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.IdentityProviderService/UpdateIdentityProvider", runtime.WithHTTPPathPattern("/api/{identity_provider.name=identity-providers/*}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -348,7 +348,7 @@ func RegisterIdentityProviderServiceHandlerServer(ctx context.Context, mux *runt var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.IdentityProviderService/DeleteIdentityProvider", runtime.WithHTTPPathPattern("/api/v1/{name=identity-providers/*}")) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.IdentityProviderService/DeleteIdentityProvider", runtime.WithHTTPPathPattern("/api/{name=identity-providers/*}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -406,7 +406,7 @@ func RegisterIdentityProviderServiceHandlerClient(ctx context.Context, mux *runt ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.IdentityProviderService/ListIdentityProviders", runtime.WithHTTPPathPattern("/api/v1/identity-providers")) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.IdentityProviderService/ListIdentityProviders", runtime.WithHTTPPathPattern("/api/identity-providers")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -423,7 +423,7 @@ func RegisterIdentityProviderServiceHandlerClient(ctx context.Context, mux *runt ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.IdentityProviderService/GetIdentityProvider", runtime.WithHTTPPathPattern("/api/v1/{name=identity-providers/*}")) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.IdentityProviderService/GetIdentityProvider", runtime.WithHTTPPathPattern("/api/{name=identity-providers/*}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -440,7 +440,7 @@ func RegisterIdentityProviderServiceHandlerClient(ctx context.Context, mux *runt ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.IdentityProviderService/CreateIdentityProvider", runtime.WithHTTPPathPattern("/api/v1/identity-providers")) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.IdentityProviderService/CreateIdentityProvider", runtime.WithHTTPPathPattern("/api/identity-providers")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -457,7 +457,7 @@ func RegisterIdentityProviderServiceHandlerClient(ctx context.Context, mux *runt ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.IdentityProviderService/UpdateIdentityProvider", runtime.WithHTTPPathPattern("/api/v1/{identity_provider.name=identity-providers/*}")) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.IdentityProviderService/UpdateIdentityProvider", runtime.WithHTTPPathPattern("/api/{identity_provider.name=identity-providers/*}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -474,7 +474,7 @@ func RegisterIdentityProviderServiceHandlerClient(ctx context.Context, mux *runt ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.IdentityProviderService/DeleteIdentityProvider", runtime.WithHTTPPathPattern("/api/v1/{name=identity-providers/*}")) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.IdentityProviderService/DeleteIdentityProvider", runtime.WithHTTPPathPattern("/api/{name=identity-providers/*}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -491,11 +491,11 @@ func RegisterIdentityProviderServiceHandlerClient(ctx context.Context, mux *runt } var ( - pattern_IdentityProviderService_ListIdentityProviders_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "v1", "identity-providers"}, "")) - pattern_IdentityProviderService_GetIdentityProvider_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3}, []string{"api", "v1", "identity-providers", "name"}, "")) - pattern_IdentityProviderService_CreateIdentityProvider_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "v1", "identity-providers"}, "")) - pattern_IdentityProviderService_UpdateIdentityProvider_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3}, []string{"api", "v1", "identity-providers", "identity_provider.name"}, "")) - pattern_IdentityProviderService_DeleteIdentityProvider_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3}, []string{"api", "v1", "identity-providers", "name"}, "")) + pattern_IdentityProviderService_ListIdentityProviders_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"api", "identity-providers"}, "")) + pattern_IdentityProviderService_GetIdentityProvider_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"api", "identity-providers", "name"}, "")) + pattern_IdentityProviderService_CreateIdentityProvider_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"api", "identity-providers"}, "")) + pattern_IdentityProviderService_UpdateIdentityProvider_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"api", "identity-providers", "identity_provider.name"}, "")) + pattern_IdentityProviderService_DeleteIdentityProvider_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"api", "identity-providers", "name"}, "")) ) var ( diff --git a/proto/gen/api/v1/idp_service_grpc.pb.go b/proto/gen/api/idp_service_grpc.pb.go similarity index 88% rename from proto/gen/api/v1/idp_service_grpc.pb.go rename to proto/gen/api/idp_service_grpc.pb.go index 8b9732d80..940d20dd3 100644 --- a/proto/gen/api/v1/idp_service_grpc.pb.go +++ b/proto/gen/api/idp_service_grpc.pb.go @@ -2,9 +2,9 @@ // versions: // - protoc-gen-go-grpc v1.6.2 // - protoc (unknown) -// source: api/v1/idp_service.proto +// source: api/idp_service.proto -package apiv1 +package api import ( context "context" @@ -20,26 +20,35 @@ import ( const _ = grpc.SupportPackageIsVersion9 const ( - IdentityProviderService_ListIdentityProviders_FullMethodName = "/memos.api.v1.IdentityProviderService/ListIdentityProviders" - IdentityProviderService_GetIdentityProvider_FullMethodName = "/memos.api.v1.IdentityProviderService/GetIdentityProvider" - IdentityProviderService_CreateIdentityProvider_FullMethodName = "/memos.api.v1.IdentityProviderService/CreateIdentityProvider" - IdentityProviderService_UpdateIdentityProvider_FullMethodName = "/memos.api.v1.IdentityProviderService/UpdateIdentityProvider" - IdentityProviderService_DeleteIdentityProvider_FullMethodName = "/memos.api.v1.IdentityProviderService/DeleteIdentityProvider" + IdentityProviderService_ListIdentityProviders_FullMethodName = "/memos.api.IdentityProviderService/ListIdentityProviders" + IdentityProviderService_GetIdentityProvider_FullMethodName = "/memos.api.IdentityProviderService/GetIdentityProvider" + IdentityProviderService_CreateIdentityProvider_FullMethodName = "/memos.api.IdentityProviderService/CreateIdentityProvider" + IdentityProviderService_UpdateIdentityProvider_FullMethodName = "/memos.api.IdentityProviderService/UpdateIdentityProvider" + IdentityProviderService_DeleteIdentityProvider_FullMethodName = "/memos.api.IdentityProviderService/DeleteIdentityProvider" ) // IdentityProviderServiceClient is the client API for IdentityProviderService service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +// +// IdentityProviderService manages the external identity providers users can sign in with. type IdentityProviderServiceClient interface { // ListIdentityProviders lists identity providers. + // Public, so the sign-in page can show SSO options. Client secrets are never returned. ListIdentityProviders(ctx context.Context, in *ListIdentityProvidersRequest, opts ...grpc.CallOption) (*ListIdentityProvidersResponse, error) // GetIdentityProvider gets an identity provider. + // The client secret is never returned. GetIdentityProvider(ctx context.Context, in *GetIdentityProviderRequest, opts ...grpc.CallOption) (*IdentityProvider, error) // CreateIdentityProvider creates an identity provider. + // Requires the admin role. Fails with FAILED_PRECONDITION when the ID belongs to a provider configured by the + // deployment. CreateIdentityProvider(ctx context.Context, in *CreateIdentityProviderRequest, opts ...grpc.CallOption) (*IdentityProvider, error) // UpdateIdentityProvider updates an identity provider. + // Requires the admin role. Providers configured by the deployment cannot be updated. UpdateIdentityProvider(ctx context.Context, in *UpdateIdentityProviderRequest, opts ...grpc.CallOption) (*IdentityProvider, error) // DeleteIdentityProvider deletes an identity provider. + // Requires the admin role. Providers configured by the deployment cannot be deleted. Fails with + // FAILED_PRECONDITION when password sign-in is disabled for regular users and no other effective provider remains. DeleteIdentityProvider(ctx context.Context, in *DeleteIdentityProviderRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) } @@ -104,16 +113,25 @@ func (c *identityProviderServiceClient) DeleteIdentityProvider(ctx context.Conte // IdentityProviderServiceServer is the server API for IdentityProviderService service. // All implementations must embed UnimplementedIdentityProviderServiceServer // for forward compatibility. +// +// IdentityProviderService manages the external identity providers users can sign in with. type IdentityProviderServiceServer interface { // ListIdentityProviders lists identity providers. + // Public, so the sign-in page can show SSO options. Client secrets are never returned. ListIdentityProviders(context.Context, *ListIdentityProvidersRequest) (*ListIdentityProvidersResponse, error) // GetIdentityProvider gets an identity provider. + // The client secret is never returned. GetIdentityProvider(context.Context, *GetIdentityProviderRequest) (*IdentityProvider, error) // CreateIdentityProvider creates an identity provider. + // Requires the admin role. Fails with FAILED_PRECONDITION when the ID belongs to a provider configured by the + // deployment. CreateIdentityProvider(context.Context, *CreateIdentityProviderRequest) (*IdentityProvider, error) // UpdateIdentityProvider updates an identity provider. + // Requires the admin role. Providers configured by the deployment cannot be updated. UpdateIdentityProvider(context.Context, *UpdateIdentityProviderRequest) (*IdentityProvider, error) // DeleteIdentityProvider deletes an identity provider. + // Requires the admin role. Providers configured by the deployment cannot be deleted. Fails with + // FAILED_PRECONDITION when password sign-in is disabled for regular users and no other effective provider remains. DeleteIdentityProvider(context.Context, *DeleteIdentityProviderRequest) (*emptypb.Empty, error) mustEmbedUnimplementedIdentityProviderServiceServer() } @@ -256,7 +274,7 @@ func _IdentityProviderService_DeleteIdentityProvider_Handler(srv interface{}, ct // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) var IdentityProviderService_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "memos.api.v1.IdentityProviderService", + ServiceName: "memos.api.IdentityProviderService", HandlerType: (*IdentityProviderServiceServer)(nil), Methods: []grpc.MethodDesc{ { @@ -281,5 +299,5 @@ var IdentityProviderService_ServiceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: "api/v1/idp_service.proto", + Metadata: "api/idp_service.proto", } diff --git a/proto/gen/api/v1/instance_service.pb.go b/proto/gen/api/instance_service.pb.go similarity index 59% rename from proto/gen/api/v1/instance_service.pb.go rename to proto/gen/api/instance_service.pb.go index a71f6fe8c..633f20711 100644 --- a/proto/gen/api/v1/instance_service.pb.go +++ b/proto/gen/api/instance_service.pb.go @@ -2,9 +2,9 @@ // versions: // protoc-gen-go v1.36.12 // protoc (unknown) -// source: api/v1/instance_service.proto +// source: api/instance_service.proto -package apiv1 +package api import ( _ "google.golang.org/genproto/googleapis/api/annotations" @@ -31,8 +31,11 @@ type InstanceAccessMode int32 const ( InstanceAccessMode_INSTANCE_ACCESS_MODE_UNSPECIFIED InstanceAccessMode = 0 - InstanceAccessMode_INSTANCE_ACCESS_MODE_PRIVATE InstanceAccessMode = 1 - InstanceAccessMode_INSTANCE_ACCESS_MODE_PUBLIC InstanceAccessMode = 2 + // Unauthenticated users may only reach the endpoints needed to sign in, register and open share links. + // This is the default. + InstanceAccessMode_INSTANCE_ACCESS_MODE_PRIVATE InstanceAccessMode = 1 + // Unauthenticated users may read public content. + InstanceAccessMode_INSTANCE_ACCESS_MODE_PUBLIC InstanceAccessMode = 2 ) // Enum value maps for InstanceAccessMode. @@ -60,11 +63,11 @@ func (x InstanceAccessMode) String() string { } func (InstanceAccessMode) Descriptor() protoreflect.EnumDescriptor { - return file_api_v1_instance_service_proto_enumTypes[0].Descriptor() + return file_api_instance_service_proto_enumTypes[0].Descriptor() } func (InstanceAccessMode) Type() protoreflect.EnumType { - return &file_api_v1_instance_service_proto_enumTypes[0] + return &file_api_instance_service_proto_enumTypes[0] } func (x InstanceAccessMode) Number() protoreflect.EnumNumber { @@ -73,27 +76,27 @@ func (x InstanceAccessMode) Number() protoreflect.EnumNumber { // Deprecated: Use InstanceAccessMode.Descriptor instead. func (InstanceAccessMode) EnumDescriptor() ([]byte, []int) { - return file_api_v1_instance_service_proto_rawDescGZIP(), []int{0} + return file_api_instance_service_proto_rawDescGZIP(), []int{0} } -// Enumeration of instance setting keys. +// Key identifies an instance setting. type InstanceSetting_Key int32 const ( InstanceSetting_KEY_UNSPECIFIED InstanceSetting_Key = 0 - // GENERAL is the key for general settings. + // General settings. InstanceSetting_GENERAL InstanceSetting_Key = 1 - // STORAGE is the key for storage settings. + // Attachment storage settings. InstanceSetting_STORAGE InstanceSetting_Key = 2 - // MEMO_RELATED is the key for memo related settings. + // Memo-related settings. InstanceSetting_MEMO_RELATED InstanceSetting_Key = 3 - // TAGS is the key for tag metadata. + // Tag metadata. InstanceSetting_TAGS InstanceSetting_Key = 4 - // NOTIFICATION is the key for notification transport settings. + // Notification transport settings. InstanceSetting_NOTIFICATION InstanceSetting_Key = 5 - // AI is the key for AI provider settings. + // AI provider settings. InstanceSetting_AI InstanceSetting_Key = 6 - // ACCESS is the key for instance access policy settings. + // Instance access policy settings. InstanceSetting_ACCESS InstanceSetting_Key = 7 ) @@ -132,11 +135,11 @@ func (x InstanceSetting_Key) String() string { } func (InstanceSetting_Key) Descriptor() protoreflect.EnumDescriptor { - return file_api_v1_instance_service_proto_enumTypes[1].Descriptor() + return file_api_instance_service_proto_enumTypes[1].Descriptor() } func (InstanceSetting_Key) Type() protoreflect.EnumType { - return &file_api_v1_instance_service_proto_enumTypes[1] + return &file_api_instance_service_proto_enumTypes[1] } func (x InstanceSetting_Key) Number() protoreflect.EnumNumber { @@ -145,18 +148,19 @@ func (x InstanceSetting_Key) Number() protoreflect.EnumNumber { // Deprecated: Use InstanceSetting_Key.Descriptor instead. func (InstanceSetting_Key) EnumDescriptor() ([]byte, []int) { - return file_api_v1_instance_service_proto_rawDescGZIP(), []int{2, 0} + return file_api_instance_service_proto_rawDescGZIP(), []int{2, 0} } +// StorageType is the backend of a configured storage. type InstanceSetting_StorageType int32 const ( InstanceSetting_STORAGE_TYPE_UNSPECIFIED InstanceSetting_StorageType = 0 - // DATABASE stores attachment content in the application database. + // Stores attachment content in the application database. InstanceSetting_DATABASE InstanceSetting_StorageType = 1 - // LOCAL stores attachment content on the local filesystem. + // Stores attachment content on the local filesystem. InstanceSetting_LOCAL InstanceSetting_StorageType = 2 - // S3 stores attachment content in an S3-compatible object store. + // Stores attachment content in an S3-compatible object store. InstanceSetting_S3 InstanceSetting_StorageType = 3 ) @@ -187,11 +191,11 @@ func (x InstanceSetting_StorageType) String() string { } func (InstanceSetting_StorageType) Descriptor() protoreflect.EnumDescriptor { - return file_api_v1_instance_service_proto_enumTypes[2].Descriptor() + return file_api_instance_service_proto_enumTypes[2].Descriptor() } func (InstanceSetting_StorageType) Type() protoreflect.EnumType { - return &file_api_v1_instance_service_proto_enumTypes[2] + return &file_api_instance_service_proto_enumTypes[2] } func (x InstanceSetting_StorageType) Number() protoreflect.EnumNumber { @@ -200,7 +204,7 @@ func (x InstanceSetting_StorageType) Number() protoreflect.EnumNumber { // Deprecated: Use InstanceSetting_StorageType.Descriptor instead. func (InstanceSetting_StorageType) EnumDescriptor() ([]byte, []int) { - return file_api_v1_instance_service_proto_rawDescGZIP(), []int{2, 1} + return file_api_instance_service_proto_rawDescGZIP(), []int{2, 1} } // AIProviderType is the provider implementation type. @@ -208,8 +212,10 @@ type InstanceSetting_AIProviderType int32 const ( InstanceSetting_AI_PROVIDER_TYPE_UNSPECIFIED InstanceSetting_AIProviderType = 0 - InstanceSetting_OPENAI InstanceSetting_AIProviderType = 1 - InstanceSetting_GEMINI InstanceSetting_AIProviderType = 2 + // OpenAI API. The endpoint defaults to https://api.openai.com/v1. + InstanceSetting_OPENAI InstanceSetting_AIProviderType = 1 + // Google Gemini API. The endpoint defaults to https://generativelanguage.googleapis.com/v1beta. + InstanceSetting_GEMINI InstanceSetting_AIProviderType = 2 ) // Enum value maps for InstanceSetting_AIProviderType. @@ -237,11 +243,11 @@ func (x InstanceSetting_AIProviderType) String() string { } func (InstanceSetting_AIProviderType) Descriptor() protoreflect.EnumDescriptor { - return file_api_v1_instance_service_proto_enumTypes[3].Descriptor() + return file_api_instance_service_proto_enumTypes[3].Descriptor() } func (InstanceSetting_AIProviderType) Type() protoreflect.EnumType { - return &file_api_v1_instance_service_proto_enumTypes[3] + return &file_api_instance_service_proto_enumTypes[3] } func (x InstanceSetting_AIProviderType) Number() protoreflect.EnumNumber { @@ -250,19 +256,19 @@ func (x InstanceSetting_AIProviderType) Number() protoreflect.EnumNumber { // Deprecated: Use InstanceSetting_AIProviderType.Descriptor instead. func (InstanceSetting_AIProviderType) EnumDescriptor() ([]byte, []int) { - return file_api_v1_instance_service_proto_rawDescGZIP(), []int{2, 2} + return file_api_instance_service_proto_rawDescGZIP(), []int{2, 2} } -// Legacy storage type enum retained for compatibility with existing clients. +// StorageType is the legacy storage type, retained for compatibility with existing clients. type InstanceSetting_StorageSetting_StorageType int32 const ( InstanceSetting_StorageSetting_STORAGE_TYPE_UNSPECIFIED InstanceSetting_StorageSetting_StorageType = 0 - // DATABASE is the database storage type. + // Database storage. InstanceSetting_StorageSetting_DATABASE InstanceSetting_StorageSetting_StorageType = 1 - // LOCAL is the local storage type. + // Local filesystem storage. InstanceSetting_StorageSetting_LOCAL InstanceSetting_StorageSetting_StorageType = 2 - // S3 is the S3 storage type. + // S3 storage. InstanceSetting_StorageSetting_S3 InstanceSetting_StorageSetting_StorageType = 3 ) @@ -293,11 +299,11 @@ func (x InstanceSetting_StorageSetting_StorageType) String() string { } func (InstanceSetting_StorageSetting_StorageType) Descriptor() protoreflect.EnumDescriptor { - return file_api_v1_instance_service_proto_enumTypes[4].Descriptor() + return file_api_instance_service_proto_enumTypes[4].Descriptor() } func (InstanceSetting_StorageSetting_StorageType) Type() protoreflect.EnumType { - return &file_api_v1_instance_service_proto_enumTypes[4] + return &file_api_instance_service_proto_enumTypes[4] } func (x InstanceSetting_StorageSetting_StorageType) Number() protoreflect.EnumNumber { @@ -306,39 +312,40 @@ func (x InstanceSetting_StorageSetting_StorageType) Number() protoreflect.EnumNu // Deprecated: Use InstanceSetting_StorageSetting_StorageType.Descriptor instead. func (InstanceSetting_StorageSetting_StorageType) EnumDescriptor() ([]byte, []int) { - return file_api_v1_instance_service_proto_rawDescGZIP(), []int{2, 2, 0} + return file_api_instance_service_proto_rawDescGZIP(), []int{2, 1, 0} } -// Instance profile message containing basic instance information. +// InstanceProfile is the basic information about the instance. type InstanceProfile struct { state protoimpl.MessageState `protogen:"open.v1"` - // Version is the current version of instance. - Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` - // Demo indicates if the instance is in demo mode. + // The version of the running server. + Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` + // The build commit of the running server. + Commit string `protobuf:"bytes,2,opt,name=commit,proto3" json:"commit,omitempty"` + // Whether the instance runs in demo mode. Demo bool `protobuf:"varint,3,opt,name=demo,proto3" json:"demo,omitempty"` - // Instance URL is the URL of the instance. - InstanceUrl string `protobuf:"bytes,6,opt,name=instance_url,json=instanceUrl,proto3" json:"instance_url,omitempty"` - // The first administrator who set up this instance, for display purposes. - // May be null on an instance that has lost all admins; use needs_setup to - // determine whether initial setup is actually required. - Admin *User `protobuf:"bytes,7,opt,name=admin,proto3" json:"admin,omitempty"` - // Commit is the current build commit of instance. - Commit string `protobuf:"bytes,8,opt,name=commit,proto3" json:"commit,omitempty"` - // NeedsSetup is true when the instance has no users yet and requires initial - // setup (creating the first admin account). Unlike a null admin, this stays - // false once any user exists, so an instance that has lost its admins is not + // The configured URL of the instance. + InstanceUrl string `protobuf:"bytes,4,opt,name=instance_url,json=instanceUrl,proto3" json:"instance_url,omitempty"` + // Whether unauthenticated users may access instance content. + AccessMode InstanceAccessMode `protobuf:"varint,5,opt,name=access_mode,json=accessMode,proto3,enum=memos.api.InstanceAccessMode" json:"access_mode,omitempty"` + // Whether the instance has no users yet and requires initial setup (creating the first admin account). + // Unlike a null admin, this stays false once any user exists, so an instance that has lost its admins is not // mistaken for a fresh install. - NeedsSetup bool `protobuf:"varint,9,opt,name=needs_setup,json=needsSetup,proto3" json:"needs_setup,omitempty"` - // Access mode controls whether unauthenticated users may access instance content. - AccessMode InstanceAccessMode `protobuf:"varint,10,opt,name=access_mode,json=accessMode,proto3,enum=memos.api.v1.InstanceAccessMode" json:"access_mode,omitempty"` - Challenge *InstanceProfile_Challenge `protobuf:"bytes,11,opt,name=challenge,proto3" json:"challenge,omitempty"` + NeedsSetup bool `protobuf:"varint,6,opt,name=needs_setup,json=needsSetup,proto3" json:"needs_setup,omitempty"` + // The first administrator of the instance, for display purposes. + // May be null on an instance that has lost all admins; use needs_setup to determine whether initial setup is + // required. + Admin *User `protobuf:"bytes,7,opt,name=admin,proto3" json:"admin,omitempty"` + // The proof-of-humanity challenge required on signup and password sign-in. + // Absent when none is configured, which is the case on every self-hosted instance. + Challenge *InstanceProfile_Challenge `protobuf:"bytes,8,opt,name=challenge,proto3" json:"challenge,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } func (x *InstanceProfile) Reset() { *x = InstanceProfile{} - mi := &file_api_v1_instance_service_proto_msgTypes[0] + mi := &file_api_instance_service_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -350,7 +357,7 @@ func (x *InstanceProfile) String() string { func (*InstanceProfile) ProtoMessage() {} func (x *InstanceProfile) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_instance_service_proto_msgTypes[0] + mi := &file_api_instance_service_proto_msgTypes[0] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -363,7 +370,7 @@ func (x *InstanceProfile) ProtoReflect() protoreflect.Message { // Deprecated: Use InstanceProfile.ProtoReflect.Descriptor instead. func (*InstanceProfile) Descriptor() ([]byte, []int) { - return file_api_v1_instance_service_proto_rawDescGZIP(), []int{0} + return file_api_instance_service_proto_rawDescGZIP(), []int{0} } func (x *InstanceProfile) GetVersion() string { @@ -373,6 +380,13 @@ func (x *InstanceProfile) GetVersion() string { return "" } +func (x *InstanceProfile) GetCommit() string { + if x != nil { + return x.Commit + } + return "" +} + func (x *InstanceProfile) GetDemo() bool { if x != nil { return x.Demo @@ -387,18 +401,11 @@ func (x *InstanceProfile) GetInstanceUrl() string { return "" } -func (x *InstanceProfile) GetAdmin() *User { +func (x *InstanceProfile) GetAccessMode() InstanceAccessMode { if x != nil { - return x.Admin + return x.AccessMode } - return nil -} - -func (x *InstanceProfile) GetCommit() string { - if x != nil { - return x.Commit - } - return "" + return InstanceAccessMode_INSTANCE_ACCESS_MODE_UNSPECIFIED } func (x *InstanceProfile) GetNeedsSetup() bool { @@ -408,11 +415,11 @@ func (x *InstanceProfile) GetNeedsSetup() bool { return false } -func (x *InstanceProfile) GetAccessMode() InstanceAccessMode { +func (x *InstanceProfile) GetAdmin() *User { if x != nil { - return x.AccessMode + return x.Admin } - return InstanceAccessMode_INSTANCE_ACCESS_MODE_UNSPECIFIED + return nil } func (x *InstanceProfile) GetChallenge() *InstanceProfile_Challenge { @@ -422,7 +429,7 @@ func (x *InstanceProfile) GetChallenge() *InstanceProfile_Challenge { return nil } -// Request for instance profile. +// Request message for InstanceService.GetInstanceProfile. type GetInstanceProfileRequest struct { state protoimpl.MessageState `protogen:"open.v1"` unknownFields protoimpl.UnknownFields @@ -431,7 +438,7 @@ type GetInstanceProfileRequest struct { func (x *GetInstanceProfileRequest) Reset() { *x = GetInstanceProfileRequest{} - mi := &file_api_v1_instance_service_proto_msgTypes[1] + mi := &file_api_instance_service_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -443,7 +450,7 @@ func (x *GetInstanceProfileRequest) String() string { func (*GetInstanceProfileRequest) ProtoMessage() {} func (x *GetInstanceProfileRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_instance_service_proto_msgTypes[1] + mi := &file_api_instance_service_proto_msgTypes[1] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -456,15 +463,17 @@ func (x *GetInstanceProfileRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetInstanceProfileRequest.ProtoReflect.Descriptor instead. func (*GetInstanceProfileRequest) Descriptor() ([]byte, []int) { - return file_api_v1_instance_service_proto_rawDescGZIP(), []int{1} + return file_api_instance_service_proto_rawDescGZIP(), []int{1} } -// An instance setting resource. +// InstanceSetting is one group of instance-wide settings, selected by its key. type InstanceSetting struct { state protoimpl.MessageState `protogen:"open.v1"` - // The name of the instance setting. + // Identifier. The resource name of the instance setting. {setting} is a Key value, such as GENERAL. // Format: instance/settings/{setting} Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // The setting value. The set field matches the key in name. + // // Types that are valid to be assigned to Value: // // *InstanceSetting_GeneralSetting_ @@ -481,7 +490,7 @@ type InstanceSetting struct { func (x *InstanceSetting) Reset() { *x = InstanceSetting{} - mi := &file_api_v1_instance_service_proto_msgTypes[2] + mi := &file_api_instance_service_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -493,7 +502,7 @@ func (x *InstanceSetting) String() string { func (*InstanceSetting) ProtoMessage() {} func (x *InstanceSetting) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_instance_service_proto_msgTypes[2] + mi := &file_api_instance_service_proto_msgTypes[2] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -506,7 +515,7 @@ func (x *InstanceSetting) ProtoReflect() protoreflect.Message { // Deprecated: Use InstanceSetting.ProtoReflect.Descriptor instead. func (*InstanceSetting) Descriptor() ([]byte, []int) { - return file_api_v1_instance_service_proto_rawDescGZIP(), []int{2} + return file_api_instance_service_proto_rawDescGZIP(), []int{2} } func (x *InstanceSetting) GetName() string { @@ -591,30 +600,37 @@ type isInstanceSetting_Value interface { } type InstanceSetting_GeneralSetting_ struct { + // The value of the GENERAL setting. GeneralSetting *InstanceSetting_GeneralSetting `protobuf:"bytes,2,opt,name=general_setting,json=generalSetting,proto3,oneof"` } type InstanceSetting_StorageSetting_ struct { + // The value of the STORAGE setting. StorageSetting *InstanceSetting_StorageSetting `protobuf:"bytes,3,opt,name=storage_setting,json=storageSetting,proto3,oneof"` } type InstanceSetting_MemoRelatedSetting_ struct { + // The value of the MEMO_RELATED setting. MemoRelatedSetting *InstanceSetting_MemoRelatedSetting `protobuf:"bytes,4,opt,name=memo_related_setting,json=memoRelatedSetting,proto3,oneof"` } type InstanceSetting_TagsSetting_ struct { + // The value of the TAGS setting. TagsSetting *InstanceSetting_TagsSetting `protobuf:"bytes,5,opt,name=tags_setting,json=tagsSetting,proto3,oneof"` } type InstanceSetting_NotificationSetting_ struct { + // The value of the NOTIFICATION setting. NotificationSetting *InstanceSetting_NotificationSetting `protobuf:"bytes,6,opt,name=notification_setting,json=notificationSetting,proto3,oneof"` } type InstanceSetting_AiSetting struct { + // The value of the AI setting. AiSetting *InstanceSetting_AISetting `protobuf:"bytes,7,opt,name=ai_setting,json=aiSetting,proto3,oneof"` } type InstanceSetting_AccessSetting_ struct { + // The value of the ACCESS setting. AccessSetting *InstanceSetting_AccessSetting `protobuf:"bytes,8,opt,name=access_setting,json=accessSetting,proto3,oneof"` } @@ -632,10 +648,10 @@ func (*InstanceSetting_AiSetting) isInstanceSetting_Value() {} func (*InstanceSetting_AccessSetting_) isInstanceSetting_Value() {} -// Request message for GetInstanceSetting method. +// Request message for InstanceService.GetInstanceSetting. type GetInstanceSettingRequest struct { state protoimpl.MessageState `protogen:"open.v1"` - // The resource name of the instance setting. + // Required. The resource name of the instance setting. // Format: instance/settings/{setting} Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` unknownFields protoimpl.UnknownFields @@ -644,7 +660,7 @@ type GetInstanceSettingRequest struct { func (x *GetInstanceSettingRequest) Reset() { *x = GetInstanceSettingRequest{} - mi := &file_api_v1_instance_service_proto_msgTypes[3] + mi := &file_api_instance_service_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -656,7 +672,7 @@ func (x *GetInstanceSettingRequest) String() string { func (*GetInstanceSettingRequest) ProtoMessage() {} func (x *GetInstanceSettingRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_instance_service_proto_msgTypes[3] + mi := &file_api_instance_service_proto_msgTypes[3] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -669,7 +685,7 @@ func (x *GetInstanceSettingRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetInstanceSettingRequest.ProtoReflect.Descriptor instead. func (*GetInstanceSettingRequest) Descriptor() ([]byte, []int) { - return file_api_v1_instance_service_proto_rawDescGZIP(), []int{3} + return file_api_instance_service_proto_rawDescGZIP(), []int{3} } func (x *GetInstanceSettingRequest) GetName() string { @@ -679,10 +695,10 @@ func (x *GetInstanceSettingRequest) GetName() string { return "" } -// Request message for BatchGetInstanceSettings method. +// Request message for InstanceService.BatchGetInstanceSettings. type BatchGetInstanceSettingsRequest struct { state protoimpl.MessageState `protogen:"open.v1"` - // The resource names of the instance settings. + // Required. The resource names of the instance settings. At most 100. // Format: instance/settings/{setting} Names []string `protobuf:"bytes,1,rep,name=names,proto3" json:"names,omitempty"` unknownFields protoimpl.UnknownFields @@ -691,7 +707,7 @@ type BatchGetInstanceSettingsRequest struct { func (x *BatchGetInstanceSettingsRequest) Reset() { *x = BatchGetInstanceSettingsRequest{} - mi := &file_api_v1_instance_service_proto_msgTypes[4] + mi := &file_api_instance_service_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -703,7 +719,7 @@ func (x *BatchGetInstanceSettingsRequest) String() string { func (*BatchGetInstanceSettingsRequest) ProtoMessage() {} func (x *BatchGetInstanceSettingsRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_instance_service_proto_msgTypes[4] + mi := &file_api_instance_service_proto_msgTypes[4] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -716,7 +732,7 @@ func (x *BatchGetInstanceSettingsRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use BatchGetInstanceSettingsRequest.ProtoReflect.Descriptor instead. func (*BatchGetInstanceSettingsRequest) Descriptor() ([]byte, []int) { - return file_api_v1_instance_service_proto_rawDescGZIP(), []int{4} + return file_api_instance_service_proto_rawDescGZIP(), []int{4} } func (x *BatchGetInstanceSettingsRequest) GetNames() []string { @@ -726,18 +742,18 @@ func (x *BatchGetInstanceSettingsRequest) GetNames() []string { return nil } -// Response message for BatchGetInstanceSettings method. +// Response message for InstanceService.BatchGetInstanceSettings. type BatchGetInstanceSettingsResponse struct { state protoimpl.MessageState `protogen:"open.v1"` - // The instance settings in the same order as the input names. - Settings []*InstanceSetting `protobuf:"bytes,1,rep,name=settings,proto3" json:"settings,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache + // The instance settings, in the same order as the requested names. + InstanceSettings []*InstanceSetting `protobuf:"bytes,1,rep,name=instance_settings,json=instanceSettings,proto3" json:"instance_settings,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *BatchGetInstanceSettingsResponse) Reset() { *x = BatchGetInstanceSettingsResponse{} - mi := &file_api_v1_instance_service_proto_msgTypes[5] + mi := &file_api_instance_service_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -749,7 +765,7 @@ func (x *BatchGetInstanceSettingsResponse) String() string { func (*BatchGetInstanceSettingsResponse) ProtoMessage() {} func (x *BatchGetInstanceSettingsResponse) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_instance_service_proto_msgTypes[5] + mi := &file_api_instance_service_proto_msgTypes[5] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -762,22 +778,22 @@ func (x *BatchGetInstanceSettingsResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use BatchGetInstanceSettingsResponse.ProtoReflect.Descriptor instead. func (*BatchGetInstanceSettingsResponse) Descriptor() ([]byte, []int) { - return file_api_v1_instance_service_proto_rawDescGZIP(), []int{5} + return file_api_instance_service_proto_rawDescGZIP(), []int{5} } -func (x *BatchGetInstanceSettingsResponse) GetSettings() []*InstanceSetting { +func (x *BatchGetInstanceSettingsResponse) GetInstanceSettings() []*InstanceSetting { if x != nil { - return x.Settings + return x.InstanceSettings } return nil } -// Request message for UpdateInstanceSetting method. +// Request message for InstanceService.UpdateInstanceSetting. type UpdateInstanceSettingRequest struct { state protoimpl.MessageState `protogen:"open.v1"` - // The instance setting resource which replaces the resource on the server. - Setting *InstanceSetting `protobuf:"bytes,1,opt,name=setting,proto3" json:"setting,omitempty"` - // The list of fields to update. + // Required. The instance setting, which replaces the stored setting. + InstanceSetting *InstanceSetting `protobuf:"bytes,1,opt,name=instance_setting,json=instanceSetting,proto3" json:"instance_setting,omitempty"` + // Optional. The list of fields to update. Currently ignored; the whole setting is replaced. UpdateMask *fieldmaskpb.FieldMask `protobuf:"bytes,2,opt,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache @@ -785,7 +801,7 @@ type UpdateInstanceSettingRequest struct { func (x *UpdateInstanceSettingRequest) Reset() { *x = UpdateInstanceSettingRequest{} - mi := &file_api_v1_instance_service_proto_msgTypes[6] + mi := &file_api_instance_service_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -797,7 +813,7 @@ func (x *UpdateInstanceSettingRequest) String() string { func (*UpdateInstanceSettingRequest) ProtoMessage() {} func (x *UpdateInstanceSettingRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_instance_service_proto_msgTypes[6] + mi := &file_api_instance_service_proto_msgTypes[6] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -810,12 +826,12 @@ func (x *UpdateInstanceSettingRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use UpdateInstanceSettingRequest.ProtoReflect.Descriptor instead. func (*UpdateInstanceSettingRequest) Descriptor() ([]byte, []int) { - return file_api_v1_instance_service_proto_rawDescGZIP(), []int{6} + return file_api_instance_service_proto_rawDescGZIP(), []int{6} } -func (x *UpdateInstanceSettingRequest) GetSetting() *InstanceSetting { +func (x *UpdateInstanceSettingRequest) GetInstanceSetting() *InstanceSetting { if x != nil { - return x.Setting + return x.InstanceSetting } return nil } @@ -827,12 +843,13 @@ func (x *UpdateInstanceSettingRequest) GetUpdateMask() *fieldmaskpb.FieldMask { return nil } -// Request message for TestInstanceEmailSetting method. +// Request message for InstanceService.TestInstanceEmailSetting. type TestInstanceEmailSettingRequest struct { state protoimpl.MessageState `protogen:"open.v1"` - // Optional. SMTP email settings to test. If omitted, the stored notification email setting is used. + // Optional. The SMTP settings to test. If omitted, the stored notification email setting is used. An empty + // password reuses the stored password when the connection settings are unchanged. Email *InstanceSetting_NotificationSetting_EmailSetting `protobuf:"bytes,1,opt,name=email,proto3" json:"email,omitempty"` - // Optional. Recipient email address. If omitted, the current user's email address is used. + // Optional. The recipient email address. If omitted, the current user's email address is used. RecipientEmail string `protobuf:"bytes,2,opt,name=recipient_email,json=recipientEmail,proto3" json:"recipient_email,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache @@ -840,7 +857,7 @@ type TestInstanceEmailSettingRequest struct { func (x *TestInstanceEmailSettingRequest) Reset() { *x = TestInstanceEmailSettingRequest{} - mi := &file_api_v1_instance_service_proto_msgTypes[7] + mi := &file_api_instance_service_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -852,7 +869,7 @@ func (x *TestInstanceEmailSettingRequest) String() string { func (*TestInstanceEmailSettingRequest) ProtoMessage() {} func (x *TestInstanceEmailSettingRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_instance_service_proto_msgTypes[7] + mi := &file_api_instance_service_proto_msgTypes[7] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -865,7 +882,7 @@ func (x *TestInstanceEmailSettingRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use TestInstanceEmailSettingRequest.ProtoReflect.Descriptor instead. func (*TestInstanceEmailSettingRequest) Descriptor() ([]byte, []int) { - return file_api_v1_instance_service_proto_rawDescGZIP(), []int{7} + return file_api_instance_service_proto_rawDescGZIP(), []int{7} } func (x *TestInstanceEmailSettingRequest) GetEmail() *InstanceSetting_NotificationSetting_EmailSetting { @@ -882,58 +899,22 @@ func (x *TestInstanceEmailSettingRequest) GetRecipientEmail() string { return "" } -// Request message for GetInstanceStats. -type GetInstanceStatsRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *GetInstanceStatsRequest) Reset() { - *x = GetInstanceStatsRequest{} - mi := &file_api_v1_instance_service_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *GetInstanceStatsRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetInstanceStatsRequest) ProtoMessage() {} - -func (x *GetInstanceStatsRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_instance_service_proto_msgTypes[8] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetInstanceStatsRequest.ProtoReflect.Descriptor instead. -func (*GetInstanceStatsRequest) Descriptor() ([]byte, []int) { - return file_api_v1_instance_service_proto_rawDescGZIP(), []int{8} -} - -// Resource usage statistics for the instance. +// InstanceStats is a snapshot of the instance's resource usage. type InstanceStats struct { - state protoimpl.MessageState `protogen:"open.v1"` + state protoimpl.MessageState `protogen:"open.v1"` + // The database size statistics. Database *InstanceStats_DatabaseStats `protobuf:"bytes,1,opt,name=database,proto3" json:"database,omitempty"` - // Recursive size of the data directory in bytes. -1 if unavailable. + // The recursive size of the data directory in bytes. -1 if unavailable. LocalStorageBytes int64 `protobuf:"varint,2,opt,name=local_storage_bytes,json=localStorageBytes,proto3" json:"local_storage_bytes,omitempty"` - // Server-side timestamp when the snapshot was generated. - GeneratedTime *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=generated_time,json=generatedTime,proto3" json:"generated_time,omitempty"` + // The time the snapshot was generated on the server. + GeneratedTime *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=generated_time,json=generatedTime,proto3" json:"generated_time,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } func (x *InstanceStats) Reset() { *x = InstanceStats{} - mi := &file_api_v1_instance_service_proto_msgTypes[9] + mi := &file_api_instance_service_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -945,7 +926,7 @@ func (x *InstanceStats) String() string { func (*InstanceStats) ProtoMessage() {} func (x *InstanceStats) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_instance_service_proto_msgTypes[9] + mi := &file_api_instance_service_proto_msgTypes[8] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -958,7 +939,7 @@ func (x *InstanceStats) ProtoReflect() protoreflect.Message { // Deprecated: Use InstanceStats.ProtoReflect.Descriptor instead. func (*InstanceStats) Descriptor() ([]byte, []int) { - return file_api_v1_instance_service_proto_rawDescGZIP(), []int{9} + return file_api_instance_service_proto_rawDescGZIP(), []int{8} } func (x *InstanceStats) GetDatabase() *InstanceStats_DatabaseStats { @@ -982,9 +963,44 @@ func (x *InstanceStats) GetGeneratedTime() *timestamppb.Timestamp { return nil } -// A proof-of-humanity challenge the deployment requires on signup and -// password sign-in. Absent when none is configured, which is the case on -// every self-hosted instance. +// Request message for InstanceService.GetInstanceStats. +type GetInstanceStatsRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetInstanceStatsRequest) Reset() { + *x = GetInstanceStatsRequest{} + mi := &file_api_instance_service_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetInstanceStatsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetInstanceStatsRequest) ProtoMessage() {} + +func (x *GetInstanceStatsRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_instance_service_proto_msgTypes[9] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetInstanceStatsRequest.ProtoReflect.Descriptor instead. +func (*GetInstanceStatsRequest) Descriptor() ([]byte, []int) { + return file_api_instance_service_proto_rawDescGZIP(), []int{9} +} + +// Challenge describes a proof-of-humanity challenge widget. type InstanceProfile_Challenge struct { state protoimpl.MessageState `protogen:"open.v1"` // The challenge provider, which selects the widget the web app renders. @@ -997,7 +1013,7 @@ type InstanceProfile_Challenge struct { func (x *InstanceProfile_Challenge) Reset() { *x = InstanceProfile_Challenge{} - mi := &file_api_v1_instance_service_proto_msgTypes[10] + mi := &file_api_instance_service_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1009,7 +1025,7 @@ func (x *InstanceProfile_Challenge) String() string { func (*InstanceProfile_Challenge) ProtoMessage() {} func (x *InstanceProfile_Challenge) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_instance_service_proto_msgTypes[10] + mi := &file_api_instance_service_proto_msgTypes[10] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1022,7 +1038,7 @@ func (x *InstanceProfile_Challenge) ProtoReflect() protoreflect.Message { // Deprecated: Use InstanceProfile_Challenge.ProtoReflect.Descriptor instead. func (*InstanceProfile_Challenge) Descriptor() ([]byte, []int) { - return file_api_v1_instance_service_proto_rawDescGZIP(), []int{0, 0} + return file_api_instance_service_proto_rawDescGZIP(), []int{0, 0} } func (x *InstanceProfile_Challenge) GetProvider() string { @@ -1039,34 +1055,34 @@ func (x *InstanceProfile_Challenge) GetSiteKey() string { return "" } -// General instance settings configuration. +// GeneralSetting is the general instance configuration. type InstanceSetting_GeneralSetting struct { state protoimpl.MessageState `protogen:"open.v1"` - // disallow_user_registration disallows user registration. + // Branding shown in the web app. + CustomProfile *InstanceSetting_GeneralSetting_CustomProfile `protobuf:"bytes,1,opt,name=custom_profile,json=customProfile,proto3" json:"custom_profile,omitempty"` + // Whether user self-registration is disabled. DisallowUserRegistration bool `protobuf:"varint,2,opt,name=disallow_user_registration,json=disallowUserRegistration,proto3" json:"disallow_user_registration,omitempty"` - // disallow_password_auth disallows password authentication. + // Whether password authentication is disabled. DisallowPasswordAuth bool `protobuf:"varint,3,opt,name=disallow_password_auth,json=disallowPasswordAuth,proto3" json:"disallow_password_auth,omitempty"` - // additional_script is the additional script. - AdditionalScript string `protobuf:"bytes,4,opt,name=additional_script,json=additionalScript,proto3" json:"additional_script,omitempty"` - // additional_style is the additional style. - AdditionalStyle string `protobuf:"bytes,5,opt,name=additional_style,json=additionalStyle,proto3" json:"additional_style,omitempty"` - // custom_profile is the custom profile. - CustomProfile *InstanceSetting_GeneralSetting_CustomProfile `protobuf:"bytes,6,opt,name=custom_profile,json=customProfile,proto3" json:"custom_profile,omitempty"` - // week_start_day_offset is the week start day offset from Sunday. - // 0: Sunday, 1: Monday, 2: Tuesday, 3: Wednesday, 4: Thursday, 5: Friday, 6: Saturday + // Whether users are prevented from changing their username. + DisallowChangeUsername bool `protobuf:"varint,4,opt,name=disallow_change_username,json=disallowChangeUsername,proto3" json:"disallow_change_username,omitempty"` + // Whether users are prevented from changing their nickname. + DisallowChangeNickname bool `protobuf:"varint,5,opt,name=disallow_change_nickname,json=disallowChangeNickname,proto3" json:"disallow_change_nickname,omitempty"` + // The first day of the week as an offset from Sunday. + // 0: Sunday, 1: Monday, 2: Tuesday, 3: Wednesday, 4: Thursday, 5: Friday, 6: Saturday. // Default is Sunday. - WeekStartDayOffset int32 `protobuf:"varint,7,opt,name=week_start_day_offset,json=weekStartDayOffset,proto3" json:"week_start_day_offset,omitempty"` - // disallow_change_username disallows changing username. - DisallowChangeUsername bool `protobuf:"varint,8,opt,name=disallow_change_username,json=disallowChangeUsername,proto3" json:"disallow_change_username,omitempty"` - // disallow_change_nickname disallows changing nickname. - DisallowChangeNickname bool `protobuf:"varint,9,opt,name=disallow_change_nickname,json=disallowChangeNickname,proto3" json:"disallow_change_nickname,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache + WeekStartDayOffset int32 `protobuf:"varint,6,opt,name=week_start_day_offset,json=weekStartDayOffset,proto3" json:"week_start_day_offset,omitempty"` + // Custom CSS injected into the web app. + AdditionalStyle string `protobuf:"bytes,7,opt,name=additional_style,json=additionalStyle,proto3" json:"additional_style,omitempty"` + // Custom JavaScript injected into the web app. + AdditionalScript string `protobuf:"bytes,8,opt,name=additional_script,json=additionalScript,proto3" json:"additional_script,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *InstanceSetting_GeneralSetting) Reset() { *x = InstanceSetting_GeneralSetting{} - mi := &file_api_v1_instance_service_proto_msgTypes[11] + mi := &file_api_instance_service_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1078,7 +1094,7 @@ func (x *InstanceSetting_GeneralSetting) String() string { func (*InstanceSetting_GeneralSetting) ProtoMessage() {} func (x *InstanceSetting_GeneralSetting) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_instance_service_proto_msgTypes[11] + mi := &file_api_instance_service_proto_msgTypes[11] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1091,7 +1107,14 @@ func (x *InstanceSetting_GeneralSetting) ProtoReflect() protoreflect.Message { // Deprecated: Use InstanceSetting_GeneralSetting.ProtoReflect.Descriptor instead. func (*InstanceSetting_GeneralSetting) Descriptor() ([]byte, []int) { - return file_api_v1_instance_service_proto_rawDescGZIP(), []int{2, 0} + return file_api_instance_service_proto_rawDescGZIP(), []int{2, 0} +} + +func (x *InstanceSetting_GeneralSetting) GetCustomProfile() *InstanceSetting_GeneralSetting_CustomProfile { + if x != nil { + return x.CustomProfile + } + return nil } func (x *InstanceSetting_GeneralSetting) GetDisallowUserRegistration() bool { @@ -1108,34 +1131,6 @@ func (x *InstanceSetting_GeneralSetting) GetDisallowPasswordAuth() bool { return false } -func (x *InstanceSetting_GeneralSetting) GetAdditionalScript() string { - if x != nil { - return x.AdditionalScript - } - return "" -} - -func (x *InstanceSetting_GeneralSetting) GetAdditionalStyle() string { - if x != nil { - return x.AdditionalStyle - } - return "" -} - -func (x *InstanceSetting_GeneralSetting) GetCustomProfile() *InstanceSetting_GeneralSetting_CustomProfile { - if x != nil { - return x.CustomProfile - } - return nil -} - -func (x *InstanceSetting_GeneralSetting) GetWeekStartDayOffset() int32 { - if x != nil { - return x.WeekStartDayOffset - } - return 0 -} - func (x *InstanceSetting_GeneralSetting) GetDisallowChangeUsername() bool { if x != nil { return x.DisallowChangeUsername @@ -1150,14 +1145,130 @@ func (x *InstanceSetting_GeneralSetting) GetDisallowChangeNickname() bool { return false } +func (x *InstanceSetting_GeneralSetting) GetWeekStartDayOffset() int32 { + if x != nil { + return x.WeekStartDayOffset + } + return 0 +} + +func (x *InstanceSetting_GeneralSetting) GetAdditionalStyle() string { + if x != nil { + return x.AdditionalStyle + } + return "" +} + +func (x *InstanceSetting_GeneralSetting) GetAdditionalScript() string { + if x != nil { + return x.AdditionalScript + } + return "" +} + +// StorageSetting is the attachment storage configuration. +type InstanceSetting_StorageSetting struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Configured storage instances, including inactive instances still referenced by attachments. + Storages []*InstanceSetting_Storage `protobuf:"bytes,1,rep,name=storages,proto3" json:"storages,omitempty"` + // The ID of the storage used for new attachments. + DefaultStorageId string `protobuf:"bytes,2,opt,name=default_storage_id,json=defaultStorageId,proto3" json:"default_storage_id,omitempty"` + // The template of attachment file paths. + // Default is assets/{timestamp}_{uuid}_{filename}. + FilepathTemplate string `protobuf:"bytes,3,opt,name=filepath_template,json=filepathTemplate,proto3" json:"filepath_template,omitempty"` + // The maximum upload size in megabytes. Default is 30. + UploadSizeLimitMb int64 `protobuf:"varint,4,opt,name=upload_size_limit_mb,json=uploadSizeLimitMb,proto3" json:"upload_size_limit_mb,omitempty"` + // Legacy compatibility field. New clients use default_storage_id. + StorageType InstanceSetting_StorageSetting_StorageType `protobuf:"varint,5,opt,name=storage_type,json=storageType,proto3,enum=memos.api.InstanceSetting_StorageSetting_StorageType" json:"storage_type,omitempty"` + // Legacy compatibility field. New clients use storages. + S3Config *InstanceSetting_StorageSetting_S3Config `protobuf:"bytes,6,opt,name=s3_config,json=s3Config,proto3" json:"s3_config,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *InstanceSetting_StorageSetting) Reset() { + *x = InstanceSetting_StorageSetting{} + mi := &file_api_instance_service_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *InstanceSetting_StorageSetting) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*InstanceSetting_StorageSetting) ProtoMessage() {} + +func (x *InstanceSetting_StorageSetting) ProtoReflect() protoreflect.Message { + mi := &file_api_instance_service_proto_msgTypes[12] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use InstanceSetting_StorageSetting.ProtoReflect.Descriptor instead. +func (*InstanceSetting_StorageSetting) Descriptor() ([]byte, []int) { + return file_api_instance_service_proto_rawDescGZIP(), []int{2, 1} +} + +func (x *InstanceSetting_StorageSetting) GetStorages() []*InstanceSetting_Storage { + if x != nil { + return x.Storages + } + return nil +} + +func (x *InstanceSetting_StorageSetting) GetDefaultStorageId() string { + if x != nil { + return x.DefaultStorageId + } + return "" +} + +func (x *InstanceSetting_StorageSetting) GetFilepathTemplate() string { + if x != nil { + return x.FilepathTemplate + } + return "" +} + +func (x *InstanceSetting_StorageSetting) GetUploadSizeLimitMb() int64 { + if x != nil { + return x.UploadSizeLimitMb + } + return 0 +} + +func (x *InstanceSetting_StorageSetting) GetStorageType() InstanceSetting_StorageSetting_StorageType { + if x != nil { + return x.StorageType + } + return InstanceSetting_StorageSetting_STORAGE_TYPE_UNSPECIFIED +} + +func (x *InstanceSetting_StorageSetting) GetS3Config() *InstanceSetting_StorageSetting_S3Config { + if x != nil { + return x.S3Config + } + return nil +} + // Storage is a configured attachment storage instance. type InstanceSetting_Storage struct { state protoimpl.MessageState `protogen:"open.v1"` - // id is the stable identifier referenced by attachments. + // The stable identifier referenced by attachments. Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - // name is the human-readable storage name. - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - Type InstanceSetting_StorageType `protobuf:"varint,3,opt,name=type,proto3,enum=memos.api.v1.InstanceSetting_StorageType" json:"type,omitempty"` + // The human-readable storage name. + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + // The storage backend. + Type InstanceSetting_StorageType `protobuf:"varint,3,opt,name=type,proto3,enum=memos.api.InstanceSetting_StorageType" json:"type,omitempty"` + // The backend-specific configuration. + // // Types that are valid to be assigned to Config: // // *InstanceSetting_Storage_S3Config_ @@ -1168,7 +1279,7 @@ type InstanceSetting_Storage struct { func (x *InstanceSetting_Storage) Reset() { *x = InstanceSetting_Storage{} - mi := &file_api_v1_instance_service_proto_msgTypes[12] + mi := &file_api_instance_service_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1180,7 +1291,7 @@ func (x *InstanceSetting_Storage) String() string { func (*InstanceSetting_Storage) ProtoMessage() {} func (x *InstanceSetting_Storage) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_instance_service_proto_msgTypes[12] + mi := &file_api_instance_service_proto_msgTypes[13] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1193,7 +1304,7 @@ func (x *InstanceSetting_Storage) ProtoReflect() protoreflect.Message { // Deprecated: Use InstanceSetting_Storage.ProtoReflect.Descriptor instead. func (*InstanceSetting_Storage) Descriptor() ([]byte, []int) { - return file_api_v1_instance_service_proto_rawDescGZIP(), []int{2, 1} + return file_api_instance_service_proto_rawDescGZIP(), []int{2, 2} } func (x *InstanceSetting_Storage) GetId() string { @@ -1238,119 +1349,28 @@ type isInstanceSetting_Storage_Config interface { } type InstanceSetting_Storage_S3Config_ struct { - S3Config *InstanceSetting_Storage_S3Config `protobuf:"bytes,10,opt,name=s3_config,json=s3Config,proto3,oneof"` + // The configuration of an S3 storage. + S3Config *InstanceSetting_Storage_S3Config `protobuf:"bytes,4,opt,name=s3_config,json=s3Config,proto3,oneof"` } func (*InstanceSetting_Storage_S3Config_) isInstanceSetting_Storage_Config() {} -// Storage configuration settings for instance attachments. -type InstanceSetting_StorageSetting struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Legacy compatibility field. New clients use default_storage_id. - StorageType InstanceSetting_StorageSetting_StorageType `protobuf:"varint,1,opt,name=storage_type,json=storageType,proto3,enum=memos.api.v1.InstanceSetting_StorageSetting_StorageType" json:"storage_type,omitempty"` - // The template of file path. - // e.g. assets/{timestamp}_{filename} - FilepathTemplate string `protobuf:"bytes,2,opt,name=filepath_template,json=filepathTemplate,proto3" json:"filepath_template,omitempty"` - // The max upload size in megabytes. - UploadSizeLimitMb int64 `protobuf:"varint,3,opt,name=upload_size_limit_mb,json=uploadSizeLimitMb,proto3" json:"upload_size_limit_mb,omitempty"` - // Legacy compatibility field. New clients use storages. - S3Config *InstanceSetting_StorageSetting_S3Config `protobuf:"bytes,4,opt,name=s3_config,json=s3Config,proto3" json:"s3_config,omitempty"` - // Configured storage instances, including inactive instances referenced by attachments. - Storages []*InstanceSetting_Storage `protobuf:"bytes,5,rep,name=storages,proto3" json:"storages,omitempty"` - // Storage used for new attachments. - DefaultStorageId string `protobuf:"bytes,6,opt,name=default_storage_id,json=defaultStorageId,proto3" json:"default_storage_id,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *InstanceSetting_StorageSetting) Reset() { - *x = InstanceSetting_StorageSetting{} - mi := &file_api_v1_instance_service_proto_msgTypes[13] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *InstanceSetting_StorageSetting) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*InstanceSetting_StorageSetting) ProtoMessage() {} - -func (x *InstanceSetting_StorageSetting) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_instance_service_proto_msgTypes[13] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use InstanceSetting_StorageSetting.ProtoReflect.Descriptor instead. -func (*InstanceSetting_StorageSetting) Descriptor() ([]byte, []int) { - return file_api_v1_instance_service_proto_rawDescGZIP(), []int{2, 2} -} - -func (x *InstanceSetting_StorageSetting) GetStorageType() InstanceSetting_StorageSetting_StorageType { - if x != nil { - return x.StorageType - } - return InstanceSetting_StorageSetting_STORAGE_TYPE_UNSPECIFIED -} - -func (x *InstanceSetting_StorageSetting) GetFilepathTemplate() string { - if x != nil { - return x.FilepathTemplate - } - return "" -} - -func (x *InstanceSetting_StorageSetting) GetUploadSizeLimitMb() int64 { - if x != nil { - return x.UploadSizeLimitMb - } - return 0 -} - -func (x *InstanceSetting_StorageSetting) GetS3Config() *InstanceSetting_StorageSetting_S3Config { - if x != nil { - return x.S3Config - } - return nil -} - -func (x *InstanceSetting_StorageSetting) GetStorages() []*InstanceSetting_Storage { - if x != nil { - return x.Storages - } - return nil -} - -func (x *InstanceSetting_StorageSetting) GetDefaultStorageId() string { - if x != nil { - return x.DefaultStorageId - } - return "" -} - -// Memo-related instance settings and policies. +// MemoRelatedSetting is the memo-related instance configuration. type InstanceSetting_MemoRelatedSetting struct { state protoimpl.MessageState `protogen:"open.v1"` - // content_length_limit is the limit of content length. Unit is byte. - ContentLengthLimit int32 `protobuf:"varint,3,opt,name=content_length_limit,json=contentLengthLimit,proto3" json:"content_length_limit,omitempty"` - // enable_double_click_edit enables editing on double click. - EnableDoubleClickEdit bool `protobuf:"varint,4,opt,name=enable_double_click_edit,json=enableDoubleClickEdit,proto3" json:"enable_double_click_edit,omitempty"` - // reactions is the list of reactions. - Reactions []string `protobuf:"bytes,7,rep,name=reactions,proto3" json:"reactions,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache + // The maximum memo content length in bytes. Default and minimum is 8192. + ContentLengthLimit int32 `protobuf:"varint,1,opt,name=content_length_limit,json=contentLengthLimit,proto3" json:"content_length_limit,omitempty"` + // The reactions users can choose from. Defaults to a built-in emoji set when empty. + Reactions []string `protobuf:"bytes,2,rep,name=reactions,proto3" json:"reactions,omitempty"` + // Whether double-clicking a memo opens it for editing. + EnableDoubleClickEdit bool `protobuf:"varint,3,opt,name=enable_double_click_edit,json=enableDoubleClickEdit,proto3" json:"enable_double_click_edit,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *InstanceSetting_MemoRelatedSetting) Reset() { *x = InstanceSetting_MemoRelatedSetting{} - mi := &file_api_v1_instance_service_proto_msgTypes[14] + mi := &file_api_instance_service_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1362,7 +1382,7 @@ func (x *InstanceSetting_MemoRelatedSetting) String() string { func (*InstanceSetting_MemoRelatedSetting) ProtoMessage() {} func (x *InstanceSetting_MemoRelatedSetting) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_instance_service_proto_msgTypes[14] + mi := &file_api_instance_service_proto_msgTypes[14] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1375,7 +1395,7 @@ func (x *InstanceSetting_MemoRelatedSetting) ProtoReflect() protoreflect.Message // Deprecated: Use InstanceSetting_MemoRelatedSetting.ProtoReflect.Descriptor instead. func (*InstanceSetting_MemoRelatedSetting) Descriptor() ([]byte, []int) { - return file_api_v1_instance_service_proto_rawDescGZIP(), []int{2, 3} + return file_api_instance_service_proto_rawDescGZIP(), []int{2, 3} } func (x *InstanceSetting_MemoRelatedSetting) GetContentLengthLimit() int32 { @@ -1385,13 +1405,6 @@ func (x *InstanceSetting_MemoRelatedSetting) GetContentLengthLimit() int32 { return 0 } -func (x *InstanceSetting_MemoRelatedSetting) GetEnableDoubleClickEdit() bool { - if x != nil { - return x.EnableDoubleClickEdit - } - return false -} - func (x *InstanceSetting_MemoRelatedSetting) GetReactions() []string { if x != nil { return x.Reactions @@ -1399,13 +1412,69 @@ func (x *InstanceSetting_MemoRelatedSetting) GetReactions() []string { return nil } -// Metadata for a tag. +func (x *InstanceSetting_MemoRelatedSetting) GetEnableDoubleClickEdit() bool { + if x != nil { + return x.EnableDoubleClickEdit + } + return false +} + +// TagsSetting is the instance-wide tag metadata configuration. +// Active tag metadata is stored in per-user tag settings. This message remains for backward compatibility with +// existing clients and migrations. +type InstanceSetting_TagsSetting struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Map of tag name pattern to tag metadata. + // Each key is treated as an anchored regular expression (^pattern$), so a single entry like "project/.*" matches + // all tags under that prefix. Exact tag names are also valid. + Tags map[string]*InstanceSetting_TagMetadata `protobuf:"bytes,1,rep,name=tags,proto3" json:"tags,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *InstanceSetting_TagsSetting) Reset() { + *x = InstanceSetting_TagsSetting{} + mi := &file_api_instance_service_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *InstanceSetting_TagsSetting) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*InstanceSetting_TagsSetting) ProtoMessage() {} + +func (x *InstanceSetting_TagsSetting) ProtoReflect() protoreflect.Message { + mi := &file_api_instance_service_proto_msgTypes[15] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use InstanceSetting_TagsSetting.ProtoReflect.Descriptor instead. +func (*InstanceSetting_TagsSetting) Descriptor() ([]byte, []int) { + return file_api_instance_service_proto_rawDescGZIP(), []int{2, 4} +} + +func (x *InstanceSetting_TagsSetting) GetTags() map[string]*InstanceSetting_TagMetadata { + if x != nil { + return x.Tags + } + return nil +} + +// TagMetadata is the display metadata for a tag. type InstanceSetting_TagMetadata struct { state protoimpl.MessageState `protogen:"open.v1"` - // Optional background color for the tag label. - // When unset, the default tag color is used. + // The background color of the tag label. When unset, the default tag color is used. BackgroundColor *color.Color `protobuf:"bytes,1,opt,name=background_color,json=backgroundColor,proto3" json:"background_color,omitempty"` - // Whether memos with this tag should have their content blurred. + // Whether memos with this tag have their content blurred. BlurContent bool `protobuf:"varint,2,opt,name=blur_content,json=blurContent,proto3" json:"blur_content,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache @@ -1413,7 +1482,7 @@ type InstanceSetting_TagMetadata struct { func (x *InstanceSetting_TagMetadata) Reset() { *x = InstanceSetting_TagMetadata{} - mi := &file_api_v1_instance_service_proto_msgTypes[15] + mi := &file_api_instance_service_proto_msgTypes[16] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1425,7 +1494,7 @@ func (x *InstanceSetting_TagMetadata) String() string { func (*InstanceSetting_TagMetadata) ProtoMessage() {} func (x *InstanceSetting_TagMetadata) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_instance_service_proto_msgTypes[15] + mi := &file_api_instance_service_proto_msgTypes[16] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1438,7 +1507,7 @@ func (x *InstanceSetting_TagMetadata) ProtoReflect() protoreflect.Message { // Deprecated: Use InstanceSetting_TagMetadata.ProtoReflect.Descriptor instead. func (*InstanceSetting_TagMetadata) Descriptor() ([]byte, []int) { - return file_api_v1_instance_service_proto_rawDescGZIP(), []int{2, 4} + return file_api_instance_service_proto_rawDescGZIP(), []int{2, 5} } func (x *InstanceSetting_TagMetadata) GetBackgroundColor() *color.Color { @@ -1455,60 +1524,10 @@ func (x *InstanceSetting_TagMetadata) GetBlurContent() bool { return false } -// Tag metadata configuration. -// Active tag metadata is stored in per-user tag settings. -// This message remains for backward compatibility with existing clients and migrations. -type InstanceSetting_TagsSetting struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Map of tag name pattern to tag metadata. - // Each key is treated as an anchored regular expression (^pattern$), - // so a single entry like "project/.*" matches all tags under that prefix. - // Exact tag names are also valid (they are trivially valid regex patterns). - Tags map[string]*InstanceSetting_TagMetadata `protobuf:"bytes,1,rep,name=tags,proto3" json:"tags,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *InstanceSetting_TagsSetting) Reset() { - *x = InstanceSetting_TagsSetting{} - mi := &file_api_v1_instance_service_proto_msgTypes[16] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *InstanceSetting_TagsSetting) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*InstanceSetting_TagsSetting) ProtoMessage() {} - -func (x *InstanceSetting_TagsSetting) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_instance_service_proto_msgTypes[16] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use InstanceSetting_TagsSetting.ProtoReflect.Descriptor instead. -func (*InstanceSetting_TagsSetting) Descriptor() ([]byte, []int) { - return file_api_v1_instance_service_proto_rawDescGZIP(), []int{2, 5} -} - -func (x *InstanceSetting_TagsSetting) GetTags() map[string]*InstanceSetting_TagMetadata { - if x != nil { - return x.Tags - } - return nil -} - -// Notification transport configuration. +// NotificationSetting is the notification transport configuration. type InstanceSetting_NotificationSetting struct { - state protoimpl.MessageState `protogen:"open.v1"` + state protoimpl.MessageState `protogen:"open.v1"` + // The email delivery configuration. Email *InstanceSetting_NotificationSetting_EmailSetting `protobuf:"bytes,1,opt,name=email,proto3" json:"email,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache @@ -1516,7 +1535,7 @@ type InstanceSetting_NotificationSetting struct { func (x *InstanceSetting_NotificationSetting) Reset() { *x = InstanceSetting_NotificationSetting{} - mi := &file_api_v1_instance_service_proto_msgTypes[17] + mi := &file_api_instance_service_proto_msgTypes[17] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1528,7 +1547,7 @@ func (x *InstanceSetting_NotificationSetting) String() string { func (*InstanceSetting_NotificationSetting) ProtoMessage() {} func (x *InstanceSetting_NotificationSetting) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_instance_service_proto_msgTypes[17] + mi := &file_api_instance_service_proto_msgTypes[17] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1541,7 +1560,7 @@ func (x *InstanceSetting_NotificationSetting) ProtoReflect() protoreflect.Messag // Deprecated: Use InstanceSetting_NotificationSetting.ProtoReflect.Descriptor instead. func (*InstanceSetting_NotificationSetting) Descriptor() ([]byte, []int) { - return file_api_v1_instance_service_proto_rawDescGZIP(), []int{2, 6} + return file_api_instance_service_proto_rawDescGZIP(), []int{2, 6} } func (x *InstanceSetting_NotificationSetting) GetEmail() *InstanceSetting_NotificationSetting_EmailSetting { @@ -1551,13 +1570,14 @@ func (x *InstanceSetting_NotificationSetting) GetEmail() *InstanceSetting_Notifi return nil } -// AI provider configuration settings. +// AISetting is the AI provider configuration. type InstanceSetting_AISetting struct { state protoimpl.MessageState `protogen:"open.v1"` - // providers is the list of AI provider configurations available instance-wide. + // The AI provider configurations available instance-wide. Providers []*InstanceSetting_AIProviderConfig `protobuf:"bytes,1,rep,name=providers,proto3" json:"providers,omitempty"` - // transcription is the speech-to-text feature configuration. - // When unset or transcription.provider_id is empty, transcription is disabled. + // The speech-to-text feature configuration. + // When unset or transcription.provider_id is empty, transcription is disabled. An update that omits it keeps the + // stored configuration. Transcription *InstanceSetting_TranscriptionConfig `protobuf:"bytes,2,opt,name=transcription,proto3" json:"transcription,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache @@ -1565,7 +1585,7 @@ type InstanceSetting_AISetting struct { func (x *InstanceSetting_AISetting) Reset() { *x = InstanceSetting_AISetting{} - mi := &file_api_v1_instance_service_proto_msgTypes[18] + mi := &file_api_instance_service_proto_msgTypes[18] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1577,7 +1597,7 @@ func (x *InstanceSetting_AISetting) String() string { func (*InstanceSetting_AISetting) ProtoMessage() {} func (x *InstanceSetting_AISetting) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_instance_service_proto_msgTypes[18] + mi := &file_api_instance_service_proto_msgTypes[18] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1590,7 +1610,7 @@ func (x *InstanceSetting_AISetting) ProtoReflect() protoreflect.Message { // Deprecated: Use InstanceSetting_AISetting.ProtoReflect.Descriptor instead. func (*InstanceSetting_AISetting) Descriptor() ([]byte, []int) { - return file_api_v1_instance_service_proto_rawDescGZIP(), []int{2, 7} + return file_api_instance_service_proto_rawDescGZIP(), []int{2, 7} } func (x *InstanceSetting_AISetting) GetProviders() []*InstanceSetting_AIProviderConfig { @@ -1607,26 +1627,30 @@ func (x *InstanceSetting_AISetting) GetTranscription() *InstanceSetting_Transcri return nil } -// AIProviderConfig represents one callable AI provider connection. +// AIProviderConfig is one callable AI provider connection. type InstanceSetting_AIProviderConfig struct { - state protoimpl.MessageState `protogen:"open.v1"` - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Title string `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"` - Type InstanceSetting_AIProviderType `protobuf:"varint,3,opt,name=type,proto3,enum=memos.api.v1.InstanceSetting_AIProviderType" json:"type,omitempty"` - Endpoint string `protobuf:"bytes,4,opt,name=endpoint,proto3" json:"endpoint,omitempty"` - // api_key is write-only and is never returned by GetInstanceSetting. + state protoimpl.MessageState `protogen:"open.v1"` + // The provider ID. Generated when empty on update. + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + // The provider display title. + Title string `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"` + // The provider implementation type. + Type InstanceSetting_AIProviderType `protobuf:"varint,3,opt,name=type,proto3,enum=memos.api.InstanceSetting_AIProviderType" json:"type,omitempty"` + // The provider API endpoint. Defaults to the provider's public endpoint when empty. + Endpoint string `protobuf:"bytes,4,opt,name=endpoint,proto3" json:"endpoint,omitempty"` + // Input only. The provider API key. Never returned; an empty value keeps the stored key. ApiKey string `protobuf:"bytes,5,opt,name=api_key,json=apiKey,proto3" json:"api_key,omitempty"` - // api_key_set indicates whether an API key is stored for this provider. - ApiKeySet bool `protobuf:"varint,8,opt,name=api_key_set,json=apiKeySet,proto3" json:"api_key_set,omitempty"` - // api_key_hint is a masked hint for the stored API key. - ApiKeyHint string `protobuf:"bytes,9,opt,name=api_key_hint,json=apiKeyHint,proto3" json:"api_key_hint,omitempty"` + // Output only. Whether an API key is stored for this provider. + ApiKeySet bool `protobuf:"varint,6,opt,name=api_key_set,json=apiKeySet,proto3" json:"api_key_set,omitempty"` + // Output only. A masked hint of the stored API key. + ApiKeyHint string `protobuf:"bytes,7,opt,name=api_key_hint,json=apiKeyHint,proto3" json:"api_key_hint,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } func (x *InstanceSetting_AIProviderConfig) Reset() { *x = InstanceSetting_AIProviderConfig{} - mi := &file_api_v1_instance_service_proto_msgTypes[19] + mi := &file_api_instance_service_proto_msgTypes[19] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1638,7 +1662,7 @@ func (x *InstanceSetting_AIProviderConfig) String() string { func (*InstanceSetting_AIProviderConfig) ProtoMessage() {} func (x *InstanceSetting_AIProviderConfig) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_instance_service_proto_msgTypes[19] + mi := &file_api_instance_service_proto_msgTypes[19] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1651,7 +1675,7 @@ func (x *InstanceSetting_AIProviderConfig) ProtoReflect() protoreflect.Message { // Deprecated: Use InstanceSetting_AIProviderConfig.ProtoReflect.Descriptor instead. func (*InstanceSetting_AIProviderConfig) Descriptor() ([]byte, []int) { - return file_api_v1_instance_service_proto_rawDescGZIP(), []int{2, 8} + return file_api_instance_service_proto_rawDescGZIP(), []int{2, 8} } func (x *InstanceSetting_AIProviderConfig) GetId() string { @@ -1703,20 +1727,19 @@ func (x *InstanceSetting_AIProviderConfig) GetApiKeyHint() string { return "" } -// TranscriptionConfig configures the speech-to-text feature. +// TranscriptionConfig is the speech-to-text feature configuration. type InstanceSetting_TranscriptionConfig struct { state protoimpl.MessageState `protogen:"open.v1"` - // provider_id references an entry in AISetting.providers[].id. - // Empty string means transcription is disabled. + // The ID of the provider used for transcription; must reference an entry in AISetting.providers. + // Empty means transcription is disabled. ProviderId string `protobuf:"bytes,1,opt,name=provider_id,json=providerId,proto3" json:"provider_id,omitempty"` - // model is the provider-specific model identifier. - // Empty string falls back to the engine default - // (whisper-1 for OPENAI providers, gemini-2.5-flash for GEMINI providers). + // The provider-specific model identifier. Hidden from non-admins. + // Empty falls back to the engine default (whisper-1 for OPENAI providers, gemini-2.5-flash for GEMINI providers). Model string `protobuf:"bytes,2,opt,name=model,proto3" json:"model,omitempty"` - // language is the default ISO 639-1 language hint sent to the provider. - // Empty string lets the provider auto-detect. + // The default ISO 639-1 language hint sent to the provider. Hidden from non-admins. + // Empty lets the provider auto-detect. Language string `protobuf:"bytes,3,opt,name=language,proto3" json:"language,omitempty"` - // prompt is a default spelling/vocabulary hint passed to the provider. + // A default spelling and vocabulary hint passed to the provider. Hidden from non-admins. Prompt string `protobuf:"bytes,4,opt,name=prompt,proto3" json:"prompt,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache @@ -1724,7 +1747,7 @@ type InstanceSetting_TranscriptionConfig struct { func (x *InstanceSetting_TranscriptionConfig) Reset() { *x = InstanceSetting_TranscriptionConfig{} - mi := &file_api_v1_instance_service_proto_msgTypes[20] + mi := &file_api_instance_service_proto_msgTypes[20] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1736,7 +1759,7 @@ func (x *InstanceSetting_TranscriptionConfig) String() string { func (*InstanceSetting_TranscriptionConfig) ProtoMessage() {} func (x *InstanceSetting_TranscriptionConfig) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_instance_service_proto_msgTypes[20] + mi := &file_api_instance_service_proto_msgTypes[20] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1749,7 +1772,7 @@ func (x *InstanceSetting_TranscriptionConfig) ProtoReflect() protoreflect.Messag // Deprecated: Use InstanceSetting_TranscriptionConfig.ProtoReflect.Descriptor instead. func (*InstanceSetting_TranscriptionConfig) Descriptor() ([]byte, []int) { - return file_api_v1_instance_service_proto_rawDescGZIP(), []int{2, 9} + return file_api_instance_service_proto_rawDescGZIP(), []int{2, 9} } func (x *InstanceSetting_TranscriptionConfig) GetProviderId() string { @@ -1780,17 +1803,18 @@ func (x *InstanceSetting_TranscriptionConfig) GetPrompt() string { return "" } -// Access policy configuration for the instance. +// AccessSetting is the instance access policy. type InstanceSetting_AccessSetting struct { - state protoimpl.MessageState `protogen:"open.v1"` - AccessMode InstanceAccessMode `protobuf:"varint,1,opt,name=access_mode,json=accessMode,proto3,enum=memos.api.v1.InstanceAccessMode" json:"access_mode,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + // Whether unauthenticated users may access instance content. Must be PRIVATE or PUBLIC on update. + AccessMode InstanceAccessMode `protobuf:"varint,1,opt,name=access_mode,json=accessMode,proto3,enum=memos.api.InstanceAccessMode" json:"access_mode,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } func (x *InstanceSetting_AccessSetting) Reset() { *x = InstanceSetting_AccessSetting{} - mi := &file_api_v1_instance_service_proto_msgTypes[21] + mi := &file_api_instance_service_proto_msgTypes[21] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1802,7 +1826,7 @@ func (x *InstanceSetting_AccessSetting) String() string { func (*InstanceSetting_AccessSetting) ProtoMessage() {} func (x *InstanceSetting_AccessSetting) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_instance_service_proto_msgTypes[21] + mi := &file_api_instance_service_proto_msgTypes[21] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1815,7 +1839,7 @@ func (x *InstanceSetting_AccessSetting) ProtoReflect() protoreflect.Message { // Deprecated: Use InstanceSetting_AccessSetting.ProtoReflect.Descriptor instead. func (*InstanceSetting_AccessSetting) Descriptor() ([]byte, []int) { - return file_api_v1_instance_service_proto_rawDescGZIP(), []int{2, 10} + return file_api_instance_service_proto_rawDescGZIP(), []int{2, 10} } func (x *InstanceSetting_AccessSetting) GetAccessMode() InstanceAccessMode { @@ -1825,19 +1849,22 @@ func (x *InstanceSetting_AccessSetting) GetAccessMode() InstanceAccessMode { return InstanceAccessMode_INSTANCE_ACCESS_MODE_UNSPECIFIED } -// Custom profile configuration for instance branding. +// CustomProfile is the instance branding. type InstanceSetting_GeneralSetting_CustomProfile struct { - state protoimpl.MessageState `protogen:"open.v1"` - Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` - Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` - LogoUrl string `protobuf:"bytes,3,opt,name=logo_url,json=logoUrl,proto3" json:"logo_url,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + // The instance title. + Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` + // The instance description. + Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` + // The URL of the instance logo. + LogoUrl string `protobuf:"bytes,3,opt,name=logo_url,json=logoUrl,proto3" json:"logo_url,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } func (x *InstanceSetting_GeneralSetting_CustomProfile) Reset() { *x = InstanceSetting_GeneralSetting_CustomProfile{} - mi := &file_api_v1_instance_service_proto_msgTypes[22] + mi := &file_api_instance_service_proto_msgTypes[22] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1849,7 +1876,7 @@ func (x *InstanceSetting_GeneralSetting_CustomProfile) String() string { func (*InstanceSetting_GeneralSetting_CustomProfile) ProtoMessage() {} func (x *InstanceSetting_GeneralSetting_CustomProfile) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_instance_service_proto_msgTypes[22] + mi := &file_api_instance_service_proto_msgTypes[22] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1862,7 +1889,7 @@ func (x *InstanceSetting_GeneralSetting_CustomProfile) ProtoReflect() protorefle // Deprecated: Use InstanceSetting_GeneralSetting_CustomProfile.ProtoReflect.Descriptor instead. func (*InstanceSetting_GeneralSetting_CustomProfile) Descriptor() ([]byte, []int) { - return file_api_v1_instance_service_proto_rawDescGZIP(), []int{2, 0, 0} + return file_api_instance_service_proto_rawDescGZIP(), []int{2, 0, 0} } func (x *InstanceSetting_GeneralSetting_CustomProfile) GetTitle() string { @@ -1886,116 +1913,25 @@ func (x *InstanceSetting_GeneralSetting_CustomProfile) GetLogoUrl() string { return "" } -// S3 configuration for an S3-compatible object store. -// Reference: https://developers.cloudflare.com/r2/examples/aws/aws-sdk-go/ -type InstanceSetting_Storage_S3Config struct { - state protoimpl.MessageState `protogen:"open.v1"` - AccessKeyId string `protobuf:"bytes,1,opt,name=access_key_id,json=accessKeyId,proto3" json:"access_key_id,omitempty"` - AccessKeySecret string `protobuf:"bytes,2,opt,name=access_key_secret,json=accessKeySecret,proto3" json:"access_key_secret,omitempty"` - Endpoint string `protobuf:"bytes,3,opt,name=endpoint,proto3" json:"endpoint,omitempty"` - Region string `protobuf:"bytes,4,opt,name=region,proto3" json:"region,omitempty"` - Bucket string `protobuf:"bytes,5,opt,name=bucket,proto3" json:"bucket,omitempty"` - UsePathStyle bool `protobuf:"varint,6,opt,name=use_path_style,json=usePathStyle,proto3" json:"use_path_style,omitempty"` - // insecure_skip_tls_verify disables TLS certificate verification when connecting - // to the S3 endpoint. Only enable this for trusted endpoints that use a self-signed - // certificate; it removes protection against man-in-the-middle attacks. - InsecureSkipTlsVerify bool `protobuf:"varint,7,opt,name=insecure_skip_tls_verify,json=insecureSkipTlsVerify,proto3" json:"insecure_skip_tls_verify,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *InstanceSetting_Storage_S3Config) Reset() { - *x = InstanceSetting_Storage_S3Config{} - mi := &file_api_v1_instance_service_proto_msgTypes[23] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *InstanceSetting_Storage_S3Config) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*InstanceSetting_Storage_S3Config) ProtoMessage() {} - -func (x *InstanceSetting_Storage_S3Config) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_instance_service_proto_msgTypes[23] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use InstanceSetting_Storage_S3Config.ProtoReflect.Descriptor instead. -func (*InstanceSetting_Storage_S3Config) Descriptor() ([]byte, []int) { - return file_api_v1_instance_service_proto_rawDescGZIP(), []int{2, 1, 0} -} - -func (x *InstanceSetting_Storage_S3Config) GetAccessKeyId() string { - if x != nil { - return x.AccessKeyId - } - return "" -} - -func (x *InstanceSetting_Storage_S3Config) GetAccessKeySecret() string { - if x != nil { - return x.AccessKeySecret - } - return "" -} - -func (x *InstanceSetting_Storage_S3Config) GetEndpoint() string { - if x != nil { - return x.Endpoint - } - return "" -} - -func (x *InstanceSetting_Storage_S3Config) GetRegion() string { - if x != nil { - return x.Region - } - return "" -} - -func (x *InstanceSetting_Storage_S3Config) GetBucket() string { - if x != nil { - return x.Bucket - } - return "" -} - -func (x *InstanceSetting_Storage_S3Config) GetUsePathStyle() bool { - if x != nil { - return x.UsePathStyle - } - return false -} - -func (x *InstanceSetting_Storage_S3Config) GetInsecureSkipTlsVerify() bool { - if x != nil { - return x.InsecureSkipTlsVerify - } - return false -} - -// Legacy S3 configuration retained for compatibility with existing clients. +// S3Config is the legacy S3 configuration, retained for compatibility with existing clients. // Reference: https://developers.cloudflare.com/r2/examples/aws/aws-sdk-go/ type InstanceSetting_StorageSetting_S3Config struct { - state protoimpl.MessageState `protogen:"open.v1"` - AccessKeyId string `protobuf:"bytes,1,opt,name=access_key_id,json=accessKeyId,proto3" json:"access_key_id,omitempty"` - AccessKeySecret string `protobuf:"bytes,2,opt,name=access_key_secret,json=accessKeySecret,proto3" json:"access_key_secret,omitempty"` - Endpoint string `protobuf:"bytes,3,opt,name=endpoint,proto3" json:"endpoint,omitempty"` - Region string `protobuf:"bytes,4,opt,name=region,proto3" json:"region,omitempty"` - Bucket string `protobuf:"bytes,5,opt,name=bucket,proto3" json:"bucket,omitempty"` - UsePathStyle bool `protobuf:"varint,6,opt,name=use_path_style,json=usePathStyle,proto3" json:"use_path_style,omitempty"` - // insecure_skip_tls_verify disables TLS certificate verification when connecting - // to the S3 endpoint. Only enable this for trusted endpoints that use a self-signed - // certificate; it removes protection against man-in-the-middle attacks. + state protoimpl.MessageState `protogen:"open.v1"` + // The S3 endpoint URL. + Endpoint string `protobuf:"bytes,1,opt,name=endpoint,proto3" json:"endpoint,omitempty"` + // The S3 region. + Region string `protobuf:"bytes,2,opt,name=region,proto3" json:"region,omitempty"` + // The S3 bucket. + Bucket string `protobuf:"bytes,3,opt,name=bucket,proto3" json:"bucket,omitempty"` + // The S3 access key ID. + AccessKeyId string `protobuf:"bytes,4,opt,name=access_key_id,json=accessKeyId,proto3" json:"access_key_id,omitempty"` + // Input only. The S3 access key secret. Never returned; an empty value keeps the stored secret. + AccessKeySecret string `protobuf:"bytes,5,opt,name=access_key_secret,json=accessKeySecret,proto3" json:"access_key_secret,omitempty"` + // Whether to use path-style addressing instead of virtual-hosted-style. + UsePathStyle bool `protobuf:"varint,6,opt,name=use_path_style,json=usePathStyle,proto3" json:"use_path_style,omitempty"` + // Whether to skip TLS certificate verification when connecting to the S3 endpoint. + // Only enable this for trusted endpoints that use a self-signed certificate; it removes protection against + // man-in-the-middle attacks. InsecureSkipTlsVerify bool `protobuf:"varint,7,opt,name=insecure_skip_tls_verify,json=insecureSkipTlsVerify,proto3" json:"insecure_skip_tls_verify,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache @@ -2003,7 +1939,7 @@ type InstanceSetting_StorageSetting_S3Config struct { func (x *InstanceSetting_StorageSetting_S3Config) Reset() { *x = InstanceSetting_StorageSetting_S3Config{} - mi := &file_api_v1_instance_service_proto_msgTypes[24] + mi := &file_api_instance_service_proto_msgTypes[23] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2015,7 +1951,7 @@ func (x *InstanceSetting_StorageSetting_S3Config) String() string { func (*InstanceSetting_StorageSetting_S3Config) ProtoMessage() {} func (x *InstanceSetting_StorageSetting_S3Config) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_instance_service_proto_msgTypes[24] + mi := &file_api_instance_service_proto_msgTypes[23] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2028,21 +1964,7 @@ func (x *InstanceSetting_StorageSetting_S3Config) ProtoReflect() protoreflect.Me // Deprecated: Use InstanceSetting_StorageSetting_S3Config.ProtoReflect.Descriptor instead. func (*InstanceSetting_StorageSetting_S3Config) Descriptor() ([]byte, []int) { - return file_api_v1_instance_service_proto_rawDescGZIP(), []int{2, 2, 0} -} - -func (x *InstanceSetting_StorageSetting_S3Config) GetAccessKeyId() string { - if x != nil { - return x.AccessKeyId - } - return "" -} - -func (x *InstanceSetting_StorageSetting_S3Config) GetAccessKeySecret() string { - if x != nil { - return x.AccessKeySecret - } - return "" + return file_api_instance_service_proto_rawDescGZIP(), []int{2, 1, 0} } func (x *InstanceSetting_StorageSetting_S3Config) GetEndpoint() string { @@ -2066,6 +1988,20 @@ func (x *InstanceSetting_StorageSetting_S3Config) GetBucket() string { return "" } +func (x *InstanceSetting_StorageSetting_S3Config) GetAccessKeyId() string { + if x != nil { + return x.AccessKeyId + } + return "" +} + +func (x *InstanceSetting_StorageSetting_S3Config) GetAccessKeySecret() string { + if x != nil { + return x.AccessKeySecret + } + return "" +} + func (x *InstanceSetting_StorageSetting_S3Config) GetUsePathStyle() bool { if x != nil { return x.UsePathStyle @@ -2080,26 +2016,140 @@ func (x *InstanceSetting_StorageSetting_S3Config) GetInsecureSkipTlsVerify() boo return false } -// Email delivery configuration for notifications. +// S3Config is the configuration of an S3-compatible object store. +// Reference: https://developers.cloudflare.com/r2/examples/aws/aws-sdk-go/ +type InstanceSetting_Storage_S3Config struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The S3 endpoint URL. + Endpoint string `protobuf:"bytes,1,opt,name=endpoint,proto3" json:"endpoint,omitempty"` + // The S3 region. + Region string `protobuf:"bytes,2,opt,name=region,proto3" json:"region,omitempty"` + // The S3 bucket. + Bucket string `protobuf:"bytes,3,opt,name=bucket,proto3" json:"bucket,omitempty"` + // The S3 access key ID. + AccessKeyId string `protobuf:"bytes,4,opt,name=access_key_id,json=accessKeyId,proto3" json:"access_key_id,omitempty"` + // Input only. The S3 access key secret. Never returned; an empty value keeps the stored secret. + AccessKeySecret string `protobuf:"bytes,5,opt,name=access_key_secret,json=accessKeySecret,proto3" json:"access_key_secret,omitempty"` + // Whether to use path-style addressing instead of virtual-hosted-style. + UsePathStyle bool `protobuf:"varint,6,opt,name=use_path_style,json=usePathStyle,proto3" json:"use_path_style,omitempty"` + // Whether to skip TLS certificate verification when connecting to the S3 endpoint. + // Only enable this for trusted endpoints that use a self-signed certificate; it removes protection against + // man-in-the-middle attacks. + InsecureSkipTlsVerify bool `protobuf:"varint,7,opt,name=insecure_skip_tls_verify,json=insecureSkipTlsVerify,proto3" json:"insecure_skip_tls_verify,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *InstanceSetting_Storage_S3Config) Reset() { + *x = InstanceSetting_Storage_S3Config{} + mi := &file_api_instance_service_proto_msgTypes[24] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *InstanceSetting_Storage_S3Config) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*InstanceSetting_Storage_S3Config) ProtoMessage() {} + +func (x *InstanceSetting_Storage_S3Config) ProtoReflect() protoreflect.Message { + mi := &file_api_instance_service_proto_msgTypes[24] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use InstanceSetting_Storage_S3Config.ProtoReflect.Descriptor instead. +func (*InstanceSetting_Storage_S3Config) Descriptor() ([]byte, []int) { + return file_api_instance_service_proto_rawDescGZIP(), []int{2, 2, 0} +} + +func (x *InstanceSetting_Storage_S3Config) GetEndpoint() string { + if x != nil { + return x.Endpoint + } + return "" +} + +func (x *InstanceSetting_Storage_S3Config) GetRegion() string { + if x != nil { + return x.Region + } + return "" +} + +func (x *InstanceSetting_Storage_S3Config) GetBucket() string { + if x != nil { + return x.Bucket + } + return "" +} + +func (x *InstanceSetting_Storage_S3Config) GetAccessKeyId() string { + if x != nil { + return x.AccessKeyId + } + return "" +} + +func (x *InstanceSetting_Storage_S3Config) GetAccessKeySecret() string { + if x != nil { + return x.AccessKeySecret + } + return "" +} + +func (x *InstanceSetting_Storage_S3Config) GetUsePathStyle() bool { + if x != nil { + return x.UsePathStyle + } + return false +} + +func (x *InstanceSetting_Storage_S3Config) GetInsecureSkipTlsVerify() bool { + if x != nil { + return x.InsecureSkipTlsVerify + } + return false +} + +// EmailSetting is the SMTP configuration for notification emails. type InstanceSetting_NotificationSetting_EmailSetting struct { - state protoimpl.MessageState `protogen:"open.v1"` - Enabled bool `protobuf:"varint,1,opt,name=enabled,proto3" json:"enabled,omitempty"` - SmtpHost string `protobuf:"bytes,2,opt,name=smtp_host,json=smtpHost,proto3" json:"smtp_host,omitempty"` - SmtpPort int32 `protobuf:"varint,3,opt,name=smtp_port,json=smtpPort,proto3" json:"smtp_port,omitempty"` - SmtpUsername string `protobuf:"bytes,4,opt,name=smtp_username,json=smtpUsername,proto3" json:"smtp_username,omitempty"` - SmtpPassword string `protobuf:"bytes,5,opt,name=smtp_password,json=smtpPassword,proto3" json:"smtp_password,omitempty"` - FromEmail string `protobuf:"bytes,6,opt,name=from_email,json=fromEmail,proto3" json:"from_email,omitempty"` - FromName string `protobuf:"bytes,7,opt,name=from_name,json=fromName,proto3" json:"from_name,omitempty"` - ReplyTo string `protobuf:"bytes,8,opt,name=reply_to,json=replyTo,proto3" json:"reply_to,omitempty"` - UseTls bool `protobuf:"varint,9,opt,name=use_tls,json=useTls,proto3" json:"use_tls,omitempty"` - UseSsl bool `protobuf:"varint,10,opt,name=use_ssl,json=useSsl,proto3" json:"use_ssl,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + // Whether email notifications are enabled. + Enabled bool `protobuf:"varint,1,opt,name=enabled,proto3" json:"enabled,omitempty"` + // The SMTP server host. + SmtpHost string `protobuf:"bytes,2,opt,name=smtp_host,json=smtpHost,proto3" json:"smtp_host,omitempty"` + // The SMTP server port. + SmtpPort int32 `protobuf:"varint,3,opt,name=smtp_port,json=smtpPort,proto3" json:"smtp_port,omitempty"` + // The SMTP username. + SmtpUsername string `protobuf:"bytes,4,opt,name=smtp_username,json=smtpUsername,proto3" json:"smtp_username,omitempty"` + // Input only. The SMTP password. Never returned. An empty value keeps the stored password, unless the host, + // port, username or encryption settings change. + SmtpPassword string `protobuf:"bytes,5,opt,name=smtp_password,json=smtpPassword,proto3" json:"smtp_password,omitempty"` + // Whether to use STARTTLS. + UseTls bool `protobuf:"varint,6,opt,name=use_tls,json=useTls,proto3" json:"use_tls,omitempty"` + // Whether to use implicit SSL/TLS. + UseSsl bool `protobuf:"varint,7,opt,name=use_ssl,json=useSsl,proto3" json:"use_ssl,omitempty"` + // The sender email address. + FromEmail string `protobuf:"bytes,8,opt,name=from_email,json=fromEmail,proto3" json:"from_email,omitempty"` + // The sender display name. + FromName string `protobuf:"bytes,9,opt,name=from_name,json=fromName,proto3" json:"from_name,omitempty"` + // The Reply-To email address. + ReplyTo string `protobuf:"bytes,10,opt,name=reply_to,json=replyTo,proto3" json:"reply_to,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } func (x *InstanceSetting_NotificationSetting_EmailSetting) Reset() { *x = InstanceSetting_NotificationSetting_EmailSetting{} - mi := &file_api_v1_instance_service_proto_msgTypes[26] + mi := &file_api_instance_service_proto_msgTypes[26] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2111,7 +2161,7 @@ func (x *InstanceSetting_NotificationSetting_EmailSetting) String() string { func (*InstanceSetting_NotificationSetting_EmailSetting) ProtoMessage() {} func (x *InstanceSetting_NotificationSetting_EmailSetting) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_instance_service_proto_msgTypes[26] + mi := &file_api_instance_service_proto_msgTypes[26] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2124,7 +2174,7 @@ func (x *InstanceSetting_NotificationSetting_EmailSetting) ProtoReflect() protor // Deprecated: Use InstanceSetting_NotificationSetting_EmailSetting.ProtoReflect.Descriptor instead. func (*InstanceSetting_NotificationSetting_EmailSetting) Descriptor() ([]byte, []int) { - return file_api_v1_instance_service_proto_rawDescGZIP(), []int{2, 6, 0} + return file_api_instance_service_proto_rawDescGZIP(), []int{2, 6, 0} } func (x *InstanceSetting_NotificationSetting_EmailSetting) GetEnabled() bool { @@ -2162,6 +2212,20 @@ func (x *InstanceSetting_NotificationSetting_EmailSetting) GetSmtpPassword() str return "" } +func (x *InstanceSetting_NotificationSetting_EmailSetting) GetUseTls() bool { + if x != nil { + return x.UseTls + } + return false +} + +func (x *InstanceSetting_NotificationSetting_EmailSetting) GetUseSsl() bool { + if x != nil { + return x.UseSsl + } + return false +} + func (x *InstanceSetting_NotificationSetting_EmailSetting) GetFromEmail() string { if x != nil { return x.FromEmail @@ -2183,26 +2247,12 @@ func (x *InstanceSetting_NotificationSetting_EmailSetting) GetReplyTo() string { return "" } -func (x *InstanceSetting_NotificationSetting_EmailSetting) GetUseTls() bool { - if x != nil { - return x.UseTls - } - return false -} - -func (x *InstanceSetting_NotificationSetting_EmailSetting) GetUseSsl() bool { - if x != nil { - return x.UseSsl - } - return false -} - -// Database size statistics. +// DatabaseStats is the database size statistics. type InstanceStats_DatabaseStats struct { state protoimpl.MessageState `protogen:"open.v1"` - // driver is one of "sqlite", "mysql", "postgres". + // The database driver: "sqlite", "mysql" or "postgres". Driver string `protobuf:"bytes,1,opt,name=driver,proto3" json:"driver,omitempty"` - // size_bytes is the database size in bytes; -1 if unavailable. + // The database size in bytes. -1 if unavailable. SizeBytes int64 `protobuf:"varint,2,opt,name=size_bytes,json=sizeBytes,proto3" json:"size_bytes,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache @@ -2210,7 +2260,7 @@ type InstanceStats_DatabaseStats struct { func (x *InstanceStats_DatabaseStats) Reset() { *x = InstanceStats_DatabaseStats{} - mi := &file_api_v1_instance_service_proto_msgTypes[27] + mi := &file_api_instance_service_proto_msgTypes[27] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2222,7 +2272,7 @@ func (x *InstanceStats_DatabaseStats) String() string { func (*InstanceStats_DatabaseStats) ProtoMessage() {} func (x *InstanceStats_DatabaseStats) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_instance_service_proto_msgTypes[27] + mi := &file_api_instance_service_proto_msgTypes[27] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2235,7 +2285,7 @@ func (x *InstanceStats_DatabaseStats) ProtoReflect() protoreflect.Message { // Deprecated: Use InstanceStats_DatabaseStats.ProtoReflect.Descriptor instead. func (*InstanceStats_DatabaseStats) Descriptor() ([]byte, []int) { - return file_api_v1_instance_service_proto_rawDescGZIP(), []int{9, 0} + return file_api_instance_service_proto_rawDescGZIP(), []int{8, 0} } func (x *InstanceStats_DatabaseStats) GetDriver() string { @@ -2252,132 +2302,130 @@ func (x *InstanceStats_DatabaseStats) GetSizeBytes() int64 { return 0 } -var File_api_v1_instance_service_proto protoreflect.FileDescriptor +var File_api_instance_service_proto protoreflect.FileDescriptor -const file_api_v1_instance_service_proto_rawDesc = "" + +const file_api_instance_service_proto_rawDesc = "" + "\n" + - "\x1dapi/v1/instance_service.proto\x12\fmemos.api.v1\x1a\x19api/v1/user_service.proto\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x17google/type/color.proto\"\x93\x03\n" + + "\x1aapi/instance_service.proto\x12\tmemos.api\x1a\x16api/user_service.proto\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x17google/type/color.proto\"\x8a\x03\n" + "\x0fInstanceProfile\x12\x18\n" + - "\aversion\x18\x02 \x01(\tR\aversion\x12\x12\n" + + "\aversion\x18\x01 \x01(\tR\aversion\x12\x16\n" + + "\x06commit\x18\x02 \x01(\tR\x06commit\x12\x12\n" + "\x04demo\x18\x03 \x01(\bR\x04demo\x12!\n" + - "\finstance_url\x18\x06 \x01(\tR\vinstanceUrl\x12(\n" + - "\x05admin\x18\a \x01(\v2\x12.memos.api.v1.UserR\x05admin\x12\x16\n" + - "\x06commit\x18\b \x01(\tR\x06commit\x12\x1f\n" + - "\vneeds_setup\x18\t \x01(\bR\n" + - "needsSetup\x12A\n" + - "\vaccess_mode\x18\n" + - " \x01(\x0e2 .memos.api.v1.InstanceAccessModeR\n" + - "accessMode\x12E\n" + - "\tchallenge\x18\v \x01(\v2'.memos.api.v1.InstanceProfile.ChallengeR\tchallenge\x1aB\n" + + "\finstance_url\x18\x04 \x01(\tR\vinstanceUrl\x12>\n" + + "\vaccess_mode\x18\x05 \x01(\x0e2\x1d.memos.api.InstanceAccessModeR\n" + + "accessMode\x12\x1f\n" + + "\vneeds_setup\x18\x06 \x01(\bR\n" + + "needsSetup\x12%\n" + + "\x05admin\x18\a \x01(\v2\x0f.memos.api.UserR\x05admin\x12B\n" + + "\tchallenge\x18\b \x01(\v2$.memos.api.InstanceProfile.ChallengeR\tchallenge\x1aB\n" + "\tChallenge\x12\x1a\n" + "\bprovider\x18\x01 \x01(\tR\bprovider\x12\x19\n" + "\bsite_key\x18\x02 \x01(\tR\asiteKey\"\x1b\n" + - "\x19GetInstanceProfileRequest\"\xd0\"\n" + + "\x19GetInstanceProfileRequest\"\xf1!\n" + "\x0fInstanceSetting\x12\x17\n" + - "\x04name\x18\x01 \x01(\tB\x03\xe0A\bR\x04name\x12W\n" + - "\x0fgeneral_setting\x18\x02 \x01(\v2,.memos.api.v1.InstanceSetting.GeneralSettingH\x00R\x0egeneralSetting\x12W\n" + - "\x0fstorage_setting\x18\x03 \x01(\v2,.memos.api.v1.InstanceSetting.StorageSettingH\x00R\x0estorageSetting\x12d\n" + - "\x14memo_related_setting\x18\x04 \x01(\v20.memos.api.v1.InstanceSetting.MemoRelatedSettingH\x00R\x12memoRelatedSetting\x12N\n" + - "\ftags_setting\x18\x05 \x01(\v2).memos.api.v1.InstanceSetting.TagsSettingH\x00R\vtagsSetting\x12f\n" + - "\x14notification_setting\x18\x06 \x01(\v21.memos.api.v1.InstanceSetting.NotificationSettingH\x00R\x13notificationSetting\x12H\n" + + "\x04name\x18\x01 \x01(\tB\x03\xe0A\bR\x04name\x12T\n" + + "\x0fgeneral_setting\x18\x02 \x01(\v2).memos.api.InstanceSetting.GeneralSettingH\x00R\x0egeneralSetting\x12T\n" + + "\x0fstorage_setting\x18\x03 \x01(\v2).memos.api.InstanceSetting.StorageSettingH\x00R\x0estorageSetting\x12a\n" + + "\x14memo_related_setting\x18\x04 \x01(\v2-.memos.api.InstanceSetting.MemoRelatedSettingH\x00R\x12memoRelatedSetting\x12K\n" + + "\ftags_setting\x18\x05 \x01(\v2&.memos.api.InstanceSetting.TagsSettingH\x00R\vtagsSetting\x12c\n" + + "\x14notification_setting\x18\x06 \x01(\v2..memos.api.InstanceSetting.NotificationSettingH\x00R\x13notificationSetting\x12E\n" + "\n" + - "ai_setting\x18\a \x01(\v2'.memos.api.v1.InstanceSetting.AISettingH\x00R\taiSetting\x12T\n" + - "\x0eaccess_setting\x18\b \x01(\v2+.memos.api.v1.InstanceSetting.AccessSettingH\x00R\raccessSetting\x1a\xca\x04\n" + - "\x0eGeneralSetting\x12<\n" + + "ai_setting\x18\a \x01(\v2$.memos.api.InstanceSetting.AISettingH\x00R\taiSetting\x12Q\n" + + "\x0eaccess_setting\x18\b \x01(\v2(.memos.api.InstanceSetting.AccessSettingH\x00R\raccessSetting\x1a\xc7\x04\n" + + "\x0eGeneralSetting\x12^\n" + + "\x0ecustom_profile\x18\x01 \x01(\v27.memos.api.InstanceSetting.GeneralSetting.CustomProfileR\rcustomProfile\x12<\n" + "\x1adisallow_user_registration\x18\x02 \x01(\bR\x18disallowUserRegistration\x124\n" + - "\x16disallow_password_auth\x18\x03 \x01(\bR\x14disallowPasswordAuth\x12+\n" + - "\x11additional_script\x18\x04 \x01(\tR\x10additionalScript\x12)\n" + - "\x10additional_style\x18\x05 \x01(\tR\x0fadditionalStyle\x12a\n" + - "\x0ecustom_profile\x18\x06 \x01(\v2:.memos.api.v1.InstanceSetting.GeneralSetting.CustomProfileR\rcustomProfile\x121\n" + - "\x15week_start_day_offset\x18\a \x01(\x05R\x12weekStartDayOffset\x128\n" + - "\x18disallow_change_username\x18\b \x01(\bR\x16disallowChangeUsername\x128\n" + - "\x18disallow_change_nickname\x18\t \x01(\bR\x16disallowChangeNickname\x1ab\n" + + "\x16disallow_password_auth\x18\x03 \x01(\bR\x14disallowPasswordAuth\x128\n" + + "\x18disallow_change_username\x18\x04 \x01(\bR\x16disallowChangeUsername\x128\n" + + "\x18disallow_change_nickname\x18\x05 \x01(\bR\x16disallowChangeNickname\x121\n" + + "\x15week_start_day_offset\x18\x06 \x01(\x05R\x12weekStartDayOffset\x12)\n" + + "\x10additional_style\x18\a \x01(\tR\x0fadditionalStyle\x12+\n" + + "\x11additional_script\x18\b \x01(\tR\x10additionalScript\x1ab\n" + "\rCustomProfile\x12\x14\n" + "\x05title\x18\x01 \x01(\tR\x05title\x12 \n" + "\vdescription\x18\x02 \x01(\tR\vdescription\x12\x19\n" + - "\blogo_url\x18\x03 \x01(\tR\alogoUrl\x1a\xd2\x03\n" + - "\aStorage\x12\x0e\n" + - "\x02id\x18\x01 \x01(\tR\x02id\x12\x12\n" + - "\x04name\x18\x02 \x01(\tR\x04name\x12=\n" + - "\x04type\x18\x03 \x01(\x0e2).memos.api.v1.InstanceSetting.StorageTypeR\x04type\x12M\n" + - "\ts3_config\x18\n" + - " \x01(\v2..memos.api.v1.InstanceSetting.Storage.S3ConfigH\x00R\bs3Config\x1a\x8a\x02\n" + - "\bS3Config\x12\"\n" + - "\raccess_key_id\x18\x01 \x01(\tR\vaccessKeyId\x12/\n" + - "\x11access_key_secret\x18\x02 \x01(\tB\x03\xe0A\x04R\x0faccessKeySecret\x12\x1a\n" + - "\bendpoint\x18\x03 \x01(\tR\bendpoint\x12\x16\n" + - "\x06region\x18\x04 \x01(\tR\x06region\x12\x16\n" + - "\x06bucket\x18\x05 \x01(\tR\x06bucket\x12$\n" + - "\x0euse_path_style\x18\x06 \x01(\bR\fusePathStyle\x127\n" + - "\x18insecure_skip_tls_verify\x18\a \x01(\bR\x15insecureSkipTlsVerifyB\b\n" + - "\x06config\x1a\xeb\x05\n" + - "\x0eStorageSetting\x12[\n" + - "\fstorage_type\x18\x01 \x01(\x0e28.memos.api.v1.InstanceSetting.StorageSetting.StorageTypeR\vstorageType\x12+\n" + - "\x11filepath_template\x18\x02 \x01(\tR\x10filepathTemplate\x12/\n" + - "\x14upload_size_limit_mb\x18\x03 \x01(\x03R\x11uploadSizeLimitMb\x12R\n" + - "\ts3_config\x18\x04 \x01(\v25.memos.api.v1.InstanceSetting.StorageSetting.S3ConfigR\bs3Config\x12A\n" + - "\bstorages\x18\x05 \x03(\v2%.memos.api.v1.InstanceSetting.StorageR\bstorages\x12,\n" + - "\x12default_storage_id\x18\x06 \x01(\tR\x10defaultStorageId\x1a\x8a\x02\n" + - "\bS3Config\x12\"\n" + - "\raccess_key_id\x18\x01 \x01(\tR\vaccessKeyId\x12/\n" + - "\x11access_key_secret\x18\x02 \x01(\tB\x03\xe0A\x04R\x0faccessKeySecret\x12\x1a\n" + - "\bendpoint\x18\x03 \x01(\tR\bendpoint\x12\x16\n" + - "\x06region\x18\x04 \x01(\tR\x06region\x12\x16\n" + - "\x06bucket\x18\x05 \x01(\tR\x06bucket\x12$\n" + + "\blogo_url\x18\x03 \x01(\tR\alogoUrl\x1a\xe2\x05\n" + + "\x0eStorageSetting\x12>\n" + + "\bstorages\x18\x01 \x03(\v2\".memos.api.InstanceSetting.StorageR\bstorages\x12,\n" + + "\x12default_storage_id\x18\x02 \x01(\tR\x10defaultStorageId\x12+\n" + + "\x11filepath_template\x18\x03 \x01(\tR\x10filepathTemplate\x12/\n" + + "\x14upload_size_limit_mb\x18\x04 \x01(\x03R\x11uploadSizeLimitMb\x12X\n" + + "\fstorage_type\x18\x05 \x01(\x0e25.memos.api.InstanceSetting.StorageSetting.StorageTypeR\vstorageType\x12O\n" + + "\ts3_config\x18\x06 \x01(\v22.memos.api.InstanceSetting.StorageSetting.S3ConfigR\bs3Config\x1a\x8a\x02\n" + + "\bS3Config\x12\x1a\n" + + "\bendpoint\x18\x01 \x01(\tR\bendpoint\x12\x16\n" + + "\x06region\x18\x02 \x01(\tR\x06region\x12\x16\n" + + "\x06bucket\x18\x03 \x01(\tR\x06bucket\x12\"\n" + + "\raccess_key_id\x18\x04 \x01(\tR\vaccessKeyId\x12/\n" + + "\x11access_key_secret\x18\x05 \x01(\tB\x03\xe0A\x04R\x0faccessKeySecret\x12$\n" + "\x0euse_path_style\x18\x06 \x01(\bR\fusePathStyle\x127\n" + "\x18insecure_skip_tls_verify\x18\a \x01(\bR\x15insecureSkipTlsVerify\"L\n" + "\vStorageType\x12\x1c\n" + "\x18STORAGE_TYPE_UNSPECIFIED\x10\x00\x12\f\n" + "\bDATABASE\x10\x01\x12\t\n" + "\x05LOCAL\x10\x02\x12\x06\n" + - "\x02S3\x10\x03\x1a\xbd\x01\n" + + "\x02S3\x10\x03\x1a\xcc\x03\n" + + "\aStorage\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\x12\x12\n" + + "\x04name\x18\x02 \x01(\tR\x04name\x12:\n" + + "\x04type\x18\x03 \x01(\x0e2&.memos.api.InstanceSetting.StorageTypeR\x04type\x12J\n" + + "\ts3_config\x18\x04 \x01(\v2+.memos.api.InstanceSetting.Storage.S3ConfigH\x00R\bs3Config\x1a\x8a\x02\n" + + "\bS3Config\x12\x1a\n" + + "\bendpoint\x18\x01 \x01(\tR\bendpoint\x12\x16\n" + + "\x06region\x18\x02 \x01(\tR\x06region\x12\x16\n" + + "\x06bucket\x18\x03 \x01(\tR\x06bucket\x12\"\n" + + "\raccess_key_id\x18\x04 \x01(\tR\vaccessKeyId\x12/\n" + + "\x11access_key_secret\x18\x05 \x01(\tB\x03\xe0A\x04R\x0faccessKeySecret\x12$\n" + + "\x0euse_path_style\x18\x06 \x01(\bR\fusePathStyle\x127\n" + + "\x18insecure_skip_tls_verify\x18\a \x01(\bR\x15insecureSkipTlsVerifyB\b\n" + + "\x06config\x1a\x9d\x01\n" + "\x12MemoRelatedSetting\x120\n" + - "\x14content_length_limit\x18\x03 \x01(\x05R\x12contentLengthLimit\x127\n" + - "\x18enable_double_click_edit\x18\x04 \x01(\bR\x15enableDoubleClickEdit\x12\x1c\n" + - "\treactions\x18\a \x03(\tR\treactionsJ\x04\b\x02\x10\x03R\x18display_with_update_time\x1ao\n" + + "\x14content_length_limit\x18\x01 \x01(\x05R\x12contentLengthLimit\x12\x1c\n" + + "\treactions\x18\x02 \x03(\tR\treactions\x127\n" + + "\x18enable_double_click_edit\x18\x03 \x01(\bR\x15enableDoubleClickEdit\x1a\xb4\x01\n" + + "\vTagsSetting\x12D\n" + + "\x04tags\x18\x01 \x03(\v20.memos.api.InstanceSetting.TagsSetting.TagsEntryR\x04tags\x1a_\n" + + "\tTagsEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12<\n" + + "\x05value\x18\x02 \x01(\v2&.memos.api.InstanceSetting.TagMetadataR\x05value:\x028\x01\x1ao\n" + "\vTagMetadata\x12=\n" + "\x10background_color\x18\x01 \x01(\v2\x12.google.type.ColorR\x0fbackgroundColor\x12!\n" + - "\fblur_content\x18\x02 \x01(\bR\vblurContent\x1a\xba\x01\n" + - "\vTagsSetting\x12G\n" + - "\x04tags\x18\x01 \x03(\v23.memos.api.v1.InstanceSetting.TagsSetting.TagsEntryR\x04tags\x1ab\n" + - "\tTagsEntry\x12\x10\n" + - "\x03key\x18\x01 \x01(\tR\x03key\x12?\n" + - "\x05value\x18\x02 \x01(\v2).memos.api.v1.InstanceSetting.TagMetadataR\x05value:\x028\x01\x1a\xa8\x03\n" + - "\x13NotificationSetting\x12T\n" + - "\x05email\x18\x01 \x01(\v2>.memos.api.v1.InstanceSetting.NotificationSetting.EmailSettingR\x05email\x1a\xba\x02\n" + + "\fblur_content\x18\x02 \x01(\bR\vblurContent\x1a\xa5\x03\n" + + "\x13NotificationSetting\x12Q\n" + + "\x05email\x18\x01 \x01(\v2;.memos.api.InstanceSetting.NotificationSetting.EmailSettingR\x05email\x1a\xba\x02\n" + "\fEmailSetting\x12\x18\n" + "\aenabled\x18\x01 \x01(\bR\aenabled\x12\x1b\n" + "\tsmtp_host\x18\x02 \x01(\tR\bsmtpHost\x12\x1b\n" + "\tsmtp_port\x18\x03 \x01(\x05R\bsmtpPort\x12#\n" + "\rsmtp_username\x18\x04 \x01(\tR\fsmtpUsername\x12(\n" + - "\rsmtp_password\x18\x05 \x01(\tB\x03\xe0A\x04R\fsmtpPassword\x12\x1d\n" + + "\rsmtp_password\x18\x05 \x01(\tB\x03\xe0A\x04R\fsmtpPassword\x12\x17\n" + + "\ause_tls\x18\x06 \x01(\bR\x06useTls\x12\x17\n" + + "\ause_ssl\x18\a \x01(\bR\x06useSsl\x12\x1d\n" + "\n" + - "from_email\x18\x06 \x01(\tR\tfromEmail\x12\x1b\n" + - "\tfrom_name\x18\a \x01(\tR\bfromName\x12\x19\n" + - "\breply_to\x18\b \x01(\tR\areplyTo\x12\x17\n" + - "\ause_tls\x18\t \x01(\bR\x06useTls\x12\x17\n" + - "\ause_ssl\x18\n" + - " \x01(\bR\x06useSsl\x1a\xb2\x01\n" + - "\tAISetting\x12L\n" + - "\tproviders\x18\x01 \x03(\v2..memos.api.v1.InstanceSetting.AIProviderConfigR\tproviders\x12W\n" + - "\rtranscription\x18\x02 \x01(\v21.memos.api.v1.InstanceSetting.TranscriptionConfigR\rtranscription\x1a\x80\x02\n" + + "from_email\x18\b \x01(\tR\tfromEmail\x12\x1b\n" + + "\tfrom_name\x18\t \x01(\tR\bfromName\x12\x19\n" + + "\breply_to\x18\n" + + " \x01(\tR\areplyTo\x1a\xac\x01\n" + + "\tAISetting\x12I\n" + + "\tproviders\x18\x01 \x03(\v2+.memos.api.InstanceSetting.AIProviderConfigR\tproviders\x12T\n" + + "\rtranscription\x18\x02 \x01(\v2..memos.api.InstanceSetting.TranscriptionConfigR\rtranscription\x1a\xfd\x01\n" + "\x10AIProviderConfig\x12\x0e\n" + "\x02id\x18\x01 \x01(\tR\x02id\x12\x14\n" + - "\x05title\x18\x02 \x01(\tR\x05title\x12@\n" + - "\x04type\x18\x03 \x01(\x0e2,.memos.api.v1.InstanceSetting.AIProviderTypeR\x04type\x12\x1a\n" + + "\x05title\x18\x02 \x01(\tR\x05title\x12=\n" + + "\x04type\x18\x03 \x01(\x0e2).memos.api.InstanceSetting.AIProviderTypeR\x04type\x12\x1a\n" + "\bendpoint\x18\x04 \x01(\tR\bendpoint\x12\x1c\n" + "\aapi_key\x18\x05 \x01(\tB\x03\xe0A\x04R\x06apiKey\x12#\n" + - "\vapi_key_set\x18\b \x01(\bB\x03\xe0A\x03R\tapiKeySet\x12%\n" + - "\fapi_key_hint\x18\t \x01(\tB\x03\xe0A\x03R\n" + + "\vapi_key_set\x18\x06 \x01(\bB\x03\xe0A\x03R\tapiKeySet\x12%\n" + + "\fapi_key_hint\x18\a \x01(\tB\x03\xe0A\x03R\n" + "apiKeyHint\x1a\x80\x01\n" + "\x13TranscriptionConfig\x12\x1f\n" + "\vprovider_id\x18\x01 \x01(\tR\n" + "providerId\x12\x14\n" + "\x05model\x18\x02 \x01(\tR\x05model\x12\x1a\n" + "\blanguage\x18\x03 \x01(\tR\blanguage\x12\x16\n" + - "\x06prompt\x18\x04 \x01(\tR\x06prompt\x1aR\n" + - "\rAccessSetting\x12A\n" + - "\vaccess_mode\x18\x01 \x01(\x0e2 .memos.api.v1.InstanceAccessModeR\n" + + "\x06prompt\x18\x04 \x01(\tR\x06prompt\x1aO\n" + + "\rAccessSetting\x12>\n" + + "\vaccess_mode\x18\x01 \x01(\x0e2\x1d.memos.api.InstanceAccessModeR\n" + "accessMode\"v\n" + "\x03Key\x12\x13\n" + "\x0fKEY_UNSPECIFIED\x10\x00\x12\v\n" + @@ -2399,143 +2447,144 @@ const file_api_v1_instance_service_proto_rawDesc = "" + "\n" + "\x06OPENAI\x10\x01\x12\n" + "\n" + - "\x06GEMINI\x10\x02:a\xeaA^\n" + - "\x1cmemos.api.v1/InstanceSetting\x12\x1binstance/settings/{setting}*\x10instanceSettings2\x0finstanceSettingB\a\n" + - "\x05value\"U\n" + - "\x19GetInstanceSettingRequest\x128\n" + - "\x04name\x18\x01 \x01(\tB$\xe0A\x02\xfaA\x1e\n" + - "\x1cmemos.api.v1/InstanceSettingR\x04name\"]\n" + - "\x1fBatchGetInstanceSettingsRequest\x12:\n" + - "\x05names\x18\x01 \x03(\tB$\xe0A\x02\xfaA\x1e\n" + - "\x1cmemos.api.v1/InstanceSettingR\x05names\"]\n" + - " BatchGetInstanceSettingsResponse\x129\n" + - "\bsettings\x18\x01 \x03(\v2\x1d.memos.api.v1.InstanceSettingR\bsettings\"\x9e\x01\n" + - "\x1cUpdateInstanceSettingRequest\x12<\n" + - "\asetting\x18\x01 \x01(\v2\x1d.memos.api.v1.InstanceSettingB\x03\xe0A\x02R\asetting\x12@\n" + + "\x06GEMINI\x10\x02:^\xeaA[\n" + + "\x19memos.api/InstanceSetting\x12\x1binstance/settings/{setting}*\x10instanceSettings2\x0finstanceSettingB\a\n" + + "\x05value\"R\n" + + "\x19GetInstanceSettingRequest\x125\n" + + "\x04name\x18\x01 \x01(\tB!\xe0A\x02\xfaA\x1b\n" + + "\x19memos.api/InstanceSettingR\x04name\"Z\n" + + "\x1fBatchGetInstanceSettingsRequest\x127\n" + + "\x05names\x18\x01 \x03(\tB!\xe0A\x02\xfaA\x1b\n" + + "\x19memos.api/InstanceSettingR\x05names\"k\n" + + " BatchGetInstanceSettingsResponse\x12G\n" + + "\x11instance_settings\x18\x01 \x03(\v2\x1a.memos.api.InstanceSettingR\x10instanceSettings\"\xac\x01\n" + + "\x1cUpdateInstanceSettingRequest\x12J\n" + + "\x10instance_setting\x18\x01 \x01(\v2\x1a.memos.api.InstanceSettingB\x03\xe0A\x02R\x0finstanceSetting\x12@\n" + "\vupdate_mask\x18\x02 \x01(\v2\x1a.google.protobuf.FieldMaskB\x03\xe0A\x01R\n" + - "updateMask\"\xaa\x01\n" + - "\x1fTestInstanceEmailSettingRequest\x12Y\n" + - "\x05email\x18\x01 \x01(\v2>.memos.api.v1.InstanceSetting.NotificationSetting.EmailSettingB\x03\xe0A\x01R\x05email\x12,\n" + - "\x0frecipient_email\x18\x02 \x01(\tB\x03\xe0A\x01R\x0erecipientEmail\"\x19\n" + - "\x17GetInstanceStatsRequest\"\x91\x02\n" + - "\rInstanceStats\x12E\n" + - "\bdatabase\x18\x01 \x01(\v2).memos.api.v1.InstanceStats.DatabaseStatsR\bdatabase\x12.\n" + + "updateMask\"\xa7\x01\n" + + "\x1fTestInstanceEmailSettingRequest\x12V\n" + + "\x05email\x18\x01 \x01(\v2;.memos.api.InstanceSetting.NotificationSetting.EmailSettingB\x03\xe0A\x01R\x05email\x12,\n" + + "\x0frecipient_email\x18\x02 \x01(\tB\x03\xe0A\x01R\x0erecipientEmail\"\x8e\x02\n" + + "\rInstanceStats\x12B\n" + + "\bdatabase\x18\x01 \x01(\v2&.memos.api.InstanceStats.DatabaseStatsR\bdatabase\x12.\n" + "\x13local_storage_bytes\x18\x02 \x01(\x03R\x11localStorageBytes\x12A\n" + - "\x0egenerated_time\x18\x04 \x01(\v2\x1a.google.protobuf.TimestampR\rgeneratedTime\x1aF\n" + + "\x0egenerated_time\x18\x03 \x01(\v2\x1a.google.protobuf.TimestampR\rgeneratedTime\x1aF\n" + "\rDatabaseStats\x12\x16\n" + "\x06driver\x18\x01 \x01(\tR\x06driver\x12\x1d\n" + "\n" + - "size_bytes\x18\x02 \x01(\x03R\tsizeBytes*}\n" + + "size_bytes\x18\x02 \x01(\x03R\tsizeBytes\"\x19\n" + + "\x17GetInstanceStatsRequest*}\n" + "\x12InstanceAccessMode\x12$\n" + " INSTANCE_ACCESS_MODE_UNSPECIFIED\x10\x00\x12 \n" + "\x1cINSTANCE_ACCESS_MODE_PRIVATE\x10\x01\x12\x1f\n" + - "\x1bINSTANCE_ACCESS_MODE_PUBLIC\x10\x022\x9f\a\n" + - "\x0fInstanceService\x12~\n" + - "\x12GetInstanceProfile\x12'.memos.api.v1.GetInstanceProfileRequest\x1a\x1d.memos.api.v1.InstanceProfile\" \x82\xd3\xe4\x93\x02\x1a\x12\x18/api/v1/instance/profile\x12\x8f\x01\n" + - "\x12GetInstanceSetting\x12'.memos.api.v1.GetInstanceSettingRequest\x1a\x1d.memos.api.v1.InstanceSetting\"1\xdaA\x04name\x82\xd3\xe4\x93\x02$\x12\"/api/v1/{name=instance/settings/*}\x12\xa8\x01\n" + - "\x18BatchGetInstanceSettings\x12-.memos.api.v1.BatchGetInstanceSettingsRequest\x1a..memos.api.v1.BatchGetInstanceSettingsResponse\"-\x82\xd3\xe4\x93\x02':\x01*\"\"/api/v1/instance/settings:batchGet\x12\xb5\x01\n" + - "\x15UpdateInstanceSetting\x12*.memos.api.v1.UpdateInstanceSettingRequest\x1a\x1d.memos.api.v1.InstanceSetting\"Q\xdaA\x13setting,update_mask\x82\xd3\xe4\x93\x025:\asetting2*/api/v1/{setting.name=instance/settings/*}\x12\x9e\x01\n" + - "\x18TestInstanceEmailSetting\x12-.memos.api.v1.TestInstanceEmailSettingRequest\x1a\x16.google.protobuf.Empty\";\x82\xd3\xe4\x93\x025:\x01*\"0/api/v1/instance/settings/notification:testEmail\x12v\n" + - "\x10GetInstanceStats\x12%.memos.api.v1.GetInstanceStatsRequest\x1a\x1b.memos.api.v1.InstanceStats\"\x1e\x82\xd3\xe4\x93\x02\x18\x12\x16/api/v1/instance/statsB\xac\x01\n" + - "\x10com.memos.api.v1B\x14InstanceServiceProtoP\x01Z0github.com/usememos/memos/proto/gen/api/v1;apiv1\xa2\x02\x03MAX\xaa\x02\fMemos.Api.V1\xca\x02\fMemos\\Api\\V1\xe2\x02\x18Memos\\Api\\V1\\GPBMetadata\xea\x02\x0eMemos::Api::V1b\x06proto3" + "\x1bINSTANCE_ACCESS_MODE_PUBLIC\x10\x022\x87\a\n" + + "\x0fInstanceService\x12u\n" + + "\x12GetInstanceProfile\x12$.memos.api.GetInstanceProfileRequest\x1a\x1a.memos.api.InstanceProfile\"\x1d\x82\xd3\xe4\x93\x02\x17\x12\x15/api/instance/profile\x12\x86\x01\n" + + "\x12GetInstanceSetting\x12$.memos.api.GetInstanceSettingRequest\x1a\x1a.memos.api.InstanceSetting\".\xdaA\x04name\x82\xd3\xe4\x93\x02!\x12\x1f/api/{name=instance/settings/*}\x12\x9f\x01\n" + + "\x18BatchGetInstanceSettings\x12*.memos.api.BatchGetInstanceSettingsRequest\x1a+.memos.api.BatchGetInstanceSettingsResponse\"*\x82\xd3\xe4\x93\x02$:\x01*\"\x1f/api/instance/settings:batchGet\x12\xc7\x01\n" + + "\x15UpdateInstanceSetting\x12'.memos.api.UpdateInstanceSettingRequest\x1a\x1a.memos.api.InstanceSetting\"i\xdaA\x1cinstance_setting,update_mask\x82\xd3\xe4\x93\x02D:\x10instance_setting20/api/{instance_setting.name=instance/settings/*}\x12\x98\x01\n" + + "\x18TestInstanceEmailSetting\x12*.memos.api.TestInstanceEmailSettingRequest\x1a\x16.google.protobuf.Empty\"8\x82\xd3\xe4\x93\x022:\x01*\"-/api/instance/settings/notification:testEmail\x12m\n" + + "\x10GetInstanceStats\x12\".memos.api.GetInstanceStatsRequest\x1a\x18.memos.api.InstanceStats\"\x1b\x82\xd3\xe4\x93\x02\x15\x12\x13/api/instance/statsB\x93\x01\n" + + "\rcom.memos.apiB\x14InstanceServiceProtoP\x01Z'github.com/usememos/memos/proto/gen/api\xa2\x02\x03MAX\xaa\x02\tMemos.Api\xca\x02\tMemos\\Api\xe2\x02\x15Memos\\Api\\GPBMetadata\xea\x02\n" + + "Memos::Apib\x06proto3" var ( - file_api_v1_instance_service_proto_rawDescOnce sync.Once - file_api_v1_instance_service_proto_rawDescData []byte + file_api_instance_service_proto_rawDescOnce sync.Once + file_api_instance_service_proto_rawDescData []byte ) -func file_api_v1_instance_service_proto_rawDescGZIP() []byte { - file_api_v1_instance_service_proto_rawDescOnce.Do(func() { - file_api_v1_instance_service_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_api_v1_instance_service_proto_rawDesc), len(file_api_v1_instance_service_proto_rawDesc))) +func file_api_instance_service_proto_rawDescGZIP() []byte { + file_api_instance_service_proto_rawDescOnce.Do(func() { + file_api_instance_service_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_api_instance_service_proto_rawDesc), len(file_api_instance_service_proto_rawDesc))) }) - return file_api_v1_instance_service_proto_rawDescData + return file_api_instance_service_proto_rawDescData } -var file_api_v1_instance_service_proto_enumTypes = make([]protoimpl.EnumInfo, 5) -var file_api_v1_instance_service_proto_msgTypes = make([]protoimpl.MessageInfo, 28) -var file_api_v1_instance_service_proto_goTypes = []any{ - (InstanceAccessMode)(0), // 0: memos.api.v1.InstanceAccessMode - (InstanceSetting_Key)(0), // 1: memos.api.v1.InstanceSetting.Key - (InstanceSetting_StorageType)(0), // 2: memos.api.v1.InstanceSetting.StorageType - (InstanceSetting_AIProviderType)(0), // 3: memos.api.v1.InstanceSetting.AIProviderType - (InstanceSetting_StorageSetting_StorageType)(0), // 4: memos.api.v1.InstanceSetting.StorageSetting.StorageType - (*InstanceProfile)(nil), // 5: memos.api.v1.InstanceProfile - (*GetInstanceProfileRequest)(nil), // 6: memos.api.v1.GetInstanceProfileRequest - (*InstanceSetting)(nil), // 7: memos.api.v1.InstanceSetting - (*GetInstanceSettingRequest)(nil), // 8: memos.api.v1.GetInstanceSettingRequest - (*BatchGetInstanceSettingsRequest)(nil), // 9: memos.api.v1.BatchGetInstanceSettingsRequest - (*BatchGetInstanceSettingsResponse)(nil), // 10: memos.api.v1.BatchGetInstanceSettingsResponse - (*UpdateInstanceSettingRequest)(nil), // 11: memos.api.v1.UpdateInstanceSettingRequest - (*TestInstanceEmailSettingRequest)(nil), // 12: memos.api.v1.TestInstanceEmailSettingRequest - (*GetInstanceStatsRequest)(nil), // 13: memos.api.v1.GetInstanceStatsRequest - (*InstanceStats)(nil), // 14: memos.api.v1.InstanceStats - (*InstanceProfile_Challenge)(nil), // 15: memos.api.v1.InstanceProfile.Challenge - (*InstanceSetting_GeneralSetting)(nil), // 16: memos.api.v1.InstanceSetting.GeneralSetting - (*InstanceSetting_Storage)(nil), // 17: memos.api.v1.InstanceSetting.Storage - (*InstanceSetting_StorageSetting)(nil), // 18: memos.api.v1.InstanceSetting.StorageSetting - (*InstanceSetting_MemoRelatedSetting)(nil), // 19: memos.api.v1.InstanceSetting.MemoRelatedSetting - (*InstanceSetting_TagMetadata)(nil), // 20: memos.api.v1.InstanceSetting.TagMetadata - (*InstanceSetting_TagsSetting)(nil), // 21: memos.api.v1.InstanceSetting.TagsSetting - (*InstanceSetting_NotificationSetting)(nil), // 22: memos.api.v1.InstanceSetting.NotificationSetting - (*InstanceSetting_AISetting)(nil), // 23: memos.api.v1.InstanceSetting.AISetting - (*InstanceSetting_AIProviderConfig)(nil), // 24: memos.api.v1.InstanceSetting.AIProviderConfig - (*InstanceSetting_TranscriptionConfig)(nil), // 25: memos.api.v1.InstanceSetting.TranscriptionConfig - (*InstanceSetting_AccessSetting)(nil), // 26: memos.api.v1.InstanceSetting.AccessSetting - (*InstanceSetting_GeneralSetting_CustomProfile)(nil), // 27: memos.api.v1.InstanceSetting.GeneralSetting.CustomProfile - (*InstanceSetting_Storage_S3Config)(nil), // 28: memos.api.v1.InstanceSetting.Storage.S3Config - (*InstanceSetting_StorageSetting_S3Config)(nil), // 29: memos.api.v1.InstanceSetting.StorageSetting.S3Config - nil, // 30: memos.api.v1.InstanceSetting.TagsSetting.TagsEntry - (*InstanceSetting_NotificationSetting_EmailSetting)(nil), // 31: memos.api.v1.InstanceSetting.NotificationSetting.EmailSetting - (*InstanceStats_DatabaseStats)(nil), // 32: memos.api.v1.InstanceStats.DatabaseStats - (*User)(nil), // 33: memos.api.v1.User +var file_api_instance_service_proto_enumTypes = make([]protoimpl.EnumInfo, 5) +var file_api_instance_service_proto_msgTypes = make([]protoimpl.MessageInfo, 28) +var file_api_instance_service_proto_goTypes = []any{ + (InstanceAccessMode)(0), // 0: memos.api.InstanceAccessMode + (InstanceSetting_Key)(0), // 1: memos.api.InstanceSetting.Key + (InstanceSetting_StorageType)(0), // 2: memos.api.InstanceSetting.StorageType + (InstanceSetting_AIProviderType)(0), // 3: memos.api.InstanceSetting.AIProviderType + (InstanceSetting_StorageSetting_StorageType)(0), // 4: memos.api.InstanceSetting.StorageSetting.StorageType + (*InstanceProfile)(nil), // 5: memos.api.InstanceProfile + (*GetInstanceProfileRequest)(nil), // 6: memos.api.GetInstanceProfileRequest + (*InstanceSetting)(nil), // 7: memos.api.InstanceSetting + (*GetInstanceSettingRequest)(nil), // 8: memos.api.GetInstanceSettingRequest + (*BatchGetInstanceSettingsRequest)(nil), // 9: memos.api.BatchGetInstanceSettingsRequest + (*BatchGetInstanceSettingsResponse)(nil), // 10: memos.api.BatchGetInstanceSettingsResponse + (*UpdateInstanceSettingRequest)(nil), // 11: memos.api.UpdateInstanceSettingRequest + (*TestInstanceEmailSettingRequest)(nil), // 12: memos.api.TestInstanceEmailSettingRequest + (*InstanceStats)(nil), // 13: memos.api.InstanceStats + (*GetInstanceStatsRequest)(nil), // 14: memos.api.GetInstanceStatsRequest + (*InstanceProfile_Challenge)(nil), // 15: memos.api.InstanceProfile.Challenge + (*InstanceSetting_GeneralSetting)(nil), // 16: memos.api.InstanceSetting.GeneralSetting + (*InstanceSetting_StorageSetting)(nil), // 17: memos.api.InstanceSetting.StorageSetting + (*InstanceSetting_Storage)(nil), // 18: memos.api.InstanceSetting.Storage + (*InstanceSetting_MemoRelatedSetting)(nil), // 19: memos.api.InstanceSetting.MemoRelatedSetting + (*InstanceSetting_TagsSetting)(nil), // 20: memos.api.InstanceSetting.TagsSetting + (*InstanceSetting_TagMetadata)(nil), // 21: memos.api.InstanceSetting.TagMetadata + (*InstanceSetting_NotificationSetting)(nil), // 22: memos.api.InstanceSetting.NotificationSetting + (*InstanceSetting_AISetting)(nil), // 23: memos.api.InstanceSetting.AISetting + (*InstanceSetting_AIProviderConfig)(nil), // 24: memos.api.InstanceSetting.AIProviderConfig + (*InstanceSetting_TranscriptionConfig)(nil), // 25: memos.api.InstanceSetting.TranscriptionConfig + (*InstanceSetting_AccessSetting)(nil), // 26: memos.api.InstanceSetting.AccessSetting + (*InstanceSetting_GeneralSetting_CustomProfile)(nil), // 27: memos.api.InstanceSetting.GeneralSetting.CustomProfile + (*InstanceSetting_StorageSetting_S3Config)(nil), // 28: memos.api.InstanceSetting.StorageSetting.S3Config + (*InstanceSetting_Storage_S3Config)(nil), // 29: memos.api.InstanceSetting.Storage.S3Config + nil, // 30: memos.api.InstanceSetting.TagsSetting.TagsEntry + (*InstanceSetting_NotificationSetting_EmailSetting)(nil), // 31: memos.api.InstanceSetting.NotificationSetting.EmailSetting + (*InstanceStats_DatabaseStats)(nil), // 32: memos.api.InstanceStats.DatabaseStats + (*User)(nil), // 33: memos.api.User (*fieldmaskpb.FieldMask)(nil), // 34: google.protobuf.FieldMask (*timestamppb.Timestamp)(nil), // 35: google.protobuf.Timestamp (*color.Color)(nil), // 36: google.type.Color (*emptypb.Empty)(nil), // 37: google.protobuf.Empty } -var file_api_v1_instance_service_proto_depIdxs = []int32{ - 33, // 0: memos.api.v1.InstanceProfile.admin:type_name -> memos.api.v1.User - 0, // 1: memos.api.v1.InstanceProfile.access_mode:type_name -> memos.api.v1.InstanceAccessMode - 15, // 2: memos.api.v1.InstanceProfile.challenge:type_name -> memos.api.v1.InstanceProfile.Challenge - 16, // 3: memos.api.v1.InstanceSetting.general_setting:type_name -> memos.api.v1.InstanceSetting.GeneralSetting - 18, // 4: memos.api.v1.InstanceSetting.storage_setting:type_name -> memos.api.v1.InstanceSetting.StorageSetting - 19, // 5: memos.api.v1.InstanceSetting.memo_related_setting:type_name -> memos.api.v1.InstanceSetting.MemoRelatedSetting - 21, // 6: memos.api.v1.InstanceSetting.tags_setting:type_name -> memos.api.v1.InstanceSetting.TagsSetting - 22, // 7: memos.api.v1.InstanceSetting.notification_setting:type_name -> memos.api.v1.InstanceSetting.NotificationSetting - 23, // 8: memos.api.v1.InstanceSetting.ai_setting:type_name -> memos.api.v1.InstanceSetting.AISetting - 26, // 9: memos.api.v1.InstanceSetting.access_setting:type_name -> memos.api.v1.InstanceSetting.AccessSetting - 7, // 10: memos.api.v1.BatchGetInstanceSettingsResponse.settings:type_name -> memos.api.v1.InstanceSetting - 7, // 11: memos.api.v1.UpdateInstanceSettingRequest.setting:type_name -> memos.api.v1.InstanceSetting - 34, // 12: memos.api.v1.UpdateInstanceSettingRequest.update_mask:type_name -> google.protobuf.FieldMask - 31, // 13: memos.api.v1.TestInstanceEmailSettingRequest.email:type_name -> memos.api.v1.InstanceSetting.NotificationSetting.EmailSetting - 32, // 14: memos.api.v1.InstanceStats.database:type_name -> memos.api.v1.InstanceStats.DatabaseStats - 35, // 15: memos.api.v1.InstanceStats.generated_time:type_name -> google.protobuf.Timestamp - 27, // 16: memos.api.v1.InstanceSetting.GeneralSetting.custom_profile:type_name -> memos.api.v1.InstanceSetting.GeneralSetting.CustomProfile - 2, // 17: memos.api.v1.InstanceSetting.Storage.type:type_name -> memos.api.v1.InstanceSetting.StorageType - 28, // 18: memos.api.v1.InstanceSetting.Storage.s3_config:type_name -> memos.api.v1.InstanceSetting.Storage.S3Config - 4, // 19: memos.api.v1.InstanceSetting.StorageSetting.storage_type:type_name -> memos.api.v1.InstanceSetting.StorageSetting.StorageType - 29, // 20: memos.api.v1.InstanceSetting.StorageSetting.s3_config:type_name -> memos.api.v1.InstanceSetting.StorageSetting.S3Config - 17, // 21: memos.api.v1.InstanceSetting.StorageSetting.storages:type_name -> memos.api.v1.InstanceSetting.Storage - 36, // 22: memos.api.v1.InstanceSetting.TagMetadata.background_color:type_name -> google.type.Color - 30, // 23: memos.api.v1.InstanceSetting.TagsSetting.tags:type_name -> memos.api.v1.InstanceSetting.TagsSetting.TagsEntry - 31, // 24: memos.api.v1.InstanceSetting.NotificationSetting.email:type_name -> memos.api.v1.InstanceSetting.NotificationSetting.EmailSetting - 24, // 25: memos.api.v1.InstanceSetting.AISetting.providers:type_name -> memos.api.v1.InstanceSetting.AIProviderConfig - 25, // 26: memos.api.v1.InstanceSetting.AISetting.transcription:type_name -> memos.api.v1.InstanceSetting.TranscriptionConfig - 3, // 27: memos.api.v1.InstanceSetting.AIProviderConfig.type:type_name -> memos.api.v1.InstanceSetting.AIProviderType - 0, // 28: memos.api.v1.InstanceSetting.AccessSetting.access_mode:type_name -> memos.api.v1.InstanceAccessMode - 20, // 29: memos.api.v1.InstanceSetting.TagsSetting.TagsEntry.value:type_name -> memos.api.v1.InstanceSetting.TagMetadata - 6, // 30: memos.api.v1.InstanceService.GetInstanceProfile:input_type -> memos.api.v1.GetInstanceProfileRequest - 8, // 31: memos.api.v1.InstanceService.GetInstanceSetting:input_type -> memos.api.v1.GetInstanceSettingRequest - 9, // 32: memos.api.v1.InstanceService.BatchGetInstanceSettings:input_type -> memos.api.v1.BatchGetInstanceSettingsRequest - 11, // 33: memos.api.v1.InstanceService.UpdateInstanceSetting:input_type -> memos.api.v1.UpdateInstanceSettingRequest - 12, // 34: memos.api.v1.InstanceService.TestInstanceEmailSetting:input_type -> memos.api.v1.TestInstanceEmailSettingRequest - 13, // 35: memos.api.v1.InstanceService.GetInstanceStats:input_type -> memos.api.v1.GetInstanceStatsRequest - 5, // 36: memos.api.v1.InstanceService.GetInstanceProfile:output_type -> memos.api.v1.InstanceProfile - 7, // 37: memos.api.v1.InstanceService.GetInstanceSetting:output_type -> memos.api.v1.InstanceSetting - 10, // 38: memos.api.v1.InstanceService.BatchGetInstanceSettings:output_type -> memos.api.v1.BatchGetInstanceSettingsResponse - 7, // 39: memos.api.v1.InstanceService.UpdateInstanceSetting:output_type -> memos.api.v1.InstanceSetting - 37, // 40: memos.api.v1.InstanceService.TestInstanceEmailSetting:output_type -> google.protobuf.Empty - 14, // 41: memos.api.v1.InstanceService.GetInstanceStats:output_type -> memos.api.v1.InstanceStats +var file_api_instance_service_proto_depIdxs = []int32{ + 0, // 0: memos.api.InstanceProfile.access_mode:type_name -> memos.api.InstanceAccessMode + 33, // 1: memos.api.InstanceProfile.admin:type_name -> memos.api.User + 15, // 2: memos.api.InstanceProfile.challenge:type_name -> memos.api.InstanceProfile.Challenge + 16, // 3: memos.api.InstanceSetting.general_setting:type_name -> memos.api.InstanceSetting.GeneralSetting + 17, // 4: memos.api.InstanceSetting.storage_setting:type_name -> memos.api.InstanceSetting.StorageSetting + 19, // 5: memos.api.InstanceSetting.memo_related_setting:type_name -> memos.api.InstanceSetting.MemoRelatedSetting + 20, // 6: memos.api.InstanceSetting.tags_setting:type_name -> memos.api.InstanceSetting.TagsSetting + 22, // 7: memos.api.InstanceSetting.notification_setting:type_name -> memos.api.InstanceSetting.NotificationSetting + 23, // 8: memos.api.InstanceSetting.ai_setting:type_name -> memos.api.InstanceSetting.AISetting + 26, // 9: memos.api.InstanceSetting.access_setting:type_name -> memos.api.InstanceSetting.AccessSetting + 7, // 10: memos.api.BatchGetInstanceSettingsResponse.instance_settings:type_name -> memos.api.InstanceSetting + 7, // 11: memos.api.UpdateInstanceSettingRequest.instance_setting:type_name -> memos.api.InstanceSetting + 34, // 12: memos.api.UpdateInstanceSettingRequest.update_mask:type_name -> google.protobuf.FieldMask + 31, // 13: memos.api.TestInstanceEmailSettingRequest.email:type_name -> memos.api.InstanceSetting.NotificationSetting.EmailSetting + 32, // 14: memos.api.InstanceStats.database:type_name -> memos.api.InstanceStats.DatabaseStats + 35, // 15: memos.api.InstanceStats.generated_time:type_name -> google.protobuf.Timestamp + 27, // 16: memos.api.InstanceSetting.GeneralSetting.custom_profile:type_name -> memos.api.InstanceSetting.GeneralSetting.CustomProfile + 18, // 17: memos.api.InstanceSetting.StorageSetting.storages:type_name -> memos.api.InstanceSetting.Storage + 4, // 18: memos.api.InstanceSetting.StorageSetting.storage_type:type_name -> memos.api.InstanceSetting.StorageSetting.StorageType + 28, // 19: memos.api.InstanceSetting.StorageSetting.s3_config:type_name -> memos.api.InstanceSetting.StorageSetting.S3Config + 2, // 20: memos.api.InstanceSetting.Storage.type:type_name -> memos.api.InstanceSetting.StorageType + 29, // 21: memos.api.InstanceSetting.Storage.s3_config:type_name -> memos.api.InstanceSetting.Storage.S3Config + 30, // 22: memos.api.InstanceSetting.TagsSetting.tags:type_name -> memos.api.InstanceSetting.TagsSetting.TagsEntry + 36, // 23: memos.api.InstanceSetting.TagMetadata.background_color:type_name -> google.type.Color + 31, // 24: memos.api.InstanceSetting.NotificationSetting.email:type_name -> memos.api.InstanceSetting.NotificationSetting.EmailSetting + 24, // 25: memos.api.InstanceSetting.AISetting.providers:type_name -> memos.api.InstanceSetting.AIProviderConfig + 25, // 26: memos.api.InstanceSetting.AISetting.transcription:type_name -> memos.api.InstanceSetting.TranscriptionConfig + 3, // 27: memos.api.InstanceSetting.AIProviderConfig.type:type_name -> memos.api.InstanceSetting.AIProviderType + 0, // 28: memos.api.InstanceSetting.AccessSetting.access_mode:type_name -> memos.api.InstanceAccessMode + 21, // 29: memos.api.InstanceSetting.TagsSetting.TagsEntry.value:type_name -> memos.api.InstanceSetting.TagMetadata + 6, // 30: memos.api.InstanceService.GetInstanceProfile:input_type -> memos.api.GetInstanceProfileRequest + 8, // 31: memos.api.InstanceService.GetInstanceSetting:input_type -> memos.api.GetInstanceSettingRequest + 9, // 32: memos.api.InstanceService.BatchGetInstanceSettings:input_type -> memos.api.BatchGetInstanceSettingsRequest + 11, // 33: memos.api.InstanceService.UpdateInstanceSetting:input_type -> memos.api.UpdateInstanceSettingRequest + 12, // 34: memos.api.InstanceService.TestInstanceEmailSetting:input_type -> memos.api.TestInstanceEmailSettingRequest + 14, // 35: memos.api.InstanceService.GetInstanceStats:input_type -> memos.api.GetInstanceStatsRequest + 5, // 36: memos.api.InstanceService.GetInstanceProfile:output_type -> memos.api.InstanceProfile + 7, // 37: memos.api.InstanceService.GetInstanceSetting:output_type -> memos.api.InstanceSetting + 10, // 38: memos.api.InstanceService.BatchGetInstanceSettings:output_type -> memos.api.BatchGetInstanceSettingsResponse + 7, // 39: memos.api.InstanceService.UpdateInstanceSetting:output_type -> memos.api.InstanceSetting + 37, // 40: memos.api.InstanceService.TestInstanceEmailSetting:output_type -> google.protobuf.Empty + 13, // 41: memos.api.InstanceService.GetInstanceStats:output_type -> memos.api.InstanceStats 36, // [36:42] is the sub-list for method output_type 30, // [30:36] is the sub-list for method input_type 30, // [30:30] is the sub-list for extension type_name @@ -2543,13 +2592,13 @@ var file_api_v1_instance_service_proto_depIdxs = []int32{ 0, // [0:30] is the sub-list for field type_name } -func init() { file_api_v1_instance_service_proto_init() } -func file_api_v1_instance_service_proto_init() { - if File_api_v1_instance_service_proto != nil { +func init() { file_api_instance_service_proto_init() } +func file_api_instance_service_proto_init() { + if File_api_instance_service_proto != nil { return } - file_api_v1_user_service_proto_init() - file_api_v1_instance_service_proto_msgTypes[2].OneofWrappers = []any{ + file_api_user_service_proto_init() + file_api_instance_service_proto_msgTypes[2].OneofWrappers = []any{ (*InstanceSetting_GeneralSetting_)(nil), (*InstanceSetting_StorageSetting_)(nil), (*InstanceSetting_MemoRelatedSetting_)(nil), @@ -2558,25 +2607,25 @@ func file_api_v1_instance_service_proto_init() { (*InstanceSetting_AiSetting)(nil), (*InstanceSetting_AccessSetting_)(nil), } - file_api_v1_instance_service_proto_msgTypes[12].OneofWrappers = []any{ + file_api_instance_service_proto_msgTypes[13].OneofWrappers = []any{ (*InstanceSetting_Storage_S3Config_)(nil), } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: unsafe.Slice(unsafe.StringData(file_api_v1_instance_service_proto_rawDesc), len(file_api_v1_instance_service_proto_rawDesc)), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_api_instance_service_proto_rawDesc), len(file_api_instance_service_proto_rawDesc)), NumEnums: 5, NumMessages: 28, NumExtensions: 0, NumServices: 1, }, - GoTypes: file_api_v1_instance_service_proto_goTypes, - DependencyIndexes: file_api_v1_instance_service_proto_depIdxs, - EnumInfos: file_api_v1_instance_service_proto_enumTypes, - MessageInfos: file_api_v1_instance_service_proto_msgTypes, + GoTypes: file_api_instance_service_proto_goTypes, + DependencyIndexes: file_api_instance_service_proto_depIdxs, + EnumInfos: file_api_instance_service_proto_enumTypes, + MessageInfos: file_api_instance_service_proto_msgTypes, }.Build() - File_api_v1_instance_service_proto = out.File - file_api_v1_instance_service_proto_goTypes = nil - file_api_v1_instance_service_proto_depIdxs = nil + File_api_instance_service_proto = out.File + file_api_instance_service_proto_goTypes = nil + file_api_instance_service_proto_depIdxs = nil } diff --git a/proto/gen/api/v1/instance_service.pb.gw.go b/proto/gen/api/instance_service.pb.gw.go similarity index 89% rename from proto/gen/api/v1/instance_service.pb.gw.go rename to proto/gen/api/instance_service.pb.gw.go index 2a440486a..cdc9000b8 100644 --- a/proto/gen/api/v1/instance_service.pb.gw.go +++ b/proto/gen/api/instance_service.pb.gw.go @@ -1,12 +1,12 @@ // Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: api/v1/instance_service.proto +// source: api/instance_service.proto /* -Package apiv1 is a reverse proxy. +Package api is a reverse proxy. It translates gRPC into RESTful JSON APIs. */ -package apiv1 +package api import ( "context" @@ -122,7 +122,7 @@ func local_request_InstanceService_BatchGetInstanceSettings_0(ctx context.Contex return msg, metadata, err } -var filter_InstanceService_UpdateInstanceSetting_0 = &utilities.DoubleArray{Encoding: map[string]int{"setting": 0, "name": 1}, Base: []int{1, 2, 1, 0, 0}, Check: []int{0, 1, 2, 3, 2}} +var filter_InstanceService_UpdateInstanceSetting_0 = &utilities.DoubleArray{Encoding: map[string]int{"instance_setting": 0, "name": 1}, Base: []int{1, 2, 1, 0, 0}, Check: []int{0, 1, 2, 3, 2}} func request_InstanceService_UpdateInstanceSetting_0(ctx context.Context, marshaler runtime.Marshaler, client InstanceServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var ( @@ -134,23 +134,23 @@ func request_InstanceService_UpdateInstanceSetting_0(ctx context.Context, marsha if berr != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Setting); err != nil && !errors.Is(err, io.EOF) { + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.InstanceSetting); err != nil && !errors.Is(err, io.EOF) { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if protoReq.UpdateMask == nil || len(protoReq.UpdateMask.GetPaths()) == 0 { - if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader(), protoReq.Setting); err != nil { + if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader(), protoReq.InstanceSetting); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } else { protoReq.UpdateMask = fieldMask } } - val, ok := pathParams["setting.name"] + val, ok := pathParams["instance_setting.name"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "setting.name") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "instance_setting.name") } - err = runtime.PopulateFieldFromPath(&protoReq, "setting.name", val) + err = runtime.PopulateFieldFromPath(&protoReq, "instance_setting.name", val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "setting.name", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "instance_setting.name", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) @@ -175,23 +175,23 @@ func local_request_InstanceService_UpdateInstanceSetting_0(ctx context.Context, if berr != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Setting); err != nil && !errors.Is(err, io.EOF) { + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.InstanceSetting); err != nil && !errors.Is(err, io.EOF) { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if protoReq.UpdateMask == nil || len(protoReq.UpdateMask.GetPaths()) == 0 { - if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader(), protoReq.Setting); err != nil { + if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader(), protoReq.InstanceSetting); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } else { protoReq.UpdateMask = fieldMask } } - val, ok := pathParams["setting.name"] + val, ok := pathParams["instance_setting.name"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "setting.name") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "instance_setting.name") } - err = runtime.PopulateFieldFromPath(&protoReq, "setting.name", val) + err = runtime.PopulateFieldFromPath(&protoReq, "instance_setting.name", val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "setting.name", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "instance_setting.name", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) @@ -263,7 +263,7 @@ func RegisterInstanceServiceHandlerServer(ctx context.Context, mux *runtime.Serv var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.InstanceService/GetInstanceProfile", runtime.WithHTTPPathPattern("/api/v1/instance/profile")) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.InstanceService/GetInstanceProfile", runtime.WithHTTPPathPattern("/api/instance/profile")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -283,7 +283,7 @@ func RegisterInstanceServiceHandlerServer(ctx context.Context, mux *runtime.Serv var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.InstanceService/GetInstanceSetting", runtime.WithHTTPPathPattern("/api/v1/{name=instance/settings/*}")) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.InstanceService/GetInstanceSetting", runtime.WithHTTPPathPattern("/api/{name=instance/settings/*}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -303,7 +303,7 @@ func RegisterInstanceServiceHandlerServer(ctx context.Context, mux *runtime.Serv var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.InstanceService/BatchGetInstanceSettings", runtime.WithHTTPPathPattern("/api/v1/instance/settings:batchGet")) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.InstanceService/BatchGetInstanceSettings", runtime.WithHTTPPathPattern("/api/instance/settings:batchGet")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -323,7 +323,7 @@ func RegisterInstanceServiceHandlerServer(ctx context.Context, mux *runtime.Serv var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.InstanceService/UpdateInstanceSetting", runtime.WithHTTPPathPattern("/api/v1/{setting.name=instance/settings/*}")) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.InstanceService/UpdateInstanceSetting", runtime.WithHTTPPathPattern("/api/{instance_setting.name=instance/settings/*}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -343,7 +343,7 @@ func RegisterInstanceServiceHandlerServer(ctx context.Context, mux *runtime.Serv var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.InstanceService/TestInstanceEmailSetting", runtime.WithHTTPPathPattern("/api/v1/instance/settings/notification:testEmail")) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.InstanceService/TestInstanceEmailSetting", runtime.WithHTTPPathPattern("/api/instance/settings/notification:testEmail")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -363,7 +363,7 @@ func RegisterInstanceServiceHandlerServer(ctx context.Context, mux *runtime.Serv var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.InstanceService/GetInstanceStats", runtime.WithHTTPPathPattern("/api/v1/instance/stats")) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.InstanceService/GetInstanceStats", runtime.WithHTTPPathPattern("/api/instance/stats")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -421,7 +421,7 @@ func RegisterInstanceServiceHandlerClient(ctx context.Context, mux *runtime.Serv ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.InstanceService/GetInstanceProfile", runtime.WithHTTPPathPattern("/api/v1/instance/profile")) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.InstanceService/GetInstanceProfile", runtime.WithHTTPPathPattern("/api/instance/profile")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -438,7 +438,7 @@ func RegisterInstanceServiceHandlerClient(ctx context.Context, mux *runtime.Serv ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.InstanceService/GetInstanceSetting", runtime.WithHTTPPathPattern("/api/v1/{name=instance/settings/*}")) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.InstanceService/GetInstanceSetting", runtime.WithHTTPPathPattern("/api/{name=instance/settings/*}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -455,7 +455,7 @@ func RegisterInstanceServiceHandlerClient(ctx context.Context, mux *runtime.Serv ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.InstanceService/BatchGetInstanceSettings", runtime.WithHTTPPathPattern("/api/v1/instance/settings:batchGet")) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.InstanceService/BatchGetInstanceSettings", runtime.WithHTTPPathPattern("/api/instance/settings:batchGet")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -472,7 +472,7 @@ func RegisterInstanceServiceHandlerClient(ctx context.Context, mux *runtime.Serv ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.InstanceService/UpdateInstanceSetting", runtime.WithHTTPPathPattern("/api/v1/{setting.name=instance/settings/*}")) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.InstanceService/UpdateInstanceSetting", runtime.WithHTTPPathPattern("/api/{instance_setting.name=instance/settings/*}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -489,7 +489,7 @@ func RegisterInstanceServiceHandlerClient(ctx context.Context, mux *runtime.Serv ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.InstanceService/TestInstanceEmailSetting", runtime.WithHTTPPathPattern("/api/v1/instance/settings/notification:testEmail")) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.InstanceService/TestInstanceEmailSetting", runtime.WithHTTPPathPattern("/api/instance/settings/notification:testEmail")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -506,7 +506,7 @@ func RegisterInstanceServiceHandlerClient(ctx context.Context, mux *runtime.Serv ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.InstanceService/GetInstanceStats", runtime.WithHTTPPathPattern("/api/v1/instance/stats")) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.InstanceService/GetInstanceStats", runtime.WithHTTPPathPattern("/api/instance/stats")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -523,12 +523,12 @@ func RegisterInstanceServiceHandlerClient(ctx context.Context, mux *runtime.Serv } var ( - pattern_InstanceService_GetInstanceProfile_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"api", "v1", "instance", "profile"}, "")) - pattern_InstanceService_GetInstanceSetting_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 3, 5, 4}, []string{"api", "v1", "instance", "settings", "name"}, "")) - pattern_InstanceService_BatchGetInstanceSettings_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"api", "v1", "instance", "settings"}, "batchGet")) - pattern_InstanceService_UpdateInstanceSetting_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 3, 5, 4}, []string{"api", "v1", "instance", "settings", "setting.name"}, "")) - pattern_InstanceService_TestInstanceEmailSetting_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"api", "v1", "instance", "settings", "notification"}, "testEmail")) - pattern_InstanceService_GetInstanceStats_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"api", "v1", "instance", "stats"}, "")) + pattern_InstanceService_GetInstanceProfile_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "instance", "profile"}, "")) + pattern_InstanceService_GetInstanceSetting_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 3, 5, 3}, []string{"api", "instance", "settings", "name"}, "")) + pattern_InstanceService_BatchGetInstanceSettings_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "instance", "settings"}, "batchGet")) + pattern_InstanceService_UpdateInstanceSetting_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 3, 5, 3}, []string{"api", "instance", "settings", "instance_setting.name"}, "")) + pattern_InstanceService_TestInstanceEmailSetting_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"api", "instance", "settings", "notification"}, "testEmail")) + pattern_InstanceService_GetInstanceStats_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "instance", "stats"}, "")) ) var ( diff --git a/proto/gen/api/v1/instance_service_grpc.pb.go b/proto/gen/api/instance_service_grpc.pb.go similarity index 84% rename from proto/gen/api/v1/instance_service_grpc.pb.go rename to proto/gen/api/instance_service_grpc.pb.go index ce41b23d9..7ed219ead 100644 --- a/proto/gen/api/v1/instance_service_grpc.pb.go +++ b/proto/gen/api/instance_service_grpc.pb.go @@ -2,9 +2,9 @@ // versions: // - protoc-gen-go-grpc v1.6.2 // - protoc (unknown) -// source: api/v1/instance_service.proto +// source: api/instance_service.proto -package apiv1 +package api import ( context "context" @@ -20,29 +20,34 @@ import ( const _ = grpc.SupportPackageIsVersion9 const ( - InstanceService_GetInstanceProfile_FullMethodName = "/memos.api.v1.InstanceService/GetInstanceProfile" - InstanceService_GetInstanceSetting_FullMethodName = "/memos.api.v1.InstanceService/GetInstanceSetting" - InstanceService_BatchGetInstanceSettings_FullMethodName = "/memos.api.v1.InstanceService/BatchGetInstanceSettings" - InstanceService_UpdateInstanceSetting_FullMethodName = "/memos.api.v1.InstanceService/UpdateInstanceSetting" - InstanceService_TestInstanceEmailSetting_FullMethodName = "/memos.api.v1.InstanceService/TestInstanceEmailSetting" - InstanceService_GetInstanceStats_FullMethodName = "/memos.api.v1.InstanceService/GetInstanceStats" + InstanceService_GetInstanceProfile_FullMethodName = "/memos.api.InstanceService/GetInstanceProfile" + InstanceService_GetInstanceSetting_FullMethodName = "/memos.api.InstanceService/GetInstanceSetting" + InstanceService_BatchGetInstanceSettings_FullMethodName = "/memos.api.InstanceService/BatchGetInstanceSettings" + InstanceService_UpdateInstanceSetting_FullMethodName = "/memos.api.InstanceService/UpdateInstanceSetting" + InstanceService_TestInstanceEmailSetting_FullMethodName = "/memos.api.InstanceService/TestInstanceEmailSetting" + InstanceService_GetInstanceStats_FullMethodName = "/memos.api.InstanceService/GetInstanceStats" ) // InstanceServiceClient is the client API for InstanceService service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +// +// InstanceService exposes the instance profile, instance-wide settings and usage statistics. type InstanceServiceClient interface { - // Gets the instance profile. + // GetInstanceProfile gets the instance profile. Available without authentication, including on a private instance. GetInstanceProfile(ctx context.Context, in *GetInstanceProfileRequest, opts ...grpc.CallOption) (*InstanceProfile, error) - // Gets an instance setting. + // GetInstanceSetting gets an instance setting. Available without authentication, except STORAGE and NOTIFICATION, + // which are admin only, and AI, which requires a signed-in user and hides transcription defaults from non-admins. GetInstanceSetting(ctx context.Context, in *GetInstanceSettingRequest, opts ...grpc.CallOption) (*InstanceSetting, error) - // Batch gets instance settings. + // BatchGetInstanceSettings gets up to 100 instance settings in request order, with the same access rules as + // GetInstanceSetting. The call fails if any setting cannot be returned. BatchGetInstanceSettings(ctx context.Context, in *BatchGetInstanceSettingsRequest, opts ...grpc.CallOption) (*BatchGetInstanceSettingsResponse, error) - // Updates an instance setting. + // UpdateInstanceSetting replaces an instance setting. Admin only. Settings configured by the deployment cannot be + // updated. Empty write-only credentials keep the stored values. UpdateInstanceSetting(ctx context.Context, in *UpdateInstanceSettingRequest, opts ...grpc.CallOption) (*InstanceSetting, error) - // Tests notification email delivery with the provided or stored SMTP settings. + // TestInstanceEmailSetting sends a test email with the provided or stored SMTP settings. Admin only. TestInstanceEmailSetting(ctx context.Context, in *TestInstanceEmailSettingRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) - // GetInstanceStats returns resource usage statistics for the instance. Admin only. + // GetInstanceStats gets resource usage statistics for the instance. Admin only. Results are cached for 60 seconds. GetInstanceStats(ctx context.Context, in *GetInstanceStatsRequest, opts ...grpc.CallOption) (*InstanceStats, error) } @@ -117,18 +122,23 @@ func (c *instanceServiceClient) GetInstanceStats(ctx context.Context, in *GetIns // InstanceServiceServer is the server API for InstanceService service. // All implementations must embed UnimplementedInstanceServiceServer // for forward compatibility. +// +// InstanceService exposes the instance profile, instance-wide settings and usage statistics. type InstanceServiceServer interface { - // Gets the instance profile. + // GetInstanceProfile gets the instance profile. Available without authentication, including on a private instance. GetInstanceProfile(context.Context, *GetInstanceProfileRequest) (*InstanceProfile, error) - // Gets an instance setting. + // GetInstanceSetting gets an instance setting. Available without authentication, except STORAGE and NOTIFICATION, + // which are admin only, and AI, which requires a signed-in user and hides transcription defaults from non-admins. GetInstanceSetting(context.Context, *GetInstanceSettingRequest) (*InstanceSetting, error) - // Batch gets instance settings. + // BatchGetInstanceSettings gets up to 100 instance settings in request order, with the same access rules as + // GetInstanceSetting. The call fails if any setting cannot be returned. BatchGetInstanceSettings(context.Context, *BatchGetInstanceSettingsRequest) (*BatchGetInstanceSettingsResponse, error) - // Updates an instance setting. + // UpdateInstanceSetting replaces an instance setting. Admin only. Settings configured by the deployment cannot be + // updated. Empty write-only credentials keep the stored values. UpdateInstanceSetting(context.Context, *UpdateInstanceSettingRequest) (*InstanceSetting, error) - // Tests notification email delivery with the provided or stored SMTP settings. + // TestInstanceEmailSetting sends a test email with the provided or stored SMTP settings. Admin only. TestInstanceEmailSetting(context.Context, *TestInstanceEmailSettingRequest) (*emptypb.Empty, error) - // GetInstanceStats returns resource usage statistics for the instance. Admin only. + // GetInstanceStats gets resource usage statistics for the instance. Admin only. Results are cached for 60 seconds. GetInstanceStats(context.Context, *GetInstanceStatsRequest) (*InstanceStats, error) mustEmbedUnimplementedInstanceServiceServer() } @@ -291,7 +301,7 @@ func _InstanceService_GetInstanceStats_Handler(srv interface{}, ctx context.Cont // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) var InstanceService_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "memos.api.v1.InstanceService", + ServiceName: "memos.api.InstanceService", HandlerType: (*InstanceServiceServer)(nil), Methods: []grpc.MethodDesc{ { @@ -320,5 +330,5 @@ var InstanceService_ServiceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: "api/v1/instance_service.proto", + Metadata: "api/instance_service.proto", } diff --git a/proto/gen/api/v1/memo_service.pb.go b/proto/gen/api/memo_service.pb.go similarity index 56% rename from proto/gen/api/v1/memo_service.pb.go rename to proto/gen/api/memo_service.pb.go index b8f2df57b..0b5416495 100644 --- a/proto/gen/api/v1/memo_service.pb.go +++ b/proto/gen/api/memo_service.pb.go @@ -2,9 +2,9 @@ // versions: // protoc-gen-go v1.36.12 // protoc (unknown) -// source: api/v1/memo_service.proto +// source: api/memo_service.proto -package apiv1 +package api import ( _ "google.golang.org/genproto/googleapis/api/annotations" @@ -30,14 +30,14 @@ type Visibility int32 const ( Visibility_VISIBILITY_UNSPECIFIED Visibility = 0 - // PRIVATE: only the creator can read the memo. + // Only the creator can read the memo. Visibility_PRIVATE Visibility = 1 - // PROTECTED: signed-in users of the instance can read the memo. + // Signed-in users of the instance can read the memo. Visibility_PROTECTED Visibility = 2 - // PUBLIC: signed-in users can read the memo; anonymous visitors can read it - // when instance policy permits. + // Signed-in users can read the memo; anonymous visitors can read it when + // instance policy permits. Visibility_PUBLIC Visibility = 3 - // SPACE: active members of the memo's space can read it. + // Active members of the memo's space can read the memo. Visibility_SPACE Visibility = 4 ) @@ -70,11 +70,11 @@ func (x Visibility) String() string { } func (Visibility) Descriptor() protoreflect.EnumDescriptor { - return file_api_v1_memo_service_proto_enumTypes[0].Descriptor() + return file_api_memo_service_proto_enumTypes[0].Descriptor() } func (Visibility) Type() protoreflect.EnumType { - return &file_api_v1_memo_service_proto_enumTypes[0] + return &file_api_memo_service_proto_enumTypes[0] } func (x Visibility) Number() protoreflect.EnumNumber { @@ -83,16 +83,18 @@ func (x Visibility) Number() protoreflect.EnumNumber { // Deprecated: Use Visibility.Descriptor instead. func (Visibility) EnumDescriptor() ([]byte, []int) { - return file_api_v1_memo_service_proto_rawDescGZIP(), []int{0} + return file_api_memo_service_proto_rawDescGZIP(), []int{0} } -// The type of the relation. +// Type is the kind of a memo relation. type MemoRelation_Type int32 const ( MemoRelation_TYPE_UNSPECIFIED MemoRelation_Type = 0 - MemoRelation_REFERENCE MemoRelation_Type = 1 - MemoRelation_COMMENT MemoRelation_Type = 2 + // The source memo references the target memo. Clients can set it. + MemoRelation_REFERENCE MemoRelation_Type = 1 + // The source memo is a comment on the target memo. Output only. + MemoRelation_COMMENT MemoRelation_Type = 2 ) // Enum value maps for MemoRelation_Type. @@ -120,11 +122,11 @@ func (x MemoRelation_Type) String() string { } func (MemoRelation_Type) Descriptor() protoreflect.EnumDescriptor { - return file_api_v1_memo_service_proto_enumTypes[1].Descriptor() + return file_api_memo_service_proto_enumTypes[1].Descriptor() } func (MemoRelation_Type) Type() protoreflect.EnumType { - return &file_api_v1_memo_service_proto_enumTypes[1] + return &file_api_memo_service_proto_enumTypes[1] } func (x MemoRelation_Type) Number() protoreflect.EnumNumber { @@ -133,138 +135,68 @@ func (x MemoRelation_Type) Number() protoreflect.EnumNumber { // Deprecated: Use MemoRelation_Type.Descriptor instead. func (MemoRelation_Type) EnumDescriptor() ([]byte, []int) { - return file_api_v1_memo_service_proto_rawDescGZIP(), []int{12, 0} -} - -// Reaction is a reaction attached to a memo. -type Reaction struct { - state protoimpl.MessageState `protogen:"open.v1"` - // The resource name of the reaction. - // Format: memos/{memo}/reactions/{reaction} - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // The resource name of the creator. - // Format: users/{user} - Creator string `protobuf:"bytes,2,opt,name=creator,proto3" json:"creator,omitempty"` - // Required. The type of reaction (e.g., "👍", "❤️", "😄"). - ReactionType string `protobuf:"bytes,4,opt,name=reaction_type,json=reactionType,proto3" json:"reaction_type,omitempty"` - // Output only. The creation timestamp. - CreateTime *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *Reaction) Reset() { - *x = Reaction{} - mi := &file_api_v1_memo_service_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *Reaction) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Reaction) ProtoMessage() {} - -func (x *Reaction) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_memo_service_proto_msgTypes[0] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Reaction.ProtoReflect.Descriptor instead. -func (*Reaction) Descriptor() ([]byte, []int) { - return file_api_v1_memo_service_proto_rawDescGZIP(), []int{0} -} - -func (x *Reaction) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *Reaction) GetCreator() string { - if x != nil { - return x.Creator - } - return "" -} - -func (x *Reaction) GetReactionType() string { - if x != nil { - return x.ReactionType - } - return "" -} - -func (x *Reaction) GetCreateTime() *timestamppb.Timestamp { - if x != nil { - return x.CreateTime - } - return nil + return file_api_memo_service_proto_rawDescGZIP(), []int{11, 0} } +// Memo is a Markdown note written by a user. type Memo struct { state protoimpl.MessageState `protogen:"open.v1"` - // The resource name of the memo. - // Format: memos/{memo}, where memo is the user-defined UID. + // Identifier. The resource name of the memo, where memo is the + // user-defined UID. + // Format: memos/{memo} Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // The state of the memo. - State State `protobuf:"varint,2,opt,name=state,proto3,enum=memos.api.v1.State" json:"state,omitempty"` - // The name of the creator. + // Output only. The resource name of the creator. // Format: users/{user} - Creator string `protobuf:"bytes,3,opt,name=creator,proto3" json:"creator,omitempty"` - // The creation timestamp. - // If not set on creation, the server will set it to the current time. - CreateTime *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty"` - // The last update timestamp. - // If not set on creation, the server will set it to the current time. - UpdateTime *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=update_time,json=updateTime,proto3" json:"update_time,omitempty"` - // Required. The content of the memo in Markdown format. - Content string `protobuf:"bytes,7,opt,name=content,proto3" json:"content,omitempty"` - // The visibility of the memo. - // One of PRIVATE (creator only), PROTECTED (signed-in users), PUBLIC - // (anonymous-eligible), or SPACE (active space members). Defaults to - // PRIVATE on creation when unspecified. - Visibility Visibility `protobuf:"varint,9,opt,name=visibility,proto3,enum=memos.api.v1.Visibility" json:"visibility,omitempty"` - // Output only. The tags extracted from the content. - Tags []string `protobuf:"bytes,10,rep,name=tags,proto3" json:"tags,omitempty"` - // Whether the memo is pinned. - Pinned bool `protobuf:"varint,11,opt,name=pinned,proto3" json:"pinned,omitempty"` - // Optional. The attachments of the memo. - Attachments []*Attachment `protobuf:"bytes,12,rep,name=attachments,proto3" json:"attachments,omitempty"` - // Optional. The relations of the memo. - Relations []*MemoRelation `protobuf:"bytes,13,rep,name=relations,proto3" json:"relations,omitempty"` + Creator string `protobuf:"bytes,2,opt,name=creator,proto3" json:"creator,omitempty"` + // Optional. The space in which the memo is placed. Every memo, including a + // comment, owns its placement independently. + // Format: spaces/{space} + Space *string `protobuf:"bytes,3,opt,name=space,proto3,oneof" json:"space,omitempty"` + // Required. The content of the memo in Markdown. Must not exceed the + // instance's content length limit. + Content string `protobuf:"bytes,4,opt,name=content,proto3" json:"content,omitempty"` + // Optional. The location of the memo. + Location *Location `protobuf:"bytes,5,opt,name=location,proto3,oneof" json:"location,omitempty"` + // Required. The visibility of the memo. Defaults to PRIVATE on creation when + // unspecified. SPACE requires the memo to be placed in a space. + Visibility Visibility `protobuf:"varint,6,opt,name=visibility,proto3,enum=memos.api.Visibility" json:"visibility,omitempty"` + // Required. The state of the memo. New memos are always NORMAL; change it + // with UpdateMemo. + State State `protobuf:"varint,7,opt,name=state,proto3,enum=memos.api.State" json:"state,omitempty"` + // Optional. Whether the memo is pinned. Ignored on creation; change it with + // UpdateMemo. + Pinned bool `protobuf:"varint,8,opt,name=pinned,proto3" json:"pinned,omitempty"` + // Optional. The attachments of the memo. Setting it replaces the full set. + Attachments []*Attachment `protobuf:"bytes,9,rep,name=attachments,proto3" json:"attachments,omitempty"` + // Optional. The relations of the memo in both directions. Only REFERENCE + // relations can be set; COMMENT relations are output only. + Relations []*MemoRelation `protobuf:"bytes,10,rep,name=relations,proto3" json:"relations,omitempty"` // Output only. The reactions to the memo. - Reactions []*Reaction `protobuf:"bytes,14,rep,name=reactions,proto3" json:"reactions,omitempty"` - // Output only. The computed properties of the memo. - Property *Memo_Property `protobuf:"bytes,15,opt,name=property,proto3" json:"property,omitempty"` + Reactions []*Reaction `protobuf:"bytes,11,rep,name=reactions,proto3" json:"reactions,omitempty"` // Output only. The context memo of this COMMENT relation, if any. // Its identity is returned even when the caller cannot read the parent. // Fetch the parent independently; this field does not grant read access. // Format: memos/{memo} - Parent *string `protobuf:"bytes,16,opt,name=parent,proto3,oneof" json:"parent,omitempty"` - // Output only. The snippet of the memo content. Plain text only. - Snippet string `protobuf:"bytes,17,opt,name=snippet,proto3" json:"snippet,omitempty"` - // Optional. The location of the memo. - Location *Location `protobuf:"bytes,18,opt,name=location,proto3,oneof" json:"location,omitempty"` - // Optional. The space in which this memo is placed. Format: spaces/{space}. - // Every memo, including a comment, owns its placement independently. - Space *string `protobuf:"bytes,19,opt,name=space,proto3,oneof" json:"space,omitempty"` + Parent *string `protobuf:"bytes,12,opt,name=parent,proto3,oneof" json:"parent,omitempty"` + // Output only. The tags extracted from the content. + Tags []string `protobuf:"bytes,13,rep,name=tags,proto3" json:"tags,omitempty"` + // Output only. The properties computed from the content. + Property *Memo_Property `protobuf:"bytes,14,opt,name=property,proto3" json:"property,omitempty"` + // Output only. A plain-text snippet of the content. + Snippet string `protobuf:"bytes,15,opt,name=snippet,proto3" json:"snippet,omitempty"` + // Optional. The creation time. Defaults to the current time when unset on + // creation. + CreateTime *timestamppb.Timestamp `protobuf:"bytes,16,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty"` + // Optional. The last update time. Defaults to the current time when unset on + // creation. + UpdateTime *timestamppb.Timestamp `protobuf:"bytes,17,opt,name=update_time,json=updateTime,proto3" json:"update_time,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } func (x *Memo) Reset() { *x = Memo{} - mi := &file_api_v1_memo_service_proto_msgTypes[1] + mi := &file_api_memo_service_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -276,7 +208,7 @@ func (x *Memo) String() string { func (*Memo) ProtoMessage() {} func (x *Memo) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_memo_service_proto_msgTypes[1] + mi := &file_api_memo_service_proto_msgTypes[0] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -289,7 +221,7 @@ func (x *Memo) ProtoReflect() protoreflect.Message { // Deprecated: Use Memo.ProtoReflect.Descriptor instead. func (*Memo) Descriptor() ([]byte, []int) { - return file_api_v1_memo_service_proto_rawDescGZIP(), []int{1} + return file_api_memo_service_proto_rawDescGZIP(), []int{0} } func (x *Memo) GetName() string { @@ -299,13 +231,6 @@ func (x *Memo) GetName() string { return "" } -func (x *Memo) GetState() State { - if x != nil { - return x.State - } - return State_STATE_UNSPECIFIED -} - func (x *Memo) GetCreator() string { if x != nil { return x.Creator @@ -313,18 +238,11 @@ func (x *Memo) GetCreator() string { return "" } -func (x *Memo) GetCreateTime() *timestamppb.Timestamp { - if x != nil { - return x.CreateTime +func (x *Memo) GetSpace() string { + if x != nil && x.Space != nil { + return *x.Space } - return nil -} - -func (x *Memo) GetUpdateTime() *timestamppb.Timestamp { - if x != nil { - return x.UpdateTime - } - return nil + return "" } func (x *Memo) GetContent() string { @@ -334,6 +252,13 @@ func (x *Memo) GetContent() string { return "" } +func (x *Memo) GetLocation() *Location { + if x != nil { + return x.Location + } + return nil +} + func (x *Memo) GetVisibility() Visibility { if x != nil { return x.Visibility @@ -341,11 +266,11 @@ func (x *Memo) GetVisibility() Visibility { return Visibility_VISIBILITY_UNSPECIFIED } -func (x *Memo) GetTags() []string { +func (x *Memo) GetState() State { if x != nil { - return x.Tags + return x.State } - return nil + return State_STATE_UNSPECIFIED } func (x *Memo) GetPinned() bool { @@ -376,13 +301,6 @@ func (x *Memo) GetReactions() []*Reaction { return nil } -func (x *Memo) GetProperty() *Memo_Property { - if x != nil { - return x.Property - } - return nil -} - func (x *Memo) GetParent() string { if x != nil && x.Parent != nil { return *x.Parent @@ -390,6 +308,20 @@ func (x *Memo) GetParent() string { return "" } +func (x *Memo) GetTags() []string { + if x != nil { + return x.Tags + } + return nil +} + +func (x *Memo) GetProperty() *Memo_Property { + if x != nil { + return x.Property + } + return nil +} + func (x *Memo) GetSnippet() string { if x != nil { return x.Snippet @@ -397,27 +329,420 @@ func (x *Memo) GetSnippet() string { return "" } -func (x *Memo) GetLocation() *Location { +func (x *Memo) GetCreateTime() *timestamppb.Timestamp { if x != nil { - return x.Location + return x.CreateTime } return nil } -func (x *Memo) GetSpace() string { - if x != nil && x.Space != nil { - return *x.Space +func (x *Memo) GetUpdateTime() *timestamppb.Timestamp { + if x != nil { + return x.UpdateTime + } + return nil +} + +// Request message for MemoService.ListMemos. +type ListMemosRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Optional. The maximum number of memos to return. The service may return + // fewer. Defaults to 50; values above 1000 are coerced to 1000. + PageSize int32 `protobuf:"varint,1,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + // Optional. A page token from a previous call. Provide it to retrieve the + // next page. + PageToken string `protobuf:"bytes,2,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` + // Optional. A CEL expression to filter memos. Combine terms with && and ||. + // Available fields: + // + // content (string), creator (string, e.g. "users/1"), + // created_ts / updated_ts (timestamp), pinned (bool), + // visibility (string: PRIVATE | PROTECTED | PUBLIC | SPACE), + // space (string resource name, or null when the memo has no space; + // supports == and comparisons against null, e.g. space != null), + // tags (list; match with `"work" in tags`, not `tag == "work"`), + // has_task_list / has_link / has_code / has_incomplete_tasks (bool), + // has_location (bool; true when the memo has a location attached). + // + // Note: the time fields here are created_ts / updated_ts, which differ from + // the create_time / update_time names used by order_by. + // Examples: + // + // pinned == true && visibility == "PUBLIC" + // space == "spaces/team" or space == null + // tags.exists(t, t == "urgent") + // content.contains("roadmap") && created_ts > now - duration("168h") + Filter string `protobuf:"bytes,3,opt,name=filter,proto3" json:"filter,omitempty"` + // Optional. The order to sort results by, as a comma-separated list of + // fields following AIP-132. Defaults to "create_time desc". + // Supported fields: pinned, create_time, update_time, name. + // Example: "pinned desc, create_time desc" or "update_time asc". + // Note: order_by uses create_time / update_time, while the filter + // expression uses created_ts / updated_ts for the same timestamps. + OrderBy string `protobuf:"bytes,4,opt,name=order_by,json=orderBy,proto3" json:"order_by,omitempty"` + // Optional. Whether to include deleted memos. Currently ignored by the + // server. + ShowDeleted bool `protobuf:"varint,5,opt,name=show_deleted,json=showDeleted,proto3" json:"show_deleted,omitempty"` + // Optional. The state of the memos to list. Defaults to NORMAL. Set to + // ARCHIVED to list the caller's own archived memos. + State State `protobuf:"varint,6,opt,name=state,proto3,enum=memos.api.State" json:"state,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListMemosRequest) Reset() { + *x = ListMemosRequest{} + mi := &file_api_memo_service_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListMemosRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListMemosRequest) ProtoMessage() {} + +func (x *ListMemosRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_memo_service_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListMemosRequest.ProtoReflect.Descriptor instead. +func (*ListMemosRequest) Descriptor() ([]byte, []int) { + return file_api_memo_service_proto_rawDescGZIP(), []int{1} +} + +func (x *ListMemosRequest) GetPageSize() int32 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *ListMemosRequest) GetPageToken() string { + if x != nil { + return x.PageToken } return "" } +func (x *ListMemosRequest) GetFilter() string { + if x != nil { + return x.Filter + } + return "" +} + +func (x *ListMemosRequest) GetOrderBy() string { + if x != nil { + return x.OrderBy + } + return "" +} + +func (x *ListMemosRequest) GetShowDeleted() bool { + if x != nil { + return x.ShowDeleted + } + return false +} + +func (x *ListMemosRequest) GetState() State { + if x != nil { + return x.State + } + return State_STATE_UNSPECIFIED +} + +// Response message for MemoService.ListMemos. +type ListMemosResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The memos. + Memos []*Memo `protobuf:"bytes,1,rep,name=memos,proto3" json:"memos,omitempty"` + // A token to retrieve the next page. Empty when there are no more pages. + NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListMemosResponse) Reset() { + *x = ListMemosResponse{} + mi := &file_api_memo_service_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListMemosResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListMemosResponse) ProtoMessage() {} + +func (x *ListMemosResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_memo_service_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListMemosResponse.ProtoReflect.Descriptor instead. +func (*ListMemosResponse) Descriptor() ([]byte, []int) { + return file_api_memo_service_proto_rawDescGZIP(), []int{2} +} + +func (x *ListMemosResponse) GetMemos() []*Memo { + if x != nil { + return x.Memos + } + return nil +} + +func (x *ListMemosResponse) GetNextPageToken() string { + if x != nil { + return x.NextPageToken + } + return "" +} + +// Request message for MemoService.GetMemo. +type GetMemoRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Required. The resource name of the memo. + // Format: memos/{memo} + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetMemoRequest) Reset() { + *x = GetMemoRequest{} + mi := &file_api_memo_service_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetMemoRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetMemoRequest) ProtoMessage() {} + +func (x *GetMemoRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_memo_service_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetMemoRequest.ProtoReflect.Descriptor instead. +func (*GetMemoRequest) Descriptor() ([]byte, []int) { + return file_api_memo_service_proto_rawDescGZIP(), []int{3} +} + +func (x *GetMemoRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +// Request message for MemoService.CreateMemo. +type CreateMemoRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Required. The memo to create. + Memo *Memo `protobuf:"bytes,1,opt,name=memo,proto3" json:"memo,omitempty"` + // Optional. The ID to use for the memo, which becomes the final segment of + // its resource name. If empty, a unique ID is generated. + // Format: ^[a-zA-Z0-9]([a-zA-Z0-9-]{0,34}[a-zA-Z0-9])?$ + MemoId string `protobuf:"bytes,2,opt,name=memo_id,json=memoId,proto3" json:"memo_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateMemoRequest) Reset() { + *x = CreateMemoRequest{} + mi := &file_api_memo_service_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateMemoRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateMemoRequest) ProtoMessage() {} + +func (x *CreateMemoRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_memo_service_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateMemoRequest.ProtoReflect.Descriptor instead. +func (*CreateMemoRequest) Descriptor() ([]byte, []int) { + return file_api_memo_service_proto_rawDescGZIP(), []int{4} +} + +func (x *CreateMemoRequest) GetMemo() *Memo { + if x != nil { + return x.Memo + } + return nil +} + +func (x *CreateMemoRequest) GetMemoId() string { + if x != nil { + return x.MemoId + } + return "" +} + +// Request message for MemoService.UpdateMemo. +type UpdateMemoRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Required. The memo to update. Its name identifies the memo. + Memo *Memo `protobuf:"bytes,1,opt,name=memo,proto3" json:"memo,omitempty"` + // Required. The fields to update. Supported paths: content, visibility, + // space, pinned, state, create_time, update_time, location, attachments, + // relations. + UpdateMask *fieldmaskpb.FieldMask `protobuf:"bytes,2,opt,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UpdateMemoRequest) Reset() { + *x = UpdateMemoRequest{} + mi := &file_api_memo_service_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UpdateMemoRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateMemoRequest) ProtoMessage() {} + +func (x *UpdateMemoRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_memo_service_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateMemoRequest.ProtoReflect.Descriptor instead. +func (*UpdateMemoRequest) Descriptor() ([]byte, []int) { + return file_api_memo_service_proto_rawDescGZIP(), []int{5} +} + +func (x *UpdateMemoRequest) GetMemo() *Memo { + if x != nil { + return x.Memo + } + return nil +} + +func (x *UpdateMemoRequest) GetUpdateMask() *fieldmaskpb.FieldMask { + if x != nil { + return x.UpdateMask + } + return nil +} + +// Request message for MemoService.DeleteMemo. +type DeleteMemoRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Required. The resource name of the memo to delete. + // Format: memos/{memo} + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // Optional. Currently ignored by the server; deletion always includes the + // comment subtree. + Force bool `protobuf:"varint,2,opt,name=force,proto3" json:"force,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteMemoRequest) Reset() { + *x = DeleteMemoRequest{} + mi := &file_api_memo_service_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteMemoRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteMemoRequest) ProtoMessage() {} + +func (x *DeleteMemoRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_memo_service_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteMemoRequest.ProtoReflect.Descriptor instead. +func (*DeleteMemoRequest) Descriptor() ([]byte, []int) { + return file_api_memo_service_proto_rawDescGZIP(), []int{6} +} + +func (x *DeleteMemoRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *DeleteMemoRequest) GetForce() bool { + if x != nil { + return x.Force + } + return false +} + +// Location is a geographic location attached to a memo. type Location struct { state protoimpl.MessageState `protogen:"open.v1"` - // A placeholder text for the location. + // Optional. A human-readable label for the location. Placeholder string `protobuf:"bytes,1,opt,name=placeholder,proto3" json:"placeholder,omitempty"` - // The latitude of the location. + // Optional. The latitude of the location. Latitude float64 `protobuf:"fixed64,2,opt,name=latitude,proto3" json:"latitude,omitempty"` - // The longitude of the location. + // Optional. The longitude of the location. Longitude float64 `protobuf:"fixed64,3,opt,name=longitude,proto3" json:"longitude,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache @@ -425,7 +750,7 @@ type Location struct { func (x *Location) Reset() { *x = Location{} - mi := &file_api_v1_memo_service_proto_msgTypes[2] + mi := &file_api_memo_service_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -437,7 +762,7 @@ func (x *Location) String() string { func (*Location) ProtoMessage() {} func (x *Location) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_memo_service_proto_msgTypes[2] + mi := &file_api_memo_service_proto_msgTypes[7] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -450,7 +775,7 @@ func (x *Location) ProtoReflect() protoreflect.Message { // Deprecated: Use Location.ProtoReflect.Descriptor instead. func (*Location) Descriptor() ([]byte, []int) { - return file_api_v1_memo_service_proto_rawDescGZIP(), []int{2} + return file_api_memo_service_proto_rawDescGZIP(), []int{7} } func (x *Location) GetPlaceholder() string { @@ -474,456 +799,17 @@ func (x *Location) GetLongitude() float64 { return 0 } -type CreateMemoRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Required. The memo to create. - Memo *Memo `protobuf:"bytes,1,opt,name=memo,proto3" json:"memo,omitempty"` - // Optional. The memo ID to use for this memo. - // If empty, a unique ID will be generated. - // Format: ^[a-zA-Z0-9]([a-zA-Z0-9-]{0,34}[a-zA-Z0-9])?$ - MemoId string `protobuf:"bytes,2,opt,name=memo_id,json=memoId,proto3" json:"memo_id,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *CreateMemoRequest) Reset() { - *x = CreateMemoRequest{} - mi := &file_api_v1_memo_service_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *CreateMemoRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CreateMemoRequest) ProtoMessage() {} - -func (x *CreateMemoRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_memo_service_proto_msgTypes[3] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CreateMemoRequest.ProtoReflect.Descriptor instead. -func (*CreateMemoRequest) Descriptor() ([]byte, []int) { - return file_api_v1_memo_service_proto_rawDescGZIP(), []int{3} -} - -func (x *CreateMemoRequest) GetMemo() *Memo { - if x != nil { - return x.Memo - } - return nil -} - -func (x *CreateMemoRequest) GetMemoId() string { - if x != nil { - return x.MemoId - } - return "" -} - -type ListMemosRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Optional. The maximum number of memos to return. - // The service may return fewer than this value. - // If unspecified, at most 50 memos will be returned. - // The maximum value is 1000; values above 1000 will be coerced to 1000. - PageSize int32 `protobuf:"varint,1,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` - // Optional. A page token, received from a previous `ListMemos` call. - // Provide this to retrieve the subsequent page. - PageToken string `protobuf:"bytes,2,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` - // Optional. The state of the memos to list. - // Default to `NORMAL`. Set to `ARCHIVED` to list archived memos. - State State `protobuf:"varint,3,opt,name=state,proto3,enum=memos.api.v1.State" json:"state,omitempty"` - // Optional. The order to sort results by. - // Default to "create_time desc". - // Supports comma-separated list of fields following AIP-132. - // Example: "pinned desc, create_time desc" or "update_time asc" - // Supported fields: pinned, create_time, update_time, name. - // Note: order_by uses create_time / update_time, while the filter - // expression uses created_ts / updated_ts for the same timestamps. - OrderBy string `protobuf:"bytes,4,opt,name=order_by,json=orderBy,proto3" json:"order_by,omitempty"` - // Optional. A CEL expression to filter memos. Combine terms with && and ||. - // Available fields: - // - // content (string), creator (string, e.g. "users/1"), - // created_ts / updated_ts (timestamp), pinned (bool), - // visibility (string: PRIVATE | PROTECTED | PUBLIC | SPACE), - // space (string resource name, or null when the memo has no space; - // supports == and comparisons against null, e.g. space != null), - // tags (list; match with `"work" in tags`, not `tag == "work"`), - // has_task_list / has_link / has_code / has_incomplete_tasks (bool), - // has_location (bool; true when the memo has a location attached). - // - // Note: the time fields here are created_ts / updated_ts, which differ from - // the create_time / update_time names used by order_by. - // Examples: - // - // pinned == true && visibility == "PUBLIC" - // space == "spaces/team" or space == null - // tags.exists(t, t == "urgent") - // content.contains("roadmap") && created_ts > now - duration("168h") - Filter string `protobuf:"bytes,5,opt,name=filter,proto3" json:"filter,omitempty"` - // Optional. If true, show deleted memos in the response. - ShowDeleted bool `protobuf:"varint,6,opt,name=show_deleted,json=showDeleted,proto3" json:"show_deleted,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ListMemosRequest) Reset() { - *x = ListMemosRequest{} - mi := &file_api_v1_memo_service_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ListMemosRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ListMemosRequest) ProtoMessage() {} - -func (x *ListMemosRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_memo_service_proto_msgTypes[4] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ListMemosRequest.ProtoReflect.Descriptor instead. -func (*ListMemosRequest) Descriptor() ([]byte, []int) { - return file_api_v1_memo_service_proto_rawDescGZIP(), []int{4} -} - -func (x *ListMemosRequest) GetPageSize() int32 { - if x != nil { - return x.PageSize - } - return 0 -} - -func (x *ListMemosRequest) GetPageToken() string { - if x != nil { - return x.PageToken - } - return "" -} - -func (x *ListMemosRequest) GetState() State { - if x != nil { - return x.State - } - return State_STATE_UNSPECIFIED -} - -func (x *ListMemosRequest) GetOrderBy() string { - if x != nil { - return x.OrderBy - } - return "" -} - -func (x *ListMemosRequest) GetFilter() string { - if x != nil { - return x.Filter - } - return "" -} - -func (x *ListMemosRequest) GetShowDeleted() bool { - if x != nil { - return x.ShowDeleted - } - return false -} - -type ListMemosResponse struct { - state protoimpl.MessageState `protogen:"open.v1"` - // The list of memos. - Memos []*Memo `protobuf:"bytes,1,rep,name=memos,proto3" json:"memos,omitempty"` - // A token that can be sent as `page_token` to retrieve the next page. - // If this field is omitted, there are no subsequent pages. - NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ListMemosResponse) Reset() { - *x = ListMemosResponse{} - mi := &file_api_v1_memo_service_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ListMemosResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ListMemosResponse) ProtoMessage() {} - -func (x *ListMemosResponse) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_memo_service_proto_msgTypes[5] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ListMemosResponse.ProtoReflect.Descriptor instead. -func (*ListMemosResponse) Descriptor() ([]byte, []int) { - return file_api_v1_memo_service_proto_rawDescGZIP(), []int{5} -} - -func (x *ListMemosResponse) GetMemos() []*Memo { - if x != nil { - return x.Memos - } - return nil -} - -func (x *ListMemosResponse) GetNextPageToken() string { - if x != nil { - return x.NextPageToken - } - return "" -} - -type GetMemoRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Required. The resource name of the memo. - // Format: memos/{memo} - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *GetMemoRequest) Reset() { - *x = GetMemoRequest{} - mi := &file_api_v1_memo_service_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *GetMemoRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetMemoRequest) ProtoMessage() {} - -func (x *GetMemoRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_memo_service_proto_msgTypes[6] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetMemoRequest.ProtoReflect.Descriptor instead. -func (*GetMemoRequest) Descriptor() ([]byte, []int) { - return file_api_v1_memo_service_proto_rawDescGZIP(), []int{6} -} - -func (x *GetMemoRequest) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -type UpdateMemoRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Required. The memo to update. - // The `name` field is required. - Memo *Memo `protobuf:"bytes,1,opt,name=memo,proto3" json:"memo,omitempty"` - // Required. The list of fields to update. - UpdateMask *fieldmaskpb.FieldMask `protobuf:"bytes,2,opt,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *UpdateMemoRequest) Reset() { - *x = UpdateMemoRequest{} - mi := &file_api_v1_memo_service_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *UpdateMemoRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateMemoRequest) ProtoMessage() {} - -func (x *UpdateMemoRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_memo_service_proto_msgTypes[7] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateMemoRequest.ProtoReflect.Descriptor instead. -func (*UpdateMemoRequest) Descriptor() ([]byte, []int) { - return file_api_v1_memo_service_proto_rawDescGZIP(), []int{7} -} - -func (x *UpdateMemoRequest) GetMemo() *Memo { - if x != nil { - return x.Memo - } - return nil -} - -func (x *UpdateMemoRequest) GetUpdateMask() *fieldmaskpb.FieldMask { - if x != nil { - return x.UpdateMask - } - return nil -} - -type DeleteMemoRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Required. The resource name of the memo to delete. - // Format: memos/{memo} - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Optional. If set to true, the memo will be deleted even if it has associated data. - Force bool `protobuf:"varint,2,opt,name=force,proto3" json:"force,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *DeleteMemoRequest) Reset() { - *x = DeleteMemoRequest{} - mi := &file_api_v1_memo_service_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *DeleteMemoRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DeleteMemoRequest) ProtoMessage() {} - -func (x *DeleteMemoRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_memo_service_proto_msgTypes[8] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DeleteMemoRequest.ProtoReflect.Descriptor instead. -func (*DeleteMemoRequest) Descriptor() ([]byte, []int) { - return file_api_v1_memo_service_proto_rawDescGZIP(), []int{8} -} - -func (x *DeleteMemoRequest) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *DeleteMemoRequest) GetForce() bool { - if x != nil { - return x.Force - } - return false -} - -type SetMemoAttachmentsRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Required. The resource name of the memo. - // Format: memos/{memo} - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Required. The attachments to set for the memo. - Attachments []*Attachment `protobuf:"bytes,2,rep,name=attachments,proto3" json:"attachments,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *SetMemoAttachmentsRequest) Reset() { - *x = SetMemoAttachmentsRequest{} - mi := &file_api_v1_memo_service_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *SetMemoAttachmentsRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SetMemoAttachmentsRequest) ProtoMessage() {} - -func (x *SetMemoAttachmentsRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_memo_service_proto_msgTypes[9] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SetMemoAttachmentsRequest.ProtoReflect.Descriptor instead. -func (*SetMemoAttachmentsRequest) Descriptor() ([]byte, []int) { - return file_api_v1_memo_service_proto_rawDescGZIP(), []int{9} -} - -func (x *SetMemoAttachmentsRequest) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *SetMemoAttachmentsRequest) GetAttachments() []*Attachment { - if x != nil { - return x.Attachments - } - return nil -} - +// Request message for MemoService.ListMemoAttachments. type ListMemoAttachmentsRequest struct { state protoimpl.MessageState `protogen:"open.v1"` // Required. The resource name of the memo. // Format: memos/{memo} - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Optional. The maximum number of attachments to return. + Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"` + // Optional. The maximum number of attachments to return. The service may + // return fewer. Currently ignored; all attachments are returned. PageSize int32 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` - // Optional. A page token for pagination. + // Optional. A page token from a previous call. Provide it to retrieve the + // next page. Currently ignored. PageToken string `protobuf:"bytes,3,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache @@ -931,7 +817,7 @@ type ListMemoAttachmentsRequest struct { func (x *ListMemoAttachmentsRequest) Reset() { *x = ListMemoAttachmentsRequest{} - mi := &file_api_v1_memo_service_proto_msgTypes[10] + mi := &file_api_memo_service_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -943,7 +829,7 @@ func (x *ListMemoAttachmentsRequest) String() string { func (*ListMemoAttachmentsRequest) ProtoMessage() {} func (x *ListMemoAttachmentsRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_memo_service_proto_msgTypes[10] + mi := &file_api_memo_service_proto_msgTypes[8] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -956,12 +842,12 @@ func (x *ListMemoAttachmentsRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ListMemoAttachmentsRequest.ProtoReflect.Descriptor instead. func (*ListMemoAttachmentsRequest) Descriptor() ([]byte, []int) { - return file_api_v1_memo_service_proto_rawDescGZIP(), []int{10} + return file_api_memo_service_proto_rawDescGZIP(), []int{8} } -func (x *ListMemoAttachmentsRequest) GetName() string { +func (x *ListMemoAttachmentsRequest) GetParent() string { if x != nil { - return x.Name + return x.Parent } return "" } @@ -980,11 +866,12 @@ func (x *ListMemoAttachmentsRequest) GetPageToken() string { return "" } +// Response message for MemoService.ListMemoAttachments. type ListMemoAttachmentsResponse struct { state protoimpl.MessageState `protogen:"open.v1"` - // The list of attachments. + // The attachments. Attachments []*Attachment `protobuf:"bytes,1,rep,name=attachments,proto3" json:"attachments,omitempty"` - // A token for the next page of results. + // A token to retrieve the next page. Empty when there are no more pages. NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache @@ -992,7 +879,7 @@ type ListMemoAttachmentsResponse struct { func (x *ListMemoAttachmentsResponse) Reset() { *x = ListMemoAttachmentsResponse{} - mi := &file_api_v1_memo_service_proto_msgTypes[11] + mi := &file_api_memo_service_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1004,7 +891,7 @@ func (x *ListMemoAttachmentsResponse) String() string { func (*ListMemoAttachmentsResponse) ProtoMessage() {} func (x *ListMemoAttachmentsResponse) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_memo_service_proto_msgTypes[11] + mi := &file_api_memo_service_proto_msgTypes[9] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1017,7 +904,7 @@ func (x *ListMemoAttachmentsResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use ListMemoAttachmentsResponse.ProtoReflect.Descriptor instead. func (*ListMemoAttachmentsResponse) Descriptor() ([]byte, []int) { - return file_api_v1_memo_service_proto_rawDescGZIP(), []int{11} + return file_api_memo_service_proto_rawDescGZIP(), []int{9} } func (x *ListMemoAttachmentsResponse) GetAttachments() []*Attachment { @@ -1034,20 +921,79 @@ func (x *ListMemoAttachmentsResponse) GetNextPageToken() string { return "" } +// Request message for MemoService.SetMemoAttachments. +type SetMemoAttachmentsRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Required. The resource name of the memo. + // Format: memos/{memo} + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // Required. The complete set of attachments for the memo. + Attachments []*Attachment `protobuf:"bytes,2,rep,name=attachments,proto3" json:"attachments,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SetMemoAttachmentsRequest) Reset() { + *x = SetMemoAttachmentsRequest{} + mi := &file_api_memo_service_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SetMemoAttachmentsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SetMemoAttachmentsRequest) ProtoMessage() {} + +func (x *SetMemoAttachmentsRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_memo_service_proto_msgTypes[10] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SetMemoAttachmentsRequest.ProtoReflect.Descriptor instead. +func (*SetMemoAttachmentsRequest) Descriptor() ([]byte, []int) { + return file_api_memo_service_proto_rawDescGZIP(), []int{10} +} + +func (x *SetMemoAttachmentsRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *SetMemoAttachmentsRequest) GetAttachments() []*Attachment { + if x != nil { + return x.Attachments + } + return nil +} + +// MemoRelation is a directed link from one memo to another. type MemoRelation struct { state protoimpl.MessageState `protogen:"open.v1"` - // The memo in the relation. - Memo *MemoRelation_Memo `protobuf:"bytes,1,opt,name=memo,proto3" json:"memo,omitempty"` - // The related memo. - RelatedMemo *MemoRelation_Memo `protobuf:"bytes,2,opt,name=related_memo,json=relatedMemo,proto3" json:"related_memo,omitempty"` - Type MemoRelation_Type `protobuf:"varint,3,opt,name=type,proto3,enum=memos.api.v1.MemoRelation_Type" json:"type,omitempty"` + // Required. The source memo of the relation. For COMMENT, the comment. + Memo *MemoRelation_MemoRef `protobuf:"bytes,1,opt,name=memo,proto3" json:"memo,omitempty"` + // Required. The target memo of the relation. For COMMENT, the memo being + // commented on. + RelatedMemo *MemoRelation_MemoRef `protobuf:"bytes,2,opt,name=related_memo,json=relatedMemo,proto3" json:"related_memo,omitempty"` + // Required. The type of the relation. + Type MemoRelation_Type `protobuf:"varint,3,opt,name=type,proto3,enum=memos.api.MemoRelation_Type" json:"type,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } func (x *MemoRelation) Reset() { *x = MemoRelation{} - mi := &file_api_v1_memo_service_proto_msgTypes[12] + mi := &file_api_memo_service_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1059,7 +1005,7 @@ func (x *MemoRelation) String() string { func (*MemoRelation) ProtoMessage() {} func (x *MemoRelation) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_memo_service_proto_msgTypes[12] + mi := &file_api_memo_service_proto_msgTypes[11] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1072,17 +1018,17 @@ func (x *MemoRelation) ProtoReflect() protoreflect.Message { // Deprecated: Use MemoRelation.ProtoReflect.Descriptor instead. func (*MemoRelation) Descriptor() ([]byte, []int) { - return file_api_v1_memo_service_proto_rawDescGZIP(), []int{12} + return file_api_memo_service_proto_rawDescGZIP(), []int{11} } -func (x *MemoRelation) GetMemo() *MemoRelation_Memo { +func (x *MemoRelation) GetMemo() *MemoRelation_MemoRef { if x != nil { return x.Memo } return nil } -func (x *MemoRelation) GetRelatedMemo() *MemoRelation_Memo { +func (x *MemoRelation) GetRelatedMemo() *MemoRelation_MemoRef { if x != nil { return x.RelatedMemo } @@ -1096,69 +1042,17 @@ func (x *MemoRelation) GetType() MemoRelation_Type { return MemoRelation_TYPE_UNSPECIFIED } -type SetMemoRelationsRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Required. The resource name of the memo. - // Format: memos/{memo} - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Required. The REFERENCE relations to set for the memo. COMMENT is invalid. - Relations []*MemoRelation `protobuf:"bytes,2,rep,name=relations,proto3" json:"relations,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *SetMemoRelationsRequest) Reset() { - *x = SetMemoRelationsRequest{} - mi := &file_api_v1_memo_service_proto_msgTypes[13] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *SetMemoRelationsRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SetMemoRelationsRequest) ProtoMessage() {} - -func (x *SetMemoRelationsRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_memo_service_proto_msgTypes[13] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SetMemoRelationsRequest.ProtoReflect.Descriptor instead. -func (*SetMemoRelationsRequest) Descriptor() ([]byte, []int) { - return file_api_v1_memo_service_proto_rawDescGZIP(), []int{13} -} - -func (x *SetMemoRelationsRequest) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *SetMemoRelationsRequest) GetRelations() []*MemoRelation { - if x != nil { - return x.Relations - } - return nil -} - +// Request message for MemoService.ListMemoRelations. type ListMemoRelationsRequest struct { state protoimpl.MessageState `protogen:"open.v1"` // Required. The resource name of the memo. // Format: memos/{memo} - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Optional. The maximum number of relations to return. + Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"` + // Optional. The maximum number of relations to return. The service may + // return fewer. Defaults to 50; values above 1000 are coerced to 1000. PageSize int32 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` - // Optional. A page token for pagination. + // Optional. A page token from a previous call. Provide it to retrieve the + // next page. PageToken string `protobuf:"bytes,3,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache @@ -1166,7 +1060,7 @@ type ListMemoRelationsRequest struct { func (x *ListMemoRelationsRequest) Reset() { *x = ListMemoRelationsRequest{} - mi := &file_api_v1_memo_service_proto_msgTypes[14] + mi := &file_api_memo_service_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1178,7 +1072,7 @@ func (x *ListMemoRelationsRequest) String() string { func (*ListMemoRelationsRequest) ProtoMessage() {} func (x *ListMemoRelationsRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_memo_service_proto_msgTypes[14] + mi := &file_api_memo_service_proto_msgTypes[12] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1191,12 +1085,12 @@ func (x *ListMemoRelationsRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ListMemoRelationsRequest.ProtoReflect.Descriptor instead. func (*ListMemoRelationsRequest) Descriptor() ([]byte, []int) { - return file_api_v1_memo_service_proto_rawDescGZIP(), []int{14} + return file_api_memo_service_proto_rawDescGZIP(), []int{12} } -func (x *ListMemoRelationsRequest) GetName() string { +func (x *ListMemoRelationsRequest) GetParent() string { if x != nil { - return x.Name + return x.Parent } return "" } @@ -1215,11 +1109,12 @@ func (x *ListMemoRelationsRequest) GetPageToken() string { return "" } +// Response message for MemoService.ListMemoRelations. type ListMemoRelationsResponse struct { state protoimpl.MessageState `protogen:"open.v1"` - // The list of relations. + // The relations. Relations []*MemoRelation `protobuf:"bytes,1,rep,name=relations,proto3" json:"relations,omitempty"` - // A token for the next page of results. + // A token to retrieve the next page. Empty when there are no more pages. NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache @@ -1227,7 +1122,7 @@ type ListMemoRelationsResponse struct { func (x *ListMemoRelationsResponse) Reset() { *x = ListMemoRelationsResponse{} - mi := &file_api_v1_memo_service_proto_msgTypes[15] + mi := &file_api_memo_service_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1239,7 +1134,7 @@ func (x *ListMemoRelationsResponse) String() string { func (*ListMemoRelationsResponse) ProtoMessage() {} func (x *ListMemoRelationsResponse) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_memo_service_proto_msgTypes[15] + mi := &file_api_memo_service_proto_msgTypes[13] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1252,7 +1147,7 @@ func (x *ListMemoRelationsResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use ListMemoRelationsResponse.ProtoReflect.Descriptor instead. func (*ListMemoRelationsResponse) Descriptor() ([]byte, []int) { - return file_api_v1_memo_service_proto_rawDescGZIP(), []int{15} + return file_api_memo_service_proto_rawDescGZIP(), []int{13} } func (x *ListMemoRelationsResponse) GetRelations() []*MemoRelation { @@ -1269,34 +1164,34 @@ func (x *ListMemoRelationsResponse) GetNextPageToken() string { return "" } -type CreateMemoCommentRequest struct { +// Request message for MemoService.SetMemoRelations. +type SetMemoRelationsRequest struct { state protoimpl.MessageState `protogen:"open.v1"` // Required. The resource name of the memo. // Format: memos/{memo} Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Required. The comment to create. - Comment *Memo `protobuf:"bytes,2,opt,name=comment,proto3" json:"comment,omitempty"` - // Optional. The comment ID to use. - CommentId string `protobuf:"bytes,3,opt,name=comment_id,json=commentId,proto3" json:"comment_id,omitempty"` + // Required. The complete set of REFERENCE relations for the memo. COMMENT + // relations are rejected. + Relations []*MemoRelation `protobuf:"bytes,2,rep,name=relations,proto3" json:"relations,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } -func (x *CreateMemoCommentRequest) Reset() { - *x = CreateMemoCommentRequest{} - mi := &file_api_v1_memo_service_proto_msgTypes[16] +func (x *SetMemoRelationsRequest) Reset() { + *x = SetMemoRelationsRequest{} + mi := &file_api_memo_service_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } -func (x *CreateMemoCommentRequest) String() string { +func (x *SetMemoRelationsRequest) String() string { return protoimpl.X.MessageStringOf(x) } -func (*CreateMemoCommentRequest) ProtoMessage() {} +func (*SetMemoRelationsRequest) ProtoMessage() {} -func (x *CreateMemoCommentRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_memo_service_proto_msgTypes[16] +func (x *SetMemoRelationsRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_memo_service_proto_msgTypes[14] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1307,42 +1202,38 @@ func (x *CreateMemoCommentRequest) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use CreateMemoCommentRequest.ProtoReflect.Descriptor instead. -func (*CreateMemoCommentRequest) Descriptor() ([]byte, []int) { - return file_api_v1_memo_service_proto_rawDescGZIP(), []int{16} +// Deprecated: Use SetMemoRelationsRequest.ProtoReflect.Descriptor instead. +func (*SetMemoRelationsRequest) Descriptor() ([]byte, []int) { + return file_api_memo_service_proto_rawDescGZIP(), []int{14} } -func (x *CreateMemoCommentRequest) GetName() string { +func (x *SetMemoRelationsRequest) GetName() string { if x != nil { return x.Name } return "" } -func (x *CreateMemoCommentRequest) GetComment() *Memo { +func (x *SetMemoRelationsRequest) GetRelations() []*MemoRelation { if x != nil { - return x.Comment + return x.Relations } return nil } -func (x *CreateMemoCommentRequest) GetCommentId() string { - if x != nil { - return x.CommentId - } - return "" -} - +// Request message for MemoService.ListMemoComments. type ListMemoCommentsRequest struct { state protoimpl.MessageState `protogen:"open.v1"` // Required. The resource name of the memo. // Format: memos/{memo} - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Optional. The maximum number of comments to return. + Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"` + // Optional. The maximum number of comments to return. The service may return + // fewer. Defaults to 50; values above 1000 are coerced to 1000. PageSize int32 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` - // Optional. A page token for pagination. + // Optional. A page token from a previous call. Provide it to retrieve the + // next page. PageToken string `protobuf:"bytes,3,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` - // Optional. The order to sort results by. + // Optional. The order to sort results by. Currently ignored by the server. OrderBy string `protobuf:"bytes,4,opt,name=order_by,json=orderBy,proto3" json:"order_by,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache @@ -1350,7 +1241,7 @@ type ListMemoCommentsRequest struct { func (x *ListMemoCommentsRequest) Reset() { *x = ListMemoCommentsRequest{} - mi := &file_api_v1_memo_service_proto_msgTypes[17] + mi := &file_api_memo_service_proto_msgTypes[15] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1362,7 +1253,7 @@ func (x *ListMemoCommentsRequest) String() string { func (*ListMemoCommentsRequest) ProtoMessage() {} func (x *ListMemoCommentsRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_memo_service_proto_msgTypes[17] + mi := &file_api_memo_service_proto_msgTypes[15] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1375,12 +1266,12 @@ func (x *ListMemoCommentsRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ListMemoCommentsRequest.ProtoReflect.Descriptor instead. func (*ListMemoCommentsRequest) Descriptor() ([]byte, []int) { - return file_api_v1_memo_service_proto_rawDescGZIP(), []int{17} + return file_api_memo_service_proto_rawDescGZIP(), []int{15} } -func (x *ListMemoCommentsRequest) GetName() string { +func (x *ListMemoCommentsRequest) GetParent() string { if x != nil { - return x.Name + return x.Parent } return "" } @@ -1406,11 +1297,12 @@ func (x *ListMemoCommentsRequest) GetOrderBy() string { return "" } +// Response message for MemoService.ListMemoComments. type ListMemoCommentsResponse struct { state protoimpl.MessageState `protogen:"open.v1"` - // The list of comment memos. - Memos []*Memo `protobuf:"bytes,1,rep,name=memos,proto3" json:"memos,omitempty"` - // A token for the next page of results. + // The comment memos. + Comments []*Memo `protobuf:"bytes,1,rep,name=comments,proto3" json:"comments,omitempty"` + // A token to retrieve the next page. Empty when there are no more pages. NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache @@ -1418,7 +1310,7 @@ type ListMemoCommentsResponse struct { func (x *ListMemoCommentsResponse) Reset() { *x = ListMemoCommentsResponse{} - mi := &file_api_v1_memo_service_proto_msgTypes[18] + mi := &file_api_memo_service_proto_msgTypes[16] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1430,7 +1322,7 @@ func (x *ListMemoCommentsResponse) String() string { func (*ListMemoCommentsResponse) ProtoMessage() {} func (x *ListMemoCommentsResponse) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_memo_service_proto_msgTypes[18] + mi := &file_api_memo_service_proto_msgTypes[16] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1443,12 +1335,12 @@ func (x *ListMemoCommentsResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use ListMemoCommentsResponse.ProtoReflect.Descriptor instead. func (*ListMemoCommentsResponse) Descriptor() ([]byte, []int) { - return file_api_v1_memo_service_proto_rawDescGZIP(), []int{18} + return file_api_memo_service_proto_rawDescGZIP(), []int{16} } -func (x *ListMemoCommentsResponse) GetMemos() []*Memo { +func (x *ListMemoCommentsResponse) GetComments() []*Memo { if x != nil { - return x.Memos + return x.Comments } return nil } @@ -1460,14 +1352,158 @@ func (x *ListMemoCommentsResponse) GetNextPageToken() string { return "" } +// Request message for MemoService.CreateMemoComment. +type CreateMemoCommentRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Required. The resource name of the memo to comment on. + // Format: memos/{memo} + Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"` + // Required. The comment memo to create. + Comment *Memo `protobuf:"bytes,2,opt,name=comment,proto3" json:"comment,omitempty"` + // Optional. The ID to use for the comment memo, in the same format as + // CreateMemoRequest.memo_id. If empty, a unique ID is generated. + CommentId string `protobuf:"bytes,3,opt,name=comment_id,json=commentId,proto3" json:"comment_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateMemoCommentRequest) Reset() { + *x = CreateMemoCommentRequest{} + mi := &file_api_memo_service_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateMemoCommentRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateMemoCommentRequest) ProtoMessage() {} + +func (x *CreateMemoCommentRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_memo_service_proto_msgTypes[17] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateMemoCommentRequest.ProtoReflect.Descriptor instead. +func (*CreateMemoCommentRequest) Descriptor() ([]byte, []int) { + return file_api_memo_service_proto_rawDescGZIP(), []int{17} +} + +func (x *CreateMemoCommentRequest) GetParent() string { + if x != nil { + return x.Parent + } + return "" +} + +func (x *CreateMemoCommentRequest) GetComment() *Memo { + if x != nil { + return x.Comment + } + return nil +} + +func (x *CreateMemoCommentRequest) GetCommentId() string { + if x != nil { + return x.CommentId + } + return "" +} + +// Reaction is a reaction a user leaves on a memo. +type Reaction struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Identifier. The resource name of the reaction. + // Format: memos/{memo}/reactions/{reaction} + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // Output only. The resource name of the creator. + // Format: users/{user} + Creator string `protobuf:"bytes,2,opt,name=creator,proto3" json:"creator,omitempty"` + // Required. The reaction, such as an emoji ("👍", "❤️", "😄"). + ReactionType string `protobuf:"bytes,3,opt,name=reaction_type,json=reactionType,proto3" json:"reaction_type,omitempty"` + // Output only. The creation time. + CreateTime *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Reaction) Reset() { + *x = Reaction{} + mi := &file_api_memo_service_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Reaction) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Reaction) ProtoMessage() {} + +func (x *Reaction) ProtoReflect() protoreflect.Message { + mi := &file_api_memo_service_proto_msgTypes[18] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Reaction.ProtoReflect.Descriptor instead. +func (*Reaction) Descriptor() ([]byte, []int) { + return file_api_memo_service_proto_rawDescGZIP(), []int{18} +} + +func (x *Reaction) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Reaction) GetCreator() string { + if x != nil { + return x.Creator + } + return "" +} + +func (x *Reaction) GetReactionType() string { + if x != nil { + return x.ReactionType + } + return "" +} + +func (x *Reaction) GetCreateTime() *timestamppb.Timestamp { + if x != nil { + return x.CreateTime + } + return nil +} + +// Request message for MemoService.ListMemoReactions. type ListMemoReactionsRequest struct { state protoimpl.MessageState `protogen:"open.v1"` // Required. The resource name of the memo. // Format: memos/{memo} - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Optional. The maximum number of reactions to return. + Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"` + // Optional. The maximum number of reactions to return. The service may + // return fewer. Currently ignored; all reactions are returned. PageSize int32 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` - // Optional. A page token for pagination. + // Optional. A page token from a previous call. Provide it to retrieve the + // next page. Currently ignored. PageToken string `protobuf:"bytes,3,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache @@ -1475,7 +1511,7 @@ type ListMemoReactionsRequest struct { func (x *ListMemoReactionsRequest) Reset() { *x = ListMemoReactionsRequest{} - mi := &file_api_v1_memo_service_proto_msgTypes[19] + mi := &file_api_memo_service_proto_msgTypes[19] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1487,7 +1523,7 @@ func (x *ListMemoReactionsRequest) String() string { func (*ListMemoReactionsRequest) ProtoMessage() {} func (x *ListMemoReactionsRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_memo_service_proto_msgTypes[19] + mi := &file_api_memo_service_proto_msgTypes[19] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1500,12 +1536,12 @@ func (x *ListMemoReactionsRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ListMemoReactionsRequest.ProtoReflect.Descriptor instead. func (*ListMemoReactionsRequest) Descriptor() ([]byte, []int) { - return file_api_v1_memo_service_proto_rawDescGZIP(), []int{19} + return file_api_memo_service_proto_rawDescGZIP(), []int{19} } -func (x *ListMemoReactionsRequest) GetName() string { +func (x *ListMemoReactionsRequest) GetParent() string { if x != nil { - return x.Name + return x.Parent } return "" } @@ -1524,11 +1560,12 @@ func (x *ListMemoReactionsRequest) GetPageToken() string { return "" } +// Response message for MemoService.ListMemoReactions. type ListMemoReactionsResponse struct { state protoimpl.MessageState `protogen:"open.v1"` - // The list of reactions. + // The reactions. Reactions []*Reaction `protobuf:"bytes,1,rep,name=reactions,proto3" json:"reactions,omitempty"` - // A token for the next page of results. + // A token to retrieve the next page. Empty when there are no more pages. NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache @@ -1536,7 +1573,7 @@ type ListMemoReactionsResponse struct { func (x *ListMemoReactionsResponse) Reset() { *x = ListMemoReactionsResponse{} - mi := &file_api_v1_memo_service_proto_msgTypes[20] + mi := &file_api_memo_service_proto_msgTypes[20] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1548,7 +1585,7 @@ func (x *ListMemoReactionsResponse) String() string { func (*ListMemoReactionsResponse) ProtoMessage() {} func (x *ListMemoReactionsResponse) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_memo_service_proto_msgTypes[20] + mi := &file_api_memo_service_proto_msgTypes[20] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1561,7 +1598,7 @@ func (x *ListMemoReactionsResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use ListMemoReactionsResponse.ProtoReflect.Descriptor instead. func (*ListMemoReactionsResponse) Descriptor() ([]byte, []int) { - return file_api_v1_memo_service_proto_rawDescGZIP(), []int{20} + return file_api_memo_service_proto_rawDescGZIP(), []int{20} } func (x *ListMemoReactionsResponse) GetReactions() []*Reaction { @@ -1578,61 +1615,7 @@ func (x *ListMemoReactionsResponse) GetNextPageToken() string { return "" } -type UpsertMemoReactionRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Required. The resource name of the memo. - // Format: memos/{memo} - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Required. The reaction to upsert. - Reaction *Reaction `protobuf:"bytes,2,opt,name=reaction,proto3" json:"reaction,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *UpsertMemoReactionRequest) Reset() { - *x = UpsertMemoReactionRequest{} - mi := &file_api_v1_memo_service_proto_msgTypes[21] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *UpsertMemoReactionRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpsertMemoReactionRequest) ProtoMessage() {} - -func (x *UpsertMemoReactionRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_memo_service_proto_msgTypes[21] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpsertMemoReactionRequest.ProtoReflect.Descriptor instead. -func (*UpsertMemoReactionRequest) Descriptor() ([]byte, []int) { - return file_api_v1_memo_service_proto_rawDescGZIP(), []int{21} -} - -func (x *UpsertMemoReactionRequest) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *UpsertMemoReactionRequest) GetReaction() *Reaction { - if x != nil { - return x.Reaction - } - return nil -} - +// Request message for MemoService.DeleteMemoReaction. type DeleteMemoReactionRequest struct { state protoimpl.MessageState `protogen:"open.v1"` // Required. The resource name of the reaction to delete. @@ -1644,7 +1627,7 @@ type DeleteMemoReactionRequest struct { func (x *DeleteMemoReactionRequest) Reset() { *x = DeleteMemoReactionRequest{} - mi := &file_api_v1_memo_service_proto_msgTypes[22] + mi := &file_api_memo_service_proto_msgTypes[21] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1656,7 +1639,7 @@ func (x *DeleteMemoReactionRequest) String() string { func (*DeleteMemoReactionRequest) ProtoMessage() {} func (x *DeleteMemoReactionRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_memo_service_proto_msgTypes[22] + mi := &file_api_memo_service_proto_msgTypes[21] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1669,7 +1652,7 @@ func (x *DeleteMemoReactionRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use DeleteMemoReactionRequest.ProtoReflect.Descriptor instead. func (*DeleteMemoReactionRequest) Descriptor() ([]byte, []int) { - return file_api_v1_memo_service_proto_rawDescGZIP(), []int{22} + return file_api_memo_service_proto_rawDescGZIP(), []int{21} } func (x *DeleteMemoReactionRequest) GetName() string { @@ -1679,16 +1662,74 @@ func (x *DeleteMemoReactionRequest) GetName() string { return "" } -// MemoShare is an access grant that permits read-only access to a memo via an opaque bearer token. +// Request message for MemoService.UpsertMemoReaction. +type UpsertMemoReactionRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Required. The resource name of the memo. + // Format: memos/{memo} + Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"` + // Required. The reaction to upsert. Only reaction_type is used. + Reaction *Reaction `protobuf:"bytes,2,opt,name=reaction,proto3" json:"reaction,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UpsertMemoReactionRequest) Reset() { + *x = UpsertMemoReactionRequest{} + mi := &file_api_memo_service_proto_msgTypes[22] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UpsertMemoReactionRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpsertMemoReactionRequest) ProtoMessage() {} + +func (x *UpsertMemoReactionRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_memo_service_proto_msgTypes[22] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpsertMemoReactionRequest.ProtoReflect.Descriptor instead. +func (*UpsertMemoReactionRequest) Descriptor() ([]byte, []int) { + return file_api_memo_service_proto_rawDescGZIP(), []int{22} +} + +func (x *UpsertMemoReactionRequest) GetParent() string { + if x != nil { + return x.Parent + } + return "" +} + +func (x *UpsertMemoReactionRequest) GetReaction() *Reaction { + if x != nil { + return x.Reaction + } + return nil +} + +// MemoShare is an access grant that permits read-only access to a memo via an +// opaque bearer token. type MemoShare struct { state protoimpl.MessageState `protogen:"open.v1"` - // The resource name of the share. Format: memos/{memo}/shares/{share} - // The {share} segment is the opaque token used in the share URL. + // Identifier. The resource name of the share. The {share} segment is the + // opaque token used in the share URL. + // Format: memos/{memo}/shares/{share} Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Output only. When this share link was created. + // Output only. The creation time. CreateTime *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty"` - // Optional. When set, the share link stops working after this time. - // If unset, the link never expires. + // Optional. The time after which the share link stops working. Must be in + // the future when set. If unset, the link never expires. ExpireTime *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=expire_time,json=expireTime,proto3,oneof" json:"expire_time,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache @@ -1696,7 +1737,7 @@ type MemoShare struct { func (x *MemoShare) Reset() { *x = MemoShare{} - mi := &file_api_v1_memo_service_proto_msgTypes[23] + mi := &file_api_memo_service_proto_msgTypes[23] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1708,7 +1749,7 @@ func (x *MemoShare) String() string { func (*MemoShare) ProtoMessage() {} func (x *MemoShare) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_memo_service_proto_msgTypes[23] + mi := &file_api_memo_service_proto_msgTypes[23] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1721,7 +1762,7 @@ func (x *MemoShare) ProtoReflect() protoreflect.Message { // Deprecated: Use MemoShare.ProtoReflect.Descriptor instead. func (*MemoShare) Descriptor() ([]byte, []int) { - return file_api_v1_memo_service_proto_rawDescGZIP(), []int{23} + return file_api_memo_service_proto_rawDescGZIP(), []int{23} } func (x *MemoShare) GetName() string { @@ -1745,12 +1786,106 @@ func (x *MemoShare) GetExpireTime() *timestamppb.Timestamp { return nil } +// Request message for MemoService.ListMemoShares. +type ListMemoSharesRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Required. The resource name of the memo. + // Format: memos/{memo} + Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListMemoSharesRequest) Reset() { + *x = ListMemoSharesRequest{} + mi := &file_api_memo_service_proto_msgTypes[24] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListMemoSharesRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListMemoSharesRequest) ProtoMessage() {} + +func (x *ListMemoSharesRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_memo_service_proto_msgTypes[24] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListMemoSharesRequest.ProtoReflect.Descriptor instead. +func (*ListMemoSharesRequest) Descriptor() ([]byte, []int) { + return file_api_memo_service_proto_rawDescGZIP(), []int{24} +} + +func (x *ListMemoSharesRequest) GetParent() string { + if x != nil { + return x.Parent + } + return "" +} + +// Response message for MemoService.ListMemoShares. +type ListMemoSharesResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The share links. + MemoShares []*MemoShare `protobuf:"bytes,1,rep,name=memo_shares,json=memoShares,proto3" json:"memo_shares,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListMemoSharesResponse) Reset() { + *x = ListMemoSharesResponse{} + mi := &file_api_memo_service_proto_msgTypes[25] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListMemoSharesResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListMemoSharesResponse) ProtoMessage() {} + +func (x *ListMemoSharesResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_memo_service_proto_msgTypes[25] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListMemoSharesResponse.ProtoReflect.Descriptor instead. +func (*ListMemoSharesResponse) Descriptor() ([]byte, []int) { + return file_api_memo_service_proto_rawDescGZIP(), []int{25} +} + +func (x *ListMemoSharesResponse) GetMemoShares() []*MemoShare { + if x != nil { + return x.MemoShares + } + return nil +} + +// Request message for MemoService.CreateMemoShare. type CreateMemoShareRequest struct { state protoimpl.MessageState `protogen:"open.v1"` // Required. The resource name of the memo to share. // Format: memos/{memo} Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"` - // Required. The share to create. + // Required. The share to create. Only expire_time is used. MemoShare *MemoShare `protobuf:"bytes,2,opt,name=memo_share,json=memoShare,proto3" json:"memo_share,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache @@ -1758,7 +1893,7 @@ type CreateMemoShareRequest struct { func (x *CreateMemoShareRequest) Reset() { *x = CreateMemoShareRequest{} - mi := &file_api_v1_memo_service_proto_msgTypes[24] + mi := &file_api_memo_service_proto_msgTypes[26] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1770,7 +1905,7 @@ func (x *CreateMemoShareRequest) String() string { func (*CreateMemoShareRequest) ProtoMessage() {} func (x *CreateMemoShareRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_memo_service_proto_msgTypes[24] + mi := &file_api_memo_service_proto_msgTypes[26] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1783,7 +1918,7 @@ func (x *CreateMemoShareRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use CreateMemoShareRequest.ProtoReflect.Descriptor instead. func (*CreateMemoShareRequest) Descriptor() ([]byte, []int) { - return file_api_v1_memo_service_proto_rawDescGZIP(), []int{24} + return file_api_memo_service_proto_rawDescGZIP(), []int{26} } func (x *CreateMemoShareRequest) GetParent() string { @@ -1800,97 +1935,7 @@ func (x *CreateMemoShareRequest) GetMemoShare() *MemoShare { return nil } -type ListMemoSharesRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Required. The resource name of the memo. - // Format: memos/{memo} - Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ListMemoSharesRequest) Reset() { - *x = ListMemoSharesRequest{} - mi := &file_api_v1_memo_service_proto_msgTypes[25] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ListMemoSharesRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ListMemoSharesRequest) ProtoMessage() {} - -func (x *ListMemoSharesRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_memo_service_proto_msgTypes[25] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ListMemoSharesRequest.ProtoReflect.Descriptor instead. -func (*ListMemoSharesRequest) Descriptor() ([]byte, []int) { - return file_api_v1_memo_service_proto_rawDescGZIP(), []int{25} -} - -func (x *ListMemoSharesRequest) GetParent() string { - if x != nil { - return x.Parent - } - return "" -} - -type ListMemoSharesResponse struct { - state protoimpl.MessageState `protogen:"open.v1"` - // The list of share links. - MemoShares []*MemoShare `protobuf:"bytes,1,rep,name=memo_shares,json=memoShares,proto3" json:"memo_shares,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ListMemoSharesResponse) Reset() { - *x = ListMemoSharesResponse{} - mi := &file_api_v1_memo_service_proto_msgTypes[26] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ListMemoSharesResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ListMemoSharesResponse) ProtoMessage() {} - -func (x *ListMemoSharesResponse) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_memo_service_proto_msgTypes[26] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ListMemoSharesResponse.ProtoReflect.Descriptor instead. -func (*ListMemoSharesResponse) Descriptor() ([]byte, []int) { - return file_api_v1_memo_service_proto_rawDescGZIP(), []int{26} -} - -func (x *ListMemoSharesResponse) GetMemoShares() []*MemoShare { - if x != nil { - return x.MemoShares - } - return nil -} - +// Request message for MemoService.DeleteMemoShare. type DeleteMemoShareRequest struct { state protoimpl.MessageState `protogen:"open.v1"` // Required. The resource name of the share to delete. @@ -1902,7 +1947,7 @@ type DeleteMemoShareRequest struct { func (x *DeleteMemoShareRequest) Reset() { *x = DeleteMemoShareRequest{} - mi := &file_api_v1_memo_service_proto_msgTypes[27] + mi := &file_api_memo_service_proto_msgTypes[27] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1914,7 +1959,7 @@ func (x *DeleteMemoShareRequest) String() string { func (*DeleteMemoShareRequest) ProtoMessage() {} func (x *DeleteMemoShareRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_memo_service_proto_msgTypes[27] + mi := &file_api_memo_service_proto_msgTypes[27] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1927,7 +1972,7 @@ func (x *DeleteMemoShareRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use DeleteMemoShareRequest.ProtoReflect.Descriptor instead. func (*DeleteMemoShareRequest) Descriptor() ([]byte, []int) { - return file_api_v1_memo_service_proto_rawDescGZIP(), []int{27} + return file_api_memo_service_proto_rawDescGZIP(), []int{27} } func (x *DeleteMemoShareRequest) GetName() string { @@ -1937,9 +1982,10 @@ func (x *DeleteMemoShareRequest) GetName() string { return "" } +// Request message for MemoService.GetSharedMemo. type GetSharedMemoRequest struct { state protoimpl.MessageState `protogen:"open.v1"` - // Required. The opaque bearer token extracted from the share URL. + // Required. The opaque bearer token from the share URL. ShareToken string `protobuf:"bytes,1,opt,name=share_token,json=shareToken,proto3" json:"share_token,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache @@ -1947,7 +1993,7 @@ type GetSharedMemoRequest struct { func (x *GetSharedMemoRequest) Reset() { *x = GetSharedMemoRequest{} - mi := &file_api_v1_memo_service_proto_msgTypes[28] + mi := &file_api_memo_service_proto_msgTypes[28] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1959,7 +2005,7 @@ func (x *GetSharedMemoRequest) String() string { func (*GetSharedMemoRequest) ProtoMessage() {} func (x *GetSharedMemoRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_memo_service_proto_msgTypes[28] + mi := &file_api_memo_service_proto_msgTypes[28] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1972,7 +2018,7 @@ func (x *GetSharedMemoRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetSharedMemoRequest.ProtoReflect.Descriptor instead. func (*GetSharedMemoRequest) Descriptor() ([]byte, []int) { - return file_api_v1_memo_service_proto_rawDescGZIP(), []int{28} + return file_api_memo_service_proto_rawDescGZIP(), []int{28} } func (x *GetSharedMemoRequest) GetShareToken() string { @@ -1982,150 +2028,16 @@ func (x *GetSharedMemoRequest) GetShareToken() string { return "" } -type GetLinkMetadataRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Required. The link URL. - Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *GetLinkMetadataRequest) Reset() { - *x = GetLinkMetadataRequest{} - mi := &file_api_v1_memo_service_proto_msgTypes[29] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *GetLinkMetadataRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetLinkMetadataRequest) ProtoMessage() {} - -func (x *GetLinkMetadataRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_memo_service_proto_msgTypes[29] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetLinkMetadataRequest.ProtoReflect.Descriptor instead. -func (*GetLinkMetadataRequest) Descriptor() ([]byte, []int) { - return file_api_v1_memo_service_proto_rawDescGZIP(), []int{29} -} - -func (x *GetLinkMetadataRequest) GetUrl() string { - if x != nil { - return x.Url - } - return "" -} - -type BatchGetLinkMetadataRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Required. The link URLs. - Urls []string `protobuf:"bytes,1,rep,name=urls,proto3" json:"urls,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *BatchGetLinkMetadataRequest) Reset() { - *x = BatchGetLinkMetadataRequest{} - mi := &file_api_v1_memo_service_proto_msgTypes[30] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *BatchGetLinkMetadataRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*BatchGetLinkMetadataRequest) ProtoMessage() {} - -func (x *BatchGetLinkMetadataRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_memo_service_proto_msgTypes[30] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use BatchGetLinkMetadataRequest.ProtoReflect.Descriptor instead. -func (*BatchGetLinkMetadataRequest) Descriptor() ([]byte, []int) { - return file_api_v1_memo_service_proto_rawDescGZIP(), []int{30} -} - -func (x *BatchGetLinkMetadataRequest) GetUrls() []string { - if x != nil { - return x.Urls - } - return nil -} - -type BatchGetLinkMetadataResponse struct { - state protoimpl.MessageState `protogen:"open.v1"` - // The link metadata list, in the same order as the input URLs. - LinkMetadata []*LinkMetadata `protobuf:"bytes,1,rep,name=link_metadata,json=linkMetadata,proto3" json:"link_metadata,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *BatchGetLinkMetadataResponse) Reset() { - *x = BatchGetLinkMetadataResponse{} - mi := &file_api_v1_memo_service_proto_msgTypes[31] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *BatchGetLinkMetadataResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*BatchGetLinkMetadataResponse) ProtoMessage() {} - -func (x *BatchGetLinkMetadataResponse) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_memo_service_proto_msgTypes[31] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use BatchGetLinkMetadataResponse.ProtoReflect.Descriptor instead. -func (*BatchGetLinkMetadataResponse) Descriptor() ([]byte, []int) { - return file_api_v1_memo_service_proto_rawDescGZIP(), []int{31} -} - -func (x *BatchGetLinkMetadataResponse) GetLinkMetadata() []*LinkMetadata { - if x != nil { - return x.LinkMetadata - } - return nil -} - +// LinkMetadata is the preview metadata of a web link. type LinkMetadata struct { state protoimpl.MessageState `protogen:"open.v1"` - // The original link URL. + // The link URL as given in the request. Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"` - // The link title. + // The page title. Title string `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"` - // The link description. + // The page description. Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` - // The link image URL. + // The preview image URL. Image string `protobuf:"bytes,4,opt,name=image,proto3" json:"image,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache @@ -2133,7 +2045,7 @@ type LinkMetadata struct { func (x *LinkMetadata) Reset() { *x = LinkMetadata{} - mi := &file_api_v1_memo_service_proto_msgTypes[32] + mi := &file_api_memo_service_proto_msgTypes[29] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2145,7 +2057,7 @@ func (x *LinkMetadata) String() string { func (*LinkMetadata) ProtoMessage() {} func (x *LinkMetadata) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_memo_service_proto_msgTypes[32] + mi := &file_api_memo_service_proto_msgTypes[29] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2158,7 +2070,7 @@ func (x *LinkMetadata) ProtoReflect() protoreflect.Message { // Deprecated: Use LinkMetadata.ProtoReflect.Descriptor instead. func (*LinkMetadata) Descriptor() ([]byte, []int) { - return file_api_v1_memo_service_proto_rawDescGZIP(), []int{32} + return file_api_memo_service_proto_rawDescGZIP(), []int{29} } func (x *LinkMetadata) GetUrl() string { @@ -2189,22 +2101,164 @@ func (x *LinkMetadata) GetImage() string { return "" } -// Computed properties of a memo. -type Memo_Property struct { - state protoimpl.MessageState `protogen:"open.v1"` - HasLink bool `protobuf:"varint,1,opt,name=has_link,json=hasLink,proto3" json:"has_link,omitempty"` - HasTaskList bool `protobuf:"varint,2,opt,name=has_task_list,json=hasTaskList,proto3" json:"has_task_list,omitempty"` - HasCode bool `protobuf:"varint,3,opt,name=has_code,json=hasCode,proto3" json:"has_code,omitempty"` - HasIncompleteTasks bool `protobuf:"varint,4,opt,name=has_incomplete_tasks,json=hasIncompleteTasks,proto3" json:"has_incomplete_tasks,omitempty"` - // The title extracted from the first H1 heading, if present. - Title string `protobuf:"bytes,5,opt,name=title,proto3" json:"title,omitempty"` +// Request message for MemoService.GetLinkMetadata. +type GetLinkMetadataRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Required. The link URL. + Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } +func (x *GetLinkMetadataRequest) Reset() { + *x = GetLinkMetadataRequest{} + mi := &file_api_memo_service_proto_msgTypes[30] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetLinkMetadataRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetLinkMetadataRequest) ProtoMessage() {} + +func (x *GetLinkMetadataRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_memo_service_proto_msgTypes[30] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetLinkMetadataRequest.ProtoReflect.Descriptor instead. +func (*GetLinkMetadataRequest) Descriptor() ([]byte, []int) { + return file_api_memo_service_proto_rawDescGZIP(), []int{30} +} + +func (x *GetLinkMetadataRequest) GetUrl() string { + if x != nil { + return x.Url + } + return "" +} + +// Request message for MemoService.BatchGetLinkMetadata. +type BatchGetLinkMetadataRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Required. The link URLs. At most 10. + Urls []string `protobuf:"bytes,1,rep,name=urls,proto3" json:"urls,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *BatchGetLinkMetadataRequest) Reset() { + *x = BatchGetLinkMetadataRequest{} + mi := &file_api_memo_service_proto_msgTypes[31] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *BatchGetLinkMetadataRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BatchGetLinkMetadataRequest) ProtoMessage() {} + +func (x *BatchGetLinkMetadataRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_memo_service_proto_msgTypes[31] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BatchGetLinkMetadataRequest.ProtoReflect.Descriptor instead. +func (*BatchGetLinkMetadataRequest) Descriptor() ([]byte, []int) { + return file_api_memo_service_proto_rawDescGZIP(), []int{31} +} + +func (x *BatchGetLinkMetadataRequest) GetUrls() []string { + if x != nil { + return x.Urls + } + return nil +} + +// Response message for MemoService.BatchGetLinkMetadata. +type BatchGetLinkMetadataResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The link metadata, in the same order as the requested URLs. + LinkMetadata []*LinkMetadata `protobuf:"bytes,1,rep,name=link_metadata,json=linkMetadata,proto3" json:"link_metadata,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *BatchGetLinkMetadataResponse) Reset() { + *x = BatchGetLinkMetadataResponse{} + mi := &file_api_memo_service_proto_msgTypes[32] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *BatchGetLinkMetadataResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BatchGetLinkMetadataResponse) ProtoMessage() {} + +func (x *BatchGetLinkMetadataResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_memo_service_proto_msgTypes[32] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BatchGetLinkMetadataResponse.ProtoReflect.Descriptor instead. +func (*BatchGetLinkMetadataResponse) Descriptor() ([]byte, []int) { + return file_api_memo_service_proto_rawDescGZIP(), []int{32} +} + +func (x *BatchGetLinkMetadataResponse) GetLinkMetadata() []*LinkMetadata { + if x != nil { + return x.LinkMetadata + } + return nil +} + +// Property holds properties computed from the memo content. +type Memo_Property struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The text of the H1 heading when it is the first block of the content. + Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` + // Whether the content contains a link. + HasLink bool `protobuf:"varint,2,opt,name=has_link,json=hasLink,proto3" json:"has_link,omitempty"` + // Whether the content contains inline code or a code block. + HasCode bool `protobuf:"varint,3,opt,name=has_code,json=hasCode,proto3" json:"has_code,omitempty"` + // Whether the content contains a task list. + HasTaskList bool `protobuf:"varint,4,opt,name=has_task_list,json=hasTaskList,proto3" json:"has_task_list,omitempty"` + // Whether the content contains an unchecked task. + HasIncompleteTasks bool `protobuf:"varint,5,opt,name=has_incomplete_tasks,json=hasIncompleteTasks,proto3" json:"has_incomplete_tasks,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + func (x *Memo_Property) Reset() { *x = Memo_Property{} - mi := &file_api_v1_memo_service_proto_msgTypes[33] + mi := &file_api_memo_service_proto_msgTypes[33] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2216,7 +2270,7 @@ func (x *Memo_Property) String() string { func (*Memo_Property) ProtoMessage() {} func (x *Memo_Property) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_memo_service_proto_msgTypes[33] + mi := &file_api_memo_service_proto_msgTypes[33] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2229,7 +2283,14 @@ func (x *Memo_Property) ProtoReflect() protoreflect.Message { // Deprecated: Use Memo_Property.ProtoReflect.Descriptor instead. func (*Memo_Property) Descriptor() ([]byte, []int) { - return file_api_v1_memo_service_proto_rawDescGZIP(), []int{1, 0} + return file_api_memo_service_proto_rawDescGZIP(), []int{0, 0} +} + +func (x *Memo_Property) GetTitle() string { + if x != nil { + return x.Title + } + return "" } func (x *Memo_Property) GetHasLink() bool { @@ -2239,13 +2300,6 @@ func (x *Memo_Property) GetHasLink() bool { return false } -func (x *Memo_Property) GetHasTaskList() bool { - if x != nil { - return x.HasTaskList - } - return false -} - func (x *Memo_Property) GetHasCode() bool { if x != nil { return x.HasCode @@ -2253,6 +2307,13 @@ func (x *Memo_Property) GetHasCode() bool { return false } +func (x *Memo_Property) GetHasTaskList() bool { + if x != nil { + return x.HasTaskList + } + return false +} + func (x *Memo_Property) GetHasIncompleteTasks() bool { if x != nil { return x.HasIncompleteTasks @@ -2260,40 +2321,34 @@ func (x *Memo_Property) GetHasIncompleteTasks() bool { return false } -func (x *Memo_Property) GetTitle() string { - if x != nil { - return x.Title - } - return "" -} - -// Memo reference in relations. -type MemoRelation_Memo struct { +// MemoRef identifies a memo in a relation. +type MemoRelation_MemoRef struct { state protoimpl.MessageState `protogen:"open.v1"` - // The resource name of the memo. + // Required. The resource name of the memo. // Format: memos/{memo} Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Output only. The snippet of the memo content. Plain text only. + // Output only. A plain-text snippet of the memo content. Empty in + // ListMemos and ListMemoComments responses. Snippet string `protobuf:"bytes,2,opt,name=snippet,proto3" json:"snippet,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } -func (x *MemoRelation_Memo) Reset() { - *x = MemoRelation_Memo{} - mi := &file_api_v1_memo_service_proto_msgTypes[34] +func (x *MemoRelation_MemoRef) Reset() { + *x = MemoRelation_MemoRef{} + mi := &file_api_memo_service_proto_msgTypes[34] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } -func (x *MemoRelation_Memo) String() string { +func (x *MemoRelation_MemoRef) String() string { return protoimpl.X.MessageStringOf(x) } -func (*MemoRelation_Memo) ProtoMessage() {} +func (*MemoRelation_MemoRef) ProtoMessage() {} -func (x *MemoRelation_Memo) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_memo_service_proto_msgTypes[34] +func (x *MemoRelation_MemoRef) ProtoReflect() protoreflect.Message { + mi := &file_api_memo_service_proto_msgTypes[34] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2304,211 +2359,210 @@ func (x *MemoRelation_Memo) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use MemoRelation_Memo.ProtoReflect.Descriptor instead. -func (*MemoRelation_Memo) Descriptor() ([]byte, []int) { - return file_api_v1_memo_service_proto_rawDescGZIP(), []int{12, 0} +// Deprecated: Use MemoRelation_MemoRef.ProtoReflect.Descriptor instead. +func (*MemoRelation_MemoRef) Descriptor() ([]byte, []int) { + return file_api_memo_service_proto_rawDescGZIP(), []int{11, 0} } -func (x *MemoRelation_Memo) GetName() string { +func (x *MemoRelation_MemoRef) GetName() string { if x != nil { return x.Name } return "" } -func (x *MemoRelation_Memo) GetSnippet() string { +func (x *MemoRelation_MemoRef) GetSnippet() string { if x != nil { return x.Snippet } return "" } -var File_api_v1_memo_service_proto protoreflect.FileDescriptor +var File_api_memo_service_proto protoreflect.FileDescriptor -const file_api_v1_memo_service_proto_rawDesc = "" + +const file_api_memo_service_proto_rawDesc = "" + "\n" + - "\x19api/v1/memo_service.proto\x12\fmemos.api.v1\x1a\x1fapi/v1/attachment_service.proto\x1a\x13api/v1/common.proto\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"\xb3\x02\n" + - "\bReaction\x12\x1a\n" + - "\x04name\x18\x01 \x01(\tB\x06\xe0A\x03\xe0A\bR\x04name\x123\n" + - "\acreator\x18\x02 \x01(\tB\x19\xe0A\x03\xfaA\x13\n" + - "\x11memos.api.v1/UserR\acreator\x12(\n" + - "\rreaction_type\x18\x04 \x01(\tB\x03\xe0A\x02R\freactionType\x12@\n" + - "\vcreate_time\x18\x05 \x01(\v2\x1a.google.protobuf.TimestampB\x03\xe0A\x03R\n" + - "createTime:X\xeaAU\n" + - "\x15memos.api.v1/Reaction\x12!memos/{memo}/reactions/{reaction}\x1a\x04name*\treactions2\breactionJ\x04\b\x03\x10\x04R\n" + - "content_id\"\xff\b\n" + + "\x16api/memo_service.proto\x12\tmemos.api\x1a\x1capi/attachment_service.proto\x1a\x10api/common.proto\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"\xc4\b\n" + "\x04Memo\x12\x17\n" + - "\x04name\x18\x01 \x01(\tB\x03\xe0A\bR\x04name\x12.\n" + - "\x05state\x18\x02 \x01(\x0e2\x13.memos.api.v1.StateB\x03\xe0A\x02R\x05state\x123\n" + - "\acreator\x18\x03 \x01(\tB\x19\xe0A\x03\xfaA\x13\n" + - "\x11memos.api.v1/UserR\acreator\x12@\n" + - "\vcreate_time\x18\x04 \x01(\v2\x1a.google.protobuf.TimestampB\x03\xe0A\x01R\n" + - "createTime\x12@\n" + - "\vupdate_time\x18\x05 \x01(\v2\x1a.google.protobuf.TimestampB\x03\xe0A\x01R\n" + - "updateTime\x12\x1d\n" + - "\acontent\x18\a \x01(\tB\x03\xe0A\x02R\acontent\x12=\n" + + "\x04name\x18\x01 \x01(\tB\x03\xe0A\bR\x04name\x120\n" + + "\acreator\x18\x02 \x01(\tB\x16\xe0A\x03\xfaA\x10\n" + + "\x0ememos.api/UserR\acreator\x122\n" + + "\x05space\x18\x03 \x01(\tB\x17\xe0A\x01\xfaA\x11\n" + + "\x0fmemos.api/SpaceH\x00R\x05space\x88\x01\x01\x12\x1d\n" + + "\acontent\x18\x04 \x01(\tB\x03\xe0A\x02R\acontent\x129\n" + + "\blocation\x18\x05 \x01(\v2\x13.memos.api.LocationB\x03\xe0A\x01H\x01R\blocation\x88\x01\x01\x12:\n" + "\n" + - "visibility\x18\t \x01(\x0e2\x18.memos.api.v1.VisibilityB\x03\xe0A\x02R\n" + - "visibility\x12\x17\n" + - "\x04tags\x18\n" + - " \x03(\tB\x03\xe0A\x03R\x04tags\x12\x1b\n" + - "\x06pinned\x18\v \x01(\bB\x03\xe0A\x01R\x06pinned\x12?\n" + - "\vattachments\x18\f \x03(\v2\x18.memos.api.v1.AttachmentB\x03\xe0A\x01R\vattachments\x12=\n" + - "\trelations\x18\r \x03(\v2\x1a.memos.api.v1.MemoRelationB\x03\xe0A\x01R\trelations\x129\n" + - "\treactions\x18\x0e \x03(\v2\x16.memos.api.v1.ReactionB\x03\xe0A\x03R\treactions\x12<\n" + - "\bproperty\x18\x0f \x01(\v2\x1b.memos.api.v1.Memo.PropertyB\x03\xe0A\x03R\bproperty\x126\n" + - "\x06parent\x18\x10 \x01(\tB\x19\xe0A\x03\xfaA\x13\n" + - "\x11memos.api.v1/MemoH\x00R\x06parent\x88\x01\x01\x12\x1d\n" + - "\asnippet\x18\x11 \x01(\tB\x03\xe0A\x03R\asnippet\x12<\n" + - "\blocation\x18\x12 \x01(\v2\x16.memos.api.v1.LocationB\x03\xe0A\x01H\x01R\blocation\x88\x01\x01\x125\n" + - "\x05space\x18\x13 \x01(\tB\x1a\xe0A\x01\xfaA\x14\n" + - "\x12memos.api.v1/SpaceH\x02R\x05space\x88\x01\x01\x1a\xac\x01\n" + - "\bProperty\x12\x19\n" + - "\bhas_link\x18\x01 \x01(\bR\ahasLink\x12\"\n" + - "\rhas_task_list\x18\x02 \x01(\bR\vhasTaskList\x12\x19\n" + - "\bhas_code\x18\x03 \x01(\bR\ahasCode\x120\n" + - "\x14has_incomplete_tasks\x18\x04 \x01(\bR\x12hasIncompleteTasks\x12\x14\n" + - "\x05title\x18\x05 \x01(\tR\x05title:7\xeaA4\n" + - "\x11memos.api.v1/Memo\x12\fmemos/{memo}\x1a\x04name*\x05memos2\x04memoB\t\n" + - "\a_parentB\v\n" + - "\t_locationB\b\n" + - "\x06_spaceJ\x04\b\x06\x10\aR\fdisplay_time\"u\n" + - "\bLocation\x12%\n" + - "\vplaceholder\x18\x01 \x01(\tB\x03\xe0A\x01R\vplaceholder\x12\x1f\n" + - "\blatitude\x18\x02 \x01(\x01B\x03\xe0A\x01R\blatitude\x12!\n" + - "\tlongitude\x18\x03 \x01(\x01B\x03\xe0A\x01R\tlongitude\"^\n" + - "\x11CreateMemoRequest\x12+\n" + - "\x04memo\x18\x01 \x01(\v2\x12.memos.api.v1.MemoB\x03\xe0A\x02R\x04memo\x12\x1c\n" + - "\amemo_id\x18\x02 \x01(\tB\x03\xe0A\x01R\x06memoId\"\x8c\x02\n" + + "visibility\x18\x06 \x01(\x0e2\x15.memos.api.VisibilityB\x03\xe0A\x02R\n" + + "visibility\x12+\n" + + "\x05state\x18\a \x01(\x0e2\x10.memos.api.StateB\x03\xe0A\x02R\x05state\x12\x1b\n" + + "\x06pinned\x18\b \x01(\bB\x03\xe0A\x01R\x06pinned\x12<\n" + + "\vattachments\x18\t \x03(\v2\x15.memos.api.AttachmentB\x03\xe0A\x01R\vattachments\x12:\n" + + "\trelations\x18\n" + + " \x03(\v2\x17.memos.api.MemoRelationB\x03\xe0A\x01R\trelations\x126\n" + + "\treactions\x18\v \x03(\v2\x13.memos.api.ReactionB\x03\xe0A\x03R\treactions\x123\n" + + "\x06parent\x18\f \x01(\tB\x16\xe0A\x03\xfaA\x10\n" + + "\x0ememos.api/MemoH\x02R\x06parent\x88\x01\x01\x12\x17\n" + + "\x04tags\x18\r \x03(\tB\x03\xe0A\x03R\x04tags\x129\n" + + "\bproperty\x18\x0e \x01(\v2\x18.memos.api.Memo.PropertyB\x03\xe0A\x03R\bproperty\x12\x1d\n" + + "\asnippet\x18\x0f \x01(\tB\x03\xe0A\x03R\asnippet\x12@\n" + + "\vcreate_time\x18\x10 \x01(\v2\x1a.google.protobuf.TimestampB\x03\xe0A\x01R\n" + + "createTime\x12@\n" + + "\vupdate_time\x18\x11 \x01(\v2\x1a.google.protobuf.TimestampB\x03\xe0A\x01R\n" + + "updateTime\x1a\xac\x01\n" + + "\bProperty\x12\x14\n" + + "\x05title\x18\x01 \x01(\tR\x05title\x12\x19\n" + + "\bhas_link\x18\x02 \x01(\bR\ahasLink\x12\x19\n" + + "\bhas_code\x18\x03 \x01(\bR\ahasCode\x12\"\n" + + "\rhas_task_list\x18\x04 \x01(\bR\vhasTaskList\x120\n" + + "\x14has_incomplete_tasks\x18\x05 \x01(\bR\x12hasIncompleteTasks:.\xeaA+\n" + + "\x0ememos.api/Memo\x12\fmemos/{memo}*\x05memos2\x04memoB\b\n" + + "\x06_spaceB\v\n" + + "\t_locationB\t\n" + + "\a_parent\"\xea\x01\n" + "\x10ListMemosRequest\x12 \n" + "\tpage_size\x18\x01 \x01(\x05B\x03\xe0A\x01R\bpageSize\x12\"\n" + "\n" + - "page_token\x18\x02 \x01(\tB\x03\xe0A\x01R\tpageToken\x12.\n" + - "\x05state\x18\x03 \x01(\x0e2\x13.memos.api.v1.StateB\x03\xe0A\x01R\x05state\x12\x1e\n" + - "\border_by\x18\x04 \x01(\tB\x03\xe0A\x01R\aorderBy\x12\x1b\n" + - "\x06filter\x18\x05 \x01(\tB\x03\xe0A\x01R\x06filter\x12&\n" + - "\fshow_deleted\x18\x06 \x01(\bB\x03\xe0A\x01R\vshowDeletedJ\x04\b\a\x10\bJ\x04\b\b\x10\tR\x05spaceR\n" + - "unassigned\"e\n" + - "\x11ListMemosResponse\x12(\n" + - "\x05memos\x18\x01 \x03(\v2\x12.memos.api.v1.MemoR\x05memos\x12&\n" + - "\x0fnext_page_token\x18\x02 \x01(\tR\rnextPageToken\"?\n" + - "\x0eGetMemoRequest\x12-\n" + - "\x04name\x18\x01 \x01(\tB\x19\xe0A\x02\xfaA\x13\n" + - "\x11memos.api.v1/MemoR\x04name\"\x82\x01\n" + - "\x11UpdateMemoRequest\x12+\n" + - "\x04memo\x18\x01 \x01(\v2\x12.memos.api.v1.MemoB\x03\xe0A\x02R\x04memo\x12@\n" + + "page_token\x18\x02 \x01(\tB\x03\xe0A\x01R\tpageToken\x12\x1b\n" + + "\x06filter\x18\x03 \x01(\tB\x03\xe0A\x01R\x06filter\x12\x1e\n" + + "\border_by\x18\x04 \x01(\tB\x03\xe0A\x01R\aorderBy\x12&\n" + + "\fshow_deleted\x18\x05 \x01(\bB\x03\xe0A\x01R\vshowDeleted\x12+\n" + + "\x05state\x18\x06 \x01(\x0e2\x10.memos.api.StateB\x03\xe0A\x01R\x05state\"b\n" + + "\x11ListMemosResponse\x12%\n" + + "\x05memos\x18\x01 \x03(\v2\x0f.memos.api.MemoR\x05memos\x12&\n" + + "\x0fnext_page_token\x18\x02 \x01(\tR\rnextPageToken\"<\n" + + "\x0eGetMemoRequest\x12*\n" + + "\x04name\x18\x01 \x01(\tB\x16\xe0A\x02\xfaA\x10\n" + + "\x0ememos.api/MemoR\x04name\"[\n" + + "\x11CreateMemoRequest\x12(\n" + + "\x04memo\x18\x01 \x01(\v2\x0f.memos.api.MemoB\x03\xe0A\x02R\x04memo\x12\x1c\n" + + "\amemo_id\x18\x02 \x01(\tB\x03\xe0A\x01R\x06memoId\"\x7f\n" + + "\x11UpdateMemoRequest\x12(\n" + + "\x04memo\x18\x01 \x01(\v2\x0f.memos.api.MemoB\x03\xe0A\x02R\x04memo\x12@\n" + "\vupdate_mask\x18\x02 \x01(\v2\x1a.google.protobuf.FieldMaskB\x03\xe0A\x02R\n" + - "updateMask\"]\n" + - "\x11DeleteMemoRequest\x12-\n" + - "\x04name\x18\x01 \x01(\tB\x19\xe0A\x02\xfaA\x13\n" + - "\x11memos.api.v1/MemoR\x04name\x12\x19\n" + - "\x05force\x18\x02 \x01(\bB\x03\xe0A\x01R\x05force\"\x8b\x01\n" + - "\x19SetMemoAttachmentsRequest\x12-\n" + - "\x04name\x18\x01 \x01(\tB\x19\xe0A\x02\xfaA\x13\n" + - "\x11memos.api.v1/MemoR\x04name\x12?\n" + - "\vattachments\x18\x02 \x03(\v2\x18.memos.api.v1.AttachmentB\x03\xe0A\x02R\vattachments\"\x91\x01\n" + - "\x1aListMemoAttachmentsRequest\x12-\n" + - "\x04name\x18\x01 \x01(\tB\x19\xe0A\x02\xfaA\x13\n" + - "\x11memos.api.v1/MemoR\x04name\x12 \n" + + "updateMask\"Z\n" + + "\x11DeleteMemoRequest\x12*\n" + + "\x04name\x18\x01 \x01(\tB\x16\xe0A\x02\xfaA\x10\n" + + "\x0ememos.api/MemoR\x04name\x12\x19\n" + + "\x05force\x18\x02 \x01(\bB\x03\xe0A\x01R\x05force\"u\n" + + "\bLocation\x12%\n" + + "\vplaceholder\x18\x01 \x01(\tB\x03\xe0A\x01R\vplaceholder\x12\x1f\n" + + "\blatitude\x18\x02 \x01(\x01B\x03\xe0A\x01R\blatitude\x12!\n" + + "\tlongitude\x18\x03 \x01(\x01B\x03\xe0A\x01R\tlongitude\"\x92\x01\n" + + "\x1aListMemoAttachmentsRequest\x12.\n" + + "\x06parent\x18\x01 \x01(\tB\x16\xe0A\x02\xfaA\x10\n" + + "\x0ememos.api/MemoR\x06parent\x12 \n" + "\tpage_size\x18\x02 \x01(\x05B\x03\xe0A\x01R\bpageSize\x12\"\n" + "\n" + - "page_token\x18\x03 \x01(\tB\x03\xe0A\x01R\tpageToken\"\x81\x01\n" + - "\x1bListMemoAttachmentsResponse\x12:\n" + - "\vattachments\x18\x01 \x03(\v2\x18.memos.api.v1.AttachmentR\vattachments\x12&\n" + - "\x0fnext_page_token\x18\x02 \x01(\tR\rnextPageToken\"\xdb\x02\n" + + "page_token\x18\x03 \x01(\tB\x03\xe0A\x01R\tpageToken\"~\n" + + "\x1bListMemoAttachmentsResponse\x127\n" + + "\vattachments\x18\x01 \x03(\v2\x15.memos.api.AttachmentR\vattachments\x12&\n" + + "\x0fnext_page_token\x18\x02 \x01(\tR\rnextPageToken\"\x85\x01\n" + + "\x19SetMemoAttachmentsRequest\x12*\n" + + "\x04name\x18\x01 \x01(\tB\x16\xe0A\x02\xfaA\x10\n" + + "\x0ememos.api/MemoR\x04name\x12<\n" + + "\vattachments\x18\x02 \x03(\v2\x15.memos.api.AttachmentB\x03\xe0A\x02R\vattachments\"\xd8\x02\n" + "\fMemoRelation\x128\n" + - "\x04memo\x18\x01 \x01(\v2\x1f.memos.api.v1.MemoRelation.MemoB\x03\xe0A\x02R\x04memo\x12G\n" + - "\frelated_memo\x18\x02 \x01(\v2\x1f.memos.api.v1.MemoRelation.MemoB\x03\xe0A\x02R\vrelatedMemo\x128\n" + - "\x04type\x18\x03 \x01(\x0e2\x1f.memos.api.v1.MemoRelation.TypeB\x03\xe0A\x02R\x04type\x1aT\n" + - "\x04Memo\x12-\n" + - "\x04name\x18\x01 \x01(\tB\x19\xe0A\x02\xfaA\x13\n" + - "\x11memos.api.v1/MemoR\x04name\x12\x1d\n" + + "\x04memo\x18\x01 \x01(\v2\x1f.memos.api.MemoRelation.MemoRefB\x03\xe0A\x02R\x04memo\x12G\n" + + "\frelated_memo\x18\x02 \x01(\v2\x1f.memos.api.MemoRelation.MemoRefB\x03\xe0A\x02R\vrelatedMemo\x125\n" + + "\x04type\x18\x03 \x01(\x0e2\x1c.memos.api.MemoRelation.TypeB\x03\xe0A\x02R\x04type\x1aT\n" + + "\aMemoRef\x12*\n" + + "\x04name\x18\x01 \x01(\tB\x16\xe0A\x02\xfaA\x10\n" + + "\x0ememos.api/MemoR\x04name\x12\x1d\n" + "\asnippet\x18\x02 \x01(\tB\x03\xe0A\x03R\asnippet\"8\n" + "\x04Type\x12\x14\n" + "\x10TYPE_UNSPECIFIED\x10\x00\x12\r\n" + "\tREFERENCE\x10\x01\x12\v\n" + - "\aCOMMENT\x10\x02\"\x87\x01\n" + - "\x17SetMemoRelationsRequest\x12-\n" + - "\x04name\x18\x01 \x01(\tB\x19\xe0A\x02\xfaA\x13\n" + - "\x11memos.api.v1/MemoR\x04name\x12=\n" + - "\trelations\x18\x02 \x03(\v2\x1a.memos.api.v1.MemoRelationB\x03\xe0A\x02R\trelations\"\x8f\x01\n" + - "\x18ListMemoRelationsRequest\x12-\n" + - "\x04name\x18\x01 \x01(\tB\x19\xe0A\x02\xfaA\x13\n" + - "\x11memos.api.v1/MemoR\x04name\x12 \n" + + "\aCOMMENT\x10\x02\"\x90\x01\n" + + "\x18ListMemoRelationsRequest\x12.\n" + + "\x06parent\x18\x01 \x01(\tB\x16\xe0A\x02\xfaA\x10\n" + + "\x0ememos.api/MemoR\x06parent\x12 \n" + "\tpage_size\x18\x02 \x01(\x05B\x03\xe0A\x01R\bpageSize\x12\"\n" + "\n" + - "page_token\x18\x03 \x01(\tB\x03\xe0A\x01R\tpageToken\"}\n" + - "\x19ListMemoRelationsResponse\x128\n" + - "\trelations\x18\x01 \x03(\v2\x1a.memos.api.v1.MemoRelationR\trelations\x12&\n" + - "\x0fnext_page_token\x18\x02 \x01(\tR\rnextPageToken\"\xa0\x01\n" + - "\x18CreateMemoCommentRequest\x12-\n" + - "\x04name\x18\x01 \x01(\tB\x19\xe0A\x02\xfaA\x13\n" + - "\x11memos.api.v1/MemoR\x04name\x121\n" + - "\acomment\x18\x02 \x01(\v2\x12.memos.api.v1.MemoB\x03\xe0A\x02R\acomment\x12\"\n" + - "\n" + - "comment_id\x18\x03 \x01(\tB\x03\xe0A\x01R\tcommentId\"\xae\x01\n" + - "\x17ListMemoCommentsRequest\x12-\n" + - "\x04name\x18\x01 \x01(\tB\x19\xe0A\x02\xfaA\x13\n" + - "\x11memos.api.v1/MemoR\x04name\x12 \n" + + "page_token\x18\x03 \x01(\tB\x03\xe0A\x01R\tpageToken\"z\n" + + "\x19ListMemoRelationsResponse\x125\n" + + "\trelations\x18\x01 \x03(\v2\x17.memos.api.MemoRelationR\trelations\x12&\n" + + "\x0fnext_page_token\x18\x02 \x01(\tR\rnextPageToken\"\x81\x01\n" + + "\x17SetMemoRelationsRequest\x12*\n" + + "\x04name\x18\x01 \x01(\tB\x16\xe0A\x02\xfaA\x10\n" + + "\x0ememos.api/MemoR\x04name\x12:\n" + + "\trelations\x18\x02 \x03(\v2\x17.memos.api.MemoRelationB\x03\xe0A\x02R\trelations\"\xaf\x01\n" + + "\x17ListMemoCommentsRequest\x12.\n" + + "\x06parent\x18\x01 \x01(\tB\x16\xe0A\x02\xfaA\x10\n" + + "\x0ememos.api/MemoR\x06parent\x12 \n" + "\tpage_size\x18\x02 \x01(\x05B\x03\xe0A\x01R\bpageSize\x12\"\n" + "\n" + "page_token\x18\x03 \x01(\tB\x03\xe0A\x01R\tpageToken\x12\x1e\n" + - "\border_by\x18\x04 \x01(\tB\x03\xe0A\x01R\aorderBy\"l\n" + - "\x18ListMemoCommentsResponse\x12(\n" + - "\x05memos\x18\x01 \x03(\v2\x12.memos.api.v1.MemoR\x05memos\x12&\n" + - "\x0fnext_page_token\x18\x02 \x01(\tR\rnextPageToken\"\x8f\x01\n" + - "\x18ListMemoReactionsRequest\x12-\n" + - "\x04name\x18\x01 \x01(\tB\x19\xe0A\x02\xfaA\x13\n" + - "\x11memos.api.v1/MemoR\x04name\x12 \n" + + "\border_by\x18\x04 \x01(\tB\x03\xe0A\x01R\aorderBy\"o\n" + + "\x18ListMemoCommentsResponse\x12+\n" + + "\bcomments\x18\x01 \x03(\v2\x0f.memos.api.MemoR\bcomments\x12&\n" + + "\x0fnext_page_token\x18\x02 \x01(\tR\rnextPageToken\"\x9e\x01\n" + + "\x18CreateMemoCommentRequest\x12.\n" + + "\x06parent\x18\x01 \x01(\tB\x16\xe0A\x02\xfaA\x10\n" + + "\x0ememos.api/MemoR\x06parent\x12.\n" + + "\acomment\x18\x02 \x01(\v2\x0f.memos.api.MemoB\x03\xe0A\x02R\acomment\x12\"\n" + + "\n" + + "comment_id\x18\x03 \x01(\tB\x03\xe0A\x01R\tcommentId\"\x95\x02\n" + + "\bReaction\x12\x1a\n" + + "\x04name\x18\x01 \x01(\tB\x06\xe0A\x03\xe0A\bR\x04name\x120\n" + + "\acreator\x18\x02 \x01(\tB\x16\xe0A\x03\xfaA\x10\n" + + "\x0ememos.api/UserR\acreator\x12(\n" + + "\rreaction_type\x18\x03 \x01(\tB\x03\xe0A\x02R\freactionType\x12@\n" + + "\vcreate_time\x18\x04 \x01(\v2\x1a.google.protobuf.TimestampB\x03\xe0A\x03R\n" + + "createTime:O\xeaAL\n" + + "\x12memos.api/Reaction\x12!memos/{memo}/reactions/{reaction}*\treactions2\breaction\"\x90\x01\n" + + "\x18ListMemoReactionsRequest\x12.\n" + + "\x06parent\x18\x01 \x01(\tB\x16\xe0A\x02\xfaA\x10\n" + + "\x0ememos.api/MemoR\x06parent\x12 \n" + "\tpage_size\x18\x02 \x01(\x05B\x03\xe0A\x01R\bpageSize\x12\"\n" + "\n" + - "page_token\x18\x03 \x01(\tB\x03\xe0A\x01R\tpageToken\"y\n" + - "\x19ListMemoReactionsResponse\x124\n" + - "\treactions\x18\x01 \x03(\v2\x16.memos.api.v1.ReactionR\treactions\x12&\n" + - "\x0fnext_page_token\x18\x02 \x01(\tR\rnextPageToken\"\x83\x01\n" + - "\x19UpsertMemoReactionRequest\x12-\n" + - "\x04name\x18\x01 \x01(\tB\x19\xe0A\x02\xfaA\x13\n" + - "\x11memos.api.v1/MemoR\x04name\x127\n" + - "\breaction\x18\x02 \x01(\v2\x16.memos.api.v1.ReactionB\x03\xe0A\x02R\breaction\"N\n" + - "\x19DeleteMemoReactionRequest\x121\n" + - "\x04name\x18\x01 \x01(\tB\x1d\xe0A\x02\xfaA\x17\n" + - "\x15memos.api.v1/ReactionR\x04name\"\x86\x02\n" + + "page_token\x18\x03 \x01(\tB\x03\xe0A\x01R\tpageToken\"v\n" + + "\x19ListMemoReactionsResponse\x121\n" + + "\treactions\x18\x01 \x03(\v2\x13.memos.api.ReactionR\treactions\x12&\n" + + "\x0fnext_page_token\x18\x02 \x01(\tR\rnextPageToken\"K\n" + + "\x19DeleteMemoReactionRequest\x12.\n" + + "\x04name\x18\x01 \x01(\tB\x1a\xe0A\x02\xfaA\x14\n" + + "\x12memos.api/ReactionR\x04name\"\x81\x01\n" + + "\x19UpsertMemoReactionRequest\x12.\n" + + "\x06parent\x18\x01 \x01(\tB\x16\xe0A\x02\xfaA\x10\n" + + "\x0ememos.api/MemoR\x06parent\x124\n" + + "\breaction\x18\x02 \x01(\v2\x13.memos.api.ReactionB\x03\xe0A\x02R\breaction\"\x8b\x02\n" + "\tMemoShare\x12\x17\n" + "\x04name\x18\x01 \x01(\tB\x03\xe0A\bR\x04name\x12@\n" + "\vcreate_time\x18\x02 \x01(\v2\x1a.google.protobuf.TimestampB\x03\xe0A\x03R\n" + "createTime\x12E\n" + "\vexpire_time\x18\x03 \x01(\v2\x1a.google.protobuf.TimestampB\x03\xe0A\x01H\x00R\n" + - "expireTime\x88\x01\x01:G\xeaAD\n" + - "\x16memos.api.v1/MemoShare\x12\x1bmemos/{memo}/shares/{share}*\x06shares2\x05shareB\x0e\n" + - "\f_expire_time\"\x88\x01\n" + - "\x16CreateMemoShareRequest\x121\n" + - "\x06parent\x18\x01 \x01(\tB\x19\xe0A\x02\xfaA\x13\n" + - "\x11memos.api.v1/MemoR\x06parent\x12;\n" + + "expireTime\x88\x01\x01:L\xeaAI\n" + + "\x13memos.api/MemoShare\x12\x1bmemos/{memo}/shares/{share}*\n" + + "memoShares2\tmemoShareB\x0e\n" + + "\f_expire_time\"G\n" + + "\x15ListMemoSharesRequest\x12.\n" + + "\x06parent\x18\x01 \x01(\tB\x16\xe0A\x02\xfaA\x10\n" + + "\x0ememos.api/MemoR\x06parent\"O\n" + + "\x16ListMemoSharesResponse\x125\n" + + "\vmemo_shares\x18\x01 \x03(\v2\x14.memos.api.MemoShareR\n" + + "memoShares\"\x82\x01\n" + + "\x16CreateMemoShareRequest\x12.\n" + + "\x06parent\x18\x01 \x01(\tB\x16\xe0A\x02\xfaA\x10\n" + + "\x0ememos.api/MemoR\x06parent\x128\n" + "\n" + - "memo_share\x18\x02 \x01(\v2\x17.memos.api.v1.MemoShareB\x03\xe0A\x02R\tmemoShare\"J\n" + - "\x15ListMemoSharesRequest\x121\n" + - "\x06parent\x18\x01 \x01(\tB\x19\xe0A\x02\xfaA\x13\n" + - "\x11memos.api.v1/MemoR\x06parent\"R\n" + - "\x16ListMemoSharesResponse\x128\n" + - "\vmemo_shares\x18\x01 \x03(\v2\x17.memos.api.v1.MemoShareR\n" + - "memoShares\"L\n" + - "\x16DeleteMemoShareRequest\x122\n" + - "\x04name\x18\x01 \x01(\tB\x1e\xe0A\x02\xfaA\x18\n" + - "\x16memos.api.v1/MemoShareR\x04name\"<\n" + + "memo_share\x18\x02 \x01(\v2\x14.memos.api.MemoShareB\x03\xe0A\x02R\tmemoShare\"I\n" + + "\x16DeleteMemoShareRequest\x12/\n" + + "\x04name\x18\x01 \x01(\tB\x1b\xe0A\x02\xfaA\x15\n" + + "\x13memos.api/MemoShareR\x04name\"<\n" + "\x14GetSharedMemoRequest\x12$\n" + "\vshare_token\x18\x01 \x01(\tB\x03\xe0A\x02R\n" + - "shareToken\"/\n" + - "\x16GetLinkMetadataRequest\x12\x15\n" + - "\x03url\x18\x01 \x01(\tB\x03\xe0A\x02R\x03url\"6\n" + - "\x1bBatchGetLinkMetadataRequest\x12\x17\n" + - "\x04urls\x18\x01 \x03(\tB\x03\xe0A\x02R\x04urls\"_\n" + - "\x1cBatchGetLinkMetadataResponse\x12?\n" + - "\rlink_metadata\x18\x01 \x03(\v2\x1a.memos.api.v1.LinkMetadataR\flinkMetadata\"n\n" + + "shareToken\"n\n" + "\fLinkMetadata\x12\x10\n" + "\x03url\x18\x01 \x01(\tR\x03url\x12\x14\n" + "\x05title\x18\x02 \x01(\tR\x05title\x12 \n" + "\vdescription\x18\x03 \x01(\tR\vdescription\x12\x14\n" + - "\x05image\x18\x04 \x01(\tR\x05image*[\n" + + "\x05image\x18\x04 \x01(\tR\x05image\"/\n" + + "\x16GetLinkMetadataRequest\x12\x15\n" + + "\x03url\x18\x01 \x01(\tB\x03\xe0A\x02R\x03url\"6\n" + + "\x1bBatchGetLinkMetadataRequest\x12\x17\n" + + "\x04urls\x18\x01 \x03(\tB\x03\xe0A\x02R\x04urls\"\\\n" + + "\x1cBatchGetLinkMetadataResponse\x12<\n" + + "\rlink_metadata\x18\x01 \x03(\v2\x17.memos.api.LinkMetadataR\flinkMetadata*[\n" + "\n" + "Visibility\x12\x1a\n" + "\x16VISIBILITY_UNSPECIFIED\x10\x00\x12\v\n" + @@ -2516,164 +2570,167 @@ const file_api_v1_memo_service_proto_rawDesc = "" + "\tPROTECTED\x10\x02\x12\n" + "\n" + "\x06PUBLIC\x10\x03\x12\t\n" + - "\x05SPACE\x10\x042\x91\x15\n" + - "\vMemoService\x12e\n" + + "\x05SPACE\x10\x042\x83\x14\n" + + "\vMemoService\x12]\n" + + "\tListMemos\x12\x1b.memos.api.ListMemosRequest\x1a\x1c.memos.api.ListMemosResponse\"\x15\xdaA\x00\x82\xd3\xe4\x93\x02\f\x12\n" + + "/api/memos\x12Y\n" + + "\aGetMemo\x12\x19.memos.api.GetMemoRequest\x1a\x0f.memos.api.Memo\"\"\xdaA\x04name\x82\xd3\xe4\x93\x02\x15\x12\x13/api/{name=memos/*}\x12\\\n" + "\n" + - "CreateMemo\x12\x1f.memos.api.v1.CreateMemoRequest\x1a\x12.memos.api.v1.Memo\"\"\xdaA\x04memo\x82\xd3\xe4\x93\x02\x15:\x04memo\"\r/api/v1/memos\x12f\n" + - "\tListMemos\x12\x1e.memos.api.v1.ListMemosRequest\x1a\x1f.memos.api.v1.ListMemosResponse\"\x18\xdaA\x00\x82\xd3\xe4\x93\x02\x0f\x12\r/api/v1/memos\x12b\n" + - "\aGetMemo\x12\x1c.memos.api.v1.GetMemoRequest\x1a\x12.memos.api.v1.Memo\"%\xdaA\x04name\x82\xd3\xe4\x93\x02\x18\x12\x16/api/v1/{name=memos/*}\x12\x7f\n" + + "CreateMemo\x12\x1c.memos.api.CreateMemoRequest\x1a\x0f.memos.api.Memo\"\x1f\xdaA\x04memo\x82\xd3\xe4\x93\x02\x12:\x04memo\"\n" + + "/api/memos\x12v\n" + "\n" + - "UpdateMemo\x12\x1f.memos.api.v1.UpdateMemoRequest\x1a\x12.memos.api.v1.Memo\"<\xdaA\x10memo,update_mask\x82\xd3\xe4\x93\x02#:\x04memo2\x1b/api/v1/{memo.name=memos/*}\x12l\n" + + "UpdateMemo\x12\x1c.memos.api.UpdateMemoRequest\x1a\x0f.memos.api.Memo\"9\xdaA\x10memo,update_mask\x82\xd3\xe4\x93\x02 :\x04memo2\x18/api/{memo.name=memos/*}\x12f\n" + "\n" + - "DeleteMemo\x12\x1f.memos.api.v1.DeleteMemoRequest\x1a\x16.google.protobuf.Empty\"%\xdaA\x04name\x82\xd3\xe4\x93\x02\x18*\x16/api/v1/{name=memos/*}\x12\x8b\x01\n" + - "\x12SetMemoAttachments\x12'.memos.api.v1.SetMemoAttachmentsRequest\x1a\x16.google.protobuf.Empty\"4\xdaA\x04name\x82\xd3\xe4\x93\x02':\x01*2\"/api/v1/{name=memos/*}/attachments\x12\x9d\x01\n" + - "\x13ListMemoAttachments\x12(.memos.api.v1.ListMemoAttachmentsRequest\x1a).memos.api.v1.ListMemoAttachmentsResponse\"1\xdaA\x04name\x82\xd3\xe4\x93\x02$\x12\"/api/v1/{name=memos/*}/attachments\x12\x85\x01\n" + - "\x10SetMemoRelations\x12%.memos.api.v1.SetMemoRelationsRequest\x1a\x16.google.protobuf.Empty\"2\xdaA\x04name\x82\xd3\xe4\x93\x02%:\x01*2 /api/v1/{name=memos/*}/relations\x12\x95\x01\n" + - "\x11ListMemoRelations\x12&.memos.api.v1.ListMemoRelationsRequest\x1a'.memos.api.v1.ListMemoRelationsResponse\"/\xdaA\x04name\x82\xd3\xe4\x93\x02\"\x12 /api/v1/{name=memos/*}/relations\x12\x90\x01\n" + - "\x11CreateMemoComment\x12&.memos.api.v1.CreateMemoCommentRequest\x1a\x12.memos.api.v1.Memo\"?\xdaA\fname,comment\x82\xd3\xe4\x93\x02*:\acomment\"\x1f/api/v1/{name=memos/*}/comments\x12\x91\x01\n" + - "\x10ListMemoComments\x12%.memos.api.v1.ListMemoCommentsRequest\x1a&.memos.api.v1.ListMemoCommentsResponse\".\xdaA\x04name\x82\xd3\xe4\x93\x02!\x12\x1f/api/v1/{name=memos/*}/comments\x12\x95\x01\n" + - "\x11ListMemoReactions\x12&.memos.api.v1.ListMemoReactionsRequest\x1a'.memos.api.v1.ListMemoReactionsResponse\"/\xdaA\x04name\x82\xd3\xe4\x93\x02\"\x12 /api/v1/{name=memos/*}/reactions\x12\x89\x01\n" + - "\x12UpsertMemoReaction\x12'.memos.api.v1.UpsertMemoReactionRequest\x1a\x16.memos.api.v1.Reaction\"2\xdaA\x04name\x82\xd3\xe4\x93\x02%:\x01*\" /api/v1/{name=memos/*}/reactions\x12\x88\x01\n" + - "\x12DeleteMemoReaction\x12'.memos.api.v1.DeleteMemoReactionRequest\x1a\x16.google.protobuf.Empty\"1\xdaA\x04name\x82\xd3\xe4\x93\x02$*\"/api/v1/{name=memos/*/reactions/*}\x12\x99\x01\n" + - "\x0fCreateMemoShare\x12$.memos.api.v1.CreateMemoShareRequest\x1a\x17.memos.api.v1.MemoShare\"G\xdaA\x11parent,memo_share\x82\xd3\xe4\x93\x02-:\n" + - "memo_share\"\x1f/api/v1/{parent=memos/*}/shares\x12\x8d\x01\n" + - "\x0eListMemoShares\x12#.memos.api.v1.ListMemoSharesRequest\x1a$.memos.api.v1.ListMemoSharesResponse\"0\xdaA\x06parent\x82\xd3\xe4\x93\x02!\x12\x1f/api/v1/{parent=memos/*}/shares\x12\x7f\n" + - "\x0fDeleteMemoShare\x12$.memos.api.v1.DeleteMemoShareRequest\x1a\x16.google.protobuf.Empty\".\xdaA\x04name\x82\xd3\xe4\x93\x02!*\x1f/api/v1/{name=memos/*/shares/*}\x12r\n" + - "\rGetSharedMemo\x12\".memos.api.v1.GetSharedMemoRequest\x1a\x12.memos.api.v1.Memo\")\x82\xd3\xe4\x93\x02#\x12!/api/v1/shares/{share_token}/memo\x12y\n" + - "\x0fGetLinkMetadata\x12$.memos.api.v1.GetLinkMetadataRequest\x1a\x1a.memos.api.v1.LinkMetadata\"$\x82\xd3\xe4\x93\x02\x1e\x12\x1c/api/v1/memos/-/linkMetadata\x12\x9f\x01\n" + - "\x14BatchGetLinkMetadata\x12).memos.api.v1.BatchGetLinkMetadataRequest\x1a*.memos.api.v1.BatchGetLinkMetadataResponse\"0\x82\xd3\xe4\x93\x02*:\x01*\"%/api/v1/memos/-/linkMetadata:batchGetB\xa8\x01\n" + - "\x10com.memos.api.v1B\x10MemoServiceProtoP\x01Z0github.com/usememos/memos/proto/gen/api/v1;apiv1\xa2\x02\x03MAX\xaa\x02\fMemos.Api.V1\xca\x02\fMemos\\Api\\V1\xe2\x02\x18Memos\\Api\\V1\\GPBMetadata\xea\x02\x0eMemos::Api::V1b\x06proto3" + "DeleteMemo\x12\x1c.memos.api.DeleteMemoRequest\x1a\x16.google.protobuf.Empty\"\"\xdaA\x04name\x82\xd3\xe4\x93\x02\x15*\x13/api/{name=memos/*}\x12\x98\x01\n" + + "\x13ListMemoAttachments\x12%.memos.api.ListMemoAttachmentsRequest\x1a&.memos.api.ListMemoAttachmentsResponse\"2\xdaA\x06parent\x82\xd3\xe4\x93\x02#\x12!/api/{parent=memos/*}/attachments\x12\x85\x01\n" + + "\x12SetMemoAttachments\x12$.memos.api.SetMemoAttachmentsRequest\x1a\x16.google.protobuf.Empty\"1\xdaA\x04name\x82\xd3\xe4\x93\x02$:\x01*2\x1f/api/{name=memos/*}/attachments\x12\x90\x01\n" + + "\x11ListMemoRelations\x12#.memos.api.ListMemoRelationsRequest\x1a$.memos.api.ListMemoRelationsResponse\"0\xdaA\x06parent\x82\xd3\xe4\x93\x02!\x12\x1f/api/{parent=memos/*}/relations\x12\x7f\n" + + "\x10SetMemoRelations\x12\".memos.api.SetMemoRelationsRequest\x1a\x16.google.protobuf.Empty\"/\xdaA\x04name\x82\xd3\xe4\x93\x02\":\x01*2\x1d/api/{name=memos/*}/relations\x12\x8c\x01\n" + + "\x10ListMemoComments\x12\".memos.api.ListMemoCommentsRequest\x1a#.memos.api.ListMemoCommentsResponse\"/\xdaA\x06parent\x82\xd3\xe4\x93\x02 \x12\x1e/api/{parent=memos/*}/comments\x12\x8b\x01\n" + + "\x11CreateMemoComment\x12#.memos.api.CreateMemoCommentRequest\x1a\x0f.memos.api.Memo\"@\xdaA\x0eparent,comment\x82\xd3\xe4\x93\x02):\acomment\"\x1e/api/{parent=memos/*}/comments\x12\x90\x01\n" + + "\x11ListMemoReactions\x12#.memos.api.ListMemoReactionsRequest\x1a$.memos.api.ListMemoReactionsResponse\"0\xdaA\x06parent\x82\xd3\xe4\x93\x02!\x12\x1f/api/{parent=memos/*}/reactions\x12\x82\x01\n" + + "\x12DeleteMemoReaction\x12$.memos.api.DeleteMemoReactionRequest\x1a\x16.google.protobuf.Empty\".\xdaA\x04name\x82\xd3\xe4\x93\x02!*\x1f/api/{name=memos/*/reactions/*}\x12\x84\x01\n" + + "\x12UpsertMemoReaction\x12$.memos.api.UpsertMemoReactionRequest\x1a\x13.memos.api.Reaction\"3\xdaA\x06parent\x82\xd3\xe4\x93\x02$:\x01*\"\x1f/api/{parent=memos/*}/reactions\x12\x84\x01\n" + + "\x0eListMemoShares\x12 .memos.api.ListMemoSharesRequest\x1a!.memos.api.ListMemoSharesResponse\"-\xdaA\x06parent\x82\xd3\xe4\x93\x02\x1e\x12\x1c/api/{parent=memos/*}/shares\x12\x90\x01\n" + + "\x0fCreateMemoShare\x12!.memos.api.CreateMemoShareRequest\x1a\x14.memos.api.MemoShare\"D\xdaA\x11parent,memo_share\x82\xd3\xe4\x93\x02*:\n" + + "memo_share\"\x1c/api/{parent=memos/*}/shares\x12y\n" + + "\x0fDeleteMemoShare\x12!.memos.api.DeleteMemoShareRequest\x1a\x16.google.protobuf.Empty\"+\xdaA\x04name\x82\xd3\xe4\x93\x02\x1e*\x1c/api/{name=memos/*/shares/*}\x12i\n" + + "\rGetSharedMemo\x12\x1f.memos.api.GetSharedMemoRequest\x1a\x0f.memos.api.Memo\"&\x82\xd3\xe4\x93\x02 \x12\x1e/api/shares/{share_token}/memo\x12p\n" + + "\x0fGetLinkMetadata\x12!.memos.api.GetLinkMetadataRequest\x1a\x17.memos.api.LinkMetadata\"!\x82\xd3\xe4\x93\x02\x1b\x12\x19/api/memos/-/linkMetadata\x12\x96\x01\n" + + "\x14BatchGetLinkMetadata\x12&.memos.api.BatchGetLinkMetadataRequest\x1a'.memos.api.BatchGetLinkMetadataResponse\"-\x82\xd3\xe4\x93\x02':\x01*\"\"/api/memos/-/linkMetadata:batchGetB\x8f\x01\n" + + "\rcom.memos.apiB\x10MemoServiceProtoP\x01Z'github.com/usememos/memos/proto/gen/api\xa2\x02\x03MAX\xaa\x02\tMemos.Api\xca\x02\tMemos\\Api\xe2\x02\x15Memos\\Api\\GPBMetadata\xea\x02\n" + + "Memos::Apib\x06proto3" var ( - file_api_v1_memo_service_proto_rawDescOnce sync.Once - file_api_v1_memo_service_proto_rawDescData []byte + file_api_memo_service_proto_rawDescOnce sync.Once + file_api_memo_service_proto_rawDescData []byte ) -func file_api_v1_memo_service_proto_rawDescGZIP() []byte { - file_api_v1_memo_service_proto_rawDescOnce.Do(func() { - file_api_v1_memo_service_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_api_v1_memo_service_proto_rawDesc), len(file_api_v1_memo_service_proto_rawDesc))) +func file_api_memo_service_proto_rawDescGZIP() []byte { + file_api_memo_service_proto_rawDescOnce.Do(func() { + file_api_memo_service_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_api_memo_service_proto_rawDesc), len(file_api_memo_service_proto_rawDesc))) }) - return file_api_v1_memo_service_proto_rawDescData + return file_api_memo_service_proto_rawDescData } -var file_api_v1_memo_service_proto_enumTypes = make([]protoimpl.EnumInfo, 2) -var file_api_v1_memo_service_proto_msgTypes = make([]protoimpl.MessageInfo, 35) -var file_api_v1_memo_service_proto_goTypes = []any{ - (Visibility)(0), // 0: memos.api.v1.Visibility - (MemoRelation_Type)(0), // 1: memos.api.v1.MemoRelation.Type - (*Reaction)(nil), // 2: memos.api.v1.Reaction - (*Memo)(nil), // 3: memos.api.v1.Memo - (*Location)(nil), // 4: memos.api.v1.Location - (*CreateMemoRequest)(nil), // 5: memos.api.v1.CreateMemoRequest - (*ListMemosRequest)(nil), // 6: memos.api.v1.ListMemosRequest - (*ListMemosResponse)(nil), // 7: memos.api.v1.ListMemosResponse - (*GetMemoRequest)(nil), // 8: memos.api.v1.GetMemoRequest - (*UpdateMemoRequest)(nil), // 9: memos.api.v1.UpdateMemoRequest - (*DeleteMemoRequest)(nil), // 10: memos.api.v1.DeleteMemoRequest - (*SetMemoAttachmentsRequest)(nil), // 11: memos.api.v1.SetMemoAttachmentsRequest - (*ListMemoAttachmentsRequest)(nil), // 12: memos.api.v1.ListMemoAttachmentsRequest - (*ListMemoAttachmentsResponse)(nil), // 13: memos.api.v1.ListMemoAttachmentsResponse - (*MemoRelation)(nil), // 14: memos.api.v1.MemoRelation - (*SetMemoRelationsRequest)(nil), // 15: memos.api.v1.SetMemoRelationsRequest - (*ListMemoRelationsRequest)(nil), // 16: memos.api.v1.ListMemoRelationsRequest - (*ListMemoRelationsResponse)(nil), // 17: memos.api.v1.ListMemoRelationsResponse - (*CreateMemoCommentRequest)(nil), // 18: memos.api.v1.CreateMemoCommentRequest - (*ListMemoCommentsRequest)(nil), // 19: memos.api.v1.ListMemoCommentsRequest - (*ListMemoCommentsResponse)(nil), // 20: memos.api.v1.ListMemoCommentsResponse - (*ListMemoReactionsRequest)(nil), // 21: memos.api.v1.ListMemoReactionsRequest - (*ListMemoReactionsResponse)(nil), // 22: memos.api.v1.ListMemoReactionsResponse - (*UpsertMemoReactionRequest)(nil), // 23: memos.api.v1.UpsertMemoReactionRequest - (*DeleteMemoReactionRequest)(nil), // 24: memos.api.v1.DeleteMemoReactionRequest - (*MemoShare)(nil), // 25: memos.api.v1.MemoShare - (*CreateMemoShareRequest)(nil), // 26: memos.api.v1.CreateMemoShareRequest - (*ListMemoSharesRequest)(nil), // 27: memos.api.v1.ListMemoSharesRequest - (*ListMemoSharesResponse)(nil), // 28: memos.api.v1.ListMemoSharesResponse - (*DeleteMemoShareRequest)(nil), // 29: memos.api.v1.DeleteMemoShareRequest - (*GetSharedMemoRequest)(nil), // 30: memos.api.v1.GetSharedMemoRequest - (*GetLinkMetadataRequest)(nil), // 31: memos.api.v1.GetLinkMetadataRequest - (*BatchGetLinkMetadataRequest)(nil), // 32: memos.api.v1.BatchGetLinkMetadataRequest - (*BatchGetLinkMetadataResponse)(nil), // 33: memos.api.v1.BatchGetLinkMetadataResponse - (*LinkMetadata)(nil), // 34: memos.api.v1.LinkMetadata - (*Memo_Property)(nil), // 35: memos.api.v1.Memo.Property - (*MemoRelation_Memo)(nil), // 36: memos.api.v1.MemoRelation.Memo - (*timestamppb.Timestamp)(nil), // 37: google.protobuf.Timestamp - (State)(0), // 38: memos.api.v1.State - (*Attachment)(nil), // 39: memos.api.v1.Attachment +var file_api_memo_service_proto_enumTypes = make([]protoimpl.EnumInfo, 2) +var file_api_memo_service_proto_msgTypes = make([]protoimpl.MessageInfo, 35) +var file_api_memo_service_proto_goTypes = []any{ + (Visibility)(0), // 0: memos.api.Visibility + (MemoRelation_Type)(0), // 1: memos.api.MemoRelation.Type + (*Memo)(nil), // 2: memos.api.Memo + (*ListMemosRequest)(nil), // 3: memos.api.ListMemosRequest + (*ListMemosResponse)(nil), // 4: memos.api.ListMemosResponse + (*GetMemoRequest)(nil), // 5: memos.api.GetMemoRequest + (*CreateMemoRequest)(nil), // 6: memos.api.CreateMemoRequest + (*UpdateMemoRequest)(nil), // 7: memos.api.UpdateMemoRequest + (*DeleteMemoRequest)(nil), // 8: memos.api.DeleteMemoRequest + (*Location)(nil), // 9: memos.api.Location + (*ListMemoAttachmentsRequest)(nil), // 10: memos.api.ListMemoAttachmentsRequest + (*ListMemoAttachmentsResponse)(nil), // 11: memos.api.ListMemoAttachmentsResponse + (*SetMemoAttachmentsRequest)(nil), // 12: memos.api.SetMemoAttachmentsRequest + (*MemoRelation)(nil), // 13: memos.api.MemoRelation + (*ListMemoRelationsRequest)(nil), // 14: memos.api.ListMemoRelationsRequest + (*ListMemoRelationsResponse)(nil), // 15: memos.api.ListMemoRelationsResponse + (*SetMemoRelationsRequest)(nil), // 16: memos.api.SetMemoRelationsRequest + (*ListMemoCommentsRequest)(nil), // 17: memos.api.ListMemoCommentsRequest + (*ListMemoCommentsResponse)(nil), // 18: memos.api.ListMemoCommentsResponse + (*CreateMemoCommentRequest)(nil), // 19: memos.api.CreateMemoCommentRequest + (*Reaction)(nil), // 20: memos.api.Reaction + (*ListMemoReactionsRequest)(nil), // 21: memos.api.ListMemoReactionsRequest + (*ListMemoReactionsResponse)(nil), // 22: memos.api.ListMemoReactionsResponse + (*DeleteMemoReactionRequest)(nil), // 23: memos.api.DeleteMemoReactionRequest + (*UpsertMemoReactionRequest)(nil), // 24: memos.api.UpsertMemoReactionRequest + (*MemoShare)(nil), // 25: memos.api.MemoShare + (*ListMemoSharesRequest)(nil), // 26: memos.api.ListMemoSharesRequest + (*ListMemoSharesResponse)(nil), // 27: memos.api.ListMemoSharesResponse + (*CreateMemoShareRequest)(nil), // 28: memos.api.CreateMemoShareRequest + (*DeleteMemoShareRequest)(nil), // 29: memos.api.DeleteMemoShareRequest + (*GetSharedMemoRequest)(nil), // 30: memos.api.GetSharedMemoRequest + (*LinkMetadata)(nil), // 31: memos.api.LinkMetadata + (*GetLinkMetadataRequest)(nil), // 32: memos.api.GetLinkMetadataRequest + (*BatchGetLinkMetadataRequest)(nil), // 33: memos.api.BatchGetLinkMetadataRequest + (*BatchGetLinkMetadataResponse)(nil), // 34: memos.api.BatchGetLinkMetadataResponse + (*Memo_Property)(nil), // 35: memos.api.Memo.Property + (*MemoRelation_MemoRef)(nil), // 36: memos.api.MemoRelation.MemoRef + (State)(0), // 37: memos.api.State + (*Attachment)(nil), // 38: memos.api.Attachment + (*timestamppb.Timestamp)(nil), // 39: google.protobuf.Timestamp (*fieldmaskpb.FieldMask)(nil), // 40: google.protobuf.FieldMask (*emptypb.Empty)(nil), // 41: google.protobuf.Empty } -var file_api_v1_memo_service_proto_depIdxs = []int32{ - 37, // 0: memos.api.v1.Reaction.create_time:type_name -> google.protobuf.Timestamp - 38, // 1: memos.api.v1.Memo.state:type_name -> memos.api.v1.State - 37, // 2: memos.api.v1.Memo.create_time:type_name -> google.protobuf.Timestamp - 37, // 3: memos.api.v1.Memo.update_time:type_name -> google.protobuf.Timestamp - 0, // 4: memos.api.v1.Memo.visibility:type_name -> memos.api.v1.Visibility - 39, // 5: memos.api.v1.Memo.attachments:type_name -> memos.api.v1.Attachment - 14, // 6: memos.api.v1.Memo.relations:type_name -> memos.api.v1.MemoRelation - 2, // 7: memos.api.v1.Memo.reactions:type_name -> memos.api.v1.Reaction - 35, // 8: memos.api.v1.Memo.property:type_name -> memos.api.v1.Memo.Property - 4, // 9: memos.api.v1.Memo.location:type_name -> memos.api.v1.Location - 3, // 10: memos.api.v1.CreateMemoRequest.memo:type_name -> memos.api.v1.Memo - 38, // 11: memos.api.v1.ListMemosRequest.state:type_name -> memos.api.v1.State - 3, // 12: memos.api.v1.ListMemosResponse.memos:type_name -> memos.api.v1.Memo - 3, // 13: memos.api.v1.UpdateMemoRequest.memo:type_name -> memos.api.v1.Memo - 40, // 14: memos.api.v1.UpdateMemoRequest.update_mask:type_name -> google.protobuf.FieldMask - 39, // 15: memos.api.v1.SetMemoAttachmentsRequest.attachments:type_name -> memos.api.v1.Attachment - 39, // 16: memos.api.v1.ListMemoAttachmentsResponse.attachments:type_name -> memos.api.v1.Attachment - 36, // 17: memos.api.v1.MemoRelation.memo:type_name -> memos.api.v1.MemoRelation.Memo - 36, // 18: memos.api.v1.MemoRelation.related_memo:type_name -> memos.api.v1.MemoRelation.Memo - 1, // 19: memos.api.v1.MemoRelation.type:type_name -> memos.api.v1.MemoRelation.Type - 14, // 20: memos.api.v1.SetMemoRelationsRequest.relations:type_name -> memos.api.v1.MemoRelation - 14, // 21: memos.api.v1.ListMemoRelationsResponse.relations:type_name -> memos.api.v1.MemoRelation - 3, // 22: memos.api.v1.CreateMemoCommentRequest.comment:type_name -> memos.api.v1.Memo - 3, // 23: memos.api.v1.ListMemoCommentsResponse.memos:type_name -> memos.api.v1.Memo - 2, // 24: memos.api.v1.ListMemoReactionsResponse.reactions:type_name -> memos.api.v1.Reaction - 2, // 25: memos.api.v1.UpsertMemoReactionRequest.reaction:type_name -> memos.api.v1.Reaction - 37, // 26: memos.api.v1.MemoShare.create_time:type_name -> google.protobuf.Timestamp - 37, // 27: memos.api.v1.MemoShare.expire_time:type_name -> google.protobuf.Timestamp - 25, // 28: memos.api.v1.CreateMemoShareRequest.memo_share:type_name -> memos.api.v1.MemoShare - 25, // 29: memos.api.v1.ListMemoSharesResponse.memo_shares:type_name -> memos.api.v1.MemoShare - 34, // 30: memos.api.v1.BatchGetLinkMetadataResponse.link_metadata:type_name -> memos.api.v1.LinkMetadata - 5, // 31: memos.api.v1.MemoService.CreateMemo:input_type -> memos.api.v1.CreateMemoRequest - 6, // 32: memos.api.v1.MemoService.ListMemos:input_type -> memos.api.v1.ListMemosRequest - 8, // 33: memos.api.v1.MemoService.GetMemo:input_type -> memos.api.v1.GetMemoRequest - 9, // 34: memos.api.v1.MemoService.UpdateMemo:input_type -> memos.api.v1.UpdateMemoRequest - 10, // 35: memos.api.v1.MemoService.DeleteMemo:input_type -> memos.api.v1.DeleteMemoRequest - 11, // 36: memos.api.v1.MemoService.SetMemoAttachments:input_type -> memos.api.v1.SetMemoAttachmentsRequest - 12, // 37: memos.api.v1.MemoService.ListMemoAttachments:input_type -> memos.api.v1.ListMemoAttachmentsRequest - 15, // 38: memos.api.v1.MemoService.SetMemoRelations:input_type -> memos.api.v1.SetMemoRelationsRequest - 16, // 39: memos.api.v1.MemoService.ListMemoRelations:input_type -> memos.api.v1.ListMemoRelationsRequest - 18, // 40: memos.api.v1.MemoService.CreateMemoComment:input_type -> memos.api.v1.CreateMemoCommentRequest - 19, // 41: memos.api.v1.MemoService.ListMemoComments:input_type -> memos.api.v1.ListMemoCommentsRequest - 21, // 42: memos.api.v1.MemoService.ListMemoReactions:input_type -> memos.api.v1.ListMemoReactionsRequest - 23, // 43: memos.api.v1.MemoService.UpsertMemoReaction:input_type -> memos.api.v1.UpsertMemoReactionRequest - 24, // 44: memos.api.v1.MemoService.DeleteMemoReaction:input_type -> memos.api.v1.DeleteMemoReactionRequest - 26, // 45: memos.api.v1.MemoService.CreateMemoShare:input_type -> memos.api.v1.CreateMemoShareRequest - 27, // 46: memos.api.v1.MemoService.ListMemoShares:input_type -> memos.api.v1.ListMemoSharesRequest - 29, // 47: memos.api.v1.MemoService.DeleteMemoShare:input_type -> memos.api.v1.DeleteMemoShareRequest - 30, // 48: memos.api.v1.MemoService.GetSharedMemo:input_type -> memos.api.v1.GetSharedMemoRequest - 31, // 49: memos.api.v1.MemoService.GetLinkMetadata:input_type -> memos.api.v1.GetLinkMetadataRequest - 32, // 50: memos.api.v1.MemoService.BatchGetLinkMetadata:input_type -> memos.api.v1.BatchGetLinkMetadataRequest - 3, // 51: memos.api.v1.MemoService.CreateMemo:output_type -> memos.api.v1.Memo - 7, // 52: memos.api.v1.MemoService.ListMemos:output_type -> memos.api.v1.ListMemosResponse - 3, // 53: memos.api.v1.MemoService.GetMemo:output_type -> memos.api.v1.Memo - 3, // 54: memos.api.v1.MemoService.UpdateMemo:output_type -> memos.api.v1.Memo - 41, // 55: memos.api.v1.MemoService.DeleteMemo:output_type -> google.protobuf.Empty - 41, // 56: memos.api.v1.MemoService.SetMemoAttachments:output_type -> google.protobuf.Empty - 13, // 57: memos.api.v1.MemoService.ListMemoAttachments:output_type -> memos.api.v1.ListMemoAttachmentsResponse - 41, // 58: memos.api.v1.MemoService.SetMemoRelations:output_type -> google.protobuf.Empty - 17, // 59: memos.api.v1.MemoService.ListMemoRelations:output_type -> memos.api.v1.ListMemoRelationsResponse - 3, // 60: memos.api.v1.MemoService.CreateMemoComment:output_type -> memos.api.v1.Memo - 20, // 61: memos.api.v1.MemoService.ListMemoComments:output_type -> memos.api.v1.ListMemoCommentsResponse - 22, // 62: memos.api.v1.MemoService.ListMemoReactions:output_type -> memos.api.v1.ListMemoReactionsResponse - 2, // 63: memos.api.v1.MemoService.UpsertMemoReaction:output_type -> memos.api.v1.Reaction - 41, // 64: memos.api.v1.MemoService.DeleteMemoReaction:output_type -> google.protobuf.Empty - 25, // 65: memos.api.v1.MemoService.CreateMemoShare:output_type -> memos.api.v1.MemoShare - 28, // 66: memos.api.v1.MemoService.ListMemoShares:output_type -> memos.api.v1.ListMemoSharesResponse - 41, // 67: memos.api.v1.MemoService.DeleteMemoShare:output_type -> google.protobuf.Empty - 3, // 68: memos.api.v1.MemoService.GetSharedMemo:output_type -> memos.api.v1.Memo - 34, // 69: memos.api.v1.MemoService.GetLinkMetadata:output_type -> memos.api.v1.LinkMetadata - 33, // 70: memos.api.v1.MemoService.BatchGetLinkMetadata:output_type -> memos.api.v1.BatchGetLinkMetadataResponse +var file_api_memo_service_proto_depIdxs = []int32{ + 9, // 0: memos.api.Memo.location:type_name -> memos.api.Location + 0, // 1: memos.api.Memo.visibility:type_name -> memos.api.Visibility + 37, // 2: memos.api.Memo.state:type_name -> memos.api.State + 38, // 3: memos.api.Memo.attachments:type_name -> memos.api.Attachment + 13, // 4: memos.api.Memo.relations:type_name -> memos.api.MemoRelation + 20, // 5: memos.api.Memo.reactions:type_name -> memos.api.Reaction + 35, // 6: memos.api.Memo.property:type_name -> memos.api.Memo.Property + 39, // 7: memos.api.Memo.create_time:type_name -> google.protobuf.Timestamp + 39, // 8: memos.api.Memo.update_time:type_name -> google.protobuf.Timestamp + 37, // 9: memos.api.ListMemosRequest.state:type_name -> memos.api.State + 2, // 10: memos.api.ListMemosResponse.memos:type_name -> memos.api.Memo + 2, // 11: memos.api.CreateMemoRequest.memo:type_name -> memos.api.Memo + 2, // 12: memos.api.UpdateMemoRequest.memo:type_name -> memos.api.Memo + 40, // 13: memos.api.UpdateMemoRequest.update_mask:type_name -> google.protobuf.FieldMask + 38, // 14: memos.api.ListMemoAttachmentsResponse.attachments:type_name -> memos.api.Attachment + 38, // 15: memos.api.SetMemoAttachmentsRequest.attachments:type_name -> memos.api.Attachment + 36, // 16: memos.api.MemoRelation.memo:type_name -> memos.api.MemoRelation.MemoRef + 36, // 17: memos.api.MemoRelation.related_memo:type_name -> memos.api.MemoRelation.MemoRef + 1, // 18: memos.api.MemoRelation.type:type_name -> memos.api.MemoRelation.Type + 13, // 19: memos.api.ListMemoRelationsResponse.relations:type_name -> memos.api.MemoRelation + 13, // 20: memos.api.SetMemoRelationsRequest.relations:type_name -> memos.api.MemoRelation + 2, // 21: memos.api.ListMemoCommentsResponse.comments:type_name -> memos.api.Memo + 2, // 22: memos.api.CreateMemoCommentRequest.comment:type_name -> memos.api.Memo + 39, // 23: memos.api.Reaction.create_time:type_name -> google.protobuf.Timestamp + 20, // 24: memos.api.ListMemoReactionsResponse.reactions:type_name -> memos.api.Reaction + 20, // 25: memos.api.UpsertMemoReactionRequest.reaction:type_name -> memos.api.Reaction + 39, // 26: memos.api.MemoShare.create_time:type_name -> google.protobuf.Timestamp + 39, // 27: memos.api.MemoShare.expire_time:type_name -> google.protobuf.Timestamp + 25, // 28: memos.api.ListMemoSharesResponse.memo_shares:type_name -> memos.api.MemoShare + 25, // 29: memos.api.CreateMemoShareRequest.memo_share:type_name -> memos.api.MemoShare + 31, // 30: memos.api.BatchGetLinkMetadataResponse.link_metadata:type_name -> memos.api.LinkMetadata + 3, // 31: memos.api.MemoService.ListMemos:input_type -> memos.api.ListMemosRequest + 5, // 32: memos.api.MemoService.GetMemo:input_type -> memos.api.GetMemoRequest + 6, // 33: memos.api.MemoService.CreateMemo:input_type -> memos.api.CreateMemoRequest + 7, // 34: memos.api.MemoService.UpdateMemo:input_type -> memos.api.UpdateMemoRequest + 8, // 35: memos.api.MemoService.DeleteMemo:input_type -> memos.api.DeleteMemoRequest + 10, // 36: memos.api.MemoService.ListMemoAttachments:input_type -> memos.api.ListMemoAttachmentsRequest + 12, // 37: memos.api.MemoService.SetMemoAttachments:input_type -> memos.api.SetMemoAttachmentsRequest + 14, // 38: memos.api.MemoService.ListMemoRelations:input_type -> memos.api.ListMemoRelationsRequest + 16, // 39: memos.api.MemoService.SetMemoRelations:input_type -> memos.api.SetMemoRelationsRequest + 17, // 40: memos.api.MemoService.ListMemoComments:input_type -> memos.api.ListMemoCommentsRequest + 19, // 41: memos.api.MemoService.CreateMemoComment:input_type -> memos.api.CreateMemoCommentRequest + 21, // 42: memos.api.MemoService.ListMemoReactions:input_type -> memos.api.ListMemoReactionsRequest + 23, // 43: memos.api.MemoService.DeleteMemoReaction:input_type -> memos.api.DeleteMemoReactionRequest + 24, // 44: memos.api.MemoService.UpsertMemoReaction:input_type -> memos.api.UpsertMemoReactionRequest + 26, // 45: memos.api.MemoService.ListMemoShares:input_type -> memos.api.ListMemoSharesRequest + 28, // 46: memos.api.MemoService.CreateMemoShare:input_type -> memos.api.CreateMemoShareRequest + 29, // 47: memos.api.MemoService.DeleteMemoShare:input_type -> memos.api.DeleteMemoShareRequest + 30, // 48: memos.api.MemoService.GetSharedMemo:input_type -> memos.api.GetSharedMemoRequest + 32, // 49: memos.api.MemoService.GetLinkMetadata:input_type -> memos.api.GetLinkMetadataRequest + 33, // 50: memos.api.MemoService.BatchGetLinkMetadata:input_type -> memos.api.BatchGetLinkMetadataRequest + 4, // 51: memos.api.MemoService.ListMemos:output_type -> memos.api.ListMemosResponse + 2, // 52: memos.api.MemoService.GetMemo:output_type -> memos.api.Memo + 2, // 53: memos.api.MemoService.CreateMemo:output_type -> memos.api.Memo + 2, // 54: memos.api.MemoService.UpdateMemo:output_type -> memos.api.Memo + 41, // 55: memos.api.MemoService.DeleteMemo:output_type -> google.protobuf.Empty + 11, // 56: memos.api.MemoService.ListMemoAttachments:output_type -> memos.api.ListMemoAttachmentsResponse + 41, // 57: memos.api.MemoService.SetMemoAttachments:output_type -> google.protobuf.Empty + 15, // 58: memos.api.MemoService.ListMemoRelations:output_type -> memos.api.ListMemoRelationsResponse + 41, // 59: memos.api.MemoService.SetMemoRelations:output_type -> google.protobuf.Empty + 18, // 60: memos.api.MemoService.ListMemoComments:output_type -> memos.api.ListMemoCommentsResponse + 2, // 61: memos.api.MemoService.CreateMemoComment:output_type -> memos.api.Memo + 22, // 62: memos.api.MemoService.ListMemoReactions:output_type -> memos.api.ListMemoReactionsResponse + 41, // 63: memos.api.MemoService.DeleteMemoReaction:output_type -> google.protobuf.Empty + 20, // 64: memos.api.MemoService.UpsertMemoReaction:output_type -> memos.api.Reaction + 27, // 65: memos.api.MemoService.ListMemoShares:output_type -> memos.api.ListMemoSharesResponse + 25, // 66: memos.api.MemoService.CreateMemoShare:output_type -> memos.api.MemoShare + 41, // 67: memos.api.MemoService.DeleteMemoShare:output_type -> google.protobuf.Empty + 2, // 68: memos.api.MemoService.GetSharedMemo:output_type -> memos.api.Memo + 31, // 69: memos.api.MemoService.GetLinkMetadata:output_type -> memos.api.LinkMetadata + 34, // 70: memos.api.MemoService.BatchGetLinkMetadata:output_type -> memos.api.BatchGetLinkMetadataResponse 51, // [51:71] is the sub-list for method output_type 31, // [31:51] is the sub-list for method input_type 31, // [31:31] is the sub-list for extension type_name @@ -2681,31 +2738,31 @@ var file_api_v1_memo_service_proto_depIdxs = []int32{ 0, // [0:31] is the sub-list for field type_name } -func init() { file_api_v1_memo_service_proto_init() } -func file_api_v1_memo_service_proto_init() { - if File_api_v1_memo_service_proto != nil { +func init() { file_api_memo_service_proto_init() } +func file_api_memo_service_proto_init() { + if File_api_memo_service_proto != nil { return } - file_api_v1_attachment_service_proto_init() - file_api_v1_common_proto_init() - file_api_v1_memo_service_proto_msgTypes[1].OneofWrappers = []any{} - file_api_v1_memo_service_proto_msgTypes[23].OneofWrappers = []any{} + file_api_attachment_service_proto_init() + file_api_common_proto_init() + file_api_memo_service_proto_msgTypes[0].OneofWrappers = []any{} + file_api_memo_service_proto_msgTypes[23].OneofWrappers = []any{} type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: unsafe.Slice(unsafe.StringData(file_api_v1_memo_service_proto_rawDesc), len(file_api_v1_memo_service_proto_rawDesc)), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_api_memo_service_proto_rawDesc), len(file_api_memo_service_proto_rawDesc)), NumEnums: 2, NumMessages: 35, NumExtensions: 0, NumServices: 1, }, - GoTypes: file_api_v1_memo_service_proto_goTypes, - DependencyIndexes: file_api_v1_memo_service_proto_depIdxs, - EnumInfos: file_api_v1_memo_service_proto_enumTypes, - MessageInfos: file_api_v1_memo_service_proto_msgTypes, + GoTypes: file_api_memo_service_proto_goTypes, + DependencyIndexes: file_api_memo_service_proto_depIdxs, + EnumInfos: file_api_memo_service_proto_enumTypes, + MessageInfos: file_api_memo_service_proto_msgTypes, }.Build() - File_api_v1_memo_service_proto = out.File - file_api_v1_memo_service_proto_goTypes = nil - file_api_v1_memo_service_proto_depIdxs = nil + File_api_memo_service_proto = out.File + file_api_memo_service_proto_goTypes = nil + file_api_memo_service_proto_depIdxs = nil } diff --git a/proto/gen/api/v1/memo_service.pb.gw.go b/proto/gen/api/memo_service.pb.gw.go similarity index 89% rename from proto/gen/api/v1/memo_service.pb.gw.go rename to proto/gen/api/memo_service.pb.gw.go index f1d2fd082..4dd863e27 100644 --- a/proto/gen/api/v1/memo_service.pb.gw.go +++ b/proto/gen/api/memo_service.pb.gw.go @@ -1,12 +1,12 @@ // Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: api/v1/memo_service.proto +// source: api/memo_service.proto /* -Package apiv1 is a reverse proxy. +Package api is a reverse proxy. It translates gRPC into RESTful JSON APIs. */ -package apiv1 +package api import ( "context" @@ -35,47 +35,6 @@ var ( _ = metadata.Join ) -var filter_MemoService_CreateMemo_0 = &utilities.DoubleArray{Encoding: map[string]int{"memo": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} - -func request_MemoService_CreateMemo_0(ctx context.Context, marshaler runtime.Marshaler, client MemoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var ( - protoReq CreateMemoRequest - metadata runtime.ServerMetadata - ) - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.Memo); err != nil && !errors.Is(err, io.EOF) { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_MemoService_CreateMemo_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if req.Body != nil { - _, _ = io.Copy(io.Discard, req.Body) - } - msg, err := client.CreateMemo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err -} - -func local_request_MemoService_CreateMemo_0(ctx context.Context, marshaler runtime.Marshaler, server MemoServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var ( - protoReq CreateMemoRequest - metadata runtime.ServerMetadata - ) - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.Memo); err != nil && !errors.Is(err, io.EOF) { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_MemoService_CreateMemo_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - msg, err := server.CreateMemo(ctx, &protoReq) - return msg, metadata, err -} - var filter_MemoService_ListMemos_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} func request_MemoService_ListMemos_0(ctx context.Context, marshaler runtime.Marshaler, client MemoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -150,6 +109,47 @@ func local_request_MemoService_GetMemo_0(ctx context.Context, marshaler runtime. return msg, metadata, err } +var filter_MemoService_CreateMemo_0 = &utilities.DoubleArray{Encoding: map[string]int{"memo": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} + +func request_MemoService_CreateMemo_0(ctx context.Context, marshaler runtime.Marshaler, client MemoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq CreateMemoRequest + metadata runtime.ServerMetadata + ) + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.Memo); err != nil && !errors.Is(err, io.EOF) { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_MemoService_CreateMemo_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if req.Body != nil { + _, _ = io.Copy(io.Discard, req.Body) + } + msg, err := client.CreateMemo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err +} + +func local_request_MemoService_CreateMemo_0(ctx context.Context, marshaler runtime.Marshaler, server MemoServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq CreateMemoRequest + metadata runtime.ServerMetadata + ) + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.Memo); err != nil && !errors.Is(err, io.EOF) { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_MemoService_CreateMemo_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + msg, err := server.CreateMemo(ctx, &protoReq) + return msg, metadata, err +} + var filter_MemoService_UpdateMemo_0 = &utilities.DoubleArray{Encoding: map[string]int{"memo": 0, "name": 1}, Base: []int{1, 2, 1, 0, 0}, Check: []int{0, 1, 2, 3, 2}} func request_MemoService_UpdateMemo_0(ctx context.Context, marshaler runtime.Marshaler, client MemoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -284,6 +284,59 @@ func local_request_MemoService_DeleteMemo_0(ctx context.Context, marshaler runti return msg, metadata, err } +var filter_MemoService_ListMemoAttachments_0 = &utilities.DoubleArray{Encoding: map[string]int{"parent": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} + +func request_MemoService_ListMemoAttachments_0(ctx context.Context, marshaler runtime.Marshaler, client MemoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq ListMemoAttachmentsRequest + metadata runtime.ServerMetadata + err error + ) + val, ok := pathParams["parent"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent") + } + protoReq.Parent, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err) + } + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_MemoService_ListMemoAttachments_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if req.Body != nil { + _, _ = io.Copy(io.Discard, req.Body) + } + msg, err := client.ListMemoAttachments(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err +} + +func local_request_MemoService_ListMemoAttachments_0(ctx context.Context, marshaler runtime.Marshaler, server MemoServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq ListMemoAttachmentsRequest + metadata runtime.ServerMetadata + err error + ) + val, ok := pathParams["parent"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent") + } + protoReq.Parent, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err) + } + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_MemoService_ListMemoAttachments_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + msg, err := server.ListMemoAttachments(ctx, &protoReq) + return msg, metadata, err +} + func request_MemoService_SetMemoAttachments_0(ctx context.Context, marshaler runtime.Marshaler, client MemoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var ( protoReq SetMemoAttachmentsRequest @@ -329,56 +382,56 @@ func local_request_MemoService_SetMemoAttachments_0(ctx context.Context, marshal return msg, metadata, err } -var filter_MemoService_ListMemoAttachments_0 = &utilities.DoubleArray{Encoding: map[string]int{"name": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +var filter_MemoService_ListMemoRelations_0 = &utilities.DoubleArray{Encoding: map[string]int{"parent": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} -func request_MemoService_ListMemoAttachments_0(ctx context.Context, marshaler runtime.Marshaler, client MemoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func request_MemoService_ListMemoRelations_0(ctx context.Context, marshaler runtime.Marshaler, client MemoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var ( - protoReq ListMemoAttachmentsRequest + protoReq ListMemoRelationsRequest metadata runtime.ServerMetadata err error ) - val, ok := pathParams["name"] + val, ok := pathParams["parent"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent") } - protoReq.Name, err = runtime.String(val) + protoReq.Parent, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_MemoService_ListMemoAttachments_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_MemoService_ListMemoRelations_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if req.Body != nil { _, _ = io.Copy(io.Discard, req.Body) } - msg, err := client.ListMemoAttachments(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.ListMemoRelations(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_MemoService_ListMemoAttachments_0(ctx context.Context, marshaler runtime.Marshaler, server MemoServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func local_request_MemoService_ListMemoRelations_0(ctx context.Context, marshaler runtime.Marshaler, server MemoServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var ( - protoReq ListMemoAttachmentsRequest + protoReq ListMemoRelationsRequest metadata runtime.ServerMetadata err error ) - val, ok := pathParams["name"] + val, ok := pathParams["parent"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent") } - protoReq.Name, err = runtime.String(val) + protoReq.Parent, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_MemoService_ListMemoAttachments_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_MemoService_ListMemoRelations_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := server.ListMemoAttachments(ctx, &protoReq) + msg, err := server.ListMemoRelations(ctx, &protoReq) return msg, metadata, err } @@ -427,60 +480,60 @@ func local_request_MemoService_SetMemoRelations_0(ctx context.Context, marshaler return msg, metadata, err } -var filter_MemoService_ListMemoRelations_0 = &utilities.DoubleArray{Encoding: map[string]int{"name": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +var filter_MemoService_ListMemoComments_0 = &utilities.DoubleArray{Encoding: map[string]int{"parent": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} -func request_MemoService_ListMemoRelations_0(ctx context.Context, marshaler runtime.Marshaler, client MemoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func request_MemoService_ListMemoComments_0(ctx context.Context, marshaler runtime.Marshaler, client MemoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var ( - protoReq ListMemoRelationsRequest + protoReq ListMemoCommentsRequest metadata runtime.ServerMetadata err error ) - val, ok := pathParams["name"] + val, ok := pathParams["parent"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent") } - protoReq.Name, err = runtime.String(val) + protoReq.Parent, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_MemoService_ListMemoRelations_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_MemoService_ListMemoComments_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if req.Body != nil { _, _ = io.Copy(io.Discard, req.Body) } - msg, err := client.ListMemoRelations(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.ListMemoComments(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_MemoService_ListMemoRelations_0(ctx context.Context, marshaler runtime.Marshaler, server MemoServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func local_request_MemoService_ListMemoComments_0(ctx context.Context, marshaler runtime.Marshaler, server MemoServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var ( - protoReq ListMemoRelationsRequest + protoReq ListMemoCommentsRequest metadata runtime.ServerMetadata err error ) - val, ok := pathParams["name"] + val, ok := pathParams["parent"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent") } - protoReq.Name, err = runtime.String(val) + protoReq.Parent, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_MemoService_ListMemoRelations_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_MemoService_ListMemoComments_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := server.ListMemoRelations(ctx, &protoReq) + msg, err := server.ListMemoComments(ctx, &protoReq) return msg, metadata, err } -var filter_MemoService_CreateMemoComment_0 = &utilities.DoubleArray{Encoding: map[string]int{"comment": 0, "name": 1}, Base: []int{1, 1, 2, 0, 0}, Check: []int{0, 1, 1, 2, 3}} +var filter_MemoService_CreateMemoComment_0 = &utilities.DoubleArray{Encoding: map[string]int{"comment": 0, "parent": 1}, Base: []int{1, 1, 2, 0, 0}, Check: []int{0, 1, 1, 2, 3}} func request_MemoService_CreateMemoComment_0(ctx context.Context, marshaler runtime.Marshaler, client MemoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var ( @@ -491,13 +544,13 @@ func request_MemoService_CreateMemoComment_0(ctx context.Context, marshaler runt if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.Comment); err != nil && !errors.Is(err, io.EOF) { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - val, ok := pathParams["name"] + val, ok := pathParams["parent"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent") } - protoReq.Name, err = runtime.String(val) + protoReq.Parent, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) @@ -521,13 +574,13 @@ func local_request_MemoService_CreateMemoComment_0(ctx context.Context, marshale if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.Comment); err != nil && !errors.Is(err, io.EOF) { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - val, ok := pathParams["name"] + val, ok := pathParams["parent"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent") } - protoReq.Name, err = runtime.String(val) + protoReq.Parent, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) @@ -539,60 +592,7 @@ func local_request_MemoService_CreateMemoComment_0(ctx context.Context, marshale return msg, metadata, err } -var filter_MemoService_ListMemoComments_0 = &utilities.DoubleArray{Encoding: map[string]int{"name": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} - -func request_MemoService_ListMemoComments_0(ctx context.Context, marshaler runtime.Marshaler, client MemoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var ( - protoReq ListMemoCommentsRequest - metadata runtime.ServerMetadata - err error - ) - val, ok := pathParams["name"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") - } - protoReq.Name, err = runtime.String(val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) - } - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_MemoService_ListMemoComments_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if req.Body != nil { - _, _ = io.Copy(io.Discard, req.Body) - } - msg, err := client.ListMemoComments(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err -} - -func local_request_MemoService_ListMemoComments_0(ctx context.Context, marshaler runtime.Marshaler, server MemoServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var ( - protoReq ListMemoCommentsRequest - metadata runtime.ServerMetadata - err error - ) - val, ok := pathParams["name"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") - } - protoReq.Name, err = runtime.String(val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) - } - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_MemoService_ListMemoComments_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - msg, err := server.ListMemoComments(ctx, &protoReq) - return msg, metadata, err -} - -var filter_MemoService_ListMemoReactions_0 = &utilities.DoubleArray{Encoding: map[string]int{"name": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +var filter_MemoService_ListMemoReactions_0 = &utilities.DoubleArray{Encoding: map[string]int{"parent": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} func request_MemoService_ListMemoReactions_0(ctx context.Context, marshaler runtime.Marshaler, client MemoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var ( @@ -600,13 +600,13 @@ func request_MemoService_ListMemoReactions_0(ctx context.Context, marshaler runt metadata runtime.ServerMetadata err error ) - val, ok := pathParams["name"] + val, ok := pathParams["parent"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent") } - protoReq.Name, err = runtime.String(val) + protoReq.Parent, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) @@ -627,13 +627,13 @@ func local_request_MemoService_ListMemoReactions_0(ctx context.Context, marshale metadata runtime.ServerMetadata err error ) - val, ok := pathParams["name"] + val, ok := pathParams["parent"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent") } - protoReq.Name, err = runtime.String(val) + protoReq.Parent, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) @@ -645,51 +645,6 @@ func local_request_MemoService_ListMemoReactions_0(ctx context.Context, marshale return msg, metadata, err } -func request_MemoService_UpsertMemoReaction_0(ctx context.Context, marshaler runtime.Marshaler, client MemoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var ( - protoReq UpsertMemoReactionRequest - metadata runtime.ServerMetadata - err error - ) - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - val, ok := pathParams["name"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") - } - protoReq.Name, err = runtime.String(val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) - } - if req.Body != nil { - _, _ = io.Copy(io.Discard, req.Body) - } - msg, err := client.UpsertMemoReaction(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err -} - -func local_request_MemoService_UpsertMemoReaction_0(ctx context.Context, marshaler runtime.Marshaler, server MemoServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var ( - protoReq UpsertMemoReactionRequest - metadata runtime.ServerMetadata - err error - ) - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - val, ok := pathParams["name"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") - } - protoReq.Name, err = runtime.String(val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) - } - msg, err := server.UpsertMemoReaction(ctx, &protoReq) - return msg, metadata, err -} - func request_MemoService_DeleteMemoReaction_0(ctx context.Context, marshaler runtime.Marshaler, client MemoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var ( protoReq DeleteMemoReactionRequest @@ -729,6 +684,90 @@ func local_request_MemoService_DeleteMemoReaction_0(ctx context.Context, marshal return msg, metadata, err } +func request_MemoService_UpsertMemoReaction_0(ctx context.Context, marshaler runtime.Marshaler, client MemoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq UpsertMemoReactionRequest + metadata runtime.ServerMetadata + err error + ) + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + val, ok := pathParams["parent"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent") + } + protoReq.Parent, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err) + } + if req.Body != nil { + _, _ = io.Copy(io.Discard, req.Body) + } + msg, err := client.UpsertMemoReaction(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err +} + +func local_request_MemoService_UpsertMemoReaction_0(ctx context.Context, marshaler runtime.Marshaler, server MemoServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq UpsertMemoReactionRequest + metadata runtime.ServerMetadata + err error + ) + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + val, ok := pathParams["parent"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent") + } + protoReq.Parent, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err) + } + msg, err := server.UpsertMemoReaction(ctx, &protoReq) + return msg, metadata, err +} + +func request_MemoService_ListMemoShares_0(ctx context.Context, marshaler runtime.Marshaler, client MemoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq ListMemoSharesRequest + metadata runtime.ServerMetadata + err error + ) + val, ok := pathParams["parent"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent") + } + protoReq.Parent, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err) + } + if req.Body != nil { + _, _ = io.Copy(io.Discard, req.Body) + } + msg, err := client.ListMemoShares(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err +} + +func local_request_MemoService_ListMemoShares_0(ctx context.Context, marshaler runtime.Marshaler, server MemoServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq ListMemoSharesRequest + metadata runtime.ServerMetadata + err error + ) + val, ok := pathParams["parent"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent") + } + protoReq.Parent, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err) + } + msg, err := server.ListMemoShares(ctx, &protoReq) + return msg, metadata, err +} + func request_MemoService_CreateMemoShare_0(ctx context.Context, marshaler runtime.Marshaler, client MemoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var ( protoReq CreateMemoShareRequest @@ -774,45 +813,6 @@ func local_request_MemoService_CreateMemoShare_0(ctx context.Context, marshaler return msg, metadata, err } -func request_MemoService_ListMemoShares_0(ctx context.Context, marshaler runtime.Marshaler, client MemoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var ( - protoReq ListMemoSharesRequest - metadata runtime.ServerMetadata - err error - ) - val, ok := pathParams["parent"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent") - } - protoReq.Parent, err = runtime.String(val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err) - } - if req.Body != nil { - _, _ = io.Copy(io.Discard, req.Body) - } - msg, err := client.ListMemoShares(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err -} - -func local_request_MemoService_ListMemoShares_0(ctx context.Context, marshaler runtime.Marshaler, server MemoServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var ( - protoReq ListMemoSharesRequest - metadata runtime.ServerMetadata - err error - ) - val, ok := pathParams["parent"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent") - } - protoReq.Parent, err = runtime.String(val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err) - } - msg, err := server.ListMemoShares(ctx, &protoReq) - return msg, metadata, err -} - func request_MemoService_DeleteMemoShare_0(ctx context.Context, marshaler runtime.Marshaler, client MemoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var ( protoReq DeleteMemoShareRequest @@ -959,33 +959,13 @@ func local_request_MemoService_BatchGetLinkMetadata_0(ctx context.Context, marsh // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterMemoServiceHandlerFromEndpoint instead. // GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call. func RegisterMemoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server MemoServiceServer) error { - mux.Handle(http.MethodPost, pattern_MemoService_CreateMemo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.MemoService/CreateMemo", runtime.WithHTTPPathPattern("/api/v1/memos")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_MemoService_CreateMemo_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - forward_MemoService_CreateMemo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle(http.MethodGet, pattern_MemoService_ListMemos_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.MemoService/ListMemos", runtime.WithHTTPPathPattern("/api/v1/memos")) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.MemoService/ListMemos", runtime.WithHTTPPathPattern("/api/memos")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -1005,7 +985,7 @@ func RegisterMemoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.MemoService/GetMemo", runtime.WithHTTPPathPattern("/api/v1/{name=memos/*}")) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.MemoService/GetMemo", runtime.WithHTTPPathPattern("/api/{name=memos/*}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -1019,13 +999,33 @@ func RegisterMemoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux } forward_MemoService_GetMemo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) + mux.Handle(http.MethodPost, pattern_MemoService_CreateMemo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.MemoService/CreateMemo", runtime.WithHTTPPathPattern("/api/memos")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_MemoService_CreateMemo_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_MemoService_CreateMemo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) mux.Handle(http.MethodPatch, pattern_MemoService_UpdateMemo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.MemoService/UpdateMemo", runtime.WithHTTPPathPattern("/api/v1/{memo.name=memos/*}")) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.MemoService/UpdateMemo", runtime.WithHTTPPathPattern("/api/{memo.name=memos/*}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -1045,7 +1045,7 @@ func RegisterMemoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.MemoService/DeleteMemo", runtime.WithHTTPPathPattern("/api/v1/{name=memos/*}")) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.MemoService/DeleteMemo", runtime.WithHTTPPathPattern("/api/{name=memos/*}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -1059,33 +1059,13 @@ func RegisterMemoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux } forward_MemoService_DeleteMemo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle(http.MethodPatch, pattern_MemoService_SetMemoAttachments_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.MemoService/SetMemoAttachments", runtime.WithHTTPPathPattern("/api/v1/{name=memos/*}/attachments")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_MemoService_SetMemoAttachments_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - forward_MemoService_SetMemoAttachments_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle(http.MethodGet, pattern_MemoService_ListMemoAttachments_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.MemoService/ListMemoAttachments", runtime.WithHTTPPathPattern("/api/v1/{name=memos/*}/attachments")) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.MemoService/ListMemoAttachments", runtime.WithHTTPPathPattern("/api/{parent=memos/*}/attachments")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -1099,25 +1079,25 @@ func RegisterMemoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux } forward_MemoService_ListMemoAttachments_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle(http.MethodPatch, pattern_MemoService_SetMemoRelations_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle(http.MethodPatch, pattern_MemoService_SetMemoAttachments_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.MemoService/SetMemoRelations", runtime.WithHTTPPathPattern("/api/v1/{name=memos/*}/relations")) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.MemoService/SetMemoAttachments", runtime.WithHTTPPathPattern("/api/{name=memos/*}/attachments")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_MemoService_SetMemoRelations_0(annotatedContext, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_MemoService_SetMemoAttachments_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } - forward_MemoService_SetMemoRelations_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_MemoService_SetMemoAttachments_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle(http.MethodGet, pattern_MemoService_ListMemoRelations_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) @@ -1125,7 +1105,7 @@ func RegisterMemoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.MemoService/ListMemoRelations", runtime.WithHTTPPathPattern("/api/v1/{name=memos/*}/relations")) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.MemoService/ListMemoRelations", runtime.WithHTTPPathPattern("/api/{parent=memos/*}/relations")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -1139,25 +1119,25 @@ func RegisterMemoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux } forward_MemoService_ListMemoRelations_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle(http.MethodPost, pattern_MemoService_CreateMemoComment_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle(http.MethodPatch, pattern_MemoService_SetMemoRelations_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.MemoService/CreateMemoComment", runtime.WithHTTPPathPattern("/api/v1/{name=memos/*}/comments")) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.MemoService/SetMemoRelations", runtime.WithHTTPPathPattern("/api/{name=memos/*}/relations")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_MemoService_CreateMemoComment_0(annotatedContext, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_MemoService_SetMemoRelations_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } - forward_MemoService_CreateMemoComment_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_MemoService_SetMemoRelations_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle(http.MethodGet, pattern_MemoService_ListMemoComments_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) @@ -1165,7 +1145,7 @@ func RegisterMemoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.MemoService/ListMemoComments", runtime.WithHTTPPathPattern("/api/v1/{name=memos/*}/comments")) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.MemoService/ListMemoComments", runtime.WithHTTPPathPattern("/api/{parent=memos/*}/comments")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -1179,13 +1159,33 @@ func RegisterMemoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux } forward_MemoService_ListMemoComments_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) + mux.Handle(http.MethodPost, pattern_MemoService_CreateMemoComment_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.MemoService/CreateMemoComment", runtime.WithHTTPPathPattern("/api/{parent=memos/*}/comments")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_MemoService_CreateMemoComment_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_MemoService_CreateMemoComment_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) mux.Handle(http.MethodGet, pattern_MemoService_ListMemoReactions_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.MemoService/ListMemoReactions", runtime.WithHTTPPathPattern("/api/v1/{name=memos/*}/reactions")) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.MemoService/ListMemoReactions", runtime.WithHTTPPathPattern("/api/{parent=memos/*}/reactions")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -1199,33 +1199,13 @@ func RegisterMemoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux } forward_MemoService_ListMemoReactions_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle(http.MethodPost, pattern_MemoService_UpsertMemoReaction_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.MemoService/UpsertMemoReaction", runtime.WithHTTPPathPattern("/api/v1/{name=memos/*}/reactions")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_MemoService_UpsertMemoReaction_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - forward_MemoService_UpsertMemoReaction_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle(http.MethodDelete, pattern_MemoService_DeleteMemoReaction_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.MemoService/DeleteMemoReaction", runtime.WithHTTPPathPattern("/api/v1/{name=memos/*/reactions/*}")) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.MemoService/DeleteMemoReaction", runtime.WithHTTPPathPattern("/api/{name=memos/*/reactions/*}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -1239,25 +1219,25 @@ func RegisterMemoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux } forward_MemoService_DeleteMemoReaction_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle(http.MethodPost, pattern_MemoService_CreateMemoShare_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle(http.MethodPost, pattern_MemoService_UpsertMemoReaction_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.MemoService/CreateMemoShare", runtime.WithHTTPPathPattern("/api/v1/{parent=memos/*}/shares")) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.MemoService/UpsertMemoReaction", runtime.WithHTTPPathPattern("/api/{parent=memos/*}/reactions")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_MemoService_CreateMemoShare_0(annotatedContext, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_MemoService_UpsertMemoReaction_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } - forward_MemoService_CreateMemoShare_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_MemoService_UpsertMemoReaction_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle(http.MethodGet, pattern_MemoService_ListMemoShares_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) @@ -1265,7 +1245,7 @@ func RegisterMemoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.MemoService/ListMemoShares", runtime.WithHTTPPathPattern("/api/v1/{parent=memos/*}/shares")) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.MemoService/ListMemoShares", runtime.WithHTTPPathPattern("/api/{parent=memos/*}/shares")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -1279,13 +1259,33 @@ func RegisterMemoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux } forward_MemoService_ListMemoShares_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) + mux.Handle(http.MethodPost, pattern_MemoService_CreateMemoShare_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.MemoService/CreateMemoShare", runtime.WithHTTPPathPattern("/api/{parent=memos/*}/shares")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_MemoService_CreateMemoShare_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_MemoService_CreateMemoShare_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) mux.Handle(http.MethodDelete, pattern_MemoService_DeleteMemoShare_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.MemoService/DeleteMemoShare", runtime.WithHTTPPathPattern("/api/v1/{name=memos/*/shares/*}")) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.MemoService/DeleteMemoShare", runtime.WithHTTPPathPattern("/api/{name=memos/*/shares/*}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -1305,7 +1305,7 @@ func RegisterMemoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.MemoService/GetSharedMemo", runtime.WithHTTPPathPattern("/api/v1/shares/{share_token}/memo")) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.MemoService/GetSharedMemo", runtime.WithHTTPPathPattern("/api/shares/{share_token}/memo")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -1325,7 +1325,7 @@ func RegisterMemoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.MemoService/GetLinkMetadata", runtime.WithHTTPPathPattern("/api/v1/memos/-/linkMetadata")) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.MemoService/GetLinkMetadata", runtime.WithHTTPPathPattern("/api/memos/-/linkMetadata")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -1345,7 +1345,7 @@ func RegisterMemoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.MemoService/BatchGetLinkMetadata", runtime.WithHTTPPathPattern("/api/v1/memos/-/linkMetadata:batchGet")) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.MemoService/BatchGetLinkMetadata", runtime.WithHTTPPathPattern("/api/memos/-/linkMetadata:batchGet")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -1399,28 +1399,11 @@ func RegisterMemoServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in // "MemoServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares. func RegisterMemoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client MemoServiceClient) error { - mux.Handle(http.MethodPost, pattern_MemoService_CreateMemo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.MemoService/CreateMemo", runtime.WithHTTPPathPattern("/api/v1/memos")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_MemoService_CreateMemo_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - forward_MemoService_CreateMemo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle(http.MethodGet, pattern_MemoService_ListMemos_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.MemoService/ListMemos", runtime.WithHTTPPathPattern("/api/v1/memos")) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.MemoService/ListMemos", runtime.WithHTTPPathPattern("/api/memos")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -1437,7 +1420,7 @@ func RegisterMemoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.MemoService/GetMemo", runtime.WithHTTPPathPattern("/api/v1/{name=memos/*}")) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.MemoService/GetMemo", runtime.WithHTTPPathPattern("/api/{name=memos/*}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -1450,11 +1433,28 @@ func RegisterMemoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux } forward_MemoService_GetMemo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) + mux.Handle(http.MethodPost, pattern_MemoService_CreateMemo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.MemoService/CreateMemo", runtime.WithHTTPPathPattern("/api/memos")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_MemoService_CreateMemo_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_MemoService_CreateMemo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) mux.Handle(http.MethodPatch, pattern_MemoService_UpdateMemo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.MemoService/UpdateMemo", runtime.WithHTTPPathPattern("/api/v1/{memo.name=memos/*}")) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.MemoService/UpdateMemo", runtime.WithHTTPPathPattern("/api/{memo.name=memos/*}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -1471,7 +1471,7 @@ func RegisterMemoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.MemoService/DeleteMemo", runtime.WithHTTPPathPattern("/api/v1/{name=memos/*}")) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.MemoService/DeleteMemo", runtime.WithHTTPPathPattern("/api/{name=memos/*}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -1484,28 +1484,11 @@ func RegisterMemoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux } forward_MemoService_DeleteMemo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle(http.MethodPatch, pattern_MemoService_SetMemoAttachments_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.MemoService/SetMemoAttachments", runtime.WithHTTPPathPattern("/api/v1/{name=memos/*}/attachments")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_MemoService_SetMemoAttachments_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - forward_MemoService_SetMemoAttachments_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle(http.MethodGet, pattern_MemoService_ListMemoAttachments_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.MemoService/ListMemoAttachments", runtime.WithHTTPPathPattern("/api/v1/{name=memos/*}/attachments")) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.MemoService/ListMemoAttachments", runtime.WithHTTPPathPattern("/api/{parent=memos/*}/attachments")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -1518,28 +1501,28 @@ func RegisterMemoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux } forward_MemoService_ListMemoAttachments_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle(http.MethodPatch, pattern_MemoService_SetMemoRelations_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle(http.MethodPatch, pattern_MemoService_SetMemoAttachments_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.MemoService/SetMemoRelations", runtime.WithHTTPPathPattern("/api/v1/{name=memos/*}/relations")) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.MemoService/SetMemoAttachments", runtime.WithHTTPPathPattern("/api/{name=memos/*}/attachments")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_MemoService_SetMemoRelations_0(annotatedContext, inboundMarshaler, client, req, pathParams) + resp, md, err := request_MemoService_SetMemoAttachments_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } - forward_MemoService_SetMemoRelations_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_MemoService_SetMemoAttachments_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle(http.MethodGet, pattern_MemoService_ListMemoRelations_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.MemoService/ListMemoRelations", runtime.WithHTTPPathPattern("/api/v1/{name=memos/*}/relations")) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.MemoService/ListMemoRelations", runtime.WithHTTPPathPattern("/api/{parent=memos/*}/relations")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -1552,28 +1535,28 @@ func RegisterMemoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux } forward_MemoService_ListMemoRelations_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle(http.MethodPost, pattern_MemoService_CreateMemoComment_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle(http.MethodPatch, pattern_MemoService_SetMemoRelations_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.MemoService/CreateMemoComment", runtime.WithHTTPPathPattern("/api/v1/{name=memos/*}/comments")) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.MemoService/SetMemoRelations", runtime.WithHTTPPathPattern("/api/{name=memos/*}/relations")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_MemoService_CreateMemoComment_0(annotatedContext, inboundMarshaler, client, req, pathParams) + resp, md, err := request_MemoService_SetMemoRelations_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } - forward_MemoService_CreateMemoComment_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_MemoService_SetMemoRelations_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle(http.MethodGet, pattern_MemoService_ListMemoComments_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.MemoService/ListMemoComments", runtime.WithHTTPPathPattern("/api/v1/{name=memos/*}/comments")) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.MemoService/ListMemoComments", runtime.WithHTTPPathPattern("/api/{parent=memos/*}/comments")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -1586,11 +1569,28 @@ func RegisterMemoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux } forward_MemoService_ListMemoComments_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) + mux.Handle(http.MethodPost, pattern_MemoService_CreateMemoComment_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.MemoService/CreateMemoComment", runtime.WithHTTPPathPattern("/api/{parent=memos/*}/comments")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_MemoService_CreateMemoComment_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_MemoService_CreateMemoComment_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) mux.Handle(http.MethodGet, pattern_MemoService_ListMemoReactions_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.MemoService/ListMemoReactions", runtime.WithHTTPPathPattern("/api/v1/{name=memos/*}/reactions")) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.MemoService/ListMemoReactions", runtime.WithHTTPPathPattern("/api/{parent=memos/*}/reactions")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -1603,28 +1603,11 @@ func RegisterMemoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux } forward_MemoService_ListMemoReactions_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle(http.MethodPost, pattern_MemoService_UpsertMemoReaction_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.MemoService/UpsertMemoReaction", runtime.WithHTTPPathPattern("/api/v1/{name=memos/*}/reactions")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_MemoService_UpsertMemoReaction_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - forward_MemoService_UpsertMemoReaction_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle(http.MethodDelete, pattern_MemoService_DeleteMemoReaction_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.MemoService/DeleteMemoReaction", runtime.WithHTTPPathPattern("/api/v1/{name=memos/*/reactions/*}")) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.MemoService/DeleteMemoReaction", runtime.WithHTTPPathPattern("/api/{name=memos/*/reactions/*}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -1637,28 +1620,28 @@ func RegisterMemoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux } forward_MemoService_DeleteMemoReaction_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle(http.MethodPost, pattern_MemoService_CreateMemoShare_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle(http.MethodPost, pattern_MemoService_UpsertMemoReaction_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.MemoService/CreateMemoShare", runtime.WithHTTPPathPattern("/api/v1/{parent=memos/*}/shares")) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.MemoService/UpsertMemoReaction", runtime.WithHTTPPathPattern("/api/{parent=memos/*}/reactions")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_MemoService_CreateMemoShare_0(annotatedContext, inboundMarshaler, client, req, pathParams) + resp, md, err := request_MemoService_UpsertMemoReaction_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } - forward_MemoService_CreateMemoShare_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_MemoService_UpsertMemoReaction_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle(http.MethodGet, pattern_MemoService_ListMemoShares_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.MemoService/ListMemoShares", runtime.WithHTTPPathPattern("/api/v1/{parent=memos/*}/shares")) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.MemoService/ListMemoShares", runtime.WithHTTPPathPattern("/api/{parent=memos/*}/shares")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -1671,11 +1654,28 @@ func RegisterMemoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux } forward_MemoService_ListMemoShares_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) + mux.Handle(http.MethodPost, pattern_MemoService_CreateMemoShare_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.MemoService/CreateMemoShare", runtime.WithHTTPPathPattern("/api/{parent=memos/*}/shares")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_MemoService_CreateMemoShare_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_MemoService_CreateMemoShare_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) mux.Handle(http.MethodDelete, pattern_MemoService_DeleteMemoShare_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.MemoService/DeleteMemoShare", runtime.WithHTTPPathPattern("/api/v1/{name=memos/*/shares/*}")) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.MemoService/DeleteMemoShare", runtime.WithHTTPPathPattern("/api/{name=memos/*/shares/*}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -1692,7 +1692,7 @@ func RegisterMemoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.MemoService/GetSharedMemo", runtime.WithHTTPPathPattern("/api/v1/shares/{share_token}/memo")) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.MemoService/GetSharedMemo", runtime.WithHTTPPathPattern("/api/shares/{share_token}/memo")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -1709,7 +1709,7 @@ func RegisterMemoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.MemoService/GetLinkMetadata", runtime.WithHTTPPathPattern("/api/v1/memos/-/linkMetadata")) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.MemoService/GetLinkMetadata", runtime.WithHTTPPathPattern("/api/memos/-/linkMetadata")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -1726,7 +1726,7 @@ func RegisterMemoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.MemoService/BatchGetLinkMetadata", runtime.WithHTTPPathPattern("/api/v1/memos/-/linkMetadata:batchGet")) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.MemoService/BatchGetLinkMetadata", runtime.WithHTTPPathPattern("/api/memos/-/linkMetadata:batchGet")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -1743,45 +1743,45 @@ func RegisterMemoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux } var ( - pattern_MemoService_CreateMemo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "v1", "memos"}, "")) - pattern_MemoService_ListMemos_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "v1", "memos"}, "")) - pattern_MemoService_GetMemo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3}, []string{"api", "v1", "memos", "name"}, "")) - pattern_MemoService_UpdateMemo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3}, []string{"api", "v1", "memos", "memo.name"}, "")) - pattern_MemoService_DeleteMemo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3}, []string{"api", "v1", "memos", "name"}, "")) - pattern_MemoService_SetMemoAttachments_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3, 2, 4}, []string{"api", "v1", "memos", "name", "attachments"}, "")) - pattern_MemoService_ListMemoAttachments_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3, 2, 4}, []string{"api", "v1", "memos", "name", "attachments"}, "")) - pattern_MemoService_SetMemoRelations_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3, 2, 4}, []string{"api", "v1", "memos", "name", "relations"}, "")) - pattern_MemoService_ListMemoRelations_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3, 2, 4}, []string{"api", "v1", "memos", "name", "relations"}, "")) - pattern_MemoService_CreateMemoComment_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3, 2, 4}, []string{"api", "v1", "memos", "name", "comments"}, "")) - pattern_MemoService_ListMemoComments_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3, 2, 4}, []string{"api", "v1", "memos", "name", "comments"}, "")) - pattern_MemoService_ListMemoReactions_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3, 2, 4}, []string{"api", "v1", "memos", "name", "reactions"}, "")) - pattern_MemoService_UpsertMemoReaction_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3, 2, 4}, []string{"api", "v1", "memos", "name", "reactions"}, "")) - pattern_MemoService_DeleteMemoReaction_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 2, 3, 1, 0, 4, 4, 5, 4}, []string{"api", "v1", "memos", "reactions", "name"}, "")) - pattern_MemoService_CreateMemoShare_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3, 2, 4}, []string{"api", "v1", "memos", "parent", "shares"}, "")) - pattern_MemoService_ListMemoShares_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3, 2, 4}, []string{"api", "v1", "memos", "parent", "shares"}, "")) - pattern_MemoService_DeleteMemoShare_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 2, 3, 1, 0, 4, 4, 5, 4}, []string{"api", "v1", "memos", "shares", "name"}, "")) - pattern_MemoService_GetSharedMemo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 2, 4}, []string{"api", "v1", "shares", "share_token", "memo"}, "")) - pattern_MemoService_GetLinkMetadata_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"api", "v1", "memos", "-", "linkMetadata"}, "")) - pattern_MemoService_BatchGetLinkMetadata_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"api", "v1", "memos", "-", "linkMetadata"}, "batchGet")) + pattern_MemoService_ListMemos_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"api", "memos"}, "")) + pattern_MemoService_GetMemo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"api", "memos", "name"}, "")) + pattern_MemoService_CreateMemo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"api", "memos"}, "")) + pattern_MemoService_UpdateMemo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"api", "memos", "memo.name"}, "")) + pattern_MemoService_DeleteMemo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"api", "memos", "name"}, "")) + pattern_MemoService_ListMemoAttachments_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2, 2, 3}, []string{"api", "memos", "parent", "attachments"}, "")) + pattern_MemoService_SetMemoAttachments_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2, 2, 3}, []string{"api", "memos", "name", "attachments"}, "")) + pattern_MemoService_ListMemoRelations_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2, 2, 3}, []string{"api", "memos", "parent", "relations"}, "")) + pattern_MemoService_SetMemoRelations_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2, 2, 3}, []string{"api", "memos", "name", "relations"}, "")) + pattern_MemoService_ListMemoComments_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2, 2, 3}, []string{"api", "memos", "parent", "comments"}, "")) + pattern_MemoService_CreateMemoComment_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2, 2, 3}, []string{"api", "memos", "parent", "comments"}, "")) + pattern_MemoService_ListMemoReactions_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2, 2, 3}, []string{"api", "memos", "parent", "reactions"}, "")) + pattern_MemoService_DeleteMemoReaction_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 4, 4, 5, 3}, []string{"api", "memos", "reactions", "name"}, "")) + pattern_MemoService_UpsertMemoReaction_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2, 2, 3}, []string{"api", "memos", "parent", "reactions"}, "")) + pattern_MemoService_ListMemoShares_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2, 2, 3}, []string{"api", "memos", "parent", "shares"}, "")) + pattern_MemoService_CreateMemoShare_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2, 2, 3}, []string{"api", "memos", "parent", "shares"}, "")) + pattern_MemoService_DeleteMemoShare_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 4, 4, 5, 3}, []string{"api", "memos", "shares", "name"}, "")) + pattern_MemoService_GetSharedMemo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"api", "shares", "share_token", "memo"}, "")) + pattern_MemoService_GetLinkMetadata_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"api", "memos", "-", "linkMetadata"}, "")) + pattern_MemoService_BatchGetLinkMetadata_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"api", "memos", "-", "linkMetadata"}, "batchGet")) ) var ( - forward_MemoService_CreateMemo_0 = runtime.ForwardResponseMessage forward_MemoService_ListMemos_0 = runtime.ForwardResponseMessage forward_MemoService_GetMemo_0 = runtime.ForwardResponseMessage + forward_MemoService_CreateMemo_0 = runtime.ForwardResponseMessage forward_MemoService_UpdateMemo_0 = runtime.ForwardResponseMessage forward_MemoService_DeleteMemo_0 = runtime.ForwardResponseMessage - forward_MemoService_SetMemoAttachments_0 = runtime.ForwardResponseMessage forward_MemoService_ListMemoAttachments_0 = runtime.ForwardResponseMessage - forward_MemoService_SetMemoRelations_0 = runtime.ForwardResponseMessage + forward_MemoService_SetMemoAttachments_0 = runtime.ForwardResponseMessage forward_MemoService_ListMemoRelations_0 = runtime.ForwardResponseMessage - forward_MemoService_CreateMemoComment_0 = runtime.ForwardResponseMessage + forward_MemoService_SetMemoRelations_0 = runtime.ForwardResponseMessage forward_MemoService_ListMemoComments_0 = runtime.ForwardResponseMessage + forward_MemoService_CreateMemoComment_0 = runtime.ForwardResponseMessage forward_MemoService_ListMemoReactions_0 = runtime.ForwardResponseMessage - forward_MemoService_UpsertMemoReaction_0 = runtime.ForwardResponseMessage forward_MemoService_DeleteMemoReaction_0 = runtime.ForwardResponseMessage - forward_MemoService_CreateMemoShare_0 = runtime.ForwardResponseMessage + forward_MemoService_UpsertMemoReaction_0 = runtime.ForwardResponseMessage forward_MemoService_ListMemoShares_0 = runtime.ForwardResponseMessage + forward_MemoService_CreateMemoShare_0 = runtime.ForwardResponseMessage forward_MemoService_DeleteMemoShare_0 = runtime.ForwardResponseMessage forward_MemoService_GetSharedMemo_0 = runtime.ForwardResponseMessage forward_MemoService_GetLinkMetadata_0 = runtime.ForwardResponseMessage diff --git a/proto/gen/api/v1/memo_service_grpc.pb.go b/proto/gen/api/memo_service_grpc.pb.go similarity index 85% rename from proto/gen/api/v1/memo_service_grpc.pb.go rename to proto/gen/api/memo_service_grpc.pb.go index 1d4f994b6..279415c3b 100644 --- a/proto/gen/api/v1/memo_service_grpc.pb.go +++ b/proto/gen/api/memo_service_grpc.pb.go @@ -2,9 +2,9 @@ // versions: // - protoc-gen-go-grpc v1.6.2 // - protoc (unknown) -// source: api/v1/memo_service.proto +// source: api/memo_service.proto -package apiv1 +package api import ( context "context" @@ -20,83 +20,100 @@ import ( const _ = grpc.SupportPackageIsVersion9 const ( - MemoService_CreateMemo_FullMethodName = "/memos.api.v1.MemoService/CreateMemo" - MemoService_ListMemos_FullMethodName = "/memos.api.v1.MemoService/ListMemos" - MemoService_GetMemo_FullMethodName = "/memos.api.v1.MemoService/GetMemo" - MemoService_UpdateMemo_FullMethodName = "/memos.api.v1.MemoService/UpdateMemo" - MemoService_DeleteMemo_FullMethodName = "/memos.api.v1.MemoService/DeleteMemo" - MemoService_SetMemoAttachments_FullMethodName = "/memos.api.v1.MemoService/SetMemoAttachments" - MemoService_ListMemoAttachments_FullMethodName = "/memos.api.v1.MemoService/ListMemoAttachments" - MemoService_SetMemoRelations_FullMethodName = "/memos.api.v1.MemoService/SetMemoRelations" - MemoService_ListMemoRelations_FullMethodName = "/memos.api.v1.MemoService/ListMemoRelations" - MemoService_CreateMemoComment_FullMethodName = "/memos.api.v1.MemoService/CreateMemoComment" - MemoService_ListMemoComments_FullMethodName = "/memos.api.v1.MemoService/ListMemoComments" - MemoService_ListMemoReactions_FullMethodName = "/memos.api.v1.MemoService/ListMemoReactions" - MemoService_UpsertMemoReaction_FullMethodName = "/memos.api.v1.MemoService/UpsertMemoReaction" - MemoService_DeleteMemoReaction_FullMethodName = "/memos.api.v1.MemoService/DeleteMemoReaction" - MemoService_CreateMemoShare_FullMethodName = "/memos.api.v1.MemoService/CreateMemoShare" - MemoService_ListMemoShares_FullMethodName = "/memos.api.v1.MemoService/ListMemoShares" - MemoService_DeleteMemoShare_FullMethodName = "/memos.api.v1.MemoService/DeleteMemoShare" - MemoService_GetSharedMemo_FullMethodName = "/memos.api.v1.MemoService/GetSharedMemo" - MemoService_GetLinkMetadata_FullMethodName = "/memos.api.v1.MemoService/GetLinkMetadata" - MemoService_BatchGetLinkMetadata_FullMethodName = "/memos.api.v1.MemoService/BatchGetLinkMetadata" + MemoService_ListMemos_FullMethodName = "/memos.api.MemoService/ListMemos" + MemoService_GetMemo_FullMethodName = "/memos.api.MemoService/GetMemo" + MemoService_CreateMemo_FullMethodName = "/memos.api.MemoService/CreateMemo" + MemoService_UpdateMemo_FullMethodName = "/memos.api.MemoService/UpdateMemo" + MemoService_DeleteMemo_FullMethodName = "/memos.api.MemoService/DeleteMemo" + MemoService_ListMemoAttachments_FullMethodName = "/memos.api.MemoService/ListMemoAttachments" + MemoService_SetMemoAttachments_FullMethodName = "/memos.api.MemoService/SetMemoAttachments" + MemoService_ListMemoRelations_FullMethodName = "/memos.api.MemoService/ListMemoRelations" + MemoService_SetMemoRelations_FullMethodName = "/memos.api.MemoService/SetMemoRelations" + MemoService_ListMemoComments_FullMethodName = "/memos.api.MemoService/ListMemoComments" + MemoService_CreateMemoComment_FullMethodName = "/memos.api.MemoService/CreateMemoComment" + MemoService_ListMemoReactions_FullMethodName = "/memos.api.MemoService/ListMemoReactions" + MemoService_DeleteMemoReaction_FullMethodName = "/memos.api.MemoService/DeleteMemoReaction" + MemoService_UpsertMemoReaction_FullMethodName = "/memos.api.MemoService/UpsertMemoReaction" + MemoService_ListMemoShares_FullMethodName = "/memos.api.MemoService/ListMemoShares" + MemoService_CreateMemoShare_FullMethodName = "/memos.api.MemoService/CreateMemoShare" + MemoService_DeleteMemoShare_FullMethodName = "/memos.api.MemoService/DeleteMemoShare" + MemoService_GetSharedMemo_FullMethodName = "/memos.api.MemoService/GetSharedMemo" + MemoService_GetLinkMetadata_FullMethodName = "/memos.api.MemoService/GetLinkMetadata" + MemoService_BatchGetLinkMetadata_FullMethodName = "/memos.api.MemoService/BatchGetLinkMetadata" ) // MemoServiceClient is the client API for MemoService service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +// +// MemoService manages memos and their attachments, relations, comments, +// reactions, and share links. type MemoServiceClient interface { - // CreateMemo creates a memo. The request body is a Memo; set its content - // (Markdown) and visibility (PRIVATE | PROTECTED | PUBLIC | SPACE, - // default PRIVATE). - // The memo is owned by the authenticated user; requires authentication. - CreateMemo(ctx context.Context, in *CreateMemoRequest, opts ...grpc.CallOption) (*Memo, error) - // ListMemos lists readable non-comment memos with pagination and filter. + // ListMemos lists the memos the caller can read, excluding comments. + // Anonymous callers can list only when the instance allows public access. ListMemos(ctx context.Context, in *ListMemosRequest, opts ...grpc.CallOption) (*ListMemosResponse, error) - // GetMemo gets a memo. + // GetMemo gets a memo. Requires read access to the memo. GetMemo(ctx context.Context, in *GetMemoRequest, opts ...grpc.CallOption) (*Memo, error) - // UpdateMemo updates a memo. + // 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(ctx context.Context, in *CreateMemoRequest, opts ...grpc.CallOption) (*Memo, error) + // UpdateMemo updates the memo fields listed in update_mask. Requires the memo + // creator or an instance administrator. UpdateMemo(ctx context.Context, in *UpdateMemoRequest, opts ...grpc.CallOption) (*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. + // deleted memos. Requires the memo creator or an instance administrator. DeleteMemo(ctx context.Context, in *DeleteMemoRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) + // ListMemoAttachments lists the attachments of a memo. Requires read access + // to the memo. + ListMemoAttachments(ctx context.Context, in *ListMemoAttachmentsRequest, opts ...grpc.CallOption) (*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. + // clears all attachments. Idempotent. Requires the memo creator or an + // instance administrator. SetMemoAttachments(ctx context.Context, in *SetMemoAttachmentsRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) - // ListMemoAttachments lists attachments for a memo. - ListMemoAttachments(ctx context.Context, in *ListMemoAttachmentsRequest, opts ...grpc.CallOption) (*ListMemoAttachmentsResponse, error) + // ListMemoRelations lists the relations of a memo in both directions. + // Requires read access to the memo. + ListMemoRelations(ctx context.Context, in *ListMemoRelationsRequest, opts ...grpc.CallOption) (*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(ctx context.Context, in *SetMemoRelationsRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) - // ListMemoRelations lists relations for a memo. - ListMemoRelations(ctx context.Context, in *ListMemoRelationsRequest, opts ...grpc.CallOption) (*ListMemoRelationsResponse, error) + // ListMemoComments lists the active comments on a memo that the caller can + // read. Requires read access to the memo. + ListMemoComments(ctx context.Context, in *ListMemoCommentsRequest, opts ...grpc.CallOption) (*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. + // placement, visibility, authorship, and lifecycle. The named memo must be + // readable by the caller and not archived. CreateMemoComment(ctx context.Context, in *CreateMemoCommentRequest, opts ...grpc.CallOption) (*Memo, error) - // ListMemoComments lists comments for a memo. - ListMemoComments(ctx context.Context, in *ListMemoCommentsRequest, opts ...grpc.CallOption) (*ListMemoCommentsResponse, error) - // ListMemoReactions lists reactions for a memo. + // ListMemoReactions lists the reactions on a memo. Requires read access to + // the memo. ListMemoReactions(ctx context.Context, in *ListMemoReactionsRequest, opts ...grpc.CallOption) (*ListMemoReactionsResponse, error) - // UpsertMemoReaction adds or updates the authenticated user's reaction on a memo. - UpsertMemoReaction(ctx context.Context, in *UpsertMemoReactionRequest, opts ...grpc.CallOption) (*Reaction, error) - // DeleteMemoReaction deletes a reaction for a memo. + // DeleteMemoReaction deletes a reaction. Requires the reaction creator or an + // instance administrator. DeleteMemoReaction(ctx context.Context, in *DeleteMemoReactionRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) - // CreateMemoShare creates a share link for a memo. Requires the memo creator or an instance administrator. - CreateMemoShare(ctx context.Context, in *CreateMemoShareRequest, opts ...grpc.CallOption) (*MemoShare, error) - // ListMemoShares lists all share links for a memo. Requires the memo creator or an instance administrator. + // UpsertMemoReaction adds or updates the authenticated user's reaction on a + // memo. Requires read access to the memo. + UpsertMemoReaction(ctx context.Context, in *UpsertMemoReactionRequest, opts ...grpc.CallOption) (*Reaction, error) + // ListMemoShares lists all share links for a memo. Requires the memo creator + // or an instance administrator. ListMemoShares(ctx context.Context, in *ListMemoSharesRequest, opts ...grpc.CallOption) (*ListMemoSharesResponse, error) - // DeleteMemoShare revokes a share link. Requires the memo creator or an instance administrator. + // 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(ctx context.Context, in *CreateMemoShareRequest, opts ...grpc.CallOption) (*MemoShare, error) + // DeleteMemoShare revokes a share link. Requires the memo creator or an + // instance administrator. DeleteMemoShare(ctx context.Context, in *DeleteMemoShareRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) - // GetSharedMemo resolves a share token to its memo. No authentication required. - // Returns NOT_FOUND if the token is invalid or expired. + // GetSharedMemo resolves a share token to its memo. No authentication is + // required. Returns NOT_FOUND if the token is invalid or expired. GetSharedMemo(ctx context.Context, in *GetSharedMemoRequest, opts ...grpc.CallOption) (*Memo, error) - // GetLinkMetadata gets metadata for a link. + // GetLinkMetadata fetches the title, description, and image of a link. GetLinkMetadata(ctx context.Context, in *GetLinkMetadataRequest, opts ...grpc.CallOption) (*LinkMetadata, error) - // BatchGetLinkMetadata gets metadata for links. + // BatchGetLinkMetadata fetches the metadata of up to 10 links. BatchGetLinkMetadata(ctx context.Context, in *BatchGetLinkMetadataRequest, opts ...grpc.CallOption) (*BatchGetLinkMetadataResponse, error) } @@ -108,16 +125,6 @@ func NewMemoServiceClient(cc grpc.ClientConnInterface) MemoServiceClient { return &memoServiceClient{cc} } -func (c *memoServiceClient) CreateMemo(ctx context.Context, in *CreateMemoRequest, opts ...grpc.CallOption) (*Memo, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(Memo) - err := c.cc.Invoke(ctx, MemoService_CreateMemo_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - func (c *memoServiceClient) ListMemos(ctx context.Context, in *ListMemosRequest, opts ...grpc.CallOption) (*ListMemosResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(ListMemosResponse) @@ -138,6 +145,16 @@ func (c *memoServiceClient) GetMemo(ctx context.Context, in *GetMemoRequest, opt return out, nil } +func (c *memoServiceClient) CreateMemo(ctx context.Context, in *CreateMemoRequest, opts ...grpc.CallOption) (*Memo, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(Memo) + err := c.cc.Invoke(ctx, MemoService_CreateMemo_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *memoServiceClient) UpdateMemo(ctx context.Context, in *UpdateMemoRequest, opts ...grpc.CallOption) (*Memo, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(Memo) @@ -158,16 +175,6 @@ func (c *memoServiceClient) DeleteMemo(ctx context.Context, in *DeleteMemoReques return out, nil } -func (c *memoServiceClient) SetMemoAttachments(ctx context.Context, in *SetMemoAttachmentsRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(emptypb.Empty) - err := c.cc.Invoke(ctx, MemoService_SetMemoAttachments_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - func (c *memoServiceClient) ListMemoAttachments(ctx context.Context, in *ListMemoAttachmentsRequest, opts ...grpc.CallOption) (*ListMemoAttachmentsResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(ListMemoAttachmentsResponse) @@ -178,10 +185,10 @@ func (c *memoServiceClient) ListMemoAttachments(ctx context.Context, in *ListMem return out, nil } -func (c *memoServiceClient) SetMemoRelations(ctx context.Context, in *SetMemoRelationsRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { +func (c *memoServiceClient) SetMemoAttachments(ctx context.Context, in *SetMemoAttachmentsRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(emptypb.Empty) - err := c.cc.Invoke(ctx, MemoService_SetMemoRelations_FullMethodName, in, out, cOpts...) + err := c.cc.Invoke(ctx, MemoService_SetMemoAttachments_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -198,10 +205,10 @@ func (c *memoServiceClient) ListMemoRelations(ctx context.Context, in *ListMemoR return out, nil } -func (c *memoServiceClient) CreateMemoComment(ctx context.Context, in *CreateMemoCommentRequest, opts ...grpc.CallOption) (*Memo, error) { +func (c *memoServiceClient) SetMemoRelations(ctx context.Context, in *SetMemoRelationsRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(Memo) - err := c.cc.Invoke(ctx, MemoService_CreateMemoComment_FullMethodName, in, out, cOpts...) + out := new(emptypb.Empty) + err := c.cc.Invoke(ctx, MemoService_SetMemoRelations_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -218,20 +225,20 @@ func (c *memoServiceClient) ListMemoComments(ctx context.Context, in *ListMemoCo return out, nil } -func (c *memoServiceClient) ListMemoReactions(ctx context.Context, in *ListMemoReactionsRequest, opts ...grpc.CallOption) (*ListMemoReactionsResponse, error) { +func (c *memoServiceClient) CreateMemoComment(ctx context.Context, in *CreateMemoCommentRequest, opts ...grpc.CallOption) (*Memo, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(ListMemoReactionsResponse) - err := c.cc.Invoke(ctx, MemoService_ListMemoReactions_FullMethodName, in, out, cOpts...) + out := new(Memo) + err := c.cc.Invoke(ctx, MemoService_CreateMemoComment_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } -func (c *memoServiceClient) UpsertMemoReaction(ctx context.Context, in *UpsertMemoReactionRequest, opts ...grpc.CallOption) (*Reaction, error) { +func (c *memoServiceClient) ListMemoReactions(ctx context.Context, in *ListMemoReactionsRequest, opts ...grpc.CallOption) (*ListMemoReactionsResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(Reaction) - err := c.cc.Invoke(ctx, MemoService_UpsertMemoReaction_FullMethodName, in, out, cOpts...) + out := new(ListMemoReactionsResponse) + err := c.cc.Invoke(ctx, MemoService_ListMemoReactions_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -248,10 +255,10 @@ func (c *memoServiceClient) DeleteMemoReaction(ctx context.Context, in *DeleteMe return out, nil } -func (c *memoServiceClient) CreateMemoShare(ctx context.Context, in *CreateMemoShareRequest, opts ...grpc.CallOption) (*MemoShare, error) { +func (c *memoServiceClient) UpsertMemoReaction(ctx context.Context, in *UpsertMemoReactionRequest, opts ...grpc.CallOption) (*Reaction, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(MemoShare) - err := c.cc.Invoke(ctx, MemoService_CreateMemoShare_FullMethodName, in, out, cOpts...) + out := new(Reaction) + err := c.cc.Invoke(ctx, MemoService_UpsertMemoReaction_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -268,6 +275,16 @@ func (c *memoServiceClient) ListMemoShares(ctx context.Context, in *ListMemoShar return out, nil } +func (c *memoServiceClient) CreateMemoShare(ctx context.Context, in *CreateMemoShareRequest, opts ...grpc.CallOption) (*MemoShare, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(MemoShare) + err := c.cc.Invoke(ctx, MemoService_CreateMemoShare_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *memoServiceClient) DeleteMemoShare(ctx context.Context, in *DeleteMemoShareRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(emptypb.Empty) @@ -311,58 +328,75 @@ func (c *memoServiceClient) BatchGetLinkMetadata(ctx context.Context, in *BatchG // MemoServiceServer is the server API for MemoService service. // All implementations must embed UnimplementedMemoServiceServer // for forward compatibility. +// +// MemoService manages memos and their attachments, relations, comments, +// reactions, and share links. type MemoServiceServer interface { - // CreateMemo creates a memo. The request body is a Memo; set its content - // (Markdown) and visibility (PRIVATE | PROTECTED | PUBLIC | SPACE, - // default PRIVATE). - // The memo is owned by the authenticated user; requires authentication. - CreateMemo(context.Context, *CreateMemoRequest) (*Memo, error) - // ListMemos lists readable non-comment memos with pagination and filter. + // ListMemos lists the memos the caller can read, excluding comments. + // Anonymous callers can list only when the instance allows public access. ListMemos(context.Context, *ListMemosRequest) (*ListMemosResponse, error) - // GetMemo gets a memo. + // GetMemo gets a memo. Requires read access to the memo. GetMemo(context.Context, *GetMemoRequest) (*Memo, error) - // UpdateMemo updates a memo. + // 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, *CreateMemoRequest) (*Memo, error) + // UpdateMemo updates the memo fields listed in update_mask. Requires the memo + // creator or an instance administrator. UpdateMemo(context.Context, *UpdateMemoRequest) (*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. + // deleted memos. Requires the memo creator or an instance administrator. DeleteMemo(context.Context, *DeleteMemoRequest) (*emptypb.Empty, error) + // ListMemoAttachments lists the attachments of a memo. Requires read access + // to the memo. + ListMemoAttachments(context.Context, *ListMemoAttachmentsRequest) (*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. + // clears all attachments. Idempotent. Requires the memo creator or an + // instance administrator. SetMemoAttachments(context.Context, *SetMemoAttachmentsRequest) (*emptypb.Empty, error) - // ListMemoAttachments lists attachments for a memo. - ListMemoAttachments(context.Context, *ListMemoAttachmentsRequest) (*ListMemoAttachmentsResponse, error) + // ListMemoRelations lists the relations of a memo in both directions. + // Requires read access to the memo. + ListMemoRelations(context.Context, *ListMemoRelationsRequest) (*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, *SetMemoRelationsRequest) (*emptypb.Empty, error) - // ListMemoRelations lists relations for a memo. - ListMemoRelations(context.Context, *ListMemoRelationsRequest) (*ListMemoRelationsResponse, error) + // ListMemoComments lists the active comments on a memo that the caller can + // read. Requires read access to the memo. + ListMemoComments(context.Context, *ListMemoCommentsRequest) (*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. + // placement, visibility, authorship, and lifecycle. The named memo must be + // readable by the caller and not archived. CreateMemoComment(context.Context, *CreateMemoCommentRequest) (*Memo, error) - // ListMemoComments lists comments for a memo. - ListMemoComments(context.Context, *ListMemoCommentsRequest) (*ListMemoCommentsResponse, error) - // ListMemoReactions lists reactions for a memo. + // ListMemoReactions lists the reactions on a memo. Requires read access to + // the memo. ListMemoReactions(context.Context, *ListMemoReactionsRequest) (*ListMemoReactionsResponse, error) - // UpsertMemoReaction adds or updates the authenticated user's reaction on a memo. - UpsertMemoReaction(context.Context, *UpsertMemoReactionRequest) (*Reaction, error) - // DeleteMemoReaction deletes a reaction for a memo. + // DeleteMemoReaction deletes a reaction. Requires the reaction creator or an + // instance administrator. DeleteMemoReaction(context.Context, *DeleteMemoReactionRequest) (*emptypb.Empty, error) - // CreateMemoShare creates a share link for a memo. Requires the memo creator or an instance administrator. - CreateMemoShare(context.Context, *CreateMemoShareRequest) (*MemoShare, error) - // ListMemoShares lists all share links for a memo. Requires the memo creator or an instance administrator. + // UpsertMemoReaction adds or updates the authenticated user's reaction on a + // memo. Requires read access to the memo. + UpsertMemoReaction(context.Context, *UpsertMemoReactionRequest) (*Reaction, error) + // ListMemoShares lists all share links for a memo. Requires the memo creator + // or an instance administrator. ListMemoShares(context.Context, *ListMemoSharesRequest) (*ListMemoSharesResponse, error) - // DeleteMemoShare revokes a share link. Requires the memo creator or an instance administrator. + // 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, *CreateMemoShareRequest) (*MemoShare, error) + // DeleteMemoShare revokes a share link. Requires the memo creator or an + // instance administrator. DeleteMemoShare(context.Context, *DeleteMemoShareRequest) (*emptypb.Empty, error) - // GetSharedMemo resolves a share token to its memo. No authentication required. - // Returns NOT_FOUND if the token is invalid or expired. + // 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, *GetSharedMemoRequest) (*Memo, error) - // GetLinkMetadata gets metadata for a link. + // GetLinkMetadata fetches the title, description, and image of a link. GetLinkMetadata(context.Context, *GetLinkMetadataRequest) (*LinkMetadata, error) - // BatchGetLinkMetadata gets metadata for links. + // BatchGetLinkMetadata fetches the metadata of up to 10 links. BatchGetLinkMetadata(context.Context, *BatchGetLinkMetadataRequest) (*BatchGetLinkMetadataResponse, error) mustEmbedUnimplementedMemoServiceServer() } @@ -374,54 +408,54 @@ type MemoServiceServer interface { // pointer dereference when methods are called. type UnimplementedMemoServiceServer struct{} -func (UnimplementedMemoServiceServer) CreateMemo(context.Context, *CreateMemoRequest) (*Memo, error) { - return nil, status.Error(codes.Unimplemented, "method CreateMemo not implemented") -} func (UnimplementedMemoServiceServer) ListMemos(context.Context, *ListMemosRequest) (*ListMemosResponse, error) { return nil, status.Error(codes.Unimplemented, "method ListMemos not implemented") } func (UnimplementedMemoServiceServer) GetMemo(context.Context, *GetMemoRequest) (*Memo, error) { return nil, status.Error(codes.Unimplemented, "method GetMemo not implemented") } +func (UnimplementedMemoServiceServer) CreateMemo(context.Context, *CreateMemoRequest) (*Memo, error) { + return nil, status.Error(codes.Unimplemented, "method CreateMemo not implemented") +} func (UnimplementedMemoServiceServer) UpdateMemo(context.Context, *UpdateMemoRequest) (*Memo, error) { return nil, status.Error(codes.Unimplemented, "method UpdateMemo not implemented") } func (UnimplementedMemoServiceServer) DeleteMemo(context.Context, *DeleteMemoRequest) (*emptypb.Empty, error) { return nil, status.Error(codes.Unimplemented, "method DeleteMemo not implemented") } -func (UnimplementedMemoServiceServer) SetMemoAttachments(context.Context, *SetMemoAttachmentsRequest) (*emptypb.Empty, error) { - return nil, status.Error(codes.Unimplemented, "method SetMemoAttachments not implemented") -} func (UnimplementedMemoServiceServer) ListMemoAttachments(context.Context, *ListMemoAttachmentsRequest) (*ListMemoAttachmentsResponse, error) { return nil, status.Error(codes.Unimplemented, "method ListMemoAttachments not implemented") } -func (UnimplementedMemoServiceServer) SetMemoRelations(context.Context, *SetMemoRelationsRequest) (*emptypb.Empty, error) { - return nil, status.Error(codes.Unimplemented, "method SetMemoRelations not implemented") +func (UnimplementedMemoServiceServer) SetMemoAttachments(context.Context, *SetMemoAttachmentsRequest) (*emptypb.Empty, error) { + return nil, status.Error(codes.Unimplemented, "method SetMemoAttachments not implemented") } func (UnimplementedMemoServiceServer) ListMemoRelations(context.Context, *ListMemoRelationsRequest) (*ListMemoRelationsResponse, error) { return nil, status.Error(codes.Unimplemented, "method ListMemoRelations not implemented") } -func (UnimplementedMemoServiceServer) CreateMemoComment(context.Context, *CreateMemoCommentRequest) (*Memo, error) { - return nil, status.Error(codes.Unimplemented, "method CreateMemoComment not implemented") +func (UnimplementedMemoServiceServer) SetMemoRelations(context.Context, *SetMemoRelationsRequest) (*emptypb.Empty, error) { + return nil, status.Error(codes.Unimplemented, "method SetMemoRelations not implemented") } func (UnimplementedMemoServiceServer) ListMemoComments(context.Context, *ListMemoCommentsRequest) (*ListMemoCommentsResponse, error) { return nil, status.Error(codes.Unimplemented, "method ListMemoComments not implemented") } +func (UnimplementedMemoServiceServer) CreateMemoComment(context.Context, *CreateMemoCommentRequest) (*Memo, error) { + return nil, status.Error(codes.Unimplemented, "method CreateMemoComment not implemented") +} func (UnimplementedMemoServiceServer) ListMemoReactions(context.Context, *ListMemoReactionsRequest) (*ListMemoReactionsResponse, error) { return nil, status.Error(codes.Unimplemented, "method ListMemoReactions not implemented") } -func (UnimplementedMemoServiceServer) UpsertMemoReaction(context.Context, *UpsertMemoReactionRequest) (*Reaction, error) { - return nil, status.Error(codes.Unimplemented, "method UpsertMemoReaction not implemented") -} func (UnimplementedMemoServiceServer) DeleteMemoReaction(context.Context, *DeleteMemoReactionRequest) (*emptypb.Empty, error) { return nil, status.Error(codes.Unimplemented, "method DeleteMemoReaction not implemented") } -func (UnimplementedMemoServiceServer) CreateMemoShare(context.Context, *CreateMemoShareRequest) (*MemoShare, error) { - return nil, status.Error(codes.Unimplemented, "method CreateMemoShare not implemented") +func (UnimplementedMemoServiceServer) UpsertMemoReaction(context.Context, *UpsertMemoReactionRequest) (*Reaction, error) { + return nil, status.Error(codes.Unimplemented, "method UpsertMemoReaction not implemented") } func (UnimplementedMemoServiceServer) ListMemoShares(context.Context, *ListMemoSharesRequest) (*ListMemoSharesResponse, error) { return nil, status.Error(codes.Unimplemented, "method ListMemoShares not implemented") } +func (UnimplementedMemoServiceServer) CreateMemoShare(context.Context, *CreateMemoShareRequest) (*MemoShare, error) { + return nil, status.Error(codes.Unimplemented, "method CreateMemoShare not implemented") +} func (UnimplementedMemoServiceServer) DeleteMemoShare(context.Context, *DeleteMemoShareRequest) (*emptypb.Empty, error) { return nil, status.Error(codes.Unimplemented, "method DeleteMemoShare not implemented") } @@ -455,24 +489,6 @@ func RegisterMemoServiceServer(s grpc.ServiceRegistrar, srv MemoServiceServer) { s.RegisterService(&MemoService_ServiceDesc, srv) } -func _MemoService_CreateMemo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CreateMemoRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MemoServiceServer).CreateMemo(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: MemoService_CreateMemo_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MemoServiceServer).CreateMemo(ctx, req.(*CreateMemoRequest)) - } - return interceptor(ctx, in, info, handler) -} - func _MemoService_ListMemos_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ListMemosRequest) if err := dec(in); err != nil { @@ -509,6 +525,24 @@ func _MemoService_GetMemo_Handler(srv interface{}, ctx context.Context, dec func return interceptor(ctx, in, info, handler) } +func _MemoService_CreateMemo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateMemoRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MemoServiceServer).CreateMemo(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: MemoService_CreateMemo_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MemoServiceServer).CreateMemo(ctx, req.(*CreateMemoRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _MemoService_UpdateMemo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(UpdateMemoRequest) if err := dec(in); err != nil { @@ -545,24 +579,6 @@ func _MemoService_DeleteMemo_Handler(srv interface{}, ctx context.Context, dec f return interceptor(ctx, in, info, handler) } -func _MemoService_SetMemoAttachments_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(SetMemoAttachmentsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MemoServiceServer).SetMemoAttachments(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: MemoService_SetMemoAttachments_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MemoServiceServer).SetMemoAttachments(ctx, req.(*SetMemoAttachmentsRequest)) - } - return interceptor(ctx, in, info, handler) -} - func _MemoService_ListMemoAttachments_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ListMemoAttachmentsRequest) if err := dec(in); err != nil { @@ -581,20 +597,20 @@ func _MemoService_ListMemoAttachments_Handler(srv interface{}, ctx context.Conte return interceptor(ctx, in, info, handler) } -func _MemoService_SetMemoRelations_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(SetMemoRelationsRequest) +func _MemoService_SetMemoAttachments_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SetMemoAttachmentsRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(MemoServiceServer).SetMemoRelations(ctx, in) + return srv.(MemoServiceServer).SetMemoAttachments(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: MemoService_SetMemoRelations_FullMethodName, + FullMethod: MemoService_SetMemoAttachments_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MemoServiceServer).SetMemoRelations(ctx, req.(*SetMemoRelationsRequest)) + return srv.(MemoServiceServer).SetMemoAttachments(ctx, req.(*SetMemoAttachmentsRequest)) } return interceptor(ctx, in, info, handler) } @@ -617,20 +633,20 @@ func _MemoService_ListMemoRelations_Handler(srv interface{}, ctx context.Context return interceptor(ctx, in, info, handler) } -func _MemoService_CreateMemoComment_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CreateMemoCommentRequest) +func _MemoService_SetMemoRelations_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SetMemoRelationsRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(MemoServiceServer).CreateMemoComment(ctx, in) + return srv.(MemoServiceServer).SetMemoRelations(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: MemoService_CreateMemoComment_FullMethodName, + FullMethod: MemoService_SetMemoRelations_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MemoServiceServer).CreateMemoComment(ctx, req.(*CreateMemoCommentRequest)) + return srv.(MemoServiceServer).SetMemoRelations(ctx, req.(*SetMemoRelationsRequest)) } return interceptor(ctx, in, info, handler) } @@ -653,6 +669,24 @@ func _MemoService_ListMemoComments_Handler(srv interface{}, ctx context.Context, return interceptor(ctx, in, info, handler) } +func _MemoService_CreateMemoComment_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateMemoCommentRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MemoServiceServer).CreateMemoComment(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: MemoService_CreateMemoComment_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MemoServiceServer).CreateMemoComment(ctx, req.(*CreateMemoCommentRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _MemoService_ListMemoReactions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ListMemoReactionsRequest) if err := dec(in); err != nil { @@ -671,24 +705,6 @@ func _MemoService_ListMemoReactions_Handler(srv interface{}, ctx context.Context return interceptor(ctx, in, info, handler) } -func _MemoService_UpsertMemoReaction_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(UpsertMemoReactionRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MemoServiceServer).UpsertMemoReaction(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: MemoService_UpsertMemoReaction_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MemoServiceServer).UpsertMemoReaction(ctx, req.(*UpsertMemoReactionRequest)) - } - return interceptor(ctx, in, info, handler) -} - func _MemoService_DeleteMemoReaction_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(DeleteMemoReactionRequest) if err := dec(in); err != nil { @@ -707,20 +723,20 @@ func _MemoService_DeleteMemoReaction_Handler(srv interface{}, ctx context.Contex return interceptor(ctx, in, info, handler) } -func _MemoService_CreateMemoShare_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CreateMemoShareRequest) +func _MemoService_UpsertMemoReaction_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpsertMemoReactionRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(MemoServiceServer).CreateMemoShare(ctx, in) + return srv.(MemoServiceServer).UpsertMemoReaction(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: MemoService_CreateMemoShare_FullMethodName, + FullMethod: MemoService_UpsertMemoReaction_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MemoServiceServer).CreateMemoShare(ctx, req.(*CreateMemoShareRequest)) + return srv.(MemoServiceServer).UpsertMemoReaction(ctx, req.(*UpsertMemoReactionRequest)) } return interceptor(ctx, in, info, handler) } @@ -743,6 +759,24 @@ func _MemoService_ListMemoShares_Handler(srv interface{}, ctx context.Context, d return interceptor(ctx, in, info, handler) } +func _MemoService_CreateMemoShare_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateMemoShareRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MemoServiceServer).CreateMemoShare(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: MemoService_CreateMemoShare_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MemoServiceServer).CreateMemoShare(ctx, req.(*CreateMemoShareRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _MemoService_DeleteMemoShare_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(DeleteMemoShareRequest) if err := dec(in); err != nil { @@ -819,13 +853,9 @@ func _MemoService_BatchGetLinkMetadata_Handler(srv interface{}, ctx context.Cont // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) var MemoService_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "memos.api.v1.MemoService", + ServiceName: "memos.api.MemoService", HandlerType: (*MemoServiceServer)(nil), Methods: []grpc.MethodDesc{ - { - MethodName: "CreateMemo", - Handler: _MemoService_CreateMemo_Handler, - }, { MethodName: "ListMemos", Handler: _MemoService_ListMemos_Handler, @@ -834,6 +864,10 @@ var MemoService_ServiceDesc = grpc.ServiceDesc{ MethodName: "GetMemo", Handler: _MemoService_GetMemo_Handler, }, + { + MethodName: "CreateMemo", + Handler: _MemoService_CreateMemo_Handler, + }, { MethodName: "UpdateMemo", Handler: _MemoService_UpdateMemo_Handler, @@ -842,50 +876,50 @@ var MemoService_ServiceDesc = grpc.ServiceDesc{ MethodName: "DeleteMemo", Handler: _MemoService_DeleteMemo_Handler, }, - { - MethodName: "SetMemoAttachments", - Handler: _MemoService_SetMemoAttachments_Handler, - }, { MethodName: "ListMemoAttachments", Handler: _MemoService_ListMemoAttachments_Handler, }, { - MethodName: "SetMemoRelations", - Handler: _MemoService_SetMemoRelations_Handler, + MethodName: "SetMemoAttachments", + Handler: _MemoService_SetMemoAttachments_Handler, }, { MethodName: "ListMemoRelations", Handler: _MemoService_ListMemoRelations_Handler, }, { - MethodName: "CreateMemoComment", - Handler: _MemoService_CreateMemoComment_Handler, + MethodName: "SetMemoRelations", + Handler: _MemoService_SetMemoRelations_Handler, }, { MethodName: "ListMemoComments", Handler: _MemoService_ListMemoComments_Handler, }, { - MethodName: "ListMemoReactions", - Handler: _MemoService_ListMemoReactions_Handler, + MethodName: "CreateMemoComment", + Handler: _MemoService_CreateMemoComment_Handler, }, { - MethodName: "UpsertMemoReaction", - Handler: _MemoService_UpsertMemoReaction_Handler, + MethodName: "ListMemoReactions", + Handler: _MemoService_ListMemoReactions_Handler, }, { MethodName: "DeleteMemoReaction", Handler: _MemoService_DeleteMemoReaction_Handler, }, { - MethodName: "CreateMemoShare", - Handler: _MemoService_CreateMemoShare_Handler, + MethodName: "UpsertMemoReaction", + Handler: _MemoService_UpsertMemoReaction_Handler, }, { MethodName: "ListMemoShares", Handler: _MemoService_ListMemoShares_Handler, }, + { + MethodName: "CreateMemoShare", + Handler: _MemoService_CreateMemoShare_Handler, + }, { MethodName: "DeleteMemoShare", Handler: _MemoService_DeleteMemoShare_Handler, @@ -904,5 +938,5 @@ var MemoService_ServiceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: "api/v1/memo_service.proto", + Metadata: "api/memo_service.proto", } diff --git a/proto/gen/api/v1/space_service.pb.go b/proto/gen/api/space_service.pb.go similarity index 55% rename from proto/gen/api/v1/space_service.pb.go rename to proto/gen/api/space_service.pb.go index fc2103743..040dd809e 100644 --- a/proto/gen/api/v1/space_service.pb.go +++ b/proto/gen/api/space_service.pb.go @@ -2,9 +2,9 @@ // versions: // protoc-gen-go v1.36.12 // protoc (unknown) -// source: api/v1/space_service.proto +// source: api/space_service.proto -package apiv1 +package api import ( _ "google.golang.org/genproto/googleapis/api/annotations" @@ -24,12 +24,15 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) +// Role is a member's governance role within a space. type SpaceMember_Role int32 const ( SpaceMember_ROLE_UNSPECIFIED SpaceMember_Role = 0 - SpaceMember_ADMIN SpaceMember_Role = 1 - SpaceMember_USER SpaceMember_Role = 2 + // Can update and delete the space, manage members and manage invitations. + SpaceMember_ADMIN SpaceMember_Role = 1 + // A regular member without governance permissions. + SpaceMember_USER SpaceMember_Role = 2 ) // Enum value maps for SpaceMember_Role. @@ -57,11 +60,11 @@ func (x SpaceMember_Role) String() string { } func (SpaceMember_Role) Descriptor() protoreflect.EnumDescriptor { - return file_api_v1_space_service_proto_enumTypes[0].Descriptor() + return file_api_space_service_proto_enumTypes[0].Descriptor() } func (SpaceMember_Role) Type() protoreflect.EnumType { - return &file_api_v1_space_service_proto_enumTypes[0] + return &file_api_space_service_proto_enumTypes[0] } func (x SpaceMember_Role) Number() protoreflect.EnumNumber { @@ -70,34 +73,35 @@ func (x SpaceMember_Role) Number() protoreflect.EnumNumber { // Deprecated: Use SpaceMember_Role.Descriptor instead. func (SpaceMember_Role) EnumDescriptor() ([]byte, []int) { - return file_api_v1_space_service_proto_rawDescGZIP(), []int{1, 0} + return file_api_space_service_proto_rawDescGZIP(), []int{7, 0} } // Space is a collaboration boundary for placed memos. type Space struct { state protoimpl.MessageState `protogen:"open.v1"` - // The resource name of the space. Format: spaces/{space}. + // Identifier. The resource name of the space. + // Format: spaces/{space} Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // Required. The human-readable title. Title string `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"` // Optional. A description of the space. Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` + // Optional. The display icon. Omit it when updating with the "icon" mask to + // reset to the default space mark. + Icon *Space_Icon `protobuf:"bytes,4,opt,name=icon,proto3" json:"icon,omitempty"` // Output only. The authenticated user's membership role in this space. - // ROLE_UNSPECIFIED when this Space is exposed as metadata-only. - CurrentUserRole SpaceMember_Role `protobuf:"varint,4,opt,name=current_user_role,json=currentUserRole,proto3,enum=memos.api.v1.SpaceMember_Role" json:"current_user_role,omitempty"` + // ROLE_UNSPECIFIED when this space is exposed as metadata only. + CurrentUserRole SpaceMember_Role `protobuf:"varint,5,opt,name=current_user_role,json=currentUserRole,proto3,enum=memos.api.SpaceMember_Role" json:"current_user_role,omitempty"` // Output only. The number of accepted members in this space. Pending - // invitations are excluded. Zero when this Space is exposed as metadata-only. - MemberCount int32 `protobuf:"varint,5,opt,name=member_count,json=memberCount,proto3" json:"member_count,omitempty"` - // Optional. Display icon. Omit when updating with the "icon" mask to reset - // to the default Space mark. - Icon *Space_Icon `protobuf:"bytes,6,opt,name=icon,proto3" json:"icon,omitempty"` + // invitations are excluded. Zero when this space is exposed as metadata only. + MemberCount int32 `protobuf:"varint,6,opt,name=member_count,json=memberCount,proto3" json:"member_count,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } func (x *Space) Reset() { *x = Space{} - mi := &file_api_v1_space_service_proto_msgTypes[0] + mi := &file_api_space_service_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -109,7 +113,7 @@ func (x *Space) String() string { func (*Space) ProtoMessage() {} func (x *Space) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_space_service_proto_msgTypes[0] + mi := &file_api_space_service_proto_msgTypes[0] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -122,7 +126,7 @@ func (x *Space) ProtoReflect() protoreflect.Message { // Deprecated: Use Space.ProtoReflect.Descriptor instead. func (*Space) Descriptor() ([]byte, []int) { - return file_api_v1_space_service_proto_rawDescGZIP(), []int{0} + return file_api_space_service_proto_rawDescGZIP(), []int{0} } func (x *Space) GetName() string { @@ -146,6 +150,13 @@ func (x *Space) GetDescription() string { return "" } +func (x *Space) GetIcon() *Space_Icon { + if x != nil { + return x.Icon + } + return nil +} + func (x *Space) GetCurrentUserRole() SpaceMember_Role { if x != nil { return x.CurrentUserRole @@ -160,29 +171,342 @@ func (x *Space) GetMemberCount() int32 { return 0 } -func (x *Space) GetIcon() *Space_Icon { +// Request message for SpaceService.ListSpaces. +type ListSpacesRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Optional. The maximum number of spaces to return. The service may return fewer. + PageSize int32 `protobuf:"varint,1,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + // Optional. A page token from a previous call. Provide it to retrieve the next page. + PageToken string `protobuf:"bytes,2,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListSpacesRequest) Reset() { + *x = ListSpacesRequest{} + mi := &file_api_space_service_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListSpacesRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListSpacesRequest) ProtoMessage() {} + +func (x *ListSpacesRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_space_service_proto_msgTypes[1] if x != nil { - return x.Icon + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListSpacesRequest.ProtoReflect.Descriptor instead. +func (*ListSpacesRequest) Descriptor() ([]byte, []int) { + return file_api_space_service_proto_rawDescGZIP(), []int{1} +} + +func (x *ListSpacesRequest) GetPageSize() int32 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *ListSpacesRequest) GetPageToken() string { + if x != nil { + return x.PageToken + } + return "" +} + +// Response message for SpaceService.ListSpaces. +type ListSpacesResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The spaces of which the caller is a member. + Spaces []*Space `protobuf:"bytes,1,rep,name=spaces,proto3" json:"spaces,omitempty"` + // A token to retrieve the next page. Empty when there are no more pages. + NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListSpacesResponse) Reset() { + *x = ListSpacesResponse{} + mi := &file_api_space_service_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListSpacesResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListSpacesResponse) ProtoMessage() {} + +func (x *ListSpacesResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_space_service_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListSpacesResponse.ProtoReflect.Descriptor instead. +func (*ListSpacesResponse) Descriptor() ([]byte, []int) { + return file_api_space_service_proto_rawDescGZIP(), []int{2} +} + +func (x *ListSpacesResponse) GetSpaces() []*Space { + if x != nil { + return x.Spaces } return nil } +func (x *ListSpacesResponse) GetNextPageToken() string { + if x != nil { + return x.NextPageToken + } + return "" +} + +// Request message for SpaceService.GetSpace. +type GetSpaceRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Required. The resource name of the space. + // Format: spaces/{space} + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetSpaceRequest) Reset() { + *x = GetSpaceRequest{} + mi := &file_api_space_service_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetSpaceRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetSpaceRequest) ProtoMessage() {} + +func (x *GetSpaceRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_space_service_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetSpaceRequest.ProtoReflect.Descriptor instead. +func (*GetSpaceRequest) Descriptor() ([]byte, []int) { + return file_api_space_service_proto_rawDescGZIP(), []int{3} +} + +func (x *GetSpaceRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +// Request message for SpaceService.CreateSpace. +type CreateSpaceRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Required. The space to create. + Space *Space `protobuf:"bytes,1,opt,name=space,proto3" json:"space,omitempty"` + // Optional. The ID to use for the space, which becomes the final segment of + // its resource name. If empty, a UUID v4 is generated. Must match + // ^[a-zA-Z0-9]([a-zA-Z0-9-]{0,34}[a-zA-Z0-9])?$. + SpaceId string `protobuf:"bytes,2,opt,name=space_id,json=spaceId,proto3" json:"space_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateSpaceRequest) Reset() { + *x = CreateSpaceRequest{} + mi := &file_api_space_service_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateSpaceRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateSpaceRequest) ProtoMessage() {} + +func (x *CreateSpaceRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_space_service_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateSpaceRequest.ProtoReflect.Descriptor instead. +func (*CreateSpaceRequest) Descriptor() ([]byte, []int) { + return file_api_space_service_proto_rawDescGZIP(), []int{4} +} + +func (x *CreateSpaceRequest) GetSpace() *Space { + if x != nil { + return x.Space + } + return nil +} + +func (x *CreateSpaceRequest) GetSpaceId() string { + if x != nil { + return x.SpaceId + } + return "" +} + +// Request message for SpaceService.UpdateSpace. +type UpdateSpaceRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Required. The space with updated values. Its name identifies the space to + // update. + Space *Space `protobuf:"bytes,1,opt,name=space,proto3" json:"space,omitempty"` + // Required. The fields to update. Supported paths: title, description, icon. + UpdateMask *fieldmaskpb.FieldMask `protobuf:"bytes,2,opt,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UpdateSpaceRequest) Reset() { + *x = UpdateSpaceRequest{} + mi := &file_api_space_service_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UpdateSpaceRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateSpaceRequest) ProtoMessage() {} + +func (x *UpdateSpaceRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_space_service_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateSpaceRequest.ProtoReflect.Descriptor instead. +func (*UpdateSpaceRequest) Descriptor() ([]byte, []int) { + return file_api_space_service_proto_rawDescGZIP(), []int{5} +} + +func (x *UpdateSpaceRequest) GetSpace() *Space { + if x != nil { + return x.Space + } + return nil +} + +func (x *UpdateSpaceRequest) GetUpdateMask() *fieldmaskpb.FieldMask { + if x != nil { + return x.UpdateMask + } + return nil +} + +// Request message for SpaceService.DeleteSpace. +type DeleteSpaceRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Required. The resource name of the space. + // Format: spaces/{space} + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteSpaceRequest) Reset() { + *x = DeleteSpaceRequest{} + mi := &file_api_space_service_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteSpaceRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteSpaceRequest) ProtoMessage() {} + +func (x *DeleteSpaceRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_space_service_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteSpaceRequest.ProtoReflect.Descriptor instead. +func (*DeleteSpaceRequest) Descriptor() ([]byte, []int) { + return file_api_space_service_proto_rawDescGZIP(), []int{6} +} + +func (x *DeleteSpaceRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + // SpaceMember is a user's membership and governance role in a space. type SpaceMember struct { state protoimpl.MessageState `protogen:"open.v1"` - // The resource name. Format: spaces/{space}/members/{username}. + // Identifier. The resource name of the membership. The member segment is + // the member's username. + // Format: spaces/{space}/members/{member} Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Required. The member user. Format: users/{username}. + // Required. The member user. + // Format: users/{user} User string `protobuf:"bytes,2,opt,name=user,proto3" json:"user,omitempty"` // Required. The member's role within this space. - Role SpaceMember_Role `protobuf:"varint,3,opt,name=role,proto3,enum=memos.api.v1.SpaceMember_Role" json:"role,omitempty"` + Role SpaceMember_Role `protobuf:"varint,3,opt,name=role,proto3,enum=memos.api.SpaceMember_Role" json:"role,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } func (x *SpaceMember) Reset() { *x = SpaceMember{} - mi := &file_api_v1_space_service_proto_msgTypes[1] + mi := &file_api_space_service_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -194,7 +518,7 @@ func (x *SpaceMember) String() string { func (*SpaceMember) ProtoMessage() {} func (x *SpaceMember) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_space_service_proto_msgTypes[1] + mi := &file_api_space_service_proto_msgTypes[7] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -207,7 +531,7 @@ func (x *SpaceMember) ProtoReflect() protoreflect.Message { // Deprecated: Use SpaceMember.ProtoReflect.Descriptor instead. func (*SpaceMember) Descriptor() ([]byte, []int) { - return file_api_v1_space_service_proto_rawDescGZIP(), []int{1} + return file_api_space_service_proto_rawDescGZIP(), []int{7} } func (x *SpaceMember) GetName() string { @@ -231,17 +555,292 @@ func (x *SpaceMember) GetRole() SpaceMember_Role { return SpaceMember_ROLE_UNSPECIFIED } +// Request message for SpaceService.ListSpaceMembers. +type ListSpaceMembersRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Required. The parent space. + // Format: spaces/{space} + Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"` + // Optional. The maximum number of members to return. The service may return fewer. + PageSize int32 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + // Optional. A page token from a previous call. Provide it to retrieve the next page. + PageToken string `protobuf:"bytes,3,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListSpaceMembersRequest) Reset() { + *x = ListSpaceMembersRequest{} + mi := &file_api_space_service_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListSpaceMembersRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListSpaceMembersRequest) ProtoMessage() {} + +func (x *ListSpaceMembersRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_space_service_proto_msgTypes[8] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListSpaceMembersRequest.ProtoReflect.Descriptor instead. +func (*ListSpaceMembersRequest) Descriptor() ([]byte, []int) { + return file_api_space_service_proto_rawDescGZIP(), []int{8} +} + +func (x *ListSpaceMembersRequest) GetParent() string { + if x != nil { + return x.Parent + } + return "" +} + +func (x *ListSpaceMembersRequest) GetPageSize() int32 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *ListSpaceMembersRequest) GetPageToken() string { + if x != nil { + return x.PageToken + } + return "" +} + +// Response message for SpaceService.ListSpaceMembers. +type ListSpaceMembersResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The members of the space. + SpaceMembers []*SpaceMember `protobuf:"bytes,1,rep,name=space_members,json=spaceMembers,proto3" json:"space_members,omitempty"` + // A token to retrieve the next page. Empty when there are no more pages. + NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListSpaceMembersResponse) Reset() { + *x = ListSpaceMembersResponse{} + mi := &file_api_space_service_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListSpaceMembersResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListSpaceMembersResponse) ProtoMessage() {} + +func (x *ListSpaceMembersResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_space_service_proto_msgTypes[9] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListSpaceMembersResponse.ProtoReflect.Descriptor instead. +func (*ListSpaceMembersResponse) Descriptor() ([]byte, []int) { + return file_api_space_service_proto_rawDescGZIP(), []int{9} +} + +func (x *ListSpaceMembersResponse) GetSpaceMembers() []*SpaceMember { + if x != nil { + return x.SpaceMembers + } + return nil +} + +func (x *ListSpaceMembersResponse) GetNextPageToken() string { + if x != nil { + return x.NextPageToken + } + return "" +} + +// Request message for SpaceService.GetSpaceMember. +type GetSpaceMemberRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Required. The resource name of the membership. + // Format: spaces/{space}/members/{member} + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetSpaceMemberRequest) Reset() { + *x = GetSpaceMemberRequest{} + mi := &file_api_space_service_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetSpaceMemberRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetSpaceMemberRequest) ProtoMessage() {} + +func (x *GetSpaceMemberRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_space_service_proto_msgTypes[10] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetSpaceMemberRequest.ProtoReflect.Descriptor instead. +func (*GetSpaceMemberRequest) Descriptor() ([]byte, []int) { + return file_api_space_service_proto_rawDescGZIP(), []int{10} +} + +func (x *GetSpaceMemberRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +// Request message for SpaceService.UpdateSpaceMember. +type UpdateSpaceMemberRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Required. The membership with the new role. Its name identifies the + // membership to update. + SpaceMember *SpaceMember `protobuf:"bytes,1,opt,name=space_member,json=spaceMember,proto3" json:"space_member,omitempty"` + // Required. The fields to update. Must include role. The user path is also + // accepted, but the user must match the existing member and is never changed. + UpdateMask *fieldmaskpb.FieldMask `protobuf:"bytes,2,opt,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UpdateSpaceMemberRequest) Reset() { + *x = UpdateSpaceMemberRequest{} + mi := &file_api_space_service_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UpdateSpaceMemberRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateSpaceMemberRequest) ProtoMessage() {} + +func (x *UpdateSpaceMemberRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_space_service_proto_msgTypes[11] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateSpaceMemberRequest.ProtoReflect.Descriptor instead. +func (*UpdateSpaceMemberRequest) Descriptor() ([]byte, []int) { + return file_api_space_service_proto_rawDescGZIP(), []int{11} +} + +func (x *UpdateSpaceMemberRequest) GetSpaceMember() *SpaceMember { + if x != nil { + return x.SpaceMember + } + return nil +} + +func (x *UpdateSpaceMemberRequest) GetUpdateMask() *fieldmaskpb.FieldMask { + if x != nil { + return x.UpdateMask + } + return nil +} + +// Request message for SpaceService.DeleteSpaceMember. +type DeleteSpaceMemberRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Required. The resource name of the membership. + // Format: spaces/{space}/members/{member} + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteSpaceMemberRequest) Reset() { + *x = DeleteSpaceMemberRequest{} + mi := &file_api_space_service_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteSpaceMemberRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteSpaceMemberRequest) ProtoMessage() {} + +func (x *DeleteSpaceMemberRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_space_service_proto_msgTypes[12] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteSpaceMemberRequest.ProtoReflect.Descriptor instead. +func (*DeleteSpaceMemberRequest) Descriptor() ([]byte, []int) { + return file_api_space_service_proto_rawDescGZIP(), []int{12} +} + +func (x *DeleteSpaceMemberRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + // SpaceInvitation is a pending invitation for an existing user to join a space. type SpaceInvitation struct { state protoimpl.MessageState `protogen:"open.v1"` - // The resource name. Format: spaces/{space}/invitations/{username}. + // Identifier. The resource name of the invitation. The invitation segment + // is the invitee's username. + // Format: spaces/{space}/invitations/{invitation} Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Required. The invited user. Format: users/{username}. + // Required. The invited user. + // Format: users/{user} Invitee string `protobuf:"bytes,2,opt,name=invitee,proto3" json:"invitee,omitempty"` - // Required. The role the user will receive after accepting the invitation. - Role SpaceMember_Role `protobuf:"varint,3,opt,name=role,proto3,enum=memos.api.v1.SpaceMember_Role" json:"role,omitempty"` - // Output only. The Space the user is invited to. This lets an invitee - // understand the invitation without granting membership-based GetSpace access. + // Required. The role the user receives after accepting the invitation. + Role SpaceMember_Role `protobuf:"varint,3,opt,name=role,proto3,enum=memos.api.SpaceMember_Role" json:"role,omitempty"` + // Output only. The space the user is invited to, as metadata only. This lets + // an invitee understand the invitation without membership-based GetSpace + // access. Space *Space `protobuf:"bytes,4,opt,name=space,proto3" json:"space,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache @@ -249,7 +848,7 @@ type SpaceInvitation struct { func (x *SpaceInvitation) Reset() { *x = SpaceInvitation{} - mi := &file_api_v1_space_service_proto_msgTypes[2] + mi := &file_api_space_service_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -261,7 +860,7 @@ func (x *SpaceInvitation) String() string { func (*SpaceInvitation) ProtoMessage() {} func (x *SpaceInvitation) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_space_service_proto_msgTypes[2] + mi := &file_api_space_service_proto_msgTypes[13] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -274,7 +873,7 @@ func (x *SpaceInvitation) ProtoReflect() protoreflect.Message { // Deprecated: Use SpaceInvitation.ProtoReflect.Descriptor instead. func (*SpaceInvitation) Descriptor() ([]byte, []int) { - return file_api_v1_space_service_proto_rawDescGZIP(), []int{2} + return file_api_space_service_proto_rawDescGZIP(), []int{13} } func (x *SpaceInvitation) GetName() string { @@ -305,373 +904,15 @@ func (x *SpaceInvitation) GetSpace() *Space { return nil } -type CreateSpaceRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Required. The space to create. - Space *Space `protobuf:"bytes,1,opt,name=space,proto3" json:"space,omitempty"` - // Optional. The space UID to use for this space. - // If empty, a canonical UUID v4 will be generated. - // Format: ^[a-zA-Z0-9]([a-zA-Z0-9-]{0,34}[a-zA-Z0-9])?$ - SpaceId string `protobuf:"bytes,2,opt,name=space_id,json=spaceId,proto3" json:"space_id,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *CreateSpaceRequest) Reset() { - *x = CreateSpaceRequest{} - mi := &file_api_v1_space_service_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *CreateSpaceRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CreateSpaceRequest) ProtoMessage() {} - -func (x *CreateSpaceRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_space_service_proto_msgTypes[3] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CreateSpaceRequest.ProtoReflect.Descriptor instead. -func (*CreateSpaceRequest) Descriptor() ([]byte, []int) { - return file_api_v1_space_service_proto_rawDescGZIP(), []int{3} -} - -func (x *CreateSpaceRequest) GetSpace() *Space { - if x != nil { - return x.Space - } - return nil -} - -func (x *CreateSpaceRequest) GetSpaceId() string { - if x != nil { - return x.SpaceId - } - return "" -} - -type ListSpacesRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Optional. The maximum number of spaces to return. - PageSize int32 `protobuf:"varint,1,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` - // Optional. A token from a previous ListSpaces response. - PageToken string `protobuf:"bytes,2,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ListSpacesRequest) Reset() { - *x = ListSpacesRequest{} - mi := &file_api_v1_space_service_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ListSpacesRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ListSpacesRequest) ProtoMessage() {} - -func (x *ListSpacesRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_space_service_proto_msgTypes[4] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ListSpacesRequest.ProtoReflect.Descriptor instead. -func (*ListSpacesRequest) Descriptor() ([]byte, []int) { - return file_api_v1_space_service_proto_rawDescGZIP(), []int{4} -} - -func (x *ListSpacesRequest) GetPageSize() int32 { - if x != nil { - return x.PageSize - } - return 0 -} - -func (x *ListSpacesRequest) GetPageToken() string { - if x != nil { - return x.PageToken - } - return "" -} - -type ListSpacesResponse struct { - state protoimpl.MessageState `protogen:"open.v1"` - Spaces []*Space `protobuf:"bytes,1,rep,name=spaces,proto3" json:"spaces,omitempty"` - NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ListSpacesResponse) Reset() { - *x = ListSpacesResponse{} - mi := &file_api_v1_space_service_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ListSpacesResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ListSpacesResponse) ProtoMessage() {} - -func (x *ListSpacesResponse) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_space_service_proto_msgTypes[5] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ListSpacesResponse.ProtoReflect.Descriptor instead. -func (*ListSpacesResponse) Descriptor() ([]byte, []int) { - return file_api_v1_space_service_proto_rawDescGZIP(), []int{5} -} - -func (x *ListSpacesResponse) GetSpaces() []*Space { - if x != nil { - return x.Spaces - } - return nil -} - -func (x *ListSpacesResponse) GetNextPageToken() string { - if x != nil { - return x.NextPageToken - } - return "" -} - -type GetSpaceRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Required. The resource name of the space. - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *GetSpaceRequest) Reset() { - *x = GetSpaceRequest{} - mi := &file_api_v1_space_service_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *GetSpaceRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetSpaceRequest) ProtoMessage() {} - -func (x *GetSpaceRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_space_service_proto_msgTypes[6] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetSpaceRequest.ProtoReflect.Descriptor instead. -func (*GetSpaceRequest) Descriptor() ([]byte, []int) { - return file_api_v1_space_service_proto_rawDescGZIP(), []int{6} -} - -func (x *GetSpaceRequest) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -type UpdateSpaceRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Required. The space with updated values. - Space *Space `protobuf:"bytes,1,opt,name=space,proto3" json:"space,omitempty"` - // Required. The fields to update: title or description. - UpdateMask *fieldmaskpb.FieldMask `protobuf:"bytes,2,opt,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *UpdateSpaceRequest) Reset() { - *x = UpdateSpaceRequest{} - mi := &file_api_v1_space_service_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *UpdateSpaceRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateSpaceRequest) ProtoMessage() {} - -func (x *UpdateSpaceRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_space_service_proto_msgTypes[7] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateSpaceRequest.ProtoReflect.Descriptor instead. -func (*UpdateSpaceRequest) Descriptor() ([]byte, []int) { - return file_api_v1_space_service_proto_rawDescGZIP(), []int{7} -} - -func (x *UpdateSpaceRequest) GetSpace() *Space { - if x != nil { - return x.Space - } - return nil -} - -func (x *UpdateSpaceRequest) GetUpdateMask() *fieldmaskpb.FieldMask { - if x != nil { - return x.UpdateMask - } - return nil -} - -type DeleteSpaceRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Required. The resource name of the space. - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *DeleteSpaceRequest) Reset() { - *x = DeleteSpaceRequest{} - mi := &file_api_v1_space_service_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *DeleteSpaceRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DeleteSpaceRequest) ProtoMessage() {} - -func (x *DeleteSpaceRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_space_service_proto_msgTypes[8] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DeleteSpaceRequest.ProtoReflect.Descriptor instead. -func (*DeleteSpaceRequest) Descriptor() ([]byte, []int) { - return file_api_v1_space_service_proto_rawDescGZIP(), []int{8} -} - -func (x *DeleteSpaceRequest) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -type CreateSpaceInvitationRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Required. The parent space. Format: spaces/{space}. - Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"` - // Required. The invitation to create. - SpaceInvitation *SpaceInvitation `protobuf:"bytes,2,opt,name=space_invitation,json=spaceInvitation,proto3" json:"space_invitation,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *CreateSpaceInvitationRequest) Reset() { - *x = CreateSpaceInvitationRequest{} - mi := &file_api_v1_space_service_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *CreateSpaceInvitationRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CreateSpaceInvitationRequest) ProtoMessage() {} - -func (x *CreateSpaceInvitationRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_space_service_proto_msgTypes[9] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CreateSpaceInvitationRequest.ProtoReflect.Descriptor instead. -func (*CreateSpaceInvitationRequest) Descriptor() ([]byte, []int) { - return file_api_v1_space_service_proto_rawDescGZIP(), []int{9} -} - -func (x *CreateSpaceInvitationRequest) GetParent() string { - if x != nil { - return x.Parent - } - return "" -} - -func (x *CreateSpaceInvitationRequest) GetSpaceInvitation() *SpaceInvitation { - if x != nil { - return x.SpaceInvitation - } - return nil -} - +// Request message for SpaceService.ListSpaceInvitations. type ListSpaceInvitationsRequest struct { state protoimpl.MessageState `protogen:"open.v1"` - // Required. The parent space. Format: spaces/{space}. + // Required. The parent space. + // Format: spaces/{space} Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"` - // Optional. The maximum number of invitations to return. + // Optional. The maximum number of invitations to return. The service may return fewer. PageSize int32 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` - // Optional. A token from a previous ListSpaceInvitations response. + // Optional. A page token from a previous call. Provide it to retrieve the next page. PageToken string `protobuf:"bytes,3,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache @@ -679,7 +920,7 @@ type ListSpaceInvitationsRequest struct { func (x *ListSpaceInvitationsRequest) Reset() { *x = ListSpaceInvitationsRequest{} - mi := &file_api_v1_space_service_proto_msgTypes[10] + mi := &file_api_space_service_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -691,7 +932,7 @@ func (x *ListSpaceInvitationsRequest) String() string { func (*ListSpaceInvitationsRequest) ProtoMessage() {} func (x *ListSpaceInvitationsRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_space_service_proto_msgTypes[10] + mi := &file_api_space_service_proto_msgTypes[14] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -704,7 +945,7 @@ func (x *ListSpaceInvitationsRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ListSpaceInvitationsRequest.ProtoReflect.Descriptor instead. func (*ListSpaceInvitationsRequest) Descriptor() ([]byte, []int) { - return file_api_v1_space_service_proto_rawDescGZIP(), []int{10} + return file_api_space_service_proto_rawDescGZIP(), []int{14} } func (x *ListSpaceInvitationsRequest) GetParent() string { @@ -728,17 +969,20 @@ func (x *ListSpaceInvitationsRequest) GetPageToken() string { return "" } +// Response message for SpaceService.ListSpaceInvitations. type ListSpaceInvitationsResponse struct { - state protoimpl.MessageState `protogen:"open.v1"` - SpaceInvitations []*SpaceInvitation `protobuf:"bytes,1,rep,name=space_invitations,json=spaceInvitations,proto3" json:"space_invitations,omitempty"` - NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + // The pending invitations for the space. + SpaceInvitations []*SpaceInvitation `protobuf:"bytes,1,rep,name=space_invitations,json=spaceInvitations,proto3" json:"space_invitations,omitempty"` + // A token to retrieve the next page. Empty when there are no more pages. + NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *ListSpaceInvitationsResponse) Reset() { *x = ListSpaceInvitationsResponse{} - mi := &file_api_v1_space_service_proto_msgTypes[11] + mi := &file_api_space_service_proto_msgTypes[15] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -750,7 +994,7 @@ func (x *ListSpaceInvitationsResponse) String() string { func (*ListSpaceInvitationsResponse) ProtoMessage() {} func (x *ListSpaceInvitationsResponse) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_space_service_proto_msgTypes[11] + mi := &file_api_space_service_proto_msgTypes[15] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -763,7 +1007,7 @@ func (x *ListSpaceInvitationsResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use ListSpaceInvitationsResponse.ProtoReflect.Descriptor instead. func (*ListSpaceInvitationsResponse) Descriptor() ([]byte, []int) { - return file_api_v1_space_service_proto_rawDescGZIP(), []int{11} + return file_api_space_service_proto_rawDescGZIP(), []int{15} } func (x *ListSpaceInvitationsResponse) GetSpaceInvitations() []*SpaceInvitation { @@ -780,13 +1024,16 @@ func (x *ListSpaceInvitationsResponse) GetNextPageToken() string { return "" } +// Request message for SpaceService.ListUserSpaceInvitations. type ListUserSpaceInvitationsRequest struct { state protoimpl.MessageState `protogen:"open.v1"` - // Required. The authenticated user. Format: users/{username}. + // Required. The user whose invitations to list. Must be the authenticated + // user. + // Format: users/{user} Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"` - // Optional. The maximum number of invitations to return. + // Optional. The maximum number of invitations to return. The service may return fewer. PageSize int32 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` - // Optional. A token from a previous ListUserSpaceInvitations response. + // Optional. A page token from a previous call. Provide it to retrieve the next page. PageToken string `protobuf:"bytes,3,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache @@ -794,7 +1041,7 @@ type ListUserSpaceInvitationsRequest struct { func (x *ListUserSpaceInvitationsRequest) Reset() { *x = ListUserSpaceInvitationsRequest{} - mi := &file_api_v1_space_service_proto_msgTypes[12] + mi := &file_api_space_service_proto_msgTypes[16] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -806,7 +1053,7 @@ func (x *ListUserSpaceInvitationsRequest) String() string { func (*ListUserSpaceInvitationsRequest) ProtoMessage() {} func (x *ListUserSpaceInvitationsRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_space_service_proto_msgTypes[12] + mi := &file_api_space_service_proto_msgTypes[16] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -819,7 +1066,7 @@ func (x *ListUserSpaceInvitationsRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ListUserSpaceInvitationsRequest.ProtoReflect.Descriptor instead. func (*ListUserSpaceInvitationsRequest) Descriptor() ([]byte, []int) { - return file_api_v1_space_service_proto_rawDescGZIP(), []int{12} + return file_api_space_service_proto_rawDescGZIP(), []int{16} } func (x *ListUserSpaceInvitationsRequest) GetParent() string { @@ -843,17 +1090,20 @@ func (x *ListUserSpaceInvitationsRequest) GetPageToken() string { return "" } +// Response message for SpaceService.ListUserSpaceInvitations. type ListUserSpaceInvitationsResponse struct { - state protoimpl.MessageState `protogen:"open.v1"` - SpaceInvitations []*SpaceInvitation `protobuf:"bytes,1,rep,name=space_invitations,json=spaceInvitations,proto3" json:"space_invitations,omitempty"` - NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + // The pending invitations received by the user. + SpaceInvitations []*SpaceInvitation `protobuf:"bytes,1,rep,name=space_invitations,json=spaceInvitations,proto3" json:"space_invitations,omitempty"` + // A token to retrieve the next page. Empty when there are no more pages. + NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *ListUserSpaceInvitationsResponse) Reset() { *x = ListUserSpaceInvitationsResponse{} - mi := &file_api_v1_space_service_proto_msgTypes[13] + mi := &file_api_space_service_proto_msgTypes[17] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -865,7 +1115,7 @@ func (x *ListUserSpaceInvitationsResponse) String() string { func (*ListUserSpaceInvitationsResponse) ProtoMessage() {} func (x *ListUserSpaceInvitationsResponse) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_space_service_proto_msgTypes[13] + mi := &file_api_space_service_proto_msgTypes[17] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -878,7 +1128,7 @@ func (x *ListUserSpaceInvitationsResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use ListUserSpaceInvitationsResponse.ProtoReflect.Descriptor instead. func (*ListUserSpaceInvitationsResponse) Descriptor() ([]byte, []int) { - return file_api_v1_space_service_proto_rawDescGZIP(), []int{13} + return file_api_space_service_proto_rawDescGZIP(), []int{17} } func (x *ListUserSpaceInvitationsResponse) GetSpaceInvitations() []*SpaceInvitation { @@ -895,9 +1145,11 @@ func (x *ListUserSpaceInvitationsResponse) GetNextPageToken() string { return "" } +// Request message for SpaceService.GetSpaceInvitation. type GetSpaceInvitationRequest struct { state protoimpl.MessageState `protogen:"open.v1"` - // Required. Format: spaces/{space}/invitations/{username}. + // Required. The resource name of the invitation. + // Format: spaces/{space}/invitations/{invitation} Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache @@ -905,7 +1157,7 @@ type GetSpaceInvitationRequest struct { func (x *GetSpaceInvitationRequest) Reset() { *x = GetSpaceInvitationRequest{} - mi := &file_api_v1_space_service_proto_msgTypes[14] + mi := &file_api_space_service_proto_msgTypes[18] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -917,7 +1169,7 @@ func (x *GetSpaceInvitationRequest) String() string { func (*GetSpaceInvitationRequest) ProtoMessage() {} func (x *GetSpaceInvitationRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_space_service_proto_msgTypes[14] + mi := &file_api_space_service_proto_msgTypes[18] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -930,7 +1182,7 @@ func (x *GetSpaceInvitationRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetSpaceInvitationRequest.ProtoReflect.Descriptor instead. func (*GetSpaceInvitationRequest) Descriptor() ([]byte, []int) { - return file_api_v1_space_service_proto_rawDescGZIP(), []int{14} + return file_api_space_service_proto_rawDescGZIP(), []int{18} } func (x *GetSpaceInvitationRequest) GetName() string { @@ -940,9 +1192,67 @@ func (x *GetSpaceInvitationRequest) GetName() string { return "" } +// Request message for SpaceService.CreateSpaceInvitation. +type CreateSpaceInvitationRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Required. The parent space. + // Format: spaces/{space} + Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"` + // Required. The invitation to create. The role must be ADMIN or USER. + SpaceInvitation *SpaceInvitation `protobuf:"bytes,2,opt,name=space_invitation,json=spaceInvitation,proto3" json:"space_invitation,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateSpaceInvitationRequest) Reset() { + *x = CreateSpaceInvitationRequest{} + mi := &file_api_space_service_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateSpaceInvitationRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateSpaceInvitationRequest) ProtoMessage() {} + +func (x *CreateSpaceInvitationRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_space_service_proto_msgTypes[19] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateSpaceInvitationRequest.ProtoReflect.Descriptor instead. +func (*CreateSpaceInvitationRequest) Descriptor() ([]byte, []int) { + return file_api_space_service_proto_rawDescGZIP(), []int{19} +} + +func (x *CreateSpaceInvitationRequest) GetParent() string { + if x != nil { + return x.Parent + } + return "" +} + +func (x *CreateSpaceInvitationRequest) GetSpaceInvitation() *SpaceInvitation { + if x != nil { + return x.SpaceInvitation + } + return nil +} + +// Request message for SpaceService.DeleteSpaceInvitation. type DeleteSpaceInvitationRequest struct { state protoimpl.MessageState `protogen:"open.v1"` - // Required. Format: spaces/{space}/invitations/{username}. + // Required. The resource name of the invitation. + // Format: spaces/{space}/invitations/{invitation} Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache @@ -950,7 +1260,7 @@ type DeleteSpaceInvitationRequest struct { func (x *DeleteSpaceInvitationRequest) Reset() { *x = DeleteSpaceInvitationRequest{} - mi := &file_api_v1_space_service_proto_msgTypes[15] + mi := &file_api_space_service_proto_msgTypes[20] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -962,7 +1272,7 @@ func (x *DeleteSpaceInvitationRequest) String() string { func (*DeleteSpaceInvitationRequest) ProtoMessage() {} func (x *DeleteSpaceInvitationRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_space_service_proto_msgTypes[15] + mi := &file_api_space_service_proto_msgTypes[20] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -975,7 +1285,7 @@ func (x *DeleteSpaceInvitationRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use DeleteSpaceInvitationRequest.ProtoReflect.Descriptor instead. func (*DeleteSpaceInvitationRequest) Descriptor() ([]byte, []int) { - return file_api_v1_space_service_proto_rawDescGZIP(), []int{15} + return file_api_space_service_proto_rawDescGZIP(), []int{20} } func (x *DeleteSpaceInvitationRequest) GetName() string { @@ -985,9 +1295,11 @@ func (x *DeleteSpaceInvitationRequest) GetName() string { return "" } +// Request message for SpaceService.AcceptSpaceInvitation. type AcceptSpaceInvitationRequest struct { state protoimpl.MessageState `protogen:"open.v1"` - // Required. Format: spaces/{space}/invitations/{username}. + // Required. The resource name of the invitation. + // Format: spaces/{space}/invitations/{invitation} Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache @@ -995,7 +1307,7 @@ type AcceptSpaceInvitationRequest struct { func (x *AcceptSpaceInvitationRequest) Reset() { *x = AcceptSpaceInvitationRequest{} - mi := &file_api_v1_space_service_proto_msgTypes[16] + mi := &file_api_space_service_proto_msgTypes[21] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1007,7 +1319,7 @@ func (x *AcceptSpaceInvitationRequest) String() string { func (*AcceptSpaceInvitationRequest) ProtoMessage() {} func (x *AcceptSpaceInvitationRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_space_service_proto_msgTypes[16] + mi := &file_api_space_service_proto_msgTypes[21] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1020,7 +1332,7 @@ func (x *AcceptSpaceInvitationRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use AcceptSpaceInvitationRequest.ProtoReflect.Descriptor instead. func (*AcceptSpaceInvitationRequest) Descriptor() ([]byte, []int) { - return file_api_v1_space_service_proto_rawDescGZIP(), []int{16} + return file_api_space_service_proto_rawDescGZIP(), []int{21} } func (x *AcceptSpaceInvitationRequest) GetName() string { @@ -1030,9 +1342,11 @@ func (x *AcceptSpaceInvitationRequest) GetName() string { return "" } +// Request message for SpaceService.DeclineSpaceInvitation. type DeclineSpaceInvitationRequest struct { state protoimpl.MessageState `protogen:"open.v1"` - // Required. Format: spaces/{space}/invitations/{username}. + // Required. The resource name of the invitation. + // Format: spaces/{space}/invitations/{invitation} Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache @@ -1040,7 +1354,7 @@ type DeclineSpaceInvitationRequest struct { func (x *DeclineSpaceInvitationRequest) Reset() { *x = DeclineSpaceInvitationRequest{} - mi := &file_api_v1_space_service_proto_msgTypes[17] + mi := &file_api_space_service_proto_msgTypes[22] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1052,7 +1366,7 @@ func (x *DeclineSpaceInvitationRequest) String() string { func (*DeclineSpaceInvitationRequest) ProtoMessage() {} func (x *DeclineSpaceInvitationRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_space_service_proto_msgTypes[17] + mi := &file_api_space_service_proto_msgTypes[22] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1065,7 +1379,7 @@ func (x *DeclineSpaceInvitationRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use DeclineSpaceInvitationRequest.ProtoReflect.Descriptor instead. func (*DeclineSpaceInvitationRequest) Descriptor() ([]byte, []int) { - return file_api_v1_space_service_proto_rawDescGZIP(), []int{17} + return file_api_space_service_proto_rawDescGZIP(), []int{22} } func (x *DeclineSpaceInvitationRequest) GetName() string { @@ -1075,267 +1389,11 @@ func (x *DeclineSpaceInvitationRequest) GetName() string { return "" } -type ListSpaceMembersRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Required. The parent space. Format: spaces/{space}. - Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"` - // Optional. The maximum number of members to return. - PageSize int32 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` - // Optional. A token from a previous ListSpaceMembers response. - PageToken string `protobuf:"bytes,3,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ListSpaceMembersRequest) Reset() { - *x = ListSpaceMembersRequest{} - mi := &file_api_v1_space_service_proto_msgTypes[18] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ListSpaceMembersRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ListSpaceMembersRequest) ProtoMessage() {} - -func (x *ListSpaceMembersRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_space_service_proto_msgTypes[18] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ListSpaceMembersRequest.ProtoReflect.Descriptor instead. -func (*ListSpaceMembersRequest) Descriptor() ([]byte, []int) { - return file_api_v1_space_service_proto_rawDescGZIP(), []int{18} -} - -func (x *ListSpaceMembersRequest) GetParent() string { - if x != nil { - return x.Parent - } - return "" -} - -func (x *ListSpaceMembersRequest) GetPageSize() int32 { - if x != nil { - return x.PageSize - } - return 0 -} - -func (x *ListSpaceMembersRequest) GetPageToken() string { - if x != nil { - return x.PageToken - } - return "" -} - -type ListSpaceMembersResponse struct { - state protoimpl.MessageState `protogen:"open.v1"` - SpaceMembers []*SpaceMember `protobuf:"bytes,1,rep,name=space_members,json=spaceMembers,proto3" json:"space_members,omitempty"` - NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ListSpaceMembersResponse) Reset() { - *x = ListSpaceMembersResponse{} - mi := &file_api_v1_space_service_proto_msgTypes[19] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ListSpaceMembersResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ListSpaceMembersResponse) ProtoMessage() {} - -func (x *ListSpaceMembersResponse) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_space_service_proto_msgTypes[19] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ListSpaceMembersResponse.ProtoReflect.Descriptor instead. -func (*ListSpaceMembersResponse) Descriptor() ([]byte, []int) { - return file_api_v1_space_service_proto_rawDescGZIP(), []int{19} -} - -func (x *ListSpaceMembersResponse) GetSpaceMembers() []*SpaceMember { - if x != nil { - return x.SpaceMembers - } - return nil -} - -func (x *ListSpaceMembersResponse) GetNextPageToken() string { - if x != nil { - return x.NextPageToken - } - return "" -} - -type GetSpaceMemberRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Required. Format: spaces/{space}/members/{username}. - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *GetSpaceMemberRequest) Reset() { - *x = GetSpaceMemberRequest{} - mi := &file_api_v1_space_service_proto_msgTypes[20] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *GetSpaceMemberRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetSpaceMemberRequest) ProtoMessage() {} - -func (x *GetSpaceMemberRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_space_service_proto_msgTypes[20] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetSpaceMemberRequest.ProtoReflect.Descriptor instead. -func (*GetSpaceMemberRequest) Descriptor() ([]byte, []int) { - return file_api_v1_space_service_proto_rawDescGZIP(), []int{20} -} - -func (x *GetSpaceMemberRequest) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -type UpdateSpaceMemberRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Required. The membership with the new role. - SpaceMember *SpaceMember `protobuf:"bytes,1,opt,name=space_member,json=spaceMember,proto3" json:"space_member,omitempty"` - // Required. Only role is supported. - UpdateMask *fieldmaskpb.FieldMask `protobuf:"bytes,2,opt,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *UpdateSpaceMemberRequest) Reset() { - *x = UpdateSpaceMemberRequest{} - mi := &file_api_v1_space_service_proto_msgTypes[21] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *UpdateSpaceMemberRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateSpaceMemberRequest) ProtoMessage() {} - -func (x *UpdateSpaceMemberRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_space_service_proto_msgTypes[21] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateSpaceMemberRequest.ProtoReflect.Descriptor instead. -func (*UpdateSpaceMemberRequest) Descriptor() ([]byte, []int) { - return file_api_v1_space_service_proto_rawDescGZIP(), []int{21} -} - -func (x *UpdateSpaceMemberRequest) GetSpaceMember() *SpaceMember { - if x != nil { - return x.SpaceMember - } - return nil -} - -func (x *UpdateSpaceMemberRequest) GetUpdateMask() *fieldmaskpb.FieldMask { - if x != nil { - return x.UpdateMask - } - return nil -} - -type DeleteSpaceMemberRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Required. Format: spaces/{space}/members/{username}. - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *DeleteSpaceMemberRequest) Reset() { - *x = DeleteSpaceMemberRequest{} - mi := &file_api_v1_space_service_proto_msgTypes[22] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *DeleteSpaceMemberRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DeleteSpaceMemberRequest) ProtoMessage() {} - -func (x *DeleteSpaceMemberRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_space_service_proto_msgTypes[22] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DeleteSpaceMemberRequest.ProtoReflect.Descriptor instead. -func (*DeleteSpaceMemberRequest) Descriptor() ([]byte, []int) { - return file_api_v1_space_service_proto_rawDescGZIP(), []int{22} -} - -func (x *DeleteSpaceMemberRequest) GetName() string { - if x != nil { - return x.Name - } - return "" -} - +// Icon is the display icon of a space. type Space_Icon struct { state protoimpl.MessageState `protogen:"open.v1"` + // The icon value. + // // Types that are valid to be assigned to Value: // // *Space_Icon_Emoji @@ -1347,7 +1405,7 @@ type Space_Icon struct { func (x *Space_Icon) Reset() { *x = Space_Icon{} - mi := &file_api_v1_space_service_proto_msgTypes[23] + mi := &file_api_space_service_proto_msgTypes[23] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1359,7 +1417,7 @@ func (x *Space_Icon) String() string { func (*Space_Icon) ProtoMessage() {} func (x *Space_Icon) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_space_service_proto_msgTypes[23] + mi := &file_api_space_service_proto_msgTypes[23] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1372,7 +1430,7 @@ func (x *Space_Icon) ProtoReflect() protoreflect.Message { // Deprecated: Use Space_Icon.ProtoReflect.Descriptor instead. func (*Space_Icon) Descriptor() ([]byte, []int) { - return file_api_v1_space_service_proto_rawDescGZIP(), []int{0, 0} + return file_api_space_service_proto_rawDescGZIP(), []int{0, 0} } func (x *Space_Icon) GetValue() isSpace_Icon_Value { @@ -1418,221 +1476,222 @@ func (*Space_Icon_Emoji) isSpace_Icon_Value() {} func (*Space_Icon_Lucide) isSpace_Icon_Value() {} -var File_api_v1_space_service_proto protoreflect.FileDescriptor +var File_api_space_service_proto protoreflect.FileDescriptor -const file_api_v1_space_service_proto_rawDesc = "" + +const file_api_space_service_proto_rawDesc = "" + "\n" + - "\x1aapi/v1/space_service.proto\x12\fmemos.api.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto\"\x8f\x03\n" + + "\x17api/space_service.proto\x12\tmemos.api\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto\"\x80\x03\n" + "\x05Space\x12\x17\n" + "\x04name\x18\x01 \x01(\tB\x03\xe0A\bR\x04name\x12\x19\n" + "\x05title\x18\x02 \x01(\tB\x03\xe0A\x02R\x05title\x12%\n" + - "\vdescription\x18\x03 \x01(\tB\x03\xe0A\x01R\vdescription\x12O\n" + - "\x11current_user_role\x18\x04 \x01(\x0e2\x1e.memos.api.v1.SpaceMember.RoleB\x03\xe0A\x03R\x0fcurrentUserRole\x12&\n" + - "\fmember_count\x18\x05 \x01(\x05B\x03\xe0A\x03R\vmemberCount\x121\n" + - "\x04icon\x18\x06 \x01(\v2\x18.memos.api.v1.Space.IconB\x03\xe0A\x01R\x04icon\x1aA\n" + + "\vdescription\x18\x03 \x01(\tB\x03\xe0A\x01R\vdescription\x12.\n" + + "\x04icon\x18\x04 \x01(\v2\x15.memos.api.Space.IconB\x03\xe0A\x01R\x04icon\x12L\n" + + "\x11current_user_role\x18\x05 \x01(\x0e2\x1b.memos.api.SpaceMember.RoleB\x03\xe0A\x03R\x0fcurrentUserRole\x12&\n" + + "\fmember_count\x18\x06 \x01(\x05B\x03\xe0A\x03R\vmemberCount\x1aA\n" + "\x04Icon\x12\x16\n" + "\x05emoji\x18\x01 \x01(\tH\x00R\x05emoji\x12\x18\n" + "\x06lucide\x18\x02 \x01(\tH\x00R\x06lucideB\a\n" + - "\x05value:<\xeaA9\n" + - "\x12memos.api.v1/Space\x12\x0espaces/{space}\x1a\x04name*\x06spaces2\x05space\"\xa2\x02\n" + - "\vSpaceMember\x12\x17\n" + - "\x04name\x18\x01 \x01(\tB\x03\xe0A\bR\x04name\x12-\n" + - "\x04user\x18\x02 \x01(\tB\x19\xe0A\x02\xfaA\x13\n" + - "\x11memos.api.v1/UserR\x04user\x127\n" + - "\x04role\x18\x03 \x01(\x0e2\x1e.memos.api.v1.SpaceMember.RoleB\x03\xe0A\x02R\x04role\"1\n" + - "\x04Role\x12\x14\n" + - "\x10ROLE_UNSPECIFIED\x10\x00\x12\t\n" + - "\x05ADMIN\x10\x01\x12\b\n" + - "\x04USER\x10\x02:_\xeaA\\\n" + - "\x18memos.api.v1/SpaceMember\x12\x1fspaces/{space}/members/{member}\x1a\x04name*\fspaceMembers2\vspaceMember\"\xbd\x02\n" + - "\x0fSpaceInvitation\x12\x17\n" + - "\x04name\x18\x01 \x01(\tB\x03\xe0A\bR\x04name\x123\n" + - "\ainvitee\x18\x02 \x01(\tB\x19\xe0A\x02\xfaA\x13\n" + - "\x11memos.api.v1/UserR\ainvitee\x127\n" + - "\x04role\x18\x03 \x01(\x0e2\x1e.memos.api.v1.SpaceMember.RoleB\x03\xe0A\x02R\x04role\x12.\n" + - "\x05space\x18\x04 \x01(\v2\x13.memos.api.v1.SpaceB\x03\xe0A\x03R\x05space:s\xeaAp\n" + - "\x1cmemos.api.v1/SpaceInvitation\x12'spaces/{space}/invitations/{invitation}\x1a\x04name*\x10spaceInvitations2\x0fspaceInvitation\"d\n" + - "\x12CreateSpaceRequest\x12.\n" + - "\x05space\x18\x01 \x01(\v2\x13.memos.api.v1.SpaceB\x03\xe0A\x02R\x05space\x12\x1e\n" + - "\bspace_id\x18\x02 \x01(\tB\x03\xe0A\x01R\aspaceId\"Y\n" + + "\x05value:3\xeaA0\n" + + "\x0fmemos.api/Space\x12\x0espaces/{space}*\x06spaces2\x05space\"Y\n" + "\x11ListSpacesRequest\x12 \n" + "\tpage_size\x18\x01 \x01(\x05B\x03\xe0A\x01R\bpageSize\x12\"\n" + "\n" + - "page_token\x18\x02 \x01(\tB\x03\xe0A\x01R\tpageToken\"i\n" + - "\x12ListSpacesResponse\x12+\n" + - "\x06spaces\x18\x01 \x03(\v2\x13.memos.api.v1.SpaceR\x06spaces\x12&\n" + - "\x0fnext_page_token\x18\x02 \x01(\tR\rnextPageToken\"A\n" + - "\x0fGetSpaceRequest\x12.\n" + - "\x04name\x18\x01 \x01(\tB\x1a\xe0A\x02\xfaA\x14\n" + - "\x12memos.api.v1/SpaceR\x04name\"\x86\x01\n" + - "\x12UpdateSpaceRequest\x12.\n" + - "\x05space\x18\x01 \x01(\v2\x13.memos.api.v1.SpaceB\x03\xe0A\x02R\x05space\x12@\n" + + "page_token\x18\x02 \x01(\tB\x03\xe0A\x01R\tpageToken\"f\n" + + "\x12ListSpacesResponse\x12(\n" + + "\x06spaces\x18\x01 \x03(\v2\x10.memos.api.SpaceR\x06spaces\x12&\n" + + "\x0fnext_page_token\x18\x02 \x01(\tR\rnextPageToken\">\n" + + "\x0fGetSpaceRequest\x12+\n" + + "\x04name\x18\x01 \x01(\tB\x17\xe0A\x02\xfaA\x11\n" + + "\x0fmemos.api/SpaceR\x04name\"a\n" + + "\x12CreateSpaceRequest\x12+\n" + + "\x05space\x18\x01 \x01(\v2\x10.memos.api.SpaceB\x03\xe0A\x02R\x05space\x12\x1e\n" + + "\bspace_id\x18\x02 \x01(\tB\x03\xe0A\x01R\aspaceId\"\x83\x01\n" + + "\x12UpdateSpaceRequest\x12+\n" + + "\x05space\x18\x01 \x01(\v2\x10.memos.api.SpaceB\x03\xe0A\x02R\x05space\x12@\n" + "\vupdate_mask\x18\x02 \x01(\v2\x1a.google.protobuf.FieldMaskB\x03\xe0A\x02R\n" + - "updateMask\"D\n" + - "\x12DeleteSpaceRequest\x12.\n" + - "\x04name\x18\x01 \x01(\tB\x1a\xe0A\x02\xfaA\x14\n" + - "\x12memos.api.v1/SpaceR\x04name\"\xab\x01\n" + - "\x1cCreateSpaceInvitationRequest\x12<\n" + - "\x06parent\x18\x01 \x01(\tB$\xe0A\x02\xfaA\x1e\x12\x1cmemos.api.v1/SpaceInvitationR\x06parent\x12M\n" + - "\x10space_invitation\x18\x02 \x01(\v2\x1d.memos.api.v1.SpaceInvitationB\x03\xe0A\x02R\x0fspaceInvitation\"\xa1\x01\n" + - "\x1bListSpaceInvitationsRequest\x12<\n" + - "\x06parent\x18\x01 \x01(\tB$\xe0A\x02\xfaA\x1e\x12\x1cmemos.api.v1/SpaceInvitationR\x06parent\x12 \n" + + "updateMask\"A\n" + + "\x12DeleteSpaceRequest\x12+\n" + + "\x04name\x18\x01 \x01(\tB\x17\xe0A\x02\xfaA\x11\n" + + "\x0fmemos.api/SpaceR\x04name\"\x93\x02\n" + + "\vSpaceMember\x12\x17\n" + + "\x04name\x18\x01 \x01(\tB\x03\xe0A\bR\x04name\x12*\n" + + "\x04user\x18\x02 \x01(\tB\x16\xe0A\x02\xfaA\x10\n" + + "\x0ememos.api/UserR\x04user\x124\n" + + "\x04role\x18\x03 \x01(\x0e2\x1b.memos.api.SpaceMember.RoleB\x03\xe0A\x02R\x04role\"1\n" + + "\x04Role\x12\x14\n" + + "\x10ROLE_UNSPECIFIED\x10\x00\x12\t\n" + + "\x05ADMIN\x10\x01\x12\b\n" + + "\x04USER\x10\x02:V\xeaAS\n" + + "\x15memos.api/SpaceMember\x12\x1fspaces/{space}/members/{member}*\fspaceMembers2\vspaceMember\"\x96\x01\n" + + "\x17ListSpaceMembersRequest\x125\n" + + "\x06parent\x18\x01 \x01(\tB\x1d\xe0A\x02\xfaA\x17\x12\x15memos.api/SpaceMemberR\x06parent\x12 \n" + "\tpage_size\x18\x02 \x01(\x05B\x03\xe0A\x01R\bpageSize\x12\"\n" + "\n" + - "page_token\x18\x03 \x01(\tB\x03\xe0A\x01R\tpageToken\"\x92\x01\n" + - "\x1cListSpaceInvitationsResponse\x12J\n" + - "\x11space_invitations\x18\x01 \x03(\v2\x1d.memos.api.v1.SpaceInvitationR\x10spaceInvitations\x12&\n" + - "\x0fnext_page_token\x18\x02 \x01(\tR\rnextPageToken\"\x9a\x01\n" + - "\x1fListUserSpaceInvitationsRequest\x121\n" + - "\x06parent\x18\x01 \x01(\tB\x19\xe0A\x02\xfaA\x13\n" + - "\x11memos.api.v1/UserR\x06parent\x12 \n" + - "\tpage_size\x18\x02 \x01(\x05B\x03\xe0A\x01R\bpageSize\x12\"\n" + - "\n" + - "page_token\x18\x03 \x01(\tB\x03\xe0A\x01R\tpageToken\"\x96\x01\n" + - " ListUserSpaceInvitationsResponse\x12J\n" + - "\x11space_invitations\x18\x01 \x03(\v2\x1d.memos.api.v1.SpaceInvitationR\x10spaceInvitations\x12&\n" + - "\x0fnext_page_token\x18\x02 \x01(\tR\rnextPageToken\"U\n" + - "\x19GetSpaceInvitationRequest\x128\n" + - "\x04name\x18\x01 \x01(\tB$\xe0A\x02\xfaA\x1e\n" + - "\x1cmemos.api.v1/SpaceInvitationR\x04name\"X\n" + - "\x1cDeleteSpaceInvitationRequest\x128\n" + - "\x04name\x18\x01 \x01(\tB$\xe0A\x02\xfaA\x1e\n" + - "\x1cmemos.api.v1/SpaceInvitationR\x04name\"X\n" + - "\x1cAcceptSpaceInvitationRequest\x128\n" + - "\x04name\x18\x01 \x01(\tB$\xe0A\x02\xfaA\x1e\n" + - "\x1cmemos.api.v1/SpaceInvitationR\x04name\"Y\n" + - "\x1dDeclineSpaceInvitationRequest\x128\n" + - "\x04name\x18\x01 \x01(\tB$\xe0A\x02\xfaA\x1e\n" + - "\x1cmemos.api.v1/SpaceInvitationR\x04name\"\x99\x01\n" + - "\x17ListSpaceMembersRequest\x128\n" + - "\x06parent\x18\x01 \x01(\tB \xe0A\x02\xfaA\x1a\x12\x18memos.api.v1/SpaceMemberR\x06parent\x12 \n" + - "\tpage_size\x18\x02 \x01(\x05B\x03\xe0A\x01R\bpageSize\x12\"\n" + - "\n" + - "page_token\x18\x03 \x01(\tB\x03\xe0A\x01R\tpageToken\"\x82\x01\n" + - "\x18ListSpaceMembersResponse\x12>\n" + - "\rspace_members\x18\x01 \x03(\v2\x19.memos.api.v1.SpaceMemberR\fspaceMembers\x12&\n" + - "\x0fnext_page_token\x18\x02 \x01(\tR\rnextPageToken\"M\n" + - "\x15GetSpaceMemberRequest\x124\n" + - "\x04name\x18\x01 \x01(\tB \xe0A\x02\xfaA\x1a\n" + - "\x18memos.api.v1/SpaceMemberR\x04name\"\x9f\x01\n" + - "\x18UpdateSpaceMemberRequest\x12A\n" + - "\fspace_member\x18\x01 \x01(\v2\x19.memos.api.v1.SpaceMemberB\x03\xe0A\x02R\vspaceMember\x12@\n" + + "page_token\x18\x03 \x01(\tB\x03\xe0A\x01R\tpageToken\"\x7f\n" + + "\x18ListSpaceMembersResponse\x12;\n" + + "\rspace_members\x18\x01 \x03(\v2\x16.memos.api.SpaceMemberR\fspaceMembers\x12&\n" + + "\x0fnext_page_token\x18\x02 \x01(\tR\rnextPageToken\"J\n" + + "\x15GetSpaceMemberRequest\x121\n" + + "\x04name\x18\x01 \x01(\tB\x1d\xe0A\x02\xfaA\x17\n" + + "\x15memos.api/SpaceMemberR\x04name\"\x9c\x01\n" + + "\x18UpdateSpaceMemberRequest\x12>\n" + + "\fspace_member\x18\x01 \x01(\v2\x16.memos.api.SpaceMemberB\x03\xe0A\x02R\vspaceMember\x12@\n" + "\vupdate_mask\x18\x02 \x01(\v2\x1a.google.protobuf.FieldMaskB\x03\xe0A\x02R\n" + - "updateMask\"P\n" + - "\x18DeleteSpaceMemberRequest\x124\n" + - "\x04name\x18\x01 \x01(\tB \xe0A\x02\xfaA\x1a\n" + - "\x18memos.api.v1/SpaceMemberR\x04name2\xb3\x12\n" + - "\fSpaceService\x12k\n" + - "\vCreateSpace\x12 .memos.api.v1.CreateSpaceRequest\x1a\x13.memos.api.v1.Space\"%\xdaA\x05space\x82\xd3\xe4\x93\x02\x17:\x05space\"\x0e/api/v1/spaces\x12j\n" + + "updateMask\"M\n" + + "\x18DeleteSpaceMemberRequest\x121\n" + + "\x04name\x18\x01 \x01(\tB\x1d\xe0A\x02\xfaA\x17\n" + + "\x15memos.api/SpaceMemberR\x04name\"\xab\x02\n" + + "\x0fSpaceInvitation\x12\x17\n" + + "\x04name\x18\x01 \x01(\tB\x03\xe0A\bR\x04name\x120\n" + + "\ainvitee\x18\x02 \x01(\tB\x16\xe0A\x02\xfaA\x10\n" + + "\x0ememos.api/UserR\ainvitee\x124\n" + + "\x04role\x18\x03 \x01(\x0e2\x1b.memos.api.SpaceMember.RoleB\x03\xe0A\x02R\x04role\x12+\n" + + "\x05space\x18\x04 \x01(\v2\x10.memos.api.SpaceB\x03\xe0A\x03R\x05space:j\xeaAg\n" + + "\x19memos.api/SpaceInvitation\x12'spaces/{space}/invitations/{invitation}*\x10spaceInvitations2\x0fspaceInvitation\"\x9e\x01\n" + + "\x1bListSpaceInvitationsRequest\x129\n" + + "\x06parent\x18\x01 \x01(\tB!\xe0A\x02\xfaA\x1b\x12\x19memos.api/SpaceInvitationR\x06parent\x12 \n" + + "\tpage_size\x18\x02 \x01(\x05B\x03\xe0A\x01R\bpageSize\x12\"\n" + "\n" + - "ListSpaces\x12\x1f.memos.api.v1.ListSpacesRequest\x1a .memos.api.v1.ListSpacesResponse\"\x19\xdaA\x00\x82\xd3\xe4\x93\x02\x10\x12\x0e/api/v1/spaces\x12f\n" + - "\bGetSpace\x12\x1d.memos.api.v1.GetSpaceRequest\x1a\x13.memos.api.v1.Space\"&\xdaA\x04name\x82\xd3\xe4\x93\x02\x19\x12\x17/api/v1/{name=spaces/*}\x12\x86\x01\n" + - "\vUpdateSpace\x12 .memos.api.v1.UpdateSpaceRequest\x1a\x13.memos.api.v1.Space\"@\xdaA\x11space,update_mask\x82\xd3\xe4\x93\x02&:\x05space2\x1d/api/v1/{space.name=spaces/*}\x12o\n" + - "\vDeleteSpace\x12 .memos.api.v1.DeleteSpaceRequest\x1a\x16.google.protobuf.Empty\"&\xdaA\x04name\x82\xd3\xe4\x93\x02\x19*\x17/api/v1/{name=spaces/*}\x12\xbd\x01\n" + - "\x15CreateSpaceInvitation\x12*.memos.api.v1.CreateSpaceInvitationRequest\x1a\x1d.memos.api.v1.SpaceInvitation\"Y\xdaA\x17parent,space_invitation\x82\xd3\xe4\x93\x029:\x10space_invitation\"%/api/v1/{parent=spaces/*}/invitations\x12\xa5\x01\n" + - "\x14ListSpaceInvitations\x12).memos.api.v1.ListSpaceInvitationsRequest\x1a*.memos.api.v1.ListSpaceInvitationsResponse\"6\xdaA\x06parent\x82\xd3\xe4\x93\x02'\x12%/api/v1/{parent=spaces/*}/invitations\x12\xb5\x01\n" + - "\x18ListUserSpaceInvitations\x12-.memos.api.v1.ListUserSpaceInvitationsRequest\x1a..memos.api.v1.ListUserSpaceInvitationsResponse\":\xdaA\x06parent\x82\xd3\xe4\x93\x02+\x12)/api/v1/{parent=users/*}/spaceInvitations\x12\x92\x01\n" + - "\x12GetSpaceInvitation\x12'.memos.api.v1.GetSpaceInvitationRequest\x1a\x1d.memos.api.v1.SpaceInvitation\"4\xdaA\x04name\x82\xd3\xe4\x93\x02'\x12%/api/v1/{name=spaces/*/invitations/*}\x12\x91\x01\n" + - "\x15DeleteSpaceInvitation\x12*.memos.api.v1.DeleteSpaceInvitationRequest\x1a\x16.google.protobuf.Empty\"4\xdaA\x04name\x82\xd3\xe4\x93\x02'*%/api/v1/{name=spaces/*/invitations/*}\x12\x9e\x01\n" + - "\x15AcceptSpaceInvitation\x12*.memos.api.v1.AcceptSpaceInvitationRequest\x1a\x19.memos.api.v1.SpaceMember\">\xdaA\x04name\x82\xd3\xe4\x93\x021:\x01*\",/api/v1/{name=spaces/*/invitations/*}:accept\x12\x9e\x01\n" + - "\x16DeclineSpaceInvitation\x12+.memos.api.v1.DeclineSpaceInvitationRequest\x1a\x16.google.protobuf.Empty\"?\xdaA\x04name\x82\xd3\xe4\x93\x022:\x01*\"-/api/v1/{name=spaces/*/invitations/*}:decline\x12\x95\x01\n" + - "\x10ListSpaceMembers\x12%.memos.api.v1.ListSpaceMembersRequest\x1a&.memos.api.v1.ListSpaceMembersResponse\"2\xdaA\x06parent\x82\xd3\xe4\x93\x02#\x12!/api/v1/{parent=spaces/*}/members\x12\x82\x01\n" + - "\x0eGetSpaceMember\x12#.memos.api.v1.GetSpaceMemberRequest\x1a\x19.memos.api.v1.SpaceMember\"0\xdaA\x04name\x82\xd3\xe4\x93\x02#\x12!/api/v1/{name=spaces/*/members/*}\x12\xb7\x01\n" + - "\x11UpdateSpaceMember\x12&.memos.api.v1.UpdateSpaceMemberRequest\x1a\x19.memos.api.v1.SpaceMember\"_\xdaA\x18space_member,update_mask\x82\xd3\xe4\x93\x02>:\fspace_member2./api/v1/{space_member.name=spaces/*/members/*}\x12\x85\x01\n" + - "\x11DeleteSpaceMember\x12&.memos.api.v1.DeleteSpaceMemberRequest\x1a\x16.google.protobuf.Empty\"0\xdaA\x04name\x82\xd3\xe4\x93\x02#*!/api/v1/{name=spaces/*/members/*}B\xa9\x01\n" + - "\x10com.memos.api.v1B\x11SpaceServiceProtoP\x01Z0github.com/usememos/memos/proto/gen/api/v1;apiv1\xa2\x02\x03MAX\xaa\x02\fMemos.Api.V1\xca\x02\fMemos\\Api\\V1\xe2\x02\x18Memos\\Api\\V1\\GPBMetadata\xea\x02\x0eMemos::Api::V1b\x06proto3" + "page_token\x18\x03 \x01(\tB\x03\xe0A\x01R\tpageToken\"\x8f\x01\n" + + "\x1cListSpaceInvitationsResponse\x12G\n" + + "\x11space_invitations\x18\x01 \x03(\v2\x1a.memos.api.SpaceInvitationR\x10spaceInvitations\x12&\n" + + "\x0fnext_page_token\x18\x02 \x01(\tR\rnextPageToken\"\x97\x01\n" + + "\x1fListUserSpaceInvitationsRequest\x12.\n" + + "\x06parent\x18\x01 \x01(\tB\x16\xe0A\x02\xfaA\x10\n" + + "\x0ememos.api/UserR\x06parent\x12 \n" + + "\tpage_size\x18\x02 \x01(\x05B\x03\xe0A\x01R\bpageSize\x12\"\n" + + "\n" + + "page_token\x18\x03 \x01(\tB\x03\xe0A\x01R\tpageToken\"\x93\x01\n" + + " ListUserSpaceInvitationsResponse\x12G\n" + + "\x11space_invitations\x18\x01 \x03(\v2\x1a.memos.api.SpaceInvitationR\x10spaceInvitations\x12&\n" + + "\x0fnext_page_token\x18\x02 \x01(\tR\rnextPageToken\"R\n" + + "\x19GetSpaceInvitationRequest\x125\n" + + "\x04name\x18\x01 \x01(\tB!\xe0A\x02\xfaA\x1b\n" + + "\x19memos.api/SpaceInvitationR\x04name\"\xa5\x01\n" + + "\x1cCreateSpaceInvitationRequest\x129\n" + + "\x06parent\x18\x01 \x01(\tB!\xe0A\x02\xfaA\x1b\x12\x19memos.api/SpaceInvitationR\x06parent\x12J\n" + + "\x10space_invitation\x18\x02 \x01(\v2\x1a.memos.api.SpaceInvitationB\x03\xe0A\x02R\x0fspaceInvitation\"U\n" + + "\x1cDeleteSpaceInvitationRequest\x125\n" + + "\x04name\x18\x01 \x01(\tB!\xe0A\x02\xfaA\x1b\n" + + "\x19memos.api/SpaceInvitationR\x04name\"U\n" + + "\x1cAcceptSpaceInvitationRequest\x125\n" + + "\x04name\x18\x01 \x01(\tB!\xe0A\x02\xfaA\x1b\n" + + "\x19memos.api/SpaceInvitationR\x04name\"V\n" + + "\x1dDeclineSpaceInvitationRequest\x125\n" + + "\x04name\x18\x01 \x01(\tB!\xe0A\x02\xfaA\x1b\n" + + "\x19memos.api/SpaceInvitationR\x04name2\xac\x11\n" + + "\fSpaceService\x12a\n" + + "\n" + + "ListSpaces\x12\x1c.memos.api.ListSpacesRequest\x1a\x1d.memos.api.ListSpacesResponse\"\x16\xdaA\x00\x82\xd3\xe4\x93\x02\r\x12\v/api/spaces\x12]\n" + + "\bGetSpace\x12\x1a.memos.api.GetSpaceRequest\x1a\x10.memos.api.Space\"#\xdaA\x04name\x82\xd3\xe4\x93\x02\x16\x12\x14/api/{name=spaces/*}\x12b\n" + + "\vCreateSpace\x12\x1d.memos.api.CreateSpaceRequest\x1a\x10.memos.api.Space\"\"\xdaA\x05space\x82\xd3\xe4\x93\x02\x14:\x05space\"\v/api/spaces\x12}\n" + + "\vUpdateSpace\x12\x1d.memos.api.UpdateSpaceRequest\x1a\x10.memos.api.Space\"=\xdaA\x11space,update_mask\x82\xd3\xe4\x93\x02#:\x05space2\x1a/api/{space.name=spaces/*}\x12i\n" + + "\vDeleteSpace\x12\x1d.memos.api.DeleteSpaceRequest\x1a\x16.google.protobuf.Empty\"#\xdaA\x04name\x82\xd3\xe4\x93\x02\x16*\x14/api/{name=spaces/*}\x12\x8c\x01\n" + + "\x10ListSpaceMembers\x12\".memos.api.ListSpaceMembersRequest\x1a#.memos.api.ListSpaceMembersResponse\"/\xdaA\x06parent\x82\xd3\xe4\x93\x02 \x12\x1e/api/{parent=spaces/*}/members\x12y\n" + + "\x0eGetSpaceMember\x12 .memos.api.GetSpaceMemberRequest\x1a\x16.memos.api.SpaceMember\"-\xdaA\x04name\x82\xd3\xe4\x93\x02 \x12\x1e/api/{name=spaces/*/members/*}\x12\xae\x01\n" + + "\x11UpdateSpaceMember\x12#.memos.api.UpdateSpaceMemberRequest\x1a\x16.memos.api.SpaceMember\"\\\xdaA\x18space_member,update_mask\x82\xd3\xe4\x93\x02;:\fspace_member2+/api/{space_member.name=spaces/*/members/*}\x12\x7f\n" + + "\x11DeleteSpaceMember\x12#.memos.api.DeleteSpaceMemberRequest\x1a\x16.google.protobuf.Empty\"-\xdaA\x04name\x82\xd3\xe4\x93\x02 *\x1e/api/{name=spaces/*/members/*}\x12\x9c\x01\n" + + "\x14ListSpaceInvitations\x12&.memos.api.ListSpaceInvitationsRequest\x1a'.memos.api.ListSpaceInvitationsResponse\"3\xdaA\x06parent\x82\xd3\xe4\x93\x02$\x12\"/api/{parent=spaces/*}/invitations\x12\xac\x01\n" + + "\x18ListUserSpaceInvitations\x12*.memos.api.ListUserSpaceInvitationsRequest\x1a+.memos.api.ListUserSpaceInvitationsResponse\"7\xdaA\x06parent\x82\xd3\xe4\x93\x02(\x12&/api/{parent=users/*}/spaceInvitations\x12\x89\x01\n" + + "\x12GetSpaceInvitation\x12$.memos.api.GetSpaceInvitationRequest\x1a\x1a.memos.api.SpaceInvitation\"1\xdaA\x04name\x82\xd3\xe4\x93\x02$\x12\"/api/{name=spaces/*/invitations/*}\x12\xb4\x01\n" + + "\x15CreateSpaceInvitation\x12'.memos.api.CreateSpaceInvitationRequest\x1a\x1a.memos.api.SpaceInvitation\"V\xdaA\x17parent,space_invitation\x82\xd3\xe4\x93\x026:\x10space_invitation\"\"/api/{parent=spaces/*}/invitations\x12\x8b\x01\n" + + "\x15DeleteSpaceInvitation\x12'.memos.api.DeleteSpaceInvitationRequest\x1a\x16.google.protobuf.Empty\"1\xdaA\x04name\x82\xd3\xe4\x93\x02$*\"/api/{name=spaces/*/invitations/*}\x12\x95\x01\n" + + "\x15AcceptSpaceInvitation\x12'.memos.api.AcceptSpaceInvitationRequest\x1a\x16.memos.api.SpaceMember\";\xdaA\x04name\x82\xd3\xe4\x93\x02.:\x01*\")/api/{name=spaces/*/invitations/*}:accept\x12\x98\x01\n" + + "\x16DeclineSpaceInvitation\x12(.memos.api.DeclineSpaceInvitationRequest\x1a\x16.google.protobuf.Empty\"<\xdaA\x04name\x82\xd3\xe4\x93\x02/:\x01*\"*/api/{name=spaces/*/invitations/*}:declineB\x90\x01\n" + + "\rcom.memos.apiB\x11SpaceServiceProtoP\x01Z'github.com/usememos/memos/proto/gen/api\xa2\x02\x03MAX\xaa\x02\tMemos.Api\xca\x02\tMemos\\Api\xe2\x02\x15Memos\\Api\\GPBMetadata\xea\x02\n" + + "Memos::Apib\x06proto3" var ( - file_api_v1_space_service_proto_rawDescOnce sync.Once - file_api_v1_space_service_proto_rawDescData []byte + file_api_space_service_proto_rawDescOnce sync.Once + file_api_space_service_proto_rawDescData []byte ) -func file_api_v1_space_service_proto_rawDescGZIP() []byte { - file_api_v1_space_service_proto_rawDescOnce.Do(func() { - file_api_v1_space_service_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_api_v1_space_service_proto_rawDesc), len(file_api_v1_space_service_proto_rawDesc))) +func file_api_space_service_proto_rawDescGZIP() []byte { + file_api_space_service_proto_rawDescOnce.Do(func() { + file_api_space_service_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_api_space_service_proto_rawDesc), len(file_api_space_service_proto_rawDesc))) }) - return file_api_v1_space_service_proto_rawDescData + return file_api_space_service_proto_rawDescData } -var file_api_v1_space_service_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_api_v1_space_service_proto_msgTypes = make([]protoimpl.MessageInfo, 24) -var file_api_v1_space_service_proto_goTypes = []any{ - (SpaceMember_Role)(0), // 0: memos.api.v1.SpaceMember.Role - (*Space)(nil), // 1: memos.api.v1.Space - (*SpaceMember)(nil), // 2: memos.api.v1.SpaceMember - (*SpaceInvitation)(nil), // 3: memos.api.v1.SpaceInvitation - (*CreateSpaceRequest)(nil), // 4: memos.api.v1.CreateSpaceRequest - (*ListSpacesRequest)(nil), // 5: memos.api.v1.ListSpacesRequest - (*ListSpacesResponse)(nil), // 6: memos.api.v1.ListSpacesResponse - (*GetSpaceRequest)(nil), // 7: memos.api.v1.GetSpaceRequest - (*UpdateSpaceRequest)(nil), // 8: memos.api.v1.UpdateSpaceRequest - (*DeleteSpaceRequest)(nil), // 9: memos.api.v1.DeleteSpaceRequest - (*CreateSpaceInvitationRequest)(nil), // 10: memos.api.v1.CreateSpaceInvitationRequest - (*ListSpaceInvitationsRequest)(nil), // 11: memos.api.v1.ListSpaceInvitationsRequest - (*ListSpaceInvitationsResponse)(nil), // 12: memos.api.v1.ListSpaceInvitationsResponse - (*ListUserSpaceInvitationsRequest)(nil), // 13: memos.api.v1.ListUserSpaceInvitationsRequest - (*ListUserSpaceInvitationsResponse)(nil), // 14: memos.api.v1.ListUserSpaceInvitationsResponse - (*GetSpaceInvitationRequest)(nil), // 15: memos.api.v1.GetSpaceInvitationRequest - (*DeleteSpaceInvitationRequest)(nil), // 16: memos.api.v1.DeleteSpaceInvitationRequest - (*AcceptSpaceInvitationRequest)(nil), // 17: memos.api.v1.AcceptSpaceInvitationRequest - (*DeclineSpaceInvitationRequest)(nil), // 18: memos.api.v1.DeclineSpaceInvitationRequest - (*ListSpaceMembersRequest)(nil), // 19: memos.api.v1.ListSpaceMembersRequest - (*ListSpaceMembersResponse)(nil), // 20: memos.api.v1.ListSpaceMembersResponse - (*GetSpaceMemberRequest)(nil), // 21: memos.api.v1.GetSpaceMemberRequest - (*UpdateSpaceMemberRequest)(nil), // 22: memos.api.v1.UpdateSpaceMemberRequest - (*DeleteSpaceMemberRequest)(nil), // 23: memos.api.v1.DeleteSpaceMemberRequest - (*Space_Icon)(nil), // 24: memos.api.v1.Space.Icon +var file_api_space_service_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_api_space_service_proto_msgTypes = make([]protoimpl.MessageInfo, 24) +var file_api_space_service_proto_goTypes = []any{ + (SpaceMember_Role)(0), // 0: memos.api.SpaceMember.Role + (*Space)(nil), // 1: memos.api.Space + (*ListSpacesRequest)(nil), // 2: memos.api.ListSpacesRequest + (*ListSpacesResponse)(nil), // 3: memos.api.ListSpacesResponse + (*GetSpaceRequest)(nil), // 4: memos.api.GetSpaceRequest + (*CreateSpaceRequest)(nil), // 5: memos.api.CreateSpaceRequest + (*UpdateSpaceRequest)(nil), // 6: memos.api.UpdateSpaceRequest + (*DeleteSpaceRequest)(nil), // 7: memos.api.DeleteSpaceRequest + (*SpaceMember)(nil), // 8: memos.api.SpaceMember + (*ListSpaceMembersRequest)(nil), // 9: memos.api.ListSpaceMembersRequest + (*ListSpaceMembersResponse)(nil), // 10: memos.api.ListSpaceMembersResponse + (*GetSpaceMemberRequest)(nil), // 11: memos.api.GetSpaceMemberRequest + (*UpdateSpaceMemberRequest)(nil), // 12: memos.api.UpdateSpaceMemberRequest + (*DeleteSpaceMemberRequest)(nil), // 13: memos.api.DeleteSpaceMemberRequest + (*SpaceInvitation)(nil), // 14: memos.api.SpaceInvitation + (*ListSpaceInvitationsRequest)(nil), // 15: memos.api.ListSpaceInvitationsRequest + (*ListSpaceInvitationsResponse)(nil), // 16: memos.api.ListSpaceInvitationsResponse + (*ListUserSpaceInvitationsRequest)(nil), // 17: memos.api.ListUserSpaceInvitationsRequest + (*ListUserSpaceInvitationsResponse)(nil), // 18: memos.api.ListUserSpaceInvitationsResponse + (*GetSpaceInvitationRequest)(nil), // 19: memos.api.GetSpaceInvitationRequest + (*CreateSpaceInvitationRequest)(nil), // 20: memos.api.CreateSpaceInvitationRequest + (*DeleteSpaceInvitationRequest)(nil), // 21: memos.api.DeleteSpaceInvitationRequest + (*AcceptSpaceInvitationRequest)(nil), // 22: memos.api.AcceptSpaceInvitationRequest + (*DeclineSpaceInvitationRequest)(nil), // 23: memos.api.DeclineSpaceInvitationRequest + (*Space_Icon)(nil), // 24: memos.api.Space.Icon (*fieldmaskpb.FieldMask)(nil), // 25: google.protobuf.FieldMask (*emptypb.Empty)(nil), // 26: google.protobuf.Empty } -var file_api_v1_space_service_proto_depIdxs = []int32{ - 0, // 0: memos.api.v1.Space.current_user_role:type_name -> memos.api.v1.SpaceMember.Role - 24, // 1: memos.api.v1.Space.icon:type_name -> memos.api.v1.Space.Icon - 0, // 2: memos.api.v1.SpaceMember.role:type_name -> memos.api.v1.SpaceMember.Role - 0, // 3: memos.api.v1.SpaceInvitation.role:type_name -> memos.api.v1.SpaceMember.Role - 1, // 4: memos.api.v1.SpaceInvitation.space:type_name -> memos.api.v1.Space - 1, // 5: memos.api.v1.CreateSpaceRequest.space:type_name -> memos.api.v1.Space - 1, // 6: memos.api.v1.ListSpacesResponse.spaces:type_name -> memos.api.v1.Space - 1, // 7: memos.api.v1.UpdateSpaceRequest.space:type_name -> memos.api.v1.Space - 25, // 8: memos.api.v1.UpdateSpaceRequest.update_mask:type_name -> google.protobuf.FieldMask - 3, // 9: memos.api.v1.CreateSpaceInvitationRequest.space_invitation:type_name -> memos.api.v1.SpaceInvitation - 3, // 10: memos.api.v1.ListSpaceInvitationsResponse.space_invitations:type_name -> memos.api.v1.SpaceInvitation - 3, // 11: memos.api.v1.ListUserSpaceInvitationsResponse.space_invitations:type_name -> memos.api.v1.SpaceInvitation - 2, // 12: memos.api.v1.ListSpaceMembersResponse.space_members:type_name -> memos.api.v1.SpaceMember - 2, // 13: memos.api.v1.UpdateSpaceMemberRequest.space_member:type_name -> memos.api.v1.SpaceMember - 25, // 14: memos.api.v1.UpdateSpaceMemberRequest.update_mask:type_name -> google.protobuf.FieldMask - 4, // 15: memos.api.v1.SpaceService.CreateSpace:input_type -> memos.api.v1.CreateSpaceRequest - 5, // 16: memos.api.v1.SpaceService.ListSpaces:input_type -> memos.api.v1.ListSpacesRequest - 7, // 17: memos.api.v1.SpaceService.GetSpace:input_type -> memos.api.v1.GetSpaceRequest - 8, // 18: memos.api.v1.SpaceService.UpdateSpace:input_type -> memos.api.v1.UpdateSpaceRequest - 9, // 19: memos.api.v1.SpaceService.DeleteSpace:input_type -> memos.api.v1.DeleteSpaceRequest - 10, // 20: memos.api.v1.SpaceService.CreateSpaceInvitation:input_type -> memos.api.v1.CreateSpaceInvitationRequest - 11, // 21: memos.api.v1.SpaceService.ListSpaceInvitations:input_type -> memos.api.v1.ListSpaceInvitationsRequest - 13, // 22: memos.api.v1.SpaceService.ListUserSpaceInvitations:input_type -> memos.api.v1.ListUserSpaceInvitationsRequest - 15, // 23: memos.api.v1.SpaceService.GetSpaceInvitation:input_type -> memos.api.v1.GetSpaceInvitationRequest - 16, // 24: memos.api.v1.SpaceService.DeleteSpaceInvitation:input_type -> memos.api.v1.DeleteSpaceInvitationRequest - 17, // 25: memos.api.v1.SpaceService.AcceptSpaceInvitation:input_type -> memos.api.v1.AcceptSpaceInvitationRequest - 18, // 26: memos.api.v1.SpaceService.DeclineSpaceInvitation:input_type -> memos.api.v1.DeclineSpaceInvitationRequest - 19, // 27: memos.api.v1.SpaceService.ListSpaceMembers:input_type -> memos.api.v1.ListSpaceMembersRequest - 21, // 28: memos.api.v1.SpaceService.GetSpaceMember:input_type -> memos.api.v1.GetSpaceMemberRequest - 22, // 29: memos.api.v1.SpaceService.UpdateSpaceMember:input_type -> memos.api.v1.UpdateSpaceMemberRequest - 23, // 30: memos.api.v1.SpaceService.DeleteSpaceMember:input_type -> memos.api.v1.DeleteSpaceMemberRequest - 1, // 31: memos.api.v1.SpaceService.CreateSpace:output_type -> memos.api.v1.Space - 6, // 32: memos.api.v1.SpaceService.ListSpaces:output_type -> memos.api.v1.ListSpacesResponse - 1, // 33: memos.api.v1.SpaceService.GetSpace:output_type -> memos.api.v1.Space - 1, // 34: memos.api.v1.SpaceService.UpdateSpace:output_type -> memos.api.v1.Space - 26, // 35: memos.api.v1.SpaceService.DeleteSpace:output_type -> google.protobuf.Empty - 3, // 36: memos.api.v1.SpaceService.CreateSpaceInvitation:output_type -> memos.api.v1.SpaceInvitation - 12, // 37: memos.api.v1.SpaceService.ListSpaceInvitations:output_type -> memos.api.v1.ListSpaceInvitationsResponse - 14, // 38: memos.api.v1.SpaceService.ListUserSpaceInvitations:output_type -> memos.api.v1.ListUserSpaceInvitationsResponse - 3, // 39: memos.api.v1.SpaceService.GetSpaceInvitation:output_type -> memos.api.v1.SpaceInvitation - 26, // 40: memos.api.v1.SpaceService.DeleteSpaceInvitation:output_type -> google.protobuf.Empty - 2, // 41: memos.api.v1.SpaceService.AcceptSpaceInvitation:output_type -> memos.api.v1.SpaceMember - 26, // 42: memos.api.v1.SpaceService.DeclineSpaceInvitation:output_type -> google.protobuf.Empty - 20, // 43: memos.api.v1.SpaceService.ListSpaceMembers:output_type -> memos.api.v1.ListSpaceMembersResponse - 2, // 44: memos.api.v1.SpaceService.GetSpaceMember:output_type -> memos.api.v1.SpaceMember - 2, // 45: memos.api.v1.SpaceService.UpdateSpaceMember:output_type -> memos.api.v1.SpaceMember - 26, // 46: memos.api.v1.SpaceService.DeleteSpaceMember:output_type -> google.protobuf.Empty +var file_api_space_service_proto_depIdxs = []int32{ + 24, // 0: memos.api.Space.icon:type_name -> memos.api.Space.Icon + 0, // 1: memos.api.Space.current_user_role:type_name -> memos.api.SpaceMember.Role + 1, // 2: memos.api.ListSpacesResponse.spaces:type_name -> memos.api.Space + 1, // 3: memos.api.CreateSpaceRequest.space:type_name -> memos.api.Space + 1, // 4: memos.api.UpdateSpaceRequest.space:type_name -> memos.api.Space + 25, // 5: memos.api.UpdateSpaceRequest.update_mask:type_name -> google.protobuf.FieldMask + 0, // 6: memos.api.SpaceMember.role:type_name -> memos.api.SpaceMember.Role + 8, // 7: memos.api.ListSpaceMembersResponse.space_members:type_name -> memos.api.SpaceMember + 8, // 8: memos.api.UpdateSpaceMemberRequest.space_member:type_name -> memos.api.SpaceMember + 25, // 9: memos.api.UpdateSpaceMemberRequest.update_mask:type_name -> google.protobuf.FieldMask + 0, // 10: memos.api.SpaceInvitation.role:type_name -> memos.api.SpaceMember.Role + 1, // 11: memos.api.SpaceInvitation.space:type_name -> memos.api.Space + 14, // 12: memos.api.ListSpaceInvitationsResponse.space_invitations:type_name -> memos.api.SpaceInvitation + 14, // 13: memos.api.ListUserSpaceInvitationsResponse.space_invitations:type_name -> memos.api.SpaceInvitation + 14, // 14: memos.api.CreateSpaceInvitationRequest.space_invitation:type_name -> memos.api.SpaceInvitation + 2, // 15: memos.api.SpaceService.ListSpaces:input_type -> memos.api.ListSpacesRequest + 4, // 16: memos.api.SpaceService.GetSpace:input_type -> memos.api.GetSpaceRequest + 5, // 17: memos.api.SpaceService.CreateSpace:input_type -> memos.api.CreateSpaceRequest + 6, // 18: memos.api.SpaceService.UpdateSpace:input_type -> memos.api.UpdateSpaceRequest + 7, // 19: memos.api.SpaceService.DeleteSpace:input_type -> memos.api.DeleteSpaceRequest + 9, // 20: memos.api.SpaceService.ListSpaceMembers:input_type -> memos.api.ListSpaceMembersRequest + 11, // 21: memos.api.SpaceService.GetSpaceMember:input_type -> memos.api.GetSpaceMemberRequest + 12, // 22: memos.api.SpaceService.UpdateSpaceMember:input_type -> memos.api.UpdateSpaceMemberRequest + 13, // 23: memos.api.SpaceService.DeleteSpaceMember:input_type -> memos.api.DeleteSpaceMemberRequest + 15, // 24: memos.api.SpaceService.ListSpaceInvitations:input_type -> memos.api.ListSpaceInvitationsRequest + 17, // 25: memos.api.SpaceService.ListUserSpaceInvitations:input_type -> memos.api.ListUserSpaceInvitationsRequest + 19, // 26: memos.api.SpaceService.GetSpaceInvitation:input_type -> memos.api.GetSpaceInvitationRequest + 20, // 27: memos.api.SpaceService.CreateSpaceInvitation:input_type -> memos.api.CreateSpaceInvitationRequest + 21, // 28: memos.api.SpaceService.DeleteSpaceInvitation:input_type -> memos.api.DeleteSpaceInvitationRequest + 22, // 29: memos.api.SpaceService.AcceptSpaceInvitation:input_type -> memos.api.AcceptSpaceInvitationRequest + 23, // 30: memos.api.SpaceService.DeclineSpaceInvitation:input_type -> memos.api.DeclineSpaceInvitationRequest + 3, // 31: memos.api.SpaceService.ListSpaces:output_type -> memos.api.ListSpacesResponse + 1, // 32: memos.api.SpaceService.GetSpace:output_type -> memos.api.Space + 1, // 33: memos.api.SpaceService.CreateSpace:output_type -> memos.api.Space + 1, // 34: memos.api.SpaceService.UpdateSpace:output_type -> memos.api.Space + 26, // 35: memos.api.SpaceService.DeleteSpace:output_type -> google.protobuf.Empty + 10, // 36: memos.api.SpaceService.ListSpaceMembers:output_type -> memos.api.ListSpaceMembersResponse + 8, // 37: memos.api.SpaceService.GetSpaceMember:output_type -> memos.api.SpaceMember + 8, // 38: memos.api.SpaceService.UpdateSpaceMember:output_type -> memos.api.SpaceMember + 26, // 39: memos.api.SpaceService.DeleteSpaceMember:output_type -> google.protobuf.Empty + 16, // 40: memos.api.SpaceService.ListSpaceInvitations:output_type -> memos.api.ListSpaceInvitationsResponse + 18, // 41: memos.api.SpaceService.ListUserSpaceInvitations:output_type -> memos.api.ListUserSpaceInvitationsResponse + 14, // 42: memos.api.SpaceService.GetSpaceInvitation:output_type -> memos.api.SpaceInvitation + 14, // 43: memos.api.SpaceService.CreateSpaceInvitation:output_type -> memos.api.SpaceInvitation + 26, // 44: memos.api.SpaceService.DeleteSpaceInvitation:output_type -> google.protobuf.Empty + 8, // 45: memos.api.SpaceService.AcceptSpaceInvitation:output_type -> memos.api.SpaceMember + 26, // 46: memos.api.SpaceService.DeclineSpaceInvitation:output_type -> google.protobuf.Empty 31, // [31:47] is the sub-list for method output_type 15, // [15:31] is the sub-list for method input_type 15, // [15:15] is the sub-list for extension type_name @@ -1640,12 +1699,12 @@ var file_api_v1_space_service_proto_depIdxs = []int32{ 0, // [0:15] is the sub-list for field type_name } -func init() { file_api_v1_space_service_proto_init() } -func file_api_v1_space_service_proto_init() { - if File_api_v1_space_service_proto != nil { +func init() { file_api_space_service_proto_init() } +func file_api_space_service_proto_init() { + if File_api_space_service_proto != nil { return } - file_api_v1_space_service_proto_msgTypes[23].OneofWrappers = []any{ + file_api_space_service_proto_msgTypes[23].OneofWrappers = []any{ (*Space_Icon_Emoji)(nil), (*Space_Icon_Lucide)(nil), } @@ -1653,18 +1712,18 @@ func file_api_v1_space_service_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: unsafe.Slice(unsafe.StringData(file_api_v1_space_service_proto_rawDesc), len(file_api_v1_space_service_proto_rawDesc)), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_api_space_service_proto_rawDesc), len(file_api_space_service_proto_rawDesc)), NumEnums: 1, NumMessages: 24, NumExtensions: 0, NumServices: 1, }, - GoTypes: file_api_v1_space_service_proto_goTypes, - DependencyIndexes: file_api_v1_space_service_proto_depIdxs, - EnumInfos: file_api_v1_space_service_proto_enumTypes, - MessageInfos: file_api_v1_space_service_proto_msgTypes, + GoTypes: file_api_space_service_proto_goTypes, + DependencyIndexes: file_api_space_service_proto_depIdxs, + EnumInfos: file_api_space_service_proto_enumTypes, + MessageInfos: file_api_space_service_proto_msgTypes, }.Build() - File_api_v1_space_service_proto = out.File - file_api_v1_space_service_proto_goTypes = nil - file_api_v1_space_service_proto_depIdxs = nil + File_api_space_service_proto = out.File + file_api_space_service_proto_goTypes = nil + file_api_space_service_proto_depIdxs = nil } diff --git a/proto/gen/api/v1/space_service.pb.gw.go b/proto/gen/api/space_service.pb.gw.go similarity index 92% rename from proto/gen/api/v1/space_service.pb.gw.go rename to proto/gen/api/space_service.pb.gw.go index 0f85e11ee..aca2548cd 100644 --- a/proto/gen/api/v1/space_service.pb.gw.go +++ b/proto/gen/api/space_service.pb.gw.go @@ -1,12 +1,12 @@ // Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: api/v1/space_service.proto +// source: api/space_service.proto /* -Package apiv1 is a reverse proxy. +Package api is a reverse proxy. It translates gRPC into RESTful JSON APIs. */ -package apiv1 +package api import ( "context" @@ -35,47 +35,6 @@ var ( _ = metadata.Join ) -var filter_SpaceService_CreateSpace_0 = &utilities.DoubleArray{Encoding: map[string]int{"space": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} - -func request_SpaceService_CreateSpace_0(ctx context.Context, marshaler runtime.Marshaler, client SpaceServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var ( - protoReq CreateSpaceRequest - metadata runtime.ServerMetadata - ) - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.Space); err != nil && !errors.Is(err, io.EOF) { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_SpaceService_CreateSpace_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if req.Body != nil { - _, _ = io.Copy(io.Discard, req.Body) - } - msg, err := client.CreateSpace(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err -} - -func local_request_SpaceService_CreateSpace_0(ctx context.Context, marshaler runtime.Marshaler, server SpaceServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var ( - protoReq CreateSpaceRequest - metadata runtime.ServerMetadata - ) - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.Space); err != nil && !errors.Is(err, io.EOF) { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_SpaceService_CreateSpace_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - msg, err := server.CreateSpace(ctx, &protoReq) - return msg, metadata, err -} - var filter_SpaceService_ListSpaces_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} func request_SpaceService_ListSpaces_0(ctx context.Context, marshaler runtime.Marshaler, client SpaceServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -150,6 +109,47 @@ func local_request_SpaceService_GetSpace_0(ctx context.Context, marshaler runtim return msg, metadata, err } +var filter_SpaceService_CreateSpace_0 = &utilities.DoubleArray{Encoding: map[string]int{"space": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} + +func request_SpaceService_CreateSpace_0(ctx context.Context, marshaler runtime.Marshaler, client SpaceServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq CreateSpaceRequest + metadata runtime.ServerMetadata + ) + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.Space); err != nil && !errors.Is(err, io.EOF) { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_SpaceService_CreateSpace_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if req.Body != nil { + _, _ = io.Copy(io.Discard, req.Body) + } + msg, err := client.CreateSpace(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err +} + +func local_request_SpaceService_CreateSpace_0(ctx context.Context, marshaler runtime.Marshaler, server SpaceServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq CreateSpaceRequest + metadata runtime.ServerMetadata + ) + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.Space); err != nil && !errors.Is(err, io.EOF) { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_SpaceService_CreateSpace_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + msg, err := server.CreateSpace(ctx, &protoReq) + return msg, metadata, err +} + var filter_SpaceService_UpdateSpace_0 = &utilities.DoubleArray{Encoding: map[string]int{"space": 0, "name": 1}, Base: []int{1, 2, 1, 0, 0}, Check: []int{0, 1, 2, 3, 2}} func request_SpaceService_UpdateSpace_0(ctx context.Context, marshaler runtime.Marshaler, client SpaceServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -270,325 +270,6 @@ func local_request_SpaceService_DeleteSpace_0(ctx context.Context, marshaler run return msg, metadata, err } -func request_SpaceService_CreateSpaceInvitation_0(ctx context.Context, marshaler runtime.Marshaler, client SpaceServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var ( - protoReq CreateSpaceInvitationRequest - metadata runtime.ServerMetadata - err error - ) - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.SpaceInvitation); err != nil && !errors.Is(err, io.EOF) { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - val, ok := pathParams["parent"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent") - } - protoReq.Parent, err = runtime.String(val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err) - } - if req.Body != nil { - _, _ = io.Copy(io.Discard, req.Body) - } - msg, err := client.CreateSpaceInvitation(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err -} - -func local_request_SpaceService_CreateSpaceInvitation_0(ctx context.Context, marshaler runtime.Marshaler, server SpaceServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var ( - protoReq CreateSpaceInvitationRequest - metadata runtime.ServerMetadata - err error - ) - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.SpaceInvitation); err != nil && !errors.Is(err, io.EOF) { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - val, ok := pathParams["parent"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent") - } - protoReq.Parent, err = runtime.String(val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err) - } - msg, err := server.CreateSpaceInvitation(ctx, &protoReq) - return msg, metadata, err -} - -var filter_SpaceService_ListSpaceInvitations_0 = &utilities.DoubleArray{Encoding: map[string]int{"parent": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} - -func request_SpaceService_ListSpaceInvitations_0(ctx context.Context, marshaler runtime.Marshaler, client SpaceServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var ( - protoReq ListSpaceInvitationsRequest - metadata runtime.ServerMetadata - err error - ) - val, ok := pathParams["parent"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent") - } - protoReq.Parent, err = runtime.String(val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err) - } - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_SpaceService_ListSpaceInvitations_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if req.Body != nil { - _, _ = io.Copy(io.Discard, req.Body) - } - msg, err := client.ListSpaceInvitations(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err -} - -func local_request_SpaceService_ListSpaceInvitations_0(ctx context.Context, marshaler runtime.Marshaler, server SpaceServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var ( - protoReq ListSpaceInvitationsRequest - metadata runtime.ServerMetadata - err error - ) - val, ok := pathParams["parent"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent") - } - protoReq.Parent, err = runtime.String(val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err) - } - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_SpaceService_ListSpaceInvitations_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - msg, err := server.ListSpaceInvitations(ctx, &protoReq) - return msg, metadata, err -} - -var filter_SpaceService_ListUserSpaceInvitations_0 = &utilities.DoubleArray{Encoding: map[string]int{"parent": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} - -func request_SpaceService_ListUserSpaceInvitations_0(ctx context.Context, marshaler runtime.Marshaler, client SpaceServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var ( - protoReq ListUserSpaceInvitationsRequest - metadata runtime.ServerMetadata - err error - ) - val, ok := pathParams["parent"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent") - } - protoReq.Parent, err = runtime.String(val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err) - } - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_SpaceService_ListUserSpaceInvitations_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if req.Body != nil { - _, _ = io.Copy(io.Discard, req.Body) - } - msg, err := client.ListUserSpaceInvitations(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err -} - -func local_request_SpaceService_ListUserSpaceInvitations_0(ctx context.Context, marshaler runtime.Marshaler, server SpaceServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var ( - protoReq ListUserSpaceInvitationsRequest - metadata runtime.ServerMetadata - err error - ) - val, ok := pathParams["parent"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent") - } - protoReq.Parent, err = runtime.String(val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err) - } - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_SpaceService_ListUserSpaceInvitations_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - msg, err := server.ListUserSpaceInvitations(ctx, &protoReq) - return msg, metadata, err -} - -func request_SpaceService_GetSpaceInvitation_0(ctx context.Context, marshaler runtime.Marshaler, client SpaceServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var ( - protoReq GetSpaceInvitationRequest - metadata runtime.ServerMetadata - err error - ) - val, ok := pathParams["name"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") - } - protoReq.Name, err = runtime.String(val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) - } - if req.Body != nil { - _, _ = io.Copy(io.Discard, req.Body) - } - msg, err := client.GetSpaceInvitation(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err -} - -func local_request_SpaceService_GetSpaceInvitation_0(ctx context.Context, marshaler runtime.Marshaler, server SpaceServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var ( - protoReq GetSpaceInvitationRequest - metadata runtime.ServerMetadata - err error - ) - val, ok := pathParams["name"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") - } - protoReq.Name, err = runtime.String(val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) - } - msg, err := server.GetSpaceInvitation(ctx, &protoReq) - return msg, metadata, err -} - -func request_SpaceService_DeleteSpaceInvitation_0(ctx context.Context, marshaler runtime.Marshaler, client SpaceServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var ( - protoReq DeleteSpaceInvitationRequest - metadata runtime.ServerMetadata - err error - ) - val, ok := pathParams["name"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") - } - protoReq.Name, err = runtime.String(val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) - } - if req.Body != nil { - _, _ = io.Copy(io.Discard, req.Body) - } - msg, err := client.DeleteSpaceInvitation(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err -} - -func local_request_SpaceService_DeleteSpaceInvitation_0(ctx context.Context, marshaler runtime.Marshaler, server SpaceServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var ( - protoReq DeleteSpaceInvitationRequest - metadata runtime.ServerMetadata - err error - ) - val, ok := pathParams["name"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") - } - protoReq.Name, err = runtime.String(val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) - } - msg, err := server.DeleteSpaceInvitation(ctx, &protoReq) - return msg, metadata, err -} - -func request_SpaceService_AcceptSpaceInvitation_0(ctx context.Context, marshaler runtime.Marshaler, client SpaceServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var ( - protoReq AcceptSpaceInvitationRequest - metadata runtime.ServerMetadata - err error - ) - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - val, ok := pathParams["name"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") - } - protoReq.Name, err = runtime.String(val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) - } - if req.Body != nil { - _, _ = io.Copy(io.Discard, req.Body) - } - msg, err := client.AcceptSpaceInvitation(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err -} - -func local_request_SpaceService_AcceptSpaceInvitation_0(ctx context.Context, marshaler runtime.Marshaler, server SpaceServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var ( - protoReq AcceptSpaceInvitationRequest - metadata runtime.ServerMetadata - err error - ) - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - val, ok := pathParams["name"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") - } - protoReq.Name, err = runtime.String(val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) - } - msg, err := server.AcceptSpaceInvitation(ctx, &protoReq) - return msg, metadata, err -} - -func request_SpaceService_DeclineSpaceInvitation_0(ctx context.Context, marshaler runtime.Marshaler, client SpaceServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var ( - protoReq DeclineSpaceInvitationRequest - metadata runtime.ServerMetadata - err error - ) - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - val, ok := pathParams["name"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") - } - protoReq.Name, err = runtime.String(val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) - } - if req.Body != nil { - _, _ = io.Copy(io.Discard, req.Body) - } - msg, err := client.DeclineSpaceInvitation(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err -} - -func local_request_SpaceService_DeclineSpaceInvitation_0(ctx context.Context, marshaler runtime.Marshaler, server SpaceServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var ( - protoReq DeclineSpaceInvitationRequest - metadata runtime.ServerMetadata - err error - ) - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - val, ok := pathParams["name"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") - } - protoReq.Name, err = runtime.String(val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) - } - msg, err := server.DeclineSpaceInvitation(ctx, &protoReq) - return msg, metadata, err -} - var filter_SpaceService_ListSpaceMembers_0 = &utilities.DoubleArray{Encoding: map[string]int{"parent": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} func request_SpaceService_ListSpaceMembers_0(ctx context.Context, marshaler runtime.Marshaler, client SpaceServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -801,39 +482,338 @@ func local_request_SpaceService_DeleteSpaceMember_0(ctx context.Context, marshal return msg, metadata, err } +var filter_SpaceService_ListSpaceInvitations_0 = &utilities.DoubleArray{Encoding: map[string]int{"parent": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} + +func request_SpaceService_ListSpaceInvitations_0(ctx context.Context, marshaler runtime.Marshaler, client SpaceServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq ListSpaceInvitationsRequest + metadata runtime.ServerMetadata + err error + ) + val, ok := pathParams["parent"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent") + } + protoReq.Parent, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err) + } + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_SpaceService_ListSpaceInvitations_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if req.Body != nil { + _, _ = io.Copy(io.Discard, req.Body) + } + msg, err := client.ListSpaceInvitations(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err +} + +func local_request_SpaceService_ListSpaceInvitations_0(ctx context.Context, marshaler runtime.Marshaler, server SpaceServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq ListSpaceInvitationsRequest + metadata runtime.ServerMetadata + err error + ) + val, ok := pathParams["parent"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent") + } + protoReq.Parent, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err) + } + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_SpaceService_ListSpaceInvitations_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + msg, err := server.ListSpaceInvitations(ctx, &protoReq) + return msg, metadata, err +} + +var filter_SpaceService_ListUserSpaceInvitations_0 = &utilities.DoubleArray{Encoding: map[string]int{"parent": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} + +func request_SpaceService_ListUserSpaceInvitations_0(ctx context.Context, marshaler runtime.Marshaler, client SpaceServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq ListUserSpaceInvitationsRequest + metadata runtime.ServerMetadata + err error + ) + val, ok := pathParams["parent"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent") + } + protoReq.Parent, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err) + } + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_SpaceService_ListUserSpaceInvitations_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if req.Body != nil { + _, _ = io.Copy(io.Discard, req.Body) + } + msg, err := client.ListUserSpaceInvitations(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err +} + +func local_request_SpaceService_ListUserSpaceInvitations_0(ctx context.Context, marshaler runtime.Marshaler, server SpaceServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq ListUserSpaceInvitationsRequest + metadata runtime.ServerMetadata + err error + ) + val, ok := pathParams["parent"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent") + } + protoReq.Parent, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err) + } + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_SpaceService_ListUserSpaceInvitations_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + msg, err := server.ListUserSpaceInvitations(ctx, &protoReq) + return msg, metadata, err +} + +func request_SpaceService_GetSpaceInvitation_0(ctx context.Context, marshaler runtime.Marshaler, client SpaceServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq GetSpaceInvitationRequest + metadata runtime.ServerMetadata + err error + ) + val, ok := pathParams["name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + } + protoReq.Name, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + } + if req.Body != nil { + _, _ = io.Copy(io.Discard, req.Body) + } + msg, err := client.GetSpaceInvitation(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err +} + +func local_request_SpaceService_GetSpaceInvitation_0(ctx context.Context, marshaler runtime.Marshaler, server SpaceServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq GetSpaceInvitationRequest + metadata runtime.ServerMetadata + err error + ) + val, ok := pathParams["name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + } + protoReq.Name, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + } + msg, err := server.GetSpaceInvitation(ctx, &protoReq) + return msg, metadata, err +} + +func request_SpaceService_CreateSpaceInvitation_0(ctx context.Context, marshaler runtime.Marshaler, client SpaceServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq CreateSpaceInvitationRequest + metadata runtime.ServerMetadata + err error + ) + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.SpaceInvitation); err != nil && !errors.Is(err, io.EOF) { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + val, ok := pathParams["parent"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent") + } + protoReq.Parent, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err) + } + if req.Body != nil { + _, _ = io.Copy(io.Discard, req.Body) + } + msg, err := client.CreateSpaceInvitation(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err +} + +func local_request_SpaceService_CreateSpaceInvitation_0(ctx context.Context, marshaler runtime.Marshaler, server SpaceServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq CreateSpaceInvitationRequest + metadata runtime.ServerMetadata + err error + ) + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.SpaceInvitation); err != nil && !errors.Is(err, io.EOF) { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + val, ok := pathParams["parent"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent") + } + protoReq.Parent, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err) + } + msg, err := server.CreateSpaceInvitation(ctx, &protoReq) + return msg, metadata, err +} + +func request_SpaceService_DeleteSpaceInvitation_0(ctx context.Context, marshaler runtime.Marshaler, client SpaceServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq DeleteSpaceInvitationRequest + metadata runtime.ServerMetadata + err error + ) + val, ok := pathParams["name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + } + protoReq.Name, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + } + if req.Body != nil { + _, _ = io.Copy(io.Discard, req.Body) + } + msg, err := client.DeleteSpaceInvitation(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err +} + +func local_request_SpaceService_DeleteSpaceInvitation_0(ctx context.Context, marshaler runtime.Marshaler, server SpaceServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq DeleteSpaceInvitationRequest + metadata runtime.ServerMetadata + err error + ) + val, ok := pathParams["name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + } + protoReq.Name, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + } + msg, err := server.DeleteSpaceInvitation(ctx, &protoReq) + return msg, metadata, err +} + +func request_SpaceService_AcceptSpaceInvitation_0(ctx context.Context, marshaler runtime.Marshaler, client SpaceServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq AcceptSpaceInvitationRequest + metadata runtime.ServerMetadata + err error + ) + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + val, ok := pathParams["name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + } + protoReq.Name, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + } + if req.Body != nil { + _, _ = io.Copy(io.Discard, req.Body) + } + msg, err := client.AcceptSpaceInvitation(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err +} + +func local_request_SpaceService_AcceptSpaceInvitation_0(ctx context.Context, marshaler runtime.Marshaler, server SpaceServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq AcceptSpaceInvitationRequest + metadata runtime.ServerMetadata + err error + ) + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + val, ok := pathParams["name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + } + protoReq.Name, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + } + msg, err := server.AcceptSpaceInvitation(ctx, &protoReq) + return msg, metadata, err +} + +func request_SpaceService_DeclineSpaceInvitation_0(ctx context.Context, marshaler runtime.Marshaler, client SpaceServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq DeclineSpaceInvitationRequest + metadata runtime.ServerMetadata + err error + ) + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + val, ok := pathParams["name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + } + protoReq.Name, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + } + if req.Body != nil { + _, _ = io.Copy(io.Discard, req.Body) + } + msg, err := client.DeclineSpaceInvitation(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err +} + +func local_request_SpaceService_DeclineSpaceInvitation_0(ctx context.Context, marshaler runtime.Marshaler, server SpaceServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq DeclineSpaceInvitationRequest + metadata runtime.ServerMetadata + err error + ) + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + val, ok := pathParams["name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + } + protoReq.Name, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + } + msg, err := server.DeclineSpaceInvitation(ctx, &protoReq) + return msg, metadata, err +} + // RegisterSpaceServiceHandlerServer registers the http handlers for service SpaceService to "mux". // UnaryRPC :call SpaceServiceServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterSpaceServiceHandlerFromEndpoint instead. // GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call. func RegisterSpaceServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server SpaceServiceServer) error { - mux.Handle(http.MethodPost, pattern_SpaceService_CreateSpace_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.SpaceService/CreateSpace", runtime.WithHTTPPathPattern("/api/v1/spaces")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_SpaceService_CreateSpace_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - forward_SpaceService_CreateSpace_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle(http.MethodGet, pattern_SpaceService_ListSpaces_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.SpaceService/ListSpaces", runtime.WithHTTPPathPattern("/api/v1/spaces")) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.SpaceService/ListSpaces", runtime.WithHTTPPathPattern("/api/spaces")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -853,7 +833,7 @@ func RegisterSpaceServiceHandlerServer(ctx context.Context, mux *runtime.ServeMu var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.SpaceService/GetSpace", runtime.WithHTTPPathPattern("/api/v1/{name=spaces/*}")) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.SpaceService/GetSpace", runtime.WithHTTPPathPattern("/api/{name=spaces/*}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -867,13 +847,33 @@ func RegisterSpaceServiceHandlerServer(ctx context.Context, mux *runtime.ServeMu } forward_SpaceService_GetSpace_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) + mux.Handle(http.MethodPost, pattern_SpaceService_CreateSpace_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.SpaceService/CreateSpace", runtime.WithHTTPPathPattern("/api/spaces")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_SpaceService_CreateSpace_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_SpaceService_CreateSpace_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) mux.Handle(http.MethodPatch, pattern_SpaceService_UpdateSpace_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.SpaceService/UpdateSpace", runtime.WithHTTPPathPattern("/api/v1/{space.name=spaces/*}")) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.SpaceService/UpdateSpace", runtime.WithHTTPPathPattern("/api/{space.name=spaces/*}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -893,7 +893,7 @@ func RegisterSpaceServiceHandlerServer(ctx context.Context, mux *runtime.ServeMu var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.SpaceService/DeleteSpace", runtime.WithHTTPPathPattern("/api/v1/{name=spaces/*}")) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.SpaceService/DeleteSpace", runtime.WithHTTPPathPattern("/api/{name=spaces/*}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -907,153 +907,13 @@ func RegisterSpaceServiceHandlerServer(ctx context.Context, mux *runtime.ServeMu } forward_SpaceService_DeleteSpace_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle(http.MethodPost, pattern_SpaceService_CreateSpaceInvitation_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.SpaceService/CreateSpaceInvitation", runtime.WithHTTPPathPattern("/api/v1/{parent=spaces/*}/invitations")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_SpaceService_CreateSpaceInvitation_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - forward_SpaceService_CreateSpaceInvitation_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - mux.Handle(http.MethodGet, pattern_SpaceService_ListSpaceInvitations_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.SpaceService/ListSpaceInvitations", runtime.WithHTTPPathPattern("/api/v1/{parent=spaces/*}/invitations")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_SpaceService_ListSpaceInvitations_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - forward_SpaceService_ListSpaceInvitations_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - mux.Handle(http.MethodGet, pattern_SpaceService_ListUserSpaceInvitations_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.SpaceService/ListUserSpaceInvitations", runtime.WithHTTPPathPattern("/api/v1/{parent=users/*}/spaceInvitations")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_SpaceService_ListUserSpaceInvitations_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - forward_SpaceService_ListUserSpaceInvitations_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - mux.Handle(http.MethodGet, pattern_SpaceService_GetSpaceInvitation_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.SpaceService/GetSpaceInvitation", runtime.WithHTTPPathPattern("/api/v1/{name=spaces/*/invitations/*}")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_SpaceService_GetSpaceInvitation_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - forward_SpaceService_GetSpaceInvitation_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - mux.Handle(http.MethodDelete, pattern_SpaceService_DeleteSpaceInvitation_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.SpaceService/DeleteSpaceInvitation", runtime.WithHTTPPathPattern("/api/v1/{name=spaces/*/invitations/*}")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_SpaceService_DeleteSpaceInvitation_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - forward_SpaceService_DeleteSpaceInvitation_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - mux.Handle(http.MethodPost, pattern_SpaceService_AcceptSpaceInvitation_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.SpaceService/AcceptSpaceInvitation", runtime.WithHTTPPathPattern("/api/v1/{name=spaces/*/invitations/*}:accept")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_SpaceService_AcceptSpaceInvitation_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - forward_SpaceService_AcceptSpaceInvitation_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - mux.Handle(http.MethodPost, pattern_SpaceService_DeclineSpaceInvitation_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.SpaceService/DeclineSpaceInvitation", runtime.WithHTTPPathPattern("/api/v1/{name=spaces/*/invitations/*}:decline")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_SpaceService_DeclineSpaceInvitation_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - forward_SpaceService_DeclineSpaceInvitation_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle(http.MethodGet, pattern_SpaceService_ListSpaceMembers_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.SpaceService/ListSpaceMembers", runtime.WithHTTPPathPattern("/api/v1/{parent=spaces/*}/members")) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.SpaceService/ListSpaceMembers", runtime.WithHTTPPathPattern("/api/{parent=spaces/*}/members")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -1073,7 +933,7 @@ func RegisterSpaceServiceHandlerServer(ctx context.Context, mux *runtime.ServeMu var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.SpaceService/GetSpaceMember", runtime.WithHTTPPathPattern("/api/v1/{name=spaces/*/members/*}")) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.SpaceService/GetSpaceMember", runtime.WithHTTPPathPattern("/api/{name=spaces/*/members/*}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -1093,7 +953,7 @@ func RegisterSpaceServiceHandlerServer(ctx context.Context, mux *runtime.ServeMu var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.SpaceService/UpdateSpaceMember", runtime.WithHTTPPathPattern("/api/v1/{space_member.name=spaces/*/members/*}")) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.SpaceService/UpdateSpaceMember", runtime.WithHTTPPathPattern("/api/{space_member.name=spaces/*/members/*}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -1113,7 +973,7 @@ func RegisterSpaceServiceHandlerServer(ctx context.Context, mux *runtime.ServeMu var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.SpaceService/DeleteSpaceMember", runtime.WithHTTPPathPattern("/api/v1/{name=spaces/*/members/*}")) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.SpaceService/DeleteSpaceMember", runtime.WithHTTPPathPattern("/api/{name=spaces/*/members/*}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -1127,6 +987,146 @@ func RegisterSpaceServiceHandlerServer(ctx context.Context, mux *runtime.ServeMu } forward_SpaceService_DeleteSpaceMember_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) + mux.Handle(http.MethodGet, pattern_SpaceService_ListSpaceInvitations_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.SpaceService/ListSpaceInvitations", runtime.WithHTTPPathPattern("/api/{parent=spaces/*}/invitations")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_SpaceService_ListSpaceInvitations_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_SpaceService_ListSpaceInvitations_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) + mux.Handle(http.MethodGet, pattern_SpaceService_ListUserSpaceInvitations_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.SpaceService/ListUserSpaceInvitations", runtime.WithHTTPPathPattern("/api/{parent=users/*}/spaceInvitations")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_SpaceService_ListUserSpaceInvitations_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_SpaceService_ListUserSpaceInvitations_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) + mux.Handle(http.MethodGet, pattern_SpaceService_GetSpaceInvitation_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.SpaceService/GetSpaceInvitation", runtime.WithHTTPPathPattern("/api/{name=spaces/*/invitations/*}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_SpaceService_GetSpaceInvitation_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_SpaceService_GetSpaceInvitation_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) + mux.Handle(http.MethodPost, pattern_SpaceService_CreateSpaceInvitation_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.SpaceService/CreateSpaceInvitation", runtime.WithHTTPPathPattern("/api/{parent=spaces/*}/invitations")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_SpaceService_CreateSpaceInvitation_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_SpaceService_CreateSpaceInvitation_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) + mux.Handle(http.MethodDelete, pattern_SpaceService_DeleteSpaceInvitation_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.SpaceService/DeleteSpaceInvitation", runtime.WithHTTPPathPattern("/api/{name=spaces/*/invitations/*}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_SpaceService_DeleteSpaceInvitation_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_SpaceService_DeleteSpaceInvitation_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) + mux.Handle(http.MethodPost, pattern_SpaceService_AcceptSpaceInvitation_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.SpaceService/AcceptSpaceInvitation", runtime.WithHTTPPathPattern("/api/{name=spaces/*/invitations/*}:accept")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_SpaceService_AcceptSpaceInvitation_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_SpaceService_AcceptSpaceInvitation_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) + mux.Handle(http.MethodPost, pattern_SpaceService_DeclineSpaceInvitation_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.SpaceService/DeclineSpaceInvitation", runtime.WithHTTPPathPattern("/api/{name=spaces/*/invitations/*}:decline")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_SpaceService_DeclineSpaceInvitation_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_SpaceService_DeclineSpaceInvitation_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) return nil } @@ -1167,28 +1167,11 @@ func RegisterSpaceServiceHandler(ctx context.Context, mux *runtime.ServeMux, con // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in // "SpaceServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares. func RegisterSpaceServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client SpaceServiceClient) error { - mux.Handle(http.MethodPost, pattern_SpaceService_CreateSpace_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.SpaceService/CreateSpace", runtime.WithHTTPPathPattern("/api/v1/spaces")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_SpaceService_CreateSpace_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - forward_SpaceService_CreateSpace_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle(http.MethodGet, pattern_SpaceService_ListSpaces_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.SpaceService/ListSpaces", runtime.WithHTTPPathPattern("/api/v1/spaces")) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.SpaceService/ListSpaces", runtime.WithHTTPPathPattern("/api/spaces")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -1205,7 +1188,7 @@ func RegisterSpaceServiceHandlerClient(ctx context.Context, mux *runtime.ServeMu ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.SpaceService/GetSpace", runtime.WithHTTPPathPattern("/api/v1/{name=spaces/*}")) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.SpaceService/GetSpace", runtime.WithHTTPPathPattern("/api/{name=spaces/*}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -1218,11 +1201,28 @@ func RegisterSpaceServiceHandlerClient(ctx context.Context, mux *runtime.ServeMu } forward_SpaceService_GetSpace_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) + mux.Handle(http.MethodPost, pattern_SpaceService_CreateSpace_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.SpaceService/CreateSpace", runtime.WithHTTPPathPattern("/api/spaces")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_SpaceService_CreateSpace_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_SpaceService_CreateSpace_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) mux.Handle(http.MethodPatch, pattern_SpaceService_UpdateSpace_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.SpaceService/UpdateSpace", runtime.WithHTTPPathPattern("/api/v1/{space.name=spaces/*}")) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.SpaceService/UpdateSpace", runtime.WithHTTPPathPattern("/api/{space.name=spaces/*}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -1239,7 +1239,7 @@ func RegisterSpaceServiceHandlerClient(ctx context.Context, mux *runtime.ServeMu ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.SpaceService/DeleteSpace", runtime.WithHTTPPathPattern("/api/v1/{name=spaces/*}")) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.SpaceService/DeleteSpace", runtime.WithHTTPPathPattern("/api/{name=spaces/*}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -1252,130 +1252,11 @@ func RegisterSpaceServiceHandlerClient(ctx context.Context, mux *runtime.ServeMu } forward_SpaceService_DeleteSpace_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle(http.MethodPost, pattern_SpaceService_CreateSpaceInvitation_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.SpaceService/CreateSpaceInvitation", runtime.WithHTTPPathPattern("/api/v1/{parent=spaces/*}/invitations")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_SpaceService_CreateSpaceInvitation_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - forward_SpaceService_CreateSpaceInvitation_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - mux.Handle(http.MethodGet, pattern_SpaceService_ListSpaceInvitations_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.SpaceService/ListSpaceInvitations", runtime.WithHTTPPathPattern("/api/v1/{parent=spaces/*}/invitations")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_SpaceService_ListSpaceInvitations_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - forward_SpaceService_ListSpaceInvitations_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - mux.Handle(http.MethodGet, pattern_SpaceService_ListUserSpaceInvitations_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.SpaceService/ListUserSpaceInvitations", runtime.WithHTTPPathPattern("/api/v1/{parent=users/*}/spaceInvitations")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_SpaceService_ListUserSpaceInvitations_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - forward_SpaceService_ListUserSpaceInvitations_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - mux.Handle(http.MethodGet, pattern_SpaceService_GetSpaceInvitation_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.SpaceService/GetSpaceInvitation", runtime.WithHTTPPathPattern("/api/v1/{name=spaces/*/invitations/*}")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_SpaceService_GetSpaceInvitation_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - forward_SpaceService_GetSpaceInvitation_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - mux.Handle(http.MethodDelete, pattern_SpaceService_DeleteSpaceInvitation_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.SpaceService/DeleteSpaceInvitation", runtime.WithHTTPPathPattern("/api/v1/{name=spaces/*/invitations/*}")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_SpaceService_DeleteSpaceInvitation_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - forward_SpaceService_DeleteSpaceInvitation_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - mux.Handle(http.MethodPost, pattern_SpaceService_AcceptSpaceInvitation_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.SpaceService/AcceptSpaceInvitation", runtime.WithHTTPPathPattern("/api/v1/{name=spaces/*/invitations/*}:accept")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_SpaceService_AcceptSpaceInvitation_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - forward_SpaceService_AcceptSpaceInvitation_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - mux.Handle(http.MethodPost, pattern_SpaceService_DeclineSpaceInvitation_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.SpaceService/DeclineSpaceInvitation", runtime.WithHTTPPathPattern("/api/v1/{name=spaces/*/invitations/*}:decline")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_SpaceService_DeclineSpaceInvitation_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - forward_SpaceService_DeclineSpaceInvitation_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle(http.MethodGet, pattern_SpaceService_ListSpaceMembers_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.SpaceService/ListSpaceMembers", runtime.WithHTTPPathPattern("/api/v1/{parent=spaces/*}/members")) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.SpaceService/ListSpaceMembers", runtime.WithHTTPPathPattern("/api/{parent=spaces/*}/members")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -1392,7 +1273,7 @@ func RegisterSpaceServiceHandlerClient(ctx context.Context, mux *runtime.ServeMu ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.SpaceService/GetSpaceMember", runtime.WithHTTPPathPattern("/api/v1/{name=spaces/*/members/*}")) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.SpaceService/GetSpaceMember", runtime.WithHTTPPathPattern("/api/{name=spaces/*/members/*}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -1409,7 +1290,7 @@ func RegisterSpaceServiceHandlerClient(ctx context.Context, mux *runtime.ServeMu ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.SpaceService/UpdateSpaceMember", runtime.WithHTTPPathPattern("/api/v1/{space_member.name=spaces/*/members/*}")) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.SpaceService/UpdateSpaceMember", runtime.WithHTTPPathPattern("/api/{space_member.name=spaces/*/members/*}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -1426,7 +1307,7 @@ func RegisterSpaceServiceHandlerClient(ctx context.Context, mux *runtime.ServeMu ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.SpaceService/DeleteSpaceMember", runtime.WithHTTPPathPattern("/api/v1/{name=spaces/*/members/*}")) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.SpaceService/DeleteSpaceMember", runtime.WithHTTPPathPattern("/api/{name=spaces/*/members/*}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -1439,43 +1320,162 @@ func RegisterSpaceServiceHandlerClient(ctx context.Context, mux *runtime.ServeMu } forward_SpaceService_DeleteSpaceMember_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) + mux.Handle(http.MethodGet, pattern_SpaceService_ListSpaceInvitations_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.SpaceService/ListSpaceInvitations", runtime.WithHTTPPathPattern("/api/{parent=spaces/*}/invitations")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_SpaceService_ListSpaceInvitations_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_SpaceService_ListSpaceInvitations_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) + mux.Handle(http.MethodGet, pattern_SpaceService_ListUserSpaceInvitations_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.SpaceService/ListUserSpaceInvitations", runtime.WithHTTPPathPattern("/api/{parent=users/*}/spaceInvitations")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_SpaceService_ListUserSpaceInvitations_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_SpaceService_ListUserSpaceInvitations_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) + mux.Handle(http.MethodGet, pattern_SpaceService_GetSpaceInvitation_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.SpaceService/GetSpaceInvitation", runtime.WithHTTPPathPattern("/api/{name=spaces/*/invitations/*}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_SpaceService_GetSpaceInvitation_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_SpaceService_GetSpaceInvitation_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) + mux.Handle(http.MethodPost, pattern_SpaceService_CreateSpaceInvitation_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.SpaceService/CreateSpaceInvitation", runtime.WithHTTPPathPattern("/api/{parent=spaces/*}/invitations")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_SpaceService_CreateSpaceInvitation_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_SpaceService_CreateSpaceInvitation_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) + mux.Handle(http.MethodDelete, pattern_SpaceService_DeleteSpaceInvitation_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.SpaceService/DeleteSpaceInvitation", runtime.WithHTTPPathPattern("/api/{name=spaces/*/invitations/*}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_SpaceService_DeleteSpaceInvitation_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_SpaceService_DeleteSpaceInvitation_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) + mux.Handle(http.MethodPost, pattern_SpaceService_AcceptSpaceInvitation_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.SpaceService/AcceptSpaceInvitation", runtime.WithHTTPPathPattern("/api/{name=spaces/*/invitations/*}:accept")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_SpaceService_AcceptSpaceInvitation_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_SpaceService_AcceptSpaceInvitation_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) + mux.Handle(http.MethodPost, pattern_SpaceService_DeclineSpaceInvitation_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.SpaceService/DeclineSpaceInvitation", runtime.WithHTTPPathPattern("/api/{name=spaces/*/invitations/*}:decline")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_SpaceService_DeclineSpaceInvitation_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_SpaceService_DeclineSpaceInvitation_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) return nil } var ( - pattern_SpaceService_CreateSpace_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "v1", "spaces"}, "")) - pattern_SpaceService_ListSpaces_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "v1", "spaces"}, "")) - pattern_SpaceService_GetSpace_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3}, []string{"api", "v1", "spaces", "name"}, "")) - pattern_SpaceService_UpdateSpace_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3}, []string{"api", "v1", "spaces", "space.name"}, "")) - pattern_SpaceService_DeleteSpace_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3}, []string{"api", "v1", "spaces", "name"}, "")) - pattern_SpaceService_CreateSpaceInvitation_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3, 2, 4}, []string{"api", "v1", "spaces", "parent", "invitations"}, "")) - pattern_SpaceService_ListSpaceInvitations_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3, 2, 4}, []string{"api", "v1", "spaces", "parent", "invitations"}, "")) - pattern_SpaceService_ListUserSpaceInvitations_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3, 2, 4}, []string{"api", "v1", "users", "parent", "spaceInvitations"}, "")) - pattern_SpaceService_GetSpaceInvitation_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 2, 3, 1, 0, 4, 4, 5, 4}, []string{"api", "v1", "spaces", "invitations", "name"}, "")) - pattern_SpaceService_DeleteSpaceInvitation_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 2, 3, 1, 0, 4, 4, 5, 4}, []string{"api", "v1", "spaces", "invitations", "name"}, "")) - pattern_SpaceService_AcceptSpaceInvitation_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 2, 3, 1, 0, 4, 4, 5, 4}, []string{"api", "v1", "spaces", "invitations", "name"}, "accept")) - pattern_SpaceService_DeclineSpaceInvitation_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 2, 3, 1, 0, 4, 4, 5, 4}, []string{"api", "v1", "spaces", "invitations", "name"}, "decline")) - pattern_SpaceService_ListSpaceMembers_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3, 2, 4}, []string{"api", "v1", "spaces", "parent", "members"}, "")) - pattern_SpaceService_GetSpaceMember_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 2, 3, 1, 0, 4, 4, 5, 4}, []string{"api", "v1", "spaces", "members", "name"}, "")) - pattern_SpaceService_UpdateSpaceMember_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 2, 3, 1, 0, 4, 4, 5, 4}, []string{"api", "v1", "spaces", "members", "space_member.name"}, "")) - pattern_SpaceService_DeleteSpaceMember_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 2, 3, 1, 0, 4, 4, 5, 4}, []string{"api", "v1", "spaces", "members", "name"}, "")) + pattern_SpaceService_ListSpaces_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"api", "spaces"}, "")) + pattern_SpaceService_GetSpace_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"api", "spaces", "name"}, "")) + pattern_SpaceService_CreateSpace_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"api", "spaces"}, "")) + pattern_SpaceService_UpdateSpace_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"api", "spaces", "space.name"}, "")) + pattern_SpaceService_DeleteSpace_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"api", "spaces", "name"}, "")) + pattern_SpaceService_ListSpaceMembers_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2, 2, 3}, []string{"api", "spaces", "parent", "members"}, "")) + pattern_SpaceService_GetSpaceMember_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 4, 4, 5, 3}, []string{"api", "spaces", "members", "name"}, "")) + pattern_SpaceService_UpdateSpaceMember_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 4, 4, 5, 3}, []string{"api", "spaces", "members", "space_member.name"}, "")) + pattern_SpaceService_DeleteSpaceMember_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 4, 4, 5, 3}, []string{"api", "spaces", "members", "name"}, "")) + pattern_SpaceService_ListSpaceInvitations_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2, 2, 3}, []string{"api", "spaces", "parent", "invitations"}, "")) + pattern_SpaceService_ListUserSpaceInvitations_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2, 2, 3}, []string{"api", "users", "parent", "spaceInvitations"}, "")) + pattern_SpaceService_GetSpaceInvitation_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 4, 4, 5, 3}, []string{"api", "spaces", "invitations", "name"}, "")) + pattern_SpaceService_CreateSpaceInvitation_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2, 2, 3}, []string{"api", "spaces", "parent", "invitations"}, "")) + pattern_SpaceService_DeleteSpaceInvitation_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 4, 4, 5, 3}, []string{"api", "spaces", "invitations", "name"}, "")) + pattern_SpaceService_AcceptSpaceInvitation_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 4, 4, 5, 3}, []string{"api", "spaces", "invitations", "name"}, "accept")) + pattern_SpaceService_DeclineSpaceInvitation_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 4, 4, 5, 3}, []string{"api", "spaces", "invitations", "name"}, "decline")) ) var ( - forward_SpaceService_CreateSpace_0 = runtime.ForwardResponseMessage forward_SpaceService_ListSpaces_0 = runtime.ForwardResponseMessage forward_SpaceService_GetSpace_0 = runtime.ForwardResponseMessage + forward_SpaceService_CreateSpace_0 = runtime.ForwardResponseMessage forward_SpaceService_UpdateSpace_0 = runtime.ForwardResponseMessage forward_SpaceService_DeleteSpace_0 = runtime.ForwardResponseMessage - forward_SpaceService_CreateSpaceInvitation_0 = runtime.ForwardResponseMessage - forward_SpaceService_ListSpaceInvitations_0 = runtime.ForwardResponseMessage - forward_SpaceService_ListUserSpaceInvitations_0 = runtime.ForwardResponseMessage - forward_SpaceService_GetSpaceInvitation_0 = runtime.ForwardResponseMessage - forward_SpaceService_DeleteSpaceInvitation_0 = runtime.ForwardResponseMessage - forward_SpaceService_AcceptSpaceInvitation_0 = runtime.ForwardResponseMessage - forward_SpaceService_DeclineSpaceInvitation_0 = runtime.ForwardResponseMessage forward_SpaceService_ListSpaceMembers_0 = runtime.ForwardResponseMessage forward_SpaceService_GetSpaceMember_0 = runtime.ForwardResponseMessage forward_SpaceService_UpdateSpaceMember_0 = runtime.ForwardResponseMessage forward_SpaceService_DeleteSpaceMember_0 = runtime.ForwardResponseMessage + forward_SpaceService_ListSpaceInvitations_0 = runtime.ForwardResponseMessage + forward_SpaceService_ListUserSpaceInvitations_0 = runtime.ForwardResponseMessage + forward_SpaceService_GetSpaceInvitation_0 = runtime.ForwardResponseMessage + forward_SpaceService_CreateSpaceInvitation_0 = runtime.ForwardResponseMessage + forward_SpaceService_DeleteSpaceInvitation_0 = runtime.ForwardResponseMessage + forward_SpaceService_AcceptSpaceInvitation_0 = runtime.ForwardResponseMessage + forward_SpaceService_DeclineSpaceInvitation_0 = runtime.ForwardResponseMessage ) diff --git a/proto/gen/api/v1/space_service_grpc.pb.go b/proto/gen/api/space_service_grpc.pb.go similarity index 88% rename from proto/gen/api/v1/space_service_grpc.pb.go rename to proto/gen/api/space_service_grpc.pb.go index 2d9e4c6c6..00a3a6d55 100644 --- a/proto/gen/api/v1/space_service_grpc.pb.go +++ b/proto/gen/api/space_service_grpc.pb.go @@ -2,9 +2,9 @@ // versions: // - protoc-gen-go-grpc v1.6.2 // - protoc (unknown) -// source: api/v1/space_service.proto +// source: api/space_service.proto -package apiv1 +package api import ( context "context" @@ -20,65 +20,80 @@ import ( const _ = grpc.SupportPackageIsVersion9 const ( - SpaceService_CreateSpace_FullMethodName = "/memos.api.v1.SpaceService/CreateSpace" - SpaceService_ListSpaces_FullMethodName = "/memos.api.v1.SpaceService/ListSpaces" - SpaceService_GetSpace_FullMethodName = "/memos.api.v1.SpaceService/GetSpace" - SpaceService_UpdateSpace_FullMethodName = "/memos.api.v1.SpaceService/UpdateSpace" - SpaceService_DeleteSpace_FullMethodName = "/memos.api.v1.SpaceService/DeleteSpace" - SpaceService_CreateSpaceInvitation_FullMethodName = "/memos.api.v1.SpaceService/CreateSpaceInvitation" - SpaceService_ListSpaceInvitations_FullMethodName = "/memos.api.v1.SpaceService/ListSpaceInvitations" - SpaceService_ListUserSpaceInvitations_FullMethodName = "/memos.api.v1.SpaceService/ListUserSpaceInvitations" - SpaceService_GetSpaceInvitation_FullMethodName = "/memos.api.v1.SpaceService/GetSpaceInvitation" - SpaceService_DeleteSpaceInvitation_FullMethodName = "/memos.api.v1.SpaceService/DeleteSpaceInvitation" - SpaceService_AcceptSpaceInvitation_FullMethodName = "/memos.api.v1.SpaceService/AcceptSpaceInvitation" - SpaceService_DeclineSpaceInvitation_FullMethodName = "/memos.api.v1.SpaceService/DeclineSpaceInvitation" - SpaceService_ListSpaceMembers_FullMethodName = "/memos.api.v1.SpaceService/ListSpaceMembers" - SpaceService_GetSpaceMember_FullMethodName = "/memos.api.v1.SpaceService/GetSpaceMember" - SpaceService_UpdateSpaceMember_FullMethodName = "/memos.api.v1.SpaceService/UpdateSpaceMember" - SpaceService_DeleteSpaceMember_FullMethodName = "/memos.api.v1.SpaceService/DeleteSpaceMember" + SpaceService_ListSpaces_FullMethodName = "/memos.api.SpaceService/ListSpaces" + SpaceService_GetSpace_FullMethodName = "/memos.api.SpaceService/GetSpace" + SpaceService_CreateSpace_FullMethodName = "/memos.api.SpaceService/CreateSpace" + SpaceService_UpdateSpace_FullMethodName = "/memos.api.SpaceService/UpdateSpace" + SpaceService_DeleteSpace_FullMethodName = "/memos.api.SpaceService/DeleteSpace" + SpaceService_ListSpaceMembers_FullMethodName = "/memos.api.SpaceService/ListSpaceMembers" + SpaceService_GetSpaceMember_FullMethodName = "/memos.api.SpaceService/GetSpaceMember" + SpaceService_UpdateSpaceMember_FullMethodName = "/memos.api.SpaceService/UpdateSpaceMember" + SpaceService_DeleteSpaceMember_FullMethodName = "/memos.api.SpaceService/DeleteSpaceMember" + SpaceService_ListSpaceInvitations_FullMethodName = "/memos.api.SpaceService/ListSpaceInvitations" + SpaceService_ListUserSpaceInvitations_FullMethodName = "/memos.api.SpaceService/ListUserSpaceInvitations" + SpaceService_GetSpaceInvitation_FullMethodName = "/memos.api.SpaceService/GetSpaceInvitation" + SpaceService_CreateSpaceInvitation_FullMethodName = "/memos.api.SpaceService/CreateSpaceInvitation" + SpaceService_DeleteSpaceInvitation_FullMethodName = "/memos.api.SpaceService/DeleteSpaceInvitation" + SpaceService_AcceptSpaceInvitation_FullMethodName = "/memos.api.SpaceService/AcceptSpaceInvitation" + SpaceService_DeclineSpaceInvitation_FullMethodName = "/memos.api.SpaceService/DeclineSpaceInvitation" ) // SpaceServiceClient is the client API for SpaceService service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. // -// SpaceService manages collaborative spaces and their memberships. +// SpaceService manages collaborative spaces, their members and their invitations. type SpaceServiceClient interface { + // ListSpaces lists the spaces of which the authenticated caller is a member. + ListSpaces(ctx context.Context, in *ListSpacesRequest, opts ...grpc.CallOption) (*ListSpacesResponse, error) + // GetSpace gets a space of which the authenticated caller is a member. + // Spaces the caller is not a member of are reported as not found. + GetSpace(ctx context.Context, in *GetSpaceRequest, opts ...grpc.CallOption) (*Space, error) // CreateSpace creates a space and makes the authenticated caller its first // administrator. CreateSpace(ctx context.Context, in *CreateSpaceRequest, opts ...grpc.CallOption) (*Space, error) - // ListSpaces lists spaces of which the authenticated caller is a member. - ListSpaces(ctx context.Context, in *ListSpacesRequest, opts ...grpc.CallOption) (*ListSpacesResponse, error) - // GetSpace gets a space of which the authenticated caller is a member. - GetSpace(ctx context.Context, in *GetSpaceRequest, opts ...grpc.CallOption) (*Space, error) - // UpdateSpace updates space metadata. + // UpdateSpace updates space metadata. Only a space administrator can update + // a space. UpdateSpace(ctx context.Context, in *UpdateSpaceRequest, opts ...grpc.CallOption) (*Space, error) // DeleteSpace permanently deletes a space and every memo currently placed - // in it. It never follows memo relations to other memos. + // in it. It never follows memo relations to other memos. Only a space + // administrator can delete a space. DeleteSpace(ctx context.Context, in *DeleteSpaceRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) - // CreateSpaceInvitation invites an existing active user to a space. - CreateSpaceInvitation(ctx context.Context, in *CreateSpaceInvitationRequest, opts ...grpc.CallOption) (*SpaceInvitation, error) - // ListSpaceInvitations lists the pending invitations for a space. - ListSpaceInvitations(ctx context.Context, in *ListSpaceInvitationsRequest, opts ...grpc.CallOption) (*ListSpaceInvitationsResponse, error) - // ListUserSpaceInvitations lists the authenticated user's pending space invitations. - ListUserSpaceInvitations(ctx context.Context, in *ListUserSpaceInvitationsRequest, opts ...grpc.CallOption) (*ListUserSpaceInvitationsResponse, error) - // GetSpaceInvitation gets one pending invitation. - GetSpaceInvitation(ctx context.Context, in *GetSpaceInvitationRequest, opts ...grpc.CallOption) (*SpaceInvitation, error) - // DeleteSpaceInvitation revokes a pending invitation. - DeleteSpaceInvitation(ctx context.Context, in *DeleteSpaceInvitationRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) - // AcceptSpaceInvitation accepts a pending invitation and creates a membership. - AcceptSpaceInvitation(ctx context.Context, in *AcceptSpaceInvitationRequest, opts ...grpc.CallOption) (*SpaceMember, error) - // DeclineSpaceInvitation declines a pending invitation. - DeclineSpaceInvitation(ctx context.Context, in *DeclineSpaceInvitationRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) - // ListSpaceMembers lists the members of a space. + // ListSpaceMembers lists the members of a space. The caller must be a member + // of the space. ListSpaceMembers(ctx context.Context, in *ListSpaceMembersRequest, opts ...grpc.CallOption) (*ListSpaceMembersResponse, error) - // GetSpaceMember gets one membership in a space. + // GetSpaceMember gets one membership in a space. The caller must be a member + // of the space. GetSpaceMember(ctx context.Context, in *GetSpaceMemberRequest, opts ...grpc.CallOption) (*SpaceMember, error) - // UpdateSpaceMember changes a member's space role. + // UpdateSpaceMember changes a member's space role. Only a space administrator + // can change roles, and a space must keep at least one administrator. UpdateSpaceMember(ctx context.Context, in *UpdateSpaceMemberRequest, opts ...grpc.CallOption) (*SpaceMember, error) - // DeleteSpaceMember removes a member. A member may delete their own - // membership to leave the space. + // DeleteSpaceMember removes a member. A space administrator can remove any + // member, and a member may delete their own membership to leave the space. + // A space must keep at least one administrator. DeleteSpaceMember(ctx context.Context, in *DeleteSpaceMemberRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) + // ListSpaceInvitations lists the pending invitations for a space. Only a + // space administrator can list them. + ListSpaceInvitations(ctx context.Context, in *ListSpaceInvitationsRequest, opts ...grpc.CallOption) (*ListSpaceInvitationsResponse, error) + // ListUserSpaceInvitations lists the authenticated user's pending space + // invitations. A user cannot list another user's invitations. + ListUserSpaceInvitations(ctx context.Context, in *ListUserSpaceInvitationsRequest, opts ...grpc.CallOption) (*ListUserSpaceInvitationsResponse, error) + // GetSpaceInvitation gets one pending invitation. Only the invitee or a + // space administrator can get it. + GetSpaceInvitation(ctx context.Context, in *GetSpaceInvitationRequest, opts ...grpc.CallOption) (*SpaceInvitation, error) + // CreateSpaceInvitation invites an existing active user to a space. Only a + // space administrator can invite. The invitee gets no space access until + // they accept. + CreateSpaceInvitation(ctx context.Context, in *CreateSpaceInvitationRequest, opts ...grpc.CallOption) (*SpaceInvitation, error) + // DeleteSpaceInvitation revokes a pending invitation. Only a space + // administrator can revoke it. + DeleteSpaceInvitation(ctx context.Context, in *DeleteSpaceInvitationRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) + // AcceptSpaceInvitation accepts a pending invitation and creates a + // membership with the invited role. Only the invitee can accept it. + AcceptSpaceInvitation(ctx context.Context, in *AcceptSpaceInvitationRequest, opts ...grpc.CallOption) (*SpaceMember, error) + // DeclineSpaceInvitation declines a pending invitation without creating a + // membership. Only the invitee can decline it. + DeclineSpaceInvitation(ctx context.Context, in *DeclineSpaceInvitationRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) } type spaceServiceClient struct { @@ -89,16 +104,6 @@ func NewSpaceServiceClient(cc grpc.ClientConnInterface) SpaceServiceClient { return &spaceServiceClient{cc} } -func (c *spaceServiceClient) CreateSpace(ctx context.Context, in *CreateSpaceRequest, opts ...grpc.CallOption) (*Space, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(Space) - err := c.cc.Invoke(ctx, SpaceService_CreateSpace_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - func (c *spaceServiceClient) ListSpaces(ctx context.Context, in *ListSpacesRequest, opts ...grpc.CallOption) (*ListSpacesResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(ListSpacesResponse) @@ -119,6 +124,16 @@ func (c *spaceServiceClient) GetSpace(ctx context.Context, in *GetSpaceRequest, return out, nil } +func (c *spaceServiceClient) CreateSpace(ctx context.Context, in *CreateSpaceRequest, opts ...grpc.CallOption) (*Space, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(Space) + err := c.cc.Invoke(ctx, SpaceService_CreateSpace_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *spaceServiceClient) UpdateSpace(ctx context.Context, in *UpdateSpaceRequest, opts ...grpc.CallOption) (*Space, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(Space) @@ -139,76 +154,6 @@ func (c *spaceServiceClient) DeleteSpace(ctx context.Context, in *DeleteSpaceReq return out, nil } -func (c *spaceServiceClient) CreateSpaceInvitation(ctx context.Context, in *CreateSpaceInvitationRequest, opts ...grpc.CallOption) (*SpaceInvitation, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(SpaceInvitation) - err := c.cc.Invoke(ctx, SpaceService_CreateSpaceInvitation_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *spaceServiceClient) ListSpaceInvitations(ctx context.Context, in *ListSpaceInvitationsRequest, opts ...grpc.CallOption) (*ListSpaceInvitationsResponse, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(ListSpaceInvitationsResponse) - err := c.cc.Invoke(ctx, SpaceService_ListSpaceInvitations_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *spaceServiceClient) ListUserSpaceInvitations(ctx context.Context, in *ListUserSpaceInvitationsRequest, opts ...grpc.CallOption) (*ListUserSpaceInvitationsResponse, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(ListUserSpaceInvitationsResponse) - err := c.cc.Invoke(ctx, SpaceService_ListUserSpaceInvitations_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *spaceServiceClient) GetSpaceInvitation(ctx context.Context, in *GetSpaceInvitationRequest, opts ...grpc.CallOption) (*SpaceInvitation, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(SpaceInvitation) - err := c.cc.Invoke(ctx, SpaceService_GetSpaceInvitation_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *spaceServiceClient) DeleteSpaceInvitation(ctx context.Context, in *DeleteSpaceInvitationRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(emptypb.Empty) - err := c.cc.Invoke(ctx, SpaceService_DeleteSpaceInvitation_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *spaceServiceClient) AcceptSpaceInvitation(ctx context.Context, in *AcceptSpaceInvitationRequest, opts ...grpc.CallOption) (*SpaceMember, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(SpaceMember) - err := c.cc.Invoke(ctx, SpaceService_AcceptSpaceInvitation_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *spaceServiceClient) DeclineSpaceInvitation(ctx context.Context, in *DeclineSpaceInvitationRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(emptypb.Empty) - err := c.cc.Invoke(ctx, SpaceService_DeclineSpaceInvitation_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - func (c *spaceServiceClient) ListSpaceMembers(ctx context.Context, in *ListSpaceMembersRequest, opts ...grpc.CallOption) (*ListSpaceMembersResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(ListSpaceMembersResponse) @@ -249,47 +194,132 @@ func (c *spaceServiceClient) DeleteSpaceMember(ctx context.Context, in *DeleteSp return out, nil } +func (c *spaceServiceClient) ListSpaceInvitations(ctx context.Context, in *ListSpaceInvitationsRequest, opts ...grpc.CallOption) (*ListSpaceInvitationsResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ListSpaceInvitationsResponse) + err := c.cc.Invoke(ctx, SpaceService_ListSpaceInvitations_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *spaceServiceClient) ListUserSpaceInvitations(ctx context.Context, in *ListUserSpaceInvitationsRequest, opts ...grpc.CallOption) (*ListUserSpaceInvitationsResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ListUserSpaceInvitationsResponse) + err := c.cc.Invoke(ctx, SpaceService_ListUserSpaceInvitations_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *spaceServiceClient) GetSpaceInvitation(ctx context.Context, in *GetSpaceInvitationRequest, opts ...grpc.CallOption) (*SpaceInvitation, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(SpaceInvitation) + err := c.cc.Invoke(ctx, SpaceService_GetSpaceInvitation_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *spaceServiceClient) CreateSpaceInvitation(ctx context.Context, in *CreateSpaceInvitationRequest, opts ...grpc.CallOption) (*SpaceInvitation, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(SpaceInvitation) + err := c.cc.Invoke(ctx, SpaceService_CreateSpaceInvitation_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *spaceServiceClient) DeleteSpaceInvitation(ctx context.Context, in *DeleteSpaceInvitationRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(emptypb.Empty) + err := c.cc.Invoke(ctx, SpaceService_DeleteSpaceInvitation_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *spaceServiceClient) AcceptSpaceInvitation(ctx context.Context, in *AcceptSpaceInvitationRequest, opts ...grpc.CallOption) (*SpaceMember, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(SpaceMember) + err := c.cc.Invoke(ctx, SpaceService_AcceptSpaceInvitation_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *spaceServiceClient) DeclineSpaceInvitation(ctx context.Context, in *DeclineSpaceInvitationRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(emptypb.Empty) + err := c.cc.Invoke(ctx, SpaceService_DeclineSpaceInvitation_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + // SpaceServiceServer is the server API for SpaceService service. // All implementations must embed UnimplementedSpaceServiceServer // for forward compatibility. // -// SpaceService manages collaborative spaces and their memberships. +// SpaceService manages collaborative spaces, their members and their invitations. type SpaceServiceServer interface { + // ListSpaces lists the spaces of which the authenticated caller is a member. + ListSpaces(context.Context, *ListSpacesRequest) (*ListSpacesResponse, error) + // GetSpace gets a space of which the authenticated caller is a member. + // Spaces the caller is not a member of are reported as not found. + GetSpace(context.Context, *GetSpaceRequest) (*Space, error) // CreateSpace creates a space and makes the authenticated caller its first // administrator. CreateSpace(context.Context, *CreateSpaceRequest) (*Space, error) - // ListSpaces lists spaces of which the authenticated caller is a member. - ListSpaces(context.Context, *ListSpacesRequest) (*ListSpacesResponse, error) - // GetSpace gets a space of which the authenticated caller is a member. - GetSpace(context.Context, *GetSpaceRequest) (*Space, error) - // UpdateSpace updates space metadata. + // UpdateSpace updates space metadata. Only a space administrator can update + // a space. UpdateSpace(context.Context, *UpdateSpaceRequest) (*Space, error) // DeleteSpace permanently deletes a space and every memo currently placed - // in it. It never follows memo relations to other memos. + // in it. It never follows memo relations to other memos. Only a space + // administrator can delete a space. DeleteSpace(context.Context, *DeleteSpaceRequest) (*emptypb.Empty, error) - // CreateSpaceInvitation invites an existing active user to a space. - CreateSpaceInvitation(context.Context, *CreateSpaceInvitationRequest) (*SpaceInvitation, error) - // ListSpaceInvitations lists the pending invitations for a space. - ListSpaceInvitations(context.Context, *ListSpaceInvitationsRequest) (*ListSpaceInvitationsResponse, error) - // ListUserSpaceInvitations lists the authenticated user's pending space invitations. - ListUserSpaceInvitations(context.Context, *ListUserSpaceInvitationsRequest) (*ListUserSpaceInvitationsResponse, error) - // GetSpaceInvitation gets one pending invitation. - GetSpaceInvitation(context.Context, *GetSpaceInvitationRequest) (*SpaceInvitation, error) - // DeleteSpaceInvitation revokes a pending invitation. - DeleteSpaceInvitation(context.Context, *DeleteSpaceInvitationRequest) (*emptypb.Empty, error) - // AcceptSpaceInvitation accepts a pending invitation and creates a membership. - AcceptSpaceInvitation(context.Context, *AcceptSpaceInvitationRequest) (*SpaceMember, error) - // DeclineSpaceInvitation declines a pending invitation. - DeclineSpaceInvitation(context.Context, *DeclineSpaceInvitationRequest) (*emptypb.Empty, error) - // ListSpaceMembers lists the members of a space. + // ListSpaceMembers lists the members of a space. The caller must be a member + // of the space. ListSpaceMembers(context.Context, *ListSpaceMembersRequest) (*ListSpaceMembersResponse, error) - // GetSpaceMember gets one membership in a space. + // GetSpaceMember gets one membership in a space. The caller must be a member + // of the space. GetSpaceMember(context.Context, *GetSpaceMemberRequest) (*SpaceMember, error) - // UpdateSpaceMember changes a member's space role. + // UpdateSpaceMember changes a member's space role. Only a space administrator + // can change roles, and a space must keep at least one administrator. UpdateSpaceMember(context.Context, *UpdateSpaceMemberRequest) (*SpaceMember, error) - // DeleteSpaceMember removes a member. A member may delete their own - // membership to leave the space. + // DeleteSpaceMember removes a member. A space administrator can remove any + // member, and a member may delete their own membership to leave the space. + // A space must keep at least one administrator. DeleteSpaceMember(context.Context, *DeleteSpaceMemberRequest) (*emptypb.Empty, error) + // ListSpaceInvitations lists the pending invitations for a space. Only a + // space administrator can list them. + ListSpaceInvitations(context.Context, *ListSpaceInvitationsRequest) (*ListSpaceInvitationsResponse, error) + // ListUserSpaceInvitations lists the authenticated user's pending space + // invitations. A user cannot list another user's invitations. + ListUserSpaceInvitations(context.Context, *ListUserSpaceInvitationsRequest) (*ListUserSpaceInvitationsResponse, error) + // GetSpaceInvitation gets one pending invitation. Only the invitee or a + // space administrator can get it. + GetSpaceInvitation(context.Context, *GetSpaceInvitationRequest) (*SpaceInvitation, error) + // CreateSpaceInvitation invites an existing active user to a space. Only a + // space administrator can invite. The invitee gets no space access until + // they accept. + CreateSpaceInvitation(context.Context, *CreateSpaceInvitationRequest) (*SpaceInvitation, error) + // DeleteSpaceInvitation revokes a pending invitation. Only a space + // administrator can revoke it. + DeleteSpaceInvitation(context.Context, *DeleteSpaceInvitationRequest) (*emptypb.Empty, error) + // AcceptSpaceInvitation accepts a pending invitation and creates a + // membership with the invited role. Only the invitee can accept it. + AcceptSpaceInvitation(context.Context, *AcceptSpaceInvitationRequest) (*SpaceMember, error) + // DeclineSpaceInvitation declines a pending invitation without creating a + // membership. Only the invitee can decline it. + DeclineSpaceInvitation(context.Context, *DeclineSpaceInvitationRequest) (*emptypb.Empty, error) mustEmbedUnimplementedSpaceServiceServer() } @@ -300,42 +330,21 @@ type SpaceServiceServer interface { // pointer dereference when methods are called. type UnimplementedSpaceServiceServer struct{} -func (UnimplementedSpaceServiceServer) CreateSpace(context.Context, *CreateSpaceRequest) (*Space, error) { - return nil, status.Error(codes.Unimplemented, "method CreateSpace not implemented") -} func (UnimplementedSpaceServiceServer) ListSpaces(context.Context, *ListSpacesRequest) (*ListSpacesResponse, error) { return nil, status.Error(codes.Unimplemented, "method ListSpaces not implemented") } func (UnimplementedSpaceServiceServer) GetSpace(context.Context, *GetSpaceRequest) (*Space, error) { return nil, status.Error(codes.Unimplemented, "method GetSpace not implemented") } +func (UnimplementedSpaceServiceServer) CreateSpace(context.Context, *CreateSpaceRequest) (*Space, error) { + return nil, status.Error(codes.Unimplemented, "method CreateSpace not implemented") +} func (UnimplementedSpaceServiceServer) UpdateSpace(context.Context, *UpdateSpaceRequest) (*Space, error) { return nil, status.Error(codes.Unimplemented, "method UpdateSpace not implemented") } func (UnimplementedSpaceServiceServer) DeleteSpace(context.Context, *DeleteSpaceRequest) (*emptypb.Empty, error) { return nil, status.Error(codes.Unimplemented, "method DeleteSpace not implemented") } -func (UnimplementedSpaceServiceServer) CreateSpaceInvitation(context.Context, *CreateSpaceInvitationRequest) (*SpaceInvitation, error) { - return nil, status.Error(codes.Unimplemented, "method CreateSpaceInvitation not implemented") -} -func (UnimplementedSpaceServiceServer) ListSpaceInvitations(context.Context, *ListSpaceInvitationsRequest) (*ListSpaceInvitationsResponse, error) { - return nil, status.Error(codes.Unimplemented, "method ListSpaceInvitations not implemented") -} -func (UnimplementedSpaceServiceServer) ListUserSpaceInvitations(context.Context, *ListUserSpaceInvitationsRequest) (*ListUserSpaceInvitationsResponse, error) { - return nil, status.Error(codes.Unimplemented, "method ListUserSpaceInvitations not implemented") -} -func (UnimplementedSpaceServiceServer) GetSpaceInvitation(context.Context, *GetSpaceInvitationRequest) (*SpaceInvitation, error) { - return nil, status.Error(codes.Unimplemented, "method GetSpaceInvitation not implemented") -} -func (UnimplementedSpaceServiceServer) DeleteSpaceInvitation(context.Context, *DeleteSpaceInvitationRequest) (*emptypb.Empty, error) { - return nil, status.Error(codes.Unimplemented, "method DeleteSpaceInvitation not implemented") -} -func (UnimplementedSpaceServiceServer) AcceptSpaceInvitation(context.Context, *AcceptSpaceInvitationRequest) (*SpaceMember, error) { - return nil, status.Error(codes.Unimplemented, "method AcceptSpaceInvitation not implemented") -} -func (UnimplementedSpaceServiceServer) DeclineSpaceInvitation(context.Context, *DeclineSpaceInvitationRequest) (*emptypb.Empty, error) { - return nil, status.Error(codes.Unimplemented, "method DeclineSpaceInvitation not implemented") -} func (UnimplementedSpaceServiceServer) ListSpaceMembers(context.Context, *ListSpaceMembersRequest) (*ListSpaceMembersResponse, error) { return nil, status.Error(codes.Unimplemented, "method ListSpaceMembers not implemented") } @@ -348,6 +357,27 @@ func (UnimplementedSpaceServiceServer) UpdateSpaceMember(context.Context, *Updat func (UnimplementedSpaceServiceServer) DeleteSpaceMember(context.Context, *DeleteSpaceMemberRequest) (*emptypb.Empty, error) { return nil, status.Error(codes.Unimplemented, "method DeleteSpaceMember not implemented") } +func (UnimplementedSpaceServiceServer) ListSpaceInvitations(context.Context, *ListSpaceInvitationsRequest) (*ListSpaceInvitationsResponse, error) { + return nil, status.Error(codes.Unimplemented, "method ListSpaceInvitations not implemented") +} +func (UnimplementedSpaceServiceServer) ListUserSpaceInvitations(context.Context, *ListUserSpaceInvitationsRequest) (*ListUserSpaceInvitationsResponse, error) { + return nil, status.Error(codes.Unimplemented, "method ListUserSpaceInvitations not implemented") +} +func (UnimplementedSpaceServiceServer) GetSpaceInvitation(context.Context, *GetSpaceInvitationRequest) (*SpaceInvitation, error) { + return nil, status.Error(codes.Unimplemented, "method GetSpaceInvitation not implemented") +} +func (UnimplementedSpaceServiceServer) CreateSpaceInvitation(context.Context, *CreateSpaceInvitationRequest) (*SpaceInvitation, error) { + return nil, status.Error(codes.Unimplemented, "method CreateSpaceInvitation not implemented") +} +func (UnimplementedSpaceServiceServer) DeleteSpaceInvitation(context.Context, *DeleteSpaceInvitationRequest) (*emptypb.Empty, error) { + return nil, status.Error(codes.Unimplemented, "method DeleteSpaceInvitation not implemented") +} +func (UnimplementedSpaceServiceServer) AcceptSpaceInvitation(context.Context, *AcceptSpaceInvitationRequest) (*SpaceMember, error) { + return nil, status.Error(codes.Unimplemented, "method AcceptSpaceInvitation not implemented") +} +func (UnimplementedSpaceServiceServer) DeclineSpaceInvitation(context.Context, *DeclineSpaceInvitationRequest) (*emptypb.Empty, error) { + return nil, status.Error(codes.Unimplemented, "method DeclineSpaceInvitation not implemented") +} func (UnimplementedSpaceServiceServer) mustEmbedUnimplementedSpaceServiceServer() {} func (UnimplementedSpaceServiceServer) testEmbeddedByValue() {} @@ -369,24 +399,6 @@ func RegisterSpaceServiceServer(s grpc.ServiceRegistrar, srv SpaceServiceServer) s.RegisterService(&SpaceService_ServiceDesc, srv) } -func _SpaceService_CreateSpace_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CreateSpaceRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(SpaceServiceServer).CreateSpace(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: SpaceService_CreateSpace_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(SpaceServiceServer).CreateSpace(ctx, req.(*CreateSpaceRequest)) - } - return interceptor(ctx, in, info, handler) -} - func _SpaceService_ListSpaces_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ListSpacesRequest) if err := dec(in); err != nil { @@ -423,6 +435,24 @@ func _SpaceService_GetSpace_Handler(srv interface{}, ctx context.Context, dec fu return interceptor(ctx, in, info, handler) } +func _SpaceService_CreateSpace_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateSpaceRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SpaceServiceServer).CreateSpace(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SpaceService_CreateSpace_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SpaceServiceServer).CreateSpace(ctx, req.(*CreateSpaceRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _SpaceService_UpdateSpace_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(UpdateSpaceRequest) if err := dec(in); err != nil { @@ -459,132 +489,6 @@ func _SpaceService_DeleteSpace_Handler(srv interface{}, ctx context.Context, dec return interceptor(ctx, in, info, handler) } -func _SpaceService_CreateSpaceInvitation_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CreateSpaceInvitationRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(SpaceServiceServer).CreateSpaceInvitation(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: SpaceService_CreateSpaceInvitation_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(SpaceServiceServer).CreateSpaceInvitation(ctx, req.(*CreateSpaceInvitationRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _SpaceService_ListSpaceInvitations_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ListSpaceInvitationsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(SpaceServiceServer).ListSpaceInvitations(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: SpaceService_ListSpaceInvitations_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(SpaceServiceServer).ListSpaceInvitations(ctx, req.(*ListSpaceInvitationsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _SpaceService_ListUserSpaceInvitations_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ListUserSpaceInvitationsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(SpaceServiceServer).ListUserSpaceInvitations(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: SpaceService_ListUserSpaceInvitations_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(SpaceServiceServer).ListUserSpaceInvitations(ctx, req.(*ListUserSpaceInvitationsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _SpaceService_GetSpaceInvitation_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetSpaceInvitationRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(SpaceServiceServer).GetSpaceInvitation(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: SpaceService_GetSpaceInvitation_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(SpaceServiceServer).GetSpaceInvitation(ctx, req.(*GetSpaceInvitationRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _SpaceService_DeleteSpaceInvitation_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(DeleteSpaceInvitationRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(SpaceServiceServer).DeleteSpaceInvitation(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: SpaceService_DeleteSpaceInvitation_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(SpaceServiceServer).DeleteSpaceInvitation(ctx, req.(*DeleteSpaceInvitationRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _SpaceService_AcceptSpaceInvitation_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(AcceptSpaceInvitationRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(SpaceServiceServer).AcceptSpaceInvitation(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: SpaceService_AcceptSpaceInvitation_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(SpaceServiceServer).AcceptSpaceInvitation(ctx, req.(*AcceptSpaceInvitationRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _SpaceService_DeclineSpaceInvitation_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(DeclineSpaceInvitationRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(SpaceServiceServer).DeclineSpaceInvitation(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: SpaceService_DeclineSpaceInvitation_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(SpaceServiceServer).DeclineSpaceInvitation(ctx, req.(*DeclineSpaceInvitationRequest)) - } - return interceptor(ctx, in, info, handler) -} - func _SpaceService_ListSpaceMembers_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ListSpaceMembersRequest) if err := dec(in); err != nil { @@ -657,17 +561,139 @@ func _SpaceService_DeleteSpaceMember_Handler(srv interface{}, ctx context.Contex return interceptor(ctx, in, info, handler) } +func _SpaceService_ListSpaceInvitations_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListSpaceInvitationsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SpaceServiceServer).ListSpaceInvitations(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SpaceService_ListSpaceInvitations_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SpaceServiceServer).ListSpaceInvitations(ctx, req.(*ListSpaceInvitationsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SpaceService_ListUserSpaceInvitations_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListUserSpaceInvitationsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SpaceServiceServer).ListUserSpaceInvitations(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SpaceService_ListUserSpaceInvitations_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SpaceServiceServer).ListUserSpaceInvitations(ctx, req.(*ListUserSpaceInvitationsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SpaceService_GetSpaceInvitation_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetSpaceInvitationRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SpaceServiceServer).GetSpaceInvitation(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SpaceService_GetSpaceInvitation_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SpaceServiceServer).GetSpaceInvitation(ctx, req.(*GetSpaceInvitationRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SpaceService_CreateSpaceInvitation_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateSpaceInvitationRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SpaceServiceServer).CreateSpaceInvitation(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SpaceService_CreateSpaceInvitation_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SpaceServiceServer).CreateSpaceInvitation(ctx, req.(*CreateSpaceInvitationRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SpaceService_DeleteSpaceInvitation_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteSpaceInvitationRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SpaceServiceServer).DeleteSpaceInvitation(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SpaceService_DeleteSpaceInvitation_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SpaceServiceServer).DeleteSpaceInvitation(ctx, req.(*DeleteSpaceInvitationRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SpaceService_AcceptSpaceInvitation_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AcceptSpaceInvitationRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SpaceServiceServer).AcceptSpaceInvitation(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SpaceService_AcceptSpaceInvitation_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SpaceServiceServer).AcceptSpaceInvitation(ctx, req.(*AcceptSpaceInvitationRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SpaceService_DeclineSpaceInvitation_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeclineSpaceInvitationRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SpaceServiceServer).DeclineSpaceInvitation(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SpaceService_DeclineSpaceInvitation_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SpaceServiceServer).DeclineSpaceInvitation(ctx, req.(*DeclineSpaceInvitationRequest)) + } + return interceptor(ctx, in, info, handler) +} + // SpaceService_ServiceDesc is the grpc.ServiceDesc for SpaceService service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) var SpaceService_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "memos.api.v1.SpaceService", + ServiceName: "memos.api.SpaceService", HandlerType: (*SpaceServiceServer)(nil), Methods: []grpc.MethodDesc{ - { - MethodName: "CreateSpace", - Handler: _SpaceService_CreateSpace_Handler, - }, { MethodName: "ListSpaces", Handler: _SpaceService_ListSpaces_Handler, @@ -676,6 +702,10 @@ var SpaceService_ServiceDesc = grpc.ServiceDesc{ MethodName: "GetSpace", Handler: _SpaceService_GetSpace_Handler, }, + { + MethodName: "CreateSpace", + Handler: _SpaceService_CreateSpace_Handler, + }, { MethodName: "UpdateSpace", Handler: _SpaceService_UpdateSpace_Handler, @@ -684,34 +714,6 @@ var SpaceService_ServiceDesc = grpc.ServiceDesc{ MethodName: "DeleteSpace", Handler: _SpaceService_DeleteSpace_Handler, }, - { - MethodName: "CreateSpaceInvitation", - Handler: _SpaceService_CreateSpaceInvitation_Handler, - }, - { - MethodName: "ListSpaceInvitations", - Handler: _SpaceService_ListSpaceInvitations_Handler, - }, - { - MethodName: "ListUserSpaceInvitations", - Handler: _SpaceService_ListUserSpaceInvitations_Handler, - }, - { - MethodName: "GetSpaceInvitation", - Handler: _SpaceService_GetSpaceInvitation_Handler, - }, - { - MethodName: "DeleteSpaceInvitation", - Handler: _SpaceService_DeleteSpaceInvitation_Handler, - }, - { - MethodName: "AcceptSpaceInvitation", - Handler: _SpaceService_AcceptSpaceInvitation_Handler, - }, - { - MethodName: "DeclineSpaceInvitation", - Handler: _SpaceService_DeclineSpaceInvitation_Handler, - }, { MethodName: "ListSpaceMembers", Handler: _SpaceService_ListSpaceMembers_Handler, @@ -728,7 +730,35 @@ var SpaceService_ServiceDesc = grpc.ServiceDesc{ MethodName: "DeleteSpaceMember", Handler: _SpaceService_DeleteSpaceMember_Handler, }, + { + MethodName: "ListSpaceInvitations", + Handler: _SpaceService_ListSpaceInvitations_Handler, + }, + { + MethodName: "ListUserSpaceInvitations", + Handler: _SpaceService_ListUserSpaceInvitations_Handler, + }, + { + MethodName: "GetSpaceInvitation", + Handler: _SpaceService_GetSpaceInvitation_Handler, + }, + { + MethodName: "CreateSpaceInvitation", + Handler: _SpaceService_CreateSpaceInvitation_Handler, + }, + { + MethodName: "DeleteSpaceInvitation", + Handler: _SpaceService_DeleteSpaceInvitation_Handler, + }, + { + MethodName: "AcceptSpaceInvitation", + Handler: _SpaceService_AcceptSpaceInvitation_Handler, + }, + { + MethodName: "DeclineSpaceInvitation", + Handler: _SpaceService_DeclineSpaceInvitation_Handler, + }, }, Streams: []grpc.StreamDesc{}, - Metadata: "api/v1/space_service.proto", + Metadata: "api/space_service.proto", } diff --git a/proto/gen/api/v1/user_service.pb.go b/proto/gen/api/user_service.pb.go similarity index 58% rename from proto/gen/api/v1/user_service.pb.go rename to proto/gen/api/user_service.pb.go index 1e2686d50..7c7bb8071 100644 --- a/proto/gen/api/v1/user_service.pb.go +++ b/proto/gen/api/user_service.pb.go @@ -2,9 +2,9 @@ // versions: // protoc-gen-go v1.36.12 // protoc (unknown) -// source: api/v1/user_service.proto +// source: api/user_service.proto -package apiv1 +package api import ( _ "google.golang.org/genproto/googleapis/api/annotations" @@ -27,14 +27,14 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// User role enumeration. +// Role is the instance-wide role of a user. type User_Role int32 const ( User_ROLE_UNSPECIFIED User_Role = 0 - // Admin role with system access. + // An administrator of the instance. User_ADMIN User_Role = 2 - // User role with limited access. + // A regular user. User_USER User_Role = 3 ) @@ -63,11 +63,11 @@ func (x User_Role) String() string { } func (User_Role) Descriptor() protoreflect.EnumDescriptor { - return file_api_v1_user_service_proto_enumTypes[0].Descriptor() + return file_api_user_service_proto_enumTypes[0].Descriptor() } func (User_Role) Type() protoreflect.EnumType { - return &file_api_v1_user_service_proto_enumTypes[0] + return &file_api_user_service_proto_enumTypes[0] } func (x User_Role) Number() protoreflect.EnumNumber { @@ -76,10 +76,227 @@ func (x User_Role) Number() protoreflect.EnumNumber { // Deprecated: Use User_Role.Descriptor instead. func (User_Role) EnumDescriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{0, 0} + return file_api_user_service_proto_rawDescGZIP(), []int{0, 0} } -// What the importer does with a memo whose UID the user already holds. +// Key identifies a user setting. +type UserSetting_Key int32 + +const ( + UserSetting_KEY_UNSPECIFIED UserSetting_Key = 0 + // General user preferences. + UserSetting_GENERAL UserSetting_Key = 1 + // The user's webhooks. + UserSetting_WEBHOOKS UserSetting_Key = 4 + // Per-user tag metadata. + UserSetting_TAGS UserSetting_Key = 5 +) + +// Enum value maps for UserSetting_Key. +var ( + UserSetting_Key_name = map[int32]string{ + 0: "KEY_UNSPECIFIED", + 1: "GENERAL", + 4: "WEBHOOKS", + 5: "TAGS", + } + UserSetting_Key_value = map[string]int32{ + "KEY_UNSPECIFIED": 0, + "GENERAL": 1, + "WEBHOOKS": 4, + "TAGS": 5, + } +) + +func (x UserSetting_Key) Enum() *UserSetting_Key { + p := new(UserSetting_Key) + *p = x + return p +} + +func (x UserSetting_Key) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (UserSetting_Key) Descriptor() protoreflect.EnumDescriptor { + return file_api_user_service_proto_enumTypes[1].Descriptor() +} + +func (UserSetting_Key) Type() protoreflect.EnumType { + return &file_api_user_service_proto_enumTypes[1] +} + +func (x UserSetting_Key) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use UserSetting_Key.Descriptor instead. +func (UserSetting_Key) EnumDescriptor() ([]byte, []int) { + return file_api_user_service_proto_rawDescGZIP(), []int{9, 0} +} + +// Status is the receiver's handling state of a notification. +type UserNotification_Status int32 + +const ( + UserNotification_STATUS_UNSPECIFIED UserNotification_Status = 0 + // The receiver has not handled the notification yet. + UserNotification_UNREAD UserNotification_Status = 1 + // The receiver has archived the notification. + UserNotification_ARCHIVED UserNotification_Status = 2 +) + +// Enum value maps for UserNotification_Status. +var ( + UserNotification_Status_name = map[int32]string{ + 0: "STATUS_UNSPECIFIED", + 1: "UNREAD", + 2: "ARCHIVED", + } + UserNotification_Status_value = map[string]int32{ + "STATUS_UNSPECIFIED": 0, + "UNREAD": 1, + "ARCHIVED": 2, + } +) + +func (x UserNotification_Status) Enum() *UserNotification_Status { + p := new(UserNotification_Status) + *p = x + return p +} + +func (x UserNotification_Status) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (UserNotification_Status) Descriptor() protoreflect.EnumDescriptor { + return file_api_user_service_proto_enumTypes[2].Descriptor() +} + +func (UserNotification_Status) Type() protoreflect.EnumType { + return &file_api_user_service_proto_enumTypes[2] +} + +func (x UserNotification_Status) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use UserNotification_Status.Descriptor instead. +func (UserNotification_Status) EnumDescriptor() ([]byte, []int) { + return file_api_user_service_proto_rawDescGZIP(), []int{25, 0} +} + +// Type is the kind of event a notification reports. +type UserNotification_Type int32 + +const ( + UserNotification_TYPE_UNSPECIFIED UserNotification_Type = 0 + // Someone commented on a memo. + UserNotification_MEMO_COMMENT UserNotification_Type = 1 + // Someone mentioned the receiver in a memo. + UserNotification_MEMO_MENTION UserNotification_Type = 2 + // Someone invited the receiver to a space. + UserNotification_SPACE_INVITATION UserNotification_Type = 3 +) + +// Enum value maps for UserNotification_Type. +var ( + UserNotification_Type_name = map[int32]string{ + 0: "TYPE_UNSPECIFIED", + 1: "MEMO_COMMENT", + 2: "MEMO_MENTION", + 3: "SPACE_INVITATION", + } + UserNotification_Type_value = map[string]int32{ + "TYPE_UNSPECIFIED": 0, + "MEMO_COMMENT": 1, + "MEMO_MENTION": 2, + "SPACE_INVITATION": 3, + } +) + +func (x UserNotification_Type) Enum() *UserNotification_Type { + p := new(UserNotification_Type) + *p = x + return p +} + +func (x UserNotification_Type) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (UserNotification_Type) Descriptor() protoreflect.EnumDescriptor { + return file_api_user_service_proto_enumTypes[3].Descriptor() +} + +func (UserNotification_Type) Type() protoreflect.EnumType { + return &file_api_user_service_proto_enumTypes[3] +} + +func (x UserNotification_Type) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use UserNotification_Type.Descriptor instead. +func (UserNotification_Type) EnumDescriptor() ([]byte, []int) { + return file_api_user_service_proto_rawDescGZIP(), []int{25, 1} +} + +// InvitationState is the receiver's progress on the invitation. +type UserNotification_SpaceInvitationPayload_InvitationState int32 + +const ( + UserNotification_SpaceInvitationPayload_STATE_UNSPECIFIED UserNotification_SpaceInvitationPayload_InvitationState = 0 + // The receiver has not yet accepted or declined the invitation. + UserNotification_SpaceInvitationPayload_PENDING UserNotification_SpaceInvitationPayload_InvitationState = 1 + // The receiver accepted the invitation and is an active member. + UserNotification_SpaceInvitationPayload_ACCEPTED UserNotification_SpaceInvitationPayload_InvitationState = 2 +) + +// Enum value maps for UserNotification_SpaceInvitationPayload_InvitationState. +var ( + UserNotification_SpaceInvitationPayload_InvitationState_name = map[int32]string{ + 0: "STATE_UNSPECIFIED", + 1: "PENDING", + 2: "ACCEPTED", + } + UserNotification_SpaceInvitationPayload_InvitationState_value = map[string]int32{ + "STATE_UNSPECIFIED": 0, + "PENDING": 1, + "ACCEPTED": 2, + } +) + +func (x UserNotification_SpaceInvitationPayload_InvitationState) Enum() *UserNotification_SpaceInvitationPayload_InvitationState { + p := new(UserNotification_SpaceInvitationPayload_InvitationState) + *p = x + return p +} + +func (x UserNotification_SpaceInvitationPayload_InvitationState) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (UserNotification_SpaceInvitationPayload_InvitationState) Descriptor() protoreflect.EnumDescriptor { + return file_api_user_service_proto_enumTypes[4].Descriptor() +} + +func (UserNotification_SpaceInvitationPayload_InvitationState) Type() protoreflect.EnumType { + return &file_api_user_service_proto_enumTypes[4] +} + +func (x UserNotification_SpaceInvitationPayload_InvitationState) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use UserNotification_SpaceInvitationPayload_InvitationState.Descriptor instead. +func (UserNotification_SpaceInvitationPayload_InvitationState) EnumDescriptor() ([]byte, []int) { + return file_api_user_service_proto_rawDescGZIP(), []int{25, 2, 0} +} + +// ConflictPolicy says what the importer does with a memo whose UID the user +// already holds. type ImportMemosRequest_ConflictPolicy int32 const ( @@ -119,11 +336,11 @@ func (x ImportMemosRequest_ConflictPolicy) String() string { } func (ImportMemosRequest_ConflictPolicy) Descriptor() protoreflect.EnumDescriptor { - return file_api_v1_user_service_proto_enumTypes[1].Descriptor() + return file_api_user_service_proto_enumTypes[5].Descriptor() } func (ImportMemosRequest_ConflictPolicy) Type() protoreflect.EnumType { - return &file_api_v1_user_service_proto_enumTypes[1] + return &file_api_user_service_proto_enumTypes[5] } func (x ImportMemosRequest_ConflictPolicy) Number() protoreflect.EnumNumber { @@ -132,240 +349,35 @@ func (x ImportMemosRequest_ConflictPolicy) Number() protoreflect.EnumNumber { // Deprecated: Use ImportMemosRequest_ConflictPolicy.Descriptor instead. func (ImportMemosRequest_ConflictPolicy) EnumDescriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{11, 0} -} - -// Enumeration of user setting keys. -type UserSetting_Key int32 - -const ( - UserSetting_KEY_UNSPECIFIED UserSetting_Key = 0 - // GENERAL is the key for general user settings. - UserSetting_GENERAL UserSetting_Key = 1 - // WEBHOOKS is the key for user webhooks. - UserSetting_WEBHOOKS UserSetting_Key = 4 - // TAGS is the key for per-user tag metadata. - UserSetting_TAGS UserSetting_Key = 5 -) - -// Enum value maps for UserSetting_Key. -var ( - UserSetting_Key_name = map[int32]string{ - 0: "KEY_UNSPECIFIED", - 1: "GENERAL", - 4: "WEBHOOKS", - 5: "TAGS", - } - UserSetting_Key_value = map[string]int32{ - "KEY_UNSPECIFIED": 0, - "GENERAL": 1, - "WEBHOOKS": 4, - "TAGS": 5, - } -) - -func (x UserSetting_Key) Enum() *UserSetting_Key { - p := new(UserSetting_Key) - *p = x - return p -} - -func (x UserSetting_Key) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (UserSetting_Key) Descriptor() protoreflect.EnumDescriptor { - return file_api_v1_user_service_proto_enumTypes[2].Descriptor() -} - -func (UserSetting_Key) Type() protoreflect.EnumType { - return &file_api_v1_user_service_proto_enumTypes[2] -} - -func (x UserSetting_Key) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use UserSetting_Key.Descriptor instead. -func (UserSetting_Key) EnumDescriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{20, 0} -} - -type UserNotification_Status int32 - -const ( - UserNotification_STATUS_UNSPECIFIED UserNotification_Status = 0 - UserNotification_UNREAD UserNotification_Status = 1 - UserNotification_ARCHIVED UserNotification_Status = 2 -) - -// Enum value maps for UserNotification_Status. -var ( - UserNotification_Status_name = map[int32]string{ - 0: "STATUS_UNSPECIFIED", - 1: "UNREAD", - 2: "ARCHIVED", - } - UserNotification_Status_value = map[string]int32{ - "STATUS_UNSPECIFIED": 0, - "UNREAD": 1, - "ARCHIVED": 2, - } -) - -func (x UserNotification_Status) Enum() *UserNotification_Status { - p := new(UserNotification_Status) - *p = x - return p -} - -func (x UserNotification_Status) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (UserNotification_Status) Descriptor() protoreflect.EnumDescriptor { - return file_api_v1_user_service_proto_enumTypes[3].Descriptor() -} - -func (UserNotification_Status) Type() protoreflect.EnumType { - return &file_api_v1_user_service_proto_enumTypes[3] -} - -func (x UserNotification_Status) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use UserNotification_Status.Descriptor instead. -func (UserNotification_Status) EnumDescriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{52, 0} -} - -type UserNotification_Type int32 - -const ( - UserNotification_TYPE_UNSPECIFIED UserNotification_Type = 0 - UserNotification_MEMO_COMMENT UserNotification_Type = 1 - UserNotification_MEMO_MENTION UserNotification_Type = 2 - UserNotification_SPACE_INVITATION UserNotification_Type = 3 -) - -// Enum value maps for UserNotification_Type. -var ( - UserNotification_Type_name = map[int32]string{ - 0: "TYPE_UNSPECIFIED", - 1: "MEMO_COMMENT", - 2: "MEMO_MENTION", - 3: "SPACE_INVITATION", - } - UserNotification_Type_value = map[string]int32{ - "TYPE_UNSPECIFIED": 0, - "MEMO_COMMENT": 1, - "MEMO_MENTION": 2, - "SPACE_INVITATION": 3, - } -) - -func (x UserNotification_Type) Enum() *UserNotification_Type { - p := new(UserNotification_Type) - *p = x - return p -} - -func (x UserNotification_Type) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (UserNotification_Type) Descriptor() protoreflect.EnumDescriptor { - return file_api_v1_user_service_proto_enumTypes[4].Descriptor() -} - -func (UserNotification_Type) Type() protoreflect.EnumType { - return &file_api_v1_user_service_proto_enumTypes[4] -} - -func (x UserNotification_Type) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use UserNotification_Type.Descriptor instead. -func (UserNotification_Type) EnumDescriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{52, 1} -} - -type UserNotification_SpaceInvitationPayload_State int32 - -const ( - UserNotification_SpaceInvitationPayload_STATE_UNSPECIFIED UserNotification_SpaceInvitationPayload_State = 0 - // The receiver has not yet accepted or declined the invitation. - UserNotification_SpaceInvitationPayload_PENDING UserNotification_SpaceInvitationPayload_State = 1 - // The receiver accepted the invitation and is an active member. - UserNotification_SpaceInvitationPayload_ACCEPTED UserNotification_SpaceInvitationPayload_State = 2 -) - -// Enum value maps for UserNotification_SpaceInvitationPayload_State. -var ( - UserNotification_SpaceInvitationPayload_State_name = map[int32]string{ - 0: "STATE_UNSPECIFIED", - 1: "PENDING", - 2: "ACCEPTED", - } - UserNotification_SpaceInvitationPayload_State_value = map[string]int32{ - "STATE_UNSPECIFIED": 0, - "PENDING": 1, - "ACCEPTED": 2, - } -) - -func (x UserNotification_SpaceInvitationPayload_State) Enum() *UserNotification_SpaceInvitationPayload_State { - p := new(UserNotification_SpaceInvitationPayload_State) - *p = x - return p -} - -func (x UserNotification_SpaceInvitationPayload_State) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (UserNotification_SpaceInvitationPayload_State) Descriptor() protoreflect.EnumDescriptor { - return file_api_v1_user_service_proto_enumTypes[5].Descriptor() -} - -func (UserNotification_SpaceInvitationPayload_State) Type() protoreflect.EnumType { - return &file_api_v1_user_service_proto_enumTypes[5] -} - -func (x UserNotification_SpaceInvitationPayload_State) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use UserNotification_SpaceInvitationPayload_State.Descriptor instead. -func (UserNotification_SpaceInvitationPayload_State) EnumDescriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{52, 2, 0} + return file_api_user_service_proto_rawDescGZIP(), []int{51, 0} } +// User is an account on the instance. type User struct { state protoimpl.MessageState `protogen:"open.v1"` - // The resource name of the user. + // Identifier. The resource name of the user. {user} is the username. // Format: users/{user} Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // The role of the user. - Role User_Role `protobuf:"varint,2,opt,name=role,proto3,enum=memos.api.v1.User_Role" json:"role,omitempty"` - // Required. The unique username for login. - Username string `protobuf:"bytes,3,opt,name=username,proto3" json:"username,omitempty"` + // Required. The unique username, used to sign in. + Username string `protobuf:"bytes,2,opt,name=username,proto3" json:"username,omitempty"` + // Optional. The display name of the user. + DisplayName string `protobuf:"bytes,3,opt,name=display_name,json=displayName,proto3" json:"display_name,omitempty"` // Optional. The email address of the user. Stored trimmed and lowercased; // empty means no address. An address belongs to at most one user on the // instance, so writes that would reuse one fail with ALREADY_EXISTS. + // Returned only to the user and to admins. Email string `protobuf:"bytes,4,opt,name=email,proto3" json:"email,omitempty"` - // Optional. The display name of the user. - DisplayName string `protobuf:"bytes,5,opt,name=display_name,json=displayName,proto3" json:"display_name,omitempty"` - // Optional. The avatar URL of the user. - AvatarUrl string `protobuf:"bytes,6,opt,name=avatar_url,json=avatarUrl,proto3" json:"avatar_url,omitempty"` + // Optional. The avatar URL of the user. An avatar set as a data URI (PNG, + // JPEG, GIF or WebP, at most 2 MiB) is returned as a file server URL. + AvatarUrl string `protobuf:"bytes,5,opt,name=avatar_url,json=avatarUrl,proto3" json:"avatar_url,omitempty"` // Optional. The description of the user. - Description string `protobuf:"bytes,7,opt,name=description,proto3" json:"description,omitempty"` - // Input only. The password for the user. - Password string `protobuf:"bytes,8,opt,name=password,proto3" json:"password,omitempty"` - // The state of the user. - State State `protobuf:"varint,9,opt,name=state,proto3,enum=memos.api.v1.State" json:"state,omitempty"` + Description string `protobuf:"bytes,6,opt,name=description,proto3" json:"description,omitempty"` + // Input only. The password of the user. Never returned. + Password string `protobuf:"bytes,7,opt,name=password,proto3" json:"password,omitempty"` + // Required. The role of the user. Only admins can change it. + Role User_Role `protobuf:"varint,8,opt,name=role,proto3,enum=memos.api.User_Role" json:"role,omitempty"` + // Required. The state of the user. Only admins can change it. + State State `protobuf:"varint,9,opt,name=state,proto3,enum=memos.api.State" json:"state,omitempty"` // Output only. The creation timestamp. CreateTime *timestamppb.Timestamp `protobuf:"bytes,10,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty"` // Output only. The last update timestamp. @@ -376,7 +388,7 @@ type User struct { func (x *User) Reset() { *x = User{} - mi := &file_api_v1_user_service_proto_msgTypes[0] + mi := &file_api_user_service_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -388,7 +400,7 @@ func (x *User) String() string { func (*User) ProtoMessage() {} func (x *User) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[0] + mi := &file_api_user_service_proto_msgTypes[0] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -401,7 +413,7 @@ func (x *User) ProtoReflect() protoreflect.Message { // Deprecated: Use User.ProtoReflect.Descriptor instead. func (*User) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{0} + return file_api_user_service_proto_rawDescGZIP(), []int{0} } func (x *User) GetName() string { @@ -411,13 +423,6 @@ func (x *User) GetName() string { return "" } -func (x *User) GetRole() User_Role { - if x != nil { - return x.Role - } - return User_ROLE_UNSPECIFIED -} - func (x *User) GetUsername() string { if x != nil { return x.Username @@ -425,16 +430,16 @@ func (x *User) GetUsername() string { return "" } -func (x *User) GetEmail() string { +func (x *User) GetDisplayName() string { if x != nil { - return x.Email + return x.DisplayName } return "" } -func (x *User) GetDisplayName() string { +func (x *User) GetEmail() string { if x != nil { - return x.DisplayName + return x.Email } return "" } @@ -460,6 +465,13 @@ func (x *User) GetPassword() string { return "" } +func (x *User) GetRole() User_Role { + if x != nil { + return x.Role + } + return User_ROLE_UNSPECIFIED +} + func (x *User) GetState() State { if x != nil { return x.State @@ -481,22 +493,21 @@ func (x *User) GetUpdateTime() *timestamppb.Timestamp { return nil } +// Request message for UserService.ListUsers. type ListUsersRequest struct { state protoimpl.MessageState `protogen:"open.v1"` - // Optional. The maximum number of users to return. - // The service may return fewer than this value. - // If unspecified, at most 50 users will be returned. - // The maximum value is 1000; values above 1000 will be coerced to 1000. + // Optional. The maximum number of users to return. The service may return + // fewer. If unspecified, at most 50 users are returned. The maximum value is + // 1000; values above 1000 are coerced to 1000. PageSize int32 `protobuf:"varint,1,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` - // Optional. A page token, received from a previous `ListUsers` call. - // Provide this to retrieve the subsequent page. + // Optional. A page token from a previous call. Provide it to retrieve the + // next page. PageToken string `protobuf:"bytes,2,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` - // Optional. Filter to apply to the list results. + // Optional. A CEL filter on the users. Only `username == ''` is + // supported. // Example: "username == 'steven'" - // Supported operators: == - // Supported fields: username Filter string `protobuf:"bytes,3,opt,name=filter,proto3" json:"filter,omitempty"` - // Optional. If true, show deleted users in the response. + // Optional. Currently ignored; the list includes users in every state. ShowDeleted bool `protobuf:"varint,4,opt,name=show_deleted,json=showDeleted,proto3" json:"show_deleted,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache @@ -504,7 +515,7 @@ type ListUsersRequest struct { func (x *ListUsersRequest) Reset() { *x = ListUsersRequest{} - mi := &file_api_v1_user_service_proto_msgTypes[1] + mi := &file_api_user_service_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -516,7 +527,7 @@ func (x *ListUsersRequest) String() string { func (*ListUsersRequest) ProtoMessage() {} func (x *ListUsersRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[1] + mi := &file_api_user_service_proto_msgTypes[1] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -529,7 +540,7 @@ func (x *ListUsersRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ListUsersRequest.ProtoReflect.Descriptor instead. func (*ListUsersRequest) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{1} + return file_api_user_service_proto_rawDescGZIP(), []int{1} } func (x *ListUsersRequest) GetPageSize() int32 { @@ -560,12 +571,12 @@ func (x *ListUsersRequest) GetShowDeleted() bool { return false } +// Response message for UserService.ListUsers. type ListUsersResponse struct { state protoimpl.MessageState `protogen:"open.v1"` - // The list of users. + // The users. Users []*User `protobuf:"bytes,1,rep,name=users,proto3" json:"users,omitempty"` - // A token that can be sent as `page_token` to retrieve the next page. - // If this field is omitted, there are no subsequent pages. + // A token to retrieve the next page. Empty when there are no more pages. NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache @@ -573,7 +584,7 @@ type ListUsersResponse struct { func (x *ListUsersResponse) Reset() { *x = ListUsersResponse{} - mi := &file_api_v1_user_service_proto_msgTypes[2] + mi := &file_api_user_service_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -585,7 +596,7 @@ func (x *ListUsersResponse) String() string { func (*ListUsersResponse) ProtoMessage() {} func (x *ListUsersResponse) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[2] + mi := &file_api_user_service_proto_msgTypes[2] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -598,7 +609,7 @@ func (x *ListUsersResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use ListUsersResponse.ProtoReflect.Descriptor instead. func (*ListUsersResponse) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{2} + return file_api_user_service_proto_rawDescGZIP(), []int{2} } func (x *ListUsersResponse) GetUsers() []*User { @@ -615,101 +626,13 @@ func (x *ListUsersResponse) GetNextPageToken() string { return "" } -type BatchGetUsersRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - Usernames []string `protobuf:"bytes,1,rep,name=usernames,proto3" json:"usernames,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *BatchGetUsersRequest) Reset() { - *x = BatchGetUsersRequest{} - mi := &file_api_v1_user_service_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *BatchGetUsersRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*BatchGetUsersRequest) ProtoMessage() {} - -func (x *BatchGetUsersRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[3] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use BatchGetUsersRequest.ProtoReflect.Descriptor instead. -func (*BatchGetUsersRequest) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{3} -} - -func (x *BatchGetUsersRequest) GetUsernames() []string { - if x != nil { - return x.Usernames - } - return nil -} - -type BatchGetUsersResponse struct { - state protoimpl.MessageState `protogen:"open.v1"` - Users []*User `protobuf:"bytes,1,rep,name=users,proto3" json:"users,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *BatchGetUsersResponse) Reset() { - *x = BatchGetUsersResponse{} - mi := &file_api_v1_user_service_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *BatchGetUsersResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*BatchGetUsersResponse) ProtoMessage() {} - -func (x *BatchGetUsersResponse) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[4] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use BatchGetUsersResponse.ProtoReflect.Descriptor instead. -func (*BatchGetUsersResponse) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{4} -} - -func (x *BatchGetUsersResponse) GetUsers() []*User { - if x != nil { - return x.Users - } - return nil -} - +// Request message for UserService.GetUser. type GetUserRequest struct { state protoimpl.MessageState `protogen:"open.v1"` // Required. The resource name of the user. // Format: users/{user} Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Optional. The fields to return in the response. - // If not specified, all fields are returned. + // Optional. Currently ignored; all fields are returned. ReadMask *fieldmaskpb.FieldMask `protobuf:"bytes,2,opt,name=read_mask,json=readMask,proto3" json:"read_mask,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache @@ -717,7 +640,7 @@ type GetUserRequest struct { func (x *GetUserRequest) Reset() { *x = GetUserRequest{} - mi := &file_api_v1_user_service_proto_msgTypes[5] + mi := &file_api_user_service_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -729,7 +652,7 @@ func (x *GetUserRequest) String() string { func (*GetUserRequest) ProtoMessage() {} func (x *GetUserRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[5] + mi := &file_api_user_service_proto_msgTypes[3] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -742,7 +665,7 @@ func (x *GetUserRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetUserRequest.ProtoReflect.Descriptor instead. func (*GetUserRequest) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{5} + return file_api_user_service_proto_rawDescGZIP(), []int{3} } func (x *GetUserRequest) GetName() string { @@ -759,18 +682,113 @@ func (x *GetUserRequest) GetReadMask() *fieldmaskpb.FieldMask { return nil } +// Request message for UserService.BatchGetUsers. +type BatchGetUsersRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Required. The resource names of the users to get. Empty and duplicate + // entries are ignored. At most 100 non-empty names are allowed. + // Format: users/{user} + Names []string `protobuf:"bytes,1,rep,name=names,proto3" json:"names,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *BatchGetUsersRequest) Reset() { + *x = BatchGetUsersRequest{} + mi := &file_api_user_service_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *BatchGetUsersRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BatchGetUsersRequest) ProtoMessage() {} + +func (x *BatchGetUsersRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_user_service_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BatchGetUsersRequest.ProtoReflect.Descriptor instead. +func (*BatchGetUsersRequest) Descriptor() ([]byte, []int) { + return file_api_user_service_proto_rawDescGZIP(), []int{4} +} + +func (x *BatchGetUsersRequest) GetNames() []string { + if x != nil { + return x.Names + } + return nil +} + +// Response message for UserService.BatchGetUsers. +type BatchGetUsersResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The active users that match the requested names. + Users []*User `protobuf:"bytes,1,rep,name=users,proto3" json:"users,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *BatchGetUsersResponse) Reset() { + *x = BatchGetUsersResponse{} + mi := &file_api_user_service_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *BatchGetUsersResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BatchGetUsersResponse) ProtoMessage() {} + +func (x *BatchGetUsersResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_user_service_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BatchGetUsersResponse.ProtoReflect.Descriptor instead. +func (*BatchGetUsersResponse) Descriptor() ([]byte, []int) { + return file_api_user_service_proto_rawDescGZIP(), []int{5} +} + +func (x *BatchGetUsersResponse) GetUsers() []*User { + if x != nil { + return x.Users + } + return nil +} + +// Request message for UserService.CreateUser. type CreateUserRequest struct { state protoimpl.MessageState `protogen:"open.v1"` - // Required. The user to create. + // Required. The user to create. username and password are required; role + // is honored only when an admin calls the method. User *User `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` // Optional. The resource ID to use for this user. If set, it must equal // user.username and follow the username format. // Format: ^[a-zA-Z0-9]([a-zA-Z0-9-]{0,34}[a-zA-Z0-9])?$ UserId string `protobuf:"bytes,2,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` - // Optional. If set, validate the request but don't actually create the user. + // Optional. If set, validate the request but do not create the user. ValidateOnly bool `protobuf:"varint,3,opt,name=validate_only,json=validateOnly,proto3" json:"validate_only,omitempty"` - // Optional. An idempotency token that can be used to ensure that multiple - // requests to create a user have the same result. + // Optional. An idempotency token. Currently ignored. RequestId string `protobuf:"bytes,4,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache @@ -778,7 +796,7 @@ type CreateUserRequest struct { func (x *CreateUserRequest) Reset() { *x = CreateUserRequest{} - mi := &file_api_v1_user_service_proto_msgTypes[6] + mi := &file_api_user_service_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -790,7 +808,7 @@ func (x *CreateUserRequest) String() string { func (*CreateUserRequest) ProtoMessage() {} func (x *CreateUserRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[6] + mi := &file_api_user_service_proto_msgTypes[6] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -803,7 +821,7 @@ func (x *CreateUserRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use CreateUserRequest.ProtoReflect.Descriptor instead. func (*CreateUserRequest) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{6} + return file_api_user_service_proto_rawDescGZIP(), []int{6} } func (x *CreateUserRequest) GetUser() *User { @@ -834,13 +852,16 @@ func (x *CreateUserRequest) GetRequestId() string { return "" } +// Request message for UserService.UpdateUser. type UpdateUserRequest struct { state protoimpl.MessageState `protogen:"open.v1"` - // Required. The user to update. + // Required. The user to update. Its name identifies the user. User *User `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` - // Required. The list of fields to update. + // Required. The fields to update. Supported paths: username, display_name, + // email, avatar_url, description, password, role, state. role and state + // require an admin. UpdateMask *fieldmaskpb.FieldMask `protobuf:"bytes,2,opt,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"` - // Optional. If set to true, allows updating sensitive fields. + // Optional. Currently ignored; updating a missing user fails with NOT_FOUND. AllowMissing bool `protobuf:"varint,3,opt,name=allow_missing,json=allowMissing,proto3" json:"allow_missing,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache @@ -848,7 +869,7 @@ type UpdateUserRequest struct { func (x *UpdateUserRequest) Reset() { *x = UpdateUserRequest{} - mi := &file_api_v1_user_service_proto_msgTypes[7] + mi := &file_api_user_service_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -860,7 +881,7 @@ func (x *UpdateUserRequest) String() string { func (*UpdateUserRequest) ProtoMessage() {} func (x *UpdateUserRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[7] + mi := &file_api_user_service_proto_msgTypes[7] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -873,7 +894,7 @@ func (x *UpdateUserRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use UpdateUserRequest.ProtoReflect.Descriptor instead. func (*UpdateUserRequest) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{7} + return file_api_user_service_proto_rawDescGZIP(), []int{7} } func (x *UpdateUserRequest) GetUser() *User { @@ -897,12 +918,14 @@ func (x *UpdateUserRequest) GetAllowMissing() bool { return false } +// Request message for UserService.DeleteUser. type DeleteUserRequest struct { state protoimpl.MessageState `protogen:"open.v1"` // Required. The resource name of the user to delete. // Format: users/{user} Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Optional. If set to true, the user will be deleted even if they have associated data. + // Optional. Currently ignored; deleting a user who belongs to any space + // fails with FAILED_PRECONDITION. Force bool `protobuf:"varint,2,opt,name=force,proto3" json:"force,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache @@ -910,7 +933,7 @@ type DeleteUserRequest struct { func (x *DeleteUserRequest) Reset() { *x = DeleteUserRequest{} - mi := &file_api_v1_user_service_proto_msgTypes[8] + mi := &file_api_user_service_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -922,7 +945,7 @@ func (x *DeleteUserRequest) String() string { func (*DeleteUserRequest) ProtoMessage() {} func (x *DeleteUserRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[8] + mi := &file_api_user_service_proto_msgTypes[8] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -935,7 +958,7 @@ func (x *DeleteUserRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use DeleteUserRequest.ProtoReflect.Descriptor instead. func (*DeleteUserRequest) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{8} + return file_api_user_service_proto_rawDescGZIP(), []int{8} } func (x *DeleteUserRequest) GetName() string { @@ -952,38 +975,380 @@ func (x *DeleteUserRequest) GetForce() bool { return false } -// User statistics messages +// UserSetting is one group of a user's preferences, identified by its key. +type UserSetting struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Identifier. The resource name of the user setting. {setting} is the + // setting key, such as GENERAL. + // Format: users/{user}/settings/{setting} + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // The setting value. The set field matches the setting key. + // + // Types that are valid to be assigned to Value: + // + // *UserSetting_GeneralSetting_ + // *UserSetting_WebhooksSetting_ + // *UserSetting_TagsSetting_ + Value isUserSetting_Value `protobuf_oneof:"value"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UserSetting) Reset() { + *x = UserSetting{} + mi := &file_api_user_service_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UserSetting) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserSetting) ProtoMessage() {} + +func (x *UserSetting) ProtoReflect() protoreflect.Message { + mi := &file_api_user_service_proto_msgTypes[9] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UserSetting.ProtoReflect.Descriptor instead. +func (*UserSetting) Descriptor() ([]byte, []int) { + return file_api_user_service_proto_rawDescGZIP(), []int{9} +} + +func (x *UserSetting) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *UserSetting) GetValue() isUserSetting_Value { + if x != nil { + return x.Value + } + return nil +} + +func (x *UserSetting) GetGeneralSetting() *UserSetting_GeneralSetting { + if x != nil { + if x, ok := x.Value.(*UserSetting_GeneralSetting_); ok { + return x.GeneralSetting + } + } + return nil +} + +func (x *UserSetting) GetWebhooksSetting() *UserSetting_WebhooksSetting { + if x != nil { + if x, ok := x.Value.(*UserSetting_WebhooksSetting_); ok { + return x.WebhooksSetting + } + } + return nil +} + +func (x *UserSetting) GetTagsSetting() *UserSetting_TagsSetting { + if x != nil { + if x, ok := x.Value.(*UserSetting_TagsSetting_); ok { + return x.TagsSetting + } + } + return nil +} + +type isUserSetting_Value interface { + isUserSetting_Value() +} + +type UserSetting_GeneralSetting_ struct { + // The value of the GENERAL setting. + GeneralSetting *UserSetting_GeneralSetting `protobuf:"bytes,2,opt,name=general_setting,json=generalSetting,proto3,oneof"` +} + +type UserSetting_WebhooksSetting_ struct { + // The value of the WEBHOOKS setting. + WebhooksSetting *UserSetting_WebhooksSetting `protobuf:"bytes,3,opt,name=webhooks_setting,json=webhooksSetting,proto3,oneof"` +} + +type UserSetting_TagsSetting_ struct { + // The value of the TAGS setting. + TagsSetting *UserSetting_TagsSetting `protobuf:"bytes,4,opt,name=tags_setting,json=tagsSetting,proto3,oneof"` +} + +func (*UserSetting_GeneralSetting_) isUserSetting_Value() {} + +func (*UserSetting_WebhooksSetting_) isUserSetting_Value() {} + +func (*UserSetting_TagsSetting_) isUserSetting_Value() {} + +// Request message for UserService.ListUserSettings. +type ListUserSettingsRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Required. The user whose settings are listed. + // Format: users/{user} + Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"` + // Optional. The maximum number of settings to return. The service may return + // fewer. Currently ignored; all settings are returned in one page. + PageSize int32 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + // Optional. A page token from a previous call. Provide it to retrieve the + // next page. + PageToken string `protobuf:"bytes,3,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListUserSettingsRequest) Reset() { + *x = ListUserSettingsRequest{} + mi := &file_api_user_service_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListUserSettingsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListUserSettingsRequest) ProtoMessage() {} + +func (x *ListUserSettingsRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_user_service_proto_msgTypes[10] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListUserSettingsRequest.ProtoReflect.Descriptor instead. +func (*ListUserSettingsRequest) Descriptor() ([]byte, []int) { + return file_api_user_service_proto_rawDescGZIP(), []int{10} +} + +func (x *ListUserSettingsRequest) GetParent() string { + if x != nil { + return x.Parent + } + return "" +} + +func (x *ListUserSettingsRequest) GetPageSize() int32 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *ListUserSettingsRequest) GetPageToken() string { + if x != nil { + return x.PageToken + } + return "" +} + +// Response message for UserService.ListUserSettings. +type ListUserSettingsResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The user settings. + UserSettings []*UserSetting `protobuf:"bytes,1,rep,name=user_settings,json=userSettings,proto3" json:"user_settings,omitempty"` + // A token to retrieve the next page. Empty when there are no more pages. + NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListUserSettingsResponse) Reset() { + *x = ListUserSettingsResponse{} + mi := &file_api_user_service_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListUserSettingsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListUserSettingsResponse) ProtoMessage() {} + +func (x *ListUserSettingsResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_user_service_proto_msgTypes[11] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListUserSettingsResponse.ProtoReflect.Descriptor instead. +func (*ListUserSettingsResponse) Descriptor() ([]byte, []int) { + return file_api_user_service_proto_rawDescGZIP(), []int{11} +} + +func (x *ListUserSettingsResponse) GetUserSettings() []*UserSetting { + if x != nil { + return x.UserSettings + } + return nil +} + +func (x *ListUserSettingsResponse) GetNextPageToken() string { + if x != nil { + return x.NextPageToken + } + return "" +} + +// Request message for UserService.GetUserSetting. +type GetUserSettingRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Required. The resource name of the user setting. + // Format: users/{user}/settings/{setting} + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetUserSettingRequest) Reset() { + *x = GetUserSettingRequest{} + mi := &file_api_user_service_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetUserSettingRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetUserSettingRequest) ProtoMessage() {} + +func (x *GetUserSettingRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_user_service_proto_msgTypes[12] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetUserSettingRequest.ProtoReflect.Descriptor instead. +func (*GetUserSettingRequest) Descriptor() ([]byte, []int) { + return file_api_user_service_proto_rawDescGZIP(), []int{12} +} + +func (x *GetUserSettingRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +// Request message for UserService.UpdateUserSetting. +type UpdateUserSettingRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Required. The user setting to update. Its name identifies the setting. + UserSetting *UserSetting `protobuf:"bytes,1,opt,name=user_setting,json=userSetting,proto3" json:"user_setting,omitempty"` + // Required. The fields to update, relative to the setting value. GENERAL + // supports locale, memo_visibility, theme and save_media_metadata; TAGS + // supports tags. + UpdateMask *fieldmaskpb.FieldMask `protobuf:"bytes,2,opt,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UpdateUserSettingRequest) Reset() { + *x = UpdateUserSettingRequest{} + mi := &file_api_user_service_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UpdateUserSettingRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateUserSettingRequest) ProtoMessage() {} + +func (x *UpdateUserSettingRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_user_service_proto_msgTypes[13] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateUserSettingRequest.ProtoReflect.Descriptor instead. +func (*UpdateUserSettingRequest) Descriptor() ([]byte, []int) { + return file_api_user_service_proto_rawDescGZIP(), []int{13} +} + +func (x *UpdateUserSettingRequest) GetUserSetting() *UserSetting { + if x != nil { + return x.UserSetting + } + return nil +} + +func (x *UpdateUserSettingRequest) GetUpdateMask() *fieldmaskpb.FieldMask { + if x != nil { + return x.UpdateMask + } + return nil +} + +// UserStats is a summary of a user's memos. Comments are not counted. type UserStats struct { state protoimpl.MessageState `protogen:"open.v1"` - // The resource name of the user statistics singleton. + // Identifier. The resource name of the user statistics singleton. // Format: users/{user}/stats Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // The stats of memo types. + // The number of counted memos. + TotalMemoCount int32 `protobuf:"varint,2,opt,name=total_memo_count,json=totalMemoCount,proto3" json:"total_memo_count,omitempty"` + // The number of counted memos by content type. MemoTypeStats *UserStats_MemoTypeStats `protobuf:"bytes,3,opt,name=memo_type_stats,json=memoTypeStats,proto3" json:"memo_type_stats,omitempty"` - // The count of tags. - TagCount map[string]int32 `protobuf:"bytes,4,rep,name=tag_count,json=tagCount,proto3" json:"tag_count,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"varint,2,opt,name=value"` - // The creation timestamps of the user's memos. - MemoCreatedTimestamps []*timestamppb.Timestamp `protobuf:"bytes,7,rep,name=memo_created_timestamps,json=memoCreatedTimestamps,proto3" json:"memo_created_timestamps,omitempty"` - // The latest update timestamps of the user's memos (one per memo, - // mirrors memo_created_timestamps). Used by the activity heatmap when - // the client's view is set to update_time basis. - MemoUpdatedTimestamps []*timestamppb.Timestamp `protobuf:"bytes,8,rep,name=memo_updated_timestamps,json=memoUpdatedTimestamps,proto3" json:"memo_updated_timestamps,omitempty"` - // The pinned memos of the user. + // The number of counted memos per tag. + TagCounts map[string]int32 `protobuf:"bytes,4,rep,name=tag_counts,json=tagCounts,proto3" json:"tag_counts,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"varint,2,opt,name=value"` + // The pinned memos among the counted memos. + // Format: memos/{memo} PinnedMemos []string `protobuf:"bytes,5,rep,name=pinned_memos,json=pinnedMemos,proto3" json:"pinned_memos,omitempty"` - // Total memo count. - TotalMemoCount int32 `protobuf:"varint,6,opt,name=total_memo_count,json=totalMemoCount,proto3" json:"total_memo_count,omitempty"` - // Total persisted attachment size in bytes, including unlinked uploads and - // attachments in all spaces. Excludes temporary uploads and derived files. - // Returned only by GetUserStats for the authenticated user's own stats, - // independently of the request's memo filter. - AttachmentStorageBytes *int64 `protobuf:"varint,9,opt,name=attachment_storage_bytes,json=attachmentStorageBytes,proto3,oneof" json:"attachment_storage_bytes,omitempty"` + // The creation timestamps of the counted memos, one per memo. + MemoCreatedTimestamps []*timestamppb.Timestamp `protobuf:"bytes,6,rep,name=memo_created_timestamps,json=memoCreatedTimestamps,proto3" json:"memo_created_timestamps,omitempty"` + // The latest update timestamps of the counted memos (one per memo, mirrors + // memo_created_timestamps). Used by the activity heatmap when the client's + // view is set to update_time basis. + MemoUpdatedTimestamps []*timestamppb.Timestamp `protobuf:"bytes,7,rep,name=memo_updated_timestamps,json=memoUpdatedTimestamps,proto3" json:"memo_updated_timestamps,omitempty"` + // Output only. Total persisted attachment size in bytes, including unlinked + // uploads and attachments in all spaces. Excludes temporary uploads and + // derived files. Returned only by GetUserStats for the authenticated user's + // own stats, independently of the request's memo filter. + AttachmentStorageBytes *int64 `protobuf:"varint,8,opt,name=attachment_storage_bytes,json=attachmentStorageBytes,proto3,oneof" json:"attachment_storage_bytes,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } func (x *UserStats) Reset() { *x = UserStats{} - mi := &file_api_v1_user_service_proto_msgTypes[9] + mi := &file_api_user_service_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -995,7 +1360,7 @@ func (x *UserStats) String() string { func (*UserStats) ProtoMessage() {} func (x *UserStats) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[9] + mi := &file_api_user_service_proto_msgTypes[14] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1008,7 +1373,7 @@ func (x *UserStats) ProtoReflect() protoreflect.Message { // Deprecated: Use UserStats.ProtoReflect.Descriptor instead. func (*UserStats) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{9} + return file_api_user_service_proto_rawDescGZIP(), []int{14} } func (x *UserStats) GetName() string { @@ -1018,6 +1383,13 @@ func (x *UserStats) GetName() string { return "" } +func (x *UserStats) GetTotalMemoCount() int32 { + if x != nil { + return x.TotalMemoCount + } + return 0 +} + func (x *UserStats) GetMemoTypeStats() *UserStats_MemoTypeStats { if x != nil { return x.MemoTypeStats @@ -1025,9 +1397,16 @@ func (x *UserStats) GetMemoTypeStats() *UserStats_MemoTypeStats { return nil } -func (x *UserStats) GetTagCount() map[string]int32 { +func (x *UserStats) GetTagCounts() map[string]int32 { if x != nil { - return x.TagCount + return x.TagCounts + } + return nil +} + +func (x *UserStats) GetPinnedMemos() []string { + if x != nil { + return x.PinnedMemos } return nil } @@ -1046,20 +1425,6 @@ func (x *UserStats) GetMemoUpdatedTimestamps() []*timestamppb.Timestamp { return nil } -func (x *UserStats) GetPinnedMemos() []string { - if x != nil { - return x.PinnedMemos - } - return nil -} - -func (x *UserStats) GetTotalMemoCount() int32 { - if x != nil { - return x.TotalMemoCount - } - return 0 -} - func (x *UserStats) GetAttachmentStorageBytes() int64 { if x != nil && x.AttachmentStorageBytes != nil { return *x.AttachmentStorageBytes @@ -1067,6 +1432,2119 @@ func (x *UserStats) GetAttachmentStorageBytes() int64 { return 0 } +// Request message for UserService.ListUserStats. +type ListUserStatsRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Required. The users to list statistics for: users/- for all users, or + // users/{user} for one user. + // Format: users/{user} + Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"` + // Optional. A CEL expression selecting the memos to count. Uses the same + // filter syntax as ListMemos. + Filter string `protobuf:"bytes,2,opt,name=filter,proto3" json:"filter,omitempty"` + // Optional. The state of the memos to count. Defaults to NORMAL. ARCHIVED + // counts only the caller's own memos. + State State `protobuf:"varint,3,opt,name=state,proto3,enum=memos.api.State" json:"state,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListUserStatsRequest) Reset() { + *x = ListUserStatsRequest{} + mi := &file_api_user_service_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListUserStatsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListUserStatsRequest) ProtoMessage() {} + +func (x *ListUserStatsRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_user_service_proto_msgTypes[15] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListUserStatsRequest.ProtoReflect.Descriptor instead. +func (*ListUserStatsRequest) Descriptor() ([]byte, []int) { + return file_api_user_service_proto_rawDescGZIP(), []int{15} +} + +func (x *ListUserStatsRequest) GetParent() string { + if x != nil { + return x.Parent + } + return "" +} + +func (x *ListUserStatsRequest) GetFilter() string { + if x != nil { + return x.Filter + } + return "" +} + +func (x *ListUserStatsRequest) GetState() State { + if x != nil { + return x.State + } + return State_STATE_UNSPECIFIED +} + +// Response message for UserService.ListUserStats. +type ListUserStatsResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The statistics, one entry per user. + UserStats []*UserStats `protobuf:"bytes,1,rep,name=user_stats,json=userStats,proto3" json:"user_stats,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListUserStatsResponse) Reset() { + *x = ListUserStatsResponse{} + mi := &file_api_user_service_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListUserStatsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListUserStatsResponse) ProtoMessage() {} + +func (x *ListUserStatsResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_user_service_proto_msgTypes[16] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListUserStatsResponse.ProtoReflect.Descriptor instead. +func (*ListUserStatsResponse) Descriptor() ([]byte, []int) { + return file_api_user_service_proto_rawDescGZIP(), []int{16} +} + +func (x *ListUserStatsResponse) GetUserStats() []*UserStats { + if x != nil { + return x.UserStats + } + return nil +} + +// Request message for UserService.GetUserStats. +type GetUserStatsRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Required. The resource name of the user. + // Format: users/{user} + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // Optional. A CEL expression selecting the readable non-comment memos to + // count. Supports the same fields as ListMemos, including `space`. + Filter string `protobuf:"bytes,2,opt,name=filter,proto3" json:"filter,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetUserStatsRequest) Reset() { + *x = GetUserStatsRequest{} + mi := &file_api_user_service_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetUserStatsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetUserStatsRequest) ProtoMessage() {} + +func (x *GetUserStatsRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_user_service_proto_msgTypes[17] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetUserStatsRequest.ProtoReflect.Descriptor instead. +func (*GetUserStatsRequest) Descriptor() ([]byte, []int) { + return file_api_user_service_proto_rawDescGZIP(), []int{17} +} + +func (x *GetUserStatsRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *GetUserStatsRequest) GetFilter() string { + if x != nil { + return x.Filter + } + return "" +} + +// MemoView is a user's saved memo filter. +type MemoView struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Identifier. The resource name of the memo view. + // Format: users/{user}/views/{view} + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // Required. The title of the memo view. + Title string `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"` + // Required. The CEL filter expression for the memo view, using the same + // grammar as the ListMemos `filter` argument. Reuse it by passing this value + // to ListMemos. + Filter string `protobuf:"bytes,3,opt,name=filter,proto3" json:"filter,omitempty"` + // Optional. Display icon. Omit when updating with the "icon" mask to reset to + // the default view icon. + Icon *MemoView_Icon `protobuf:"bytes,4,opt,name=icon,proto3" json:"icon,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *MemoView) Reset() { + *x = MemoView{} + mi := &file_api_user_service_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *MemoView) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MemoView) ProtoMessage() {} + +func (x *MemoView) ProtoReflect() protoreflect.Message { + mi := &file_api_user_service_proto_msgTypes[18] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MemoView.ProtoReflect.Descriptor instead. +func (*MemoView) Descriptor() ([]byte, []int) { + return file_api_user_service_proto_rawDescGZIP(), []int{18} +} + +func (x *MemoView) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *MemoView) GetTitle() string { + if x != nil { + return x.Title + } + return "" +} + +func (x *MemoView) GetFilter() string { + if x != nil { + return x.Filter + } + return "" +} + +func (x *MemoView) GetIcon() *MemoView_Icon { + if x != nil { + return x.Icon + } + return nil +} + +// Request message for UserService.ListMemoViews. +type ListMemoViewsRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Required. The user whose memo views are listed. + // Format: users/{user} + Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListMemoViewsRequest) Reset() { + *x = ListMemoViewsRequest{} + mi := &file_api_user_service_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListMemoViewsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListMemoViewsRequest) ProtoMessage() {} + +func (x *ListMemoViewsRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_user_service_proto_msgTypes[19] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListMemoViewsRequest.ProtoReflect.Descriptor instead. +func (*ListMemoViewsRequest) Descriptor() ([]byte, []int) { + return file_api_user_service_proto_rawDescGZIP(), []int{19} +} + +func (x *ListMemoViewsRequest) GetParent() string { + if x != nil { + return x.Parent + } + return "" +} + +// Response message for UserService.ListMemoViews. +type ListMemoViewsResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The memo views. + MemoViews []*MemoView `protobuf:"bytes,1,rep,name=memo_views,json=memoViews,proto3" json:"memo_views,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListMemoViewsResponse) Reset() { + *x = ListMemoViewsResponse{} + mi := &file_api_user_service_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListMemoViewsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListMemoViewsResponse) ProtoMessage() {} + +func (x *ListMemoViewsResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_user_service_proto_msgTypes[20] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListMemoViewsResponse.ProtoReflect.Descriptor instead. +func (*ListMemoViewsResponse) Descriptor() ([]byte, []int) { + return file_api_user_service_proto_rawDescGZIP(), []int{20} +} + +func (x *ListMemoViewsResponse) GetMemoViews() []*MemoView { + if x != nil { + return x.MemoViews + } + return nil +} + +// Request message for UserService.GetMemoView. +type GetMemoViewRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Required. The resource name of the memo view. + // Format: users/{user}/views/{view} + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetMemoViewRequest) Reset() { + *x = GetMemoViewRequest{} + mi := &file_api_user_service_proto_msgTypes[21] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetMemoViewRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetMemoViewRequest) ProtoMessage() {} + +func (x *GetMemoViewRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_user_service_proto_msgTypes[21] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetMemoViewRequest.ProtoReflect.Descriptor instead. +func (*GetMemoViewRequest) Descriptor() ([]byte, []int) { + return file_api_user_service_proto_rawDescGZIP(), []int{21} +} + +func (x *GetMemoViewRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +// Request message for UserService.CreateMemoView. +type CreateMemoViewRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Required. The user who owns the memo view. + // Format: users/{user} + Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"` + // Required. The memo view to create. + MemoView *MemoView `protobuf:"bytes,2,opt,name=memo_view,json=memoView,proto3" json:"memo_view,omitempty"` + // Optional. If set, validate the request but do not create the memo view. + ValidateOnly bool `protobuf:"varint,3,opt,name=validate_only,json=validateOnly,proto3" json:"validate_only,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateMemoViewRequest) Reset() { + *x = CreateMemoViewRequest{} + mi := &file_api_user_service_proto_msgTypes[22] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateMemoViewRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateMemoViewRequest) ProtoMessage() {} + +func (x *CreateMemoViewRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_user_service_proto_msgTypes[22] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateMemoViewRequest.ProtoReflect.Descriptor instead. +func (*CreateMemoViewRequest) Descriptor() ([]byte, []int) { + return file_api_user_service_proto_rawDescGZIP(), []int{22} +} + +func (x *CreateMemoViewRequest) GetParent() string { + if x != nil { + return x.Parent + } + return "" +} + +func (x *CreateMemoViewRequest) GetMemoView() *MemoView { + if x != nil { + return x.MemoView + } + return nil +} + +func (x *CreateMemoViewRequest) GetValidateOnly() bool { + if x != nil { + return x.ValidateOnly + } + return false +} + +// Request message for UserService.UpdateMemoView. +type UpdateMemoViewRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Required. The memo view to update. Its name identifies the memo view. + MemoView *MemoView `protobuf:"bytes,1,opt,name=memo_view,json=memoView,proto3" json:"memo_view,omitempty"` + // Optional. The fields to update. Supported paths: title, filter, icon. The + // service rejects an empty mask. + UpdateMask *fieldmaskpb.FieldMask `protobuf:"bytes,2,opt,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UpdateMemoViewRequest) Reset() { + *x = UpdateMemoViewRequest{} + mi := &file_api_user_service_proto_msgTypes[23] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UpdateMemoViewRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateMemoViewRequest) ProtoMessage() {} + +func (x *UpdateMemoViewRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_user_service_proto_msgTypes[23] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateMemoViewRequest.ProtoReflect.Descriptor instead. +func (*UpdateMemoViewRequest) Descriptor() ([]byte, []int) { + return file_api_user_service_proto_rawDescGZIP(), []int{23} +} + +func (x *UpdateMemoViewRequest) GetMemoView() *MemoView { + if x != nil { + return x.MemoView + } + return nil +} + +func (x *UpdateMemoViewRequest) GetUpdateMask() *fieldmaskpb.FieldMask { + if x != nil { + return x.UpdateMask + } + return nil +} + +// Request message for UserService.DeleteMemoView. +type DeleteMemoViewRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Required. The resource name of the memo view to delete. + // Format: users/{user}/views/{view} + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteMemoViewRequest) Reset() { + *x = DeleteMemoViewRequest{} + mi := &file_api_user_service_proto_msgTypes[24] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteMemoViewRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteMemoViewRequest) ProtoMessage() {} + +func (x *DeleteMemoViewRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_user_service_proto_msgTypes[24] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteMemoViewRequest.ProtoReflect.Descriptor instead. +func (*DeleteMemoViewRequest) Descriptor() ([]byte, []int) { + return file_api_user_service_proto_rawDescGZIP(), []int{24} +} + +func (x *DeleteMemoViewRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +// UserNotification is a notification delivered to a user. +type UserNotification struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Identifier. The resource name of the notification. + // Format: users/{user}/notifications/{notification} + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // Output only. The user who caused the notification. + // Format: users/{user} + Sender string `protobuf:"bytes,2,opt,name=sender,proto3" json:"sender,omitempty"` + // Output only. The sender user details. + SenderUser *User `protobuf:"bytes,3,opt,name=sender_user,json=senderUser,proto3" json:"sender_user,omitempty"` + // Output only. The type of the notification. + Type UserNotification_Type `protobuf:"varint,4,opt,name=type,proto3,enum=memos.api.UserNotification_Type" json:"type,omitempty"` + // The type-specific details. The set field matches the type. + // + // Types that are valid to be assigned to Payload: + // + // *UserNotification_MemoComment + // *UserNotification_MemoMention + // *UserNotification_SpaceInvitation + Payload isUserNotification_Payload `protobuf_oneof:"payload"` + // Optional. The status of the notification. + Status UserNotification_Status `protobuf:"varint,8,opt,name=status,proto3,enum=memos.api.UserNotification_Status" json:"status,omitempty"` + // Output only. The creation timestamp. + CreateTime *timestamppb.Timestamp `protobuf:"bytes,9,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UserNotification) Reset() { + *x = UserNotification{} + mi := &file_api_user_service_proto_msgTypes[25] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UserNotification) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserNotification) ProtoMessage() {} + +func (x *UserNotification) ProtoReflect() protoreflect.Message { + mi := &file_api_user_service_proto_msgTypes[25] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UserNotification.ProtoReflect.Descriptor instead. +func (*UserNotification) Descriptor() ([]byte, []int) { + return file_api_user_service_proto_rawDescGZIP(), []int{25} +} + +func (x *UserNotification) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *UserNotification) GetSender() string { + if x != nil { + return x.Sender + } + return "" +} + +func (x *UserNotification) GetSenderUser() *User { + if x != nil { + return x.SenderUser + } + return nil +} + +func (x *UserNotification) GetType() UserNotification_Type { + if x != nil { + return x.Type + } + return UserNotification_TYPE_UNSPECIFIED +} + +func (x *UserNotification) GetPayload() isUserNotification_Payload { + if x != nil { + return x.Payload + } + return nil +} + +func (x *UserNotification) GetMemoComment() *UserNotification_MemoCommentPayload { + if x != nil { + if x, ok := x.Payload.(*UserNotification_MemoComment); ok { + return x.MemoComment + } + } + return nil +} + +func (x *UserNotification) GetMemoMention() *UserNotification_MemoMentionPayload { + if x != nil { + if x, ok := x.Payload.(*UserNotification_MemoMention); ok { + return x.MemoMention + } + } + return nil +} + +func (x *UserNotification) GetSpaceInvitation() *UserNotification_SpaceInvitationPayload { + if x != nil { + if x, ok := x.Payload.(*UserNotification_SpaceInvitation); ok { + return x.SpaceInvitation + } + } + return nil +} + +func (x *UserNotification) GetStatus() UserNotification_Status { + if x != nil { + return x.Status + } + return UserNotification_STATUS_UNSPECIFIED +} + +func (x *UserNotification) GetCreateTime() *timestamppb.Timestamp { + if x != nil { + return x.CreateTime + } + return nil +} + +type isUserNotification_Payload interface { + isUserNotification_Payload() +} + +type UserNotification_MemoComment struct { + // Output only. Details of a MEMO_COMMENT notification. + MemoComment *UserNotification_MemoCommentPayload `protobuf:"bytes,5,opt,name=memo_comment,json=memoComment,proto3,oneof"` +} + +type UserNotification_MemoMention struct { + // Output only. Details of a MEMO_MENTION notification. + MemoMention *UserNotification_MemoMentionPayload `protobuf:"bytes,6,opt,name=memo_mention,json=memoMention,proto3,oneof"` +} + +type UserNotification_SpaceInvitation struct { + // Output only. Details of a SPACE_INVITATION notification. + SpaceInvitation *UserNotification_SpaceInvitationPayload `protobuf:"bytes,7,opt,name=space_invitation,json=spaceInvitation,proto3,oneof"` +} + +func (*UserNotification_MemoComment) isUserNotification_Payload() {} + +func (*UserNotification_MemoMention) isUserNotification_Payload() {} + +func (*UserNotification_SpaceInvitation) isUserNotification_Payload() {} + +// Request message for UserService.ListUserNotifications. +type ListUserNotificationsRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Required. The user whose notifications are listed. + // Format: users/{user} + Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"` + // Optional. The maximum number of notifications to return. The service may + // return fewer. Currently ignored; all notifications are returned in one + // page. + PageSize int32 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + // Optional. A page token from a previous call. Provide it to retrieve the + // next page. + PageToken string `protobuf:"bytes,3,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` + // Optional. A filter on the notifications. Currently ignored. + Filter string `protobuf:"bytes,4,opt,name=filter,proto3" json:"filter,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListUserNotificationsRequest) Reset() { + *x = ListUserNotificationsRequest{} + mi := &file_api_user_service_proto_msgTypes[26] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListUserNotificationsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListUserNotificationsRequest) ProtoMessage() {} + +func (x *ListUserNotificationsRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_user_service_proto_msgTypes[26] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListUserNotificationsRequest.ProtoReflect.Descriptor instead. +func (*ListUserNotificationsRequest) Descriptor() ([]byte, []int) { + return file_api_user_service_proto_rawDescGZIP(), []int{26} +} + +func (x *ListUserNotificationsRequest) GetParent() string { + if x != nil { + return x.Parent + } + return "" +} + +func (x *ListUserNotificationsRequest) GetPageSize() int32 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *ListUserNotificationsRequest) GetPageToken() string { + if x != nil { + return x.PageToken + } + return "" +} + +func (x *ListUserNotificationsRequest) GetFilter() string { + if x != nil { + return x.Filter + } + return "" +} + +// Response message for UserService.ListUserNotifications. +type ListUserNotificationsResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The notifications. + Notifications []*UserNotification `protobuf:"bytes,1,rep,name=notifications,proto3" json:"notifications,omitempty"` + // A token to retrieve the next page. Empty when there are no more pages. + NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListUserNotificationsResponse) Reset() { + *x = ListUserNotificationsResponse{} + mi := &file_api_user_service_proto_msgTypes[27] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListUserNotificationsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListUserNotificationsResponse) ProtoMessage() {} + +func (x *ListUserNotificationsResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_user_service_proto_msgTypes[27] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListUserNotificationsResponse.ProtoReflect.Descriptor instead. +func (*ListUserNotificationsResponse) Descriptor() ([]byte, []int) { + return file_api_user_service_proto_rawDescGZIP(), []int{27} +} + +func (x *ListUserNotificationsResponse) GetNotifications() []*UserNotification { + if x != nil { + return x.Notifications + } + return nil +} + +func (x *ListUserNotificationsResponse) GetNextPageToken() string { + if x != nil { + return x.NextPageToken + } + return "" +} + +// Request message for UserService.UpdateUserNotification. +type UpdateUserNotificationRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Required. The notification to update. Its name identifies the + // notification. + Notification *UserNotification `protobuf:"bytes,1,opt,name=notification,proto3" json:"notification,omitempty"` + // Required. The fields to update. Only status is supported. + UpdateMask *fieldmaskpb.FieldMask `protobuf:"bytes,2,opt,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UpdateUserNotificationRequest) Reset() { + *x = UpdateUserNotificationRequest{} + mi := &file_api_user_service_proto_msgTypes[28] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UpdateUserNotificationRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateUserNotificationRequest) ProtoMessage() {} + +func (x *UpdateUserNotificationRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_user_service_proto_msgTypes[28] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateUserNotificationRequest.ProtoReflect.Descriptor instead. +func (*UpdateUserNotificationRequest) Descriptor() ([]byte, []int) { + return file_api_user_service_proto_rawDescGZIP(), []int{28} +} + +func (x *UpdateUserNotificationRequest) GetNotification() *UserNotification { + if x != nil { + return x.Notification + } + return nil +} + +func (x *UpdateUserNotificationRequest) GetUpdateMask() *fieldmaskpb.FieldMask { + if x != nil { + return x.UpdateMask + } + return nil +} + +// Request message for UserService.DeleteUserNotification. +type DeleteUserNotificationRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Required. The resource name of the notification to delete. + // Format: users/{user}/notifications/{notification} + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteUserNotificationRequest) Reset() { + *x = DeleteUserNotificationRequest{} + mi := &file_api_user_service_proto_msgTypes[29] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteUserNotificationRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteUserNotificationRequest) ProtoMessage() {} + +func (x *DeleteUserNotificationRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_user_service_proto_msgTypes[29] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteUserNotificationRequest.ProtoReflect.Descriptor instead. +func (*DeleteUserNotificationRequest) Descriptor() ([]byte, []int) { + return file_api_user_service_proto_rawDescGZIP(), []int{29} +} + +func (x *DeleteUserNotificationRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +// UserWebhook is a webhook owned by a user. +type UserWebhook struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Identifier. The resource name of the webhook. + // Format: users/{user}/webhooks/{webhook} + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // A human-readable name for the webhook. + DisplayName string `protobuf:"bytes,2,opt,name=display_name,json=displayName,proto3" json:"display_name,omitempty"` + // The URL the webhook request is sent to. Required on create. + Url string `protobuf:"bytes,3,opt,name=url,proto3" json:"url,omitempty"` + // Input only. The secret used to HMAC-SHA256 sign the webhook request body. + // Never returned; use GetUserWebhookSigningSecret to read it. + SigningSecret string `protobuf:"bytes,4,opt,name=signing_secret,json=signingSecret,proto3" json:"signing_secret,omitempty"` + // Output only. Whether a signing secret is configured for this webhook. + SigningSecretSet bool `protobuf:"varint,5,opt,name=signing_secret_set,json=signingSecretSet,proto3" json:"signing_secret_set,omitempty"` + // Output only. The creation timestamp. Currently never set. + CreateTime *timestamppb.Timestamp `protobuf:"bytes,6,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty"` + // Output only. The last update timestamp. Currently never set. + UpdateTime *timestamppb.Timestamp `protobuf:"bytes,7,opt,name=update_time,json=updateTime,proto3" json:"update_time,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UserWebhook) Reset() { + *x = UserWebhook{} + mi := &file_api_user_service_proto_msgTypes[30] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UserWebhook) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserWebhook) ProtoMessage() {} + +func (x *UserWebhook) ProtoReflect() protoreflect.Message { + mi := &file_api_user_service_proto_msgTypes[30] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UserWebhook.ProtoReflect.Descriptor instead. +func (*UserWebhook) Descriptor() ([]byte, []int) { + return file_api_user_service_proto_rawDescGZIP(), []int{30} +} + +func (x *UserWebhook) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *UserWebhook) GetDisplayName() string { + if x != nil { + return x.DisplayName + } + return "" +} + +func (x *UserWebhook) GetUrl() string { + if x != nil { + return x.Url + } + return "" +} + +func (x *UserWebhook) GetSigningSecret() string { + if x != nil { + return x.SigningSecret + } + return "" +} + +func (x *UserWebhook) GetSigningSecretSet() bool { + if x != nil { + return x.SigningSecretSet + } + return false +} + +func (x *UserWebhook) GetCreateTime() *timestamppb.Timestamp { + if x != nil { + return x.CreateTime + } + return nil +} + +func (x *UserWebhook) GetUpdateTime() *timestamppb.Timestamp { + if x != nil { + return x.UpdateTime + } + return nil +} + +// Request message for UserService.ListUserWebhooks. +type ListUserWebhooksRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Required. The user whose webhooks are listed. + // Format: users/{user} + Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListUserWebhooksRequest) Reset() { + *x = ListUserWebhooksRequest{} + mi := &file_api_user_service_proto_msgTypes[31] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListUserWebhooksRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListUserWebhooksRequest) ProtoMessage() {} + +func (x *ListUserWebhooksRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_user_service_proto_msgTypes[31] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListUserWebhooksRequest.ProtoReflect.Descriptor instead. +func (*ListUserWebhooksRequest) Descriptor() ([]byte, []int) { + return file_api_user_service_proto_rawDescGZIP(), []int{31} +} + +func (x *ListUserWebhooksRequest) GetParent() string { + if x != nil { + return x.Parent + } + return "" +} + +// Response message for UserService.ListUserWebhooks. +type ListUserWebhooksResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The webhooks. + Webhooks []*UserWebhook `protobuf:"bytes,1,rep,name=webhooks,proto3" json:"webhooks,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListUserWebhooksResponse) Reset() { + *x = ListUserWebhooksResponse{} + mi := &file_api_user_service_proto_msgTypes[32] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListUserWebhooksResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListUserWebhooksResponse) ProtoMessage() {} + +func (x *ListUserWebhooksResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_user_service_proto_msgTypes[32] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListUserWebhooksResponse.ProtoReflect.Descriptor instead. +func (*ListUserWebhooksResponse) Descriptor() ([]byte, []int) { + return file_api_user_service_proto_rawDescGZIP(), []int{32} +} + +func (x *ListUserWebhooksResponse) GetWebhooks() []*UserWebhook { + if x != nil { + return x.Webhooks + } + return nil +} + +// Request message for UserService.CreateUserWebhook. +type CreateUserWebhookRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Required. The user who owns the webhook. + // Format: users/{user} + Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"` + // Required. The webhook to create. + Webhook *UserWebhook `protobuf:"bytes,2,opt,name=webhook,proto3" json:"webhook,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateUserWebhookRequest) Reset() { + *x = CreateUserWebhookRequest{} + mi := &file_api_user_service_proto_msgTypes[33] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateUserWebhookRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateUserWebhookRequest) ProtoMessage() {} + +func (x *CreateUserWebhookRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_user_service_proto_msgTypes[33] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateUserWebhookRequest.ProtoReflect.Descriptor instead. +func (*CreateUserWebhookRequest) Descriptor() ([]byte, []int) { + return file_api_user_service_proto_rawDescGZIP(), []int{33} +} + +func (x *CreateUserWebhookRequest) GetParent() string { + if x != nil { + return x.Parent + } + return "" +} + +func (x *CreateUserWebhookRequest) GetWebhook() *UserWebhook { + if x != nil { + return x.Webhook + } + return nil +} + +// Request message for UserService.UpdateUserWebhook. +type UpdateUserWebhookRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Required. The webhook to update. Its name identifies the webhook. + Webhook *UserWebhook `protobuf:"bytes,1,opt,name=webhook,proto3" json:"webhook,omitempty"` + // The fields to update. Supported paths: url, display_name, signing_secret. + // When unset, all of them are updated, skipping an empty url or + // signing_secret. + UpdateMask *fieldmaskpb.FieldMask `protobuf:"bytes,2,opt,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UpdateUserWebhookRequest) Reset() { + *x = UpdateUserWebhookRequest{} + mi := &file_api_user_service_proto_msgTypes[34] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UpdateUserWebhookRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateUserWebhookRequest) ProtoMessage() {} + +func (x *UpdateUserWebhookRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_user_service_proto_msgTypes[34] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateUserWebhookRequest.ProtoReflect.Descriptor instead. +func (*UpdateUserWebhookRequest) Descriptor() ([]byte, []int) { + return file_api_user_service_proto_rawDescGZIP(), []int{34} +} + +func (x *UpdateUserWebhookRequest) GetWebhook() *UserWebhook { + if x != nil { + return x.Webhook + } + return nil +} + +func (x *UpdateUserWebhookRequest) GetUpdateMask() *fieldmaskpb.FieldMask { + if x != nil { + return x.UpdateMask + } + return nil +} + +// Request message for UserService.DeleteUserWebhook. +type DeleteUserWebhookRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Required. The resource name of the webhook to delete. + // Format: users/{user}/webhooks/{webhook} + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteUserWebhookRequest) Reset() { + *x = DeleteUserWebhookRequest{} + mi := &file_api_user_service_proto_msgTypes[35] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteUserWebhookRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteUserWebhookRequest) ProtoMessage() {} + +func (x *DeleteUserWebhookRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_user_service_proto_msgTypes[35] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteUserWebhookRequest.ProtoReflect.Descriptor instead. +func (*DeleteUserWebhookRequest) Descriptor() ([]byte, []int) { + return file_api_user_service_proto_rawDescGZIP(), []int{35} +} + +func (x *DeleteUserWebhookRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +// Request message for UserService.GetUserWebhookSigningSecret. +type GetUserWebhookSigningSecretRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Required. The resource name of the webhook whose signing secret to reveal. + // Format: users/{user}/webhooks/{webhook} + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetUserWebhookSigningSecretRequest) Reset() { + *x = GetUserWebhookSigningSecretRequest{} + mi := &file_api_user_service_proto_msgTypes[36] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetUserWebhookSigningSecretRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetUserWebhookSigningSecretRequest) ProtoMessage() {} + +func (x *GetUserWebhookSigningSecretRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_user_service_proto_msgTypes[36] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetUserWebhookSigningSecretRequest.ProtoReflect.Descriptor instead. +func (*GetUserWebhookSigningSecretRequest) Descriptor() ([]byte, []int) { + return file_api_user_service_proto_rawDescGZIP(), []int{36} +} + +func (x *GetUserWebhookSigningSecretRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +// Response message for UserService.GetUserWebhookSigningSecret. +type GetUserWebhookSigningSecretResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The signing secret, in the Standard Webhooks "whsec_" form. + SigningSecret string `protobuf:"bytes,1,opt,name=signing_secret,json=signingSecret,proto3" json:"signing_secret,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetUserWebhookSigningSecretResponse) Reset() { + *x = GetUserWebhookSigningSecretResponse{} + mi := &file_api_user_service_proto_msgTypes[37] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetUserWebhookSigningSecretResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetUserWebhookSigningSecretResponse) ProtoMessage() {} + +func (x *GetUserWebhookSigningSecretResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_user_service_proto_msgTypes[37] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetUserWebhookSigningSecretResponse.ProtoReflect.Descriptor instead. +func (*GetUserWebhookSigningSecretResponse) Descriptor() ([]byte, []int) { + return file_api_user_service_proto_rawDescGZIP(), []int{37} +} + +func (x *GetUserWebhookSigningSecretResponse) GetSigningSecret() string { + if x != nil { + return x.SigningSecret + } + return "" +} + +// LinkedIdentity is an SSO identity linked to a user account. +type LinkedIdentity struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Identifier. The resource name of the linked identity. {linked_identity} is + // the ID of the identity provider. + // Format: users/{user}/linkedIdentities/{linked_identity} + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // Output only. The resource name of the identity provider. + // Format: identity-providers/{idp} + IdentityProvider string `protobuf:"bytes,2,opt,name=identity_provider,json=identityProvider,proto3" json:"identity_provider,omitempty"` + // Output only. The external user identifier from the identity provider. + ExternalUid string `protobuf:"bytes,3,opt,name=external_uid,json=externalUid,proto3" json:"external_uid,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *LinkedIdentity) Reset() { + *x = LinkedIdentity{} + mi := &file_api_user_service_proto_msgTypes[38] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *LinkedIdentity) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LinkedIdentity) ProtoMessage() {} + +func (x *LinkedIdentity) ProtoReflect() protoreflect.Message { + mi := &file_api_user_service_proto_msgTypes[38] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LinkedIdentity.ProtoReflect.Descriptor instead. +func (*LinkedIdentity) Descriptor() ([]byte, []int) { + return file_api_user_service_proto_rawDescGZIP(), []int{38} +} + +func (x *LinkedIdentity) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *LinkedIdentity) GetIdentityProvider() string { + if x != nil { + return x.IdentityProvider + } + return "" +} + +func (x *LinkedIdentity) GetExternalUid() string { + if x != nil { + return x.ExternalUid + } + return "" +} + +// Request message for UserService.ListLinkedIdentities. +type ListLinkedIdentitiesRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Required. The user whose linked identities are listed. + // Format: users/{user} + Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListLinkedIdentitiesRequest) Reset() { + *x = ListLinkedIdentitiesRequest{} + mi := &file_api_user_service_proto_msgTypes[39] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListLinkedIdentitiesRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListLinkedIdentitiesRequest) ProtoMessage() {} + +func (x *ListLinkedIdentitiesRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_user_service_proto_msgTypes[39] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListLinkedIdentitiesRequest.ProtoReflect.Descriptor instead. +func (*ListLinkedIdentitiesRequest) Descriptor() ([]byte, []int) { + return file_api_user_service_proto_rawDescGZIP(), []int{39} +} + +func (x *ListLinkedIdentitiesRequest) GetParent() string { + if x != nil { + return x.Parent + } + return "" +} + +// Response message for UserService.ListLinkedIdentities. +type ListLinkedIdentitiesResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The linked identities. + LinkedIdentities []*LinkedIdentity `protobuf:"bytes,1,rep,name=linked_identities,json=linkedIdentities,proto3" json:"linked_identities,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListLinkedIdentitiesResponse) Reset() { + *x = ListLinkedIdentitiesResponse{} + mi := &file_api_user_service_proto_msgTypes[40] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListLinkedIdentitiesResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListLinkedIdentitiesResponse) ProtoMessage() {} + +func (x *ListLinkedIdentitiesResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_user_service_proto_msgTypes[40] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListLinkedIdentitiesResponse.ProtoReflect.Descriptor instead. +func (*ListLinkedIdentitiesResponse) Descriptor() ([]byte, []int) { + return file_api_user_service_proto_rawDescGZIP(), []int{40} +} + +func (x *ListLinkedIdentitiesResponse) GetLinkedIdentities() []*LinkedIdentity { + if x != nil { + return x.LinkedIdentities + } + return nil +} + +// Request message for UserService.GetLinkedIdentity. +type GetLinkedIdentityRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Required. The resource name of the linked identity. + // Format: users/{user}/linkedIdentities/{linked_identity} + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetLinkedIdentityRequest) Reset() { + *x = GetLinkedIdentityRequest{} + mi := &file_api_user_service_proto_msgTypes[41] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetLinkedIdentityRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetLinkedIdentityRequest) ProtoMessage() {} + +func (x *GetLinkedIdentityRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_user_service_proto_msgTypes[41] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetLinkedIdentityRequest.ProtoReflect.Descriptor instead. +func (*GetLinkedIdentityRequest) Descriptor() ([]byte, []int) { + return file_api_user_service_proto_rawDescGZIP(), []int{41} +} + +func (x *GetLinkedIdentityRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +// Request message for UserService.CreateLinkedIdentity. +type CreateLinkedIdentityRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Required. The user who owns the linked identity. Must be the caller. + // Format: users/{user} + Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"` + // Required. The identity provider to link. + // Format: identity-providers/{idp} + IdentityProvider string `protobuf:"bytes,2,opt,name=identity_provider,json=identityProvider,proto3" json:"identity_provider,omitempty"` + // Required. The authorization code from the identity provider. + Code string `protobuf:"bytes,3,opt,name=code,proto3" json:"code,omitempty"` + // Required. The redirect URI used in the OAuth flow. + RedirectUri string `protobuf:"bytes,4,opt,name=redirect_uri,json=redirectUri,proto3" json:"redirect_uri,omitempty"` + // Optional. The PKCE code verifier used in the OAuth flow. + CodeVerifier string `protobuf:"bytes,5,opt,name=code_verifier,json=codeVerifier,proto3" json:"code_verifier,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateLinkedIdentityRequest) Reset() { + *x = CreateLinkedIdentityRequest{} + mi := &file_api_user_service_proto_msgTypes[42] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateLinkedIdentityRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateLinkedIdentityRequest) ProtoMessage() {} + +func (x *CreateLinkedIdentityRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_user_service_proto_msgTypes[42] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateLinkedIdentityRequest.ProtoReflect.Descriptor instead. +func (*CreateLinkedIdentityRequest) Descriptor() ([]byte, []int) { + return file_api_user_service_proto_rawDescGZIP(), []int{42} +} + +func (x *CreateLinkedIdentityRequest) GetParent() string { + if x != nil { + return x.Parent + } + return "" +} + +func (x *CreateLinkedIdentityRequest) GetIdentityProvider() string { + if x != nil { + return x.IdentityProvider + } + return "" +} + +func (x *CreateLinkedIdentityRequest) GetCode() string { + if x != nil { + return x.Code + } + return "" +} + +func (x *CreateLinkedIdentityRequest) GetRedirectUri() string { + if x != nil { + return x.RedirectUri + } + return "" +} + +func (x *CreateLinkedIdentityRequest) GetCodeVerifier() string { + if x != nil { + return x.CodeVerifier + } + return "" +} + +// Request message for UserService.DeleteLinkedIdentity. +type DeleteLinkedIdentityRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Required. The resource name of the linked identity to delete. + // Format: users/{user}/linkedIdentities/{linked_identity} + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteLinkedIdentityRequest) Reset() { + *x = DeleteLinkedIdentityRequest{} + mi := &file_api_user_service_proto_msgTypes[43] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteLinkedIdentityRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteLinkedIdentityRequest) ProtoMessage() {} + +func (x *DeleteLinkedIdentityRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_user_service_proto_msgTypes[43] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteLinkedIdentityRequest.ProtoReflect.Descriptor instead. +func (*DeleteLinkedIdentityRequest) Descriptor() ([]byte, []int) { + return file_api_user_service_proto_rawDescGZIP(), []int{43} +} + +func (x *DeleteLinkedIdentityRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +// PersonalAccessToken is a long-lived token for API and script access. +// PATs are distinct from short-lived JWT access tokens used for session +// authentication. +type PersonalAccessToken struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Identifier. The resource name of the personal access token. + // Format: users/{user}/personalAccessTokens/{personal_access_token} + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // Optional. The description of the token. + Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` + // Output only. The creation time. + CreateTime *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty"` + // Optional. The expiration time. Unset means the token never expires. + ExpireTime *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=expire_time,json=expireTime,proto3" json:"expire_time,omitempty"` + // Output only. The time the token was last used. + LastUseTime *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=last_use_time,json=lastUseTime,proto3" json:"last_use_time,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PersonalAccessToken) Reset() { + *x = PersonalAccessToken{} + mi := &file_api_user_service_proto_msgTypes[44] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PersonalAccessToken) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PersonalAccessToken) ProtoMessage() {} + +func (x *PersonalAccessToken) ProtoReflect() protoreflect.Message { + mi := &file_api_user_service_proto_msgTypes[44] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PersonalAccessToken.ProtoReflect.Descriptor instead. +func (*PersonalAccessToken) Descriptor() ([]byte, []int) { + return file_api_user_service_proto_rawDescGZIP(), []int{44} +} + +func (x *PersonalAccessToken) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *PersonalAccessToken) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *PersonalAccessToken) GetCreateTime() *timestamppb.Timestamp { + if x != nil { + return x.CreateTime + } + return nil +} + +func (x *PersonalAccessToken) GetExpireTime() *timestamppb.Timestamp { + if x != nil { + return x.ExpireTime + } + return nil +} + +func (x *PersonalAccessToken) GetLastUseTime() *timestamppb.Timestamp { + if x != nil { + return x.LastUseTime + } + return nil +} + +// Request message for UserService.ListPersonalAccessTokens. +type ListPersonalAccessTokensRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Required. The user whose personal access tokens are listed. + // Format: users/{user} + Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"` + // Optional. The maximum number of tokens to return. The service may return + // fewer. Currently ignored; all tokens are returned in one page. + PageSize int32 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + // Optional. A page token from a previous call. Provide it to retrieve the + // next page. + PageToken string `protobuf:"bytes,3,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListPersonalAccessTokensRequest) Reset() { + *x = ListPersonalAccessTokensRequest{} + mi := &file_api_user_service_proto_msgTypes[45] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListPersonalAccessTokensRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListPersonalAccessTokensRequest) ProtoMessage() {} + +func (x *ListPersonalAccessTokensRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_user_service_proto_msgTypes[45] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListPersonalAccessTokensRequest.ProtoReflect.Descriptor instead. +func (*ListPersonalAccessTokensRequest) Descriptor() ([]byte, []int) { + return file_api_user_service_proto_rawDescGZIP(), []int{45} +} + +func (x *ListPersonalAccessTokensRequest) GetParent() string { + if x != nil { + return x.Parent + } + return "" +} + +func (x *ListPersonalAccessTokensRequest) GetPageSize() int32 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *ListPersonalAccessTokensRequest) GetPageToken() string { + if x != nil { + return x.PageToken + } + return "" +} + +// Response message for UserService.ListPersonalAccessTokens. +type ListPersonalAccessTokensResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The personal access tokens, without their token values. + PersonalAccessTokens []*PersonalAccessToken `protobuf:"bytes,1,rep,name=personal_access_tokens,json=personalAccessTokens,proto3" json:"personal_access_tokens,omitempty"` + // A token to retrieve the next page. Empty when there are no more pages. + NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListPersonalAccessTokensResponse) Reset() { + *x = ListPersonalAccessTokensResponse{} + mi := &file_api_user_service_proto_msgTypes[46] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListPersonalAccessTokensResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListPersonalAccessTokensResponse) ProtoMessage() {} + +func (x *ListPersonalAccessTokensResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_user_service_proto_msgTypes[46] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListPersonalAccessTokensResponse.ProtoReflect.Descriptor instead. +func (*ListPersonalAccessTokensResponse) Descriptor() ([]byte, []int) { + return file_api_user_service_proto_rawDescGZIP(), []int{46} +} + +func (x *ListPersonalAccessTokensResponse) GetPersonalAccessTokens() []*PersonalAccessToken { + if x != nil { + return x.PersonalAccessTokens + } + return nil +} + +func (x *ListPersonalAccessTokensResponse) GetNextPageToken() string { + if x != nil { + return x.NextPageToken + } + return "" +} + +// Request message for UserService.CreatePersonalAccessToken. +type CreatePersonalAccessTokenRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Required. The user who owns the token. Must be the caller. + // Format: users/{user} + Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"` + // Optional. The description of the token. + Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` + // Optional. The lifetime of the token in days. 0 means the token never + // expires. + ExpiresInDays int32 `protobuf:"varint,3,opt,name=expires_in_days,json=expiresInDays,proto3" json:"expires_in_days,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreatePersonalAccessTokenRequest) Reset() { + *x = CreatePersonalAccessTokenRequest{} + mi := &file_api_user_service_proto_msgTypes[47] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreatePersonalAccessTokenRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreatePersonalAccessTokenRequest) ProtoMessage() {} + +func (x *CreatePersonalAccessTokenRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_user_service_proto_msgTypes[47] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreatePersonalAccessTokenRequest.ProtoReflect.Descriptor instead. +func (*CreatePersonalAccessTokenRequest) Descriptor() ([]byte, []int) { + return file_api_user_service_proto_rawDescGZIP(), []int{47} +} + +func (x *CreatePersonalAccessTokenRequest) GetParent() string { + if x != nil { + return x.Parent + } + return "" +} + +func (x *CreatePersonalAccessTokenRequest) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *CreatePersonalAccessTokenRequest) GetExpiresInDays() int32 { + if x != nil { + return x.ExpiresInDays + } + return 0 +} + +// Response message for UserService.CreatePersonalAccessToken. +type CreatePersonalAccessTokenResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The personal access token metadata. + PersonalAccessToken *PersonalAccessToken `protobuf:"bytes,1,opt,name=personal_access_token,json=personalAccessToken,proto3" json:"personal_access_token,omitempty"` + // The token value. This is the only time it is returned. + Token string `protobuf:"bytes,2,opt,name=token,proto3" json:"token,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreatePersonalAccessTokenResponse) Reset() { + *x = CreatePersonalAccessTokenResponse{} + mi := &file_api_user_service_proto_msgTypes[48] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreatePersonalAccessTokenResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreatePersonalAccessTokenResponse) ProtoMessage() {} + +func (x *CreatePersonalAccessTokenResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_user_service_proto_msgTypes[48] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreatePersonalAccessTokenResponse.ProtoReflect.Descriptor instead. +func (*CreatePersonalAccessTokenResponse) Descriptor() ([]byte, []int) { + return file_api_user_service_proto_rawDescGZIP(), []int{48} +} + +func (x *CreatePersonalAccessTokenResponse) GetPersonalAccessToken() *PersonalAccessToken { + if x != nil { + return x.PersonalAccessToken + } + return nil +} + +func (x *CreatePersonalAccessTokenResponse) GetToken() string { + if x != nil { + return x.Token + } + return "" +} + +// Request message for UserService.DeletePersonalAccessToken. +type DeletePersonalAccessTokenRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Required. The resource name of the personal access token to delete. + // Format: users/{user}/personalAccessTokens/{personal_access_token} + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeletePersonalAccessTokenRequest) Reset() { + *x = DeletePersonalAccessTokenRequest{} + mi := &file_api_user_service_proto_msgTypes[49] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeletePersonalAccessTokenRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeletePersonalAccessTokenRequest) ProtoMessage() {} + +func (x *DeletePersonalAccessTokenRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_user_service_proto_msgTypes[49] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeletePersonalAccessTokenRequest.ProtoReflect.Descriptor instead. +func (*DeletePersonalAccessTokenRequest) Descriptor() ([]byte, []int) { + return file_api_user_service_proto_rawDescGZIP(), []int{49} +} + +func (x *DeletePersonalAccessTokenRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +// Request message for UserService.ExportMemos. type ExportMemosRequest struct { state protoimpl.MessageState `protogen:"open.v1"` // Required. The user whose memos are exported. Must be the caller. @@ -1078,7 +3556,7 @@ type ExportMemosRequest struct { func (x *ExportMemosRequest) Reset() { *x = ExportMemosRequest{} - mi := &file_api_v1_user_service_proto_msgTypes[10] + mi := &file_api_user_service_proto_msgTypes[50] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1090,7 +3568,7 @@ func (x *ExportMemosRequest) String() string { func (*ExportMemosRequest) ProtoMessage() {} func (x *ExportMemosRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[10] + mi := &file_api_user_service_proto_msgTypes[50] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1103,7 +3581,7 @@ func (x *ExportMemosRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ExportMemosRequest.ProtoReflect.Descriptor instead. func (*ExportMemosRequest) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{10} + return file_api_user_service_proto_rawDescGZIP(), []int{50} } func (x *ExportMemosRequest) GetName() string { @@ -1113,6 +3591,7 @@ func (x *ExportMemosRequest) GetName() string { return "" } +// Request message for UserService.ImportMemos. type ImportMemosRequest struct { state protoimpl.MessageState `protogen:"open.v1"` // Required. The user who receives the memos. Must be the caller. @@ -1138,19 +3617,19 @@ type ImportMemosRequest struct { // validate_only is set, imported. Any later call for an imported upload // returns the same report. FinishWrite bool `protobuf:"varint,6,opt,name=finish_write,json=finishWrite,proto3" json:"finish_write,omitempty"` + // Optional. Read on the finishing call that imports. Unspecified means SKIP. + ConflictPolicy ImportMemosRequest_ConflictPolicy `protobuf:"varint,7,opt,name=conflict_policy,json=conflictPolicy,proto3,enum=memos.api.ImportMemosRequest_ConflictPolicy" json:"conflict_policy,omitempty"` // Optional. On a finishing call, validate the archive and return the plan // without importing. The upload stays staged so a later finishing call can // import it. - ValidateOnly bool `protobuf:"varint,7,opt,name=validate_only,json=validateOnly,proto3" json:"validate_only,omitempty"` - // Optional. Read on the finishing call that imports. Unspecified means SKIP. - ConflictPolicy ImportMemosRequest_ConflictPolicy `protobuf:"varint,8,opt,name=conflict_policy,json=conflictPolicy,proto3,enum=memos.api.v1.ImportMemosRequest_ConflictPolicy" json:"conflict_policy,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache + ValidateOnly bool `protobuf:"varint,8,opt,name=validate_only,json=validateOnly,proto3" json:"validate_only,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *ImportMemosRequest) Reset() { *x = ImportMemosRequest{} - mi := &file_api_v1_user_service_proto_msgTypes[11] + mi := &file_api_user_service_proto_msgTypes[51] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1162,7 +3641,7 @@ func (x *ImportMemosRequest) String() string { func (*ImportMemosRequest) ProtoMessage() {} func (x *ImportMemosRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[11] + mi := &file_api_user_service_proto_msgTypes[51] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1175,7 +3654,7 @@ func (x *ImportMemosRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ImportMemosRequest.ProtoReflect.Descriptor instead. func (*ImportMemosRequest) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{11} + return file_api_user_service_proto_rawDescGZIP(), []int{51} } func (x *ImportMemosRequest) GetName() string { @@ -1231,13 +3710,6 @@ func (x *ImportMemosRequest) GetFinishWrite() bool { return false } -func (x *ImportMemosRequest) GetValidateOnly() bool { - if x != nil { - return x.ValidateOnly - } - return false -} - func (x *ImportMemosRequest) GetConflictPolicy() ImportMemosRequest_ConflictPolicy { if x != nil { return x.ConflictPolicy @@ -1245,6 +3717,13 @@ func (x *ImportMemosRequest) GetConflictPolicy() ImportMemosRequest_ConflictPoli return ImportMemosRequest_CONFLICT_POLICY_UNSPECIFIED } +func (x *ImportMemosRequest) GetValidateOnly() bool { + if x != nil { + return x.ValidateOnly + } + return false +} + type isImportMemosRequest_Upload interface { isImportMemosRequest_Upload() } @@ -1263,51 +3742,7 @@ func (*ImportMemosRequest_Spec) isImportMemosRequest_Upload() {} func (*ImportMemosRequest_UploadId) isImportMemosRequest_Upload() {} -type ImportMemosSpec struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Optional. Total size of the archive in bytes. - TotalSize int64 `protobuf:"varint,1,opt,name=total_size,json=totalSize,proto3" json:"total_size,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ImportMemosSpec) Reset() { - *x = ImportMemosSpec{} - mi := &file_api_v1_user_service_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ImportMemosSpec) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ImportMemosSpec) ProtoMessage() {} - -func (x *ImportMemosSpec) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[12] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ImportMemosSpec.ProtoReflect.Descriptor instead. -func (*ImportMemosSpec) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{12} -} - -func (x *ImportMemosSpec) GetTotalSize() int64 { - if x != nil { - return x.TotalSize - } - return 0 -} - +// Response message for UserService.ImportMemos. type ImportMemosResponse struct { state protoimpl.MessageState `protogen:"open.v1"` // Opaque ID for subsequent calls. This is not a resource name. @@ -1329,7 +3764,7 @@ type ImportMemosResponse struct { func (x *ImportMemosResponse) Reset() { *x = ImportMemosResponse{} - mi := &file_api_v1_user_service_proto_msgTypes[13] + mi := &file_api_user_service_proto_msgTypes[52] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1341,7 +3776,7 @@ func (x *ImportMemosResponse) String() string { func (*ImportMemosResponse) ProtoMessage() {} func (x *ImportMemosResponse) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[13] + mi := &file_api_user_service_proto_msgTypes[52] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1354,7 +3789,7 @@ func (x *ImportMemosResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use ImportMemosResponse.ProtoReflect.Descriptor instead. func (*ImportMemosResponse) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{13} + return file_api_user_service_proto_rawDescGZIP(), []int{52} } func (x *ImportMemosResponse) GetUploadId() string { @@ -1385,7 +3820,7 @@ func (x *ImportMemosResponse) GetResult() isImportMemosResponse_Result { return nil } -func (x *ImportMemosResponse) GetPlan() *MemoImportPlan { +func (x *ImportMemosResponse) GetPlan() *ImportMemosPlan { if x != nil { if x, ok := x.Result.(*ImportMemosResponse_Plan); ok { return x.Plan @@ -1394,7 +3829,7 @@ func (x *ImportMemosResponse) GetPlan() *MemoImportPlan { return nil } -func (x *ImportMemosResponse) GetReport() *MemoImportReport { +func (x *ImportMemosResponse) GetReport() *ImportMemosReport { if x != nil { if x, ok := x.Result.(*ImportMemosResponse_Report); ok { return x.Report @@ -1409,44 +3844,42 @@ type isImportMemosResponse_Result interface { type ImportMemosResponse_Plan struct { // What the import would do. Set by a finishing call with validate_only. - Plan *MemoImportPlan `protobuf:"bytes,4,opt,name=plan,proto3,oneof"` + Plan *ImportMemosPlan `protobuf:"bytes,4,opt,name=plan,proto3,oneof"` } type ImportMemosResponse_Report struct { // What the import did. Set by a finishing call that imported. - Report *MemoImportReport `protobuf:"bytes,5,opt,name=report,proto3,oneof"` + Report *ImportMemosReport `protobuf:"bytes,5,opt,name=report,proto3,oneof"` } func (*ImportMemosResponse_Plan) isImportMemosResponse_Result() {} func (*ImportMemosResponse_Report) isImportMemosResponse_Result() {} -// MemoImportIssue is one warning or failure of an import, tied to the memo -// UID from the archive when there is one. -type MemoImportIssue struct { +// ImportMemosSpec describes a new memo import upload. +type ImportMemosSpec struct { state protoimpl.MessageState `protogen:"open.v1"` - // The archive memo UID the issue concerns, if any. - Memo string `protobuf:"bytes,1,opt,name=memo,proto3" json:"memo,omitempty"` - Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` + // Optional. Total size of the archive in bytes. + TotalSize int64 `protobuf:"varint,1,opt,name=total_size,json=totalSize,proto3" json:"total_size,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } -func (x *MemoImportIssue) Reset() { - *x = MemoImportIssue{} - mi := &file_api_v1_user_service_proto_msgTypes[14] +func (x *ImportMemosSpec) Reset() { + *x = ImportMemosSpec{} + mi := &file_api_user_service_proto_msgTypes[53] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } -func (x *MemoImportIssue) String() string { +func (x *ImportMemosSpec) String() string { return protoimpl.X.MessageStringOf(x) } -func (*MemoImportIssue) ProtoMessage() {} +func (*ImportMemosSpec) ProtoMessage() {} -func (x *MemoImportIssue) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[14] +func (x *ImportMemosSpec) ProtoReflect() protoreflect.Message { + mi := &file_api_user_service_proto_msgTypes[53] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1457,27 +3890,20 @@ func (x *MemoImportIssue) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use MemoImportIssue.ProtoReflect.Descriptor instead. -func (*MemoImportIssue) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{14} +// Deprecated: Use ImportMemosSpec.ProtoReflect.Descriptor instead. +func (*ImportMemosSpec) Descriptor() ([]byte, []int) { + return file_api_user_service_proto_rawDescGZIP(), []int{53} } -func (x *MemoImportIssue) GetMemo() string { +func (x *ImportMemosSpec) GetTotalSize() int64 { if x != nil { - return x.Memo + return x.TotalSize } - return "" + return 0 } -func (x *MemoImportIssue) GetMessage() string { - if x != nil { - return x.Message - } - return "" -} - -// MemoImportPlan describes what importing a staged archive would do. -type MemoImportPlan struct { +// ImportMemosPlan describes what importing a staged archive would do. +type ImportMemosPlan struct { state protoimpl.MessageState `protogen:"open.v1"` // When the archive was written. ExportTime *timestamppb.Timestamp `protobuf:"bytes,1,opt,name=export_time,json=exportTime,proto3" json:"export_time,omitempty"` @@ -1486,9 +3912,9 @@ type MemoImportPlan struct { // The software that wrote the archive. Generator string `protobuf:"bytes,3,opt,name=generator,proto3" json:"generator,omitempty"` // Number of memo records in the archive. - Memos int32 `protobuf:"varint,4,opt,name=memos,proto3" json:"memos,omitempty"` + MemoCount int32 `protobuf:"varint,4,opt,name=memo_count,json=memoCount,proto3" json:"memo_count,omitempty"` // Number of attachment files in the archive. - Attachments int32 `protobuf:"varint,5,opt,name=attachments,proto3" json:"attachments,omitempty"` + AttachmentCount int32 `protobuf:"varint,5,opt,name=attachment_count,json=attachmentCount,proto3" json:"attachment_count,omitempty"` // Memos whose UID nobody on the instance holds. New int32 `protobuf:"varint,6,opt,name=new,proto3" json:"new,omitempty"` // Memos the user already holds; the conflict policy applies to them. @@ -1496,26 +3922,26 @@ type MemoImportPlan struct { // Memos whose UID another account holds; they are imported under fresh UIDs. Renamed int32 `protobuf:"varint,8,opt,name=renamed,proto3" json:"renamed,omitempty"` // Deviations the archive reader corrected while validating. - Warnings []*MemoImportIssue `protobuf:"bytes,9,rep,name=warnings,proto3" json:"warnings,omitempty"` + Warnings []*ImportMemosIssue `protobuf:"bytes,9,rep,name=warnings,proto3" json:"warnings,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } -func (x *MemoImportPlan) Reset() { - *x = MemoImportPlan{} - mi := &file_api_v1_user_service_proto_msgTypes[15] +func (x *ImportMemosPlan) Reset() { + *x = ImportMemosPlan{} + mi := &file_api_user_service_proto_msgTypes[54] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } -func (x *MemoImportPlan) String() string { +func (x *ImportMemosPlan) String() string { return protoimpl.X.MessageStringOf(x) } -func (*MemoImportPlan) ProtoMessage() {} +func (*ImportMemosPlan) ProtoMessage() {} -func (x *MemoImportPlan) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[15] +func (x *ImportMemosPlan) ProtoReflect() protoreflect.Message { + mi := &file_api_user_service_proto_msgTypes[54] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1526,103 +3952,108 @@ func (x *MemoImportPlan) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use MemoImportPlan.ProtoReflect.Descriptor instead. -func (*MemoImportPlan) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{15} +// Deprecated: Use ImportMemosPlan.ProtoReflect.Descriptor instead. +func (*ImportMemosPlan) Descriptor() ([]byte, []int) { + return file_api_user_service_proto_rawDescGZIP(), []int{54} } -func (x *MemoImportPlan) GetExportTime() *timestamppb.Timestamp { +func (x *ImportMemosPlan) GetExportTime() *timestamppb.Timestamp { if x != nil { return x.ExportTime } return nil } -func (x *MemoImportPlan) GetExporter() string { +func (x *ImportMemosPlan) GetExporter() string { if x != nil { return x.Exporter } return "" } -func (x *MemoImportPlan) GetGenerator() string { +func (x *ImportMemosPlan) GetGenerator() string { if x != nil { return x.Generator } return "" } -func (x *MemoImportPlan) GetMemos() int32 { +func (x *ImportMemosPlan) GetMemoCount() int32 { if x != nil { - return x.Memos + return x.MemoCount } return 0 } -func (x *MemoImportPlan) GetAttachments() int32 { +func (x *ImportMemosPlan) GetAttachmentCount() int32 { if x != nil { - return x.Attachments + return x.AttachmentCount } return 0 } -func (x *MemoImportPlan) GetNew() int32 { +func (x *ImportMemosPlan) GetNew() int32 { if x != nil { return x.New } return 0 } -func (x *MemoImportPlan) GetExisting() int32 { +func (x *ImportMemosPlan) GetExisting() int32 { if x != nil { return x.Existing } return 0 } -func (x *MemoImportPlan) GetRenamed() int32 { +func (x *ImportMemosPlan) GetRenamed() int32 { if x != nil { return x.Renamed } return 0 } -func (x *MemoImportPlan) GetWarnings() []*MemoImportIssue { +func (x *ImportMemosPlan) GetWarnings() []*ImportMemosIssue { if x != nil { return x.Warnings } return nil } -// MemoImportReport is the outcome of an import. -type MemoImportReport struct { - state protoimpl.MessageState `protogen:"open.v1"` - Created int32 `protobuf:"varint,1,opt,name=created,proto3" json:"created,omitempty"` - Updated int32 `protobuf:"varint,2,opt,name=updated,proto3" json:"updated,omitempty"` - Skipped int32 `protobuf:"varint,3,opt,name=skipped,proto3" json:"skipped,omitempty"` - Failed int32 `protobuf:"varint,4,opt,name=failed,proto3" json:"failed,omitempty"` - Warnings []*MemoImportIssue `protobuf:"bytes,5,rep,name=warnings,proto3" json:"warnings,omitempty"` +// ImportMemosReport is the outcome of an import. +type ImportMemosReport struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Number of memos created. + Created int32 `protobuf:"varint,1,opt,name=created,proto3" json:"created,omitempty"` + // Number of existing memos replaced under the REPLACE policy. + Updated int32 `protobuf:"varint,2,opt,name=updated,proto3" json:"updated,omitempty"` + // Number of existing memos left untouched under the SKIP policy. + Skipped int32 `protobuf:"varint,3,opt,name=skipped,proto3" json:"skipped,omitempty"` + // Number of memos that could not be imported. + Failed int32 `protobuf:"varint,4,opt,name=failed,proto3" json:"failed,omitempty"` + // Deviations the importer corrected or tolerated. + Warnings []*ImportMemosIssue `protobuf:"bytes,5,rep,name=warnings,proto3" json:"warnings,omitempty"` // One entry per failed memo, with the reason. - Failures []*MemoImportIssue `protobuf:"bytes,6,rep,name=failures,proto3" json:"failures,omitempty"` + Failures []*ImportMemosIssue `protobuf:"bytes,6,rep,name=failures,proto3" json:"failures,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } -func (x *MemoImportReport) Reset() { - *x = MemoImportReport{} - mi := &file_api_v1_user_service_proto_msgTypes[16] +func (x *ImportMemosReport) Reset() { + *x = ImportMemosReport{} + mi := &file_api_user_service_proto_msgTypes[55] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } -func (x *MemoImportReport) String() string { +func (x *ImportMemosReport) String() string { return protoimpl.X.MessageStringOf(x) } -func (*MemoImportReport) ProtoMessage() {} +func (*ImportMemosReport) ProtoMessage() {} -func (x *MemoImportReport) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[16] +func (x *ImportMemosReport) ProtoReflect() protoreflect.Message { + mi := &file_api_user_service_proto_msgTypes[55] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1633,80 +4064,80 @@ func (x *MemoImportReport) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use MemoImportReport.ProtoReflect.Descriptor instead. -func (*MemoImportReport) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{16} +// Deprecated: Use ImportMemosReport.ProtoReflect.Descriptor instead. +func (*ImportMemosReport) Descriptor() ([]byte, []int) { + return file_api_user_service_proto_rawDescGZIP(), []int{55} } -func (x *MemoImportReport) GetCreated() int32 { +func (x *ImportMemosReport) GetCreated() int32 { if x != nil { return x.Created } return 0 } -func (x *MemoImportReport) GetUpdated() int32 { +func (x *ImportMemosReport) GetUpdated() int32 { if x != nil { return x.Updated } return 0 } -func (x *MemoImportReport) GetSkipped() int32 { +func (x *ImportMemosReport) GetSkipped() int32 { if x != nil { return x.Skipped } return 0 } -func (x *MemoImportReport) GetFailed() int32 { +func (x *ImportMemosReport) GetFailed() int32 { if x != nil { return x.Failed } return 0 } -func (x *MemoImportReport) GetWarnings() []*MemoImportIssue { +func (x *ImportMemosReport) GetWarnings() []*ImportMemosIssue { if x != nil { return x.Warnings } return nil } -func (x *MemoImportReport) GetFailures() []*MemoImportIssue { +func (x *ImportMemosReport) GetFailures() []*ImportMemosIssue { if x != nil { return x.Failures } return nil } -type GetUserStatsRequest struct { +// ImportMemosIssue is one warning or failure of an import, tied to the memo +// UID from the archive when there is one. +type ImportMemosIssue struct { state protoimpl.MessageState `protogen:"open.v1"` - // Required. The resource name of the user. - // Format: users/{user} - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Optional. CEL expression selecting the readable non-comment memos to - // include. Supports the same fields as ListMemos, including `space`. - Filter string `protobuf:"bytes,2,opt,name=filter,proto3" json:"filter,omitempty"` + // The archive memo UID the issue concerns, if any. + MemoUid string `protobuf:"bytes,1,opt,name=memo_uid,json=memoUid,proto3" json:"memo_uid,omitempty"` + // A description of the issue. + Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } -func (x *GetUserStatsRequest) Reset() { - *x = GetUserStatsRequest{} - mi := &file_api_v1_user_service_proto_msgTypes[17] +func (x *ImportMemosIssue) Reset() { + *x = ImportMemosIssue{} + mi := &file_api_user_service_proto_msgTypes[56] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } -func (x *GetUserStatsRequest) String() string { +func (x *ImportMemosIssue) String() string { return protoimpl.X.MessageStringOf(x) } -func (*GetUserStatsRequest) ProtoMessage() {} +func (*ImportMemosIssue) ProtoMessage() {} -func (x *GetUserStatsRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[17] +func (x *ImportMemosIssue) ProtoReflect() protoreflect.Message { + mi := &file_api_user_service_proto_msgTypes[56] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1717,2437 +4148,46 @@ func (x *GetUserStatsRequest) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use GetUserStatsRequest.ProtoReflect.Descriptor instead. -func (*GetUserStatsRequest) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{17} +// Deprecated: Use ImportMemosIssue.ProtoReflect.Descriptor instead. +func (*ImportMemosIssue) Descriptor() ([]byte, []int) { + return file_api_user_service_proto_rawDescGZIP(), []int{56} } -func (x *GetUserStatsRequest) GetName() string { +func (x *ImportMemosIssue) GetMemoUid() string { if x != nil { - return x.Name + return x.MemoUid } return "" } -func (x *GetUserStatsRequest) GetFilter() string { +func (x *ImportMemosIssue) GetMessage() string { if x != nil { - return x.Filter + return x.Message } return "" } -type ListAllUserStatsRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Optional. The state of memos to include. Defaults to NORMAL. - State State `protobuf:"varint,1,opt,name=state,proto3,enum=memos.api.v1.State" json:"state,omitempty"` - // Optional. Filter to apply to memo stats. - // Uses the same filter syntax as ListMemos. - Filter string `protobuf:"bytes,2,opt,name=filter,proto3" json:"filter,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ListAllUserStatsRequest) Reset() { - *x = ListAllUserStatsRequest{} - mi := &file_api_v1_user_service_proto_msgTypes[18] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ListAllUserStatsRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ListAllUserStatsRequest) ProtoMessage() {} - -func (x *ListAllUserStatsRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[18] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ListAllUserStatsRequest.ProtoReflect.Descriptor instead. -func (*ListAllUserStatsRequest) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{18} -} - -func (x *ListAllUserStatsRequest) GetState() State { - if x != nil { - return x.State - } - return State_STATE_UNSPECIFIED -} - -func (x *ListAllUserStatsRequest) GetFilter() string { - if x != nil { - return x.Filter - } - return "" -} - -type ListAllUserStatsResponse struct { - state protoimpl.MessageState `protogen:"open.v1"` - // The list of user statistics. - Stats []*UserStats `protobuf:"bytes,1,rep,name=stats,proto3" json:"stats,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ListAllUserStatsResponse) Reset() { - *x = ListAllUserStatsResponse{} - mi := &file_api_v1_user_service_proto_msgTypes[19] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ListAllUserStatsResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ListAllUserStatsResponse) ProtoMessage() {} - -func (x *ListAllUserStatsResponse) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[19] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ListAllUserStatsResponse.ProtoReflect.Descriptor instead. -func (*ListAllUserStatsResponse) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{19} -} - -func (x *ListAllUserStatsResponse) GetStats() []*UserStats { - if x != nil { - return x.Stats - } - return nil -} - -// User settings message -type UserSetting struct { - state protoimpl.MessageState `protogen:"open.v1"` - // The name of the user setting. - // Format: users/{user}/settings/{setting}, {setting} is the key for the setting. - // For example, "users/steven/settings/GENERAL" for general settings. - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Types that are valid to be assigned to Value: - // - // *UserSetting_GeneralSetting_ - // *UserSetting_WebhooksSetting_ - // *UserSetting_TagsSetting_ - Value isUserSetting_Value `protobuf_oneof:"value"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *UserSetting) Reset() { - *x = UserSetting{} - mi := &file_api_v1_user_service_proto_msgTypes[20] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *UserSetting) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UserSetting) ProtoMessage() {} - -func (x *UserSetting) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[20] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UserSetting.ProtoReflect.Descriptor instead. -func (*UserSetting) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{20} -} - -func (x *UserSetting) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *UserSetting) GetValue() isUserSetting_Value { - if x != nil { - return x.Value - } - return nil -} - -func (x *UserSetting) GetGeneralSetting() *UserSetting_GeneralSetting { - if x != nil { - if x, ok := x.Value.(*UserSetting_GeneralSetting_); ok { - return x.GeneralSetting - } - } - return nil -} - -func (x *UserSetting) GetWebhooksSetting() *UserSetting_WebhooksSetting { - if x != nil { - if x, ok := x.Value.(*UserSetting_WebhooksSetting_); ok { - return x.WebhooksSetting - } - } - return nil -} - -func (x *UserSetting) GetTagsSetting() *UserSetting_TagsSetting { - if x != nil { - if x, ok := x.Value.(*UserSetting_TagsSetting_); ok { - return x.TagsSetting - } - } - return nil -} - -type isUserSetting_Value interface { - isUserSetting_Value() -} - -type UserSetting_GeneralSetting_ struct { - GeneralSetting *UserSetting_GeneralSetting `protobuf:"bytes,2,opt,name=general_setting,json=generalSetting,proto3,oneof"` -} - -type UserSetting_WebhooksSetting_ struct { - WebhooksSetting *UserSetting_WebhooksSetting `protobuf:"bytes,5,opt,name=webhooks_setting,json=webhooksSetting,proto3,oneof"` -} - -type UserSetting_TagsSetting_ struct { - TagsSetting *UserSetting_TagsSetting `protobuf:"bytes,6,opt,name=tags_setting,json=tagsSetting,proto3,oneof"` -} - -func (*UserSetting_GeneralSetting_) isUserSetting_Value() {} - -func (*UserSetting_WebhooksSetting_) isUserSetting_Value() {} - -func (*UserSetting_TagsSetting_) isUserSetting_Value() {} - -type GetUserSettingRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Required. The resource name of the user setting. - // Format: users/{user}/settings/{setting} - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *GetUserSettingRequest) Reset() { - *x = GetUserSettingRequest{} - mi := &file_api_v1_user_service_proto_msgTypes[21] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *GetUserSettingRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetUserSettingRequest) ProtoMessage() {} - -func (x *GetUserSettingRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[21] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetUserSettingRequest.ProtoReflect.Descriptor instead. -func (*GetUserSettingRequest) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{21} -} - -func (x *GetUserSettingRequest) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -type UpdateUserSettingRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Required. The user setting to update. - Setting *UserSetting `protobuf:"bytes,1,opt,name=setting,proto3" json:"setting,omitempty"` - // Required. The list of fields to update. - UpdateMask *fieldmaskpb.FieldMask `protobuf:"bytes,2,opt,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *UpdateUserSettingRequest) Reset() { - *x = UpdateUserSettingRequest{} - mi := &file_api_v1_user_service_proto_msgTypes[22] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *UpdateUserSettingRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateUserSettingRequest) ProtoMessage() {} - -func (x *UpdateUserSettingRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[22] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateUserSettingRequest.ProtoReflect.Descriptor instead. -func (*UpdateUserSettingRequest) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{22} -} - -func (x *UpdateUserSettingRequest) GetSetting() *UserSetting { - if x != nil { - return x.Setting - } - return nil -} - -func (x *UpdateUserSettingRequest) GetUpdateMask() *fieldmaskpb.FieldMask { - if x != nil { - return x.UpdateMask - } - return nil -} - -// Request message for ListUserSettings method. -type ListUserSettingsRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Required. The parent resource whose settings will be listed. - // Format: users/{user} - Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"` - // Optional. The maximum number of settings to return. - // The service may return fewer than this value. - // If unspecified, at most 50 settings will be returned. - // The maximum value is 1000; values above 1000 will be coerced to 1000. - PageSize int32 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` - // Optional. A page token, received from a previous `ListUserSettings` call. - // Provide this to retrieve the subsequent page. - PageToken string `protobuf:"bytes,3,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ListUserSettingsRequest) Reset() { - *x = ListUserSettingsRequest{} - mi := &file_api_v1_user_service_proto_msgTypes[23] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ListUserSettingsRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ListUserSettingsRequest) ProtoMessage() {} - -func (x *ListUserSettingsRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[23] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ListUserSettingsRequest.ProtoReflect.Descriptor instead. -func (*ListUserSettingsRequest) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{23} -} - -func (x *ListUserSettingsRequest) GetParent() string { - if x != nil { - return x.Parent - } - return "" -} - -func (x *ListUserSettingsRequest) GetPageSize() int32 { - if x != nil { - return x.PageSize - } - return 0 -} - -func (x *ListUserSettingsRequest) GetPageToken() string { - if x != nil { - return x.PageToken - } - return "" -} - -// Response message for ListUserSettings method. -type ListUserSettingsResponse struct { - state protoimpl.MessageState `protogen:"open.v1"` - // The list of user settings. - Settings []*UserSetting `protobuf:"bytes,1,rep,name=settings,proto3" json:"settings,omitempty"` - // A token that can be sent as `page_token` to retrieve the next page. - // If this field is omitted, there are no subsequent pages. - NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ListUserSettingsResponse) Reset() { - *x = ListUserSettingsResponse{} - mi := &file_api_v1_user_service_proto_msgTypes[24] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ListUserSettingsResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ListUserSettingsResponse) ProtoMessage() {} - -func (x *ListUserSettingsResponse) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[24] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ListUserSettingsResponse.ProtoReflect.Descriptor instead. -func (*ListUserSettingsResponse) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{24} -} - -func (x *ListUserSettingsResponse) GetSettings() []*UserSetting { - if x != nil { - return x.Settings - } - return nil -} - -func (x *ListUserSettingsResponse) GetNextPageToken() string { - if x != nil { - return x.NextPageToken - } - return "" -} - -// Saved memo view messages -type MemoView struct { - state protoimpl.MessageState `protogen:"open.v1"` - // The resource name of the memo view. - // Format: users/{user}/views/{view} - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // The title of the memo view. - Title string `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"` - // The CEL filter expression for the memo view, using the same grammar as the - // ListMemos `filter` argument. Reuse it by passing this value to ListMemos. - Filter string `protobuf:"bytes,3,opt,name=filter,proto3" json:"filter,omitempty"` - // Optional. Display icon. Omit when updating with the "icon" mask to reset - // to the default view icon. - Icon *MemoView_Icon `protobuf:"bytes,4,opt,name=icon,proto3" json:"icon,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *MemoView) Reset() { - *x = MemoView{} - mi := &file_api_v1_user_service_proto_msgTypes[25] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *MemoView) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MemoView) ProtoMessage() {} - -func (x *MemoView) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[25] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MemoView.ProtoReflect.Descriptor instead. -func (*MemoView) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{25} -} - -func (x *MemoView) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *MemoView) GetTitle() string { - if x != nil { - return x.Title - } - return "" -} - -func (x *MemoView) GetFilter() string { - if x != nil { - return x.Filter - } - return "" -} - -func (x *MemoView) GetIcon() *MemoView_Icon { - if x != nil { - return x.Icon - } - return nil -} - -type ListMemoViewsRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Required. The parent resource where memo views are listed. - // Format: users/{user} - Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ListMemoViewsRequest) Reset() { - *x = ListMemoViewsRequest{} - mi := &file_api_v1_user_service_proto_msgTypes[26] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ListMemoViewsRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ListMemoViewsRequest) ProtoMessage() {} - -func (x *ListMemoViewsRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[26] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ListMemoViewsRequest.ProtoReflect.Descriptor instead. -func (*ListMemoViewsRequest) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{26} -} - -func (x *ListMemoViewsRequest) GetParent() string { - if x != nil { - return x.Parent - } - return "" -} - -type ListMemoViewsResponse struct { - state protoimpl.MessageState `protogen:"open.v1"` - // The list of memo views. - MemoViews []*MemoView `protobuf:"bytes,1,rep,name=memo_views,json=memoViews,proto3" json:"memo_views,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ListMemoViewsResponse) Reset() { - *x = ListMemoViewsResponse{} - mi := &file_api_v1_user_service_proto_msgTypes[27] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ListMemoViewsResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ListMemoViewsResponse) ProtoMessage() {} - -func (x *ListMemoViewsResponse) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[27] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ListMemoViewsResponse.ProtoReflect.Descriptor instead. -func (*ListMemoViewsResponse) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{27} -} - -func (x *ListMemoViewsResponse) GetMemoViews() []*MemoView { - if x != nil { - return x.MemoViews - } - return nil -} - -type GetMemoViewRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Required. The resource name of the memo view to retrieve. - // Format: users/{user}/views/{view} - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *GetMemoViewRequest) Reset() { - *x = GetMemoViewRequest{} - mi := &file_api_v1_user_service_proto_msgTypes[28] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *GetMemoViewRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetMemoViewRequest) ProtoMessage() {} - -func (x *GetMemoViewRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[28] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetMemoViewRequest.ProtoReflect.Descriptor instead. -func (*GetMemoViewRequest) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{28} -} - -func (x *GetMemoViewRequest) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -type CreateMemoViewRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Required. The parent resource where this memo view will be created. - // Format: users/{user} - Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"` - // Required. The memo view to create. - MemoView *MemoView `protobuf:"bytes,2,opt,name=memo_view,json=memoView,proto3" json:"memo_view,omitempty"` - // Optional. If set, validate the request, but do not actually create the memo view. - ValidateOnly bool `protobuf:"varint,3,opt,name=validate_only,json=validateOnly,proto3" json:"validate_only,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *CreateMemoViewRequest) Reset() { - *x = CreateMemoViewRequest{} - mi := &file_api_v1_user_service_proto_msgTypes[29] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *CreateMemoViewRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CreateMemoViewRequest) ProtoMessage() {} - -func (x *CreateMemoViewRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[29] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CreateMemoViewRequest.ProtoReflect.Descriptor instead. -func (*CreateMemoViewRequest) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{29} -} - -func (x *CreateMemoViewRequest) GetParent() string { - if x != nil { - return x.Parent - } - return "" -} - -func (x *CreateMemoViewRequest) GetMemoView() *MemoView { - if x != nil { - return x.MemoView - } - return nil -} - -func (x *CreateMemoViewRequest) GetValidateOnly() bool { - if x != nil { - return x.ValidateOnly - } - return false -} - -type UpdateMemoViewRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Required. The memo view resource which replaces the resource on the server. - MemoView *MemoView `protobuf:"bytes,1,opt,name=memo_view,json=memoView,proto3" json:"memo_view,omitempty"` - // Optional. The list of fields to update. - UpdateMask *fieldmaskpb.FieldMask `protobuf:"bytes,2,opt,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *UpdateMemoViewRequest) Reset() { - *x = UpdateMemoViewRequest{} - mi := &file_api_v1_user_service_proto_msgTypes[30] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *UpdateMemoViewRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateMemoViewRequest) ProtoMessage() {} - -func (x *UpdateMemoViewRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[30] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateMemoViewRequest.ProtoReflect.Descriptor instead. -func (*UpdateMemoViewRequest) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{30} -} - -func (x *UpdateMemoViewRequest) GetMemoView() *MemoView { - if x != nil { - return x.MemoView - } - return nil -} - -func (x *UpdateMemoViewRequest) GetUpdateMask() *fieldmaskpb.FieldMask { - if x != nil { - return x.UpdateMask - } - return nil -} - -type DeleteMemoViewRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Required. The resource name of the memo view to delete. - // Format: users/{user}/views/{view} - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *DeleteMemoViewRequest) Reset() { - *x = DeleteMemoViewRequest{} - mi := &file_api_v1_user_service_proto_msgTypes[31] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *DeleteMemoViewRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DeleteMemoViewRequest) ProtoMessage() {} - -func (x *DeleteMemoViewRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[31] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DeleteMemoViewRequest.ProtoReflect.Descriptor instead. -func (*DeleteMemoViewRequest) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{31} -} - -func (x *DeleteMemoViewRequest) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -// LinkedIdentity represents an SSO identity linked to a user account. -type LinkedIdentity struct { - state protoimpl.MessageState `protogen:"open.v1"` - // The resource name of the linked identity. - // Format: users/{user}/linkedIdentities/{linked_identity} - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // The resource name of the identity provider. - // Format: identity-providers/{idp} - IdpName string `protobuf:"bytes,2,opt,name=idp_name,json=idpName,proto3" json:"idp_name,omitempty"` - // The external user identifier from the identity provider. - ExternUid string `protobuf:"bytes,3,opt,name=extern_uid,json=externUid,proto3" json:"extern_uid,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *LinkedIdentity) Reset() { - *x = LinkedIdentity{} - mi := &file_api_v1_user_service_proto_msgTypes[32] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *LinkedIdentity) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*LinkedIdentity) ProtoMessage() {} - -func (x *LinkedIdentity) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[32] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use LinkedIdentity.ProtoReflect.Descriptor instead. -func (*LinkedIdentity) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{32} -} - -func (x *LinkedIdentity) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *LinkedIdentity) GetIdpName() string { - if x != nil { - return x.IdpName - } - return "" -} - -func (x *LinkedIdentity) GetExternUid() string { - if x != nil { - return x.ExternUid - } - return "" -} - -type ListLinkedIdentitiesRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Required. The parent resource whose linked identities will be listed. - // Format: users/{user} - Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ListLinkedIdentitiesRequest) Reset() { - *x = ListLinkedIdentitiesRequest{} - mi := &file_api_v1_user_service_proto_msgTypes[33] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ListLinkedIdentitiesRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ListLinkedIdentitiesRequest) ProtoMessage() {} - -func (x *ListLinkedIdentitiesRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[33] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ListLinkedIdentitiesRequest.ProtoReflect.Descriptor instead. -func (*ListLinkedIdentitiesRequest) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{33} -} - -func (x *ListLinkedIdentitiesRequest) GetParent() string { - if x != nil { - return x.Parent - } - return "" -} - -type ListLinkedIdentitiesResponse struct { - state protoimpl.MessageState `protogen:"open.v1"` - // The list of linked identities. - LinkedIdentities []*LinkedIdentity `protobuf:"bytes,1,rep,name=linked_identities,json=linkedIdentities,proto3" json:"linked_identities,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ListLinkedIdentitiesResponse) Reset() { - *x = ListLinkedIdentitiesResponse{} - mi := &file_api_v1_user_service_proto_msgTypes[34] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ListLinkedIdentitiesResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ListLinkedIdentitiesResponse) ProtoMessage() {} - -func (x *ListLinkedIdentitiesResponse) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[34] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ListLinkedIdentitiesResponse.ProtoReflect.Descriptor instead. -func (*ListLinkedIdentitiesResponse) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{34} -} - -func (x *ListLinkedIdentitiesResponse) GetLinkedIdentities() []*LinkedIdentity { - if x != nil { - return x.LinkedIdentities - } - return nil -} - -type CreateLinkedIdentityRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Required. The parent user who owns the linked identity. - // Format: users/{user} - Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"` - // Required. The identity provider to link. - // Format: identity-providers/{idp} - IdpName string `protobuf:"bytes,2,opt,name=idp_name,json=idpName,proto3" json:"idp_name,omitempty"` - // Required. The authorization code from the identity provider. - Code string `protobuf:"bytes,3,opt,name=code,proto3" json:"code,omitempty"` - // Required. The redirect URI used in the OAuth flow. - RedirectUri string `protobuf:"bytes,4,opt,name=redirect_uri,json=redirectUri,proto3" json:"redirect_uri,omitempty"` - // Optional. The PKCE code verifier used in the OAuth flow. - CodeVerifier string `protobuf:"bytes,5,opt,name=code_verifier,json=codeVerifier,proto3" json:"code_verifier,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *CreateLinkedIdentityRequest) Reset() { - *x = CreateLinkedIdentityRequest{} - mi := &file_api_v1_user_service_proto_msgTypes[35] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *CreateLinkedIdentityRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CreateLinkedIdentityRequest) ProtoMessage() {} - -func (x *CreateLinkedIdentityRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[35] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CreateLinkedIdentityRequest.ProtoReflect.Descriptor instead. -func (*CreateLinkedIdentityRequest) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{35} -} - -func (x *CreateLinkedIdentityRequest) GetParent() string { - if x != nil { - return x.Parent - } - return "" -} - -func (x *CreateLinkedIdentityRequest) GetIdpName() string { - if x != nil { - return x.IdpName - } - return "" -} - -func (x *CreateLinkedIdentityRequest) GetCode() string { - if x != nil { - return x.Code - } - return "" -} - -func (x *CreateLinkedIdentityRequest) GetRedirectUri() string { - if x != nil { - return x.RedirectUri - } - return "" -} - -func (x *CreateLinkedIdentityRequest) GetCodeVerifier() string { - if x != nil { - return x.CodeVerifier - } - return "" -} - -type GetLinkedIdentityRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Required. The resource name of the linked identity to get. - // Format: users/{user}/linkedIdentities/{linked_identity} - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *GetLinkedIdentityRequest) Reset() { - *x = GetLinkedIdentityRequest{} - mi := &file_api_v1_user_service_proto_msgTypes[36] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *GetLinkedIdentityRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetLinkedIdentityRequest) ProtoMessage() {} - -func (x *GetLinkedIdentityRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[36] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetLinkedIdentityRequest.ProtoReflect.Descriptor instead. -func (*GetLinkedIdentityRequest) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{36} -} - -func (x *GetLinkedIdentityRequest) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -type DeleteLinkedIdentityRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Required. The resource name of the linked identity to delete. - // Format: users/{user}/linkedIdentities/{linked_identity} - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *DeleteLinkedIdentityRequest) Reset() { - *x = DeleteLinkedIdentityRequest{} - mi := &file_api_v1_user_service_proto_msgTypes[37] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *DeleteLinkedIdentityRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DeleteLinkedIdentityRequest) ProtoMessage() {} - -func (x *DeleteLinkedIdentityRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[37] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DeleteLinkedIdentityRequest.ProtoReflect.Descriptor instead. -func (*DeleteLinkedIdentityRequest) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{37} -} - -func (x *DeleteLinkedIdentityRequest) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -// PersonalAccessToken represents a long-lived token for API/script access. -// PATs are distinct from short-lived JWT access tokens used for session authentication. -type PersonalAccessToken struct { - state protoimpl.MessageState `protogen:"open.v1"` - // The resource name of the personal access token. - // Format: users/{user}/personalAccessTokens/{personal_access_token} - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // The description of the token. - Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` - // Output only. The creation timestamp. - CreatedAt *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` - // Optional. The expiration timestamp. - ExpiresAt *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=expires_at,json=expiresAt,proto3" json:"expires_at,omitempty"` - // Output only. The last used timestamp. - LastUsedAt *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=last_used_at,json=lastUsedAt,proto3" json:"last_used_at,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *PersonalAccessToken) Reset() { - *x = PersonalAccessToken{} - mi := &file_api_v1_user_service_proto_msgTypes[38] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *PersonalAccessToken) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PersonalAccessToken) ProtoMessage() {} - -func (x *PersonalAccessToken) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[38] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PersonalAccessToken.ProtoReflect.Descriptor instead. -func (*PersonalAccessToken) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{38} -} - -func (x *PersonalAccessToken) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *PersonalAccessToken) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *PersonalAccessToken) GetCreatedAt() *timestamppb.Timestamp { - if x != nil { - return x.CreatedAt - } - return nil -} - -func (x *PersonalAccessToken) GetExpiresAt() *timestamppb.Timestamp { - if x != nil { - return x.ExpiresAt - } - return nil -} - -func (x *PersonalAccessToken) GetLastUsedAt() *timestamppb.Timestamp { - if x != nil { - return x.LastUsedAt - } - return nil -} - -type ListPersonalAccessTokensRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Required. The parent resource whose personal access tokens will be listed. - // Format: users/{user} - Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"` - // Optional. The maximum number of tokens to return. - PageSize int32 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` - // Optional. A page token for pagination. - PageToken string `protobuf:"bytes,3,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ListPersonalAccessTokensRequest) Reset() { - *x = ListPersonalAccessTokensRequest{} - mi := &file_api_v1_user_service_proto_msgTypes[39] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ListPersonalAccessTokensRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ListPersonalAccessTokensRequest) ProtoMessage() {} - -func (x *ListPersonalAccessTokensRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[39] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ListPersonalAccessTokensRequest.ProtoReflect.Descriptor instead. -func (*ListPersonalAccessTokensRequest) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{39} -} - -func (x *ListPersonalAccessTokensRequest) GetParent() string { - if x != nil { - return x.Parent - } - return "" -} - -func (x *ListPersonalAccessTokensRequest) GetPageSize() int32 { - if x != nil { - return x.PageSize - } - return 0 -} - -func (x *ListPersonalAccessTokensRequest) GetPageToken() string { - if x != nil { - return x.PageToken - } - return "" -} - -type ListPersonalAccessTokensResponse struct { - state protoimpl.MessageState `protogen:"open.v1"` - // The list of personal access tokens. - PersonalAccessTokens []*PersonalAccessToken `protobuf:"bytes,1,rep,name=personal_access_tokens,json=personalAccessTokens,proto3" json:"personal_access_tokens,omitempty"` - // A token for the next page of results. - NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ListPersonalAccessTokensResponse) Reset() { - *x = ListPersonalAccessTokensResponse{} - mi := &file_api_v1_user_service_proto_msgTypes[40] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ListPersonalAccessTokensResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ListPersonalAccessTokensResponse) ProtoMessage() {} - -func (x *ListPersonalAccessTokensResponse) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[40] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ListPersonalAccessTokensResponse.ProtoReflect.Descriptor instead. -func (*ListPersonalAccessTokensResponse) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{40} -} - -func (x *ListPersonalAccessTokensResponse) GetPersonalAccessTokens() []*PersonalAccessToken { - if x != nil { - return x.PersonalAccessTokens - } - return nil -} - -func (x *ListPersonalAccessTokensResponse) GetNextPageToken() string { - if x != nil { - return x.NextPageToken - } - return "" -} - -type CreatePersonalAccessTokenRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Required. The parent resource where this token will be created. - // Format: users/{user} - Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"` - // Optional. Description of the personal access token. - Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` - // Optional. Expiration duration in days (0 = never expires). - ExpiresInDays int32 `protobuf:"varint,3,opt,name=expires_in_days,json=expiresInDays,proto3" json:"expires_in_days,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *CreatePersonalAccessTokenRequest) Reset() { - *x = CreatePersonalAccessTokenRequest{} - mi := &file_api_v1_user_service_proto_msgTypes[41] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *CreatePersonalAccessTokenRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CreatePersonalAccessTokenRequest) ProtoMessage() {} - -func (x *CreatePersonalAccessTokenRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[41] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CreatePersonalAccessTokenRequest.ProtoReflect.Descriptor instead. -func (*CreatePersonalAccessTokenRequest) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{41} -} - -func (x *CreatePersonalAccessTokenRequest) GetParent() string { - if x != nil { - return x.Parent - } - return "" -} - -func (x *CreatePersonalAccessTokenRequest) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *CreatePersonalAccessTokenRequest) GetExpiresInDays() int32 { - if x != nil { - return x.ExpiresInDays - } - return 0 -} - -type CreatePersonalAccessTokenResponse struct { - state protoimpl.MessageState `protogen:"open.v1"` - // The personal access token metadata. - PersonalAccessToken *PersonalAccessToken `protobuf:"bytes,1,opt,name=personal_access_token,json=personalAccessToken,proto3" json:"personal_access_token,omitempty"` - // The actual token value - only returned on creation. - // This is the only time the token value will be visible. - Token string `protobuf:"bytes,2,opt,name=token,proto3" json:"token,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *CreatePersonalAccessTokenResponse) Reset() { - *x = CreatePersonalAccessTokenResponse{} - mi := &file_api_v1_user_service_proto_msgTypes[42] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *CreatePersonalAccessTokenResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CreatePersonalAccessTokenResponse) ProtoMessage() {} - -func (x *CreatePersonalAccessTokenResponse) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[42] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CreatePersonalAccessTokenResponse.ProtoReflect.Descriptor instead. -func (*CreatePersonalAccessTokenResponse) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{42} -} - -func (x *CreatePersonalAccessTokenResponse) GetPersonalAccessToken() *PersonalAccessToken { - if x != nil { - return x.PersonalAccessToken - } - return nil -} - -func (x *CreatePersonalAccessTokenResponse) GetToken() string { - if x != nil { - return x.Token - } - return "" -} - -type DeletePersonalAccessTokenRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Required. The resource name of the personal access token to delete. - // Format: users/{user}/personalAccessTokens/{personal_access_token} - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *DeletePersonalAccessTokenRequest) Reset() { - *x = DeletePersonalAccessTokenRequest{} - mi := &file_api_v1_user_service_proto_msgTypes[43] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *DeletePersonalAccessTokenRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DeletePersonalAccessTokenRequest) ProtoMessage() {} - -func (x *DeletePersonalAccessTokenRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[43] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DeletePersonalAccessTokenRequest.ProtoReflect.Descriptor instead. -func (*DeletePersonalAccessTokenRequest) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{43} -} - -func (x *DeletePersonalAccessTokenRequest) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -// UserWebhook represents a webhook owned by a user. -type UserWebhook struct { - state protoimpl.MessageState `protogen:"open.v1"` - // The name of the webhook. - // Format: users/{user}/webhooks/{webhook} - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // The URL to send the webhook to. - Url string `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"` - // Optional. Human-readable name for the webhook. - DisplayName string `protobuf:"bytes,3,opt,name=display_name,json=displayName,proto3" json:"display_name,omitempty"` - // The creation time of the webhook. - CreateTime *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty"` - // The last update time of the webhook. - UpdateTime *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=update_time,json=updateTime,proto3" json:"update_time,omitempty"` - // Optional. Signing secret used to HMAC-SHA256 sign the webhook request body. - // This field is input-only; it is never returned in responses. - SigningSecret string `protobuf:"bytes,6,opt,name=signing_secret,json=signingSecret,proto3" json:"signing_secret,omitempty"` - // Whether a signing secret is configured for this webhook. - SigningSecretSet bool `protobuf:"varint,7,opt,name=signing_secret_set,json=signingSecretSet,proto3" json:"signing_secret_set,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *UserWebhook) Reset() { - *x = UserWebhook{} - mi := &file_api_v1_user_service_proto_msgTypes[44] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *UserWebhook) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UserWebhook) ProtoMessage() {} - -func (x *UserWebhook) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[44] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UserWebhook.ProtoReflect.Descriptor instead. -func (*UserWebhook) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{44} -} - -func (x *UserWebhook) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *UserWebhook) GetUrl() string { - if x != nil { - return x.Url - } - return "" -} - -func (x *UserWebhook) GetDisplayName() string { - if x != nil { - return x.DisplayName - } - return "" -} - -func (x *UserWebhook) GetCreateTime() *timestamppb.Timestamp { - if x != nil { - return x.CreateTime - } - return nil -} - -func (x *UserWebhook) GetUpdateTime() *timestamppb.Timestamp { - if x != nil { - return x.UpdateTime - } - return nil -} - -func (x *UserWebhook) GetSigningSecret() string { - if x != nil { - return x.SigningSecret - } - return "" -} - -func (x *UserWebhook) GetSigningSecretSet() bool { - if x != nil { - return x.SigningSecretSet - } - return false -} - -type ListUserWebhooksRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - // The parent user resource. - // Format: users/{user} - Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ListUserWebhooksRequest) Reset() { - *x = ListUserWebhooksRequest{} - mi := &file_api_v1_user_service_proto_msgTypes[45] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ListUserWebhooksRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ListUserWebhooksRequest) ProtoMessage() {} - -func (x *ListUserWebhooksRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[45] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ListUserWebhooksRequest.ProtoReflect.Descriptor instead. -func (*ListUserWebhooksRequest) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{45} -} - -func (x *ListUserWebhooksRequest) GetParent() string { - if x != nil { - return x.Parent - } - return "" -} - -type ListUserWebhooksResponse struct { - state protoimpl.MessageState `protogen:"open.v1"` - // The list of webhooks. - Webhooks []*UserWebhook `protobuf:"bytes,1,rep,name=webhooks,proto3" json:"webhooks,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ListUserWebhooksResponse) Reset() { - *x = ListUserWebhooksResponse{} - mi := &file_api_v1_user_service_proto_msgTypes[46] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ListUserWebhooksResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ListUserWebhooksResponse) ProtoMessage() {} - -func (x *ListUserWebhooksResponse) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[46] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ListUserWebhooksResponse.ProtoReflect.Descriptor instead. -func (*ListUserWebhooksResponse) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{46} -} - -func (x *ListUserWebhooksResponse) GetWebhooks() []*UserWebhook { - if x != nil { - return x.Webhooks - } - return nil -} - -type CreateUserWebhookRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - // The parent user resource. - // Format: users/{user} - Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"` - // The webhook to create. - Webhook *UserWebhook `protobuf:"bytes,2,opt,name=webhook,proto3" json:"webhook,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *CreateUserWebhookRequest) Reset() { - *x = CreateUserWebhookRequest{} - mi := &file_api_v1_user_service_proto_msgTypes[47] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *CreateUserWebhookRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CreateUserWebhookRequest) ProtoMessage() {} - -func (x *CreateUserWebhookRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[47] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CreateUserWebhookRequest.ProtoReflect.Descriptor instead. -func (*CreateUserWebhookRequest) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{47} -} - -func (x *CreateUserWebhookRequest) GetParent() string { - if x != nil { - return x.Parent - } - return "" -} - -func (x *CreateUserWebhookRequest) GetWebhook() *UserWebhook { - if x != nil { - return x.Webhook - } - return nil -} - -type UpdateUserWebhookRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - // The webhook to update. - Webhook *UserWebhook `protobuf:"bytes,1,opt,name=webhook,proto3" json:"webhook,omitempty"` - // The list of fields to update. - UpdateMask *fieldmaskpb.FieldMask `protobuf:"bytes,2,opt,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *UpdateUserWebhookRequest) Reset() { - *x = UpdateUserWebhookRequest{} - mi := &file_api_v1_user_service_proto_msgTypes[48] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *UpdateUserWebhookRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateUserWebhookRequest) ProtoMessage() {} - -func (x *UpdateUserWebhookRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[48] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateUserWebhookRequest.ProtoReflect.Descriptor instead. -func (*UpdateUserWebhookRequest) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{48} -} - -func (x *UpdateUserWebhookRequest) GetWebhook() *UserWebhook { - if x != nil { - return x.Webhook - } - return nil -} - -func (x *UpdateUserWebhookRequest) GetUpdateMask() *fieldmaskpb.FieldMask { - if x != nil { - return x.UpdateMask - } - return nil -} - -type DeleteUserWebhookRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - // The name of the webhook to delete. - // Format: users/{user}/webhooks/{webhook} - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *DeleteUserWebhookRequest) Reset() { - *x = DeleteUserWebhookRequest{} - mi := &file_api_v1_user_service_proto_msgTypes[49] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *DeleteUserWebhookRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DeleteUserWebhookRequest) ProtoMessage() {} - -func (x *DeleteUserWebhookRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[49] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DeleteUserWebhookRequest.ProtoReflect.Descriptor instead. -func (*DeleteUserWebhookRequest) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{49} -} - -func (x *DeleteUserWebhookRequest) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -type GetUserWebhookSigningSecretRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - // The name of the webhook whose signing secret to reveal. - // Format: users/{user}/webhooks/{webhook} - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *GetUserWebhookSigningSecretRequest) Reset() { - *x = GetUserWebhookSigningSecretRequest{} - mi := &file_api_v1_user_service_proto_msgTypes[50] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *GetUserWebhookSigningSecretRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetUserWebhookSigningSecretRequest) ProtoMessage() {} - -func (x *GetUserWebhookSigningSecretRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[50] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetUserWebhookSigningSecretRequest.ProtoReflect.Descriptor instead. -func (*GetUserWebhookSigningSecretRequest) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{50} -} - -func (x *GetUserWebhookSigningSecretRequest) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -type GetUserWebhookSigningSecretResponse struct { - state protoimpl.MessageState `protogen:"open.v1"` - // The signing secret, in the Standard Webhooks "whsec_" form. - SigningSecret string `protobuf:"bytes,1,opt,name=signing_secret,json=signingSecret,proto3" json:"signing_secret,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *GetUserWebhookSigningSecretResponse) Reset() { - *x = GetUserWebhookSigningSecretResponse{} - mi := &file_api_v1_user_service_proto_msgTypes[51] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *GetUserWebhookSigningSecretResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetUserWebhookSigningSecretResponse) ProtoMessage() {} - -func (x *GetUserWebhookSigningSecretResponse) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[51] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetUserWebhookSigningSecretResponse.ProtoReflect.Descriptor instead. -func (*GetUserWebhookSigningSecretResponse) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{51} -} - -func (x *GetUserWebhookSigningSecretResponse) GetSigningSecret() string { - if x != nil { - return x.SigningSecret - } - return "" -} - -type UserNotification struct { - state protoimpl.MessageState `protogen:"open.v1"` - // The resource name of the notification. - // Format: users/{user}/notifications/{notification} - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // The sender of the notification. - // Format: users/{user} - Sender string `protobuf:"bytes,2,opt,name=sender,proto3" json:"sender,omitempty"` - // The sender user details. - SenderUser *User `protobuf:"bytes,8,opt,name=sender_user,json=senderUser,proto3" json:"sender_user,omitempty"` - // The status of the notification. - Status UserNotification_Status `protobuf:"varint,3,opt,name=status,proto3,enum=memos.api.v1.UserNotification_Status" json:"status,omitempty"` - // The creation timestamp. - CreateTime *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty"` - // The type of the notification. - Type UserNotification_Type `protobuf:"varint,5,opt,name=type,proto3,enum=memos.api.v1.UserNotification_Type" json:"type,omitempty"` - // Types that are valid to be assigned to Payload: - // - // *UserNotification_MemoComment - // *UserNotification_MemoMention - // *UserNotification_SpaceInvitation - Payload isUserNotification_Payload `protobuf_oneof:"payload"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *UserNotification) Reset() { - *x = UserNotification{} - mi := &file_api_v1_user_service_proto_msgTypes[52] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *UserNotification) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UserNotification) ProtoMessage() {} - -func (x *UserNotification) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[52] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UserNotification.ProtoReflect.Descriptor instead. -func (*UserNotification) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{52} -} - -func (x *UserNotification) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *UserNotification) GetSender() string { - if x != nil { - return x.Sender - } - return "" -} - -func (x *UserNotification) GetSenderUser() *User { - if x != nil { - return x.SenderUser - } - return nil -} - -func (x *UserNotification) GetStatus() UserNotification_Status { - if x != nil { - return x.Status - } - return UserNotification_STATUS_UNSPECIFIED -} - -func (x *UserNotification) GetCreateTime() *timestamppb.Timestamp { - if x != nil { - return x.CreateTime - } - return nil -} - -func (x *UserNotification) GetType() UserNotification_Type { - if x != nil { - return x.Type - } - return UserNotification_TYPE_UNSPECIFIED -} - -func (x *UserNotification) GetPayload() isUserNotification_Payload { - if x != nil { - return x.Payload - } - return nil -} - -func (x *UserNotification) GetMemoComment() *UserNotification_MemoCommentPayload { - if x != nil { - if x, ok := x.Payload.(*UserNotification_MemoComment); ok { - return x.MemoComment - } - } - return nil -} - -func (x *UserNotification) GetMemoMention() *UserNotification_MemoMentionPayload { - if x != nil { - if x, ok := x.Payload.(*UserNotification_MemoMention); ok { - return x.MemoMention - } - } - return nil -} - -func (x *UserNotification) GetSpaceInvitation() *UserNotification_SpaceInvitationPayload { - if x != nil { - if x, ok := x.Payload.(*UserNotification_SpaceInvitation); ok { - return x.SpaceInvitation - } - } - return nil -} - -type isUserNotification_Payload interface { - isUserNotification_Payload() -} - -type UserNotification_MemoComment struct { - MemoComment *UserNotification_MemoCommentPayload `protobuf:"bytes,6,opt,name=memo_comment,json=memoComment,proto3,oneof"` -} - -type UserNotification_MemoMention struct { - MemoMention *UserNotification_MemoMentionPayload `protobuf:"bytes,7,opt,name=memo_mention,json=memoMention,proto3,oneof"` -} - -type UserNotification_SpaceInvitation struct { - SpaceInvitation *UserNotification_SpaceInvitationPayload `protobuf:"bytes,9,opt,name=space_invitation,json=spaceInvitation,proto3,oneof"` -} - -func (*UserNotification_MemoComment) isUserNotification_Payload() {} - -func (*UserNotification_MemoMention) isUserNotification_Payload() {} - -func (*UserNotification_SpaceInvitation) isUserNotification_Payload() {} - -type ListUserNotificationsRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - // The parent user resource. - // Format: users/{user} - Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"` - PageSize int32 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` - PageToken string `protobuf:"bytes,3,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` - Filter string `protobuf:"bytes,4,opt,name=filter,proto3" json:"filter,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ListUserNotificationsRequest) Reset() { - *x = ListUserNotificationsRequest{} - mi := &file_api_v1_user_service_proto_msgTypes[53] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ListUserNotificationsRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ListUserNotificationsRequest) ProtoMessage() {} - -func (x *ListUserNotificationsRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[53] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ListUserNotificationsRequest.ProtoReflect.Descriptor instead. -func (*ListUserNotificationsRequest) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{53} -} - -func (x *ListUserNotificationsRequest) GetParent() string { - if x != nil { - return x.Parent - } - return "" -} - -func (x *ListUserNotificationsRequest) GetPageSize() int32 { - if x != nil { - return x.PageSize - } - return 0 -} - -func (x *ListUserNotificationsRequest) GetPageToken() string { - if x != nil { - return x.PageToken - } - return "" -} - -func (x *ListUserNotificationsRequest) GetFilter() string { - if x != nil { - return x.Filter - } - return "" -} - -type ListUserNotificationsResponse struct { - state protoimpl.MessageState `protogen:"open.v1"` - Notifications []*UserNotification `protobuf:"bytes,1,rep,name=notifications,proto3" json:"notifications,omitempty"` - NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ListUserNotificationsResponse) Reset() { - *x = ListUserNotificationsResponse{} - mi := &file_api_v1_user_service_proto_msgTypes[54] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ListUserNotificationsResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ListUserNotificationsResponse) ProtoMessage() {} - -func (x *ListUserNotificationsResponse) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[54] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ListUserNotificationsResponse.ProtoReflect.Descriptor instead. -func (*ListUserNotificationsResponse) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{54} -} - -func (x *ListUserNotificationsResponse) GetNotifications() []*UserNotification { - if x != nil { - return x.Notifications - } - return nil -} - -func (x *ListUserNotificationsResponse) GetNextPageToken() string { - if x != nil { - return x.NextPageToken - } - return "" -} - -type UpdateUserNotificationRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - Notification *UserNotification `protobuf:"bytes,1,opt,name=notification,proto3" json:"notification,omitempty"` - UpdateMask *fieldmaskpb.FieldMask `protobuf:"bytes,2,opt,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *UpdateUserNotificationRequest) Reset() { - *x = UpdateUserNotificationRequest{} - mi := &file_api_v1_user_service_proto_msgTypes[55] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *UpdateUserNotificationRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateUserNotificationRequest) ProtoMessage() {} - -func (x *UpdateUserNotificationRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[55] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateUserNotificationRequest.ProtoReflect.Descriptor instead. -func (*UpdateUserNotificationRequest) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{55} -} - -func (x *UpdateUserNotificationRequest) GetNotification() *UserNotification { - if x != nil { - return x.Notification - } - return nil -} - -func (x *UpdateUserNotificationRequest) GetUpdateMask() *fieldmaskpb.FieldMask { - if x != nil { - return x.UpdateMask - } - return nil -} - -type DeleteUserNotificationRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Format: users/{user}/notifications/{notification} - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *DeleteUserNotificationRequest) Reset() { - *x = DeleteUserNotificationRequest{} - mi := &file_api_v1_user_service_proto_msgTypes[56] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *DeleteUserNotificationRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DeleteUserNotificationRequest) ProtoMessage() {} - -func (x *DeleteUserNotificationRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[56] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DeleteUserNotificationRequest.ProtoReflect.Descriptor instead. -func (*DeleteUserNotificationRequest) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{56} -} - -func (x *DeleteUserNotificationRequest) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -// Memo type statistics. -type UserStats_MemoTypeStats struct { - state protoimpl.MessageState `protogen:"open.v1"` - LinkCount int32 `protobuf:"varint,1,opt,name=link_count,json=linkCount,proto3" json:"link_count,omitempty"` - CodeCount int32 `protobuf:"varint,2,opt,name=code_count,json=codeCount,proto3" json:"code_count,omitempty"` - TodoCount int32 `protobuf:"varint,3,opt,name=todo_count,json=todoCount,proto3" json:"todo_count,omitempty"` - UndoCount int32 `protobuf:"varint,4,opt,name=undo_count,json=undoCount,proto3" json:"undo_count,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *UserStats_MemoTypeStats) Reset() { - *x = UserStats_MemoTypeStats{} - mi := &file_api_v1_user_service_proto_msgTypes[58] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *UserStats_MemoTypeStats) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UserStats_MemoTypeStats) ProtoMessage() {} - -func (x *UserStats_MemoTypeStats) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[58] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UserStats_MemoTypeStats.ProtoReflect.Descriptor instead. -func (*UserStats_MemoTypeStats) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{9, 1} -} - -func (x *UserStats_MemoTypeStats) GetLinkCount() int32 { - if x != nil { - return x.LinkCount - } - return 0 -} - -func (x *UserStats_MemoTypeStats) GetCodeCount() int32 { - if x != nil { - return x.CodeCount - } - return 0 -} - -func (x *UserStats_MemoTypeStats) GetTodoCount() int32 { - if x != nil { - return x.TodoCount - } - return 0 -} - -func (x *UserStats_MemoTypeStats) GetUndoCount() int32 { - if x != nil { - return x.UndoCount - } - return 0 -} - -// General user settings configuration. +// GeneralSetting holds general user preferences. type UserSetting_GeneralSetting struct { state protoimpl.MessageState `protogen:"open.v1"` - // The preferred locale of the user. + // Optional. The preferred locale of the user. Locale string `protobuf:"bytes,1,opt,name=locale,proto3" json:"locale,omitempty"` - // The default visibility of the memo. - MemoVisibility string `protobuf:"bytes,3,opt,name=memo_visibility,json=memoVisibility,proto3" json:"memo_visibility,omitempty"` - // The preferred theme of the user. - // This references a CSS file in the web/public/themes/ directory. - // If not set, the default theme will be used. - Theme string `protobuf:"bytes,4,opt,name=theme,proto3" json:"theme,omitempty"` - // Whether the official client should save metadata from future media uploads. - SaveMediaMetadata bool `protobuf:"varint,5,opt,name=save_media_metadata,json=saveMediaMetadata,proto3" json:"save_media_metadata,omitempty"` + // Optional. The default visibility of new memos: PRIVATE, PROTECTED or + // PUBLIC. + MemoVisibility string `protobuf:"bytes,2,opt,name=memo_visibility,json=memoVisibility,proto3" json:"memo_visibility,omitempty"` + // Optional. The preferred theme of the user. This references a CSS file in + // the web/public/themes/ directory. If not set, the default theme is used. + Theme string `protobuf:"bytes,3,opt,name=theme,proto3" json:"theme,omitempty"` + // Optional. Whether the official client should save metadata from future + // media uploads. + SaveMediaMetadata bool `protobuf:"varint,4,opt,name=save_media_metadata,json=saveMediaMetadata,proto3" json:"save_media_metadata,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } func (x *UserSetting_GeneralSetting) Reset() { *x = UserSetting_GeneralSetting{} - mi := &file_api_v1_user_service_proto_msgTypes[59] + mi := &file_api_user_service_proto_msgTypes[57] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4159,7 +4199,7 @@ func (x *UserSetting_GeneralSetting) String() string { func (*UserSetting_GeneralSetting) ProtoMessage() {} func (x *UserSetting_GeneralSetting) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[59] + mi := &file_api_user_service_proto_msgTypes[57] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4172,7 +4212,7 @@ func (x *UserSetting_GeneralSetting) ProtoReflect() protoreflect.Message { // Deprecated: Use UserSetting_GeneralSetting.ProtoReflect.Descriptor instead. func (*UserSetting_GeneralSetting) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{20, 0} + return file_api_user_service_proto_rawDescGZIP(), []int{9, 0} } func (x *UserSetting_GeneralSetting) GetLocale() string { @@ -4203,13 +4243,106 @@ func (x *UserSetting_GeneralSetting) GetSaveMediaMetadata() bool { return false } -// Tag metadata for user-specific display rules. +// WebhooksSetting holds a user's webhooks. +type UserSetting_WebhooksSetting struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The user's webhooks. + Webhooks []*UserWebhook `protobuf:"bytes,1,rep,name=webhooks,proto3" json:"webhooks,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UserSetting_WebhooksSetting) Reset() { + *x = UserSetting_WebhooksSetting{} + mi := &file_api_user_service_proto_msgTypes[58] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UserSetting_WebhooksSetting) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserSetting_WebhooksSetting) ProtoMessage() {} + +func (x *UserSetting_WebhooksSetting) ProtoReflect() protoreflect.Message { + mi := &file_api_user_service_proto_msgTypes[58] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UserSetting_WebhooksSetting.ProtoReflect.Descriptor instead. +func (*UserSetting_WebhooksSetting) Descriptor() ([]byte, []int) { + return file_api_user_service_proto_rawDescGZIP(), []int{9, 1} +} + +func (x *UserSetting_WebhooksSetting) GetWebhooks() []*UserWebhook { + if x != nil { + return x.Webhooks + } + return nil +} + +// TagsSetting holds user-specific tag metadata. +type UserSetting_TagsSetting struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Optional. Map of tag name pattern to tag metadata. Each key is treated as + // an anchored regular expression (^pattern$). + Tags map[string]*UserSetting_TagMetadata `protobuf:"bytes,1,rep,name=tags,proto3" json:"tags,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UserSetting_TagsSetting) Reset() { + *x = UserSetting_TagsSetting{} + mi := &file_api_user_service_proto_msgTypes[59] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UserSetting_TagsSetting) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserSetting_TagsSetting) ProtoMessage() {} + +func (x *UserSetting_TagsSetting) ProtoReflect() protoreflect.Message { + mi := &file_api_user_service_proto_msgTypes[59] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UserSetting_TagsSetting.ProtoReflect.Descriptor instead. +func (*UserSetting_TagsSetting) Descriptor() ([]byte, []int) { + return file_api_user_service_proto_rawDescGZIP(), []int{9, 2} +} + +func (x *UserSetting_TagsSetting) GetTags() map[string]*UserSetting_TagMetadata { + if x != nil { + return x.Tags + } + return nil +} + +// TagMetadata holds user-specific display rules for a tag. type UserSetting_TagMetadata struct { state protoimpl.MessageState `protogen:"open.v1"` - // Optional background color for the tag label. - // When unset, the default tag color is used. + // Optional. The background color of the tag label. When unset, the default + // tag color is used. BackgroundColor *color.Color `protobuf:"bytes,1,opt,name=background_color,json=backgroundColor,proto3" json:"background_color,omitempty"` - // Whether memos with this tag should have their content blurred. + // Optional. Whether memos with this tag have their content blurred. BlurContent bool `protobuf:"varint,2,opt,name=blur_content,json=blurContent,proto3" json:"blur_content,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache @@ -4217,7 +4350,7 @@ type UserSetting_TagMetadata struct { func (x *UserSetting_TagMetadata) Reset() { *x = UserSetting_TagMetadata{} - mi := &file_api_v1_user_service_proto_msgTypes[60] + mi := &file_api_user_service_proto_msgTypes[60] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4229,7 +4362,7 @@ func (x *UserSetting_TagMetadata) String() string { func (*UserSetting_TagMetadata) ProtoMessage() {} func (x *UserSetting_TagMetadata) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[60] + mi := &file_api_user_service_proto_msgTypes[60] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4242,7 +4375,7 @@ func (x *UserSetting_TagMetadata) ProtoReflect() protoreflect.Message { // Deprecated: Use UserSetting_TagMetadata.ProtoReflect.Descriptor instead. func (*UserSetting_TagMetadata) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{20, 1} + return file_api_user_service_proto_rawDescGZIP(), []int{9, 3} } func (x *UserSetting_TagMetadata) GetBackgroundColor() *color.Color { @@ -4259,31 +4392,36 @@ func (x *UserSetting_TagMetadata) GetBlurContent() bool { return false } -// User-specific tag metadata. -type UserSetting_TagsSetting struct { +// MemoTypeStats counts memos by the kind of content they contain. +type UserStats_MemoTypeStats struct { state protoimpl.MessageState `protogen:"open.v1"` - // Map of tag name pattern to tag metadata. - // Each key is treated as an anchored regular expression (^pattern$). - Tags map[string]*UserSetting_TagMetadata `protobuf:"bytes,1,rep,name=tags,proto3" json:"tags,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + // The number of memos that contain a link. + LinkCount int32 `protobuf:"varint,1,opt,name=link_count,json=linkCount,proto3" json:"link_count,omitempty"` + // The number of memos that contain code. + CodeCount int32 `protobuf:"varint,2,opt,name=code_count,json=codeCount,proto3" json:"code_count,omitempty"` + // The number of memos that contain a task list. + TodoCount int32 `protobuf:"varint,3,opt,name=todo_count,json=todoCount,proto3" json:"todo_count,omitempty"` + // The number of memos that contain incomplete tasks. + UndoCount int32 `protobuf:"varint,4,opt,name=undo_count,json=undoCount,proto3" json:"undo_count,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } -func (x *UserSetting_TagsSetting) Reset() { - *x = UserSetting_TagsSetting{} - mi := &file_api_v1_user_service_proto_msgTypes[61] +func (x *UserStats_MemoTypeStats) Reset() { + *x = UserStats_MemoTypeStats{} + mi := &file_api_user_service_proto_msgTypes[63] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } -func (x *UserSetting_TagsSetting) String() string { +func (x *UserStats_MemoTypeStats) String() string { return protoimpl.X.MessageStringOf(x) } -func (*UserSetting_TagsSetting) ProtoMessage() {} +func (*UserStats_MemoTypeStats) ProtoMessage() {} -func (x *UserSetting_TagsSetting) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[61] +func (x *UserStats_MemoTypeStats) ProtoReflect() protoreflect.Message { + mi := &file_api_user_service_proto_msgTypes[63] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4294,66 +4432,44 @@ func (x *UserSetting_TagsSetting) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use UserSetting_TagsSetting.ProtoReflect.Descriptor instead. -func (*UserSetting_TagsSetting) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{20, 2} +// Deprecated: Use UserStats_MemoTypeStats.ProtoReflect.Descriptor instead. +func (*UserStats_MemoTypeStats) Descriptor() ([]byte, []int) { + return file_api_user_service_proto_rawDescGZIP(), []int{14, 1} } -func (x *UserSetting_TagsSetting) GetTags() map[string]*UserSetting_TagMetadata { +func (x *UserStats_MemoTypeStats) GetLinkCount() int32 { if x != nil { - return x.Tags + return x.LinkCount } - return nil + return 0 } -// User webhooks configuration. -type UserSetting_WebhooksSetting struct { - state protoimpl.MessageState `protogen:"open.v1"` - // List of user webhooks. - Webhooks []*UserWebhook `protobuf:"bytes,1,rep,name=webhooks,proto3" json:"webhooks,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *UserSetting_WebhooksSetting) Reset() { - *x = UserSetting_WebhooksSetting{} - mi := &file_api_v1_user_service_proto_msgTypes[62] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *UserSetting_WebhooksSetting) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UserSetting_WebhooksSetting) ProtoMessage() {} - -func (x *UserSetting_WebhooksSetting) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[62] +func (x *UserStats_MemoTypeStats) GetCodeCount() int32 { if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms + return x.CodeCount } - return mi.MessageOf(x) + return 0 } -// Deprecated: Use UserSetting_WebhooksSetting.ProtoReflect.Descriptor instead. -func (*UserSetting_WebhooksSetting) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{20, 3} -} - -func (x *UserSetting_WebhooksSetting) GetWebhooks() []*UserWebhook { +func (x *UserStats_MemoTypeStats) GetTodoCount() int32 { if x != nil { - return x.Webhooks + return x.TodoCount } - return nil + return 0 } +func (x *UserStats_MemoTypeStats) GetUndoCount() int32 { + if x != nil { + return x.UndoCount + } + return 0 +} + +// Icon is the display icon of a memo view. type MemoView_Icon struct { state protoimpl.MessageState `protogen:"open.v1"` + // The icon value. + // // Types that are valid to be assigned to Value: // // *MemoView_Icon_Emoji @@ -4365,7 +4481,7 @@ type MemoView_Icon struct { func (x *MemoView_Icon) Reset() { *x = MemoView_Icon{} - mi := &file_api_v1_user_service_proto_msgTypes[64] + mi := &file_api_user_service_proto_msgTypes[64] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4377,7 +4493,7 @@ func (x *MemoView_Icon) String() string { func (*MemoView_Icon) ProtoMessage() {} func (x *MemoView_Icon) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[64] + mi := &file_api_user_service_proto_msgTypes[64] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4390,7 +4506,7 @@ func (x *MemoView_Icon) ProtoReflect() protoreflect.Message { // Deprecated: Use MemoView_Icon.ProtoReflect.Descriptor instead. func (*MemoView_Icon) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{25, 0} + return file_api_user_service_proto_rawDescGZIP(), []int{18, 0} } func (x *MemoView_Icon) GetValue() isMemoView_Icon_Value { @@ -4436,12 +4552,13 @@ func (*MemoView_Icon_Emoji) isMemoView_Icon_Value() {} func (*MemoView_Icon_Lucide) isMemoView_Icon_Value() {} +// MemoCommentPayload holds the details of a MEMO_COMMENT notification. type UserNotification_MemoCommentPayload struct { state protoimpl.MessageState `protogen:"open.v1"` - // The memo name of comment. + // The comment memo. // Format: memos/{memo} Memo string `protobuf:"bytes,1,opt,name=memo,proto3" json:"memo,omitempty"` - // The name of related memo. + // The memo that was commented on. // Format: memos/{memo} RelatedMemo string `protobuf:"bytes,2,opt,name=related_memo,json=relatedMemo,proto3" json:"related_memo,omitempty"` // Preview text of the comment memo. @@ -4454,7 +4571,7 @@ type UserNotification_MemoCommentPayload struct { func (x *UserNotification_MemoCommentPayload) Reset() { *x = UserNotification_MemoCommentPayload{} - mi := &file_api_v1_user_service_proto_msgTypes[65] + mi := &file_api_user_service_proto_msgTypes[65] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4466,7 +4583,7 @@ func (x *UserNotification_MemoCommentPayload) String() string { func (*UserNotification_MemoCommentPayload) ProtoMessage() {} func (x *UserNotification_MemoCommentPayload) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[65] + mi := &file_api_user_service_proto_msgTypes[65] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4479,7 +4596,7 @@ func (x *UserNotification_MemoCommentPayload) ProtoReflect() protoreflect.Messag // Deprecated: Use UserNotification_MemoCommentPayload.ProtoReflect.Descriptor instead. func (*UserNotification_MemoCommentPayload) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{52, 0} + return file_api_user_service_proto_rawDescGZIP(), []int{25, 0} } func (x *UserNotification_MemoCommentPayload) GetMemo() string { @@ -4510,6 +4627,7 @@ func (x *UserNotification_MemoCommentPayload) GetRelatedMemoSnippet() string { return "" } +// MemoMentionPayload holds the details of a MEMO_MENTION notification. type UserNotification_MemoMentionPayload struct { state protoimpl.MessageState `protogen:"open.v1"` // The memo that contains the mention. @@ -4528,7 +4646,7 @@ type UserNotification_MemoMentionPayload struct { func (x *UserNotification_MemoMentionPayload) Reset() { *x = UserNotification_MemoMentionPayload{} - mi := &file_api_v1_user_service_proto_msgTypes[66] + mi := &file_api_user_service_proto_msgTypes[66] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4540,7 +4658,7 @@ func (x *UserNotification_MemoMentionPayload) String() string { func (*UserNotification_MemoMentionPayload) ProtoMessage() {} func (x *UserNotification_MemoMentionPayload) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[66] + mi := &file_api_user_service_proto_msgTypes[66] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4553,7 +4671,7 @@ func (x *UserNotification_MemoMentionPayload) ProtoReflect() protoreflect.Messag // Deprecated: Use UserNotification_MemoMentionPayload.ProtoReflect.Descriptor instead. func (*UserNotification_MemoMentionPayload) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{52, 1} + return file_api_user_service_proto_rawDescGZIP(), []int{25, 1} } func (x *UserNotification_MemoMentionPayload) GetMemo() string { @@ -4584,24 +4702,26 @@ func (x *UserNotification_MemoMentionPayload) GetRelatedMemoSnippet() string { return "" } +// SpaceInvitationPayload holds the details of a SPACE_INVITATION +// notification. type UserNotification_SpaceInvitationPayload struct { state protoimpl.MessageState `protogen:"open.v1"` - // The invitation resource. - // Format: spaces/{space}/invitations/{username} + // The invitation. + // Format: spaces/{space}/invitations/{invitation} SpaceInvitation string `protobuf:"bytes,1,opt,name=space_invitation,json=spaceInvitation,proto3" json:"space_invitation,omitempty"` // The read-only Space summary carried by the invitation. Space *Space `protobuf:"bytes,2,opt,name=space,proto3" json:"space,omitempty"` // The role the invitation offers. - Role SpaceMember_Role `protobuf:"varint,3,opt,name=role,proto3,enum=memos.api.v1.SpaceMember_Role" json:"role,omitempty"` + Role SpaceMember_Role `protobuf:"varint,3,opt,name=role,proto3,enum=memos.api.SpaceMember_Role" json:"role,omitempty"` // The current state of the invitation for the receiver. - State UserNotification_SpaceInvitationPayload_State `protobuf:"varint,4,opt,name=state,proto3,enum=memos.api.v1.UserNotification_SpaceInvitationPayload_State" json:"state,omitempty"` + State UserNotification_SpaceInvitationPayload_InvitationState `protobuf:"varint,4,opt,name=state,proto3,enum=memos.api.UserNotification_SpaceInvitationPayload_InvitationState" json:"state,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } func (x *UserNotification_SpaceInvitationPayload) Reset() { *x = UserNotification_SpaceInvitationPayload{} - mi := &file_api_v1_user_service_proto_msgTypes[67] + mi := &file_api_user_service_proto_msgTypes[67] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4613,7 +4733,7 @@ func (x *UserNotification_SpaceInvitationPayload) String() string { func (*UserNotification_SpaceInvitationPayload) ProtoMessage() {} func (x *UserNotification_SpaceInvitationPayload) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[67] + mi := &file_api_user_service_proto_msgTypes[67] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4626,7 +4746,7 @@ func (x *UserNotification_SpaceInvitationPayload) ProtoReflect() protoreflect.Me // Deprecated: Use UserNotification_SpaceInvitationPayload.ProtoReflect.Descriptor instead. func (*UserNotification_SpaceInvitationPayload) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{52, 2} + return file_api_user_service_proto_rawDescGZIP(), []int{25, 2} } func (x *UserNotification_SpaceInvitationPayload) GetSpaceInvitation() string { @@ -4650,29 +4770,29 @@ func (x *UserNotification_SpaceInvitationPayload) GetRole() SpaceMember_Role { return SpaceMember_ROLE_UNSPECIFIED } -func (x *UserNotification_SpaceInvitationPayload) GetState() UserNotification_SpaceInvitationPayload_State { +func (x *UserNotification_SpaceInvitationPayload) GetState() UserNotification_SpaceInvitationPayload_InvitationState { if x != nil { return x.State } return UserNotification_SpaceInvitationPayload_STATE_UNSPECIFIED } -var File_api_v1_user_service_proto protoreflect.FileDescriptor +var File_api_user_service_proto protoreflect.FileDescriptor -const file_api_v1_user_service_proto_rawDesc = "" + +const file_api_user_service_proto_rawDesc = "" + "\n" + - "\x19api/v1/user_service.proto\x12\fmemos.api.v1\x1a\x13api/v1/common.proto\x1a\x1aapi/v1/space_service.proto\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/httpbody.proto\x1a\x19google/api/resource.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x17google/type/color.proto\"\xc1\x04\n" + + "\x16api/user_service.proto\x12\tmemos.api\x1a\x10api/common.proto\x1a\x17api/space_service.proto\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/httpbody.proto\x1a\x19google/api/resource.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x17google/type/color.proto\"\xb2\x04\n" + "\x04User\x12\x17\n" + - "\x04name\x18\x01 \x01(\tB\x03\xe0A\bR\x04name\x120\n" + - "\x04role\x18\x02 \x01(\x0e2\x17.memos.api.v1.User.RoleB\x03\xe0A\x02R\x04role\x12\x1f\n" + - "\busername\x18\x03 \x01(\tB\x03\xe0A\x02R\busername\x12\x19\n" + - "\x05email\x18\x04 \x01(\tB\x03\xe0A\x01R\x05email\x12&\n" + - "\fdisplay_name\x18\x05 \x01(\tB\x03\xe0A\x01R\vdisplayName\x12\"\n" + + "\x04name\x18\x01 \x01(\tB\x03\xe0A\bR\x04name\x12\x1f\n" + + "\busername\x18\x02 \x01(\tB\x03\xe0A\x02R\busername\x12&\n" + + "\fdisplay_name\x18\x03 \x01(\tB\x03\xe0A\x01R\vdisplayName\x12\x19\n" + + "\x05email\x18\x04 \x01(\tB\x03\xe0A\x01R\x05email\x12\"\n" + "\n" + - "avatar_url\x18\x06 \x01(\tB\x03\xe0A\x01R\tavatarUrl\x12%\n" + - "\vdescription\x18\a \x01(\tB\x03\xe0A\x01R\vdescription\x12\x1f\n" + - "\bpassword\x18\b \x01(\tB\x03\xe0A\x04R\bpassword\x12.\n" + - "\x05state\x18\t \x01(\x0e2\x13.memos.api.v1.StateB\x03\xe0A\x02R\x05state\x12@\n" + + "avatar_url\x18\x05 \x01(\tB\x03\xe0A\x01R\tavatarUrl\x12%\n" + + "\vdescription\x18\x06 \x01(\tB\x03\xe0A\x01R\vdescription\x12\x1f\n" + + "\bpassword\x18\a \x01(\tB\x03\xe0A\x04R\bpassword\x12-\n" + + "\x04role\x18\b \x01(\x0e2\x14.memos.api.User.RoleB\x03\xe0A\x02R\x04role\x12+\n" + + "\x05state\x18\t \x01(\x0e2\x10.memos.api.StateB\x03\xe0A\x02R\x05state\x12@\n" + "\vcreate_time\x18\n" + " \x01(\v2\x1a.google.protobuf.TimestampB\x03\xe0A\x03R\n" + "createTime\x12@\n" + @@ -4681,51 +4801,96 @@ const file_api_v1_user_service_proto_rawDesc = "" + "\x04Role\x12\x14\n" + "\x10ROLE_UNSPECIFIED\x10\x00\x12\t\n" + "\x05ADMIN\x10\x02\x12\b\n" + - "\x04USER\x10\x03:7\xeaA4\n" + - "\x11memos.api.v1/User\x12\fusers/{user}\x1a\x04name*\x05users2\x04user\"\x9d\x01\n" + + "\x04USER\x10\x03:.\xeaA+\n" + + "\x0ememos.api/User\x12\fusers/{user}*\x05users2\x04user\"\x9d\x01\n" + "\x10ListUsersRequest\x12 \n" + "\tpage_size\x18\x01 \x01(\x05B\x03\xe0A\x01R\bpageSize\x12\"\n" + "\n" + "page_token\x18\x02 \x01(\tB\x03\xe0A\x01R\tpageToken\x12\x1b\n" + "\x06filter\x18\x03 \x01(\tB\x03\xe0A\x01R\x06filter\x12&\n" + - "\fshow_deleted\x18\x04 \x01(\bB\x03\xe0A\x01R\vshowDeleted\"e\n" + - "\x11ListUsersResponse\x12(\n" + - "\x05users\x18\x01 \x03(\v2\x12.memos.api.v1.UserR\x05users\x12&\n" + - "\x0fnext_page_token\x18\x02 \x01(\tR\rnextPageToken\"4\n" + - "\x14BatchGetUsersRequest\x12\x1c\n" + - "\tusernames\x18\x01 \x03(\tR\tusernames\"A\n" + - "\x15BatchGetUsersResponse\x12(\n" + - "\x05users\x18\x01 \x03(\v2\x12.memos.api.v1.UserR\x05users\"}\n" + - "\x0eGetUserRequest\x12-\n" + - "\x04name\x18\x01 \x01(\tB\x19\xe0A\x02\xfaA\x13\n" + - "\x11memos.api.v1/UserR\x04name\x12<\n" + - "\tread_mask\x18\x02 \x01(\v2\x1a.google.protobuf.FieldMaskB\x03\xe0A\x01R\breadMask\"\xaf\x01\n" + - "\x11CreateUserRequest\x12.\n" + - "\x04user\x18\x01 \x01(\v2\x12.memos.api.v1.UserB\x06\xe0A\x02\xe0A\x04R\x04user\x12\x1c\n" + + "\fshow_deleted\x18\x04 \x01(\bB\x03\xe0A\x01R\vshowDeleted\"b\n" + + "\x11ListUsersResponse\x12%\n" + + "\x05users\x18\x01 \x03(\v2\x0f.memos.api.UserR\x05users\x12&\n" + + "\x0fnext_page_token\x18\x02 \x01(\tR\rnextPageToken\"z\n" + + "\x0eGetUserRequest\x12*\n" + + "\x04name\x18\x01 \x01(\tB\x16\xe0A\x02\xfaA\x10\n" + + "\x0ememos.api/UserR\x04name\x12<\n" + + "\tread_mask\x18\x02 \x01(\v2\x1a.google.protobuf.FieldMaskB\x03\xe0A\x01R\breadMask\"D\n" + + "\x14BatchGetUsersRequest\x12,\n" + + "\x05names\x18\x01 \x03(\tB\x16\xe0A\x02\xfaA\x10\n" + + "\x0ememos.api/UserR\x05names\">\n" + + "\x15BatchGetUsersResponse\x12%\n" + + "\x05users\x18\x01 \x03(\v2\x0f.memos.api.UserR\x05users\"\xac\x01\n" + + "\x11CreateUserRequest\x12+\n" + + "\x04user\x18\x01 \x01(\v2\x0f.memos.api.UserB\x06\xe0A\x02\xe0A\x04R\x04user\x12\x1c\n" + "\auser_id\x18\x02 \x01(\tB\x03\xe0A\x01R\x06userId\x12(\n" + "\rvalidate_only\x18\x03 \x01(\bB\x03\xe0A\x01R\fvalidateOnly\x12\"\n" + "\n" + - "request_id\x18\x04 \x01(\tB\x03\xe0A\x01R\trequestId\"\xac\x01\n" + - "\x11UpdateUserRequest\x12+\n" + - "\x04user\x18\x01 \x01(\v2\x12.memos.api.v1.UserB\x03\xe0A\x02R\x04user\x12@\n" + + "request_id\x18\x04 \x01(\tB\x03\xe0A\x01R\trequestId\"\xa9\x01\n" + + "\x11UpdateUserRequest\x12(\n" + + "\x04user\x18\x01 \x01(\v2\x0f.memos.api.UserB\x03\xe0A\x02R\x04user\x12@\n" + "\vupdate_mask\x18\x02 \x01(\v2\x1a.google.protobuf.FieldMaskB\x03\xe0A\x02R\n" + "updateMask\x12(\n" + - "\rallow_missing\x18\x03 \x01(\bB\x03\xe0A\x01R\fallowMissing\"]\n" + - "\x11DeleteUserRequest\x12-\n" + - "\x04name\x18\x01 \x01(\tB\x19\xe0A\x02\xfaA\x13\n" + - "\x11memos.api.v1/UserR\x04name\x12\x19\n" + - "\x05force\x18\x02 \x01(\bB\x03\xe0A\x01R\x05force\"\xd6\x06\n" + + "\rallow_missing\x18\x03 \x01(\bB\x03\xe0A\x01R\fallowMissing\"Z\n" + + "\x11DeleteUserRequest\x12*\n" + + "\x04name\x18\x01 \x01(\tB\x16\xe0A\x02\xfaA\x10\n" + + "\x0ememos.api/UserR\x04name\x12\x19\n" + + "\x05force\x18\x02 \x01(\bB\x03\xe0A\x01R\x05force\"\xdc\a\n" + + "\vUserSetting\x12\x17\n" + + "\x04name\x18\x01 \x01(\tB\x03\xe0A\bR\x04name\x12P\n" + + "\x0fgeneral_setting\x18\x02 \x01(\v2%.memos.api.UserSetting.GeneralSettingH\x00R\x0egeneralSetting\x12S\n" + + "\x10webhooks_setting\x18\x03 \x01(\v2&.memos.api.UserSetting.WebhooksSettingH\x00R\x0fwebhooksSetting\x12G\n" + + "\ftags_setting\x18\x04 \x01(\v2\".memos.api.UserSetting.TagsSettingH\x00R\vtagsSetting\x1a\xab\x01\n" + + "\x0eGeneralSetting\x12\x1b\n" + + "\x06locale\x18\x01 \x01(\tB\x03\xe0A\x01R\x06locale\x12,\n" + + "\x0fmemo_visibility\x18\x02 \x01(\tB\x03\xe0A\x01R\x0ememoVisibility\x12\x19\n" + + "\x05theme\x18\x03 \x01(\tB\x03\xe0A\x01R\x05theme\x123\n" + + "\x13save_media_metadata\x18\x04 \x01(\bB\x03\xe0A\x01R\x11saveMediaMetadata\x1aE\n" + + "\x0fWebhooksSetting\x122\n" + + "\bwebhooks\x18\x01 \x03(\v2\x16.memos.api.UserWebhookR\bwebhooks\x1a\xb1\x01\n" + + "\vTagsSetting\x12E\n" + + "\x04tags\x18\x01 \x03(\v2,.memos.api.UserSetting.TagsSetting.TagsEntryB\x03\xe0A\x01R\x04tags\x1a[\n" + + "\tTagsEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x128\n" + + "\x05value\x18\x02 \x01(\v2\".memos.api.UserSetting.TagMetadataR\x05value:\x028\x01\x1ay\n" + + "\vTagMetadata\x12B\n" + + "\x10background_color\x18\x01 \x01(\v2\x12.google.type.ColorB\x03\xe0A\x01R\x0fbackgroundColor\x12&\n" + + "\fblur_content\x18\x02 \x01(\bB\x03\xe0A\x01R\vblurContent\"?\n" + + "\x03Key\x12\x13\n" + + "\x0fKEY_UNSPECIFIED\x10\x00\x12\v\n" + + "\aGENERAL\x10\x01\x12\f\n" + + "\bWEBHOOKS\x10\x04\x12\b\n" + + "\x04TAGS\x10\x05:V\xeaAS\n" + + "\x15memos.api/UserSetting\x12\x1fusers/{user}/settings/{setting}*\fuserSettings2\vuserSettingB\a\n" + + "\x05value\"\x8f\x01\n" + + "\x17ListUserSettingsRequest\x12.\n" + + "\x06parent\x18\x01 \x01(\tB\x16\xe0A\x02\xfaA\x10\n" + + "\x0ememos.api/UserR\x06parent\x12 \n" + + "\tpage_size\x18\x02 \x01(\x05B\x03\xe0A\x01R\bpageSize\x12\"\n" + + "\n" + + "page_token\x18\x03 \x01(\tB\x03\xe0A\x01R\tpageToken\"\x7f\n" + + "\x18ListUserSettingsResponse\x12;\n" + + "\ruser_settings\x18\x01 \x03(\v2\x16.memos.api.UserSettingR\fuserSettings\x12&\n" + + "\x0fnext_page_token\x18\x02 \x01(\tR\rnextPageToken\"J\n" + + "\x15GetUserSettingRequest\x121\n" + + "\x04name\x18\x01 \x01(\tB\x1d\xe0A\x02\xfaA\x17\n" + + "\x15memos.api/UserSettingR\x04name\"\x9c\x01\n" + + "\x18UpdateUserSettingRequest\x12>\n" + + "\fuser_setting\x18\x01 \x01(\v2\x16.memos.api.UserSettingB\x03\xe0A\x02R\vuserSetting\x12@\n" + + "\vupdate_mask\x18\x02 \x01(\v2\x1a.google.protobuf.FieldMaskB\x03\xe0A\x02R\n" + + "updateMask\"\xaf\x06\n" + "\tUserStats\x12\x17\n" + - "\x04name\x18\x01 \x01(\tB\x03\xe0A\bR\x04name\x12M\n" + - "\x0fmemo_type_stats\x18\x03 \x01(\v2%.memos.api.v1.UserStats.MemoTypeStatsR\rmemoTypeStats\x12B\n" + - "\ttag_count\x18\x04 \x03(\v2%.memos.api.v1.UserStats.TagCountEntryR\btagCount\x12R\n" + - "\x17memo_created_timestamps\x18\a \x03(\v2\x1a.google.protobuf.TimestampR\x15memoCreatedTimestamps\x12R\n" + - "\x17memo_updated_timestamps\x18\b \x03(\v2\x1a.google.protobuf.TimestampR\x15memoUpdatedTimestamps\x129\n" + - "\fpinned_memos\x18\x05 \x03(\tB\x16\xfaA\x13\n" + - "\x11memos.api.v1/MemoR\vpinnedMemos\x12(\n" + - "\x10total_memo_count\x18\x06 \x01(\x05R\x0etotalMemoCount\x12B\n" + - "\x18attachment_storage_bytes\x18\t \x01(\x03B\x03\xe0A\x03H\x00R\x16attachmentStorageBytes\x88\x01\x01\x1a;\n" + - "\rTagCountEntry\x12\x10\n" + + "\x04name\x18\x01 \x01(\tB\x03\xe0A\bR\x04name\x12(\n" + + "\x10total_memo_count\x18\x02 \x01(\x05R\x0etotalMemoCount\x12J\n" + + "\x0fmemo_type_stats\x18\x03 \x01(\v2\".memos.api.UserStats.MemoTypeStatsR\rmemoTypeStats\x12B\n" + + "\n" + + "tag_counts\x18\x04 \x03(\v2#.memos.api.UserStats.TagCountsEntryR\ttagCounts\x126\n" + + "\fpinned_memos\x18\x05 \x03(\tB\x13\xfaA\x10\n" + + "\x0ememos.api/MemoR\vpinnedMemos\x12R\n" + + "\x17memo_created_timestamps\x18\x06 \x03(\v2\x1a.google.protobuf.TimestampR\x15memoCreatedTimestamps\x12R\n" + + "\x17memo_updated_timestamps\x18\a \x03(\v2\x1a.google.protobuf.TimestampR\x15memoUpdatedTimestamps\x12B\n" + + "\x18attachment_storage_bytes\x18\b \x01(\x03B\x03\xe0A\x03H\x00R\x16attachmentStorageBytes\x88\x01\x01\x1a<\n" + + "\x0eTagCountsEntry\x12\x10\n" + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + "\x05value\x18\x02 \x01(\x05R\x05value:\x028\x01\x1a\x8b\x01\n" + "\rMemoTypeStats\x12\x1d\n" + @@ -4736,241 +4901,62 @@ const file_api_v1_user_service_proto_rawDesc = "" + "\n" + "todo_count\x18\x03 \x01(\x05R\ttodoCount\x12\x1d\n" + "\n" + - "undo_count\x18\x04 \x01(\x05R\tundoCount:E\xeaAB\n" + - "\x16memos.api.v1/UserStats\x12\x12users/{user}/stats*\tuserStats2\tuserStatsB\x1b\n" + - "\x19_attachment_storage_bytesJ\x04\b\x02\x10\x03R\x17memo_display_timestamps\"C\n" + - "\x12ExportMemosRequest\x12-\n" + - "\x04name\x18\x01 \x01(\tB\x19\xe0A\x02\xfaA\x13\n" + - "\x11memos.api.v1/UserR\x04name\"\xec\x03\n" + - "\x12ImportMemosRequest\x12-\n" + - "\x04name\x18\x01 \x01(\tB\x19\xe0A\x02\xfaA\x13\n" + - "\x11memos.api.v1/UserR\x04name\x123\n" + - "\x04spec\x18\x02 \x01(\v2\x1d.memos.api.v1.ImportMemosSpecH\x00R\x04spec\x12\x1d\n" + - "\tupload_id\x18\x03 \x01(\tH\x00R\buploadId\x12&\n" + - "\fwrite_offset\x18\x04 \x01(\x03B\x03\xe0A\x02R\vwriteOffset\x12\x17\n" + - "\x04data\x18\x05 \x01(\fB\x03\xe0A\x01R\x04data\x12&\n" + - "\ffinish_write\x18\x06 \x01(\bB\x03\xe0A\x01R\vfinishWrite\x12(\n" + - "\rvalidate_only\x18\a \x01(\bB\x03\xe0A\x01R\fvalidateOnly\x12]\n" + - "\x0fconflict_policy\x18\b \x01(\x0e2/.memos.api.v1.ImportMemosRequest.ConflictPolicyB\x03\xe0A\x01R\x0econflictPolicy\"W\n" + - "\x0eConflictPolicy\x12\x1f\n" + - "\x1bCONFLICT_POLICY_UNSPECIFIED\x10\x00\x12\b\n" + - "\x04SKIP\x10\x01\x12\v\n" + - "\aREPLACE\x10\x02\x12\r\n" + - "\tDUPLICATE\x10\x03B\b\n" + - "\x06upload\"5\n" + - "\x0fImportMemosSpec\x12\"\n" + + "undo_count\x18\x04 \x01(\x05R\tundoCount:B\xeaA?\n" + + "\x13memos.api/UserStats\x12\x12users/{user}/stats*\tuserStats2\tuserStatsB\x1b\n" + + "\x19_attachment_storage_bytes\"\x95\x01\n" + + "\x14ListUserStatsRequest\x123\n" + + "\x06parent\x18\x01 \x01(\tB\x1b\xe0A\x02\xfaA\x15\x12\x13memos.api/UserStatsR\x06parent\x12\x1b\n" + + "\x06filter\x18\x02 \x01(\tB\x03\xe0A\x01R\x06filter\x12+\n" + + "\x05state\x18\x03 \x01(\x0e2\x10.memos.api.StateB\x03\xe0A\x01R\x05state\"L\n" + + "\x15ListUserStatsResponse\x123\n" + "\n" + - "total_size\x18\x01 \x01(\x03B\x03\xe0A\x01R\ttotalSize\"\xf7\x01\n" + - "\x13ImportMemosResponse\x12\x1b\n" + - "\tupload_id\x18\x01 \x01(\tR\buploadId\x12%\n" + - "\x0ecommitted_size\x18\x02 \x01(\x03R\rcommittedSize\x12$\n" + - "\x0emax_chunk_size\x18\x03 \x01(\x05R\fmaxChunkSize\x122\n" + - "\x04plan\x18\x04 \x01(\v2\x1c.memos.api.v1.MemoImportPlanH\x00R\x04plan\x128\n" + - "\x06report\x18\x05 \x01(\v2\x1e.memos.api.v1.MemoImportReportH\x00R\x06reportB\b\n" + - "\x06result\"?\n" + - "\x0fMemoImportIssue\x12\x12\n" + - "\x04memo\x18\x01 \x01(\tR\x04memo\x12\x18\n" + - "\amessage\x18\x02 \x01(\tR\amessage\"\xc2\x02\n" + - "\x0eMemoImportPlan\x12;\n" + - "\vexport_time\x18\x01 \x01(\v2\x1a.google.protobuf.TimestampR\n" + - "exportTime\x12\x1a\n" + - "\bexporter\x18\x02 \x01(\tR\bexporter\x12\x1c\n" + - "\tgenerator\x18\x03 \x01(\tR\tgenerator\x12\x14\n" + - "\x05memos\x18\x04 \x01(\x05R\x05memos\x12 \n" + - "\vattachments\x18\x05 \x01(\x05R\vattachments\x12\x10\n" + - "\x03new\x18\x06 \x01(\x05R\x03new\x12\x1a\n" + - "\bexisting\x18\a \x01(\x05R\bexisting\x12\x18\n" + - "\arenamed\x18\b \x01(\x05R\arenamed\x129\n" + - "\bwarnings\x18\t \x03(\v2\x1d.memos.api.v1.MemoImportIssueR\bwarnings\"\xee\x01\n" + - "\x10MemoImportReport\x12\x18\n" + - "\acreated\x18\x01 \x01(\x05R\acreated\x12\x18\n" + - "\aupdated\x18\x02 \x01(\x05R\aupdated\x12\x18\n" + - "\askipped\x18\x03 \x01(\x05R\askipped\x12\x16\n" + - "\x06failed\x18\x04 \x01(\x05R\x06failed\x129\n" + - "\bwarnings\x18\x05 \x03(\v2\x1d.memos.api.v1.MemoImportIssueR\bwarnings\x129\n" + - "\bfailures\x18\x06 \x03(\v2\x1d.memos.api.v1.MemoImportIssueR\bfailures\"z\n" + - "\x13GetUserStatsRequest\x12-\n" + - "\x04name\x18\x01 \x01(\tB\x19\xe0A\x02\xfaA\x13\n" + - "\x11memos.api.v1/UserR\x04name\x12\x1b\n" + - "\x06filter\x18\x02 \x01(\tB\x03\xe0A\x01R\x06filterJ\x04\b\x03\x10\x04R\x05spaceR\n" + - "unassigned\"\x85\x01\n" + - "\x17ListAllUserStatsRequest\x12.\n" + - "\x05state\x18\x01 \x01(\x0e2\x13.memos.api.v1.StateB\x03\xe0A\x01R\x05state\x12\x1b\n" + - "\x06filter\x18\x02 \x01(\tB\x03\xe0A\x01R\x06filterJ\x04\b\x03\x10\x04J\x04\b\x04\x10\x05R\x05spaceR\n" + - "unassigned\"I\n" + - "\x18ListAllUserStatsResponse\x12-\n" + - "\x05stats\x18\x01 \x03(\v2\x17.memos.api.v1.UserStatsR\x05stats\"\xf1\a\n" + - "\vUserSetting\x12\x17\n" + - "\x04name\x18\x01 \x01(\tB\x03\xe0A\bR\x04name\x12S\n" + - "\x0fgeneral_setting\x18\x02 \x01(\v2(.memos.api.v1.UserSetting.GeneralSettingH\x00R\x0egeneralSetting\x12V\n" + - "\x10webhooks_setting\x18\x05 \x01(\v2).memos.api.v1.UserSetting.WebhooksSettingH\x00R\x0fwebhooksSetting\x12J\n" + - "\ftags_setting\x18\x06 \x01(\v2%.memos.api.v1.UserSetting.TagsSettingH\x00R\vtagsSetting\x1a\xab\x01\n" + - "\x0eGeneralSetting\x12\x1b\n" + - "\x06locale\x18\x01 \x01(\tB\x03\xe0A\x01R\x06locale\x12,\n" + - "\x0fmemo_visibility\x18\x03 \x01(\tB\x03\xe0A\x01R\x0ememoVisibility\x12\x19\n" + - "\x05theme\x18\x04 \x01(\tB\x03\xe0A\x01R\x05theme\x123\n" + - "\x13save_media_metadata\x18\x05 \x01(\bB\x03\xe0A\x01R\x11saveMediaMetadata\x1ay\n" + - "\vTagMetadata\x12B\n" + - "\x10background_color\x18\x01 \x01(\v2\x12.google.type.ColorB\x03\xe0A\x01R\x0fbackgroundColor\x12&\n" + - "\fblur_content\x18\x02 \x01(\bB\x03\xe0A\x01R\vblurContent\x1a\xb7\x01\n" + - "\vTagsSetting\x12H\n" + - "\x04tags\x18\x01 \x03(\v2/.memos.api.v1.UserSetting.TagsSetting.TagsEntryB\x03\xe0A\x01R\x04tags\x1a^\n" + - "\tTagsEntry\x12\x10\n" + - "\x03key\x18\x01 \x01(\tR\x03key\x12;\n" + - "\x05value\x18\x02 \x01(\v2%.memos.api.v1.UserSetting.TagMetadataR\x05value:\x028\x01\x1aH\n" + - "\x0fWebhooksSetting\x125\n" + - "\bwebhooks\x18\x01 \x03(\v2\x19.memos.api.v1.UserWebhookR\bwebhooks\"?\n" + - "\x03Key\x12\x13\n" + - "\x0fKEY_UNSPECIFIED\x10\x00\x12\v\n" + - "\aGENERAL\x10\x01\x12\f\n" + - "\bWEBHOOKS\x10\x04\x12\b\n" + - "\x04TAGS\x10\x05:Y\xeaAV\n" + - "\x18memos.api.v1/UserSetting\x12\x1fusers/{user}/settings/{setting}*\fuserSettings2\vuserSettingB\a\n" + - "\x05value\"M\n" + - "\x15GetUserSettingRequest\x124\n" + - "\x04name\x18\x01 \x01(\tB \xe0A\x02\xfaA\x1a\n" + - "\x18memos.api.v1/UserSettingR\x04name\"\x96\x01\n" + - "\x18UpdateUserSettingRequest\x128\n" + - "\asetting\x18\x01 \x01(\v2\x19.memos.api.v1.UserSettingB\x03\xe0A\x02R\asetting\x12@\n" + - "\vupdate_mask\x18\x02 \x01(\v2\x1a.google.protobuf.FieldMaskB\x03\xe0A\x02R\n" + - "updateMask\"\x92\x01\n" + - "\x17ListUserSettingsRequest\x121\n" + - "\x06parent\x18\x01 \x01(\tB\x19\xe0A\x02\xfaA\x13\n" + - "\x11memos.api.v1/UserR\x06parent\x12 \n" + - "\tpage_size\x18\x02 \x01(\x05B\x03\xe0A\x01R\bpageSize\x12\"\n" + - "\n" + - "page_token\x18\x03 \x01(\tB\x03\xe0A\x01R\tpageToken\"y\n" + - "\x18ListUserSettingsResponse\x125\n" + - "\bsettings\x18\x01 \x03(\v2\x19.memos.api.v1.UserSettingR\bsettings\x12&\n" + - "\x0fnext_page_token\x18\x02 \x01(\tR\rnextPageToken\"\x98\x02\n" + + "user_stats\x18\x01 \x03(\v2\x14.memos.api.UserStatsR\tuserStats\"^\n" + + "\x13GetUserStatsRequest\x12*\n" + + "\x04name\x18\x01 \x01(\tB\x16\xe0A\x02\xfaA\x10\n" + + "\x0ememos.api/UserR\x04name\x12\x1b\n" + + "\x06filter\x18\x02 \x01(\tB\x03\xe0A\x01R\x06filter\"\x9a\x02\n" + "\bMemoView\x12\x17\n" + "\x04name\x18\x01 \x01(\tB\x03\xe0A\bR\x04name\x12\x19\n" + "\x05title\x18\x02 \x01(\tB\x03\xe0A\x02R\x05title\x12\x1b\n" + - "\x06filter\x18\x03 \x01(\tB\x03\xe0A\x02R\x06filter\x124\n" + - "\x04icon\x18\x04 \x01(\v2\x1b.memos.api.v1.MemoView.IconB\x03\xe0A\x01R\x04icon\x1aA\n" + + "\x06filter\x18\x03 \x01(\tB\x03\xe0A\x02R\x06filter\x121\n" + + "\x04icon\x18\x04 \x01(\v2\x18.memos.api.MemoView.IconB\x03\xe0A\x01R\x04icon\x1aA\n" + "\x04Icon\x12\x16\n" + "\x05emoji\x18\x01 \x01(\tH\x00R\x05emoji\x12\x18\n" + "\x06lucide\x18\x02 \x01(\tH\x00R\x06lucideB\a\n" + - "\x05value:B\xeaA?\n" + - "\x15memos.api.v1/MemoView\x12\x19users/{user}/views/{view}*\x05views2\x04view\"M\n" + - "\x14ListMemoViewsRequest\x125\n" + - "\x06parent\x18\x01 \x01(\tB\x1d\xe0A\x02\xfaA\x17\x12\x15memos.api.v1/MemoViewR\x06parent\"N\n" + - "\x15ListMemoViewsResponse\x125\n" + + "\x05value:G\xeaAD\n" + + "\x12memos.api/MemoView\x12\x19users/{user}/views/{view}*\tmemoViews2\bmemoView\"J\n" + + "\x14ListMemoViewsRequest\x122\n" + + "\x06parent\x18\x01 \x01(\tB\x1a\xe0A\x02\xfaA\x14\x12\x12memos.api/MemoViewR\x06parent\"K\n" + + "\x15ListMemoViewsResponse\x122\n" + "\n" + - "memo_views\x18\x01 \x03(\v2\x16.memos.api.v1.MemoViewR\tmemoViews\"G\n" + - "\x12GetMemoViewRequest\x121\n" + - "\x04name\x18\x01 \x01(\tB\x1d\xe0A\x02\xfaA\x17\n" + - "\x15memos.api.v1/MemoViewR\x04name\"\xb2\x01\n" + - "\x15CreateMemoViewRequest\x125\n" + - "\x06parent\x18\x01 \x01(\tB\x1d\xe0A\x02\xfaA\x17\x12\x15memos.api.v1/MemoViewR\x06parent\x128\n" + - "\tmemo_view\x18\x02 \x01(\v2\x16.memos.api.v1.MemoViewB\x03\xe0A\x02R\bmemoView\x12(\n" + - "\rvalidate_only\x18\x03 \x01(\bB\x03\xe0A\x01R\fvalidateOnly\"\x93\x01\n" + - "\x15UpdateMemoViewRequest\x128\n" + - "\tmemo_view\x18\x01 \x01(\v2\x16.memos.api.v1.MemoViewB\x03\xe0A\x02R\bmemoView\x12@\n" + + "memo_views\x18\x01 \x03(\v2\x13.memos.api.MemoViewR\tmemoViews\"D\n" + + "\x12GetMemoViewRequest\x12.\n" + + "\x04name\x18\x01 \x01(\tB\x1a\xe0A\x02\xfaA\x14\n" + + "\x12memos.api/MemoViewR\x04name\"\xac\x01\n" + + "\x15CreateMemoViewRequest\x122\n" + + "\x06parent\x18\x01 \x01(\tB\x1a\xe0A\x02\xfaA\x14\x12\x12memos.api/MemoViewR\x06parent\x125\n" + + "\tmemo_view\x18\x02 \x01(\v2\x13.memos.api.MemoViewB\x03\xe0A\x02R\bmemoView\x12(\n" + + "\rvalidate_only\x18\x03 \x01(\bB\x03\xe0A\x01R\fvalidateOnly\"\x90\x01\n" + + "\x15UpdateMemoViewRequest\x125\n" + + "\tmemo_view\x18\x01 \x01(\v2\x13.memos.api.MemoViewB\x03\xe0A\x02R\bmemoView\x12@\n" + "\vupdate_mask\x18\x02 \x01(\v2\x1a.google.protobuf.FieldMaskB\x03\xe0A\x01R\n" + - "updateMask\"J\n" + - "\x15DeleteMemoViewRequest\x121\n" + - "\x04name\x18\x01 \x01(\tB\x1d\xe0A\x02\xfaA\x17\n" + - "\x15memos.api.v1/MemoViewR\x04name\"\x84\x02\n" + - "\x0eLinkedIdentity\x12\x17\n" + - "\x04name\x18\x01 \x01(\tB\x03\xe0A\bR\x04name\x12@\n" + - "\bidp_name\x18\x02 \x01(\tB%\xe0A\x03\xfaA\x1f\n" + - "\x1dmemos.api.v1/IdentityProviderR\aidpName\x12\"\n" + - "\n" + - "extern_uid\x18\x03 \x01(\tB\x03\xe0A\x03R\texternUid:s\xeaAp\n" + - "\x1bmemos.api.v1/LinkedIdentity\x12/users/{user}/linkedIdentities/{linked_identity}*\x10linkedIdentities2\x0elinkedIdentity\"P\n" + - "\x1bListLinkedIdentitiesRequest\x121\n" + - "\x06parent\x18\x01 \x01(\tB\x19\xe0A\x02\xfaA\x13\n" + - "\x11memos.api.v1/UserR\x06parent\"i\n" + - "\x1cListLinkedIdentitiesResponse\x12I\n" + - "\x11linked_identities\x18\x01 \x03(\v2\x1c.memos.api.v1.LinkedIdentityR\x10linkedIdentities\"\xfd\x01\n" + - "\x1bCreateLinkedIdentityRequest\x121\n" + - "\x06parent\x18\x01 \x01(\tB\x19\xe0A\x02\xfaA\x13\n" + - "\x11memos.api.v1/UserR\x06parent\x12@\n" + - "\bidp_name\x18\x02 \x01(\tB%\xe0A\x02\xfaA\x1f\n" + - "\x1dmemos.api.v1/IdentityProviderR\aidpName\x12\x17\n" + - "\x04code\x18\x03 \x01(\tB\x03\xe0A\x02R\x04code\x12&\n" + - "\fredirect_uri\x18\x04 \x01(\tB\x03\xe0A\x02R\vredirectUri\x12(\n" + - "\rcode_verifier\x18\x05 \x01(\tB\x03\xe0A\x01R\fcodeVerifier\"S\n" + - "\x18GetLinkedIdentityRequest\x127\n" + - "\x04name\x18\x01 \x01(\tB#\xe0A\x02\xfaA\x1d\n" + - "\x1bmemos.api.v1/LinkedIdentityR\x04name\"V\n" + - "\x1bDeleteLinkedIdentityRequest\x127\n" + - "\x04name\x18\x01 \x01(\tB#\xe0A\x02\xfaA\x1d\n" + - "\x1bmemos.api.v1/LinkedIdentityR\x04name\"\xa7\x03\n" + - "\x13PersonalAccessToken\x12\x17\n" + - "\x04name\x18\x01 \x01(\tB\x03\xe0A\bR\x04name\x12%\n" + - "\vdescription\x18\x02 \x01(\tB\x03\xe0A\x01R\vdescription\x12>\n" + - "\n" + - "created_at\x18\x03 \x01(\v2\x1a.google.protobuf.TimestampB\x03\xe0A\x03R\tcreatedAt\x12>\n" + - "\n" + - "expires_at\x18\x04 \x01(\v2\x1a.google.protobuf.TimestampB\x03\xe0A\x01R\texpiresAt\x12A\n" + - "\flast_used_at\x18\x05 \x01(\v2\x1a.google.protobuf.TimestampB\x03\xe0A\x03R\n" + - "lastUsedAt:\x8c\x01\xeaA\x88\x01\n" + - " memos.api.v1/PersonalAccessToken\x129users/{user}/personalAccessTokens/{personal_access_token}*\x14personalAccessTokens2\x13personalAccessToken\"\x9a\x01\n" + - "\x1fListPersonalAccessTokensRequest\x121\n" + - "\x06parent\x18\x01 \x01(\tB\x19\xe0A\x02\xfaA\x13\n" + - "\x11memos.api.v1/UserR\x06parent\x12 \n" + - "\tpage_size\x18\x02 \x01(\x05B\x03\xe0A\x01R\bpageSize\x12\"\n" + - "\n" + - "page_token\x18\x03 \x01(\tB\x03\xe0A\x01R\tpageToken\"\xa3\x01\n" + - " ListPersonalAccessTokensResponse\x12W\n" + - "\x16personal_access_tokens\x18\x01 \x03(\v2!.memos.api.v1.PersonalAccessTokenR\x14personalAccessTokens\x12&\n" + - "\x0fnext_page_token\x18\x02 \x01(\tR\rnextPageToken\"\xa9\x01\n" + - " CreatePersonalAccessTokenRequest\x121\n" + - "\x06parent\x18\x01 \x01(\tB\x19\xe0A\x02\xfaA\x13\n" + - "\x11memos.api.v1/UserR\x06parent\x12%\n" + - "\vdescription\x18\x02 \x01(\tB\x03\xe0A\x01R\vdescription\x12+\n" + - "\x0fexpires_in_days\x18\x03 \x01(\x05B\x03\xe0A\x01R\rexpiresInDays\"\x90\x01\n" + - "!CreatePersonalAccessTokenResponse\x12U\n" + - "\x15personal_access_token\x18\x01 \x01(\v2!.memos.api.v1.PersonalAccessTokenR\x13personalAccessToken\x12\x14\n" + - "\x05token\x18\x02 \x01(\tR\x05token\"`\n" + - " DeletePersonalAccessTokenRequest\x12<\n" + - "\x04name\x18\x01 \x01(\tB(\xe0A\x02\xfaA\"\n" + - " memos.api.v1/PersonalAccessTokenR\x04name\"\x99\x03\n" + - "\vUserWebhook\x12\x17\n" + - "\x04name\x18\x01 \x01(\tB\x03\xe0A\bR\x04name\x12\x10\n" + - "\x03url\x18\x02 \x01(\tR\x03url\x12!\n" + - "\fdisplay_name\x18\x03 \x01(\tR\vdisplayName\x12@\n" + - "\vcreate_time\x18\x04 \x01(\v2\x1a.google.protobuf.TimestampB\x03\xe0A\x03R\n" + - "createTime\x12@\n" + - "\vupdate_time\x18\x05 \x01(\v2\x1a.google.protobuf.TimestampB\x03\xe0A\x03R\n" + - "updateTime\x12*\n" + - "\x0esigning_secret\x18\x06 \x01(\tB\x03\xe0A\x04R\rsigningSecret\x121\n" + - "\x12signing_secret_set\x18\a \x01(\bB\x03\xe0A\x03R\x10signingSecretSet:Y\xeaAV\n" + - "\x18memos.api.v1/UserWebhook\x12\x1fusers/{user}/webhooks/{webhook}*\fuserWebhooks2\vuserWebhook\"S\n" + - "\x17ListUserWebhooksRequest\x128\n" + - "\x06parent\x18\x01 \x01(\tB \xe0A\x02\xfaA\x1a\x12\x18memos.api.v1/UserWebhookR\x06parent\"Q\n" + - "\x18ListUserWebhooksResponse\x125\n" + - "\bwebhooks\x18\x01 \x03(\v2\x19.memos.api.v1.UserWebhookR\bwebhooks\"\x8e\x01\n" + - "\x18CreateUserWebhookRequest\x128\n" + - "\x06parent\x18\x01 \x01(\tB \xe0A\x02\xfaA\x1a\x12\x18memos.api.v1/UserWebhookR\x06parent\x128\n" + - "\awebhook\x18\x02 \x01(\v2\x19.memos.api.v1.UserWebhookB\x03\xe0A\x02R\awebhook\"\x91\x01\n" + - "\x18UpdateUserWebhookRequest\x128\n" + - "\awebhook\x18\x01 \x01(\v2\x19.memos.api.v1.UserWebhookB\x03\xe0A\x02R\awebhook\x12;\n" + - "\vupdate_mask\x18\x02 \x01(\v2\x1a.google.protobuf.FieldMaskR\n" + - "updateMask\"P\n" + - "\x18DeleteUserWebhookRequest\x124\n" + - "\x04name\x18\x01 \x01(\tB \xe0A\x02\xfaA\x1a\n" + - "\x18memos.api.v1/UserWebhookR\x04name\"Z\n" + - "\"GetUserWebhookSigningSecretRequest\x124\n" + - "\x04name\x18\x01 \x01(\tB \xe0A\x02\xfaA\x1a\n" + - "\x18memos.api.v1/UserWebhookR\x04name\"L\n" + - "#GetUserWebhookSigningSecretResponse\x12%\n" + - "\x0esigning_secret\x18\x01 \x01(\tR\rsigningSecret\"\xaf\f\n" + + "updateMask\"G\n" + + "\x15DeleteMemoViewRequest\x12.\n" + + "\x04name\x18\x01 \x01(\tB\x1a\xe0A\x02\xfaA\x14\n" + + "\x12memos.api/MemoViewR\x04name\"\xa1\f\n" + "\x10UserNotification\x12\x1a\n" + - "\x04name\x18\x01 \x01(\tB\x06\xe0A\x03\xe0A\bR\x04name\x121\n" + - "\x06sender\x18\x02 \x01(\tB\x19\xe0A\x03\xfaA\x13\n" + - "\x11memos.api.v1/UserR\x06sender\x128\n" + - "\vsender_user\x18\b \x01(\v2\x12.memos.api.v1.UserB\x03\xe0A\x03R\n" + - "senderUser\x12B\n" + - "\x06status\x18\x03 \x01(\x0e2%.memos.api.v1.UserNotification.StatusB\x03\xe0A\x01R\x06status\x12@\n" + - "\vcreate_time\x18\x04 \x01(\v2\x1a.google.protobuf.TimestampB\x03\xe0A\x03R\n" + - "createTime\x12<\n" + - "\x04type\x18\x05 \x01(\x0e2#.memos.api.v1.UserNotification.TypeB\x03\xe0A\x03R\x04type\x12[\n" + - "\fmemo_comment\x18\x06 \x01(\v21.memos.api.v1.UserNotification.MemoCommentPayloadB\x03\xe0A\x03H\x00R\vmemoComment\x12[\n" + - "\fmemo_mention\x18\a \x01(\v21.memos.api.v1.UserNotification.MemoMentionPayloadB\x03\xe0A\x03H\x00R\vmemoMention\x12g\n" + - "\x10space_invitation\x18\t \x01(\v25.memos.api.v1.UserNotification.SpaceInvitationPayloadB\x03\xe0A\x03H\x00R\x0fspaceInvitation\x1a\xa0\x01\n" + + "\x04name\x18\x01 \x01(\tB\x06\xe0A\x03\xe0A\bR\x04name\x12.\n" + + "\x06sender\x18\x02 \x01(\tB\x16\xe0A\x03\xfaA\x10\n" + + "\x0ememos.api/UserR\x06sender\x125\n" + + "\vsender_user\x18\x03 \x01(\v2\x0f.memos.api.UserB\x03\xe0A\x03R\n" + + "senderUser\x129\n" + + "\x04type\x18\x04 \x01(\x0e2 .memos.api.UserNotification.TypeB\x03\xe0A\x03R\x04type\x12X\n" + + "\fmemo_comment\x18\x05 \x01(\v2..memos.api.UserNotification.MemoCommentPayloadB\x03\xe0A\x03H\x00R\vmemoComment\x12X\n" + + "\fmemo_mention\x18\x06 \x01(\v2..memos.api.UserNotification.MemoMentionPayloadB\x03\xe0A\x03H\x00R\vmemoMention\x12d\n" + + "\x10space_invitation\x18\a \x01(\v22.memos.api.UserNotification.SpaceInvitationPayloadB\x03\xe0A\x03H\x00R\x0fspaceInvitation\x12?\n" + + "\x06status\x18\b \x01(\x0e2\".memos.api.UserNotification.StatusB\x03\xe0A\x01R\x06status\x12@\n" + + "\vcreate_time\x18\t \x01(\v2\x1a.google.protobuf.TimestampB\x03\xe0A\x03R\n" + + "createTime\x1a\xa0\x01\n" + "\x12MemoCommentPayload\x12\x12\n" + "\x04memo\x18\x01 \x01(\tR\x04memo\x12!\n" + "\frelated_memo\x18\x02 \x01(\tR\vrelatedMemo\x12!\n" + @@ -4980,14 +4966,14 @@ const file_api_v1_user_service_proto_rawDesc = "" + "\x04memo\x18\x01 \x01(\tR\x04memo\x12!\n" + "\frelated_memo\x18\x02 \x01(\tR\vrelatedMemo\x12!\n" + "\fmemo_snippet\x18\x03 \x01(\tR\vmemoSnippet\x120\n" + - "\x14related_memo_snippet\x18\x04 \x01(\tR\x12relatedMemoSnippet\x1a\xd3\x02\n" + - "\x16SpaceInvitationPayload\x12L\n" + - "\x10space_invitation\x18\x01 \x01(\tB!\xfaA\x1e\n" + - "\x1cmemos.api.v1/SpaceInvitationR\x0fspaceInvitation\x12)\n" + - "\x05space\x18\x02 \x01(\v2\x13.memos.api.v1.SpaceR\x05space\x122\n" + - "\x04role\x18\x03 \x01(\x0e2\x1e.memos.api.v1.SpaceMember.RoleR\x04role\x12Q\n" + - "\x05state\x18\x04 \x01(\x0e2;.memos.api.v1.UserNotification.SpaceInvitationPayload.StateR\x05state\"9\n" + - "\x05State\x12\x15\n" + + "\x14related_memo_snippet\x18\x04 \x01(\tR\x12relatedMemoSnippet\x1a\xdb\x02\n" + + "\x16SpaceInvitationPayload\x12I\n" + + "\x10space_invitation\x18\x01 \x01(\tB\x1e\xfaA\x1b\n" + + "\x19memos.api/SpaceInvitationR\x0fspaceInvitation\x12&\n" + + "\x05space\x18\x02 \x01(\v2\x10.memos.api.SpaceR\x05space\x12/\n" + + "\x04role\x18\x03 \x01(\x0e2\x1b.memos.api.SpaceMember.RoleR\x04role\x12X\n" + + "\x05state\x18\x04 \x01(\x0e2B.memos.api.UserNotification.SpaceInvitationPayload.InvitationStateR\x05state\"C\n" + + "\x0fInvitationState\x12\x15\n" + "\x11STATE_UNSPECIFIED\x10\x00\x12\v\n" + "\aPENDING\x10\x01\x12\f\n" + "\bACCEPTED\x10\x02\":\n" + @@ -5000,294 +4986,432 @@ const file_api_v1_user_service_proto_rawDesc = "" + "\x10TYPE_UNSPECIFIED\x10\x00\x12\x10\n" + "\fMEMO_COMMENT\x10\x01\x12\x10\n" + "\fMEMO_MENTION\x10\x02\x12\x14\n" + - "\x10SPACE_INVITATION\x10\x03:p\xeaAm\n" + - "\x1dmemos.api.v1/UserNotification\x12)users/{user}/notifications/{notification}\x1a\x04name*\rnotifications2\fnotificationB\t\n" + - "\apayload\"\xb4\x01\n" + - "\x1cListUserNotificationsRequest\x121\n" + - "\x06parent\x18\x01 \x01(\tB\x19\xe0A\x02\xfaA\x13\n" + - "\x11memos.api.v1/UserR\x06parent\x12 \n" + + "\x10SPACE_INVITATION\x10\x03:o\xeaAl\n" + + "\x1amemos.api/UserNotification\x12)users/{user}/notifications/{notification}*\x11userNotifications2\x10userNotificationB\t\n" + + "\apayload\"\xb1\x01\n" + + "\x1cListUserNotificationsRequest\x12.\n" + + "\x06parent\x18\x01 \x01(\tB\x16\xe0A\x02\xfaA\x10\n" + + "\x0ememos.api/UserR\x06parent\x12 \n" + "\tpage_size\x18\x02 \x01(\x05B\x03\xe0A\x01R\bpageSize\x12\"\n" + "\n" + "page_token\x18\x03 \x01(\tB\x03\xe0A\x01R\tpageToken\x12\x1b\n" + - "\x06filter\x18\x04 \x01(\tB\x03\xe0A\x01R\x06filter\"\x8d\x01\n" + - "\x1dListUserNotificationsResponse\x12D\n" + - "\rnotifications\x18\x01 \x03(\v2\x1e.memos.api.v1.UserNotificationR\rnotifications\x12&\n" + - "\x0fnext_page_token\x18\x02 \x01(\tR\rnextPageToken\"\xaa\x01\n" + - "\x1dUpdateUserNotificationRequest\x12G\n" + - "\fnotification\x18\x01 \x01(\v2\x1e.memos.api.v1.UserNotificationB\x03\xe0A\x02R\fnotification\x12@\n" + + "\x06filter\x18\x04 \x01(\tB\x03\xe0A\x01R\x06filter\"\x8a\x01\n" + + "\x1dListUserNotificationsResponse\x12A\n" + + "\rnotifications\x18\x01 \x03(\v2\x1b.memos.api.UserNotificationR\rnotifications\x12&\n" + + "\x0fnext_page_token\x18\x02 \x01(\tR\rnextPageToken\"\xa7\x01\n" + + "\x1dUpdateUserNotificationRequest\x12D\n" + + "\fnotification\x18\x01 \x01(\v2\x1b.memos.api.UserNotificationB\x03\xe0A\x02R\fnotification\x12@\n" + "\vupdate_mask\x18\x02 \x01(\v2\x1a.google.protobuf.FieldMaskB\x03\xe0A\x02R\n" + - "updateMask\"Z\n" + - "\x1dDeleteUserNotificationRequest\x129\n" + + "updateMask\"W\n" + + "\x1dDeleteUserNotificationRequest\x126\n" + + "\x04name\x18\x01 \x01(\tB\"\xe0A\x02\xfaA\x1c\n" + + "\x1amemos.api/UserNotificationR\x04name\"\x96\x03\n" + + "\vUserWebhook\x12\x17\n" + + "\x04name\x18\x01 \x01(\tB\x03\xe0A\bR\x04name\x12!\n" + + "\fdisplay_name\x18\x02 \x01(\tR\vdisplayName\x12\x10\n" + + "\x03url\x18\x03 \x01(\tR\x03url\x12*\n" + + "\x0esigning_secret\x18\x04 \x01(\tB\x03\xe0A\x04R\rsigningSecret\x121\n" + + "\x12signing_secret_set\x18\x05 \x01(\bB\x03\xe0A\x03R\x10signingSecretSet\x12@\n" + + "\vcreate_time\x18\x06 \x01(\v2\x1a.google.protobuf.TimestampB\x03\xe0A\x03R\n" + + "createTime\x12@\n" + + "\vupdate_time\x18\a \x01(\v2\x1a.google.protobuf.TimestampB\x03\xe0A\x03R\n" + + "updateTime:V\xeaAS\n" + + "\x15memos.api/UserWebhook\x12\x1fusers/{user}/webhooks/{webhook}*\fuserWebhooks2\vuserWebhook\"P\n" + + "\x17ListUserWebhooksRequest\x125\n" + + "\x06parent\x18\x01 \x01(\tB\x1d\xe0A\x02\xfaA\x17\x12\x15memos.api/UserWebhookR\x06parent\"N\n" + + "\x18ListUserWebhooksResponse\x122\n" + + "\bwebhooks\x18\x01 \x03(\v2\x16.memos.api.UserWebhookR\bwebhooks\"\x88\x01\n" + + "\x18CreateUserWebhookRequest\x125\n" + + "\x06parent\x18\x01 \x01(\tB\x1d\xe0A\x02\xfaA\x17\x12\x15memos.api/UserWebhookR\x06parent\x125\n" + + "\awebhook\x18\x02 \x01(\v2\x16.memos.api.UserWebhookB\x03\xe0A\x02R\awebhook\"\x8e\x01\n" + + "\x18UpdateUserWebhookRequest\x125\n" + + "\awebhook\x18\x01 \x01(\v2\x16.memos.api.UserWebhookB\x03\xe0A\x02R\awebhook\x12;\n" + + "\vupdate_mask\x18\x02 \x01(\v2\x1a.google.protobuf.FieldMaskR\n" + + "updateMask\"M\n" + + "\x18DeleteUserWebhookRequest\x121\n" + + "\x04name\x18\x01 \x01(\tB\x1d\xe0A\x02\xfaA\x17\n" + + "\x15memos.api/UserWebhookR\x04name\"W\n" + + "\"GetUserWebhookSigningSecretRequest\x121\n" + + "\x04name\x18\x01 \x01(\tB\x1d\xe0A\x02\xfaA\x17\n" + + "\x15memos.api/UserWebhookR\x04name\"L\n" + + "#GetUserWebhookSigningSecretResponse\x12%\n" + + "\x0esigning_secret\x18\x01 \x01(\tR\rsigningSecret\"\x94\x02\n" + + "\x0eLinkedIdentity\x12\x17\n" + + "\x04name\x18\x01 \x01(\tB\x03\xe0A\bR\x04name\x12O\n" + + "\x11identity_provider\x18\x02 \x01(\tB\"\xe0A\x03\xfaA\x1c\n" + + "\x1amemos.api/IdentityProviderR\x10identityProvider\x12&\n" + + "\fexternal_uid\x18\x03 \x01(\tB\x03\xe0A\x03R\vexternalUid:p\xeaAm\n" + + "\x18memos.api/LinkedIdentity\x12/users/{user}/linkedIdentities/{linked_identity}*\x10linkedIdentities2\x0elinkedIdentity\"M\n" + + "\x1bListLinkedIdentitiesRequest\x12.\n" + + "\x06parent\x18\x01 \x01(\tB\x16\xe0A\x02\xfaA\x10\n" + + "\x0ememos.api/UserR\x06parent\"f\n" + + "\x1cListLinkedIdentitiesResponse\x12F\n" + + "\x11linked_identities\x18\x01 \x03(\v2\x19.memos.api.LinkedIdentityR\x10linkedIdentities\"P\n" + + "\x18GetLinkedIdentityRequest\x124\n" + + "\x04name\x18\x01 \x01(\tB \xe0A\x02\xfaA\x1a\n" + + "\x18memos.api/LinkedIdentityR\x04name\"\x89\x02\n" + + "\x1bCreateLinkedIdentityRequest\x12.\n" + + "\x06parent\x18\x01 \x01(\tB\x16\xe0A\x02\xfaA\x10\n" + + "\x0ememos.api/UserR\x06parent\x12O\n" + + "\x11identity_provider\x18\x02 \x01(\tB\"\xe0A\x02\xfaA\x1c\n" + + "\x1amemos.api/IdentityProviderR\x10identityProvider\x12\x17\n" + + "\x04code\x18\x03 \x01(\tB\x03\xe0A\x02R\x04code\x12&\n" + + "\fredirect_uri\x18\x04 \x01(\tB\x03\xe0A\x02R\vredirectUri\x12(\n" + + "\rcode_verifier\x18\x05 \x01(\tB\x03\xe0A\x01R\fcodeVerifier\"S\n" + + "\x1bDeleteLinkedIdentityRequest\x124\n" + + "\x04name\x18\x01 \x01(\tB \xe0A\x02\xfaA\x1a\n" + + "\x18memos.api/LinkedIdentityR\x04name\"\xaa\x03\n" + + "\x13PersonalAccessToken\x12\x17\n" + + "\x04name\x18\x01 \x01(\tB\x03\xe0A\bR\x04name\x12%\n" + + "\vdescription\x18\x02 \x01(\tB\x03\xe0A\x01R\vdescription\x12@\n" + + "\vcreate_time\x18\x03 \x01(\v2\x1a.google.protobuf.TimestampB\x03\xe0A\x03R\n" + + "createTime\x12@\n" + + "\vexpire_time\x18\x04 \x01(\v2\x1a.google.protobuf.TimestampB\x03\xe0A\x01R\n" + + "expireTime\x12C\n" + + "\rlast_use_time\x18\x05 \x01(\v2\x1a.google.protobuf.TimestampB\x03\xe0A\x03R\vlastUseTime:\x89\x01\xeaA\x85\x01\n" + + "\x1dmemos.api/PersonalAccessToken\x129users/{user}/personalAccessTokens/{personal_access_token}*\x14personalAccessTokens2\x13personalAccessToken\"\x97\x01\n" + + "\x1fListPersonalAccessTokensRequest\x12.\n" + + "\x06parent\x18\x01 \x01(\tB\x16\xe0A\x02\xfaA\x10\n" + + "\x0ememos.api/UserR\x06parent\x12 \n" + + "\tpage_size\x18\x02 \x01(\x05B\x03\xe0A\x01R\bpageSize\x12\"\n" + + "\n" + + "page_token\x18\x03 \x01(\tB\x03\xe0A\x01R\tpageToken\"\xa0\x01\n" + + " ListPersonalAccessTokensResponse\x12T\n" + + "\x16personal_access_tokens\x18\x01 \x03(\v2\x1e.memos.api.PersonalAccessTokenR\x14personalAccessTokens\x12&\n" + + "\x0fnext_page_token\x18\x02 \x01(\tR\rnextPageToken\"\xa6\x01\n" + + " CreatePersonalAccessTokenRequest\x12.\n" + + "\x06parent\x18\x01 \x01(\tB\x16\xe0A\x02\xfaA\x10\n" + + "\x0ememos.api/UserR\x06parent\x12%\n" + + "\vdescription\x18\x02 \x01(\tB\x03\xe0A\x01R\vdescription\x12+\n" + + "\x0fexpires_in_days\x18\x03 \x01(\x05B\x03\xe0A\x01R\rexpiresInDays\"\x8d\x01\n" + + "!CreatePersonalAccessTokenResponse\x12R\n" + + "\x15personal_access_token\x18\x01 \x01(\v2\x1e.memos.api.PersonalAccessTokenR\x13personalAccessToken\x12\x14\n" + + "\x05token\x18\x02 \x01(\tR\x05token\"]\n" + + " DeletePersonalAccessTokenRequest\x129\n" + "\x04name\x18\x01 \x01(\tB%\xe0A\x02\xfaA\x1f\n" + - "\x1dmemos.api.v1/UserNotificationR\x04name2\x8d&\n" + - "\vUserService\x12c\n" + - "\tListUsers\x12\x1e.memos.api.v1.ListUsersRequest\x1a\x1f.memos.api.v1.ListUsersResponse\"\x15\x82\xd3\xe4\x93\x02\x0f\x12\r/api/v1/users\x12{\n" + - "\rBatchGetUsers\x12\".memos.api.v1.BatchGetUsersRequest\x1a#.memos.api.v1.BatchGetUsersResponse\"!\x82\xd3\xe4\x93\x02\x1b:\x01*\"\x16/api/v1/users:batchGet\x12b\n" + - "\aGetUser\x12\x1c.memos.api.v1.GetUserRequest\x1a\x12.memos.api.v1.User\"%\xdaA\x04name\x82\xd3\xe4\x93\x02\x18\x12\x16/api/v1/{name=users/*}\x12m\n" + + "\x1dmemos.api/PersonalAccessTokenR\x04name\"@\n" + + "\x12ExportMemosRequest\x12*\n" + + "\x04name\x18\x01 \x01(\tB\x16\xe0A\x02\xfaA\x10\n" + + "\x0ememos.api/UserR\x04name\"\xe3\x03\n" + + "\x12ImportMemosRequest\x12*\n" + + "\x04name\x18\x01 \x01(\tB\x16\xe0A\x02\xfaA\x10\n" + + "\x0ememos.api/UserR\x04name\x120\n" + + "\x04spec\x18\x02 \x01(\v2\x1a.memos.api.ImportMemosSpecH\x00R\x04spec\x12\x1d\n" + + "\tupload_id\x18\x03 \x01(\tH\x00R\buploadId\x12&\n" + + "\fwrite_offset\x18\x04 \x01(\x03B\x03\xe0A\x02R\vwriteOffset\x12\x17\n" + + "\x04data\x18\x05 \x01(\fB\x03\xe0A\x01R\x04data\x12&\n" + + "\ffinish_write\x18\x06 \x01(\bB\x03\xe0A\x01R\vfinishWrite\x12Z\n" + + "\x0fconflict_policy\x18\a \x01(\x0e2,.memos.api.ImportMemosRequest.ConflictPolicyB\x03\xe0A\x01R\x0econflictPolicy\x12(\n" + + "\rvalidate_only\x18\b \x01(\bB\x03\xe0A\x01R\fvalidateOnly\"W\n" + + "\x0eConflictPolicy\x12\x1f\n" + + "\x1bCONFLICT_POLICY_UNSPECIFIED\x10\x00\x12\b\n" + + "\x04SKIP\x10\x01\x12\v\n" + + "\aREPLACE\x10\x02\x12\r\n" + + "\tDUPLICATE\x10\x03B\b\n" + + "\x06upload\"\xf3\x01\n" + + "\x13ImportMemosResponse\x12\x1b\n" + + "\tupload_id\x18\x01 \x01(\tR\buploadId\x12%\n" + + "\x0ecommitted_size\x18\x02 \x01(\x03R\rcommittedSize\x12$\n" + + "\x0emax_chunk_size\x18\x03 \x01(\x05R\fmaxChunkSize\x120\n" + + "\x04plan\x18\x04 \x01(\v2\x1a.memos.api.ImportMemosPlanH\x00R\x04plan\x126\n" + + "\x06report\x18\x05 \x01(\v2\x1c.memos.api.ImportMemosReportH\x00R\x06reportB\b\n" + + "\x06result\"5\n" + + "\x0fImportMemosSpec\x12\"\n" + "\n" + - "CreateUser\x12\x1f.memos.api.v1.CreateUserRequest\x1a\x12.memos.api.v1.User\"*\xdaA\fuser,user_id\x82\xd3\xe4\x93\x02\x15:\x04user\"\r/api/v1/users\x12\x7f\n" + + "total_size\x18\x01 \x01(\x03B\x03\xe0A\x01R\ttotalSize\"\xd3\x02\n" + + "\x0fImportMemosPlan\x12;\n" + + "\vexport_time\x18\x01 \x01(\v2\x1a.google.protobuf.TimestampR\n" + + "exportTime\x12\x1a\n" + + "\bexporter\x18\x02 \x01(\tR\bexporter\x12\x1c\n" + + "\tgenerator\x18\x03 \x01(\tR\tgenerator\x12\x1d\n" + "\n" + - "UpdateUser\x12\x1f.memos.api.v1.UpdateUserRequest\x1a\x12.memos.api.v1.User\"<\xdaA\x10user,update_mask\x82\xd3\xe4\x93\x02#:\x04user2\x1b/api/v1/{user.name=users/*}\x12l\n" + + "memo_count\x18\x04 \x01(\x05R\tmemoCount\x12)\n" + + "\x10attachment_count\x18\x05 \x01(\x05R\x0fattachmentCount\x12\x10\n" + + "\x03new\x18\x06 \x01(\x05R\x03new\x12\x1a\n" + + "\bexisting\x18\a \x01(\x05R\bexisting\x12\x18\n" + + "\arenamed\x18\b \x01(\x05R\arenamed\x127\n" + + "\bwarnings\x18\t \x03(\v2\x1b.memos.api.ImportMemosIssueR\bwarnings\"\xeb\x01\n" + + "\x11ImportMemosReport\x12\x18\n" + + "\acreated\x18\x01 \x01(\x05R\acreated\x12\x18\n" + + "\aupdated\x18\x02 \x01(\x05R\aupdated\x12\x18\n" + + "\askipped\x18\x03 \x01(\x05R\askipped\x12\x16\n" + + "\x06failed\x18\x04 \x01(\x05R\x06failed\x127\n" + + "\bwarnings\x18\x05 \x03(\v2\x1b.memos.api.ImportMemosIssueR\bwarnings\x127\n" + + "\bfailures\x18\x06 \x03(\v2\x1b.memos.api.ImportMemosIssueR\bfailures\"G\n" + + "\x10ImportMemosIssue\x12\x19\n" + + "\bmemo_uid\x18\x01 \x01(\tR\amemoUid\x12\x18\n" + + "\amessage\x18\x02 \x01(\tR\amessage2\x9a$\n" + + "\vUserService\x12Z\n" + + "\tListUsers\x12\x1b.memos.api.ListUsersRequest\x1a\x1c.memos.api.ListUsersResponse\"\x12\x82\xd3\xe4\x93\x02\f\x12\n" + + "/api/users\x12Y\n" + + "\aGetUser\x12\x19.memos.api.GetUserRequest\x1a\x0f.memos.api.User\"\"\xdaA\x04name\x82\xd3\xe4\x93\x02\x15\x12\x13/api/{name=users/*}\x12r\n" + + "\rBatchGetUsers\x12\x1f.memos.api.BatchGetUsersRequest\x1a .memos.api.BatchGetUsersResponse\"\x1e\x82\xd3\xe4\x93\x02\x18:\x01*\"\x13/api/users:batchGet\x12d\n" + "\n" + - "DeleteUser\x12\x1f.memos.api.v1.DeleteUserRequest\x1a\x16.google.protobuf.Empty\"%\xdaA\x04name\x82\xd3\xe4\x93\x02\x18*\x16/api/v1/{name=users/*}\x12~\n" + - "\x10ListAllUserStats\x12%.memos.api.v1.ListAllUserStatsRequest\x1a&.memos.api.v1.ListAllUserStatsResponse\"\x1b\x82\xd3\xe4\x93\x02\x15\x12\x13/api/v1/users:stats\x12z\n" + - "\fGetUserStats\x12!.memos.api.v1.GetUserStatsRequest\x1a\x17.memos.api.v1.UserStats\".\xdaA\x04name\x82\xd3\xe4\x93\x02!\x12\x1f/api/v1/{name=users/*}:getStats\x12x\n" + - "\vExportMemos\x12 .memos.api.v1.ExportMemosRequest\x1a\x14.google.api.HttpBody\"1\xdaA\x04name\x82\xd3\xe4\x93\x02$\x12\"/api/v1/{name=users/*}:exportMemos\x12\x81\x01\n" + - "\vImportMemos\x12 .memos.api.v1.ImportMemosRequest\x1a!.memos.api.v1.ImportMemosResponse\"-\x82\xd3\xe4\x93\x02':\x01*\"\"/api/v1/{name=users/*}:importMemos\x12\x82\x01\n" + - "\x0eGetUserSetting\x12#.memos.api.v1.GetUserSettingRequest\x1a\x19.memos.api.v1.UserSetting\"0\xdaA\x04name\x82\xd3\xe4\x93\x02#\x12!/api/v1/{name=users/*/settings/*}\x12\xa8\x01\n" + - "\x11UpdateUserSetting\x12&.memos.api.v1.UpdateUserSettingRequest\x1a\x19.memos.api.v1.UserSetting\"P\xdaA\x13setting,update_mask\x82\xd3\xe4\x93\x024:\asetting2)/api/v1/{setting.name=users/*/settings/*}\x12\x95\x01\n" + - "\x10ListUserSettings\x12%.memos.api.v1.ListUserSettingsRequest\x1a&.memos.api.v1.ListUserSettingsResponse\"2\xdaA\x06parent\x82\xd3\xe4\x93\x02#\x12!/api/v1/{parent=users/*}/settings\x12\x89\x01\n" + - "\rListMemoViews\x12\".memos.api.v1.ListMemoViewsRequest\x1a#.memos.api.v1.ListMemoViewsResponse\"/\xdaA\x06parent\x82\xd3\xe4\x93\x02 \x12\x1e/api/v1/{parent=users/*}/views\x12v\n" + - "\vGetMemoView\x12 .memos.api.v1.GetMemoViewRequest\x1a\x16.memos.api.v1.MemoView\"-\xdaA\x04name\x82\xd3\xe4\x93\x02 \x12\x1e/api/v1/{name=users/*/views/*}\x12\x93\x01\n" + - "\x0eCreateMemoView\x12#.memos.api.v1.CreateMemoViewRequest\x1a\x16.memos.api.v1.MemoView\"D\xdaA\x10parent,memo_view\x82\xd3\xe4\x93\x02+:\tmemo_view\"\x1e/api/v1/{parent=users/*}/views\x12\xa2\x01\n" + - "\x0eUpdateMemoView\x12#.memos.api.v1.UpdateMemoViewRequest\x1a\x16.memos.api.v1.MemoView\"S\xdaA\x15memo_view,update_mask\x82\xd3\xe4\x93\x025:\tmemo_view2(/api/v1/{memo_view.name=users/*/views/*}\x12|\n" + - "\x0eDeleteMemoView\x12#.memos.api.v1.DeleteMemoViewRequest\x1a\x16.google.protobuf.Empty\"-\xdaA\x04name\x82\xd3\xe4\x93\x02 *\x1e/api/v1/{name=users/*/views/*}\x12\xa9\x01\n" + - "\x14ListLinkedIdentities\x12).memos.api.v1.ListLinkedIdentitiesRequest\x1a*.memos.api.v1.ListLinkedIdentitiesResponse\":\xdaA\x06parent\x82\xd3\xe4\x93\x02+\x12)/api/v1/{parent=users/*}/linkedIdentities\x12\xa7\x01\n" + - "\x14CreateLinkedIdentity\x12).memos.api.v1.CreateLinkedIdentityRequest\x1a\x1c.memos.api.v1.LinkedIdentity\"F\xdaA\x0fparent,idp_name\x82\xd3\xe4\x93\x02.:\x01*\")/api/v1/{parent=users/*}/linkedIdentities\x12\x93\x01\n" + - "\x11GetLinkedIdentity\x12&.memos.api.v1.GetLinkedIdentityRequest\x1a\x1c.memos.api.v1.LinkedIdentity\"8\xdaA\x04name\x82\xd3\xe4\x93\x02+\x12)/api/v1/{name=users/*/linkedIdentities/*}\x12\x93\x01\n" + - "\x14DeleteLinkedIdentity\x12).memos.api.v1.DeleteLinkedIdentityRequest\x1a\x16.google.protobuf.Empty\"8\xdaA\x04name\x82\xd3\xe4\x93\x02+*)/api/v1/{name=users/*/linkedIdentities/*}\x12\xb9\x01\n" + - "\x18ListPersonalAccessTokens\x12-.memos.api.v1.ListPersonalAccessTokensRequest\x1a..memos.api.v1.ListPersonalAccessTokensResponse\">\xdaA\x06parent\x82\xd3\xe4\x93\x02/\x12-/api/v1/{parent=users/*}/personalAccessTokens\x12\xb6\x01\n" + - "\x19CreatePersonalAccessToken\x12..memos.api.v1.CreatePersonalAccessTokenRequest\x1a/.memos.api.v1.CreatePersonalAccessTokenResponse\"8\x82\xd3\xe4\x93\x022:\x01*\"-/api/v1/{parent=users/*}/personalAccessTokens\x12\xa1\x01\n" + - "\x19DeletePersonalAccessToken\x12..memos.api.v1.DeletePersonalAccessTokenRequest\x1a\x16.google.protobuf.Empty\"<\xdaA\x04name\x82\xd3\xe4\x93\x02/*-/api/v1/{name=users/*/personalAccessTokens/*}\x12\x95\x01\n" + - "\x10ListUserWebhooks\x12%.memos.api.v1.ListUserWebhooksRequest\x1a&.memos.api.v1.ListUserWebhooksResponse\"2\xdaA\x06parent\x82\xd3\xe4\x93\x02#\x12!/api/v1/{parent=users/*}/webhooks\x12\x9b\x01\n" + - "\x11CreateUserWebhook\x12&.memos.api.v1.CreateUserWebhookRequest\x1a\x19.memos.api.v1.UserWebhook\"C\xdaA\x0eparent,webhook\x82\xd3\xe4\x93\x02,:\awebhook\"!/api/v1/{parent=users/*}/webhooks\x12\xa8\x01\n" + - "\x11UpdateUserWebhook\x12&.memos.api.v1.UpdateUserWebhookRequest\x1a\x19.memos.api.v1.UserWebhook\"P\xdaA\x13webhook,update_mask\x82\xd3\xe4\x93\x024:\awebhook2)/api/v1/{webhook.name=users/*/webhooks/*}\x12\x85\x01\n" + - "\x11DeleteUserWebhook\x12&.memos.api.v1.DeleteUserWebhookRequest\x1a\x16.google.protobuf.Empty\"0\xdaA\x04name\x82\xd3\xe4\x93\x02#*!/api/v1/{name=users/*/webhooks/*}\x12\xc5\x01\n" + - "\x1bGetUserWebhookSigningSecret\x120.memos.api.v1.GetUserWebhookSigningSecretRequest\x1a1.memos.api.v1.GetUserWebhookSigningSecretResponse\"A\xdaA\x04name\x82\xd3\xe4\x93\x024\x122/api/v1/{name=users/*/webhooks/*}:getSigningSecret\x12\xa9\x01\n" + - "\x15ListUserNotifications\x12*.memos.api.v1.ListUserNotificationsRequest\x1a+.memos.api.v1.ListUserNotificationsResponse\"7\xdaA\x06parent\x82\xd3\xe4\x93\x02(\x12&/api/v1/{parent=users/*}/notifications\x12\xcb\x01\n" + - "\x16UpdateUserNotification\x12+.memos.api.v1.UpdateUserNotificationRequest\x1a\x1e.memos.api.v1.UserNotification\"d\xdaA\x18notification,update_mask\x82\xd3\xe4\x93\x02C:\fnotification23/api/v1/{notification.name=users/*/notifications/*}\x12\x94\x01\n" + - "\x16DeleteUserNotification\x12+.memos.api.v1.DeleteUserNotificationRequest\x1a\x16.google.protobuf.Empty\"5\xdaA\x04name\x82\xd3\xe4\x93\x02(*&/api/v1/{name=users/*/notifications/*}B\xa8\x01\n" + - "\x10com.memos.api.v1B\x10UserServiceProtoP\x01Z0github.com/usememos/memos/proto/gen/api/v1;apiv1\xa2\x02\x03MAX\xaa\x02\fMemos.Api.V1\xca\x02\fMemos\\Api\\V1\xe2\x02\x18Memos\\Api\\V1\\GPBMetadata\xea\x02\x0eMemos::Api::V1b\x06proto3" + "CreateUser\x12\x1c.memos.api.CreateUserRequest\x1a\x0f.memos.api.User\"'\xdaA\fuser,user_id\x82\xd3\xe4\x93\x02\x12:\x04user\"\n" + + "/api/users\x12v\n" + + "\n" + + "UpdateUser\x12\x1c.memos.api.UpdateUserRequest\x1a\x0f.memos.api.User\"9\xdaA\x10user,update_mask\x82\xd3\xe4\x93\x02 :\x04user2\x18/api/{user.name=users/*}\x12f\n" + + "\n" + + "DeleteUser\x12\x1c.memos.api.DeleteUserRequest\x1a\x16.google.protobuf.Empty\"\"\xdaA\x04name\x82\xd3\xe4\x93\x02\x15*\x13/api/{name=users/*}\x12\x8c\x01\n" + + "\x10ListUserSettings\x12\".memos.api.ListUserSettingsRequest\x1a#.memos.api.ListUserSettingsResponse\"/\xdaA\x06parent\x82\xd3\xe4\x93\x02 \x12\x1e/api/{parent=users/*}/settings\x12y\n" + + "\x0eGetUserSetting\x12 .memos.api.GetUserSettingRequest\x1a\x16.memos.api.UserSetting\"-\xdaA\x04name\x82\xd3\xe4\x93\x02 \x12\x1e/api/{name=users/*/settings/*}\x12\xae\x01\n" + + "\x11UpdateUserSetting\x12#.memos.api.UpdateUserSettingRequest\x1a\x16.memos.api.UserSetting\"\\\xdaA\x18user_setting,update_mask\x82\xd3\xe4\x93\x02;:\fuser_setting2+/api/{user_setting.name=users/*/settings/*}\x12\x80\x01\n" + + "\rListUserStats\x12\x1f.memos.api.ListUserStatsRequest\x1a .memos.api.ListUserStatsResponse\",\xdaA\x06parent\x82\xd3\xe4\x93\x02\x1d\x12\x1b/api/{parent=users/*}/stats\x12q\n" + + "\fGetUserStats\x12\x1e.memos.api.GetUserStatsRequest\x1a\x14.memos.api.UserStats\"+\xdaA\x04name\x82\xd3\xe4\x93\x02\x1e\x12\x1c/api/{name=users/*}:getStats\x12\x80\x01\n" + + "\rListMemoViews\x12\x1f.memos.api.ListMemoViewsRequest\x1a .memos.api.ListMemoViewsResponse\",\xdaA\x06parent\x82\xd3\xe4\x93\x02\x1d\x12\x1b/api/{parent=users/*}/views\x12m\n" + + "\vGetMemoView\x12\x1d.memos.api.GetMemoViewRequest\x1a\x13.memos.api.MemoView\"*\xdaA\x04name\x82\xd3\xe4\x93\x02\x1d\x12\x1b/api/{name=users/*/views/*}\x12\x8a\x01\n" + + "\x0eCreateMemoView\x12 .memos.api.CreateMemoViewRequest\x1a\x13.memos.api.MemoView\"A\xdaA\x10parent,memo_view\x82\xd3\xe4\x93\x02(:\tmemo_view\"\x1b/api/{parent=users/*}/views\x12\x99\x01\n" + + "\x0eUpdateMemoView\x12 .memos.api.UpdateMemoViewRequest\x1a\x13.memos.api.MemoView\"P\xdaA\x15memo_view,update_mask\x82\xd3\xe4\x93\x022:\tmemo_view2%/api/{memo_view.name=users/*/views/*}\x12v\n" + + "\x0eDeleteMemoView\x12 .memos.api.DeleteMemoViewRequest\x1a\x16.google.protobuf.Empty\"*\xdaA\x04name\x82\xd3\xe4\x93\x02\x1d*\x1b/api/{name=users/*/views/*}\x12\xa0\x01\n" + + "\x15ListUserNotifications\x12'.memos.api.ListUserNotificationsRequest\x1a(.memos.api.ListUserNotificationsResponse\"4\xdaA\x06parent\x82\xd3\xe4\x93\x02%\x12#/api/{parent=users/*}/notifications\x12\xc2\x01\n" + + "\x16UpdateUserNotification\x12(.memos.api.UpdateUserNotificationRequest\x1a\x1b.memos.api.UserNotification\"a\xdaA\x18notification,update_mask\x82\xd3\xe4\x93\x02@:\fnotification20/api/{notification.name=users/*/notifications/*}\x12\x8e\x01\n" + + "\x16DeleteUserNotification\x12(.memos.api.DeleteUserNotificationRequest\x1a\x16.google.protobuf.Empty\"2\xdaA\x04name\x82\xd3\xe4\x93\x02%*#/api/{name=users/*/notifications/*}\x12\x8c\x01\n" + + "\x10ListUserWebhooks\x12\".memos.api.ListUserWebhooksRequest\x1a#.memos.api.ListUserWebhooksResponse\"/\xdaA\x06parent\x82\xd3\xe4\x93\x02 \x12\x1e/api/{parent=users/*}/webhooks\x12\x92\x01\n" + + "\x11CreateUserWebhook\x12#.memos.api.CreateUserWebhookRequest\x1a\x16.memos.api.UserWebhook\"@\xdaA\x0eparent,webhook\x82\xd3\xe4\x93\x02):\awebhook\"\x1e/api/{parent=users/*}/webhooks\x12\x9f\x01\n" + + "\x11UpdateUserWebhook\x12#.memos.api.UpdateUserWebhookRequest\x1a\x16.memos.api.UserWebhook\"M\xdaA\x13webhook,update_mask\x82\xd3\xe4\x93\x021:\awebhook2&/api/{webhook.name=users/*/webhooks/*}\x12\x7f\n" + + "\x11DeleteUserWebhook\x12#.memos.api.DeleteUserWebhookRequest\x1a\x16.google.protobuf.Empty\"-\xdaA\x04name\x82\xd3\xe4\x93\x02 *\x1e/api/{name=users/*/webhooks/*}\x12\xbc\x01\n" + + "\x1bGetUserWebhookSigningSecret\x12-.memos.api.GetUserWebhookSigningSecretRequest\x1a..memos.api.GetUserWebhookSigningSecretResponse\">\xdaA\x04name\x82\xd3\xe4\x93\x021\x12//api/{name=users/*/webhooks/*}:getSigningSecret\x12\xa0\x01\n" + + "\x14ListLinkedIdentities\x12&.memos.api.ListLinkedIdentitiesRequest\x1a'.memos.api.ListLinkedIdentitiesResponse\"7\xdaA\x06parent\x82\xd3\xe4\x93\x02(\x12&/api/{parent=users/*}/linkedIdentities\x12\x8a\x01\n" + + "\x11GetLinkedIdentity\x12#.memos.api.GetLinkedIdentityRequest\x1a\x19.memos.api.LinkedIdentity\"5\xdaA\x04name\x82\xd3\xe4\x93\x02(\x12&/api/{name=users/*/linkedIdentities/*}\x12\xa7\x01\n" + + "\x14CreateLinkedIdentity\x12&.memos.api.CreateLinkedIdentityRequest\x1a\x19.memos.api.LinkedIdentity\"L\xdaA\x18parent,identity_provider\x82\xd3\xe4\x93\x02+:\x01*\"&/api/{parent=users/*}/linkedIdentities\x12\x8d\x01\n" + + "\x14DeleteLinkedIdentity\x12&.memos.api.DeleteLinkedIdentityRequest\x1a\x16.google.protobuf.Empty\"5\xdaA\x04name\x82\xd3\xe4\x93\x02(*&/api/{name=users/*/linkedIdentities/*}\x12\xb0\x01\n" + + "\x18ListPersonalAccessTokens\x12*.memos.api.ListPersonalAccessTokensRequest\x1a+.memos.api.ListPersonalAccessTokensResponse\";\xdaA\x06parent\x82\xd3\xe4\x93\x02,\x12*/api/{parent=users/*}/personalAccessTokens\x12\xad\x01\n" + + "\x19CreatePersonalAccessToken\x12+.memos.api.CreatePersonalAccessTokenRequest\x1a,.memos.api.CreatePersonalAccessTokenResponse\"5\x82\xd3\xe4\x93\x02/:\x01*\"*/api/{parent=users/*}/personalAccessTokens\x12\x9b\x01\n" + + "\x19DeletePersonalAccessToken\x12+.memos.api.DeletePersonalAccessTokenRequest\x1a\x16.google.protobuf.Empty\"9\xdaA\x04name\x82\xd3\xe4\x93\x02,**/api/{name=users/*/personalAccessTokens/*}\x12r\n" + + "\vExportMemos\x12\x1d.memos.api.ExportMemosRequest\x1a\x14.google.api.HttpBody\".\xdaA\x04name\x82\xd3\xe4\x93\x02!\x12\x1f/api/{name=users/*}:exportMemos\x12x\n" + + "\vImportMemos\x12\x1d.memos.api.ImportMemosRequest\x1a\x1e.memos.api.ImportMemosResponse\"*\x82\xd3\xe4\x93\x02$:\x01*\"\x1f/api/{name=users/*}:importMemosB\x8f\x01\n" + + "\rcom.memos.apiB\x10UserServiceProtoP\x01Z'github.com/usememos/memos/proto/gen/api\xa2\x02\x03MAX\xaa\x02\tMemos.Api\xca\x02\tMemos\\Api\xe2\x02\x15Memos\\Api\\GPBMetadata\xea\x02\n" + + "Memos::Apib\x06proto3" var ( - file_api_v1_user_service_proto_rawDescOnce sync.Once - file_api_v1_user_service_proto_rawDescData []byte + file_api_user_service_proto_rawDescOnce sync.Once + file_api_user_service_proto_rawDescData []byte ) -func file_api_v1_user_service_proto_rawDescGZIP() []byte { - file_api_v1_user_service_proto_rawDescOnce.Do(func() { - file_api_v1_user_service_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_api_v1_user_service_proto_rawDesc), len(file_api_v1_user_service_proto_rawDesc))) +func file_api_user_service_proto_rawDescGZIP() []byte { + file_api_user_service_proto_rawDescOnce.Do(func() { + file_api_user_service_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_api_user_service_proto_rawDesc), len(file_api_user_service_proto_rawDesc))) }) - return file_api_v1_user_service_proto_rawDescData + return file_api_user_service_proto_rawDescData } -var file_api_v1_user_service_proto_enumTypes = make([]protoimpl.EnumInfo, 6) -var file_api_v1_user_service_proto_msgTypes = make([]protoimpl.MessageInfo, 68) -var file_api_v1_user_service_proto_goTypes = []any{ - (User_Role)(0), // 0: memos.api.v1.User.Role - (ImportMemosRequest_ConflictPolicy)(0), // 1: memos.api.v1.ImportMemosRequest.ConflictPolicy - (UserSetting_Key)(0), // 2: memos.api.v1.UserSetting.Key - (UserNotification_Status)(0), // 3: memos.api.v1.UserNotification.Status - (UserNotification_Type)(0), // 4: memos.api.v1.UserNotification.Type - (UserNotification_SpaceInvitationPayload_State)(0), // 5: memos.api.v1.UserNotification.SpaceInvitationPayload.State - (*User)(nil), // 6: memos.api.v1.User - (*ListUsersRequest)(nil), // 7: memos.api.v1.ListUsersRequest - (*ListUsersResponse)(nil), // 8: memos.api.v1.ListUsersResponse - (*BatchGetUsersRequest)(nil), // 9: memos.api.v1.BatchGetUsersRequest - (*BatchGetUsersResponse)(nil), // 10: memos.api.v1.BatchGetUsersResponse - (*GetUserRequest)(nil), // 11: memos.api.v1.GetUserRequest - (*CreateUserRequest)(nil), // 12: memos.api.v1.CreateUserRequest - (*UpdateUserRequest)(nil), // 13: memos.api.v1.UpdateUserRequest - (*DeleteUserRequest)(nil), // 14: memos.api.v1.DeleteUserRequest - (*UserStats)(nil), // 15: memos.api.v1.UserStats - (*ExportMemosRequest)(nil), // 16: memos.api.v1.ExportMemosRequest - (*ImportMemosRequest)(nil), // 17: memos.api.v1.ImportMemosRequest - (*ImportMemosSpec)(nil), // 18: memos.api.v1.ImportMemosSpec - (*ImportMemosResponse)(nil), // 19: memos.api.v1.ImportMemosResponse - (*MemoImportIssue)(nil), // 20: memos.api.v1.MemoImportIssue - (*MemoImportPlan)(nil), // 21: memos.api.v1.MemoImportPlan - (*MemoImportReport)(nil), // 22: memos.api.v1.MemoImportReport - (*GetUserStatsRequest)(nil), // 23: memos.api.v1.GetUserStatsRequest - (*ListAllUserStatsRequest)(nil), // 24: memos.api.v1.ListAllUserStatsRequest - (*ListAllUserStatsResponse)(nil), // 25: memos.api.v1.ListAllUserStatsResponse - (*UserSetting)(nil), // 26: memos.api.v1.UserSetting - (*GetUserSettingRequest)(nil), // 27: memos.api.v1.GetUserSettingRequest - (*UpdateUserSettingRequest)(nil), // 28: memos.api.v1.UpdateUserSettingRequest - (*ListUserSettingsRequest)(nil), // 29: memos.api.v1.ListUserSettingsRequest - (*ListUserSettingsResponse)(nil), // 30: memos.api.v1.ListUserSettingsResponse - (*MemoView)(nil), // 31: memos.api.v1.MemoView - (*ListMemoViewsRequest)(nil), // 32: memos.api.v1.ListMemoViewsRequest - (*ListMemoViewsResponse)(nil), // 33: memos.api.v1.ListMemoViewsResponse - (*GetMemoViewRequest)(nil), // 34: memos.api.v1.GetMemoViewRequest - (*CreateMemoViewRequest)(nil), // 35: memos.api.v1.CreateMemoViewRequest - (*UpdateMemoViewRequest)(nil), // 36: memos.api.v1.UpdateMemoViewRequest - (*DeleteMemoViewRequest)(nil), // 37: memos.api.v1.DeleteMemoViewRequest - (*LinkedIdentity)(nil), // 38: memos.api.v1.LinkedIdentity - (*ListLinkedIdentitiesRequest)(nil), // 39: memos.api.v1.ListLinkedIdentitiesRequest - (*ListLinkedIdentitiesResponse)(nil), // 40: memos.api.v1.ListLinkedIdentitiesResponse - (*CreateLinkedIdentityRequest)(nil), // 41: memos.api.v1.CreateLinkedIdentityRequest - (*GetLinkedIdentityRequest)(nil), // 42: memos.api.v1.GetLinkedIdentityRequest - (*DeleteLinkedIdentityRequest)(nil), // 43: memos.api.v1.DeleteLinkedIdentityRequest - (*PersonalAccessToken)(nil), // 44: memos.api.v1.PersonalAccessToken - (*ListPersonalAccessTokensRequest)(nil), // 45: memos.api.v1.ListPersonalAccessTokensRequest - (*ListPersonalAccessTokensResponse)(nil), // 46: memos.api.v1.ListPersonalAccessTokensResponse - (*CreatePersonalAccessTokenRequest)(nil), // 47: memos.api.v1.CreatePersonalAccessTokenRequest - (*CreatePersonalAccessTokenResponse)(nil), // 48: memos.api.v1.CreatePersonalAccessTokenResponse - (*DeletePersonalAccessTokenRequest)(nil), // 49: memos.api.v1.DeletePersonalAccessTokenRequest - (*UserWebhook)(nil), // 50: memos.api.v1.UserWebhook - (*ListUserWebhooksRequest)(nil), // 51: memos.api.v1.ListUserWebhooksRequest - (*ListUserWebhooksResponse)(nil), // 52: memos.api.v1.ListUserWebhooksResponse - (*CreateUserWebhookRequest)(nil), // 53: memos.api.v1.CreateUserWebhookRequest - (*UpdateUserWebhookRequest)(nil), // 54: memos.api.v1.UpdateUserWebhookRequest - (*DeleteUserWebhookRequest)(nil), // 55: memos.api.v1.DeleteUserWebhookRequest - (*GetUserWebhookSigningSecretRequest)(nil), // 56: memos.api.v1.GetUserWebhookSigningSecretRequest - (*GetUserWebhookSigningSecretResponse)(nil), // 57: memos.api.v1.GetUserWebhookSigningSecretResponse - (*UserNotification)(nil), // 58: memos.api.v1.UserNotification - (*ListUserNotificationsRequest)(nil), // 59: memos.api.v1.ListUserNotificationsRequest - (*ListUserNotificationsResponse)(nil), // 60: memos.api.v1.ListUserNotificationsResponse - (*UpdateUserNotificationRequest)(nil), // 61: memos.api.v1.UpdateUserNotificationRequest - (*DeleteUserNotificationRequest)(nil), // 62: memos.api.v1.DeleteUserNotificationRequest - nil, // 63: memos.api.v1.UserStats.TagCountEntry - (*UserStats_MemoTypeStats)(nil), // 64: memos.api.v1.UserStats.MemoTypeStats - (*UserSetting_GeneralSetting)(nil), // 65: memos.api.v1.UserSetting.GeneralSetting - (*UserSetting_TagMetadata)(nil), // 66: memos.api.v1.UserSetting.TagMetadata - (*UserSetting_TagsSetting)(nil), // 67: memos.api.v1.UserSetting.TagsSetting - (*UserSetting_WebhooksSetting)(nil), // 68: memos.api.v1.UserSetting.WebhooksSetting - nil, // 69: memos.api.v1.UserSetting.TagsSetting.TagsEntry - (*MemoView_Icon)(nil), // 70: memos.api.v1.MemoView.Icon - (*UserNotification_MemoCommentPayload)(nil), // 71: memos.api.v1.UserNotification.MemoCommentPayload - (*UserNotification_MemoMentionPayload)(nil), // 72: memos.api.v1.UserNotification.MemoMentionPayload - (*UserNotification_SpaceInvitationPayload)(nil), // 73: memos.api.v1.UserNotification.SpaceInvitationPayload - (State)(0), // 74: memos.api.v1.State +var file_api_user_service_proto_enumTypes = make([]protoimpl.EnumInfo, 6) +var file_api_user_service_proto_msgTypes = make([]protoimpl.MessageInfo, 68) +var file_api_user_service_proto_goTypes = []any{ + (User_Role)(0), // 0: memos.api.User.Role + (UserSetting_Key)(0), // 1: memos.api.UserSetting.Key + (UserNotification_Status)(0), // 2: memos.api.UserNotification.Status + (UserNotification_Type)(0), // 3: memos.api.UserNotification.Type + (UserNotification_SpaceInvitationPayload_InvitationState)(0), // 4: memos.api.UserNotification.SpaceInvitationPayload.InvitationState + (ImportMemosRequest_ConflictPolicy)(0), // 5: memos.api.ImportMemosRequest.ConflictPolicy + (*User)(nil), // 6: memos.api.User + (*ListUsersRequest)(nil), // 7: memos.api.ListUsersRequest + (*ListUsersResponse)(nil), // 8: memos.api.ListUsersResponse + (*GetUserRequest)(nil), // 9: memos.api.GetUserRequest + (*BatchGetUsersRequest)(nil), // 10: memos.api.BatchGetUsersRequest + (*BatchGetUsersResponse)(nil), // 11: memos.api.BatchGetUsersResponse + (*CreateUserRequest)(nil), // 12: memos.api.CreateUserRequest + (*UpdateUserRequest)(nil), // 13: memos.api.UpdateUserRequest + (*DeleteUserRequest)(nil), // 14: memos.api.DeleteUserRequest + (*UserSetting)(nil), // 15: memos.api.UserSetting + (*ListUserSettingsRequest)(nil), // 16: memos.api.ListUserSettingsRequest + (*ListUserSettingsResponse)(nil), // 17: memos.api.ListUserSettingsResponse + (*GetUserSettingRequest)(nil), // 18: memos.api.GetUserSettingRequest + (*UpdateUserSettingRequest)(nil), // 19: memos.api.UpdateUserSettingRequest + (*UserStats)(nil), // 20: memos.api.UserStats + (*ListUserStatsRequest)(nil), // 21: memos.api.ListUserStatsRequest + (*ListUserStatsResponse)(nil), // 22: memos.api.ListUserStatsResponse + (*GetUserStatsRequest)(nil), // 23: memos.api.GetUserStatsRequest + (*MemoView)(nil), // 24: memos.api.MemoView + (*ListMemoViewsRequest)(nil), // 25: memos.api.ListMemoViewsRequest + (*ListMemoViewsResponse)(nil), // 26: memos.api.ListMemoViewsResponse + (*GetMemoViewRequest)(nil), // 27: memos.api.GetMemoViewRequest + (*CreateMemoViewRequest)(nil), // 28: memos.api.CreateMemoViewRequest + (*UpdateMemoViewRequest)(nil), // 29: memos.api.UpdateMemoViewRequest + (*DeleteMemoViewRequest)(nil), // 30: memos.api.DeleteMemoViewRequest + (*UserNotification)(nil), // 31: memos.api.UserNotification + (*ListUserNotificationsRequest)(nil), // 32: memos.api.ListUserNotificationsRequest + (*ListUserNotificationsResponse)(nil), // 33: memos.api.ListUserNotificationsResponse + (*UpdateUserNotificationRequest)(nil), // 34: memos.api.UpdateUserNotificationRequest + (*DeleteUserNotificationRequest)(nil), // 35: memos.api.DeleteUserNotificationRequest + (*UserWebhook)(nil), // 36: memos.api.UserWebhook + (*ListUserWebhooksRequest)(nil), // 37: memos.api.ListUserWebhooksRequest + (*ListUserWebhooksResponse)(nil), // 38: memos.api.ListUserWebhooksResponse + (*CreateUserWebhookRequest)(nil), // 39: memos.api.CreateUserWebhookRequest + (*UpdateUserWebhookRequest)(nil), // 40: memos.api.UpdateUserWebhookRequest + (*DeleteUserWebhookRequest)(nil), // 41: memos.api.DeleteUserWebhookRequest + (*GetUserWebhookSigningSecretRequest)(nil), // 42: memos.api.GetUserWebhookSigningSecretRequest + (*GetUserWebhookSigningSecretResponse)(nil), // 43: memos.api.GetUserWebhookSigningSecretResponse + (*LinkedIdentity)(nil), // 44: memos.api.LinkedIdentity + (*ListLinkedIdentitiesRequest)(nil), // 45: memos.api.ListLinkedIdentitiesRequest + (*ListLinkedIdentitiesResponse)(nil), // 46: memos.api.ListLinkedIdentitiesResponse + (*GetLinkedIdentityRequest)(nil), // 47: memos.api.GetLinkedIdentityRequest + (*CreateLinkedIdentityRequest)(nil), // 48: memos.api.CreateLinkedIdentityRequest + (*DeleteLinkedIdentityRequest)(nil), // 49: memos.api.DeleteLinkedIdentityRequest + (*PersonalAccessToken)(nil), // 50: memos.api.PersonalAccessToken + (*ListPersonalAccessTokensRequest)(nil), // 51: memos.api.ListPersonalAccessTokensRequest + (*ListPersonalAccessTokensResponse)(nil), // 52: memos.api.ListPersonalAccessTokensResponse + (*CreatePersonalAccessTokenRequest)(nil), // 53: memos.api.CreatePersonalAccessTokenRequest + (*CreatePersonalAccessTokenResponse)(nil), // 54: memos.api.CreatePersonalAccessTokenResponse + (*DeletePersonalAccessTokenRequest)(nil), // 55: memos.api.DeletePersonalAccessTokenRequest + (*ExportMemosRequest)(nil), // 56: memos.api.ExportMemosRequest + (*ImportMemosRequest)(nil), // 57: memos.api.ImportMemosRequest + (*ImportMemosResponse)(nil), // 58: memos.api.ImportMemosResponse + (*ImportMemosSpec)(nil), // 59: memos.api.ImportMemosSpec + (*ImportMemosPlan)(nil), // 60: memos.api.ImportMemosPlan + (*ImportMemosReport)(nil), // 61: memos.api.ImportMemosReport + (*ImportMemosIssue)(nil), // 62: memos.api.ImportMemosIssue + (*UserSetting_GeneralSetting)(nil), // 63: memos.api.UserSetting.GeneralSetting + (*UserSetting_WebhooksSetting)(nil), // 64: memos.api.UserSetting.WebhooksSetting + (*UserSetting_TagsSetting)(nil), // 65: memos.api.UserSetting.TagsSetting + (*UserSetting_TagMetadata)(nil), // 66: memos.api.UserSetting.TagMetadata + nil, // 67: memos.api.UserSetting.TagsSetting.TagsEntry + nil, // 68: memos.api.UserStats.TagCountsEntry + (*UserStats_MemoTypeStats)(nil), // 69: memos.api.UserStats.MemoTypeStats + (*MemoView_Icon)(nil), // 70: memos.api.MemoView.Icon + (*UserNotification_MemoCommentPayload)(nil), // 71: memos.api.UserNotification.MemoCommentPayload + (*UserNotification_MemoMentionPayload)(nil), // 72: memos.api.UserNotification.MemoMentionPayload + (*UserNotification_SpaceInvitationPayload)(nil), // 73: memos.api.UserNotification.SpaceInvitationPayload + (State)(0), // 74: memos.api.State (*timestamppb.Timestamp)(nil), // 75: google.protobuf.Timestamp (*fieldmaskpb.FieldMask)(nil), // 76: google.protobuf.FieldMask (*color.Color)(nil), // 77: google.type.Color - (*Space)(nil), // 78: memos.api.v1.Space - (SpaceMember_Role)(0), // 79: memos.api.v1.SpaceMember.Role + (*Space)(nil), // 78: memos.api.Space + (SpaceMember_Role)(0), // 79: memos.api.SpaceMember.Role (*emptypb.Empty)(nil), // 80: google.protobuf.Empty (*httpbody.HttpBody)(nil), // 81: google.api.HttpBody } -var file_api_v1_user_service_proto_depIdxs = []int32{ - 0, // 0: memos.api.v1.User.role:type_name -> memos.api.v1.User.Role - 74, // 1: memos.api.v1.User.state:type_name -> memos.api.v1.State - 75, // 2: memos.api.v1.User.create_time:type_name -> google.protobuf.Timestamp - 75, // 3: memos.api.v1.User.update_time:type_name -> google.protobuf.Timestamp - 6, // 4: memos.api.v1.ListUsersResponse.users:type_name -> memos.api.v1.User - 6, // 5: memos.api.v1.BatchGetUsersResponse.users:type_name -> memos.api.v1.User - 76, // 6: memos.api.v1.GetUserRequest.read_mask:type_name -> google.protobuf.FieldMask - 6, // 7: memos.api.v1.CreateUserRequest.user:type_name -> memos.api.v1.User - 6, // 8: memos.api.v1.UpdateUserRequest.user:type_name -> memos.api.v1.User - 76, // 9: memos.api.v1.UpdateUserRequest.update_mask:type_name -> google.protobuf.FieldMask - 64, // 10: memos.api.v1.UserStats.memo_type_stats:type_name -> memos.api.v1.UserStats.MemoTypeStats - 63, // 11: memos.api.v1.UserStats.tag_count:type_name -> memos.api.v1.UserStats.TagCountEntry - 75, // 12: memos.api.v1.UserStats.memo_created_timestamps:type_name -> google.protobuf.Timestamp - 75, // 13: memos.api.v1.UserStats.memo_updated_timestamps:type_name -> google.protobuf.Timestamp - 18, // 14: memos.api.v1.ImportMemosRequest.spec:type_name -> memos.api.v1.ImportMemosSpec - 1, // 15: memos.api.v1.ImportMemosRequest.conflict_policy:type_name -> memos.api.v1.ImportMemosRequest.ConflictPolicy - 21, // 16: memos.api.v1.ImportMemosResponse.plan:type_name -> memos.api.v1.MemoImportPlan - 22, // 17: memos.api.v1.ImportMemosResponse.report:type_name -> memos.api.v1.MemoImportReport - 75, // 18: memos.api.v1.MemoImportPlan.export_time:type_name -> google.protobuf.Timestamp - 20, // 19: memos.api.v1.MemoImportPlan.warnings:type_name -> memos.api.v1.MemoImportIssue - 20, // 20: memos.api.v1.MemoImportReport.warnings:type_name -> memos.api.v1.MemoImportIssue - 20, // 21: memos.api.v1.MemoImportReport.failures:type_name -> memos.api.v1.MemoImportIssue - 74, // 22: memos.api.v1.ListAllUserStatsRequest.state:type_name -> memos.api.v1.State - 15, // 23: memos.api.v1.ListAllUserStatsResponse.stats:type_name -> memos.api.v1.UserStats - 65, // 24: memos.api.v1.UserSetting.general_setting:type_name -> memos.api.v1.UserSetting.GeneralSetting - 68, // 25: memos.api.v1.UserSetting.webhooks_setting:type_name -> memos.api.v1.UserSetting.WebhooksSetting - 67, // 26: memos.api.v1.UserSetting.tags_setting:type_name -> memos.api.v1.UserSetting.TagsSetting - 26, // 27: memos.api.v1.UpdateUserSettingRequest.setting:type_name -> memos.api.v1.UserSetting - 76, // 28: memos.api.v1.UpdateUserSettingRequest.update_mask:type_name -> google.protobuf.FieldMask - 26, // 29: memos.api.v1.ListUserSettingsResponse.settings:type_name -> memos.api.v1.UserSetting - 70, // 30: memos.api.v1.MemoView.icon:type_name -> memos.api.v1.MemoView.Icon - 31, // 31: memos.api.v1.ListMemoViewsResponse.memo_views:type_name -> memos.api.v1.MemoView - 31, // 32: memos.api.v1.CreateMemoViewRequest.memo_view:type_name -> memos.api.v1.MemoView - 31, // 33: memos.api.v1.UpdateMemoViewRequest.memo_view:type_name -> memos.api.v1.MemoView - 76, // 34: memos.api.v1.UpdateMemoViewRequest.update_mask:type_name -> google.protobuf.FieldMask - 38, // 35: memos.api.v1.ListLinkedIdentitiesResponse.linked_identities:type_name -> memos.api.v1.LinkedIdentity - 75, // 36: memos.api.v1.PersonalAccessToken.created_at:type_name -> google.protobuf.Timestamp - 75, // 37: memos.api.v1.PersonalAccessToken.expires_at:type_name -> google.protobuf.Timestamp - 75, // 38: memos.api.v1.PersonalAccessToken.last_used_at:type_name -> google.protobuf.Timestamp - 44, // 39: memos.api.v1.ListPersonalAccessTokensResponse.personal_access_tokens:type_name -> memos.api.v1.PersonalAccessToken - 44, // 40: memos.api.v1.CreatePersonalAccessTokenResponse.personal_access_token:type_name -> memos.api.v1.PersonalAccessToken - 75, // 41: memos.api.v1.UserWebhook.create_time:type_name -> google.protobuf.Timestamp - 75, // 42: memos.api.v1.UserWebhook.update_time:type_name -> google.protobuf.Timestamp - 50, // 43: memos.api.v1.ListUserWebhooksResponse.webhooks:type_name -> memos.api.v1.UserWebhook - 50, // 44: memos.api.v1.CreateUserWebhookRequest.webhook:type_name -> memos.api.v1.UserWebhook - 50, // 45: memos.api.v1.UpdateUserWebhookRequest.webhook:type_name -> memos.api.v1.UserWebhook - 76, // 46: memos.api.v1.UpdateUserWebhookRequest.update_mask:type_name -> google.protobuf.FieldMask - 6, // 47: memos.api.v1.UserNotification.sender_user:type_name -> memos.api.v1.User - 3, // 48: memos.api.v1.UserNotification.status:type_name -> memos.api.v1.UserNotification.Status - 75, // 49: memos.api.v1.UserNotification.create_time:type_name -> google.protobuf.Timestamp - 4, // 50: memos.api.v1.UserNotification.type:type_name -> memos.api.v1.UserNotification.Type - 71, // 51: memos.api.v1.UserNotification.memo_comment:type_name -> memos.api.v1.UserNotification.MemoCommentPayload - 72, // 52: memos.api.v1.UserNotification.memo_mention:type_name -> memos.api.v1.UserNotification.MemoMentionPayload - 73, // 53: memos.api.v1.UserNotification.space_invitation:type_name -> memos.api.v1.UserNotification.SpaceInvitationPayload - 58, // 54: memos.api.v1.ListUserNotificationsResponse.notifications:type_name -> memos.api.v1.UserNotification - 58, // 55: memos.api.v1.UpdateUserNotificationRequest.notification:type_name -> memos.api.v1.UserNotification - 76, // 56: memos.api.v1.UpdateUserNotificationRequest.update_mask:type_name -> google.protobuf.FieldMask - 77, // 57: memos.api.v1.UserSetting.TagMetadata.background_color:type_name -> google.type.Color - 69, // 58: memos.api.v1.UserSetting.TagsSetting.tags:type_name -> memos.api.v1.UserSetting.TagsSetting.TagsEntry - 50, // 59: memos.api.v1.UserSetting.WebhooksSetting.webhooks:type_name -> memos.api.v1.UserWebhook - 66, // 60: memos.api.v1.UserSetting.TagsSetting.TagsEntry.value:type_name -> memos.api.v1.UserSetting.TagMetadata - 78, // 61: memos.api.v1.UserNotification.SpaceInvitationPayload.space:type_name -> memos.api.v1.Space - 79, // 62: memos.api.v1.UserNotification.SpaceInvitationPayload.role:type_name -> memos.api.v1.SpaceMember.Role - 5, // 63: memos.api.v1.UserNotification.SpaceInvitationPayload.state:type_name -> memos.api.v1.UserNotification.SpaceInvitationPayload.State - 7, // 64: memos.api.v1.UserService.ListUsers:input_type -> memos.api.v1.ListUsersRequest - 9, // 65: memos.api.v1.UserService.BatchGetUsers:input_type -> memos.api.v1.BatchGetUsersRequest - 11, // 66: memos.api.v1.UserService.GetUser:input_type -> memos.api.v1.GetUserRequest - 12, // 67: memos.api.v1.UserService.CreateUser:input_type -> memos.api.v1.CreateUserRequest - 13, // 68: memos.api.v1.UserService.UpdateUser:input_type -> memos.api.v1.UpdateUserRequest - 14, // 69: memos.api.v1.UserService.DeleteUser:input_type -> memos.api.v1.DeleteUserRequest - 24, // 70: memos.api.v1.UserService.ListAllUserStats:input_type -> memos.api.v1.ListAllUserStatsRequest - 23, // 71: memos.api.v1.UserService.GetUserStats:input_type -> memos.api.v1.GetUserStatsRequest - 16, // 72: memos.api.v1.UserService.ExportMemos:input_type -> memos.api.v1.ExportMemosRequest - 17, // 73: memos.api.v1.UserService.ImportMemos:input_type -> memos.api.v1.ImportMemosRequest - 27, // 74: memos.api.v1.UserService.GetUserSetting:input_type -> memos.api.v1.GetUserSettingRequest - 28, // 75: memos.api.v1.UserService.UpdateUserSetting:input_type -> memos.api.v1.UpdateUserSettingRequest - 29, // 76: memos.api.v1.UserService.ListUserSettings:input_type -> memos.api.v1.ListUserSettingsRequest - 32, // 77: memos.api.v1.UserService.ListMemoViews:input_type -> memos.api.v1.ListMemoViewsRequest - 34, // 78: memos.api.v1.UserService.GetMemoView:input_type -> memos.api.v1.GetMemoViewRequest - 35, // 79: memos.api.v1.UserService.CreateMemoView:input_type -> memos.api.v1.CreateMemoViewRequest - 36, // 80: memos.api.v1.UserService.UpdateMemoView:input_type -> memos.api.v1.UpdateMemoViewRequest - 37, // 81: memos.api.v1.UserService.DeleteMemoView:input_type -> memos.api.v1.DeleteMemoViewRequest - 39, // 82: memos.api.v1.UserService.ListLinkedIdentities:input_type -> memos.api.v1.ListLinkedIdentitiesRequest - 41, // 83: memos.api.v1.UserService.CreateLinkedIdentity:input_type -> memos.api.v1.CreateLinkedIdentityRequest - 42, // 84: memos.api.v1.UserService.GetLinkedIdentity:input_type -> memos.api.v1.GetLinkedIdentityRequest - 43, // 85: memos.api.v1.UserService.DeleteLinkedIdentity:input_type -> memos.api.v1.DeleteLinkedIdentityRequest - 45, // 86: memos.api.v1.UserService.ListPersonalAccessTokens:input_type -> memos.api.v1.ListPersonalAccessTokensRequest - 47, // 87: memos.api.v1.UserService.CreatePersonalAccessToken:input_type -> memos.api.v1.CreatePersonalAccessTokenRequest - 49, // 88: memos.api.v1.UserService.DeletePersonalAccessToken:input_type -> memos.api.v1.DeletePersonalAccessTokenRequest - 51, // 89: memos.api.v1.UserService.ListUserWebhooks:input_type -> memos.api.v1.ListUserWebhooksRequest - 53, // 90: memos.api.v1.UserService.CreateUserWebhook:input_type -> memos.api.v1.CreateUserWebhookRequest - 54, // 91: memos.api.v1.UserService.UpdateUserWebhook:input_type -> memos.api.v1.UpdateUserWebhookRequest - 55, // 92: memos.api.v1.UserService.DeleteUserWebhook:input_type -> memos.api.v1.DeleteUserWebhookRequest - 56, // 93: memos.api.v1.UserService.GetUserWebhookSigningSecret:input_type -> memos.api.v1.GetUserWebhookSigningSecretRequest - 59, // 94: memos.api.v1.UserService.ListUserNotifications:input_type -> memos.api.v1.ListUserNotificationsRequest - 61, // 95: memos.api.v1.UserService.UpdateUserNotification:input_type -> memos.api.v1.UpdateUserNotificationRequest - 62, // 96: memos.api.v1.UserService.DeleteUserNotification:input_type -> memos.api.v1.DeleteUserNotificationRequest - 8, // 97: memos.api.v1.UserService.ListUsers:output_type -> memos.api.v1.ListUsersResponse - 10, // 98: memos.api.v1.UserService.BatchGetUsers:output_type -> memos.api.v1.BatchGetUsersResponse - 6, // 99: memos.api.v1.UserService.GetUser:output_type -> memos.api.v1.User - 6, // 100: memos.api.v1.UserService.CreateUser:output_type -> memos.api.v1.User - 6, // 101: memos.api.v1.UserService.UpdateUser:output_type -> memos.api.v1.User - 80, // 102: memos.api.v1.UserService.DeleteUser:output_type -> google.protobuf.Empty - 25, // 103: memos.api.v1.UserService.ListAllUserStats:output_type -> memos.api.v1.ListAllUserStatsResponse - 15, // 104: memos.api.v1.UserService.GetUserStats:output_type -> memos.api.v1.UserStats - 81, // 105: memos.api.v1.UserService.ExportMemos:output_type -> google.api.HttpBody - 19, // 106: memos.api.v1.UserService.ImportMemos:output_type -> memos.api.v1.ImportMemosResponse - 26, // 107: memos.api.v1.UserService.GetUserSetting:output_type -> memos.api.v1.UserSetting - 26, // 108: memos.api.v1.UserService.UpdateUserSetting:output_type -> memos.api.v1.UserSetting - 30, // 109: memos.api.v1.UserService.ListUserSettings:output_type -> memos.api.v1.ListUserSettingsResponse - 33, // 110: memos.api.v1.UserService.ListMemoViews:output_type -> memos.api.v1.ListMemoViewsResponse - 31, // 111: memos.api.v1.UserService.GetMemoView:output_type -> memos.api.v1.MemoView - 31, // 112: memos.api.v1.UserService.CreateMemoView:output_type -> memos.api.v1.MemoView - 31, // 113: memos.api.v1.UserService.UpdateMemoView:output_type -> memos.api.v1.MemoView - 80, // 114: memos.api.v1.UserService.DeleteMemoView:output_type -> google.protobuf.Empty - 40, // 115: memos.api.v1.UserService.ListLinkedIdentities:output_type -> memos.api.v1.ListLinkedIdentitiesResponse - 38, // 116: memos.api.v1.UserService.CreateLinkedIdentity:output_type -> memos.api.v1.LinkedIdentity - 38, // 117: memos.api.v1.UserService.GetLinkedIdentity:output_type -> memos.api.v1.LinkedIdentity - 80, // 118: memos.api.v1.UserService.DeleteLinkedIdentity:output_type -> google.protobuf.Empty - 46, // 119: memos.api.v1.UserService.ListPersonalAccessTokens:output_type -> memos.api.v1.ListPersonalAccessTokensResponse - 48, // 120: memos.api.v1.UserService.CreatePersonalAccessToken:output_type -> memos.api.v1.CreatePersonalAccessTokenResponse - 80, // 121: memos.api.v1.UserService.DeletePersonalAccessToken:output_type -> google.protobuf.Empty - 52, // 122: memos.api.v1.UserService.ListUserWebhooks:output_type -> memos.api.v1.ListUserWebhooksResponse - 50, // 123: memos.api.v1.UserService.CreateUserWebhook:output_type -> memos.api.v1.UserWebhook - 50, // 124: memos.api.v1.UserService.UpdateUserWebhook:output_type -> memos.api.v1.UserWebhook - 80, // 125: memos.api.v1.UserService.DeleteUserWebhook:output_type -> google.protobuf.Empty - 57, // 126: memos.api.v1.UserService.GetUserWebhookSigningSecret:output_type -> memos.api.v1.GetUserWebhookSigningSecretResponse - 60, // 127: memos.api.v1.UserService.ListUserNotifications:output_type -> memos.api.v1.ListUserNotificationsResponse - 58, // 128: memos.api.v1.UserService.UpdateUserNotification:output_type -> memos.api.v1.UserNotification - 80, // 129: memos.api.v1.UserService.DeleteUserNotification:output_type -> google.protobuf.Empty +var file_api_user_service_proto_depIdxs = []int32{ + 0, // 0: memos.api.User.role:type_name -> memos.api.User.Role + 74, // 1: memos.api.User.state:type_name -> memos.api.State + 75, // 2: memos.api.User.create_time:type_name -> google.protobuf.Timestamp + 75, // 3: memos.api.User.update_time:type_name -> google.protobuf.Timestamp + 6, // 4: memos.api.ListUsersResponse.users:type_name -> memos.api.User + 76, // 5: memos.api.GetUserRequest.read_mask:type_name -> google.protobuf.FieldMask + 6, // 6: memos.api.BatchGetUsersResponse.users:type_name -> memos.api.User + 6, // 7: memos.api.CreateUserRequest.user:type_name -> memos.api.User + 6, // 8: memos.api.UpdateUserRequest.user:type_name -> memos.api.User + 76, // 9: memos.api.UpdateUserRequest.update_mask:type_name -> google.protobuf.FieldMask + 63, // 10: memos.api.UserSetting.general_setting:type_name -> memos.api.UserSetting.GeneralSetting + 64, // 11: memos.api.UserSetting.webhooks_setting:type_name -> memos.api.UserSetting.WebhooksSetting + 65, // 12: memos.api.UserSetting.tags_setting:type_name -> memos.api.UserSetting.TagsSetting + 15, // 13: memos.api.ListUserSettingsResponse.user_settings:type_name -> memos.api.UserSetting + 15, // 14: memos.api.UpdateUserSettingRequest.user_setting:type_name -> memos.api.UserSetting + 76, // 15: memos.api.UpdateUserSettingRequest.update_mask:type_name -> google.protobuf.FieldMask + 69, // 16: memos.api.UserStats.memo_type_stats:type_name -> memos.api.UserStats.MemoTypeStats + 68, // 17: memos.api.UserStats.tag_counts:type_name -> memos.api.UserStats.TagCountsEntry + 75, // 18: memos.api.UserStats.memo_created_timestamps:type_name -> google.protobuf.Timestamp + 75, // 19: memos.api.UserStats.memo_updated_timestamps:type_name -> google.protobuf.Timestamp + 74, // 20: memos.api.ListUserStatsRequest.state:type_name -> memos.api.State + 20, // 21: memos.api.ListUserStatsResponse.user_stats:type_name -> memos.api.UserStats + 70, // 22: memos.api.MemoView.icon:type_name -> memos.api.MemoView.Icon + 24, // 23: memos.api.ListMemoViewsResponse.memo_views:type_name -> memos.api.MemoView + 24, // 24: memos.api.CreateMemoViewRequest.memo_view:type_name -> memos.api.MemoView + 24, // 25: memos.api.UpdateMemoViewRequest.memo_view:type_name -> memos.api.MemoView + 76, // 26: memos.api.UpdateMemoViewRequest.update_mask:type_name -> google.protobuf.FieldMask + 6, // 27: memos.api.UserNotification.sender_user:type_name -> memos.api.User + 3, // 28: memos.api.UserNotification.type:type_name -> memos.api.UserNotification.Type + 71, // 29: memos.api.UserNotification.memo_comment:type_name -> memos.api.UserNotification.MemoCommentPayload + 72, // 30: memos.api.UserNotification.memo_mention:type_name -> memos.api.UserNotification.MemoMentionPayload + 73, // 31: memos.api.UserNotification.space_invitation:type_name -> memos.api.UserNotification.SpaceInvitationPayload + 2, // 32: memos.api.UserNotification.status:type_name -> memos.api.UserNotification.Status + 75, // 33: memos.api.UserNotification.create_time:type_name -> google.protobuf.Timestamp + 31, // 34: memos.api.ListUserNotificationsResponse.notifications:type_name -> memos.api.UserNotification + 31, // 35: memos.api.UpdateUserNotificationRequest.notification:type_name -> memos.api.UserNotification + 76, // 36: memos.api.UpdateUserNotificationRequest.update_mask:type_name -> google.protobuf.FieldMask + 75, // 37: memos.api.UserWebhook.create_time:type_name -> google.protobuf.Timestamp + 75, // 38: memos.api.UserWebhook.update_time:type_name -> google.protobuf.Timestamp + 36, // 39: memos.api.ListUserWebhooksResponse.webhooks:type_name -> memos.api.UserWebhook + 36, // 40: memos.api.CreateUserWebhookRequest.webhook:type_name -> memos.api.UserWebhook + 36, // 41: memos.api.UpdateUserWebhookRequest.webhook:type_name -> memos.api.UserWebhook + 76, // 42: memos.api.UpdateUserWebhookRequest.update_mask:type_name -> google.protobuf.FieldMask + 44, // 43: memos.api.ListLinkedIdentitiesResponse.linked_identities:type_name -> memos.api.LinkedIdentity + 75, // 44: memos.api.PersonalAccessToken.create_time:type_name -> google.protobuf.Timestamp + 75, // 45: memos.api.PersonalAccessToken.expire_time:type_name -> google.protobuf.Timestamp + 75, // 46: memos.api.PersonalAccessToken.last_use_time:type_name -> google.protobuf.Timestamp + 50, // 47: memos.api.ListPersonalAccessTokensResponse.personal_access_tokens:type_name -> memos.api.PersonalAccessToken + 50, // 48: memos.api.CreatePersonalAccessTokenResponse.personal_access_token:type_name -> memos.api.PersonalAccessToken + 59, // 49: memos.api.ImportMemosRequest.spec:type_name -> memos.api.ImportMemosSpec + 5, // 50: memos.api.ImportMemosRequest.conflict_policy:type_name -> memos.api.ImportMemosRequest.ConflictPolicy + 60, // 51: memos.api.ImportMemosResponse.plan:type_name -> memos.api.ImportMemosPlan + 61, // 52: memos.api.ImportMemosResponse.report:type_name -> memos.api.ImportMemosReport + 75, // 53: memos.api.ImportMemosPlan.export_time:type_name -> google.protobuf.Timestamp + 62, // 54: memos.api.ImportMemosPlan.warnings:type_name -> memos.api.ImportMemosIssue + 62, // 55: memos.api.ImportMemosReport.warnings:type_name -> memos.api.ImportMemosIssue + 62, // 56: memos.api.ImportMemosReport.failures:type_name -> memos.api.ImportMemosIssue + 36, // 57: memos.api.UserSetting.WebhooksSetting.webhooks:type_name -> memos.api.UserWebhook + 67, // 58: memos.api.UserSetting.TagsSetting.tags:type_name -> memos.api.UserSetting.TagsSetting.TagsEntry + 77, // 59: memos.api.UserSetting.TagMetadata.background_color:type_name -> google.type.Color + 66, // 60: memos.api.UserSetting.TagsSetting.TagsEntry.value:type_name -> memos.api.UserSetting.TagMetadata + 78, // 61: memos.api.UserNotification.SpaceInvitationPayload.space:type_name -> memos.api.Space + 79, // 62: memos.api.UserNotification.SpaceInvitationPayload.role:type_name -> memos.api.SpaceMember.Role + 4, // 63: memos.api.UserNotification.SpaceInvitationPayload.state:type_name -> memos.api.UserNotification.SpaceInvitationPayload.InvitationState + 7, // 64: memos.api.UserService.ListUsers:input_type -> memos.api.ListUsersRequest + 9, // 65: memos.api.UserService.GetUser:input_type -> memos.api.GetUserRequest + 10, // 66: memos.api.UserService.BatchGetUsers:input_type -> memos.api.BatchGetUsersRequest + 12, // 67: memos.api.UserService.CreateUser:input_type -> memos.api.CreateUserRequest + 13, // 68: memos.api.UserService.UpdateUser:input_type -> memos.api.UpdateUserRequest + 14, // 69: memos.api.UserService.DeleteUser:input_type -> memos.api.DeleteUserRequest + 16, // 70: memos.api.UserService.ListUserSettings:input_type -> memos.api.ListUserSettingsRequest + 18, // 71: memos.api.UserService.GetUserSetting:input_type -> memos.api.GetUserSettingRequest + 19, // 72: memos.api.UserService.UpdateUserSetting:input_type -> memos.api.UpdateUserSettingRequest + 21, // 73: memos.api.UserService.ListUserStats:input_type -> memos.api.ListUserStatsRequest + 23, // 74: memos.api.UserService.GetUserStats:input_type -> memos.api.GetUserStatsRequest + 25, // 75: memos.api.UserService.ListMemoViews:input_type -> memos.api.ListMemoViewsRequest + 27, // 76: memos.api.UserService.GetMemoView:input_type -> memos.api.GetMemoViewRequest + 28, // 77: memos.api.UserService.CreateMemoView:input_type -> memos.api.CreateMemoViewRequest + 29, // 78: memos.api.UserService.UpdateMemoView:input_type -> memos.api.UpdateMemoViewRequest + 30, // 79: memos.api.UserService.DeleteMemoView:input_type -> memos.api.DeleteMemoViewRequest + 32, // 80: memos.api.UserService.ListUserNotifications:input_type -> memos.api.ListUserNotificationsRequest + 34, // 81: memos.api.UserService.UpdateUserNotification:input_type -> memos.api.UpdateUserNotificationRequest + 35, // 82: memos.api.UserService.DeleteUserNotification:input_type -> memos.api.DeleteUserNotificationRequest + 37, // 83: memos.api.UserService.ListUserWebhooks:input_type -> memos.api.ListUserWebhooksRequest + 39, // 84: memos.api.UserService.CreateUserWebhook:input_type -> memos.api.CreateUserWebhookRequest + 40, // 85: memos.api.UserService.UpdateUserWebhook:input_type -> memos.api.UpdateUserWebhookRequest + 41, // 86: memos.api.UserService.DeleteUserWebhook:input_type -> memos.api.DeleteUserWebhookRequest + 42, // 87: memos.api.UserService.GetUserWebhookSigningSecret:input_type -> memos.api.GetUserWebhookSigningSecretRequest + 45, // 88: memos.api.UserService.ListLinkedIdentities:input_type -> memos.api.ListLinkedIdentitiesRequest + 47, // 89: memos.api.UserService.GetLinkedIdentity:input_type -> memos.api.GetLinkedIdentityRequest + 48, // 90: memos.api.UserService.CreateLinkedIdentity:input_type -> memos.api.CreateLinkedIdentityRequest + 49, // 91: memos.api.UserService.DeleteLinkedIdentity:input_type -> memos.api.DeleteLinkedIdentityRequest + 51, // 92: memos.api.UserService.ListPersonalAccessTokens:input_type -> memos.api.ListPersonalAccessTokensRequest + 53, // 93: memos.api.UserService.CreatePersonalAccessToken:input_type -> memos.api.CreatePersonalAccessTokenRequest + 55, // 94: memos.api.UserService.DeletePersonalAccessToken:input_type -> memos.api.DeletePersonalAccessTokenRequest + 56, // 95: memos.api.UserService.ExportMemos:input_type -> memos.api.ExportMemosRequest + 57, // 96: memos.api.UserService.ImportMemos:input_type -> memos.api.ImportMemosRequest + 8, // 97: memos.api.UserService.ListUsers:output_type -> memos.api.ListUsersResponse + 6, // 98: memos.api.UserService.GetUser:output_type -> memos.api.User + 11, // 99: memos.api.UserService.BatchGetUsers:output_type -> memos.api.BatchGetUsersResponse + 6, // 100: memos.api.UserService.CreateUser:output_type -> memos.api.User + 6, // 101: memos.api.UserService.UpdateUser:output_type -> memos.api.User + 80, // 102: memos.api.UserService.DeleteUser:output_type -> google.protobuf.Empty + 17, // 103: memos.api.UserService.ListUserSettings:output_type -> memos.api.ListUserSettingsResponse + 15, // 104: memos.api.UserService.GetUserSetting:output_type -> memos.api.UserSetting + 15, // 105: memos.api.UserService.UpdateUserSetting:output_type -> memos.api.UserSetting + 22, // 106: memos.api.UserService.ListUserStats:output_type -> memos.api.ListUserStatsResponse + 20, // 107: memos.api.UserService.GetUserStats:output_type -> memos.api.UserStats + 26, // 108: memos.api.UserService.ListMemoViews:output_type -> memos.api.ListMemoViewsResponse + 24, // 109: memos.api.UserService.GetMemoView:output_type -> memos.api.MemoView + 24, // 110: memos.api.UserService.CreateMemoView:output_type -> memos.api.MemoView + 24, // 111: memos.api.UserService.UpdateMemoView:output_type -> memos.api.MemoView + 80, // 112: memos.api.UserService.DeleteMemoView:output_type -> google.protobuf.Empty + 33, // 113: memos.api.UserService.ListUserNotifications:output_type -> memos.api.ListUserNotificationsResponse + 31, // 114: memos.api.UserService.UpdateUserNotification:output_type -> memos.api.UserNotification + 80, // 115: memos.api.UserService.DeleteUserNotification:output_type -> google.protobuf.Empty + 38, // 116: memos.api.UserService.ListUserWebhooks:output_type -> memos.api.ListUserWebhooksResponse + 36, // 117: memos.api.UserService.CreateUserWebhook:output_type -> memos.api.UserWebhook + 36, // 118: memos.api.UserService.UpdateUserWebhook:output_type -> memos.api.UserWebhook + 80, // 119: memos.api.UserService.DeleteUserWebhook:output_type -> google.protobuf.Empty + 43, // 120: memos.api.UserService.GetUserWebhookSigningSecret:output_type -> memos.api.GetUserWebhookSigningSecretResponse + 46, // 121: memos.api.UserService.ListLinkedIdentities:output_type -> memos.api.ListLinkedIdentitiesResponse + 44, // 122: memos.api.UserService.GetLinkedIdentity:output_type -> memos.api.LinkedIdentity + 44, // 123: memos.api.UserService.CreateLinkedIdentity:output_type -> memos.api.LinkedIdentity + 80, // 124: memos.api.UserService.DeleteLinkedIdentity:output_type -> google.protobuf.Empty + 52, // 125: memos.api.UserService.ListPersonalAccessTokens:output_type -> memos.api.ListPersonalAccessTokensResponse + 54, // 126: memos.api.UserService.CreatePersonalAccessToken:output_type -> memos.api.CreatePersonalAccessTokenResponse + 80, // 127: memos.api.UserService.DeletePersonalAccessToken:output_type -> google.protobuf.Empty + 81, // 128: memos.api.UserService.ExportMemos:output_type -> google.api.HttpBody + 58, // 129: memos.api.UserService.ImportMemos:output_type -> memos.api.ImportMemosResponse 97, // [97:130] is the sub-list for method output_type 64, // [64:97] is the sub-list for method input_type 64, // [64:64] is the sub-list for extension type_name @@ -5295,33 +5419,33 @@ var file_api_v1_user_service_proto_depIdxs = []int32{ 0, // [0:64] is the sub-list for field type_name } -func init() { file_api_v1_user_service_proto_init() } -func file_api_v1_user_service_proto_init() { - if File_api_v1_user_service_proto != nil { +func init() { file_api_user_service_proto_init() } +func file_api_user_service_proto_init() { + if File_api_user_service_proto != nil { return } - file_api_v1_common_proto_init() - file_api_v1_space_service_proto_init() - file_api_v1_user_service_proto_msgTypes[9].OneofWrappers = []any{} - file_api_v1_user_service_proto_msgTypes[11].OneofWrappers = []any{ - (*ImportMemosRequest_Spec)(nil), - (*ImportMemosRequest_UploadId)(nil), - } - file_api_v1_user_service_proto_msgTypes[13].OneofWrappers = []any{ - (*ImportMemosResponse_Plan)(nil), - (*ImportMemosResponse_Report)(nil), - } - file_api_v1_user_service_proto_msgTypes[20].OneofWrappers = []any{ + file_api_common_proto_init() + file_api_space_service_proto_init() + file_api_user_service_proto_msgTypes[9].OneofWrappers = []any{ (*UserSetting_GeneralSetting_)(nil), (*UserSetting_WebhooksSetting_)(nil), (*UserSetting_TagsSetting_)(nil), } - file_api_v1_user_service_proto_msgTypes[52].OneofWrappers = []any{ + file_api_user_service_proto_msgTypes[14].OneofWrappers = []any{} + file_api_user_service_proto_msgTypes[25].OneofWrappers = []any{ (*UserNotification_MemoComment)(nil), (*UserNotification_MemoMention)(nil), (*UserNotification_SpaceInvitation)(nil), } - file_api_v1_user_service_proto_msgTypes[64].OneofWrappers = []any{ + file_api_user_service_proto_msgTypes[51].OneofWrappers = []any{ + (*ImportMemosRequest_Spec)(nil), + (*ImportMemosRequest_UploadId)(nil), + } + file_api_user_service_proto_msgTypes[52].OneofWrappers = []any{ + (*ImportMemosResponse_Plan)(nil), + (*ImportMemosResponse_Report)(nil), + } + file_api_user_service_proto_msgTypes[64].OneofWrappers = []any{ (*MemoView_Icon_Emoji)(nil), (*MemoView_Icon_Lucide)(nil), } @@ -5329,18 +5453,18 @@ func file_api_v1_user_service_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: unsafe.Slice(unsafe.StringData(file_api_v1_user_service_proto_rawDesc), len(file_api_v1_user_service_proto_rawDesc)), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_api_user_service_proto_rawDesc), len(file_api_user_service_proto_rawDesc)), NumEnums: 6, NumMessages: 68, NumExtensions: 0, NumServices: 1, }, - GoTypes: file_api_v1_user_service_proto_goTypes, - DependencyIndexes: file_api_v1_user_service_proto_depIdxs, - EnumInfos: file_api_v1_user_service_proto_enumTypes, - MessageInfos: file_api_v1_user_service_proto_msgTypes, + GoTypes: file_api_user_service_proto_goTypes, + DependencyIndexes: file_api_user_service_proto_depIdxs, + EnumInfos: file_api_user_service_proto_enumTypes, + MessageInfos: file_api_user_service_proto_msgTypes, }.Build() - File_api_v1_user_service_proto = out.File - file_api_v1_user_service_proto_goTypes = nil - file_api_v1_user_service_proto_depIdxs = nil + File_api_user_service_proto = out.File + file_api_user_service_proto_goTypes = nil + file_api_user_service_proto_depIdxs = nil } diff --git a/proto/gen/api/v1/user_service.pb.gw.go b/proto/gen/api/user_service.pb.gw.go similarity index 90% rename from proto/gen/api/v1/user_service.pb.gw.go rename to proto/gen/api/user_service.pb.gw.go index 7f8177d08..73da06cf5 100644 --- a/proto/gen/api/v1/user_service.pb.gw.go +++ b/proto/gen/api/user_service.pb.gw.go @@ -1,12 +1,12 @@ // Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: api/v1/user_service.proto +// source: api/user_service.proto /* -Package apiv1 is a reverse proxy. +Package api is a reverse proxy. It translates gRPC into RESTful JSON APIs. */ -package apiv1 +package api import ( "context" @@ -70,33 +70,6 @@ func local_request_UserService_ListUsers_0(ctx context.Context, marshaler runtim return msg, metadata, err } -func request_UserService_BatchGetUsers_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var ( - protoReq BatchGetUsersRequest - metadata runtime.ServerMetadata - ) - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if req.Body != nil { - _, _ = io.Copy(io.Discard, req.Body) - } - msg, err := client.BatchGetUsers(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err -} - -func local_request_UserService_BatchGetUsers_0(ctx context.Context, marshaler runtime.Marshaler, server UserServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var ( - protoReq BatchGetUsersRequest - metadata runtime.ServerMetadata - ) - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - msg, err := server.BatchGetUsers(ctx, &protoReq) - return msg, metadata, err -} - var filter_UserService_GetUser_0 = &utilities.DoubleArray{Encoding: map[string]int{"name": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} func request_UserService_GetUser_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -150,6 +123,33 @@ func local_request_UserService_GetUser_0(ctx context.Context, marshaler runtime. return msg, metadata, err } +func request_UserService_BatchGetUsers_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq BatchGetUsersRequest + metadata runtime.ServerMetadata + ) + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if req.Body != nil { + _, _ = io.Copy(io.Discard, req.Body) + } + msg, err := client.BatchGetUsers(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err +} + +func local_request_UserService_BatchGetUsers_0(ctx context.Context, marshaler runtime.Marshaler, server UserServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq BatchGetUsersRequest + metadata runtime.ServerMetadata + ) + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + msg, err := server.BatchGetUsers(ctx, &protoReq) + return msg, metadata, err +} + var filter_UserService_CreateUser_0 = &utilities.DoubleArray{Encoding: map[string]int{"user": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} func request_UserService_CreateUser_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -325,38 +325,229 @@ func local_request_UserService_DeleteUser_0(ctx context.Context, marshaler runti return msg, metadata, err } -var filter_UserService_ListAllUserStats_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +var filter_UserService_ListUserSettings_0 = &utilities.DoubleArray{Encoding: map[string]int{"parent": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} -func request_UserService_ListAllUserStats_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func request_UserService_ListUserSettings_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var ( - protoReq ListAllUserStatsRequest + protoReq ListUserSettingsRequest metadata runtime.ServerMetadata + err error ) + val, ok := pathParams["parent"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent") + } + protoReq.Parent, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err) + } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_UserService_ListAllUserStats_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_UserService_ListUserSettings_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if req.Body != nil { _, _ = io.Copy(io.Discard, req.Body) } - msg, err := client.ListAllUserStats(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.ListUserSettings(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_UserService_ListAllUserStats_0(ctx context.Context, marshaler runtime.Marshaler, server UserServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func local_request_UserService_ListUserSettings_0(ctx context.Context, marshaler runtime.Marshaler, server UserServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var ( - protoReq ListAllUserStatsRequest + protoReq ListUserSettingsRequest metadata runtime.ServerMetadata + err error ) + val, ok := pathParams["parent"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent") + } + protoReq.Parent, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err) + } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_UserService_ListAllUserStats_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_UserService_ListUserSettings_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := server.ListAllUserStats(ctx, &protoReq) + msg, err := server.ListUserSettings(ctx, &protoReq) + return msg, metadata, err +} + +func request_UserService_GetUserSetting_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq GetUserSettingRequest + metadata runtime.ServerMetadata + err error + ) + val, ok := pathParams["name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + } + protoReq.Name, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + } + if req.Body != nil { + _, _ = io.Copy(io.Discard, req.Body) + } + msg, err := client.GetUserSetting(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err +} + +func local_request_UserService_GetUserSetting_0(ctx context.Context, marshaler runtime.Marshaler, server UserServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq GetUserSettingRequest + metadata runtime.ServerMetadata + err error + ) + val, ok := pathParams["name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + } + protoReq.Name, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + } + msg, err := server.GetUserSetting(ctx, &protoReq) + return msg, metadata, err +} + +var filter_UserService_UpdateUserSetting_0 = &utilities.DoubleArray{Encoding: map[string]int{"user_setting": 0, "name": 1}, Base: []int{1, 2, 1, 0, 0}, Check: []int{0, 1, 2, 3, 2}} + +func request_UserService_UpdateUserSetting_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq UpdateUserSettingRequest + metadata runtime.ServerMetadata + err error + ) + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.UserSetting); err != nil && !errors.Is(err, io.EOF) { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if protoReq.UpdateMask == nil || len(protoReq.UpdateMask.GetPaths()) == 0 { + if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader(), protoReq.UserSetting); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } else { + protoReq.UpdateMask = fieldMask + } + } + val, ok := pathParams["user_setting.name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "user_setting.name") + } + err = runtime.PopulateFieldFromPath(&protoReq, "user_setting.name", val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "user_setting.name", err) + } + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_UserService_UpdateUserSetting_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if req.Body != nil { + _, _ = io.Copy(io.Discard, req.Body) + } + msg, err := client.UpdateUserSetting(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err +} + +func local_request_UserService_UpdateUserSetting_0(ctx context.Context, marshaler runtime.Marshaler, server UserServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq UpdateUserSettingRequest + metadata runtime.ServerMetadata + err error + ) + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.UserSetting); err != nil && !errors.Is(err, io.EOF) { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if protoReq.UpdateMask == nil || len(protoReq.UpdateMask.GetPaths()) == 0 { + if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader(), protoReq.UserSetting); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } else { + protoReq.UpdateMask = fieldMask + } + } + val, ok := pathParams["user_setting.name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "user_setting.name") + } + err = runtime.PopulateFieldFromPath(&protoReq, "user_setting.name", val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "user_setting.name", err) + } + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_UserService_UpdateUserSetting_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + msg, err := server.UpdateUserSetting(ctx, &protoReq) + return msg, metadata, err +} + +var filter_UserService_ListUserStats_0 = &utilities.DoubleArray{Encoding: map[string]int{"parent": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} + +func request_UserService_ListUserStats_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq ListUserStatsRequest + metadata runtime.ServerMetadata + err error + ) + val, ok := pathParams["parent"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent") + } + protoReq.Parent, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err) + } + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_UserService_ListUserStats_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if req.Body != nil { + _, _ = io.Copy(io.Discard, req.Body) + } + msg, err := client.ListUserStats(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err +} + +func local_request_UserService_ListUserStats_0(ctx context.Context, marshaler runtime.Marshaler, server UserServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq ListUserStatsRequest + metadata runtime.ServerMetadata + err error + ) + val, ok := pathParams["parent"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent") + } + protoReq.Parent, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err) + } + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_UserService_ListUserStats_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + msg, err := server.ListUserStats(ctx, &protoReq) return msg, metadata, err } @@ -413,263 +604,6 @@ func local_request_UserService_GetUserStats_0(ctx context.Context, marshaler run return msg, metadata, err } -func request_UserService_ExportMemos_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var ( - protoReq ExportMemosRequest - metadata runtime.ServerMetadata - err error - ) - val, ok := pathParams["name"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") - } - protoReq.Name, err = runtime.String(val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) - } - if req.Body != nil { - _, _ = io.Copy(io.Discard, req.Body) - } - msg, err := client.ExportMemos(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err -} - -func local_request_UserService_ExportMemos_0(ctx context.Context, marshaler runtime.Marshaler, server UserServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var ( - protoReq ExportMemosRequest - metadata runtime.ServerMetadata - err error - ) - val, ok := pathParams["name"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") - } - protoReq.Name, err = runtime.String(val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) - } - msg, err := server.ExportMemos(ctx, &protoReq) - return msg, metadata, err -} - -func request_UserService_ImportMemos_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var ( - protoReq ImportMemosRequest - metadata runtime.ServerMetadata - err error - ) - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - val, ok := pathParams["name"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") - } - protoReq.Name, err = runtime.String(val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) - } - if req.Body != nil { - _, _ = io.Copy(io.Discard, req.Body) - } - msg, err := client.ImportMemos(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err -} - -func local_request_UserService_ImportMemos_0(ctx context.Context, marshaler runtime.Marshaler, server UserServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var ( - protoReq ImportMemosRequest - metadata runtime.ServerMetadata - err error - ) - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - val, ok := pathParams["name"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") - } - protoReq.Name, err = runtime.String(val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) - } - msg, err := server.ImportMemos(ctx, &protoReq) - return msg, metadata, err -} - -func request_UserService_GetUserSetting_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var ( - protoReq GetUserSettingRequest - metadata runtime.ServerMetadata - err error - ) - val, ok := pathParams["name"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") - } - protoReq.Name, err = runtime.String(val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) - } - if req.Body != nil { - _, _ = io.Copy(io.Discard, req.Body) - } - msg, err := client.GetUserSetting(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err -} - -func local_request_UserService_GetUserSetting_0(ctx context.Context, marshaler runtime.Marshaler, server UserServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var ( - protoReq GetUserSettingRequest - metadata runtime.ServerMetadata - err error - ) - val, ok := pathParams["name"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") - } - protoReq.Name, err = runtime.String(val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) - } - msg, err := server.GetUserSetting(ctx, &protoReq) - return msg, metadata, err -} - -var filter_UserService_UpdateUserSetting_0 = &utilities.DoubleArray{Encoding: map[string]int{"setting": 0, "name": 1}, Base: []int{1, 2, 1, 0, 0}, Check: []int{0, 1, 2, 3, 2}} - -func request_UserService_UpdateUserSetting_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var ( - protoReq UpdateUserSettingRequest - metadata runtime.ServerMetadata - err error - ) - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Setting); err != nil && !errors.Is(err, io.EOF) { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if protoReq.UpdateMask == nil || len(protoReq.UpdateMask.GetPaths()) == 0 { - if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader(), protoReq.Setting); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } else { - protoReq.UpdateMask = fieldMask - } - } - val, ok := pathParams["setting.name"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "setting.name") - } - err = runtime.PopulateFieldFromPath(&protoReq, "setting.name", val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "setting.name", err) - } - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_UserService_UpdateUserSetting_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if req.Body != nil { - _, _ = io.Copy(io.Discard, req.Body) - } - msg, err := client.UpdateUserSetting(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err -} - -func local_request_UserService_UpdateUserSetting_0(ctx context.Context, marshaler runtime.Marshaler, server UserServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var ( - protoReq UpdateUserSettingRequest - metadata runtime.ServerMetadata - err error - ) - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Setting); err != nil && !errors.Is(err, io.EOF) { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if protoReq.UpdateMask == nil || len(protoReq.UpdateMask.GetPaths()) == 0 { - if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader(), protoReq.Setting); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } else { - protoReq.UpdateMask = fieldMask - } - } - val, ok := pathParams["setting.name"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "setting.name") - } - err = runtime.PopulateFieldFromPath(&protoReq, "setting.name", val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "setting.name", err) - } - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_UserService_UpdateUserSetting_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - msg, err := server.UpdateUserSetting(ctx, &protoReq) - return msg, metadata, err -} - -var filter_UserService_ListUserSettings_0 = &utilities.DoubleArray{Encoding: map[string]int{"parent": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} - -func request_UserService_ListUserSettings_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var ( - protoReq ListUserSettingsRequest - metadata runtime.ServerMetadata - err error - ) - val, ok := pathParams["parent"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent") - } - protoReq.Parent, err = runtime.String(val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err) - } - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_UserService_ListUserSettings_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if req.Body != nil { - _, _ = io.Copy(io.Discard, req.Body) - } - msg, err := client.ListUserSettings(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err -} - -func local_request_UserService_ListUserSettings_0(ctx context.Context, marshaler runtime.Marshaler, server UserServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var ( - protoReq ListUserSettingsRequest - metadata runtime.ServerMetadata - err error - ) - val, ok := pathParams["parent"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent") - } - protoReq.Parent, err = runtime.String(val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err) - } - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_UserService_ListUserSettings_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - msg, err := server.ListUserSettings(ctx, &protoReq) - return msg, metadata, err -} - func request_UserService_ListMemoViews_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var ( protoReq ListMemoViewsRequest @@ -927,173 +861,11 @@ func local_request_UserService_DeleteMemoView_0(ctx context.Context, marshaler r return msg, metadata, err } -func request_UserService_ListLinkedIdentities_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var ( - protoReq ListLinkedIdentitiesRequest - metadata runtime.ServerMetadata - err error - ) - val, ok := pathParams["parent"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent") - } - protoReq.Parent, err = runtime.String(val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err) - } - if req.Body != nil { - _, _ = io.Copy(io.Discard, req.Body) - } - msg, err := client.ListLinkedIdentities(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err -} +var filter_UserService_ListUserNotifications_0 = &utilities.DoubleArray{Encoding: map[string]int{"parent": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} -func local_request_UserService_ListLinkedIdentities_0(ctx context.Context, marshaler runtime.Marshaler, server UserServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func request_UserService_ListUserNotifications_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var ( - protoReq ListLinkedIdentitiesRequest - metadata runtime.ServerMetadata - err error - ) - val, ok := pathParams["parent"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent") - } - protoReq.Parent, err = runtime.String(val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err) - } - msg, err := server.ListLinkedIdentities(ctx, &protoReq) - return msg, metadata, err -} - -func request_UserService_CreateLinkedIdentity_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var ( - protoReq CreateLinkedIdentityRequest - metadata runtime.ServerMetadata - err error - ) - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - val, ok := pathParams["parent"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent") - } - protoReq.Parent, err = runtime.String(val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err) - } - if req.Body != nil { - _, _ = io.Copy(io.Discard, req.Body) - } - msg, err := client.CreateLinkedIdentity(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err -} - -func local_request_UserService_CreateLinkedIdentity_0(ctx context.Context, marshaler runtime.Marshaler, server UserServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var ( - protoReq CreateLinkedIdentityRequest - metadata runtime.ServerMetadata - err error - ) - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - val, ok := pathParams["parent"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent") - } - protoReq.Parent, err = runtime.String(val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err) - } - msg, err := server.CreateLinkedIdentity(ctx, &protoReq) - return msg, metadata, err -} - -func request_UserService_GetLinkedIdentity_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var ( - protoReq GetLinkedIdentityRequest - metadata runtime.ServerMetadata - err error - ) - val, ok := pathParams["name"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") - } - protoReq.Name, err = runtime.String(val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) - } - if req.Body != nil { - _, _ = io.Copy(io.Discard, req.Body) - } - msg, err := client.GetLinkedIdentity(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err -} - -func local_request_UserService_GetLinkedIdentity_0(ctx context.Context, marshaler runtime.Marshaler, server UserServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var ( - protoReq GetLinkedIdentityRequest - metadata runtime.ServerMetadata - err error - ) - val, ok := pathParams["name"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") - } - protoReq.Name, err = runtime.String(val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) - } - msg, err := server.GetLinkedIdentity(ctx, &protoReq) - return msg, metadata, err -} - -func request_UserService_DeleteLinkedIdentity_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var ( - protoReq DeleteLinkedIdentityRequest - metadata runtime.ServerMetadata - err error - ) - val, ok := pathParams["name"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") - } - protoReq.Name, err = runtime.String(val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) - } - if req.Body != nil { - _, _ = io.Copy(io.Discard, req.Body) - } - msg, err := client.DeleteLinkedIdentity(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err -} - -func local_request_UserService_DeleteLinkedIdentity_0(ctx context.Context, marshaler runtime.Marshaler, server UserServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var ( - protoReq DeleteLinkedIdentityRequest - metadata runtime.ServerMetadata - err error - ) - val, ok := pathParams["name"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") - } - protoReq.Name, err = runtime.String(val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) - } - msg, err := server.DeleteLinkedIdentity(ctx, &protoReq) - return msg, metadata, err -} - -var filter_UserService_ListPersonalAccessTokens_0 = &utilities.DoubleArray{Encoding: map[string]int{"parent": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} - -func request_UserService_ListPersonalAccessTokens_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var ( - protoReq ListPersonalAccessTokensRequest + protoReq ListUserNotificationsRequest metadata runtime.ServerMetadata err error ) @@ -1108,19 +880,19 @@ func request_UserService_ListPersonalAccessTokens_0(ctx context.Context, marshal if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_UserService_ListPersonalAccessTokens_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_UserService_ListUserNotifications_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if req.Body != nil { _, _ = io.Copy(io.Discard, req.Body) } - msg, err := client.ListPersonalAccessTokens(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.ListUserNotifications(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_UserService_ListPersonalAccessTokens_0(ctx context.Context, marshaler runtime.Marshaler, server UserServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func local_request_UserService_ListUserNotifications_0(ctx context.Context, marshaler runtime.Marshaler, server UserServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var ( - protoReq ListPersonalAccessTokensRequest + protoReq ListUserNotificationsRequest metadata runtime.ServerMetadata err error ) @@ -1135,61 +907,97 @@ func local_request_UserService_ListPersonalAccessTokens_0(ctx context.Context, m if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_UserService_ListPersonalAccessTokens_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_UserService_ListUserNotifications_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := server.ListPersonalAccessTokens(ctx, &protoReq) + msg, err := server.ListUserNotifications(ctx, &protoReq) return msg, metadata, err } -func request_UserService_CreatePersonalAccessToken_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +var filter_UserService_UpdateUserNotification_0 = &utilities.DoubleArray{Encoding: map[string]int{"notification": 0, "name": 1}, Base: []int{1, 2, 1, 0, 0}, Check: []int{0, 1, 2, 3, 2}} + +func request_UserService_UpdateUserNotification_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var ( - protoReq CreatePersonalAccessTokenRequest + protoReq UpdateUserNotificationRequest metadata runtime.ServerMetadata err error ) - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) { + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Notification); err != nil && !errors.Is(err, io.EOF) { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - val, ok := pathParams["parent"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent") + if protoReq.UpdateMask == nil || len(protoReq.UpdateMask.GetPaths()) == 0 { + if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader(), protoReq.Notification); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } else { + protoReq.UpdateMask = fieldMask + } } - protoReq.Parent, err = runtime.String(val) + val, ok := pathParams["notification.name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "notification.name") + } + err = runtime.PopulateFieldFromPath(&protoReq, "notification.name", val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "notification.name", err) + } + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_UserService_UpdateUserNotification_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if req.Body != nil { _, _ = io.Copy(io.Discard, req.Body) } - msg, err := client.CreatePersonalAccessToken(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.UpdateUserNotification(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_UserService_CreatePersonalAccessToken_0(ctx context.Context, marshaler runtime.Marshaler, server UserServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func local_request_UserService_UpdateUserNotification_0(ctx context.Context, marshaler runtime.Marshaler, server UserServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var ( - protoReq CreatePersonalAccessTokenRequest + protoReq UpdateUserNotificationRequest metadata runtime.ServerMetadata err error ) - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) { + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Notification); err != nil && !errors.Is(err, io.EOF) { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - val, ok := pathParams["parent"] + if protoReq.UpdateMask == nil || len(protoReq.UpdateMask.GetPaths()) == 0 { + if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader(), protoReq.Notification); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } else { + protoReq.UpdateMask = fieldMask + } + } + val, ok := pathParams["notification.name"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "notification.name") } - protoReq.Parent, err = runtime.String(val) + err = runtime.PopulateFieldFromPath(&protoReq, "notification.name", val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "notification.name", err) } - msg, err := server.CreatePersonalAccessToken(ctx, &protoReq) + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_UserService_UpdateUserNotification_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + msg, err := server.UpdateUserNotification(ctx, &protoReq) return msg, metadata, err } -func request_UserService_DeletePersonalAccessToken_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func request_UserService_DeleteUserNotification_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var ( - protoReq DeletePersonalAccessTokenRequest + protoReq DeleteUserNotificationRequest metadata runtime.ServerMetadata err error ) @@ -1204,13 +1012,13 @@ func request_UserService_DeletePersonalAccessToken_0(ctx context.Context, marsha if req.Body != nil { _, _ = io.Copy(io.Discard, req.Body) } - msg, err := client.DeletePersonalAccessToken(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.DeleteUserNotification(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_UserService_DeletePersonalAccessToken_0(ctx context.Context, marshaler runtime.Marshaler, server UserServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func local_request_UserService_DeleteUserNotification_0(ctx context.Context, marshaler runtime.Marshaler, server UserServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var ( - protoReq DeletePersonalAccessTokenRequest + protoReq DeleteUserNotificationRequest metadata runtime.ServerMetadata err error ) @@ -1222,7 +1030,7 @@ func local_request_UserService_DeletePersonalAccessToken_0(ctx context.Context, if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) } - msg, err := server.DeletePersonalAccessToken(ctx, &protoReq) + msg, err := server.DeleteUserNotification(ctx, &protoReq) return msg, metadata, err } @@ -1469,11 +1277,9 @@ func local_request_UserService_GetUserWebhookSigningSecret_0(ctx context.Context return msg, metadata, err } -var filter_UserService_ListUserNotifications_0 = &utilities.DoubleArray{Encoding: map[string]int{"parent": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} - -func request_UserService_ListUserNotifications_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func request_UserService_ListLinkedIdentities_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var ( - protoReq ListUserNotificationsRequest + protoReq ListLinkedIdentitiesRequest metadata runtime.ServerMetadata err error ) @@ -1485,22 +1291,16 @@ func request_UserService_ListUserNotifications_0(ctx context.Context, marshaler if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err) } - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_UserService_ListUserNotifications_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } if req.Body != nil { _, _ = io.Copy(io.Discard, req.Body) } - msg, err := client.ListUserNotifications(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.ListLinkedIdentities(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_UserService_ListUserNotifications_0(ctx context.Context, marshaler runtime.Marshaler, server UserServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func local_request_UserService_ListLinkedIdentities_0(ctx context.Context, marshaler runtime.Marshaler, server UserServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var ( - protoReq ListUserNotificationsRequest + protoReq ListLinkedIdentitiesRequest metadata runtime.ServerMetadata err error ) @@ -1512,100 +1312,13 @@ func local_request_UserService_ListUserNotifications_0(ctx context.Context, mars if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err) } - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_UserService_ListUserNotifications_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - msg, err := server.ListUserNotifications(ctx, &protoReq) + msg, err := server.ListLinkedIdentities(ctx, &protoReq) return msg, metadata, err } -var filter_UserService_UpdateUserNotification_0 = &utilities.DoubleArray{Encoding: map[string]int{"notification": 0, "name": 1}, Base: []int{1, 2, 1, 0, 0}, Check: []int{0, 1, 2, 3, 2}} - -func request_UserService_UpdateUserNotification_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func request_UserService_GetLinkedIdentity_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var ( - protoReq UpdateUserNotificationRequest - metadata runtime.ServerMetadata - err error - ) - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Notification); err != nil && !errors.Is(err, io.EOF) { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if protoReq.UpdateMask == nil || len(protoReq.UpdateMask.GetPaths()) == 0 { - if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader(), protoReq.Notification); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } else { - protoReq.UpdateMask = fieldMask - } - } - val, ok := pathParams["notification.name"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "notification.name") - } - err = runtime.PopulateFieldFromPath(&protoReq, "notification.name", val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "notification.name", err) - } - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_UserService_UpdateUserNotification_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if req.Body != nil { - _, _ = io.Copy(io.Discard, req.Body) - } - msg, err := client.UpdateUserNotification(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err -} - -func local_request_UserService_UpdateUserNotification_0(ctx context.Context, marshaler runtime.Marshaler, server UserServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var ( - protoReq UpdateUserNotificationRequest - metadata runtime.ServerMetadata - err error - ) - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Notification); err != nil && !errors.Is(err, io.EOF) { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if protoReq.UpdateMask == nil || len(protoReq.UpdateMask.GetPaths()) == 0 { - if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader(), protoReq.Notification); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } else { - protoReq.UpdateMask = fieldMask - } - } - val, ok := pathParams["notification.name"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "notification.name") - } - err = runtime.PopulateFieldFromPath(&protoReq, "notification.name", val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "notification.name", err) - } - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_UserService_UpdateUserNotification_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - msg, err := server.UpdateUserNotification(ctx, &protoReq) - return msg, metadata, err -} - -func request_UserService_DeleteUserNotification_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var ( - protoReq DeleteUserNotificationRequest + protoReq GetLinkedIdentityRequest metadata runtime.ServerMetadata err error ) @@ -1620,13 +1333,13 @@ func request_UserService_DeleteUserNotification_0(ctx context.Context, marshaler if req.Body != nil { _, _ = io.Copy(io.Discard, req.Body) } - msg, err := client.DeleteUserNotification(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.GetLinkedIdentity(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_UserService_DeleteUserNotification_0(ctx context.Context, marshaler runtime.Marshaler, server UserServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func local_request_UserService_GetLinkedIdentity_0(ctx context.Context, marshaler runtime.Marshaler, server UserServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var ( - protoReq DeleteUserNotificationRequest + protoReq GetLinkedIdentityRequest metadata runtime.ServerMetadata err error ) @@ -1638,7 +1351,312 @@ func local_request_UserService_DeleteUserNotification_0(ctx context.Context, mar if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) } - msg, err := server.DeleteUserNotification(ctx, &protoReq) + msg, err := server.GetLinkedIdentity(ctx, &protoReq) + return msg, metadata, err +} + +func request_UserService_CreateLinkedIdentity_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq CreateLinkedIdentityRequest + metadata runtime.ServerMetadata + err error + ) + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + val, ok := pathParams["parent"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent") + } + protoReq.Parent, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err) + } + if req.Body != nil { + _, _ = io.Copy(io.Discard, req.Body) + } + msg, err := client.CreateLinkedIdentity(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err +} + +func local_request_UserService_CreateLinkedIdentity_0(ctx context.Context, marshaler runtime.Marshaler, server UserServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq CreateLinkedIdentityRequest + metadata runtime.ServerMetadata + err error + ) + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + val, ok := pathParams["parent"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent") + } + protoReq.Parent, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err) + } + msg, err := server.CreateLinkedIdentity(ctx, &protoReq) + return msg, metadata, err +} + +func request_UserService_DeleteLinkedIdentity_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq DeleteLinkedIdentityRequest + metadata runtime.ServerMetadata + err error + ) + val, ok := pathParams["name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + } + protoReq.Name, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + } + if req.Body != nil { + _, _ = io.Copy(io.Discard, req.Body) + } + msg, err := client.DeleteLinkedIdentity(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err +} + +func local_request_UserService_DeleteLinkedIdentity_0(ctx context.Context, marshaler runtime.Marshaler, server UserServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq DeleteLinkedIdentityRequest + metadata runtime.ServerMetadata + err error + ) + val, ok := pathParams["name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + } + protoReq.Name, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + } + msg, err := server.DeleteLinkedIdentity(ctx, &protoReq) + return msg, metadata, err +} + +var filter_UserService_ListPersonalAccessTokens_0 = &utilities.DoubleArray{Encoding: map[string]int{"parent": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} + +func request_UserService_ListPersonalAccessTokens_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq ListPersonalAccessTokensRequest + metadata runtime.ServerMetadata + err error + ) + val, ok := pathParams["parent"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent") + } + protoReq.Parent, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err) + } + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_UserService_ListPersonalAccessTokens_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if req.Body != nil { + _, _ = io.Copy(io.Discard, req.Body) + } + msg, err := client.ListPersonalAccessTokens(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err +} + +func local_request_UserService_ListPersonalAccessTokens_0(ctx context.Context, marshaler runtime.Marshaler, server UserServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq ListPersonalAccessTokensRequest + metadata runtime.ServerMetadata + err error + ) + val, ok := pathParams["parent"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent") + } + protoReq.Parent, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err) + } + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_UserService_ListPersonalAccessTokens_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + msg, err := server.ListPersonalAccessTokens(ctx, &protoReq) + return msg, metadata, err +} + +func request_UserService_CreatePersonalAccessToken_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq CreatePersonalAccessTokenRequest + metadata runtime.ServerMetadata + err error + ) + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + val, ok := pathParams["parent"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent") + } + protoReq.Parent, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err) + } + if req.Body != nil { + _, _ = io.Copy(io.Discard, req.Body) + } + msg, err := client.CreatePersonalAccessToken(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err +} + +func local_request_UserService_CreatePersonalAccessToken_0(ctx context.Context, marshaler runtime.Marshaler, server UserServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq CreatePersonalAccessTokenRequest + metadata runtime.ServerMetadata + err error + ) + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + val, ok := pathParams["parent"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent") + } + protoReq.Parent, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err) + } + msg, err := server.CreatePersonalAccessToken(ctx, &protoReq) + return msg, metadata, err +} + +func request_UserService_DeletePersonalAccessToken_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq DeletePersonalAccessTokenRequest + metadata runtime.ServerMetadata + err error + ) + val, ok := pathParams["name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + } + protoReq.Name, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + } + if req.Body != nil { + _, _ = io.Copy(io.Discard, req.Body) + } + msg, err := client.DeletePersonalAccessToken(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err +} + +func local_request_UserService_DeletePersonalAccessToken_0(ctx context.Context, marshaler runtime.Marshaler, server UserServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq DeletePersonalAccessTokenRequest + metadata runtime.ServerMetadata + err error + ) + val, ok := pathParams["name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + } + protoReq.Name, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + } + msg, err := server.DeletePersonalAccessToken(ctx, &protoReq) + return msg, metadata, err +} + +func request_UserService_ExportMemos_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq ExportMemosRequest + metadata runtime.ServerMetadata + err error + ) + val, ok := pathParams["name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + } + protoReq.Name, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + } + if req.Body != nil { + _, _ = io.Copy(io.Discard, req.Body) + } + msg, err := client.ExportMemos(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err +} + +func local_request_UserService_ExportMemos_0(ctx context.Context, marshaler runtime.Marshaler, server UserServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq ExportMemosRequest + metadata runtime.ServerMetadata + err error + ) + val, ok := pathParams["name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + } + protoReq.Name, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + } + msg, err := server.ExportMemos(ctx, &protoReq) + return msg, metadata, err +} + +func request_UserService_ImportMemos_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq ImportMemosRequest + metadata runtime.ServerMetadata + err error + ) + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + val, ok := pathParams["name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + } + protoReq.Name, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + } + if req.Body != nil { + _, _ = io.Copy(io.Discard, req.Body) + } + msg, err := client.ImportMemos(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err +} + +func local_request_UserService_ImportMemos_0(ctx context.Context, marshaler runtime.Marshaler, server UserServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq ImportMemosRequest + metadata runtime.ServerMetadata + err error + ) + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + val, ok := pathParams["name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + } + protoReq.Name, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + } + msg, err := server.ImportMemos(ctx, &protoReq) return msg, metadata, err } @@ -1654,7 +1672,7 @@ func RegisterUserServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.UserService/ListUsers", runtime.WithHTTPPathPattern("/api/v1/users")) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.UserService/ListUsers", runtime.WithHTTPPathPattern("/api/users")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -1668,33 +1686,13 @@ func RegisterUserServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux } forward_UserService_ListUsers_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle(http.MethodPost, pattern_UserService_BatchGetUsers_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.UserService/BatchGetUsers", runtime.WithHTTPPathPattern("/api/v1/users:batchGet")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_UserService_BatchGetUsers_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - forward_UserService_BatchGetUsers_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle(http.MethodGet, pattern_UserService_GetUser_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.UserService/GetUser", runtime.WithHTTPPathPattern("/api/v1/{name=users/*}")) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.UserService/GetUser", runtime.WithHTTPPathPattern("/api/{name=users/*}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -1708,13 +1706,33 @@ func RegisterUserServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux } forward_UserService_GetUser_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) + mux.Handle(http.MethodPost, pattern_UserService_BatchGetUsers_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.UserService/BatchGetUsers", runtime.WithHTTPPathPattern("/api/users:batchGet")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_UserService_BatchGetUsers_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_UserService_BatchGetUsers_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) mux.Handle(http.MethodPost, pattern_UserService_CreateUser_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.UserService/CreateUser", runtime.WithHTTPPathPattern("/api/v1/users")) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.UserService/CreateUser", runtime.WithHTTPPathPattern("/api/users")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -1734,7 +1752,7 @@ func RegisterUserServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.UserService/UpdateUser", runtime.WithHTTPPathPattern("/api/v1/{user.name=users/*}")) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.UserService/UpdateUser", runtime.WithHTTPPathPattern("/api/{user.name=users/*}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -1754,7 +1772,7 @@ func RegisterUserServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.UserService/DeleteUser", runtime.WithHTTPPathPattern("/api/v1/{name=users/*}")) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.UserService/DeleteUser", runtime.WithHTTPPathPattern("/api/{name=users/*}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -1768,85 +1786,25 @@ func RegisterUserServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux } forward_UserService_DeleteUser_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle(http.MethodGet, pattern_UserService_ListAllUserStats_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle(http.MethodGet, pattern_UserService_ListUserSettings_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.UserService/ListAllUserStats", runtime.WithHTTPPathPattern("/api/v1/users:stats")) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.UserService/ListUserSettings", runtime.WithHTTPPathPattern("/api/{parent=users/*}/settings")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_UserService_ListAllUserStats_0(annotatedContext, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_UserService_ListUserSettings_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } - forward_UserService_ListAllUserStats_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - mux.Handle(http.MethodGet, pattern_UserService_GetUserStats_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.UserService/GetUserStats", runtime.WithHTTPPathPattern("/api/v1/{name=users/*}:getStats")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_UserService_GetUserStats_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - forward_UserService_GetUserStats_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - mux.Handle(http.MethodGet, pattern_UserService_ExportMemos_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.UserService/ExportMemos", runtime.WithHTTPPathPattern("/api/v1/{name=users/*}:exportMemos")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_UserService_ExportMemos_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - forward_UserService_ExportMemos_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - mux.Handle(http.MethodPost, pattern_UserService_ImportMemos_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.UserService/ImportMemos", runtime.WithHTTPPathPattern("/api/v1/{name=users/*}:importMemos")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_UserService_ImportMemos_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - forward_UserService_ImportMemos_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_UserService_ListUserSettings_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle(http.MethodGet, pattern_UserService_GetUserSetting_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) @@ -1854,7 +1812,7 @@ func RegisterUserServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.UserService/GetUserSetting", runtime.WithHTTPPathPattern("/api/v1/{name=users/*/settings/*}")) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.UserService/GetUserSetting", runtime.WithHTTPPathPattern("/api/{name=users/*/settings/*}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -1874,7 +1832,7 @@ func RegisterUserServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.UserService/UpdateUserSetting", runtime.WithHTTPPathPattern("/api/v1/{setting.name=users/*/settings/*}")) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.UserService/UpdateUserSetting", runtime.WithHTTPPathPattern("/api/{user_setting.name=users/*/settings/*}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -1888,25 +1846,45 @@ func RegisterUserServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux } forward_UserService_UpdateUserSetting_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle(http.MethodGet, pattern_UserService_ListUserSettings_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle(http.MethodGet, pattern_UserService_ListUserStats_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.UserService/ListUserSettings", runtime.WithHTTPPathPattern("/api/v1/{parent=users/*}/settings")) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.UserService/ListUserStats", runtime.WithHTTPPathPattern("/api/{parent=users/*}/stats")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_UserService_ListUserSettings_0(annotatedContext, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_UserService_ListUserStats_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } - forward_UserService_ListUserSettings_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_UserService_ListUserStats_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) + mux.Handle(http.MethodGet, pattern_UserService_GetUserStats_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.UserService/GetUserStats", runtime.WithHTTPPathPattern("/api/{name=users/*}:getStats")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_UserService_GetUserStats_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_UserService_GetUserStats_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle(http.MethodGet, pattern_UserService_ListMemoViews_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) @@ -1914,7 +1892,7 @@ func RegisterUserServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.UserService/ListMemoViews", runtime.WithHTTPPathPattern("/api/v1/{parent=users/*}/views")) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.UserService/ListMemoViews", runtime.WithHTTPPathPattern("/api/{parent=users/*}/views")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -1934,7 +1912,7 @@ func RegisterUserServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.UserService/GetMemoView", runtime.WithHTTPPathPattern("/api/v1/{name=users/*/views/*}")) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.UserService/GetMemoView", runtime.WithHTTPPathPattern("/api/{name=users/*/views/*}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -1954,7 +1932,7 @@ func RegisterUserServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.UserService/CreateMemoView", runtime.WithHTTPPathPattern("/api/v1/{parent=users/*}/views")) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.UserService/CreateMemoView", runtime.WithHTTPPathPattern("/api/{parent=users/*}/views")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -1974,7 +1952,7 @@ func RegisterUserServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.UserService/UpdateMemoView", runtime.WithHTTPPathPattern("/api/v1/{memo_view.name=users/*/views/*}")) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.UserService/UpdateMemoView", runtime.WithHTTPPathPattern("/api/{memo_view.name=users/*/views/*}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -1994,7 +1972,7 @@ func RegisterUserServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.UserService/DeleteMemoView", runtime.WithHTTPPathPattern("/api/v1/{name=users/*/views/*}")) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.UserService/DeleteMemoView", runtime.WithHTTPPathPattern("/api/{name=users/*/views/*}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -2008,253 +1986,13 @@ func RegisterUserServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux } forward_UserService_DeleteMemoView_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle(http.MethodGet, pattern_UserService_ListLinkedIdentities_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.UserService/ListLinkedIdentities", runtime.WithHTTPPathPattern("/api/v1/{parent=users/*}/linkedIdentities")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_UserService_ListLinkedIdentities_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - forward_UserService_ListLinkedIdentities_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - mux.Handle(http.MethodPost, pattern_UserService_CreateLinkedIdentity_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.UserService/CreateLinkedIdentity", runtime.WithHTTPPathPattern("/api/v1/{parent=users/*}/linkedIdentities")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_UserService_CreateLinkedIdentity_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - forward_UserService_CreateLinkedIdentity_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - mux.Handle(http.MethodGet, pattern_UserService_GetLinkedIdentity_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.UserService/GetLinkedIdentity", runtime.WithHTTPPathPattern("/api/v1/{name=users/*/linkedIdentities/*}")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_UserService_GetLinkedIdentity_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - forward_UserService_GetLinkedIdentity_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - mux.Handle(http.MethodDelete, pattern_UserService_DeleteLinkedIdentity_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.UserService/DeleteLinkedIdentity", runtime.WithHTTPPathPattern("/api/v1/{name=users/*/linkedIdentities/*}")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_UserService_DeleteLinkedIdentity_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - forward_UserService_DeleteLinkedIdentity_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - mux.Handle(http.MethodGet, pattern_UserService_ListPersonalAccessTokens_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.UserService/ListPersonalAccessTokens", runtime.WithHTTPPathPattern("/api/v1/{parent=users/*}/personalAccessTokens")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_UserService_ListPersonalAccessTokens_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - forward_UserService_ListPersonalAccessTokens_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - mux.Handle(http.MethodPost, pattern_UserService_CreatePersonalAccessToken_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.UserService/CreatePersonalAccessToken", runtime.WithHTTPPathPattern("/api/v1/{parent=users/*}/personalAccessTokens")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_UserService_CreatePersonalAccessToken_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - forward_UserService_CreatePersonalAccessToken_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - mux.Handle(http.MethodDelete, pattern_UserService_DeletePersonalAccessToken_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.UserService/DeletePersonalAccessToken", runtime.WithHTTPPathPattern("/api/v1/{name=users/*/personalAccessTokens/*}")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_UserService_DeletePersonalAccessToken_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - forward_UserService_DeletePersonalAccessToken_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - mux.Handle(http.MethodGet, pattern_UserService_ListUserWebhooks_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.UserService/ListUserWebhooks", runtime.WithHTTPPathPattern("/api/v1/{parent=users/*}/webhooks")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_UserService_ListUserWebhooks_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - forward_UserService_ListUserWebhooks_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - mux.Handle(http.MethodPost, pattern_UserService_CreateUserWebhook_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.UserService/CreateUserWebhook", runtime.WithHTTPPathPattern("/api/v1/{parent=users/*}/webhooks")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_UserService_CreateUserWebhook_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - forward_UserService_CreateUserWebhook_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - mux.Handle(http.MethodPatch, pattern_UserService_UpdateUserWebhook_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.UserService/UpdateUserWebhook", runtime.WithHTTPPathPattern("/api/v1/{webhook.name=users/*/webhooks/*}")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_UserService_UpdateUserWebhook_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - forward_UserService_UpdateUserWebhook_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - mux.Handle(http.MethodDelete, pattern_UserService_DeleteUserWebhook_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.UserService/DeleteUserWebhook", runtime.WithHTTPPathPattern("/api/v1/{name=users/*/webhooks/*}")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_UserService_DeleteUserWebhook_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - forward_UserService_DeleteUserWebhook_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - mux.Handle(http.MethodGet, pattern_UserService_GetUserWebhookSigningSecret_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.UserService/GetUserWebhookSigningSecret", runtime.WithHTTPPathPattern("/api/v1/{name=users/*/webhooks/*}:getSigningSecret")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_UserService_GetUserWebhookSigningSecret_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - forward_UserService_GetUserWebhookSigningSecret_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle(http.MethodGet, pattern_UserService_ListUserNotifications_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.UserService/ListUserNotifications", runtime.WithHTTPPathPattern("/api/v1/{parent=users/*}/notifications")) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.UserService/ListUserNotifications", runtime.WithHTTPPathPattern("/api/{parent=users/*}/notifications")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -2274,7 +2012,7 @@ func RegisterUserServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.UserService/UpdateUserNotification", runtime.WithHTTPPathPattern("/api/v1/{notification.name=users/*/notifications/*}")) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.UserService/UpdateUserNotification", runtime.WithHTTPPathPattern("/api/{notification.name=users/*/notifications/*}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -2294,7 +2032,7 @@ func RegisterUserServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.UserService/DeleteUserNotification", runtime.WithHTTPPathPattern("/api/v1/{name=users/*/notifications/*}")) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.UserService/DeleteUserNotification", runtime.WithHTTPPathPattern("/api/{name=users/*/notifications/*}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -2308,6 +2046,286 @@ func RegisterUserServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux } forward_UserService_DeleteUserNotification_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) + mux.Handle(http.MethodGet, pattern_UserService_ListUserWebhooks_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.UserService/ListUserWebhooks", runtime.WithHTTPPathPattern("/api/{parent=users/*}/webhooks")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_UserService_ListUserWebhooks_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_UserService_ListUserWebhooks_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) + mux.Handle(http.MethodPost, pattern_UserService_CreateUserWebhook_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.UserService/CreateUserWebhook", runtime.WithHTTPPathPattern("/api/{parent=users/*}/webhooks")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_UserService_CreateUserWebhook_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_UserService_CreateUserWebhook_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) + mux.Handle(http.MethodPatch, pattern_UserService_UpdateUserWebhook_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.UserService/UpdateUserWebhook", runtime.WithHTTPPathPattern("/api/{webhook.name=users/*/webhooks/*}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_UserService_UpdateUserWebhook_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_UserService_UpdateUserWebhook_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) + mux.Handle(http.MethodDelete, pattern_UserService_DeleteUserWebhook_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.UserService/DeleteUserWebhook", runtime.WithHTTPPathPattern("/api/{name=users/*/webhooks/*}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_UserService_DeleteUserWebhook_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_UserService_DeleteUserWebhook_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) + mux.Handle(http.MethodGet, pattern_UserService_GetUserWebhookSigningSecret_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.UserService/GetUserWebhookSigningSecret", runtime.WithHTTPPathPattern("/api/{name=users/*/webhooks/*}:getSigningSecret")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_UserService_GetUserWebhookSigningSecret_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_UserService_GetUserWebhookSigningSecret_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) + mux.Handle(http.MethodGet, pattern_UserService_ListLinkedIdentities_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.UserService/ListLinkedIdentities", runtime.WithHTTPPathPattern("/api/{parent=users/*}/linkedIdentities")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_UserService_ListLinkedIdentities_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_UserService_ListLinkedIdentities_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) + mux.Handle(http.MethodGet, pattern_UserService_GetLinkedIdentity_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.UserService/GetLinkedIdentity", runtime.WithHTTPPathPattern("/api/{name=users/*/linkedIdentities/*}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_UserService_GetLinkedIdentity_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_UserService_GetLinkedIdentity_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) + mux.Handle(http.MethodPost, pattern_UserService_CreateLinkedIdentity_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.UserService/CreateLinkedIdentity", runtime.WithHTTPPathPattern("/api/{parent=users/*}/linkedIdentities")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_UserService_CreateLinkedIdentity_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_UserService_CreateLinkedIdentity_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) + mux.Handle(http.MethodDelete, pattern_UserService_DeleteLinkedIdentity_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.UserService/DeleteLinkedIdentity", runtime.WithHTTPPathPattern("/api/{name=users/*/linkedIdentities/*}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_UserService_DeleteLinkedIdentity_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_UserService_DeleteLinkedIdentity_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) + mux.Handle(http.MethodGet, pattern_UserService_ListPersonalAccessTokens_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.UserService/ListPersonalAccessTokens", runtime.WithHTTPPathPattern("/api/{parent=users/*}/personalAccessTokens")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_UserService_ListPersonalAccessTokens_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_UserService_ListPersonalAccessTokens_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) + mux.Handle(http.MethodPost, pattern_UserService_CreatePersonalAccessToken_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.UserService/CreatePersonalAccessToken", runtime.WithHTTPPathPattern("/api/{parent=users/*}/personalAccessTokens")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_UserService_CreatePersonalAccessToken_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_UserService_CreatePersonalAccessToken_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) + mux.Handle(http.MethodDelete, pattern_UserService_DeletePersonalAccessToken_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.UserService/DeletePersonalAccessToken", runtime.WithHTTPPathPattern("/api/{name=users/*/personalAccessTokens/*}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_UserService_DeletePersonalAccessToken_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_UserService_DeletePersonalAccessToken_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) + mux.Handle(http.MethodGet, pattern_UserService_ExportMemos_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.UserService/ExportMemos", runtime.WithHTTPPathPattern("/api/{name=users/*}:exportMemos")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_UserService_ExportMemos_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_UserService_ExportMemos_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) + mux.Handle(http.MethodPost, pattern_UserService_ImportMemos_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.UserService/ImportMemos", runtime.WithHTTPPathPattern("/api/{name=users/*}:importMemos")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_UserService_ImportMemos_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_UserService_ImportMemos_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) return nil } @@ -2352,7 +2370,7 @@ func RegisterUserServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.UserService/ListUsers", runtime.WithHTTPPathPattern("/api/v1/users")) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.UserService/ListUsers", runtime.WithHTTPPathPattern("/api/users")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -2365,28 +2383,11 @@ func RegisterUserServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux } forward_UserService_ListUsers_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle(http.MethodPost, pattern_UserService_BatchGetUsers_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.UserService/BatchGetUsers", runtime.WithHTTPPathPattern("/api/v1/users:batchGet")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_UserService_BatchGetUsers_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - forward_UserService_BatchGetUsers_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle(http.MethodGet, pattern_UserService_GetUser_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.UserService/GetUser", runtime.WithHTTPPathPattern("/api/v1/{name=users/*}")) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.UserService/GetUser", runtime.WithHTTPPathPattern("/api/{name=users/*}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -2399,11 +2400,28 @@ func RegisterUserServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux } forward_UserService_GetUser_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) + mux.Handle(http.MethodPost, pattern_UserService_BatchGetUsers_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.UserService/BatchGetUsers", runtime.WithHTTPPathPattern("/api/users:batchGet")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_UserService_BatchGetUsers_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_UserService_BatchGetUsers_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) mux.Handle(http.MethodPost, pattern_UserService_CreateUser_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.UserService/CreateUser", runtime.WithHTTPPathPattern("/api/v1/users")) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.UserService/CreateUser", runtime.WithHTTPPathPattern("/api/users")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -2420,7 +2438,7 @@ func RegisterUserServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.UserService/UpdateUser", runtime.WithHTTPPathPattern("/api/v1/{user.name=users/*}")) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.UserService/UpdateUser", runtime.WithHTTPPathPattern("/api/{user.name=users/*}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -2437,7 +2455,7 @@ func RegisterUserServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.UserService/DeleteUser", runtime.WithHTTPPathPattern("/api/v1/{name=users/*}")) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.UserService/DeleteUser", runtime.WithHTTPPathPattern("/api/{name=users/*}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -2450,79 +2468,28 @@ func RegisterUserServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux } forward_UserService_DeleteUser_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle(http.MethodGet, pattern_UserService_ListAllUserStats_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle(http.MethodGet, pattern_UserService_ListUserSettings_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.UserService/ListAllUserStats", runtime.WithHTTPPathPattern("/api/v1/users:stats")) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.UserService/ListUserSettings", runtime.WithHTTPPathPattern("/api/{parent=users/*}/settings")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_UserService_ListAllUserStats_0(annotatedContext, inboundMarshaler, client, req, pathParams) + resp, md, err := request_UserService_ListUserSettings_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } - forward_UserService_ListAllUserStats_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - mux.Handle(http.MethodGet, pattern_UserService_GetUserStats_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.UserService/GetUserStats", runtime.WithHTTPPathPattern("/api/v1/{name=users/*}:getStats")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_UserService_GetUserStats_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - forward_UserService_GetUserStats_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - mux.Handle(http.MethodGet, pattern_UserService_ExportMemos_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.UserService/ExportMemos", runtime.WithHTTPPathPattern("/api/v1/{name=users/*}:exportMemos")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_UserService_ExportMemos_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - forward_UserService_ExportMemos_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - mux.Handle(http.MethodPost, pattern_UserService_ImportMemos_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.UserService/ImportMemos", runtime.WithHTTPPathPattern("/api/v1/{name=users/*}:importMemos")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_UserService_ImportMemos_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - forward_UserService_ImportMemos_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_UserService_ListUserSettings_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle(http.MethodGet, pattern_UserService_GetUserSetting_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.UserService/GetUserSetting", runtime.WithHTTPPathPattern("/api/v1/{name=users/*/settings/*}")) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.UserService/GetUserSetting", runtime.WithHTTPPathPattern("/api/{name=users/*/settings/*}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -2539,7 +2506,7 @@ func RegisterUserServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.UserService/UpdateUserSetting", runtime.WithHTTPPathPattern("/api/v1/{setting.name=users/*/settings/*}")) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.UserService/UpdateUserSetting", runtime.WithHTTPPathPattern("/api/{user_setting.name=users/*/settings/*}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -2552,28 +2519,45 @@ func RegisterUserServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux } forward_UserService_UpdateUserSetting_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle(http.MethodGet, pattern_UserService_ListUserSettings_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle(http.MethodGet, pattern_UserService_ListUserStats_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.UserService/ListUserSettings", runtime.WithHTTPPathPattern("/api/v1/{parent=users/*}/settings")) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.UserService/ListUserStats", runtime.WithHTTPPathPattern("/api/{parent=users/*}/stats")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_UserService_ListUserSettings_0(annotatedContext, inboundMarshaler, client, req, pathParams) + resp, md, err := request_UserService_ListUserStats_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } - forward_UserService_ListUserSettings_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_UserService_ListUserStats_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) + mux.Handle(http.MethodGet, pattern_UserService_GetUserStats_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.UserService/GetUserStats", runtime.WithHTTPPathPattern("/api/{name=users/*}:getStats")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_UserService_GetUserStats_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_UserService_GetUserStats_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle(http.MethodGet, pattern_UserService_ListMemoViews_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.UserService/ListMemoViews", runtime.WithHTTPPathPattern("/api/v1/{parent=users/*}/views")) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.UserService/ListMemoViews", runtime.WithHTTPPathPattern("/api/{parent=users/*}/views")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -2590,7 +2574,7 @@ func RegisterUserServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.UserService/GetMemoView", runtime.WithHTTPPathPattern("/api/v1/{name=users/*/views/*}")) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.UserService/GetMemoView", runtime.WithHTTPPathPattern("/api/{name=users/*/views/*}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -2607,7 +2591,7 @@ func RegisterUserServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.UserService/CreateMemoView", runtime.WithHTTPPathPattern("/api/v1/{parent=users/*}/views")) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.UserService/CreateMemoView", runtime.WithHTTPPathPattern("/api/{parent=users/*}/views")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -2624,7 +2608,7 @@ func RegisterUserServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.UserService/UpdateMemoView", runtime.WithHTTPPathPattern("/api/v1/{memo_view.name=users/*/views/*}")) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.UserService/UpdateMemoView", runtime.WithHTTPPathPattern("/api/{memo_view.name=users/*/views/*}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -2641,7 +2625,7 @@ func RegisterUserServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.UserService/DeleteMemoView", runtime.WithHTTPPathPattern("/api/v1/{name=users/*/views/*}")) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.UserService/DeleteMemoView", runtime.WithHTTPPathPattern("/api/{name=users/*/views/*}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -2654,215 +2638,11 @@ func RegisterUserServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux } forward_UserService_DeleteMemoView_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle(http.MethodGet, pattern_UserService_ListLinkedIdentities_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.UserService/ListLinkedIdentities", runtime.WithHTTPPathPattern("/api/v1/{parent=users/*}/linkedIdentities")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_UserService_ListLinkedIdentities_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - forward_UserService_ListLinkedIdentities_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - mux.Handle(http.MethodPost, pattern_UserService_CreateLinkedIdentity_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.UserService/CreateLinkedIdentity", runtime.WithHTTPPathPattern("/api/v1/{parent=users/*}/linkedIdentities")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_UserService_CreateLinkedIdentity_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - forward_UserService_CreateLinkedIdentity_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - mux.Handle(http.MethodGet, pattern_UserService_GetLinkedIdentity_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.UserService/GetLinkedIdentity", runtime.WithHTTPPathPattern("/api/v1/{name=users/*/linkedIdentities/*}")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_UserService_GetLinkedIdentity_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - forward_UserService_GetLinkedIdentity_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - mux.Handle(http.MethodDelete, pattern_UserService_DeleteLinkedIdentity_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.UserService/DeleteLinkedIdentity", runtime.WithHTTPPathPattern("/api/v1/{name=users/*/linkedIdentities/*}")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_UserService_DeleteLinkedIdentity_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - forward_UserService_DeleteLinkedIdentity_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - mux.Handle(http.MethodGet, pattern_UserService_ListPersonalAccessTokens_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.UserService/ListPersonalAccessTokens", runtime.WithHTTPPathPattern("/api/v1/{parent=users/*}/personalAccessTokens")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_UserService_ListPersonalAccessTokens_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - forward_UserService_ListPersonalAccessTokens_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - mux.Handle(http.MethodPost, pattern_UserService_CreatePersonalAccessToken_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.UserService/CreatePersonalAccessToken", runtime.WithHTTPPathPattern("/api/v1/{parent=users/*}/personalAccessTokens")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_UserService_CreatePersonalAccessToken_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - forward_UserService_CreatePersonalAccessToken_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - mux.Handle(http.MethodDelete, pattern_UserService_DeletePersonalAccessToken_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.UserService/DeletePersonalAccessToken", runtime.WithHTTPPathPattern("/api/v1/{name=users/*/personalAccessTokens/*}")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_UserService_DeletePersonalAccessToken_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - forward_UserService_DeletePersonalAccessToken_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - mux.Handle(http.MethodGet, pattern_UserService_ListUserWebhooks_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.UserService/ListUserWebhooks", runtime.WithHTTPPathPattern("/api/v1/{parent=users/*}/webhooks")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_UserService_ListUserWebhooks_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - forward_UserService_ListUserWebhooks_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - mux.Handle(http.MethodPost, pattern_UserService_CreateUserWebhook_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.UserService/CreateUserWebhook", runtime.WithHTTPPathPattern("/api/v1/{parent=users/*}/webhooks")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_UserService_CreateUserWebhook_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - forward_UserService_CreateUserWebhook_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - mux.Handle(http.MethodPatch, pattern_UserService_UpdateUserWebhook_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.UserService/UpdateUserWebhook", runtime.WithHTTPPathPattern("/api/v1/{webhook.name=users/*/webhooks/*}")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_UserService_UpdateUserWebhook_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - forward_UserService_UpdateUserWebhook_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - mux.Handle(http.MethodDelete, pattern_UserService_DeleteUserWebhook_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.UserService/DeleteUserWebhook", runtime.WithHTTPPathPattern("/api/v1/{name=users/*/webhooks/*}")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_UserService_DeleteUserWebhook_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - forward_UserService_DeleteUserWebhook_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - mux.Handle(http.MethodGet, pattern_UserService_GetUserWebhookSigningSecret_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.UserService/GetUserWebhookSigningSecret", runtime.WithHTTPPathPattern("/api/v1/{name=users/*/webhooks/*}:getSigningSecret")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_UserService_GetUserWebhookSigningSecret_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - forward_UserService_GetUserWebhookSigningSecret_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle(http.MethodGet, pattern_UserService_ListUserNotifications_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.UserService/ListUserNotifications", runtime.WithHTTPPathPattern("/api/v1/{parent=users/*}/notifications")) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.UserService/ListUserNotifications", runtime.WithHTTPPathPattern("/api/{parent=users/*}/notifications")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -2879,7 +2659,7 @@ func RegisterUserServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.UserService/UpdateUserNotification", runtime.WithHTTPPathPattern("/api/v1/{notification.name=users/*/notifications/*}")) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.UserService/UpdateUserNotification", runtime.WithHTTPPathPattern("/api/{notification.name=users/*/notifications/*}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -2896,7 +2676,7 @@ func RegisterUserServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.UserService/DeleteUserNotification", runtime.WithHTTPPathPattern("/api/v1/{name=users/*/notifications/*}")) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.UserService/DeleteUserNotification", runtime.WithHTTPPathPattern("/api/{name=users/*/notifications/*}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -2909,77 +2689,315 @@ func RegisterUserServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux } forward_UserService_DeleteUserNotification_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) + mux.Handle(http.MethodGet, pattern_UserService_ListUserWebhooks_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.UserService/ListUserWebhooks", runtime.WithHTTPPathPattern("/api/{parent=users/*}/webhooks")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_UserService_ListUserWebhooks_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_UserService_ListUserWebhooks_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) + mux.Handle(http.MethodPost, pattern_UserService_CreateUserWebhook_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.UserService/CreateUserWebhook", runtime.WithHTTPPathPattern("/api/{parent=users/*}/webhooks")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_UserService_CreateUserWebhook_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_UserService_CreateUserWebhook_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) + mux.Handle(http.MethodPatch, pattern_UserService_UpdateUserWebhook_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.UserService/UpdateUserWebhook", runtime.WithHTTPPathPattern("/api/{webhook.name=users/*/webhooks/*}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_UserService_UpdateUserWebhook_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_UserService_UpdateUserWebhook_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) + mux.Handle(http.MethodDelete, pattern_UserService_DeleteUserWebhook_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.UserService/DeleteUserWebhook", runtime.WithHTTPPathPattern("/api/{name=users/*/webhooks/*}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_UserService_DeleteUserWebhook_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_UserService_DeleteUserWebhook_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) + mux.Handle(http.MethodGet, pattern_UserService_GetUserWebhookSigningSecret_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.UserService/GetUserWebhookSigningSecret", runtime.WithHTTPPathPattern("/api/{name=users/*/webhooks/*}:getSigningSecret")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_UserService_GetUserWebhookSigningSecret_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_UserService_GetUserWebhookSigningSecret_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) + mux.Handle(http.MethodGet, pattern_UserService_ListLinkedIdentities_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.UserService/ListLinkedIdentities", runtime.WithHTTPPathPattern("/api/{parent=users/*}/linkedIdentities")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_UserService_ListLinkedIdentities_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_UserService_ListLinkedIdentities_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) + mux.Handle(http.MethodGet, pattern_UserService_GetLinkedIdentity_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.UserService/GetLinkedIdentity", runtime.WithHTTPPathPattern("/api/{name=users/*/linkedIdentities/*}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_UserService_GetLinkedIdentity_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_UserService_GetLinkedIdentity_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) + mux.Handle(http.MethodPost, pattern_UserService_CreateLinkedIdentity_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.UserService/CreateLinkedIdentity", runtime.WithHTTPPathPattern("/api/{parent=users/*}/linkedIdentities")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_UserService_CreateLinkedIdentity_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_UserService_CreateLinkedIdentity_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) + mux.Handle(http.MethodDelete, pattern_UserService_DeleteLinkedIdentity_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.UserService/DeleteLinkedIdentity", runtime.WithHTTPPathPattern("/api/{name=users/*/linkedIdentities/*}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_UserService_DeleteLinkedIdentity_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_UserService_DeleteLinkedIdentity_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) + mux.Handle(http.MethodGet, pattern_UserService_ListPersonalAccessTokens_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.UserService/ListPersonalAccessTokens", runtime.WithHTTPPathPattern("/api/{parent=users/*}/personalAccessTokens")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_UserService_ListPersonalAccessTokens_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_UserService_ListPersonalAccessTokens_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) + mux.Handle(http.MethodPost, pattern_UserService_CreatePersonalAccessToken_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.UserService/CreatePersonalAccessToken", runtime.WithHTTPPathPattern("/api/{parent=users/*}/personalAccessTokens")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_UserService_CreatePersonalAccessToken_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_UserService_CreatePersonalAccessToken_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) + mux.Handle(http.MethodDelete, pattern_UserService_DeletePersonalAccessToken_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.UserService/DeletePersonalAccessToken", runtime.WithHTTPPathPattern("/api/{name=users/*/personalAccessTokens/*}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_UserService_DeletePersonalAccessToken_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_UserService_DeletePersonalAccessToken_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) + mux.Handle(http.MethodGet, pattern_UserService_ExportMemos_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.UserService/ExportMemos", runtime.WithHTTPPathPattern("/api/{name=users/*}:exportMemos")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_UserService_ExportMemos_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_UserService_ExportMemos_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) + mux.Handle(http.MethodPost, pattern_UserService_ImportMemos_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.UserService/ImportMemos", runtime.WithHTTPPathPattern("/api/{name=users/*}:importMemos")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_UserService_ImportMemos_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_UserService_ImportMemos_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) return nil } var ( - pattern_UserService_ListUsers_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "v1", "users"}, "")) - pattern_UserService_BatchGetUsers_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "v1", "users"}, "batchGet")) - pattern_UserService_GetUser_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3}, []string{"api", "v1", "users", "name"}, "")) - pattern_UserService_CreateUser_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "v1", "users"}, "")) - pattern_UserService_UpdateUser_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3}, []string{"api", "v1", "users", "user.name"}, "")) - pattern_UserService_DeleteUser_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3}, []string{"api", "v1", "users", "name"}, "")) - pattern_UserService_ListAllUserStats_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "v1", "users"}, "stats")) - pattern_UserService_GetUserStats_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3}, []string{"api", "v1", "users", "name"}, "getStats")) - pattern_UserService_ExportMemos_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3}, []string{"api", "v1", "users", "name"}, "exportMemos")) - pattern_UserService_ImportMemos_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3}, []string{"api", "v1", "users", "name"}, "importMemos")) - pattern_UserService_GetUserSetting_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 2, 3, 1, 0, 4, 4, 5, 4}, []string{"api", "v1", "users", "settings", "name"}, "")) - pattern_UserService_UpdateUserSetting_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 2, 3, 1, 0, 4, 4, 5, 4}, []string{"api", "v1", "users", "settings", "setting.name"}, "")) - pattern_UserService_ListUserSettings_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3, 2, 4}, []string{"api", "v1", "users", "parent", "settings"}, "")) - pattern_UserService_ListMemoViews_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3, 2, 4}, []string{"api", "v1", "users", "parent", "views"}, "")) - pattern_UserService_GetMemoView_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 2, 3, 1, 0, 4, 4, 5, 4}, []string{"api", "v1", "users", "views", "name"}, "")) - pattern_UserService_CreateMemoView_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3, 2, 4}, []string{"api", "v1", "users", "parent", "views"}, "")) - pattern_UserService_UpdateMemoView_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 2, 3, 1, 0, 4, 4, 5, 4}, []string{"api", "v1", "users", "views", "memo_view.name"}, "")) - pattern_UserService_DeleteMemoView_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 2, 3, 1, 0, 4, 4, 5, 4}, []string{"api", "v1", "users", "views", "name"}, "")) - pattern_UserService_ListLinkedIdentities_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3, 2, 4}, []string{"api", "v1", "users", "parent", "linkedIdentities"}, "")) - pattern_UserService_CreateLinkedIdentity_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3, 2, 4}, []string{"api", "v1", "users", "parent", "linkedIdentities"}, "")) - pattern_UserService_GetLinkedIdentity_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 2, 3, 1, 0, 4, 4, 5, 4}, []string{"api", "v1", "users", "linkedIdentities", "name"}, "")) - pattern_UserService_DeleteLinkedIdentity_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 2, 3, 1, 0, 4, 4, 5, 4}, []string{"api", "v1", "users", "linkedIdentities", "name"}, "")) - pattern_UserService_ListPersonalAccessTokens_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3, 2, 4}, []string{"api", "v1", "users", "parent", "personalAccessTokens"}, "")) - pattern_UserService_CreatePersonalAccessToken_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3, 2, 4}, []string{"api", "v1", "users", "parent", "personalAccessTokens"}, "")) - pattern_UserService_DeletePersonalAccessToken_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 2, 3, 1, 0, 4, 4, 5, 4}, []string{"api", "v1", "users", "personalAccessTokens", "name"}, "")) - pattern_UserService_ListUserWebhooks_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3, 2, 4}, []string{"api", "v1", "users", "parent", "webhooks"}, "")) - pattern_UserService_CreateUserWebhook_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3, 2, 4}, []string{"api", "v1", "users", "parent", "webhooks"}, "")) - pattern_UserService_UpdateUserWebhook_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 2, 3, 1, 0, 4, 4, 5, 4}, []string{"api", "v1", "users", "webhooks", "webhook.name"}, "")) - pattern_UserService_DeleteUserWebhook_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 2, 3, 1, 0, 4, 4, 5, 4}, []string{"api", "v1", "users", "webhooks", "name"}, "")) - pattern_UserService_GetUserWebhookSigningSecret_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 2, 3, 1, 0, 4, 4, 5, 4}, []string{"api", "v1", "users", "webhooks", "name"}, "getSigningSecret")) - pattern_UserService_ListUserNotifications_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3, 2, 4}, []string{"api", "v1", "users", "parent", "notifications"}, "")) - pattern_UserService_UpdateUserNotification_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 2, 3, 1, 0, 4, 4, 5, 4}, []string{"api", "v1", "users", "notifications", "notification.name"}, "")) - pattern_UserService_DeleteUserNotification_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 2, 3, 1, 0, 4, 4, 5, 4}, []string{"api", "v1", "users", "notifications", "name"}, "")) + pattern_UserService_ListUsers_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"api", "users"}, "")) + pattern_UserService_GetUser_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"api", "users", "name"}, "")) + pattern_UserService_BatchGetUsers_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"api", "users"}, "batchGet")) + pattern_UserService_CreateUser_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"api", "users"}, "")) + pattern_UserService_UpdateUser_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"api", "users", "user.name"}, "")) + pattern_UserService_DeleteUser_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"api", "users", "name"}, "")) + pattern_UserService_ListUserSettings_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2, 2, 3}, []string{"api", "users", "parent", "settings"}, "")) + pattern_UserService_GetUserSetting_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 4, 4, 5, 3}, []string{"api", "users", "settings", "name"}, "")) + pattern_UserService_UpdateUserSetting_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 4, 4, 5, 3}, []string{"api", "users", "settings", "user_setting.name"}, "")) + pattern_UserService_ListUserStats_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2, 2, 3}, []string{"api", "users", "parent", "stats"}, "")) + pattern_UserService_GetUserStats_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"api", "users", "name"}, "getStats")) + pattern_UserService_ListMemoViews_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2, 2, 3}, []string{"api", "users", "parent", "views"}, "")) + pattern_UserService_GetMemoView_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 4, 4, 5, 3}, []string{"api", "users", "views", "name"}, "")) + pattern_UserService_CreateMemoView_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2, 2, 3}, []string{"api", "users", "parent", "views"}, "")) + pattern_UserService_UpdateMemoView_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 4, 4, 5, 3}, []string{"api", "users", "views", "memo_view.name"}, "")) + pattern_UserService_DeleteMemoView_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 4, 4, 5, 3}, []string{"api", "users", "views", "name"}, "")) + pattern_UserService_ListUserNotifications_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2, 2, 3}, []string{"api", "users", "parent", "notifications"}, "")) + pattern_UserService_UpdateUserNotification_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 4, 4, 5, 3}, []string{"api", "users", "notifications", "notification.name"}, "")) + pattern_UserService_DeleteUserNotification_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 4, 4, 5, 3}, []string{"api", "users", "notifications", "name"}, "")) + pattern_UserService_ListUserWebhooks_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2, 2, 3}, []string{"api", "users", "parent", "webhooks"}, "")) + pattern_UserService_CreateUserWebhook_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2, 2, 3}, []string{"api", "users", "parent", "webhooks"}, "")) + pattern_UserService_UpdateUserWebhook_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 4, 4, 5, 3}, []string{"api", "users", "webhooks", "webhook.name"}, "")) + pattern_UserService_DeleteUserWebhook_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 4, 4, 5, 3}, []string{"api", "users", "webhooks", "name"}, "")) + pattern_UserService_GetUserWebhookSigningSecret_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 4, 4, 5, 3}, []string{"api", "users", "webhooks", "name"}, "getSigningSecret")) + pattern_UserService_ListLinkedIdentities_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2, 2, 3}, []string{"api", "users", "parent", "linkedIdentities"}, "")) + pattern_UserService_GetLinkedIdentity_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 4, 4, 5, 3}, []string{"api", "users", "linkedIdentities", "name"}, "")) + pattern_UserService_CreateLinkedIdentity_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2, 2, 3}, []string{"api", "users", "parent", "linkedIdentities"}, "")) + pattern_UserService_DeleteLinkedIdentity_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 4, 4, 5, 3}, []string{"api", "users", "linkedIdentities", "name"}, "")) + pattern_UserService_ListPersonalAccessTokens_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2, 2, 3}, []string{"api", "users", "parent", "personalAccessTokens"}, "")) + pattern_UserService_CreatePersonalAccessToken_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2, 2, 3}, []string{"api", "users", "parent", "personalAccessTokens"}, "")) + pattern_UserService_DeletePersonalAccessToken_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 4, 4, 5, 3}, []string{"api", "users", "personalAccessTokens", "name"}, "")) + pattern_UserService_ExportMemos_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"api", "users", "name"}, "exportMemos")) + pattern_UserService_ImportMemos_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"api", "users", "name"}, "importMemos")) ) var ( forward_UserService_ListUsers_0 = runtime.ForwardResponseMessage - forward_UserService_BatchGetUsers_0 = runtime.ForwardResponseMessage forward_UserService_GetUser_0 = runtime.ForwardResponseMessage + forward_UserService_BatchGetUsers_0 = runtime.ForwardResponseMessage forward_UserService_CreateUser_0 = runtime.ForwardResponseMessage forward_UserService_UpdateUser_0 = runtime.ForwardResponseMessage forward_UserService_DeleteUser_0 = runtime.ForwardResponseMessage - forward_UserService_ListAllUserStats_0 = runtime.ForwardResponseMessage - forward_UserService_GetUserStats_0 = runtime.ForwardResponseMessage - forward_UserService_ExportMemos_0 = runtime.ForwardResponseMessage - forward_UserService_ImportMemos_0 = runtime.ForwardResponseMessage + forward_UserService_ListUserSettings_0 = runtime.ForwardResponseMessage forward_UserService_GetUserSetting_0 = runtime.ForwardResponseMessage forward_UserService_UpdateUserSetting_0 = runtime.ForwardResponseMessage - forward_UserService_ListUserSettings_0 = runtime.ForwardResponseMessage + forward_UserService_ListUserStats_0 = runtime.ForwardResponseMessage + forward_UserService_GetUserStats_0 = runtime.ForwardResponseMessage forward_UserService_ListMemoViews_0 = runtime.ForwardResponseMessage forward_UserService_GetMemoView_0 = runtime.ForwardResponseMessage forward_UserService_CreateMemoView_0 = runtime.ForwardResponseMessage forward_UserService_UpdateMemoView_0 = runtime.ForwardResponseMessage forward_UserService_DeleteMemoView_0 = runtime.ForwardResponseMessage - forward_UserService_ListLinkedIdentities_0 = runtime.ForwardResponseMessage - forward_UserService_CreateLinkedIdentity_0 = runtime.ForwardResponseMessage - forward_UserService_GetLinkedIdentity_0 = runtime.ForwardResponseMessage - forward_UserService_DeleteLinkedIdentity_0 = runtime.ForwardResponseMessage - forward_UserService_ListPersonalAccessTokens_0 = runtime.ForwardResponseMessage - forward_UserService_CreatePersonalAccessToken_0 = runtime.ForwardResponseMessage - forward_UserService_DeletePersonalAccessToken_0 = runtime.ForwardResponseMessage + forward_UserService_ListUserNotifications_0 = runtime.ForwardResponseMessage + forward_UserService_UpdateUserNotification_0 = runtime.ForwardResponseMessage + forward_UserService_DeleteUserNotification_0 = runtime.ForwardResponseMessage forward_UserService_ListUserWebhooks_0 = runtime.ForwardResponseMessage forward_UserService_CreateUserWebhook_0 = runtime.ForwardResponseMessage forward_UserService_UpdateUserWebhook_0 = runtime.ForwardResponseMessage forward_UserService_DeleteUserWebhook_0 = runtime.ForwardResponseMessage forward_UserService_GetUserWebhookSigningSecret_0 = runtime.ForwardResponseMessage - forward_UserService_ListUserNotifications_0 = runtime.ForwardResponseMessage - forward_UserService_UpdateUserNotification_0 = runtime.ForwardResponseMessage - forward_UserService_DeleteUserNotification_0 = runtime.ForwardResponseMessage + forward_UserService_ListLinkedIdentities_0 = runtime.ForwardResponseMessage + forward_UserService_GetLinkedIdentity_0 = runtime.ForwardResponseMessage + forward_UserService_CreateLinkedIdentity_0 = runtime.ForwardResponseMessage + forward_UserService_DeleteLinkedIdentity_0 = runtime.ForwardResponseMessage + forward_UserService_ListPersonalAccessTokens_0 = runtime.ForwardResponseMessage + forward_UserService_CreatePersonalAccessToken_0 = runtime.ForwardResponseMessage + forward_UserService_DeletePersonalAccessToken_0 = runtime.ForwardResponseMessage + forward_UserService_ExportMemos_0 = runtime.ForwardResponseMessage + forward_UserService_ImportMemos_0 = runtime.ForwardResponseMessage ) diff --git a/proto/gen/api/v1/user_service_grpc.pb.go b/proto/gen/api/user_service_grpc.pb.go similarity index 84% rename from proto/gen/api/v1/user_service_grpc.pb.go rename to proto/gen/api/user_service_grpc.pb.go index a5ef5dd58..28a17f456 100644 --- a/proto/gen/api/v1/user_service_grpc.pb.go +++ b/proto/gen/api/user_service_grpc.pb.go @@ -2,9 +2,9 @@ // versions: // - protoc-gen-go-grpc v1.6.2 // - protoc (unknown) -// source: api/v1/user_service.proto +// source: api/user_service.proto -package apiv1 +package api import ( context "context" @@ -21,127 +21,154 @@ import ( const _ = grpc.SupportPackageIsVersion9 const ( - UserService_ListUsers_FullMethodName = "/memos.api.v1.UserService/ListUsers" - UserService_BatchGetUsers_FullMethodName = "/memos.api.v1.UserService/BatchGetUsers" - UserService_GetUser_FullMethodName = "/memos.api.v1.UserService/GetUser" - UserService_CreateUser_FullMethodName = "/memos.api.v1.UserService/CreateUser" - UserService_UpdateUser_FullMethodName = "/memos.api.v1.UserService/UpdateUser" - UserService_DeleteUser_FullMethodName = "/memos.api.v1.UserService/DeleteUser" - UserService_ListAllUserStats_FullMethodName = "/memos.api.v1.UserService/ListAllUserStats" - UserService_GetUserStats_FullMethodName = "/memos.api.v1.UserService/GetUserStats" - UserService_ExportMemos_FullMethodName = "/memos.api.v1.UserService/ExportMemos" - UserService_ImportMemos_FullMethodName = "/memos.api.v1.UserService/ImportMemos" - UserService_GetUserSetting_FullMethodName = "/memos.api.v1.UserService/GetUserSetting" - UserService_UpdateUserSetting_FullMethodName = "/memos.api.v1.UserService/UpdateUserSetting" - UserService_ListUserSettings_FullMethodName = "/memos.api.v1.UserService/ListUserSettings" - UserService_ListMemoViews_FullMethodName = "/memos.api.v1.UserService/ListMemoViews" - UserService_GetMemoView_FullMethodName = "/memos.api.v1.UserService/GetMemoView" - UserService_CreateMemoView_FullMethodName = "/memos.api.v1.UserService/CreateMemoView" - UserService_UpdateMemoView_FullMethodName = "/memos.api.v1.UserService/UpdateMemoView" - UserService_DeleteMemoView_FullMethodName = "/memos.api.v1.UserService/DeleteMemoView" - UserService_ListLinkedIdentities_FullMethodName = "/memos.api.v1.UserService/ListLinkedIdentities" - UserService_CreateLinkedIdentity_FullMethodName = "/memos.api.v1.UserService/CreateLinkedIdentity" - UserService_GetLinkedIdentity_FullMethodName = "/memos.api.v1.UserService/GetLinkedIdentity" - UserService_DeleteLinkedIdentity_FullMethodName = "/memos.api.v1.UserService/DeleteLinkedIdentity" - UserService_ListPersonalAccessTokens_FullMethodName = "/memos.api.v1.UserService/ListPersonalAccessTokens" - UserService_CreatePersonalAccessToken_FullMethodName = "/memos.api.v1.UserService/CreatePersonalAccessToken" - UserService_DeletePersonalAccessToken_FullMethodName = "/memos.api.v1.UserService/DeletePersonalAccessToken" - UserService_ListUserWebhooks_FullMethodName = "/memos.api.v1.UserService/ListUserWebhooks" - UserService_CreateUserWebhook_FullMethodName = "/memos.api.v1.UserService/CreateUserWebhook" - UserService_UpdateUserWebhook_FullMethodName = "/memos.api.v1.UserService/UpdateUserWebhook" - UserService_DeleteUserWebhook_FullMethodName = "/memos.api.v1.UserService/DeleteUserWebhook" - UserService_GetUserWebhookSigningSecret_FullMethodName = "/memos.api.v1.UserService/GetUserWebhookSigningSecret" - UserService_ListUserNotifications_FullMethodName = "/memos.api.v1.UserService/ListUserNotifications" - UserService_UpdateUserNotification_FullMethodName = "/memos.api.v1.UserService/UpdateUserNotification" - UserService_DeleteUserNotification_FullMethodName = "/memos.api.v1.UserService/DeleteUserNotification" + UserService_ListUsers_FullMethodName = "/memos.api.UserService/ListUsers" + UserService_GetUser_FullMethodName = "/memos.api.UserService/GetUser" + UserService_BatchGetUsers_FullMethodName = "/memos.api.UserService/BatchGetUsers" + UserService_CreateUser_FullMethodName = "/memos.api.UserService/CreateUser" + UserService_UpdateUser_FullMethodName = "/memos.api.UserService/UpdateUser" + UserService_DeleteUser_FullMethodName = "/memos.api.UserService/DeleteUser" + UserService_ListUserSettings_FullMethodName = "/memos.api.UserService/ListUserSettings" + UserService_GetUserSetting_FullMethodName = "/memos.api.UserService/GetUserSetting" + UserService_UpdateUserSetting_FullMethodName = "/memos.api.UserService/UpdateUserSetting" + UserService_ListUserStats_FullMethodName = "/memos.api.UserService/ListUserStats" + UserService_GetUserStats_FullMethodName = "/memos.api.UserService/GetUserStats" + UserService_ListMemoViews_FullMethodName = "/memos.api.UserService/ListMemoViews" + UserService_GetMemoView_FullMethodName = "/memos.api.UserService/GetMemoView" + UserService_CreateMemoView_FullMethodName = "/memos.api.UserService/CreateMemoView" + UserService_UpdateMemoView_FullMethodName = "/memos.api.UserService/UpdateMemoView" + UserService_DeleteMemoView_FullMethodName = "/memos.api.UserService/DeleteMemoView" + UserService_ListUserNotifications_FullMethodName = "/memos.api.UserService/ListUserNotifications" + UserService_UpdateUserNotification_FullMethodName = "/memos.api.UserService/UpdateUserNotification" + UserService_DeleteUserNotification_FullMethodName = "/memos.api.UserService/DeleteUserNotification" + UserService_ListUserWebhooks_FullMethodName = "/memos.api.UserService/ListUserWebhooks" + UserService_CreateUserWebhook_FullMethodName = "/memos.api.UserService/CreateUserWebhook" + UserService_UpdateUserWebhook_FullMethodName = "/memos.api.UserService/UpdateUserWebhook" + UserService_DeleteUserWebhook_FullMethodName = "/memos.api.UserService/DeleteUserWebhook" + UserService_GetUserWebhookSigningSecret_FullMethodName = "/memos.api.UserService/GetUserWebhookSigningSecret" + UserService_ListLinkedIdentities_FullMethodName = "/memos.api.UserService/ListLinkedIdentities" + UserService_GetLinkedIdentity_FullMethodName = "/memos.api.UserService/GetLinkedIdentity" + UserService_CreateLinkedIdentity_FullMethodName = "/memos.api.UserService/CreateLinkedIdentity" + UserService_DeleteLinkedIdentity_FullMethodName = "/memos.api.UserService/DeleteLinkedIdentity" + UserService_ListPersonalAccessTokens_FullMethodName = "/memos.api.UserService/ListPersonalAccessTokens" + UserService_CreatePersonalAccessToken_FullMethodName = "/memos.api.UserService/CreatePersonalAccessToken" + UserService_DeletePersonalAccessToken_FullMethodName = "/memos.api.UserService/DeletePersonalAccessToken" + UserService_ExportMemos_FullMethodName = "/memos.api.UserService/ExportMemos" + UserService_ImportMemos_FullMethodName = "/memos.api.UserService/ImportMemos" ) // UserServiceClient is the client API for UserService service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +// +// UserService manages users and the resources they own: settings, statistics, +// memo views, notifications, webhooks, linked identities, personal access +// tokens, and memo export files. type UserServiceClient interface { - // ListUsers returns a list of users. + // ListUsers lists users in every state. Only admins may call it. ListUsers(ctx context.Context, in *ListUsersRequest, opts ...grpc.CallOption) (*ListUsersResponse, error) - // BatchGetUsers returns active users by usernames. - BatchGetUsers(ctx context.Context, in *BatchGetUsersRequest, opts ...grpc.CallOption) (*BatchGetUsersResponse, error) - // GetUser gets a user by username. - // Format: users/{user} (e.g., users/steven) + // GetUser gets a user by resource name. GetUser(ctx context.Context, in *GetUserRequest, opts ...grpc.CallOption) (*User, error) - // CreateUser creates a new user. + // BatchGetUsers gets active users by username. Usernames that match no + // active user are omitted from the response. + BatchGetUsers(ctx context.Context, in *BatchGetUsersRequest, opts ...grpc.CallOption) (*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(ctx context.Context, in *CreateUserRequest, opts ...grpc.CallOption) (*User, error) - // UpdateUser updates a user. + // UpdateUser updates a user. Users may update themselves; admins may update + // anyone. Changing the password ends the user's other sessions. UpdateUser(ctx context.Context, in *UpdateUserRequest, opts ...grpc.CallOption) (*User, error) - // DeleteUser deletes a user. + // DeleteUser deletes a user. Users may delete themselves; admins may delete + // anyone. A user who belongs to any space cannot be deleted. DeleteUser(ctx context.Context, in *DeleteUserRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) - // ListAllUserStats returns statistics for all users. - ListAllUserStats(ctx context.Context, in *ListAllUserStatsRequest, opts ...grpc.CallOption) (*ListAllUserStatsResponse, error) - // GetUserStats returns statistics for a specific user. + // 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(ctx context.Context, in *ListUserSettingsRequest, opts ...grpc.CallOption) (*ListUserSettingsResponse, error) + // GetUserSetting gets a user setting. Only the user may call it. + GetUserSetting(ctx context.Context, in *GetUserSettingRequest, opts ...grpc.CallOption) (*UserSetting, error) + // UpdateUserSetting updates a user setting. Only the user may call it, and + // only the GENERAL and TAGS settings can be updated. + UpdateUserSetting(ctx context.Context, in *UpdateUserSettingRequest, opts ...grpc.CallOption) (*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(ctx context.Context, in *ListUserStatsRequest, opts ...grpc.CallOption) (*ListUserStatsResponse, error) + // GetUserStats returns memo statistics for one user, counting the user's + // memos that the caller can read. GetUserStats(ctx context.Context, in *GetUserStatsRequest, opts ...grpc.CallOption) (*UserStats, 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(ctx context.Context, in *ListMemoViewsRequest, opts ...grpc.CallOption) (*ListMemoViewsResponse, error) + // GetMemoView gets a memo view. Only the owner may call it. + GetMemoView(ctx context.Context, in *GetMemoViewRequest, opts ...grpc.CallOption) (*MemoView, error) + // CreateMemoView creates a memo view for a user. Only the user may call it. + CreateMemoView(ctx context.Context, in *CreateMemoViewRequest, opts ...grpc.CallOption) (*MemoView, error) + // UpdateMemoView updates a memo view. Only the owner may call it. + UpdateMemoView(ctx context.Context, in *UpdateMemoViewRequest, opts ...grpc.CallOption) (*MemoView, error) + // DeleteMemoView deletes a memo view. Only the owner may call it. + DeleteMemoView(ctx context.Context, in *DeleteMemoViewRequest, opts ...grpc.CallOption) (*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(ctx context.Context, in *ListUserNotificationsRequest, opts ...grpc.CallOption) (*ListUserNotificationsResponse, error) + // UpdateUserNotification updates a notification's status. Only the receiver + // may call it. + UpdateUserNotification(ctx context.Context, in *UpdateUserNotificationRequest, opts ...grpc.CallOption) (*UserNotification, error) + // DeleteUserNotification permanently deletes a notification. Only the + // receiver may call it. + DeleteUserNotification(ctx context.Context, in *DeleteUserNotificationRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) + // ListUserWebhooks lists a user's webhooks. Only the user may call it. + ListUserWebhooks(ctx context.Context, in *ListUserWebhooksRequest, opts ...grpc.CallOption) (*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(ctx context.Context, in *CreateUserWebhookRequest, opts ...grpc.CallOption) (*UserWebhook, error) + // UpdateUserWebhook updates a webhook. Only the owner may call it. + UpdateUserWebhook(ctx context.Context, in *UpdateUserWebhookRequest, opts ...grpc.CallOption) (*UserWebhook, error) + // DeleteUserWebhook deletes a webhook. Only the owner may call it. + DeleteUserWebhook(ctx context.Context, in *DeleteUserWebhookRequest, opts ...grpc.CallOption) (*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(ctx context.Context, in *GetUserWebhookSigningSecretRequest, opts ...grpc.CallOption) (*GetUserWebhookSigningSecretResponse, error) + // ListLinkedIdentities lists the SSO identities linked to a user. The user + // and admins may call it. + ListLinkedIdentities(ctx context.Context, in *ListLinkedIdentitiesRequest, opts ...grpc.CallOption) (*ListLinkedIdentitiesResponse, error) + // GetLinkedIdentity gets an SSO identity linked to a user. The user and + // admins may call it. + GetLinkedIdentity(ctx context.Context, in *GetLinkedIdentityRequest, opts ...grpc.CallOption) (*LinkedIdentity, error) + // CreateLinkedIdentity completes an OAuth flow and links the resulting SSO + // identity to the authenticated user, who must be the parent. + CreateLinkedIdentity(ctx context.Context, in *CreateLinkedIdentityRequest, opts ...grpc.CallOption) (*LinkedIdentity, error) + // DeleteLinkedIdentity unlinks an SSO identity from a user. The user and + // admins may call it. + DeleteLinkedIdentity(ctx context.Context, in *DeleteLinkedIdentityRequest, opts ...grpc.CallOption) (*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(ctx context.Context, in *ListPersonalAccessTokensRequest, opts ...grpc.CallOption) (*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(ctx context.Context, in *CreatePersonalAccessTokenRequest, opts ...grpc.CallOption) (*CreatePersonalAccessTokenResponse, error) + // DeletePersonalAccessToken deletes a personal access token, which stops + // working immediately. Only the owner may call it. + DeletePersonalAccessToken(ctx context.Context, in *DeletePersonalAccessTokenRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) // ExportMemos writes every memo the user created, with comments, archived // memos, and attachment files, as a Memos export file (a ZIP file, see // docs/design/memos-export-format.md). Only the user may export their own // memos. The body is the archive; content_type is its media type. ExportMemos(ctx context.Context, in *ExportMemosRequest, opts ...grpc.CallOption) (*httpbody.HttpBody, 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 + // 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(ctx context.Context, in *ImportMemosRequest, opts ...grpc.CallOption) (*ImportMemosResponse, error) - // GetUserSetting returns the user setting. - GetUserSetting(ctx context.Context, in *GetUserSettingRequest, opts ...grpc.CallOption) (*UserSetting, error) - // UpdateUserSetting updates the user setting. - UpdateUserSetting(ctx context.Context, in *UpdateUserSettingRequest, opts ...grpc.CallOption) (*UserSetting, error) - // ListUserSettings returns a list of user settings. - ListUserSettings(ctx context.Context, in *ListUserSettingsRequest, opts ...grpc.CallOption) (*ListUserSettingsResponse, error) - // ListMemoViews returns a user's memo views. Each view is a named, reusable - // CEL filter (see MemoView.filter); pass its filter string directly to the - // ListMemos `filter` argument. - ListMemoViews(ctx context.Context, in *ListMemoViewsRequest, opts ...grpc.CallOption) (*ListMemoViewsResponse, error) - // GetMemoView gets a memo view by name. - GetMemoView(ctx context.Context, in *GetMemoViewRequest, opts ...grpc.CallOption) (*MemoView, error) - // CreateMemoView creates a new memo view for a user. - CreateMemoView(ctx context.Context, in *CreateMemoViewRequest, opts ...grpc.CallOption) (*MemoView, error) - // UpdateMemoView updates a memo view for a user. - UpdateMemoView(ctx context.Context, in *UpdateMemoViewRequest, opts ...grpc.CallOption) (*MemoView, error) - // DeleteMemoView deletes a memo view for a user. - DeleteMemoView(ctx context.Context, in *DeleteMemoViewRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) - // ListLinkedIdentities returns a list of linked SSO identities for a user. - ListLinkedIdentities(ctx context.Context, in *ListLinkedIdentitiesRequest, opts ...grpc.CallOption) (*ListLinkedIdentitiesResponse, error) - // CreateLinkedIdentity links an SSO identity to the authenticated user. - CreateLinkedIdentity(ctx context.Context, in *CreateLinkedIdentityRequest, opts ...grpc.CallOption) (*LinkedIdentity, error) - // GetLinkedIdentity gets a linked SSO identity for a user. - GetLinkedIdentity(ctx context.Context, in *GetLinkedIdentityRequest, opts ...grpc.CallOption) (*LinkedIdentity, error) - // DeleteLinkedIdentity unlinks an SSO identity from a user. - DeleteLinkedIdentity(ctx context.Context, in *DeleteLinkedIdentityRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) - // ListPersonalAccessTokens returns a list of Personal Access Tokens (PATs) for a user. - // PATs are long-lived tokens for API/script access, distinct from short-lived JWT access tokens. - ListPersonalAccessTokens(ctx context.Context, in *ListPersonalAccessTokensRequest, opts ...grpc.CallOption) (*ListPersonalAccessTokensResponse, error) - // CreatePersonalAccessToken creates a new Personal Access Token for a user. - // The token value is only returned once upon creation. - CreatePersonalAccessToken(ctx context.Context, in *CreatePersonalAccessTokenRequest, opts ...grpc.CallOption) (*CreatePersonalAccessTokenResponse, error) - // DeletePersonalAccessToken deletes a Personal Access Token. - DeletePersonalAccessToken(ctx context.Context, in *DeletePersonalAccessTokenRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) - // ListUserWebhooks returns a list of webhooks for a user. - ListUserWebhooks(ctx context.Context, in *ListUserWebhooksRequest, opts ...grpc.CallOption) (*ListUserWebhooksResponse, error) - // CreateUserWebhook creates a new webhook for a user. - CreateUserWebhook(ctx context.Context, in *CreateUserWebhookRequest, opts ...grpc.CallOption) (*UserWebhook, error) - // UpdateUserWebhook updates an existing webhook for a user. - UpdateUserWebhook(ctx context.Context, in *UpdateUserWebhookRequest, opts ...grpc.CallOption) (*UserWebhook, error) - // DeleteUserWebhook deletes a webhook for a user. - DeleteUserWebhook(ctx context.Context, in *DeleteUserWebhookRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) - // GetUserWebhookSigningSecret returns the signing secret for a webhook. - // The secret is returned only through this explicit, owner-gated call; it is - // never included in List/Create/Update responses. - GetUserWebhookSigningSecret(ctx context.Context, in *GetUserWebhookSigningSecretRequest, opts ...grpc.CallOption) (*GetUserWebhookSigningSecretResponse, error) - // ListUserNotifications lists notifications for a user. - ListUserNotifications(ctx context.Context, in *ListUserNotificationsRequest, opts ...grpc.CallOption) (*ListUserNotificationsResponse, error) - // UpdateUserNotification updates a notification. - UpdateUserNotification(ctx context.Context, in *UpdateUserNotificationRequest, opts ...grpc.CallOption) (*UserNotification, error) - // DeleteUserNotification deletes a notification. - DeleteUserNotification(ctx context.Context, in *DeleteUserNotificationRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) } type userServiceClient struct { @@ -162,20 +189,20 @@ func (c *userServiceClient) ListUsers(ctx context.Context, in *ListUsersRequest, return out, nil } -func (c *userServiceClient) BatchGetUsers(ctx context.Context, in *BatchGetUsersRequest, opts ...grpc.CallOption) (*BatchGetUsersResponse, error) { +func (c *userServiceClient) GetUser(ctx context.Context, in *GetUserRequest, opts ...grpc.CallOption) (*User, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(BatchGetUsersResponse) - err := c.cc.Invoke(ctx, UserService_BatchGetUsers_FullMethodName, in, out, cOpts...) + out := new(User) + err := c.cc.Invoke(ctx, UserService_GetUser_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } -func (c *userServiceClient) GetUser(ctx context.Context, in *GetUserRequest, opts ...grpc.CallOption) (*User, error) { +func (c *userServiceClient) BatchGetUsers(ctx context.Context, in *BatchGetUsersRequest, opts ...grpc.CallOption) (*BatchGetUsersResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(User) - err := c.cc.Invoke(ctx, UserService_GetUser_FullMethodName, in, out, cOpts...) + out := new(BatchGetUsersResponse) + err := c.cc.Invoke(ctx, UserService_BatchGetUsers_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -212,40 +239,10 @@ func (c *userServiceClient) DeleteUser(ctx context.Context, in *DeleteUserReques return out, nil } -func (c *userServiceClient) ListAllUserStats(ctx context.Context, in *ListAllUserStatsRequest, opts ...grpc.CallOption) (*ListAllUserStatsResponse, error) { +func (c *userServiceClient) ListUserSettings(ctx context.Context, in *ListUserSettingsRequest, opts ...grpc.CallOption) (*ListUserSettingsResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(ListAllUserStatsResponse) - err := c.cc.Invoke(ctx, UserService_ListAllUserStats_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *userServiceClient) GetUserStats(ctx context.Context, in *GetUserStatsRequest, opts ...grpc.CallOption) (*UserStats, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(UserStats) - err := c.cc.Invoke(ctx, UserService_GetUserStats_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *userServiceClient) ExportMemos(ctx context.Context, in *ExportMemosRequest, opts ...grpc.CallOption) (*httpbody.HttpBody, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(httpbody.HttpBody) - err := c.cc.Invoke(ctx, UserService_ExportMemos_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *userServiceClient) ImportMemos(ctx context.Context, in *ImportMemosRequest, opts ...grpc.CallOption) (*ImportMemosResponse, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(ImportMemosResponse) - err := c.cc.Invoke(ctx, UserService_ImportMemos_FullMethodName, in, out, cOpts...) + out := new(ListUserSettingsResponse) + err := c.cc.Invoke(ctx, UserService_ListUserSettings_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -272,10 +269,20 @@ func (c *userServiceClient) UpdateUserSetting(ctx context.Context, in *UpdateUse return out, nil } -func (c *userServiceClient) ListUserSettings(ctx context.Context, in *ListUserSettingsRequest, opts ...grpc.CallOption) (*ListUserSettingsResponse, error) { +func (c *userServiceClient) ListUserStats(ctx context.Context, in *ListUserStatsRequest, opts ...grpc.CallOption) (*ListUserStatsResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(ListUserSettingsResponse) - err := c.cc.Invoke(ctx, UserService_ListUserSettings_FullMethodName, in, out, cOpts...) + out := new(ListUserStatsResponse) + err := c.cc.Invoke(ctx, UserService_ListUserStats_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *userServiceClient) GetUserStats(ctx context.Context, in *GetUserStatsRequest, opts ...grpc.CallOption) (*UserStats, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(UserStats) + err := c.cc.Invoke(ctx, UserService_GetUserStats_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -332,70 +339,30 @@ func (c *userServiceClient) DeleteMemoView(ctx context.Context, in *DeleteMemoVi return out, nil } -func (c *userServiceClient) ListLinkedIdentities(ctx context.Context, in *ListLinkedIdentitiesRequest, opts ...grpc.CallOption) (*ListLinkedIdentitiesResponse, error) { +func (c *userServiceClient) ListUserNotifications(ctx context.Context, in *ListUserNotificationsRequest, opts ...grpc.CallOption) (*ListUserNotificationsResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(ListLinkedIdentitiesResponse) - err := c.cc.Invoke(ctx, UserService_ListLinkedIdentities_FullMethodName, in, out, cOpts...) + out := new(ListUserNotificationsResponse) + err := c.cc.Invoke(ctx, UserService_ListUserNotifications_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } -func (c *userServiceClient) CreateLinkedIdentity(ctx context.Context, in *CreateLinkedIdentityRequest, opts ...grpc.CallOption) (*LinkedIdentity, error) { +func (c *userServiceClient) UpdateUserNotification(ctx context.Context, in *UpdateUserNotificationRequest, opts ...grpc.CallOption) (*UserNotification, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(LinkedIdentity) - err := c.cc.Invoke(ctx, UserService_CreateLinkedIdentity_FullMethodName, in, out, cOpts...) + out := new(UserNotification) + err := c.cc.Invoke(ctx, UserService_UpdateUserNotification_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } -func (c *userServiceClient) GetLinkedIdentity(ctx context.Context, in *GetLinkedIdentityRequest, opts ...grpc.CallOption) (*LinkedIdentity, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(LinkedIdentity) - err := c.cc.Invoke(ctx, UserService_GetLinkedIdentity_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *userServiceClient) DeleteLinkedIdentity(ctx context.Context, in *DeleteLinkedIdentityRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { +func (c *userServiceClient) DeleteUserNotification(ctx context.Context, in *DeleteUserNotificationRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(emptypb.Empty) - err := c.cc.Invoke(ctx, UserService_DeleteLinkedIdentity_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *userServiceClient) ListPersonalAccessTokens(ctx context.Context, in *ListPersonalAccessTokensRequest, opts ...grpc.CallOption) (*ListPersonalAccessTokensResponse, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(ListPersonalAccessTokensResponse) - err := c.cc.Invoke(ctx, UserService_ListPersonalAccessTokens_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *userServiceClient) CreatePersonalAccessToken(ctx context.Context, in *CreatePersonalAccessTokenRequest, opts ...grpc.CallOption) (*CreatePersonalAccessTokenResponse, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(CreatePersonalAccessTokenResponse) - err := c.cc.Invoke(ctx, UserService_CreatePersonalAccessToken_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *userServiceClient) DeletePersonalAccessToken(ctx context.Context, in *DeletePersonalAccessTokenRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(emptypb.Empty) - err := c.cc.Invoke(ctx, UserService_DeletePersonalAccessToken_FullMethodName, in, out, cOpts...) + err := c.cc.Invoke(ctx, UserService_DeleteUserNotification_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -452,30 +419,90 @@ func (c *userServiceClient) GetUserWebhookSigningSecret(ctx context.Context, in return out, nil } -func (c *userServiceClient) ListUserNotifications(ctx context.Context, in *ListUserNotificationsRequest, opts ...grpc.CallOption) (*ListUserNotificationsResponse, error) { +func (c *userServiceClient) ListLinkedIdentities(ctx context.Context, in *ListLinkedIdentitiesRequest, opts ...grpc.CallOption) (*ListLinkedIdentitiesResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(ListUserNotificationsResponse) - err := c.cc.Invoke(ctx, UserService_ListUserNotifications_FullMethodName, in, out, cOpts...) + out := new(ListLinkedIdentitiesResponse) + err := c.cc.Invoke(ctx, UserService_ListLinkedIdentities_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } -func (c *userServiceClient) UpdateUserNotification(ctx context.Context, in *UpdateUserNotificationRequest, opts ...grpc.CallOption) (*UserNotification, error) { +func (c *userServiceClient) GetLinkedIdentity(ctx context.Context, in *GetLinkedIdentityRequest, opts ...grpc.CallOption) (*LinkedIdentity, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(UserNotification) - err := c.cc.Invoke(ctx, UserService_UpdateUserNotification_FullMethodName, in, out, cOpts...) + out := new(LinkedIdentity) + err := c.cc.Invoke(ctx, UserService_GetLinkedIdentity_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } -func (c *userServiceClient) DeleteUserNotification(ctx context.Context, in *DeleteUserNotificationRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { +func (c *userServiceClient) CreateLinkedIdentity(ctx context.Context, in *CreateLinkedIdentityRequest, opts ...grpc.CallOption) (*LinkedIdentity, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(LinkedIdentity) + err := c.cc.Invoke(ctx, UserService_CreateLinkedIdentity_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *userServiceClient) DeleteLinkedIdentity(ctx context.Context, in *DeleteLinkedIdentityRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(emptypb.Empty) - err := c.cc.Invoke(ctx, UserService_DeleteUserNotification_FullMethodName, in, out, cOpts...) + err := c.cc.Invoke(ctx, UserService_DeleteLinkedIdentity_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *userServiceClient) ListPersonalAccessTokens(ctx context.Context, in *ListPersonalAccessTokensRequest, opts ...grpc.CallOption) (*ListPersonalAccessTokensResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ListPersonalAccessTokensResponse) + err := c.cc.Invoke(ctx, UserService_ListPersonalAccessTokens_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *userServiceClient) CreatePersonalAccessToken(ctx context.Context, in *CreatePersonalAccessTokenRequest, opts ...grpc.CallOption) (*CreatePersonalAccessTokenResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(CreatePersonalAccessTokenResponse) + err := c.cc.Invoke(ctx, UserService_CreatePersonalAccessToken_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *userServiceClient) DeletePersonalAccessToken(ctx context.Context, in *DeletePersonalAccessTokenRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(emptypb.Empty) + err := c.cc.Invoke(ctx, UserService_DeletePersonalAccessToken_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *userServiceClient) ExportMemos(ctx context.Context, in *ExportMemosRequest, opts ...grpc.CallOption) (*httpbody.HttpBody, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(httpbody.HttpBody) + err := c.cc.Invoke(ctx, UserService_ExportMemos_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *userServiceClient) ImportMemos(ctx context.Context, in *ImportMemosRequest, opts ...grpc.CallOption) (*ImportMemosResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ImportMemosResponse) + err := c.cc.Invoke(ctx, UserService_ImportMemos_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -485,89 +512,116 @@ func (c *userServiceClient) DeleteUserNotification(ctx context.Context, in *Dele // UserServiceServer is the server API for UserService service. // All implementations must embed UnimplementedUserServiceServer // for forward compatibility. +// +// UserService manages users and the resources they own: settings, statistics, +// memo views, notifications, webhooks, linked identities, personal access +// tokens, and memo export files. type UserServiceServer interface { - // ListUsers returns a list of users. + // ListUsers lists users in every state. Only admins may call it. ListUsers(context.Context, *ListUsersRequest) (*ListUsersResponse, error) - // BatchGetUsers returns active users by usernames. - BatchGetUsers(context.Context, *BatchGetUsersRequest) (*BatchGetUsersResponse, error) - // GetUser gets a user by username. - // Format: users/{user} (e.g., users/steven) + // GetUser gets a user by resource name. GetUser(context.Context, *GetUserRequest) (*User, error) - // CreateUser creates a new user. + // BatchGetUsers gets active users by username. Usernames that match no + // active user are omitted from the response. + BatchGetUsers(context.Context, *BatchGetUsersRequest) (*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, *CreateUserRequest) (*User, error) - // UpdateUser updates a user. + // UpdateUser updates a user. Users may update themselves; admins may update + // anyone. Changing the password ends the user's other sessions. UpdateUser(context.Context, *UpdateUserRequest) (*User, error) - // DeleteUser deletes a user. + // 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, *DeleteUserRequest) (*emptypb.Empty, error) - // ListAllUserStats returns statistics for all users. - ListAllUserStats(context.Context, *ListAllUserStatsRequest) (*ListAllUserStatsResponse, error) - // GetUserStats returns statistics for a specific user. + // 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, *ListUserSettingsRequest) (*ListUserSettingsResponse, error) + // GetUserSetting gets a user setting. Only the user may call it. + GetUserSetting(context.Context, *GetUserSettingRequest) (*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, *UpdateUserSettingRequest) (*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, *ListUserStatsRequest) (*ListUserStatsResponse, error) + // GetUserStats returns memo statistics for one user, counting the user's + // memos that the caller can read. GetUserStats(context.Context, *GetUserStatsRequest) (*UserStats, 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, *ListMemoViewsRequest) (*ListMemoViewsResponse, error) + // GetMemoView gets a memo view. Only the owner may call it. + GetMemoView(context.Context, *GetMemoViewRequest) (*MemoView, error) + // CreateMemoView creates a memo view for a user. Only the user may call it. + CreateMemoView(context.Context, *CreateMemoViewRequest) (*MemoView, error) + // UpdateMemoView updates a memo view. Only the owner may call it. + UpdateMemoView(context.Context, *UpdateMemoViewRequest) (*MemoView, error) + // DeleteMemoView deletes a memo view. Only the owner may call it. + DeleteMemoView(context.Context, *DeleteMemoViewRequest) (*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, *ListUserNotificationsRequest) (*ListUserNotificationsResponse, error) + // UpdateUserNotification updates a notification's status. Only the receiver + // may call it. + UpdateUserNotification(context.Context, *UpdateUserNotificationRequest) (*UserNotification, error) + // DeleteUserNotification permanently deletes a notification. Only the + // receiver may call it. + DeleteUserNotification(context.Context, *DeleteUserNotificationRequest) (*emptypb.Empty, error) + // ListUserWebhooks lists a user's webhooks. Only the user may call it. + ListUserWebhooks(context.Context, *ListUserWebhooksRequest) (*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, *CreateUserWebhookRequest) (*UserWebhook, error) + // UpdateUserWebhook updates a webhook. Only the owner may call it. + UpdateUserWebhook(context.Context, *UpdateUserWebhookRequest) (*UserWebhook, error) + // DeleteUserWebhook deletes a webhook. Only the owner may call it. + DeleteUserWebhook(context.Context, *DeleteUserWebhookRequest) (*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, *GetUserWebhookSigningSecretRequest) (*GetUserWebhookSigningSecretResponse, error) + // ListLinkedIdentities lists the SSO identities linked to a user. The user + // and admins may call it. + ListLinkedIdentities(context.Context, *ListLinkedIdentitiesRequest) (*ListLinkedIdentitiesResponse, error) + // GetLinkedIdentity gets an SSO identity linked to a user. The user and + // admins may call it. + GetLinkedIdentity(context.Context, *GetLinkedIdentityRequest) (*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, *CreateLinkedIdentityRequest) (*LinkedIdentity, error) + // DeleteLinkedIdentity unlinks an SSO identity from a user. The user and + // admins may call it. + DeleteLinkedIdentity(context.Context, *DeleteLinkedIdentityRequest) (*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, *ListPersonalAccessTokensRequest) (*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, *CreatePersonalAccessTokenRequest) (*CreatePersonalAccessTokenResponse, error) + // DeletePersonalAccessToken deletes a personal access token, which stops + // working immediately. Only the owner may call it. + DeletePersonalAccessToken(context.Context, *DeletePersonalAccessTokenRequest) (*emptypb.Empty, error) // ExportMemos writes every memo the user created, with comments, archived // memos, and attachment files, as a Memos export file (a ZIP file, see // docs/design/memos-export-format.md). Only the user may export their own // memos. The body is the archive; content_type is its media type. ExportMemos(context.Context, *ExportMemosRequest) (*httpbody.HttpBody, 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 + // 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, *ImportMemosRequest) (*ImportMemosResponse, error) - // GetUserSetting returns the user setting. - GetUserSetting(context.Context, *GetUserSettingRequest) (*UserSetting, error) - // UpdateUserSetting updates the user setting. - UpdateUserSetting(context.Context, *UpdateUserSettingRequest) (*UserSetting, error) - // ListUserSettings returns a list of user settings. - ListUserSettings(context.Context, *ListUserSettingsRequest) (*ListUserSettingsResponse, error) - // ListMemoViews returns a user's memo views. Each view is a named, reusable - // CEL filter (see MemoView.filter); pass its filter string directly to the - // ListMemos `filter` argument. - ListMemoViews(context.Context, *ListMemoViewsRequest) (*ListMemoViewsResponse, error) - // GetMemoView gets a memo view by name. - GetMemoView(context.Context, *GetMemoViewRequest) (*MemoView, error) - // CreateMemoView creates a new memo view for a user. - CreateMemoView(context.Context, *CreateMemoViewRequest) (*MemoView, error) - // UpdateMemoView updates a memo view for a user. - UpdateMemoView(context.Context, *UpdateMemoViewRequest) (*MemoView, error) - // DeleteMemoView deletes a memo view for a user. - DeleteMemoView(context.Context, *DeleteMemoViewRequest) (*emptypb.Empty, error) - // ListLinkedIdentities returns a list of linked SSO identities for a user. - ListLinkedIdentities(context.Context, *ListLinkedIdentitiesRequest) (*ListLinkedIdentitiesResponse, error) - // CreateLinkedIdentity links an SSO identity to the authenticated user. - CreateLinkedIdentity(context.Context, *CreateLinkedIdentityRequest) (*LinkedIdentity, error) - // GetLinkedIdentity gets a linked SSO identity for a user. - GetLinkedIdentity(context.Context, *GetLinkedIdentityRequest) (*LinkedIdentity, error) - // DeleteLinkedIdentity unlinks an SSO identity from a user. - DeleteLinkedIdentity(context.Context, *DeleteLinkedIdentityRequest) (*emptypb.Empty, error) - // ListPersonalAccessTokens returns a list of Personal Access Tokens (PATs) for a user. - // PATs are long-lived tokens for API/script access, distinct from short-lived JWT access tokens. - ListPersonalAccessTokens(context.Context, *ListPersonalAccessTokensRequest) (*ListPersonalAccessTokensResponse, error) - // CreatePersonalAccessToken creates a new Personal Access Token for a user. - // The token value is only returned once upon creation. - CreatePersonalAccessToken(context.Context, *CreatePersonalAccessTokenRequest) (*CreatePersonalAccessTokenResponse, error) - // DeletePersonalAccessToken deletes a Personal Access Token. - DeletePersonalAccessToken(context.Context, *DeletePersonalAccessTokenRequest) (*emptypb.Empty, error) - // ListUserWebhooks returns a list of webhooks for a user. - ListUserWebhooks(context.Context, *ListUserWebhooksRequest) (*ListUserWebhooksResponse, error) - // CreateUserWebhook creates a new webhook for a user. - CreateUserWebhook(context.Context, *CreateUserWebhookRequest) (*UserWebhook, error) - // UpdateUserWebhook updates an existing webhook for a user. - UpdateUserWebhook(context.Context, *UpdateUserWebhookRequest) (*UserWebhook, error) - // DeleteUserWebhook deletes a webhook for a user. - DeleteUserWebhook(context.Context, *DeleteUserWebhookRequest) (*emptypb.Empty, error) - // GetUserWebhookSigningSecret returns the signing secret for a webhook. - // The secret is returned only through this explicit, owner-gated call; it is - // never included in List/Create/Update responses. - GetUserWebhookSigningSecret(context.Context, *GetUserWebhookSigningSecretRequest) (*GetUserWebhookSigningSecretResponse, error) - // ListUserNotifications lists notifications for a user. - ListUserNotifications(context.Context, *ListUserNotificationsRequest) (*ListUserNotificationsResponse, error) - // UpdateUserNotification updates a notification. - UpdateUserNotification(context.Context, *UpdateUserNotificationRequest) (*UserNotification, error) - // DeleteUserNotification deletes a notification. - DeleteUserNotification(context.Context, *DeleteUserNotificationRequest) (*emptypb.Empty, error) mustEmbedUnimplementedUserServiceServer() } @@ -581,12 +635,12 @@ type UnimplementedUserServiceServer struct{} func (UnimplementedUserServiceServer) ListUsers(context.Context, *ListUsersRequest) (*ListUsersResponse, error) { return nil, status.Error(codes.Unimplemented, "method ListUsers not implemented") } -func (UnimplementedUserServiceServer) BatchGetUsers(context.Context, *BatchGetUsersRequest) (*BatchGetUsersResponse, error) { - return nil, status.Error(codes.Unimplemented, "method BatchGetUsers not implemented") -} func (UnimplementedUserServiceServer) GetUser(context.Context, *GetUserRequest) (*User, error) { return nil, status.Error(codes.Unimplemented, "method GetUser not implemented") } +func (UnimplementedUserServiceServer) BatchGetUsers(context.Context, *BatchGetUsersRequest) (*BatchGetUsersResponse, error) { + return nil, status.Error(codes.Unimplemented, "method BatchGetUsers not implemented") +} func (UnimplementedUserServiceServer) CreateUser(context.Context, *CreateUserRequest) (*User, error) { return nil, status.Error(codes.Unimplemented, "method CreateUser not implemented") } @@ -596,17 +650,8 @@ func (UnimplementedUserServiceServer) UpdateUser(context.Context, *UpdateUserReq func (UnimplementedUserServiceServer) DeleteUser(context.Context, *DeleteUserRequest) (*emptypb.Empty, error) { return nil, status.Error(codes.Unimplemented, "method DeleteUser not implemented") } -func (UnimplementedUserServiceServer) ListAllUserStats(context.Context, *ListAllUserStatsRequest) (*ListAllUserStatsResponse, error) { - return nil, status.Error(codes.Unimplemented, "method ListAllUserStats not implemented") -} -func (UnimplementedUserServiceServer) GetUserStats(context.Context, *GetUserStatsRequest) (*UserStats, error) { - return nil, status.Error(codes.Unimplemented, "method GetUserStats not implemented") -} -func (UnimplementedUserServiceServer) ExportMemos(context.Context, *ExportMemosRequest) (*httpbody.HttpBody, error) { - return nil, status.Error(codes.Unimplemented, "method ExportMemos not implemented") -} -func (UnimplementedUserServiceServer) ImportMemos(context.Context, *ImportMemosRequest) (*ImportMemosResponse, error) { - return nil, status.Error(codes.Unimplemented, "method ImportMemos not implemented") +func (UnimplementedUserServiceServer) ListUserSettings(context.Context, *ListUserSettingsRequest) (*ListUserSettingsResponse, error) { + return nil, status.Error(codes.Unimplemented, "method ListUserSettings not implemented") } func (UnimplementedUserServiceServer) GetUserSetting(context.Context, *GetUserSettingRequest) (*UserSetting, error) { return nil, status.Error(codes.Unimplemented, "method GetUserSetting not implemented") @@ -614,8 +659,11 @@ func (UnimplementedUserServiceServer) GetUserSetting(context.Context, *GetUserSe func (UnimplementedUserServiceServer) UpdateUserSetting(context.Context, *UpdateUserSettingRequest) (*UserSetting, error) { return nil, status.Error(codes.Unimplemented, "method UpdateUserSetting not implemented") } -func (UnimplementedUserServiceServer) ListUserSettings(context.Context, *ListUserSettingsRequest) (*ListUserSettingsResponse, error) { - return nil, status.Error(codes.Unimplemented, "method ListUserSettings not implemented") +func (UnimplementedUserServiceServer) ListUserStats(context.Context, *ListUserStatsRequest) (*ListUserStatsResponse, error) { + return nil, status.Error(codes.Unimplemented, "method ListUserStats not implemented") +} +func (UnimplementedUserServiceServer) GetUserStats(context.Context, *GetUserStatsRequest) (*UserStats, error) { + return nil, status.Error(codes.Unimplemented, "method GetUserStats not implemented") } func (UnimplementedUserServiceServer) ListMemoViews(context.Context, *ListMemoViewsRequest) (*ListMemoViewsResponse, error) { return nil, status.Error(codes.Unimplemented, "method ListMemoViews not implemented") @@ -632,26 +680,14 @@ func (UnimplementedUserServiceServer) UpdateMemoView(context.Context, *UpdateMem func (UnimplementedUserServiceServer) DeleteMemoView(context.Context, *DeleteMemoViewRequest) (*emptypb.Empty, error) { return nil, status.Error(codes.Unimplemented, "method DeleteMemoView not implemented") } -func (UnimplementedUserServiceServer) ListLinkedIdentities(context.Context, *ListLinkedIdentitiesRequest) (*ListLinkedIdentitiesResponse, error) { - return nil, status.Error(codes.Unimplemented, "method ListLinkedIdentities not implemented") +func (UnimplementedUserServiceServer) ListUserNotifications(context.Context, *ListUserNotificationsRequest) (*ListUserNotificationsResponse, error) { + return nil, status.Error(codes.Unimplemented, "method ListUserNotifications not implemented") } -func (UnimplementedUserServiceServer) CreateLinkedIdentity(context.Context, *CreateLinkedIdentityRequest) (*LinkedIdentity, error) { - return nil, status.Error(codes.Unimplemented, "method CreateLinkedIdentity not implemented") +func (UnimplementedUserServiceServer) UpdateUserNotification(context.Context, *UpdateUserNotificationRequest) (*UserNotification, error) { + return nil, status.Error(codes.Unimplemented, "method UpdateUserNotification not implemented") } -func (UnimplementedUserServiceServer) GetLinkedIdentity(context.Context, *GetLinkedIdentityRequest) (*LinkedIdentity, error) { - return nil, status.Error(codes.Unimplemented, "method GetLinkedIdentity not implemented") -} -func (UnimplementedUserServiceServer) DeleteLinkedIdentity(context.Context, *DeleteLinkedIdentityRequest) (*emptypb.Empty, error) { - return nil, status.Error(codes.Unimplemented, "method DeleteLinkedIdentity not implemented") -} -func (UnimplementedUserServiceServer) ListPersonalAccessTokens(context.Context, *ListPersonalAccessTokensRequest) (*ListPersonalAccessTokensResponse, error) { - return nil, status.Error(codes.Unimplemented, "method ListPersonalAccessTokens not implemented") -} -func (UnimplementedUserServiceServer) CreatePersonalAccessToken(context.Context, *CreatePersonalAccessTokenRequest) (*CreatePersonalAccessTokenResponse, error) { - return nil, status.Error(codes.Unimplemented, "method CreatePersonalAccessToken not implemented") -} -func (UnimplementedUserServiceServer) DeletePersonalAccessToken(context.Context, *DeletePersonalAccessTokenRequest) (*emptypb.Empty, error) { - return nil, status.Error(codes.Unimplemented, "method DeletePersonalAccessToken not implemented") +func (UnimplementedUserServiceServer) DeleteUserNotification(context.Context, *DeleteUserNotificationRequest) (*emptypb.Empty, error) { + return nil, status.Error(codes.Unimplemented, "method DeleteUserNotification not implemented") } func (UnimplementedUserServiceServer) ListUserWebhooks(context.Context, *ListUserWebhooksRequest) (*ListUserWebhooksResponse, error) { return nil, status.Error(codes.Unimplemented, "method ListUserWebhooks not implemented") @@ -668,14 +704,32 @@ func (UnimplementedUserServiceServer) DeleteUserWebhook(context.Context, *Delete func (UnimplementedUserServiceServer) GetUserWebhookSigningSecret(context.Context, *GetUserWebhookSigningSecretRequest) (*GetUserWebhookSigningSecretResponse, error) { return nil, status.Error(codes.Unimplemented, "method GetUserWebhookSigningSecret not implemented") } -func (UnimplementedUserServiceServer) ListUserNotifications(context.Context, *ListUserNotificationsRequest) (*ListUserNotificationsResponse, error) { - return nil, status.Error(codes.Unimplemented, "method ListUserNotifications not implemented") +func (UnimplementedUserServiceServer) ListLinkedIdentities(context.Context, *ListLinkedIdentitiesRequest) (*ListLinkedIdentitiesResponse, error) { + return nil, status.Error(codes.Unimplemented, "method ListLinkedIdentities not implemented") } -func (UnimplementedUserServiceServer) UpdateUserNotification(context.Context, *UpdateUserNotificationRequest) (*UserNotification, error) { - return nil, status.Error(codes.Unimplemented, "method UpdateUserNotification not implemented") +func (UnimplementedUserServiceServer) GetLinkedIdentity(context.Context, *GetLinkedIdentityRequest) (*LinkedIdentity, error) { + return nil, status.Error(codes.Unimplemented, "method GetLinkedIdentity not implemented") } -func (UnimplementedUserServiceServer) DeleteUserNotification(context.Context, *DeleteUserNotificationRequest) (*emptypb.Empty, error) { - return nil, status.Error(codes.Unimplemented, "method DeleteUserNotification not implemented") +func (UnimplementedUserServiceServer) CreateLinkedIdentity(context.Context, *CreateLinkedIdentityRequest) (*LinkedIdentity, error) { + return nil, status.Error(codes.Unimplemented, "method CreateLinkedIdentity not implemented") +} +func (UnimplementedUserServiceServer) DeleteLinkedIdentity(context.Context, *DeleteLinkedIdentityRequest) (*emptypb.Empty, error) { + return nil, status.Error(codes.Unimplemented, "method DeleteLinkedIdentity not implemented") +} +func (UnimplementedUserServiceServer) ListPersonalAccessTokens(context.Context, *ListPersonalAccessTokensRequest) (*ListPersonalAccessTokensResponse, error) { + return nil, status.Error(codes.Unimplemented, "method ListPersonalAccessTokens not implemented") +} +func (UnimplementedUserServiceServer) CreatePersonalAccessToken(context.Context, *CreatePersonalAccessTokenRequest) (*CreatePersonalAccessTokenResponse, error) { + return nil, status.Error(codes.Unimplemented, "method CreatePersonalAccessToken not implemented") +} +func (UnimplementedUserServiceServer) DeletePersonalAccessToken(context.Context, *DeletePersonalAccessTokenRequest) (*emptypb.Empty, error) { + return nil, status.Error(codes.Unimplemented, "method DeletePersonalAccessToken not implemented") +} +func (UnimplementedUserServiceServer) ExportMemos(context.Context, *ExportMemosRequest) (*httpbody.HttpBody, error) { + return nil, status.Error(codes.Unimplemented, "method ExportMemos not implemented") +} +func (UnimplementedUserServiceServer) ImportMemos(context.Context, *ImportMemosRequest) (*ImportMemosResponse, error) { + return nil, status.Error(codes.Unimplemented, "method ImportMemos not implemented") } func (UnimplementedUserServiceServer) mustEmbedUnimplementedUserServiceServer() {} func (UnimplementedUserServiceServer) testEmbeddedByValue() {} @@ -716,24 +770,6 @@ func _UserService_ListUsers_Handler(srv interface{}, ctx context.Context, dec fu return interceptor(ctx, in, info, handler) } -func _UserService_BatchGetUsers_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(BatchGetUsersRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(UserServiceServer).BatchGetUsers(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: UserService_BatchGetUsers_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(UserServiceServer).BatchGetUsers(ctx, req.(*BatchGetUsersRequest)) - } - return interceptor(ctx, in, info, handler) -} - func _UserService_GetUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(GetUserRequest) if err := dec(in); err != nil { @@ -752,6 +788,24 @@ func _UserService_GetUser_Handler(srv interface{}, ctx context.Context, dec func return interceptor(ctx, in, info, handler) } +func _UserService_BatchGetUsers_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(BatchGetUsersRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UserServiceServer).BatchGetUsers(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: UserService_BatchGetUsers_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UserServiceServer).BatchGetUsers(ctx, req.(*BatchGetUsersRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _UserService_CreateUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(CreateUserRequest) if err := dec(in); err != nil { @@ -806,74 +860,20 @@ func _UserService_DeleteUser_Handler(srv interface{}, ctx context.Context, dec f return interceptor(ctx, in, info, handler) } -func _UserService_ListAllUserStats_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ListAllUserStatsRequest) +func _UserService_ListUserSettings_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListUserSettingsRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(UserServiceServer).ListAllUserStats(ctx, in) + return srv.(UserServiceServer).ListUserSettings(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: UserService_ListAllUserStats_FullMethodName, + FullMethod: UserService_ListUserSettings_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(UserServiceServer).ListAllUserStats(ctx, req.(*ListAllUserStatsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _UserService_GetUserStats_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetUserStatsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(UserServiceServer).GetUserStats(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: UserService_GetUserStats_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(UserServiceServer).GetUserStats(ctx, req.(*GetUserStatsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _UserService_ExportMemos_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ExportMemosRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(UserServiceServer).ExportMemos(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: UserService_ExportMemos_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(UserServiceServer).ExportMemos(ctx, req.(*ExportMemosRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _UserService_ImportMemos_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ImportMemosRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(UserServiceServer).ImportMemos(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: UserService_ImportMemos_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(UserServiceServer).ImportMemos(ctx, req.(*ImportMemosRequest)) + return srv.(UserServiceServer).ListUserSettings(ctx, req.(*ListUserSettingsRequest)) } return interceptor(ctx, in, info, handler) } @@ -914,20 +914,38 @@ func _UserService_UpdateUserSetting_Handler(srv interface{}, ctx context.Context return interceptor(ctx, in, info, handler) } -func _UserService_ListUserSettings_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ListUserSettingsRequest) +func _UserService_ListUserStats_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListUserStatsRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(UserServiceServer).ListUserSettings(ctx, in) + return srv.(UserServiceServer).ListUserStats(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: UserService_ListUserSettings_FullMethodName, + FullMethod: UserService_ListUserStats_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(UserServiceServer).ListUserSettings(ctx, req.(*ListUserSettingsRequest)) + return srv.(UserServiceServer).ListUserStats(ctx, req.(*ListUserStatsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _UserService_GetUserStats_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetUserStatsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UserServiceServer).GetUserStats(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: UserService_GetUserStats_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UserServiceServer).GetUserStats(ctx, req.(*GetUserStatsRequest)) } return interceptor(ctx, in, info, handler) } @@ -1022,128 +1040,56 @@ func _UserService_DeleteMemoView_Handler(srv interface{}, ctx context.Context, d return interceptor(ctx, in, info, handler) } -func _UserService_ListLinkedIdentities_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ListLinkedIdentitiesRequest) +func _UserService_ListUserNotifications_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListUserNotificationsRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(UserServiceServer).ListLinkedIdentities(ctx, in) + return srv.(UserServiceServer).ListUserNotifications(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: UserService_ListLinkedIdentities_FullMethodName, + FullMethod: UserService_ListUserNotifications_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(UserServiceServer).ListLinkedIdentities(ctx, req.(*ListLinkedIdentitiesRequest)) + return srv.(UserServiceServer).ListUserNotifications(ctx, req.(*ListUserNotificationsRequest)) } return interceptor(ctx, in, info, handler) } -func _UserService_CreateLinkedIdentity_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CreateLinkedIdentityRequest) +func _UserService_UpdateUserNotification_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateUserNotificationRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(UserServiceServer).CreateLinkedIdentity(ctx, in) + return srv.(UserServiceServer).UpdateUserNotification(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: UserService_CreateLinkedIdentity_FullMethodName, + FullMethod: UserService_UpdateUserNotification_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(UserServiceServer).CreateLinkedIdentity(ctx, req.(*CreateLinkedIdentityRequest)) + return srv.(UserServiceServer).UpdateUserNotification(ctx, req.(*UpdateUserNotificationRequest)) } return interceptor(ctx, in, info, handler) } -func _UserService_GetLinkedIdentity_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetLinkedIdentityRequest) +func _UserService_DeleteUserNotification_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteUserNotificationRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(UserServiceServer).GetLinkedIdentity(ctx, in) + return srv.(UserServiceServer).DeleteUserNotification(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: UserService_GetLinkedIdentity_FullMethodName, + FullMethod: UserService_DeleteUserNotification_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(UserServiceServer).GetLinkedIdentity(ctx, req.(*GetLinkedIdentityRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _UserService_DeleteLinkedIdentity_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(DeleteLinkedIdentityRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(UserServiceServer).DeleteLinkedIdentity(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: UserService_DeleteLinkedIdentity_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(UserServiceServer).DeleteLinkedIdentity(ctx, req.(*DeleteLinkedIdentityRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _UserService_ListPersonalAccessTokens_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ListPersonalAccessTokensRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(UserServiceServer).ListPersonalAccessTokens(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: UserService_ListPersonalAccessTokens_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(UserServiceServer).ListPersonalAccessTokens(ctx, req.(*ListPersonalAccessTokensRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _UserService_CreatePersonalAccessToken_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CreatePersonalAccessTokenRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(UserServiceServer).CreatePersonalAccessToken(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: UserService_CreatePersonalAccessToken_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(UserServiceServer).CreatePersonalAccessToken(ctx, req.(*CreatePersonalAccessTokenRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _UserService_DeletePersonalAccessToken_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(DeletePersonalAccessTokenRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(UserServiceServer).DeletePersonalAccessToken(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: UserService_DeletePersonalAccessToken_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(UserServiceServer).DeletePersonalAccessToken(ctx, req.(*DeletePersonalAccessTokenRequest)) + return srv.(UserServiceServer).DeleteUserNotification(ctx, req.(*DeleteUserNotificationRequest)) } return interceptor(ctx, in, info, handler) } @@ -1238,56 +1184,164 @@ func _UserService_GetUserWebhookSigningSecret_Handler(srv interface{}, ctx conte return interceptor(ctx, in, info, handler) } -func _UserService_ListUserNotifications_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ListUserNotificationsRequest) +func _UserService_ListLinkedIdentities_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListLinkedIdentitiesRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(UserServiceServer).ListUserNotifications(ctx, in) + return srv.(UserServiceServer).ListLinkedIdentities(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: UserService_ListUserNotifications_FullMethodName, + FullMethod: UserService_ListLinkedIdentities_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(UserServiceServer).ListUserNotifications(ctx, req.(*ListUserNotificationsRequest)) + return srv.(UserServiceServer).ListLinkedIdentities(ctx, req.(*ListLinkedIdentitiesRequest)) } return interceptor(ctx, in, info, handler) } -func _UserService_UpdateUserNotification_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(UpdateUserNotificationRequest) +func _UserService_GetLinkedIdentity_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetLinkedIdentityRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(UserServiceServer).UpdateUserNotification(ctx, in) + return srv.(UserServiceServer).GetLinkedIdentity(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: UserService_UpdateUserNotification_FullMethodName, + FullMethod: UserService_GetLinkedIdentity_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(UserServiceServer).UpdateUserNotification(ctx, req.(*UpdateUserNotificationRequest)) + return srv.(UserServiceServer).GetLinkedIdentity(ctx, req.(*GetLinkedIdentityRequest)) } return interceptor(ctx, in, info, handler) } -func _UserService_DeleteUserNotification_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(DeleteUserNotificationRequest) +func _UserService_CreateLinkedIdentity_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateLinkedIdentityRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(UserServiceServer).DeleteUserNotification(ctx, in) + return srv.(UserServiceServer).CreateLinkedIdentity(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: UserService_DeleteUserNotification_FullMethodName, + FullMethod: UserService_CreateLinkedIdentity_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(UserServiceServer).DeleteUserNotification(ctx, req.(*DeleteUserNotificationRequest)) + return srv.(UserServiceServer).CreateLinkedIdentity(ctx, req.(*CreateLinkedIdentityRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _UserService_DeleteLinkedIdentity_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteLinkedIdentityRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UserServiceServer).DeleteLinkedIdentity(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: UserService_DeleteLinkedIdentity_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UserServiceServer).DeleteLinkedIdentity(ctx, req.(*DeleteLinkedIdentityRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _UserService_ListPersonalAccessTokens_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListPersonalAccessTokensRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UserServiceServer).ListPersonalAccessTokens(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: UserService_ListPersonalAccessTokens_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UserServiceServer).ListPersonalAccessTokens(ctx, req.(*ListPersonalAccessTokensRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _UserService_CreatePersonalAccessToken_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreatePersonalAccessTokenRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UserServiceServer).CreatePersonalAccessToken(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: UserService_CreatePersonalAccessToken_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UserServiceServer).CreatePersonalAccessToken(ctx, req.(*CreatePersonalAccessTokenRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _UserService_DeletePersonalAccessToken_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeletePersonalAccessTokenRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UserServiceServer).DeletePersonalAccessToken(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: UserService_DeletePersonalAccessToken_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UserServiceServer).DeletePersonalAccessToken(ctx, req.(*DeletePersonalAccessTokenRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _UserService_ExportMemos_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ExportMemosRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UserServiceServer).ExportMemos(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: UserService_ExportMemos_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UserServiceServer).ExportMemos(ctx, req.(*ExportMemosRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _UserService_ImportMemos_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ImportMemosRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UserServiceServer).ImportMemos(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: UserService_ImportMemos_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UserServiceServer).ImportMemos(ctx, req.(*ImportMemosRequest)) } return interceptor(ctx, in, info, handler) } @@ -1296,21 +1350,21 @@ func _UserService_DeleteUserNotification_Handler(srv interface{}, ctx context.Co // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) var UserService_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "memos.api.v1.UserService", + ServiceName: "memos.api.UserService", HandlerType: (*UserServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "ListUsers", Handler: _UserService_ListUsers_Handler, }, - { - MethodName: "BatchGetUsers", - Handler: _UserService_BatchGetUsers_Handler, - }, { MethodName: "GetUser", Handler: _UserService_GetUser_Handler, }, + { + MethodName: "BatchGetUsers", + Handler: _UserService_BatchGetUsers_Handler, + }, { MethodName: "CreateUser", Handler: _UserService_CreateUser_Handler, @@ -1324,20 +1378,8 @@ var UserService_ServiceDesc = grpc.ServiceDesc{ Handler: _UserService_DeleteUser_Handler, }, { - MethodName: "ListAllUserStats", - Handler: _UserService_ListAllUserStats_Handler, - }, - { - MethodName: "GetUserStats", - Handler: _UserService_GetUserStats_Handler, - }, - { - MethodName: "ExportMemos", - Handler: _UserService_ExportMemos_Handler, - }, - { - MethodName: "ImportMemos", - Handler: _UserService_ImportMemos_Handler, + MethodName: "ListUserSettings", + Handler: _UserService_ListUserSettings_Handler, }, { MethodName: "GetUserSetting", @@ -1348,8 +1390,12 @@ var UserService_ServiceDesc = grpc.ServiceDesc{ Handler: _UserService_UpdateUserSetting_Handler, }, { - MethodName: "ListUserSettings", - Handler: _UserService_ListUserSettings_Handler, + MethodName: "ListUserStats", + Handler: _UserService_ListUserStats_Handler, + }, + { + MethodName: "GetUserStats", + Handler: _UserService_GetUserStats_Handler, }, { MethodName: "ListMemoViews", @@ -1372,32 +1418,16 @@ var UserService_ServiceDesc = grpc.ServiceDesc{ Handler: _UserService_DeleteMemoView_Handler, }, { - MethodName: "ListLinkedIdentities", - Handler: _UserService_ListLinkedIdentities_Handler, + MethodName: "ListUserNotifications", + Handler: _UserService_ListUserNotifications_Handler, }, { - MethodName: "CreateLinkedIdentity", - Handler: _UserService_CreateLinkedIdentity_Handler, + MethodName: "UpdateUserNotification", + Handler: _UserService_UpdateUserNotification_Handler, }, { - MethodName: "GetLinkedIdentity", - Handler: _UserService_GetLinkedIdentity_Handler, - }, - { - MethodName: "DeleteLinkedIdentity", - Handler: _UserService_DeleteLinkedIdentity_Handler, - }, - { - MethodName: "ListPersonalAccessTokens", - Handler: _UserService_ListPersonalAccessTokens_Handler, - }, - { - MethodName: "CreatePersonalAccessToken", - Handler: _UserService_CreatePersonalAccessToken_Handler, - }, - { - MethodName: "DeletePersonalAccessToken", - Handler: _UserService_DeletePersonalAccessToken_Handler, + MethodName: "DeleteUserNotification", + Handler: _UserService_DeleteUserNotification_Handler, }, { MethodName: "ListUserWebhooks", @@ -1420,18 +1450,42 @@ var UserService_ServiceDesc = grpc.ServiceDesc{ Handler: _UserService_GetUserWebhookSigningSecret_Handler, }, { - MethodName: "ListUserNotifications", - Handler: _UserService_ListUserNotifications_Handler, + MethodName: "ListLinkedIdentities", + Handler: _UserService_ListLinkedIdentities_Handler, }, { - MethodName: "UpdateUserNotification", - Handler: _UserService_UpdateUserNotification_Handler, + MethodName: "GetLinkedIdentity", + Handler: _UserService_GetLinkedIdentity_Handler, }, { - MethodName: "DeleteUserNotification", - Handler: _UserService_DeleteUserNotification_Handler, + MethodName: "CreateLinkedIdentity", + Handler: _UserService_CreateLinkedIdentity_Handler, + }, + { + MethodName: "DeleteLinkedIdentity", + Handler: _UserService_DeleteLinkedIdentity_Handler, + }, + { + MethodName: "ListPersonalAccessTokens", + Handler: _UserService_ListPersonalAccessTokens_Handler, + }, + { + MethodName: "CreatePersonalAccessToken", + Handler: _UserService_CreatePersonalAccessToken_Handler, + }, + { + MethodName: "DeletePersonalAccessToken", + Handler: _UserService_DeletePersonalAccessToken_Handler, + }, + { + MethodName: "ExportMemos", + Handler: _UserService_ExportMemos_Handler, + }, + { + MethodName: "ImportMemos", + Handler: _UserService_ImportMemos_Handler, }, }, Streams: []grpc.StreamDesc{}, - Metadata: "api/v1/user_service.proto", + Metadata: "api/user_service.proto", } diff --git a/proto/gen/api/v1/apiv1connect/user_service.connect.go b/proto/gen/api/v1/apiv1connect/user_service.connect.go deleted file mode 100644 index a744bdab0..000000000 --- a/proto/gen/api/v1/apiv1connect/user_service.connect.go +++ /dev/null @@ -1,1129 +0,0 @@ -// Code generated by protoc-gen-connect-go. DO NOT EDIT. -// -// Source: api/v1/user_service.proto - -package apiv1connect - -import ( - connect "connectrpc.com/connect" - context "context" - errors "errors" - v1 "github.com/usememos/memos/proto/gen/api/v1" - httpbody "google.golang.org/genproto/googleapis/api/httpbody" - 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.v1.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.v1.UserService/ListUsers" - // UserServiceBatchGetUsersProcedure is the fully-qualified name of the UserService's BatchGetUsers - // RPC. - UserServiceBatchGetUsersProcedure = "/memos.api.v1.UserService/BatchGetUsers" - // UserServiceGetUserProcedure is the fully-qualified name of the UserService's GetUser RPC. - UserServiceGetUserProcedure = "/memos.api.v1.UserService/GetUser" - // UserServiceCreateUserProcedure is the fully-qualified name of the UserService's CreateUser RPC. - UserServiceCreateUserProcedure = "/memos.api.v1.UserService/CreateUser" - // UserServiceUpdateUserProcedure is the fully-qualified name of the UserService's UpdateUser RPC. - UserServiceUpdateUserProcedure = "/memos.api.v1.UserService/UpdateUser" - // UserServiceDeleteUserProcedure is the fully-qualified name of the UserService's DeleteUser RPC. - UserServiceDeleteUserProcedure = "/memos.api.v1.UserService/DeleteUser" - // UserServiceListAllUserStatsProcedure is the fully-qualified name of the UserService's - // ListAllUserStats RPC. - UserServiceListAllUserStatsProcedure = "/memos.api.v1.UserService/ListAllUserStats" - // UserServiceGetUserStatsProcedure is the fully-qualified name of the UserService's GetUserStats - // RPC. - UserServiceGetUserStatsProcedure = "/memos.api.v1.UserService/GetUserStats" - // UserServiceExportMemosProcedure is the fully-qualified name of the UserService's ExportMemos RPC. - UserServiceExportMemosProcedure = "/memos.api.v1.UserService/ExportMemos" - // UserServiceImportMemosProcedure is the fully-qualified name of the UserService's ImportMemos RPC. - UserServiceImportMemosProcedure = "/memos.api.v1.UserService/ImportMemos" - // UserServiceGetUserSettingProcedure is the fully-qualified name of the UserService's - // GetUserSetting RPC. - UserServiceGetUserSettingProcedure = "/memos.api.v1.UserService/GetUserSetting" - // UserServiceUpdateUserSettingProcedure is the fully-qualified name of the UserService's - // UpdateUserSetting RPC. - UserServiceUpdateUserSettingProcedure = "/memos.api.v1.UserService/UpdateUserSetting" - // UserServiceListUserSettingsProcedure is the fully-qualified name of the UserService's - // ListUserSettings RPC. - UserServiceListUserSettingsProcedure = "/memos.api.v1.UserService/ListUserSettings" - // UserServiceListMemoViewsProcedure is the fully-qualified name of the UserService's ListMemoViews - // RPC. - UserServiceListMemoViewsProcedure = "/memos.api.v1.UserService/ListMemoViews" - // UserServiceGetMemoViewProcedure is the fully-qualified name of the UserService's GetMemoView RPC. - UserServiceGetMemoViewProcedure = "/memos.api.v1.UserService/GetMemoView" - // UserServiceCreateMemoViewProcedure is the fully-qualified name of the UserService's - // CreateMemoView RPC. - UserServiceCreateMemoViewProcedure = "/memos.api.v1.UserService/CreateMemoView" - // UserServiceUpdateMemoViewProcedure is the fully-qualified name of the UserService's - // UpdateMemoView RPC. - UserServiceUpdateMemoViewProcedure = "/memos.api.v1.UserService/UpdateMemoView" - // UserServiceDeleteMemoViewProcedure is the fully-qualified name of the UserService's - // DeleteMemoView RPC. - UserServiceDeleteMemoViewProcedure = "/memos.api.v1.UserService/DeleteMemoView" - // UserServiceListLinkedIdentitiesProcedure is the fully-qualified name of the UserService's - // ListLinkedIdentities RPC. - UserServiceListLinkedIdentitiesProcedure = "/memos.api.v1.UserService/ListLinkedIdentities" - // UserServiceCreateLinkedIdentityProcedure is the fully-qualified name of the UserService's - // CreateLinkedIdentity RPC. - UserServiceCreateLinkedIdentityProcedure = "/memos.api.v1.UserService/CreateLinkedIdentity" - // UserServiceGetLinkedIdentityProcedure is the fully-qualified name of the UserService's - // GetLinkedIdentity RPC. - UserServiceGetLinkedIdentityProcedure = "/memos.api.v1.UserService/GetLinkedIdentity" - // UserServiceDeleteLinkedIdentityProcedure is the fully-qualified name of the UserService's - // DeleteLinkedIdentity RPC. - UserServiceDeleteLinkedIdentityProcedure = "/memos.api.v1.UserService/DeleteLinkedIdentity" - // UserServiceListPersonalAccessTokensProcedure is the fully-qualified name of the UserService's - // ListPersonalAccessTokens RPC. - UserServiceListPersonalAccessTokensProcedure = "/memos.api.v1.UserService/ListPersonalAccessTokens" - // UserServiceCreatePersonalAccessTokenProcedure is the fully-qualified name of the UserService's - // CreatePersonalAccessToken RPC. - UserServiceCreatePersonalAccessTokenProcedure = "/memos.api.v1.UserService/CreatePersonalAccessToken" - // UserServiceDeletePersonalAccessTokenProcedure is the fully-qualified name of the UserService's - // DeletePersonalAccessToken RPC. - UserServiceDeletePersonalAccessTokenProcedure = "/memos.api.v1.UserService/DeletePersonalAccessToken" - // UserServiceListUserWebhooksProcedure is the fully-qualified name of the UserService's - // ListUserWebhooks RPC. - UserServiceListUserWebhooksProcedure = "/memos.api.v1.UserService/ListUserWebhooks" - // UserServiceCreateUserWebhookProcedure is the fully-qualified name of the UserService's - // CreateUserWebhook RPC. - UserServiceCreateUserWebhookProcedure = "/memos.api.v1.UserService/CreateUserWebhook" - // UserServiceUpdateUserWebhookProcedure is the fully-qualified name of the UserService's - // UpdateUserWebhook RPC. - UserServiceUpdateUserWebhookProcedure = "/memos.api.v1.UserService/UpdateUserWebhook" - // UserServiceDeleteUserWebhookProcedure is the fully-qualified name of the UserService's - // DeleteUserWebhook RPC. - UserServiceDeleteUserWebhookProcedure = "/memos.api.v1.UserService/DeleteUserWebhook" - // UserServiceGetUserWebhookSigningSecretProcedure is the fully-qualified name of the UserService's - // GetUserWebhookSigningSecret RPC. - UserServiceGetUserWebhookSigningSecretProcedure = "/memos.api.v1.UserService/GetUserWebhookSigningSecret" - // UserServiceListUserNotificationsProcedure is the fully-qualified name of the UserService's - // ListUserNotifications RPC. - UserServiceListUserNotificationsProcedure = "/memos.api.v1.UserService/ListUserNotifications" - // UserServiceUpdateUserNotificationProcedure is the fully-qualified name of the UserService's - // UpdateUserNotification RPC. - UserServiceUpdateUserNotificationProcedure = "/memos.api.v1.UserService/UpdateUserNotification" - // UserServiceDeleteUserNotificationProcedure is the fully-qualified name of the UserService's - // DeleteUserNotification RPC. - UserServiceDeleteUserNotificationProcedure = "/memos.api.v1.UserService/DeleteUserNotification" -) - -// UserServiceClient is a client for the memos.api.v1.UserService service. -type UserServiceClient interface { - // ListUsers returns a list of users. - ListUsers(context.Context, *connect.Request[v1.ListUsersRequest]) (*connect.Response[v1.ListUsersResponse], error) - // BatchGetUsers returns active users by usernames. - BatchGetUsers(context.Context, *connect.Request[v1.BatchGetUsersRequest]) (*connect.Response[v1.BatchGetUsersResponse], error) - // GetUser gets a user by username. - // Format: users/{user} (e.g., users/steven) - GetUser(context.Context, *connect.Request[v1.GetUserRequest]) (*connect.Response[v1.User], error) - // CreateUser creates a new user. - CreateUser(context.Context, *connect.Request[v1.CreateUserRequest]) (*connect.Response[v1.User], error) - // UpdateUser updates a user. - UpdateUser(context.Context, *connect.Request[v1.UpdateUserRequest]) (*connect.Response[v1.User], error) - // DeleteUser deletes a user. - DeleteUser(context.Context, *connect.Request[v1.DeleteUserRequest]) (*connect.Response[emptypb.Empty], error) - // ListAllUserStats returns statistics for all users. - ListAllUserStats(context.Context, *connect.Request[v1.ListAllUserStatsRequest]) (*connect.Response[v1.ListAllUserStatsResponse], error) - // GetUserStats returns statistics for a specific user. - GetUserStats(context.Context, *connect.Request[v1.GetUserStatsRequest]) (*connect.Response[v1.UserStats], error) - // ExportMemos writes every memo the user created, with comments, archived - // memos, and attachment files, as a Memos export file (a ZIP file, see - // docs/design/memos-export-format.md). Only the user may export their own - // memos. The body is the archive; content_type is its media type. - ExportMemos(context.Context, *connect.Request[v1.ExportMemosRequest]) (*connect.Response[httpbody.HttpBody], 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[v1.ImportMemosRequest]) (*connect.Response[v1.ImportMemosResponse], error) - // GetUserSetting returns the user setting. - GetUserSetting(context.Context, *connect.Request[v1.GetUserSettingRequest]) (*connect.Response[v1.UserSetting], error) - // UpdateUserSetting updates the user setting. - UpdateUserSetting(context.Context, *connect.Request[v1.UpdateUserSettingRequest]) (*connect.Response[v1.UserSetting], error) - // ListUserSettings returns a list of user settings. - ListUserSettings(context.Context, *connect.Request[v1.ListUserSettingsRequest]) (*connect.Response[v1.ListUserSettingsResponse], error) - // ListMemoViews returns a user's memo views. Each view is a named, reusable - // CEL filter (see MemoView.filter); pass its filter string directly to the - // ListMemos `filter` argument. - ListMemoViews(context.Context, *connect.Request[v1.ListMemoViewsRequest]) (*connect.Response[v1.ListMemoViewsResponse], error) - // GetMemoView gets a memo view by name. - GetMemoView(context.Context, *connect.Request[v1.GetMemoViewRequest]) (*connect.Response[v1.MemoView], error) - // CreateMemoView creates a new memo view for a user. - CreateMemoView(context.Context, *connect.Request[v1.CreateMemoViewRequest]) (*connect.Response[v1.MemoView], error) - // UpdateMemoView updates a memo view for a user. - UpdateMemoView(context.Context, *connect.Request[v1.UpdateMemoViewRequest]) (*connect.Response[v1.MemoView], error) - // DeleteMemoView deletes a memo view for a user. - DeleteMemoView(context.Context, *connect.Request[v1.DeleteMemoViewRequest]) (*connect.Response[emptypb.Empty], error) - // ListLinkedIdentities returns a list of linked SSO identities for a user. - ListLinkedIdentities(context.Context, *connect.Request[v1.ListLinkedIdentitiesRequest]) (*connect.Response[v1.ListLinkedIdentitiesResponse], error) - // CreateLinkedIdentity links an SSO identity to the authenticated user. - CreateLinkedIdentity(context.Context, *connect.Request[v1.CreateLinkedIdentityRequest]) (*connect.Response[v1.LinkedIdentity], error) - // GetLinkedIdentity gets a linked SSO identity for a user. - GetLinkedIdentity(context.Context, *connect.Request[v1.GetLinkedIdentityRequest]) (*connect.Response[v1.LinkedIdentity], error) - // DeleteLinkedIdentity unlinks an SSO identity from a user. - DeleteLinkedIdentity(context.Context, *connect.Request[v1.DeleteLinkedIdentityRequest]) (*connect.Response[emptypb.Empty], error) - // ListPersonalAccessTokens returns a list of Personal Access Tokens (PATs) for a user. - // PATs are long-lived tokens for API/script access, distinct from short-lived JWT access tokens. - ListPersonalAccessTokens(context.Context, *connect.Request[v1.ListPersonalAccessTokensRequest]) (*connect.Response[v1.ListPersonalAccessTokensResponse], error) - // CreatePersonalAccessToken creates a new Personal Access Token for a user. - // The token value is only returned once upon creation. - CreatePersonalAccessToken(context.Context, *connect.Request[v1.CreatePersonalAccessTokenRequest]) (*connect.Response[v1.CreatePersonalAccessTokenResponse], error) - // DeletePersonalAccessToken deletes a Personal Access Token. - DeletePersonalAccessToken(context.Context, *connect.Request[v1.DeletePersonalAccessTokenRequest]) (*connect.Response[emptypb.Empty], error) - // ListUserWebhooks returns a list of webhooks for a user. - ListUserWebhooks(context.Context, *connect.Request[v1.ListUserWebhooksRequest]) (*connect.Response[v1.ListUserWebhooksResponse], error) - // CreateUserWebhook creates a new webhook for a user. - CreateUserWebhook(context.Context, *connect.Request[v1.CreateUserWebhookRequest]) (*connect.Response[v1.UserWebhook], error) - // UpdateUserWebhook updates an existing webhook for a user. - UpdateUserWebhook(context.Context, *connect.Request[v1.UpdateUserWebhookRequest]) (*connect.Response[v1.UserWebhook], error) - // DeleteUserWebhook deletes a webhook for a user. - DeleteUserWebhook(context.Context, *connect.Request[v1.DeleteUserWebhookRequest]) (*connect.Response[emptypb.Empty], error) - // GetUserWebhookSigningSecret returns the signing secret for a webhook. - // The secret is returned only through this explicit, owner-gated call; it is - // never included in List/Create/Update responses. - GetUserWebhookSigningSecret(context.Context, *connect.Request[v1.GetUserWebhookSigningSecretRequest]) (*connect.Response[v1.GetUserWebhookSigningSecretResponse], error) - // ListUserNotifications lists notifications for a user. - ListUserNotifications(context.Context, *connect.Request[v1.ListUserNotificationsRequest]) (*connect.Response[v1.ListUserNotificationsResponse], error) - // UpdateUserNotification updates a notification. - UpdateUserNotification(context.Context, *connect.Request[v1.UpdateUserNotificationRequest]) (*connect.Response[v1.UserNotification], error) - // DeleteUserNotification deletes a notification. - DeleteUserNotification(context.Context, *connect.Request[v1.DeleteUserNotificationRequest]) (*connect.Response[emptypb.Empty], error) -} - -// NewUserServiceClient constructs a client for the memos.api.v1.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 := v1.File_api_v1_user_service_proto.Services().ByName("UserService").Methods() - return &userServiceClient{ - listUsers: connect.NewClient[v1.ListUsersRequest, v1.ListUsersResponse]( - httpClient, - baseURL+UserServiceListUsersProcedure, - connect.WithSchema(userServiceMethods.ByName("ListUsers")), - connect.WithClientOptions(opts...), - ), - batchGetUsers: connect.NewClient[v1.BatchGetUsersRequest, v1.BatchGetUsersResponse]( - httpClient, - baseURL+UserServiceBatchGetUsersProcedure, - connect.WithSchema(userServiceMethods.ByName("BatchGetUsers")), - connect.WithClientOptions(opts...), - ), - getUser: connect.NewClient[v1.GetUserRequest, v1.User]( - httpClient, - baseURL+UserServiceGetUserProcedure, - connect.WithSchema(userServiceMethods.ByName("GetUser")), - connect.WithClientOptions(opts...), - ), - createUser: connect.NewClient[v1.CreateUserRequest, v1.User]( - httpClient, - baseURL+UserServiceCreateUserProcedure, - connect.WithSchema(userServiceMethods.ByName("CreateUser")), - connect.WithClientOptions(opts...), - ), - updateUser: connect.NewClient[v1.UpdateUserRequest, v1.User]( - httpClient, - baseURL+UserServiceUpdateUserProcedure, - connect.WithSchema(userServiceMethods.ByName("UpdateUser")), - connect.WithClientOptions(opts...), - ), - deleteUser: connect.NewClient[v1.DeleteUserRequest, emptypb.Empty]( - httpClient, - baseURL+UserServiceDeleteUserProcedure, - connect.WithSchema(userServiceMethods.ByName("DeleteUser")), - connect.WithClientOptions(opts...), - ), - listAllUserStats: connect.NewClient[v1.ListAllUserStatsRequest, v1.ListAllUserStatsResponse]( - httpClient, - baseURL+UserServiceListAllUserStatsProcedure, - connect.WithSchema(userServiceMethods.ByName("ListAllUserStats")), - connect.WithClientOptions(opts...), - ), - getUserStats: connect.NewClient[v1.GetUserStatsRequest, v1.UserStats]( - httpClient, - baseURL+UserServiceGetUserStatsProcedure, - connect.WithSchema(userServiceMethods.ByName("GetUserStats")), - connect.WithClientOptions(opts...), - ), - exportMemos: connect.NewClient[v1.ExportMemosRequest, httpbody.HttpBody]( - httpClient, - baseURL+UserServiceExportMemosProcedure, - connect.WithSchema(userServiceMethods.ByName("ExportMemos")), - connect.WithClientOptions(opts...), - ), - importMemos: connect.NewClient[v1.ImportMemosRequest, v1.ImportMemosResponse]( - httpClient, - baseURL+UserServiceImportMemosProcedure, - connect.WithSchema(userServiceMethods.ByName("ImportMemos")), - connect.WithClientOptions(opts...), - ), - getUserSetting: connect.NewClient[v1.GetUserSettingRequest, v1.UserSetting]( - httpClient, - baseURL+UserServiceGetUserSettingProcedure, - connect.WithSchema(userServiceMethods.ByName("GetUserSetting")), - connect.WithClientOptions(opts...), - ), - updateUserSetting: connect.NewClient[v1.UpdateUserSettingRequest, v1.UserSetting]( - httpClient, - baseURL+UserServiceUpdateUserSettingProcedure, - connect.WithSchema(userServiceMethods.ByName("UpdateUserSetting")), - connect.WithClientOptions(opts...), - ), - listUserSettings: connect.NewClient[v1.ListUserSettingsRequest, v1.ListUserSettingsResponse]( - httpClient, - baseURL+UserServiceListUserSettingsProcedure, - connect.WithSchema(userServiceMethods.ByName("ListUserSettings")), - connect.WithClientOptions(opts...), - ), - listMemoViews: connect.NewClient[v1.ListMemoViewsRequest, v1.ListMemoViewsResponse]( - httpClient, - baseURL+UserServiceListMemoViewsProcedure, - connect.WithSchema(userServiceMethods.ByName("ListMemoViews")), - connect.WithClientOptions(opts...), - ), - getMemoView: connect.NewClient[v1.GetMemoViewRequest, v1.MemoView]( - httpClient, - baseURL+UserServiceGetMemoViewProcedure, - connect.WithSchema(userServiceMethods.ByName("GetMemoView")), - connect.WithClientOptions(opts...), - ), - createMemoView: connect.NewClient[v1.CreateMemoViewRequest, v1.MemoView]( - httpClient, - baseURL+UserServiceCreateMemoViewProcedure, - connect.WithSchema(userServiceMethods.ByName("CreateMemoView")), - connect.WithClientOptions(opts...), - ), - updateMemoView: connect.NewClient[v1.UpdateMemoViewRequest, v1.MemoView]( - httpClient, - baseURL+UserServiceUpdateMemoViewProcedure, - connect.WithSchema(userServiceMethods.ByName("UpdateMemoView")), - connect.WithClientOptions(opts...), - ), - deleteMemoView: connect.NewClient[v1.DeleteMemoViewRequest, emptypb.Empty]( - httpClient, - baseURL+UserServiceDeleteMemoViewProcedure, - connect.WithSchema(userServiceMethods.ByName("DeleteMemoView")), - connect.WithClientOptions(opts...), - ), - listLinkedIdentities: connect.NewClient[v1.ListLinkedIdentitiesRequest, v1.ListLinkedIdentitiesResponse]( - httpClient, - baseURL+UserServiceListLinkedIdentitiesProcedure, - connect.WithSchema(userServiceMethods.ByName("ListLinkedIdentities")), - connect.WithClientOptions(opts...), - ), - createLinkedIdentity: connect.NewClient[v1.CreateLinkedIdentityRequest, v1.LinkedIdentity]( - httpClient, - baseURL+UserServiceCreateLinkedIdentityProcedure, - connect.WithSchema(userServiceMethods.ByName("CreateLinkedIdentity")), - connect.WithClientOptions(opts...), - ), - getLinkedIdentity: connect.NewClient[v1.GetLinkedIdentityRequest, v1.LinkedIdentity]( - httpClient, - baseURL+UserServiceGetLinkedIdentityProcedure, - connect.WithSchema(userServiceMethods.ByName("GetLinkedIdentity")), - connect.WithClientOptions(opts...), - ), - deleteLinkedIdentity: connect.NewClient[v1.DeleteLinkedIdentityRequest, emptypb.Empty]( - httpClient, - baseURL+UserServiceDeleteLinkedIdentityProcedure, - connect.WithSchema(userServiceMethods.ByName("DeleteLinkedIdentity")), - connect.WithClientOptions(opts...), - ), - listPersonalAccessTokens: connect.NewClient[v1.ListPersonalAccessTokensRequest, v1.ListPersonalAccessTokensResponse]( - httpClient, - baseURL+UserServiceListPersonalAccessTokensProcedure, - connect.WithSchema(userServiceMethods.ByName("ListPersonalAccessTokens")), - connect.WithClientOptions(opts...), - ), - createPersonalAccessToken: connect.NewClient[v1.CreatePersonalAccessTokenRequest, v1.CreatePersonalAccessTokenResponse]( - httpClient, - baseURL+UserServiceCreatePersonalAccessTokenProcedure, - connect.WithSchema(userServiceMethods.ByName("CreatePersonalAccessToken")), - connect.WithClientOptions(opts...), - ), - deletePersonalAccessToken: connect.NewClient[v1.DeletePersonalAccessTokenRequest, emptypb.Empty]( - httpClient, - baseURL+UserServiceDeletePersonalAccessTokenProcedure, - connect.WithSchema(userServiceMethods.ByName("DeletePersonalAccessToken")), - connect.WithClientOptions(opts...), - ), - listUserWebhooks: connect.NewClient[v1.ListUserWebhooksRequest, v1.ListUserWebhooksResponse]( - httpClient, - baseURL+UserServiceListUserWebhooksProcedure, - connect.WithSchema(userServiceMethods.ByName("ListUserWebhooks")), - connect.WithClientOptions(opts...), - ), - createUserWebhook: connect.NewClient[v1.CreateUserWebhookRequest, v1.UserWebhook]( - httpClient, - baseURL+UserServiceCreateUserWebhookProcedure, - connect.WithSchema(userServiceMethods.ByName("CreateUserWebhook")), - connect.WithClientOptions(opts...), - ), - updateUserWebhook: connect.NewClient[v1.UpdateUserWebhookRequest, v1.UserWebhook]( - httpClient, - baseURL+UserServiceUpdateUserWebhookProcedure, - connect.WithSchema(userServiceMethods.ByName("UpdateUserWebhook")), - connect.WithClientOptions(opts...), - ), - deleteUserWebhook: connect.NewClient[v1.DeleteUserWebhookRequest, emptypb.Empty]( - httpClient, - baseURL+UserServiceDeleteUserWebhookProcedure, - connect.WithSchema(userServiceMethods.ByName("DeleteUserWebhook")), - connect.WithClientOptions(opts...), - ), - getUserWebhookSigningSecret: connect.NewClient[v1.GetUserWebhookSigningSecretRequest, v1.GetUserWebhookSigningSecretResponse]( - httpClient, - baseURL+UserServiceGetUserWebhookSigningSecretProcedure, - connect.WithSchema(userServiceMethods.ByName("GetUserWebhookSigningSecret")), - connect.WithClientOptions(opts...), - ), - listUserNotifications: connect.NewClient[v1.ListUserNotificationsRequest, v1.ListUserNotificationsResponse]( - httpClient, - baseURL+UserServiceListUserNotificationsProcedure, - connect.WithSchema(userServiceMethods.ByName("ListUserNotifications")), - connect.WithClientOptions(opts...), - ), - updateUserNotification: connect.NewClient[v1.UpdateUserNotificationRequest, v1.UserNotification]( - httpClient, - baseURL+UserServiceUpdateUserNotificationProcedure, - connect.WithSchema(userServiceMethods.ByName("UpdateUserNotification")), - connect.WithClientOptions(opts...), - ), - deleteUserNotification: connect.NewClient[v1.DeleteUserNotificationRequest, emptypb.Empty]( - httpClient, - baseURL+UserServiceDeleteUserNotificationProcedure, - connect.WithSchema(userServiceMethods.ByName("DeleteUserNotification")), - connect.WithClientOptions(opts...), - ), - } -} - -// userServiceClient implements UserServiceClient. -type userServiceClient struct { - listUsers *connect.Client[v1.ListUsersRequest, v1.ListUsersResponse] - batchGetUsers *connect.Client[v1.BatchGetUsersRequest, v1.BatchGetUsersResponse] - getUser *connect.Client[v1.GetUserRequest, v1.User] - createUser *connect.Client[v1.CreateUserRequest, v1.User] - updateUser *connect.Client[v1.UpdateUserRequest, v1.User] - deleteUser *connect.Client[v1.DeleteUserRequest, emptypb.Empty] - listAllUserStats *connect.Client[v1.ListAllUserStatsRequest, v1.ListAllUserStatsResponse] - getUserStats *connect.Client[v1.GetUserStatsRequest, v1.UserStats] - exportMemos *connect.Client[v1.ExportMemosRequest, httpbody.HttpBody] - importMemos *connect.Client[v1.ImportMemosRequest, v1.ImportMemosResponse] - getUserSetting *connect.Client[v1.GetUserSettingRequest, v1.UserSetting] - updateUserSetting *connect.Client[v1.UpdateUserSettingRequest, v1.UserSetting] - listUserSettings *connect.Client[v1.ListUserSettingsRequest, v1.ListUserSettingsResponse] - listMemoViews *connect.Client[v1.ListMemoViewsRequest, v1.ListMemoViewsResponse] - getMemoView *connect.Client[v1.GetMemoViewRequest, v1.MemoView] - createMemoView *connect.Client[v1.CreateMemoViewRequest, v1.MemoView] - updateMemoView *connect.Client[v1.UpdateMemoViewRequest, v1.MemoView] - deleteMemoView *connect.Client[v1.DeleteMemoViewRequest, emptypb.Empty] - listLinkedIdentities *connect.Client[v1.ListLinkedIdentitiesRequest, v1.ListLinkedIdentitiesResponse] - createLinkedIdentity *connect.Client[v1.CreateLinkedIdentityRequest, v1.LinkedIdentity] - getLinkedIdentity *connect.Client[v1.GetLinkedIdentityRequest, v1.LinkedIdentity] - deleteLinkedIdentity *connect.Client[v1.DeleteLinkedIdentityRequest, emptypb.Empty] - listPersonalAccessTokens *connect.Client[v1.ListPersonalAccessTokensRequest, v1.ListPersonalAccessTokensResponse] - createPersonalAccessToken *connect.Client[v1.CreatePersonalAccessTokenRequest, v1.CreatePersonalAccessTokenResponse] - deletePersonalAccessToken *connect.Client[v1.DeletePersonalAccessTokenRequest, emptypb.Empty] - listUserWebhooks *connect.Client[v1.ListUserWebhooksRequest, v1.ListUserWebhooksResponse] - createUserWebhook *connect.Client[v1.CreateUserWebhookRequest, v1.UserWebhook] - updateUserWebhook *connect.Client[v1.UpdateUserWebhookRequest, v1.UserWebhook] - deleteUserWebhook *connect.Client[v1.DeleteUserWebhookRequest, emptypb.Empty] - getUserWebhookSigningSecret *connect.Client[v1.GetUserWebhookSigningSecretRequest, v1.GetUserWebhookSigningSecretResponse] - listUserNotifications *connect.Client[v1.ListUserNotificationsRequest, v1.ListUserNotificationsResponse] - updateUserNotification *connect.Client[v1.UpdateUserNotificationRequest, v1.UserNotification] - deleteUserNotification *connect.Client[v1.DeleteUserNotificationRequest, emptypb.Empty] -} - -// ListUsers calls memos.api.v1.UserService.ListUsers. -func (c *userServiceClient) ListUsers(ctx context.Context, req *connect.Request[v1.ListUsersRequest]) (*connect.Response[v1.ListUsersResponse], error) { - return c.listUsers.CallUnary(ctx, req) -} - -// BatchGetUsers calls memos.api.v1.UserService.BatchGetUsers. -func (c *userServiceClient) BatchGetUsers(ctx context.Context, req *connect.Request[v1.BatchGetUsersRequest]) (*connect.Response[v1.BatchGetUsersResponse], error) { - return c.batchGetUsers.CallUnary(ctx, req) -} - -// GetUser calls memos.api.v1.UserService.GetUser. -func (c *userServiceClient) GetUser(ctx context.Context, req *connect.Request[v1.GetUserRequest]) (*connect.Response[v1.User], error) { - return c.getUser.CallUnary(ctx, req) -} - -// CreateUser calls memos.api.v1.UserService.CreateUser. -func (c *userServiceClient) CreateUser(ctx context.Context, req *connect.Request[v1.CreateUserRequest]) (*connect.Response[v1.User], error) { - return c.createUser.CallUnary(ctx, req) -} - -// UpdateUser calls memos.api.v1.UserService.UpdateUser. -func (c *userServiceClient) UpdateUser(ctx context.Context, req *connect.Request[v1.UpdateUserRequest]) (*connect.Response[v1.User], error) { - return c.updateUser.CallUnary(ctx, req) -} - -// DeleteUser calls memos.api.v1.UserService.DeleteUser. -func (c *userServiceClient) DeleteUser(ctx context.Context, req *connect.Request[v1.DeleteUserRequest]) (*connect.Response[emptypb.Empty], error) { - return c.deleteUser.CallUnary(ctx, req) -} - -// ListAllUserStats calls memos.api.v1.UserService.ListAllUserStats. -func (c *userServiceClient) ListAllUserStats(ctx context.Context, req *connect.Request[v1.ListAllUserStatsRequest]) (*connect.Response[v1.ListAllUserStatsResponse], error) { - return c.listAllUserStats.CallUnary(ctx, req) -} - -// GetUserStats calls memos.api.v1.UserService.GetUserStats. -func (c *userServiceClient) GetUserStats(ctx context.Context, req *connect.Request[v1.GetUserStatsRequest]) (*connect.Response[v1.UserStats], error) { - return c.getUserStats.CallUnary(ctx, req) -} - -// ExportMemos calls memos.api.v1.UserService.ExportMemos. -func (c *userServiceClient) ExportMemos(ctx context.Context, req *connect.Request[v1.ExportMemosRequest]) (*connect.Response[httpbody.HttpBody], error) { - return c.exportMemos.CallUnary(ctx, req) -} - -// ImportMemos calls memos.api.v1.UserService.ImportMemos. -func (c *userServiceClient) ImportMemos(ctx context.Context, req *connect.Request[v1.ImportMemosRequest]) (*connect.Response[v1.ImportMemosResponse], error) { - return c.importMemos.CallUnary(ctx, req) -} - -// GetUserSetting calls memos.api.v1.UserService.GetUserSetting. -func (c *userServiceClient) GetUserSetting(ctx context.Context, req *connect.Request[v1.GetUserSettingRequest]) (*connect.Response[v1.UserSetting], error) { - return c.getUserSetting.CallUnary(ctx, req) -} - -// UpdateUserSetting calls memos.api.v1.UserService.UpdateUserSetting. -func (c *userServiceClient) UpdateUserSetting(ctx context.Context, req *connect.Request[v1.UpdateUserSettingRequest]) (*connect.Response[v1.UserSetting], error) { - return c.updateUserSetting.CallUnary(ctx, req) -} - -// ListUserSettings calls memos.api.v1.UserService.ListUserSettings. -func (c *userServiceClient) ListUserSettings(ctx context.Context, req *connect.Request[v1.ListUserSettingsRequest]) (*connect.Response[v1.ListUserSettingsResponse], error) { - return c.listUserSettings.CallUnary(ctx, req) -} - -// ListMemoViews calls memos.api.v1.UserService.ListMemoViews. -func (c *userServiceClient) ListMemoViews(ctx context.Context, req *connect.Request[v1.ListMemoViewsRequest]) (*connect.Response[v1.ListMemoViewsResponse], error) { - return c.listMemoViews.CallUnary(ctx, req) -} - -// GetMemoView calls memos.api.v1.UserService.GetMemoView. -func (c *userServiceClient) GetMemoView(ctx context.Context, req *connect.Request[v1.GetMemoViewRequest]) (*connect.Response[v1.MemoView], error) { - return c.getMemoView.CallUnary(ctx, req) -} - -// CreateMemoView calls memos.api.v1.UserService.CreateMemoView. -func (c *userServiceClient) CreateMemoView(ctx context.Context, req *connect.Request[v1.CreateMemoViewRequest]) (*connect.Response[v1.MemoView], error) { - return c.createMemoView.CallUnary(ctx, req) -} - -// UpdateMemoView calls memos.api.v1.UserService.UpdateMemoView. -func (c *userServiceClient) UpdateMemoView(ctx context.Context, req *connect.Request[v1.UpdateMemoViewRequest]) (*connect.Response[v1.MemoView], error) { - return c.updateMemoView.CallUnary(ctx, req) -} - -// DeleteMemoView calls memos.api.v1.UserService.DeleteMemoView. -func (c *userServiceClient) DeleteMemoView(ctx context.Context, req *connect.Request[v1.DeleteMemoViewRequest]) (*connect.Response[emptypb.Empty], error) { - return c.deleteMemoView.CallUnary(ctx, req) -} - -// ListLinkedIdentities calls memos.api.v1.UserService.ListLinkedIdentities. -func (c *userServiceClient) ListLinkedIdentities(ctx context.Context, req *connect.Request[v1.ListLinkedIdentitiesRequest]) (*connect.Response[v1.ListLinkedIdentitiesResponse], error) { - return c.listLinkedIdentities.CallUnary(ctx, req) -} - -// CreateLinkedIdentity calls memos.api.v1.UserService.CreateLinkedIdentity. -func (c *userServiceClient) CreateLinkedIdentity(ctx context.Context, req *connect.Request[v1.CreateLinkedIdentityRequest]) (*connect.Response[v1.LinkedIdentity], error) { - return c.createLinkedIdentity.CallUnary(ctx, req) -} - -// GetLinkedIdentity calls memos.api.v1.UserService.GetLinkedIdentity. -func (c *userServiceClient) GetLinkedIdentity(ctx context.Context, req *connect.Request[v1.GetLinkedIdentityRequest]) (*connect.Response[v1.LinkedIdentity], error) { - return c.getLinkedIdentity.CallUnary(ctx, req) -} - -// DeleteLinkedIdentity calls memos.api.v1.UserService.DeleteLinkedIdentity. -func (c *userServiceClient) DeleteLinkedIdentity(ctx context.Context, req *connect.Request[v1.DeleteLinkedIdentityRequest]) (*connect.Response[emptypb.Empty], error) { - return c.deleteLinkedIdentity.CallUnary(ctx, req) -} - -// ListPersonalAccessTokens calls memos.api.v1.UserService.ListPersonalAccessTokens. -func (c *userServiceClient) ListPersonalAccessTokens(ctx context.Context, req *connect.Request[v1.ListPersonalAccessTokensRequest]) (*connect.Response[v1.ListPersonalAccessTokensResponse], error) { - return c.listPersonalAccessTokens.CallUnary(ctx, req) -} - -// CreatePersonalAccessToken calls memos.api.v1.UserService.CreatePersonalAccessToken. -func (c *userServiceClient) CreatePersonalAccessToken(ctx context.Context, req *connect.Request[v1.CreatePersonalAccessTokenRequest]) (*connect.Response[v1.CreatePersonalAccessTokenResponse], error) { - return c.createPersonalAccessToken.CallUnary(ctx, req) -} - -// DeletePersonalAccessToken calls memos.api.v1.UserService.DeletePersonalAccessToken. -func (c *userServiceClient) DeletePersonalAccessToken(ctx context.Context, req *connect.Request[v1.DeletePersonalAccessTokenRequest]) (*connect.Response[emptypb.Empty], error) { - return c.deletePersonalAccessToken.CallUnary(ctx, req) -} - -// ListUserWebhooks calls memos.api.v1.UserService.ListUserWebhooks. -func (c *userServiceClient) ListUserWebhooks(ctx context.Context, req *connect.Request[v1.ListUserWebhooksRequest]) (*connect.Response[v1.ListUserWebhooksResponse], error) { - return c.listUserWebhooks.CallUnary(ctx, req) -} - -// CreateUserWebhook calls memos.api.v1.UserService.CreateUserWebhook. -func (c *userServiceClient) CreateUserWebhook(ctx context.Context, req *connect.Request[v1.CreateUserWebhookRequest]) (*connect.Response[v1.UserWebhook], error) { - return c.createUserWebhook.CallUnary(ctx, req) -} - -// UpdateUserWebhook calls memos.api.v1.UserService.UpdateUserWebhook. -func (c *userServiceClient) UpdateUserWebhook(ctx context.Context, req *connect.Request[v1.UpdateUserWebhookRequest]) (*connect.Response[v1.UserWebhook], error) { - return c.updateUserWebhook.CallUnary(ctx, req) -} - -// DeleteUserWebhook calls memos.api.v1.UserService.DeleteUserWebhook. -func (c *userServiceClient) DeleteUserWebhook(ctx context.Context, req *connect.Request[v1.DeleteUserWebhookRequest]) (*connect.Response[emptypb.Empty], error) { - return c.deleteUserWebhook.CallUnary(ctx, req) -} - -// GetUserWebhookSigningSecret calls memos.api.v1.UserService.GetUserWebhookSigningSecret. -func (c *userServiceClient) GetUserWebhookSigningSecret(ctx context.Context, req *connect.Request[v1.GetUserWebhookSigningSecretRequest]) (*connect.Response[v1.GetUserWebhookSigningSecretResponse], error) { - return c.getUserWebhookSigningSecret.CallUnary(ctx, req) -} - -// ListUserNotifications calls memos.api.v1.UserService.ListUserNotifications. -func (c *userServiceClient) ListUserNotifications(ctx context.Context, req *connect.Request[v1.ListUserNotificationsRequest]) (*connect.Response[v1.ListUserNotificationsResponse], error) { - return c.listUserNotifications.CallUnary(ctx, req) -} - -// UpdateUserNotification calls memos.api.v1.UserService.UpdateUserNotification. -func (c *userServiceClient) UpdateUserNotification(ctx context.Context, req *connect.Request[v1.UpdateUserNotificationRequest]) (*connect.Response[v1.UserNotification], error) { - return c.updateUserNotification.CallUnary(ctx, req) -} - -// DeleteUserNotification calls memos.api.v1.UserService.DeleteUserNotification. -func (c *userServiceClient) DeleteUserNotification(ctx context.Context, req *connect.Request[v1.DeleteUserNotificationRequest]) (*connect.Response[emptypb.Empty], error) { - return c.deleteUserNotification.CallUnary(ctx, req) -} - -// UserServiceHandler is an implementation of the memos.api.v1.UserService service. -type UserServiceHandler interface { - // ListUsers returns a list of users. - ListUsers(context.Context, *connect.Request[v1.ListUsersRequest]) (*connect.Response[v1.ListUsersResponse], error) - // BatchGetUsers returns active users by usernames. - BatchGetUsers(context.Context, *connect.Request[v1.BatchGetUsersRequest]) (*connect.Response[v1.BatchGetUsersResponse], error) - // GetUser gets a user by username. - // Format: users/{user} (e.g., users/steven) - GetUser(context.Context, *connect.Request[v1.GetUserRequest]) (*connect.Response[v1.User], error) - // CreateUser creates a new user. - CreateUser(context.Context, *connect.Request[v1.CreateUserRequest]) (*connect.Response[v1.User], error) - // UpdateUser updates a user. - UpdateUser(context.Context, *connect.Request[v1.UpdateUserRequest]) (*connect.Response[v1.User], error) - // DeleteUser deletes a user. - DeleteUser(context.Context, *connect.Request[v1.DeleteUserRequest]) (*connect.Response[emptypb.Empty], error) - // ListAllUserStats returns statistics for all users. - ListAllUserStats(context.Context, *connect.Request[v1.ListAllUserStatsRequest]) (*connect.Response[v1.ListAllUserStatsResponse], error) - // GetUserStats returns statistics for a specific user. - GetUserStats(context.Context, *connect.Request[v1.GetUserStatsRequest]) (*connect.Response[v1.UserStats], error) - // ExportMemos writes every memo the user created, with comments, archived - // memos, and attachment files, as a Memos export file (a ZIP file, see - // docs/design/memos-export-format.md). Only the user may export their own - // memos. The body is the archive; content_type is its media type. - ExportMemos(context.Context, *connect.Request[v1.ExportMemosRequest]) (*connect.Response[httpbody.HttpBody], 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[v1.ImportMemosRequest]) (*connect.Response[v1.ImportMemosResponse], error) - // GetUserSetting returns the user setting. - GetUserSetting(context.Context, *connect.Request[v1.GetUserSettingRequest]) (*connect.Response[v1.UserSetting], error) - // UpdateUserSetting updates the user setting. - UpdateUserSetting(context.Context, *connect.Request[v1.UpdateUserSettingRequest]) (*connect.Response[v1.UserSetting], error) - // ListUserSettings returns a list of user settings. - ListUserSettings(context.Context, *connect.Request[v1.ListUserSettingsRequest]) (*connect.Response[v1.ListUserSettingsResponse], error) - // ListMemoViews returns a user's memo views. Each view is a named, reusable - // CEL filter (see MemoView.filter); pass its filter string directly to the - // ListMemos `filter` argument. - ListMemoViews(context.Context, *connect.Request[v1.ListMemoViewsRequest]) (*connect.Response[v1.ListMemoViewsResponse], error) - // GetMemoView gets a memo view by name. - GetMemoView(context.Context, *connect.Request[v1.GetMemoViewRequest]) (*connect.Response[v1.MemoView], error) - // CreateMemoView creates a new memo view for a user. - CreateMemoView(context.Context, *connect.Request[v1.CreateMemoViewRequest]) (*connect.Response[v1.MemoView], error) - // UpdateMemoView updates a memo view for a user. - UpdateMemoView(context.Context, *connect.Request[v1.UpdateMemoViewRequest]) (*connect.Response[v1.MemoView], error) - // DeleteMemoView deletes a memo view for a user. - DeleteMemoView(context.Context, *connect.Request[v1.DeleteMemoViewRequest]) (*connect.Response[emptypb.Empty], error) - // ListLinkedIdentities returns a list of linked SSO identities for a user. - ListLinkedIdentities(context.Context, *connect.Request[v1.ListLinkedIdentitiesRequest]) (*connect.Response[v1.ListLinkedIdentitiesResponse], error) - // CreateLinkedIdentity links an SSO identity to the authenticated user. - CreateLinkedIdentity(context.Context, *connect.Request[v1.CreateLinkedIdentityRequest]) (*connect.Response[v1.LinkedIdentity], error) - // GetLinkedIdentity gets a linked SSO identity for a user. - GetLinkedIdentity(context.Context, *connect.Request[v1.GetLinkedIdentityRequest]) (*connect.Response[v1.LinkedIdentity], error) - // DeleteLinkedIdentity unlinks an SSO identity from a user. - DeleteLinkedIdentity(context.Context, *connect.Request[v1.DeleteLinkedIdentityRequest]) (*connect.Response[emptypb.Empty], error) - // ListPersonalAccessTokens returns a list of Personal Access Tokens (PATs) for a user. - // PATs are long-lived tokens for API/script access, distinct from short-lived JWT access tokens. - ListPersonalAccessTokens(context.Context, *connect.Request[v1.ListPersonalAccessTokensRequest]) (*connect.Response[v1.ListPersonalAccessTokensResponse], error) - // CreatePersonalAccessToken creates a new Personal Access Token for a user. - // The token value is only returned once upon creation. - CreatePersonalAccessToken(context.Context, *connect.Request[v1.CreatePersonalAccessTokenRequest]) (*connect.Response[v1.CreatePersonalAccessTokenResponse], error) - // DeletePersonalAccessToken deletes a Personal Access Token. - DeletePersonalAccessToken(context.Context, *connect.Request[v1.DeletePersonalAccessTokenRequest]) (*connect.Response[emptypb.Empty], error) - // ListUserWebhooks returns a list of webhooks for a user. - ListUserWebhooks(context.Context, *connect.Request[v1.ListUserWebhooksRequest]) (*connect.Response[v1.ListUserWebhooksResponse], error) - // CreateUserWebhook creates a new webhook for a user. - CreateUserWebhook(context.Context, *connect.Request[v1.CreateUserWebhookRequest]) (*connect.Response[v1.UserWebhook], error) - // UpdateUserWebhook updates an existing webhook for a user. - UpdateUserWebhook(context.Context, *connect.Request[v1.UpdateUserWebhookRequest]) (*connect.Response[v1.UserWebhook], error) - // DeleteUserWebhook deletes a webhook for a user. - DeleteUserWebhook(context.Context, *connect.Request[v1.DeleteUserWebhookRequest]) (*connect.Response[emptypb.Empty], error) - // GetUserWebhookSigningSecret returns the signing secret for a webhook. - // The secret is returned only through this explicit, owner-gated call; it is - // never included in List/Create/Update responses. - GetUserWebhookSigningSecret(context.Context, *connect.Request[v1.GetUserWebhookSigningSecretRequest]) (*connect.Response[v1.GetUserWebhookSigningSecretResponse], error) - // ListUserNotifications lists notifications for a user. - ListUserNotifications(context.Context, *connect.Request[v1.ListUserNotificationsRequest]) (*connect.Response[v1.ListUserNotificationsResponse], error) - // UpdateUserNotification updates a notification. - UpdateUserNotification(context.Context, *connect.Request[v1.UpdateUserNotificationRequest]) (*connect.Response[v1.UserNotification], error) - // DeleteUserNotification deletes a notification. - DeleteUserNotification(context.Context, *connect.Request[v1.DeleteUserNotificationRequest]) (*connect.Response[emptypb.Empty], 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 := v1.File_api_v1_user_service_proto.Services().ByName("UserService").Methods() - userServiceListUsersHandler := connect.NewUnaryHandler( - UserServiceListUsersProcedure, - svc.ListUsers, - connect.WithSchema(userServiceMethods.ByName("ListUsers")), - connect.WithHandlerOptions(opts...), - ) - userServiceBatchGetUsersHandler := connect.NewUnaryHandler( - UserServiceBatchGetUsersProcedure, - svc.BatchGetUsers, - connect.WithSchema(userServiceMethods.ByName("BatchGetUsers")), - connect.WithHandlerOptions(opts...), - ) - userServiceGetUserHandler := connect.NewUnaryHandler( - UserServiceGetUserProcedure, - svc.GetUser, - connect.WithSchema(userServiceMethods.ByName("GetUser")), - 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...), - ) - userServiceListAllUserStatsHandler := connect.NewUnaryHandler( - UserServiceListAllUserStatsProcedure, - svc.ListAllUserStats, - connect.WithSchema(userServiceMethods.ByName("ListAllUserStats")), - connect.WithHandlerOptions(opts...), - ) - userServiceGetUserStatsHandler := connect.NewUnaryHandler( - UserServiceGetUserStatsProcedure, - svc.GetUserStats, - connect.WithSchema(userServiceMethods.ByName("GetUserStats")), - connect.WithHandlerOptions(opts...), - ) - userServiceExportMemosHandler := connect.NewUnaryHandler( - UserServiceExportMemosProcedure, - svc.ExportMemos, - connect.WithSchema(userServiceMethods.ByName("ExportMemos")), - connect.WithHandlerOptions(opts...), - ) - userServiceImportMemosHandler := connect.NewUnaryHandler( - UserServiceImportMemosProcedure, - svc.ImportMemos, - connect.WithSchema(userServiceMethods.ByName("ImportMemos")), - 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...), - ) - userServiceListUserSettingsHandler := connect.NewUnaryHandler( - UserServiceListUserSettingsProcedure, - svc.ListUserSettings, - connect.WithSchema(userServiceMethods.ByName("ListUserSettings")), - 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...), - ) - userServiceListLinkedIdentitiesHandler := connect.NewUnaryHandler( - UserServiceListLinkedIdentitiesProcedure, - svc.ListLinkedIdentities, - connect.WithSchema(userServiceMethods.ByName("ListLinkedIdentities")), - connect.WithHandlerOptions(opts...), - ) - userServiceCreateLinkedIdentityHandler := connect.NewUnaryHandler( - UserServiceCreateLinkedIdentityProcedure, - svc.CreateLinkedIdentity, - connect.WithSchema(userServiceMethods.ByName("CreateLinkedIdentity")), - connect.WithHandlerOptions(opts...), - ) - userServiceGetLinkedIdentityHandler := connect.NewUnaryHandler( - UserServiceGetLinkedIdentityProcedure, - svc.GetLinkedIdentity, - connect.WithSchema(userServiceMethods.ByName("GetLinkedIdentity")), - 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...), - ) - 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...), - ) - 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...), - ) - return "/memos.api.v1.UserService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - switch r.URL.Path { - case UserServiceListUsersProcedure: - userServiceListUsersHandler.ServeHTTP(w, r) - case UserServiceBatchGetUsersProcedure: - userServiceBatchGetUsersHandler.ServeHTTP(w, r) - case UserServiceGetUserProcedure: - userServiceGetUserHandler.ServeHTTP(w, r) - case UserServiceCreateUserProcedure: - userServiceCreateUserHandler.ServeHTTP(w, r) - case UserServiceUpdateUserProcedure: - userServiceUpdateUserHandler.ServeHTTP(w, r) - case UserServiceDeleteUserProcedure: - userServiceDeleteUserHandler.ServeHTTP(w, r) - case UserServiceListAllUserStatsProcedure: - userServiceListAllUserStatsHandler.ServeHTTP(w, r) - case UserServiceGetUserStatsProcedure: - userServiceGetUserStatsHandler.ServeHTTP(w, r) - case UserServiceExportMemosProcedure: - userServiceExportMemosHandler.ServeHTTP(w, r) - case UserServiceImportMemosProcedure: - userServiceImportMemosHandler.ServeHTTP(w, r) - case UserServiceGetUserSettingProcedure: - userServiceGetUserSettingHandler.ServeHTTP(w, r) - case UserServiceUpdateUserSettingProcedure: - userServiceUpdateUserSettingHandler.ServeHTTP(w, r) - case UserServiceListUserSettingsProcedure: - userServiceListUserSettingsHandler.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 UserServiceListLinkedIdentitiesProcedure: - userServiceListLinkedIdentitiesHandler.ServeHTTP(w, r) - case UserServiceCreateLinkedIdentityProcedure: - userServiceCreateLinkedIdentityHandler.ServeHTTP(w, r) - case UserServiceGetLinkedIdentityProcedure: - userServiceGetLinkedIdentityHandler.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 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 UserServiceListUserNotificationsProcedure: - userServiceListUserNotificationsHandler.ServeHTTP(w, r) - case UserServiceUpdateUserNotificationProcedure: - userServiceUpdateUserNotificationHandler.ServeHTTP(w, r) - case UserServiceDeleteUserNotificationProcedure: - userServiceDeleteUserNotificationHandler.ServeHTTP(w, r) - default: - http.NotFound(w, r) - } - }) -} - -// UnimplementedUserServiceHandler returns CodeUnimplemented from all methods. -type UnimplementedUserServiceHandler struct{} - -func (UnimplementedUserServiceHandler) ListUsers(context.Context, *connect.Request[v1.ListUsersRequest]) (*connect.Response[v1.ListUsersResponse], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.UserService.ListUsers is not implemented")) -} - -func (UnimplementedUserServiceHandler) BatchGetUsers(context.Context, *connect.Request[v1.BatchGetUsersRequest]) (*connect.Response[v1.BatchGetUsersResponse], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.UserService.BatchGetUsers is not implemented")) -} - -func (UnimplementedUserServiceHandler) GetUser(context.Context, *connect.Request[v1.GetUserRequest]) (*connect.Response[v1.User], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.UserService.GetUser is not implemented")) -} - -func (UnimplementedUserServiceHandler) CreateUser(context.Context, *connect.Request[v1.CreateUserRequest]) (*connect.Response[v1.User], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.UserService.CreateUser is not implemented")) -} - -func (UnimplementedUserServiceHandler) UpdateUser(context.Context, *connect.Request[v1.UpdateUserRequest]) (*connect.Response[v1.User], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.UserService.UpdateUser is not implemented")) -} - -func (UnimplementedUserServiceHandler) DeleteUser(context.Context, *connect.Request[v1.DeleteUserRequest]) (*connect.Response[emptypb.Empty], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.UserService.DeleteUser is not implemented")) -} - -func (UnimplementedUserServiceHandler) ListAllUserStats(context.Context, *connect.Request[v1.ListAllUserStatsRequest]) (*connect.Response[v1.ListAllUserStatsResponse], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.UserService.ListAllUserStats is not implemented")) -} - -func (UnimplementedUserServiceHandler) GetUserStats(context.Context, *connect.Request[v1.GetUserStatsRequest]) (*connect.Response[v1.UserStats], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.UserService.GetUserStats is not implemented")) -} - -func (UnimplementedUserServiceHandler) ExportMemos(context.Context, *connect.Request[v1.ExportMemosRequest]) (*connect.Response[httpbody.HttpBody], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.UserService.ExportMemos is not implemented")) -} - -func (UnimplementedUserServiceHandler) ImportMemos(context.Context, *connect.Request[v1.ImportMemosRequest]) (*connect.Response[v1.ImportMemosResponse], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.UserService.ImportMemos is not implemented")) -} - -func (UnimplementedUserServiceHandler) GetUserSetting(context.Context, *connect.Request[v1.GetUserSettingRequest]) (*connect.Response[v1.UserSetting], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.UserService.GetUserSetting is not implemented")) -} - -func (UnimplementedUserServiceHandler) UpdateUserSetting(context.Context, *connect.Request[v1.UpdateUserSettingRequest]) (*connect.Response[v1.UserSetting], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.UserService.UpdateUserSetting is not implemented")) -} - -func (UnimplementedUserServiceHandler) ListUserSettings(context.Context, *connect.Request[v1.ListUserSettingsRequest]) (*connect.Response[v1.ListUserSettingsResponse], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.UserService.ListUserSettings is not implemented")) -} - -func (UnimplementedUserServiceHandler) ListMemoViews(context.Context, *connect.Request[v1.ListMemoViewsRequest]) (*connect.Response[v1.ListMemoViewsResponse], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.UserService.ListMemoViews is not implemented")) -} - -func (UnimplementedUserServiceHandler) GetMemoView(context.Context, *connect.Request[v1.GetMemoViewRequest]) (*connect.Response[v1.MemoView], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.UserService.GetMemoView is not implemented")) -} - -func (UnimplementedUserServiceHandler) CreateMemoView(context.Context, *connect.Request[v1.CreateMemoViewRequest]) (*connect.Response[v1.MemoView], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.UserService.CreateMemoView is not implemented")) -} - -func (UnimplementedUserServiceHandler) UpdateMemoView(context.Context, *connect.Request[v1.UpdateMemoViewRequest]) (*connect.Response[v1.MemoView], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.UserService.UpdateMemoView is not implemented")) -} - -func (UnimplementedUserServiceHandler) DeleteMemoView(context.Context, *connect.Request[v1.DeleteMemoViewRequest]) (*connect.Response[emptypb.Empty], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.UserService.DeleteMemoView is not implemented")) -} - -func (UnimplementedUserServiceHandler) ListLinkedIdentities(context.Context, *connect.Request[v1.ListLinkedIdentitiesRequest]) (*connect.Response[v1.ListLinkedIdentitiesResponse], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.UserService.ListLinkedIdentities is not implemented")) -} - -func (UnimplementedUserServiceHandler) CreateLinkedIdentity(context.Context, *connect.Request[v1.CreateLinkedIdentityRequest]) (*connect.Response[v1.LinkedIdentity], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.UserService.CreateLinkedIdentity is not implemented")) -} - -func (UnimplementedUserServiceHandler) GetLinkedIdentity(context.Context, *connect.Request[v1.GetLinkedIdentityRequest]) (*connect.Response[v1.LinkedIdentity], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.UserService.GetLinkedIdentity is not implemented")) -} - -func (UnimplementedUserServiceHandler) DeleteLinkedIdentity(context.Context, *connect.Request[v1.DeleteLinkedIdentityRequest]) (*connect.Response[emptypb.Empty], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.UserService.DeleteLinkedIdentity is not implemented")) -} - -func (UnimplementedUserServiceHandler) ListPersonalAccessTokens(context.Context, *connect.Request[v1.ListPersonalAccessTokensRequest]) (*connect.Response[v1.ListPersonalAccessTokensResponse], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.UserService.ListPersonalAccessTokens is not implemented")) -} - -func (UnimplementedUserServiceHandler) CreatePersonalAccessToken(context.Context, *connect.Request[v1.CreatePersonalAccessTokenRequest]) (*connect.Response[v1.CreatePersonalAccessTokenResponse], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.UserService.CreatePersonalAccessToken is not implemented")) -} - -func (UnimplementedUserServiceHandler) DeletePersonalAccessToken(context.Context, *connect.Request[v1.DeletePersonalAccessTokenRequest]) (*connect.Response[emptypb.Empty], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.UserService.DeletePersonalAccessToken is not implemented")) -} - -func (UnimplementedUserServiceHandler) ListUserWebhooks(context.Context, *connect.Request[v1.ListUserWebhooksRequest]) (*connect.Response[v1.ListUserWebhooksResponse], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.UserService.ListUserWebhooks is not implemented")) -} - -func (UnimplementedUserServiceHandler) CreateUserWebhook(context.Context, *connect.Request[v1.CreateUserWebhookRequest]) (*connect.Response[v1.UserWebhook], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.UserService.CreateUserWebhook is not implemented")) -} - -func (UnimplementedUserServiceHandler) UpdateUserWebhook(context.Context, *connect.Request[v1.UpdateUserWebhookRequest]) (*connect.Response[v1.UserWebhook], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.UserService.UpdateUserWebhook is not implemented")) -} - -func (UnimplementedUserServiceHandler) DeleteUserWebhook(context.Context, *connect.Request[v1.DeleteUserWebhookRequest]) (*connect.Response[emptypb.Empty], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.UserService.DeleteUserWebhook is not implemented")) -} - -func (UnimplementedUserServiceHandler) GetUserWebhookSigningSecret(context.Context, *connect.Request[v1.GetUserWebhookSigningSecretRequest]) (*connect.Response[v1.GetUserWebhookSigningSecretResponse], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.UserService.GetUserWebhookSigningSecret is not implemented")) -} - -func (UnimplementedUserServiceHandler) ListUserNotifications(context.Context, *connect.Request[v1.ListUserNotificationsRequest]) (*connect.Response[v1.ListUserNotificationsResponse], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.UserService.ListUserNotifications is not implemented")) -} - -func (UnimplementedUserServiceHandler) UpdateUserNotification(context.Context, *connect.Request[v1.UpdateUserNotificationRequest]) (*connect.Response[v1.UserNotification], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.UserService.UpdateUserNotification is not implemented")) -} - -func (UnimplementedUserServiceHandler) DeleteUserNotification(context.Context, *connect.Request[v1.DeleteUserNotificationRequest]) (*connect.Response[emptypb.Empty], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.UserService.DeleteUserNotification is not implemented")) -} diff --git a/proto/gen/openapi.yaml b/proto/gen/openapi.yaml index 432fddf80..28ca5a4c3 100644 --- a/proto/gen/openapi.yaml +++ b/proto/gen/openapi.yaml @@ -6,11 +6,13 @@ info: title: "" version: 0.0.1 paths: - /api/v1/ai:transcribe: + /api/ai:transcribe: post: tags: - AIService - description: Transcribe transcribes an audio file using an instance AI provider. + description: |- + Transcribe transcribes an audio file with the instance's configured + transcription provider. The caller must be signed in, and requests are rate limited per user. operationId: AIService_Transcribe requestBody: content: @@ -31,50 +33,44 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' - /api/v1/attachments: + /api/attachments: get: tags: - AttachmentService - description: ListAttachments lists attachments linked to readable memos and the caller's unlinked uploads. + description: ListAttachments lists attachments linked to memos the caller can read, plus the caller's unlinked uploads. operationId: AttachmentService_ListAttachments parameters: - name: pageSize in: query description: |- - Optional. The maximum number of attachments to return. - The service may return fewer than this value. - If unspecified, at most 50 attachments will be returned. - The maximum value is 1000; values above 1000 will be coerced to 1000. + Optional. The maximum number of attachments to return. The service may return fewer. + If unspecified, at most 50 attachments are returned. Values above 1000 are coerced to 1000. schema: type: integer format: int32 - name: pageToken in: query - description: |- - Optional. A page token, received from a previous `ListAttachments` call. - Provide this to retrieve the subsequent page. + description: Optional. A page token from a previous call. Provide it to retrieve the next page. schema: type: string - name: filter in: query description: |- - Optional. Filter to apply to the list results. - Example: "mime_type==\"image/png\"" or "filename.contains(\"test\")" - Supported operators: =, !=, <, <=, >, >=, : (contains), in + Optional. A CEL filter over the results. + Example: `mime_type == "image/png"` or `filename.contains("test")`. + Supported operators: ==, !=, <, <=, >, >=, : (contains), in. Supported fields: creator, filename, mime_type, create_time, memo_id, space. - `creator` is the linked memo's creator, or the uploader for an unlinked - attachment. It supports equality with a User resource name. - `space` only supports a non-negated `==` comparison with a Space resource - name or null. - `space` is the linked memo's space resource name, or null when the - attachment is unlinked or its linked memo has no space. + `creator` is the linked memo's creator, or the uploader for an unlinked attachment. It supports equality with a + User resource name. + `space` is the linked memo's Space resource name, or null when the attachment is unlinked or its memo has no + space. It supports only a non-negated `==` comparison with a Space resource name or null. schema: type: string - name: orderBy in: query description: |- - Optional. The order to sort results by. - Example: "create_time desc" or "filename asc" + Optional. The order to sort results by, such as "create_time desc" or "filename asc". The service does not apply + it yet. schema: type: string responses: @@ -93,14 +89,13 @@ paths: post: tags: - AttachmentService - description: CreateAttachment creates a new attachment. + description: CreateAttachment creates an attachment from inline content. operationId: AttachmentService_CreateAttachment parameters: - name: attachmentId in: query description: |- - Optional. The attachment ID to use for this attachment. - If empty, a unique ID will be generated. + Optional. The ID to use for the attachment. If empty, a unique ID is generated. Format: ^[a-zA-Z0-9]([a-zA-Z0-9-]{0,34}[a-zA-Z0-9])?$ schema: type: string @@ -123,11 +118,13 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' - /api/v1/attachments/{attachment}: + /api/attachments/{attachment}: get: tags: - AttachmentService - description: GetAttachment returns an attachment by name. + description: |- + GetAttachment gets an attachment by name. An unlinked attachment is visible only to its uploader and admins; + a linked attachment follows the read access of its memo. operationId: AttachmentService_GetAttachment parameters: - name: attachment @@ -152,7 +149,7 @@ paths: delete: tags: - AttachmentService - description: DeleteAttachment deletes an attachment by name. + description: DeleteAttachment deletes an attachment uploaded by the caller. operationId: AttachmentService_DeleteAttachment parameters: - name: attachment @@ -174,7 +171,9 @@ paths: patch: tags: - AttachmentService - description: UpdateAttachment updates an attachment. + description: |- + UpdateAttachment updates an attachment. Only `filename` can be updated. The caller must be the uploader or an + admin. operationId: AttachmentService_UpdateAttachment parameters: - name: attachment @@ -185,7 +184,7 @@ paths: type: string - name: updateMask in: query - description: Required. The list of fields to update. + description: Required. The fields to update. Only `filename` is supported. schema: type: string format: field-mask @@ -208,11 +207,13 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' - /api/v1/attachments:batchDelete: + /api/attachments:batchDelete: post: tags: - AttachmentService - description: BatchDeleteAttachments deletes multiple attachments in one request. + description: |- + BatchDeleteAttachments deletes up to 100 attachments in one atomic request. The caller must be the uploader of + each attachment or an admin. operationId: AttachmentService_BatchDeleteAttachments requestBody: content: @@ -230,14 +231,13 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' - /api/v1/attachments:upload: + /api/attachments:upload: post: tags: - AttachmentService description: |- - UploadAttachment uploads a file in bounded chunks. The first call carries - the spec and returns an upload_id; later calls carry that upload_id. - Uploads are bound to the authenticated user, expire after 30 minutes of + UploadAttachment uploads a file in bounded chunks. The first call carries the spec and returns an upload_id; + later calls carry that upload_id. Uploads are bound to the authenticated user, expire after 30 minutes of inactivity, and do not survive a server restart. operationId: AttachmentService_UploadAttachment requestBody: @@ -259,14 +259,14 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' - /api/v1/auth/me: + /api/auth/me: get: tags: - AuthService description: |- - GetCurrentUser returns the authenticated user's information. - Validates the access token and returns user details. - Similar to OIDC's /userinfo endpoint. + GetCurrentUser returns the authenticated user, similar to OIDC's /userinfo endpoint. + When the caller is not signed in or the account is no longer active, clears the refresh token cookie and returns + UNAUTHENTICATED. operationId: AuthService_GetCurrentUser responses: "200": @@ -281,14 +281,15 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' - /api/v1/auth/refresh: + /api/auth/refresh: post: tags: - AuthService description: |- - RefreshToken exchanges a valid refresh token for a new access token. - The refresh token is read from the HttpOnly cookie. - Returns a new short-lived access token. + RefreshToken exchanges the refresh token for a new access token. + The refresh token is read from the HttpOnly cookie and rotated: the old token is revoked and a new one with a + fresh 30-day expiry is set in the cookie. + Public, so it can be called after the access token has expired. operationId: AuthService_RefreshToken requestBody: content: @@ -309,14 +310,14 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' - /api/v1/auth/signin: + /api/auth/signin: post: tags: - AuthService description: |- - SignIn authenticates a user with credentials and returns tokens. - On success, returns an access token and sets a refresh token cookie. - Supports password-based and SSO authentication methods. + SignIn authenticates a user with password or SSO credentials. + On success, returns a short-lived access token and sets a refresh token in an HttpOnly cookie. + Public. Attempts are rate limited. Archived users cannot sign in. operationId: AuthService_SignIn requestBody: content: @@ -337,13 +338,13 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' - /api/v1/auth/signout: + /api/auth/signout: post: tags: - AuthService description: |- - SignOut terminates the user's authentication. - Revokes the refresh token and clears the authentication cookie. + SignOut ends the current session. + Revokes the refresh token from the cookie and clears the cookie. operationId: AuthService_SignOut responses: "200": @@ -355,11 +356,13 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' - /api/v1/identity-providers: + /api/identity-providers: get: tags: - IdentityProviderService - description: ListIdentityProviders lists identity providers. + description: |- + ListIdentityProviders lists identity providers. + Public, so the sign-in page can show SSO options. Client secrets are never returned. operationId: IdentityProviderService_ListIdentityProviders responses: "200": @@ -377,14 +380,17 @@ paths: post: tags: - IdentityProviderService - description: CreateIdentityProvider creates an identity provider. + description: |- + CreateIdentityProvider creates an identity provider. + Requires the admin role. Fails with FAILED_PRECONDITION when the ID belongs to a provider configured by the + deployment. operationId: IdentityProviderService_CreateIdentityProvider parameters: - name: identityProviderId in: query description: |- - Optional. The ID to use for the identity provider, which will become the final component of the resource name. - If not provided, the system will generate one. + Optional. The ID to use for the identity provider, which becomes the final component of the resource name. + If empty, the server generates one. Format: ^[a-zA-Z0-9]([a-zA-Z0-9-]{0,34}[a-zA-Z0-9])?$ schema: type: string @@ -407,11 +413,13 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' - /api/v1/identity-providers/{identity-provider}: + /api/identity-providers/{identity-provider}: get: tags: - IdentityProviderService - description: GetIdentityProvider gets an identity provider. + description: |- + GetIdentityProvider gets an identity provider. + The client secret is never returned. operationId: IdentityProviderService_GetIdentityProvider parameters: - name: identity-provider @@ -436,7 +444,10 @@ paths: delete: tags: - IdentityProviderService - description: DeleteIdentityProvider deletes an identity provider. + description: |- + DeleteIdentityProvider deletes an identity provider. + Requires the admin role. Providers configured by the deployment cannot be deleted. Fails with + FAILED_PRECONDITION when password sign-in is disabled for regular users and no other effective provider remains. operationId: IdentityProviderService_DeleteIdentityProvider parameters: - name: identity-provider @@ -458,7 +469,9 @@ paths: patch: tags: - IdentityProviderService - description: UpdateIdentityProvider updates an identity provider. + description: |- + UpdateIdentityProvider updates an identity provider. + Requires the admin role. Providers configured by the deployment cannot be updated. operationId: IdentityProviderService_UpdateIdentityProvider parameters: - name: identity-provider @@ -470,8 +483,8 @@ paths: - name: updateMask in: query description: |- - Required. The update mask applies to the resource. Only the top level fields of - IdentityProvider are supported. + Required. The fields to update. Supported paths: title, identifier_filter, config; other paths are ignored. + An empty OAuth2 client secret in config keeps the stored secret. schema: type: string format: field-mask @@ -494,11 +507,11 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' - /api/v1/instance/profile: + /api/instance/profile: get: tags: - InstanceService - description: Gets the instance profile. + description: GetInstanceProfile gets the instance profile. Available without authentication, including on a private instance. operationId: InstanceService_GetInstanceProfile responses: "200": @@ -513,11 +526,11 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' - /api/v1/instance/settings/notification:testEmail: + /api/instance/settings/notification:testEmail: post: tags: - InstanceService - description: Tests notification email delivery with the provided or stored SMTP settings. + description: TestInstanceEmailSetting sends a test email with the provided or stored SMTP settings. Admin only. operationId: InstanceService_TestInstanceEmailSetting requestBody: content: @@ -535,11 +548,13 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' - /api/v1/instance/settings:batchGet: + /api/instance/settings:batchGet: post: tags: - InstanceService - description: Batch gets instance settings. + description: |- + BatchGetInstanceSettings gets up to 100 instance settings in request order, with the same access rules as + GetInstanceSetting. The call fails if any setting cannot be returned. operationId: InstanceService_BatchGetInstanceSettings requestBody: content: @@ -560,11 +575,11 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' - /api/v1/instance/stats: + /api/instance/stats: get: tags: - InstanceService - description: GetInstanceStats returns resource usage statistics for the instance. Admin only. + description: GetInstanceStats gets resource usage statistics for the instance. Admin only. Results are cached for 60 seconds. operationId: InstanceService_GetInstanceStats responses: "200": @@ -579,11 +594,13 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' - /api/v1/instance/{instance}/*: + /api/instance/{instance}/*: get: tags: - InstanceService - description: Gets an instance setting. + description: |- + GetInstanceSetting gets an instance setting. Available without authentication, except STORAGE and NOTIFICATION, + which are admin only, and AI, which requires a signed-in user and hides transcription defaults from non-admins. operationId: InstanceService_GetInstanceSetting parameters: - name: instance @@ -608,7 +625,9 @@ paths: patch: tags: - InstanceService - description: Updates an instance setting. + description: |- + UpdateInstanceSetting replaces an instance setting. Admin only. Settings configured by the deployment cannot be + updated. Empty write-only credentials keep the stored values. operationId: InstanceService_UpdateInstanceSetting parameters: - name: instance @@ -619,7 +638,7 @@ paths: type: string - name: updateMask in: query - description: The list of fields to update. + description: Optional. The list of fields to update. Currently ignored; the whole setting is replaced. schema: type: string format: field-mask @@ -642,52 +661,28 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' - /api/v1/memos: + /api/memos: get: tags: - MemoService - description: ListMemos lists readable non-comment memos with pagination and filter. + description: |- + ListMemos lists the memos the caller can read, excluding comments. + Anonymous callers can list only when the instance allows public access. operationId: MemoService_ListMemos parameters: - name: pageSize in: query description: |- - Optional. The maximum number of memos to return. - The service may return fewer than this value. - If unspecified, at most 50 memos will be returned. - The maximum value is 1000; values above 1000 will be coerced to 1000. + Optional. The maximum number of memos to return. The service may return + fewer. Defaults to 50; values above 1000 are coerced to 1000. schema: type: integer format: int32 - name: pageToken in: query description: |- - Optional. A page token, received from a previous `ListMemos` call. - Provide this to retrieve the subsequent page. - schema: - type: string - - name: state - in: query - description: |- - Optional. The state of the memos to list. - Default to `NORMAL`. Set to `ARCHIVED` to list archived memos. - schema: - enum: - - STATE_UNSPECIFIED - - NORMAL - - ARCHIVED - type: string - format: enum - - name: orderBy - in: query - description: |- - Optional. The order to sort results by. - Default to "create_time desc". - Supports comma-separated list of fields following AIP-132. - Example: "pinned desc, create_time desc" or "update_time asc" - Supported fields: pinned, create_time, update_time, name. - Note: order_by uses create_time / update_time, while the filter - expression uses created_ts / updated_ts for the same timestamps. + Optional. A page token from a previous call. Provide it to retrieve the + next page. schema: type: string - name: filter @@ -712,11 +707,36 @@ paths: content.contains("roadmap") && created_ts > now - duration("168h") schema: type: string + - name: orderBy + in: query + description: |- + Optional. The order to sort results by, as a comma-separated list of + fields following AIP-132. Defaults to "create_time desc". + Supported fields: pinned, create_time, update_time, name. + Example: "pinned desc, create_time desc" or "update_time asc". + Note: order_by uses create_time / update_time, while the filter + expression uses created_ts / updated_ts for the same timestamps. + schema: + type: string - name: showDeleted in: query - description: Optional. If true, show deleted memos in the response. + description: |- + Optional. Whether to include deleted memos. Currently ignored by the + server. schema: type: boolean + - name: state + in: query + description: |- + Optional. The state of the memos to list. Defaults to NORMAL. Set to + ARCHIVED to list the caller's own archived memos. + schema: + enum: + - STATE_UNSPECIFIED + - NORMAL + - ARCHIVED + type: string + format: enum responses: "200": description: OK @@ -734,17 +754,16 @@ paths: tags: - MemoService description: |- - CreateMemo creates a memo. The request body is a Memo; set its content - (Markdown) and visibility (PRIVATE | PROTECTED | PUBLIC | SPACE, - default PRIVATE). - The memo is owned by the authenticated user; requires authentication. + 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. operationId: MemoService_CreateMemo parameters: - name: memoId in: query description: |- - Optional. The memo ID to use for this memo. - If empty, a unique ID will be generated. + Optional. The ID to use for the memo, which becomes the final segment of + its resource name. If empty, a unique ID is generated. Format: ^[a-zA-Z0-9]([a-zA-Z0-9-]{0,34}[a-zA-Z0-9])?$ schema: type: string @@ -767,11 +786,11 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' - /api/v1/memos/-/linkMetadata: + /api/memos/-/linkMetadata: get: tags: - MemoService - description: GetLinkMetadata gets metadata for a link. + description: GetLinkMetadata fetches the title, description, and image of a link. operationId: MemoService_GetLinkMetadata parameters: - name: url @@ -792,11 +811,11 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' - /api/v1/memos/-/linkMetadata:batchGet: + /api/memos/-/linkMetadata:batchGet: post: tags: - MemoService - description: BatchGetLinkMetadata gets metadata for links. + description: BatchGetLinkMetadata fetches the metadata of up to 10 links. operationId: MemoService_BatchGetLinkMetadata requestBody: content: @@ -817,11 +836,11 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' - /api/v1/memos/{memo}: + /api/memos/{memo}: get: tags: - MemoService - description: GetMemo gets a memo. + description: GetMemo gets a memo. Requires read access to the memo. operationId: MemoService_GetMemo parameters: - name: memo @@ -849,7 +868,7 @@ paths: description: |- DeleteMemo deletes the named memo and its comment subtree, including nested replies and their owned resources. It removes incident relations for all - deleted memos. + deleted memos. Requires the memo creator or an instance administrator. operationId: MemoService_DeleteMemo parameters: - name: memo @@ -860,7 +879,9 @@ paths: type: string - name: force in: query - description: Optional. If set to true, the memo will be deleted even if it has associated data. + description: |- + Optional. Currently ignored by the server; deletion always includes the + comment subtree. schema: type: boolean responses: @@ -876,7 +897,9 @@ paths: patch: tags: - MemoService - description: UpdateMemo updates a memo. + description: |- + UpdateMemo updates the memo fields listed in update_mask. Requires the memo + creator or an instance administrator. operationId: MemoService_UpdateMemo parameters: - name: memo @@ -887,7 +910,10 @@ paths: type: string - name: updateMask in: query - description: Required. The list of fields to update. + description: |- + Required. The fields to update. Supported paths: content, visibility, + space, pinned, state, create_time, update_time, location, attachments, + relations. schema: type: string format: field-mask @@ -910,11 +936,13 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' - /api/v1/memos/{memo}/attachments: + /api/memos/{memo}/attachments: get: tags: - MemoService - description: ListMemoAttachments lists attachments for a memo. + description: |- + ListMemoAttachments lists the attachments of a memo. Requires read access + to the memo. operationId: MemoService_ListMemoAttachments parameters: - name: memo @@ -925,13 +953,17 @@ paths: type: string - name: pageSize in: query - description: Optional. The maximum number of attachments to return. + description: |- + Optional. The maximum number of attachments to return. The service may + return fewer. Currently ignored; all attachments are returned. schema: type: integer format: int32 - name: pageToken in: query - description: Optional. A page token for pagination. + description: |- + Optional. A page token from a previous call. Provide it to retrieve the + next page. Currently ignored. schema: type: string responses: @@ -953,7 +985,8 @@ paths: description: |- 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. + clears all attachments. Idempotent. Requires the memo creator or an + instance administrator. operationId: MemoService_SetMemoAttachments parameters: - name: memo @@ -978,11 +1011,13 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' - /api/v1/memos/{memo}/comments: + /api/memos/{memo}/comments: get: tags: - MemoService - description: ListMemoComments lists comments for a memo. + description: |- + ListMemoComments lists the active comments on a memo that the caller can + read. Requires read access to the memo. operationId: MemoService_ListMemoComments parameters: - name: memo @@ -993,18 +1028,22 @@ paths: type: string - name: pageSize in: query - description: Optional. The maximum number of comments to return. + description: |- + Optional. The maximum number of comments to return. The service may return + fewer. Defaults to 50; values above 1000 are coerced to 1000. schema: type: integer format: int32 - name: pageToken in: query - description: Optional. A page token for pagination. + description: |- + Optional. A page token from a previous call. Provide it to retrieve the + next page. schema: type: string - name: orderBy in: query - description: Optional. The order to sort results by. + description: Optional. The order to sort results by. Currently ignored by the server. schema: type: string responses: @@ -1026,7 +1065,8 @@ paths: description: |- 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. + placement, visibility, authorship, and lifecycle. The named memo must be + readable by the caller and not archived. operationId: MemoService_CreateMemoComment parameters: - name: memo @@ -1037,7 +1077,9 @@ paths: type: string - name: commentId in: query - description: Optional. The comment ID to use. + description: |- + Optional. The ID to use for the comment memo, in the same format as + CreateMemoRequest.memo_id. If empty, a unique ID is generated. schema: type: string requestBody: @@ -1059,11 +1101,13 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' - /api/v1/memos/{memo}/reactions: + /api/memos/{memo}/reactions: get: tags: - MemoService - description: ListMemoReactions lists reactions for a memo. + description: |- + ListMemoReactions lists the reactions on a memo. Requires read access to + the memo. operationId: MemoService_ListMemoReactions parameters: - name: memo @@ -1074,13 +1118,17 @@ paths: type: string - name: pageSize in: query - description: Optional. The maximum number of reactions to return. + description: |- + Optional. The maximum number of reactions to return. The service may + return fewer. Currently ignored; all reactions are returned. schema: type: integer format: int32 - name: pageToken in: query - description: Optional. A page token for pagination. + description: |- + Optional. A page token from a previous call. Provide it to retrieve the + next page. Currently ignored. schema: type: string responses: @@ -1099,7 +1147,9 @@ paths: post: tags: - MemoService - description: UpsertMemoReaction adds or updates the authenticated user's reaction on a memo. + description: |- + UpsertMemoReaction adds or updates the authenticated user's reaction on a + memo. Requires read access to the memo. operationId: MemoService_UpsertMemoReaction parameters: - name: memo @@ -1127,11 +1177,13 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' - /api/v1/memos/{memo}/reactions/{reaction}: + /api/memos/{memo}/reactions/{reaction}: delete: tags: - MemoService - description: DeleteMemoReaction deletes a reaction for a memo. + description: |- + DeleteMemoReaction deletes a reaction. Requires the reaction creator or an + instance administrator. operationId: MemoService_DeleteMemoReaction parameters: - name: memo @@ -1156,11 +1208,13 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' - /api/v1/memos/{memo}/relations: + /api/memos/{memo}/relations: get: tags: - MemoService - description: ListMemoRelations lists relations for a memo. + description: |- + ListMemoRelations lists the relations of a memo in both directions. + Requires read access to the memo. operationId: MemoService_ListMemoRelations parameters: - name: memo @@ -1171,13 +1225,17 @@ paths: type: string - name: pageSize in: query - description: Optional. The maximum number of relations to return. + description: |- + Optional. The maximum number of relations to return. The service may + return fewer. Defaults to 50; values above 1000 are coerced to 1000. schema: type: integer format: int32 - name: pageToken in: query - description: Optional. A page token for pagination. + description: |- + Optional. A page token from a previous call. Provide it to retrieve the + next page. schema: type: string responses: @@ -1200,6 +1258,7 @@ paths: 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. operationId: MemoService_SetMemoRelations parameters: - name: memo @@ -1224,11 +1283,13 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' - /api/v1/memos/{memo}/shares: + /api/memos/{memo}/shares: get: tags: - MemoService - description: ListMemoShares lists all share links for a memo. Requires the memo creator or an instance administrator. + description: |- + ListMemoShares lists all share links for a memo. Requires the memo creator + or an instance administrator. operationId: MemoService_ListMemoShares parameters: - name: memo @@ -1253,7 +1314,10 @@ paths: post: tags: - MemoService - description: CreateMemoShare creates a share link for a memo. Requires the memo creator or an instance administrator. + description: |- + 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. operationId: MemoService_CreateMemoShare parameters: - name: memo @@ -1281,11 +1345,13 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' - /api/v1/memos/{memo}/shares/{share}: + /api/memos/{memo}/shares/{share}: delete: tags: - MemoService - description: DeleteMemoShare revokes a share link. Requires the memo creator or an instance administrator. + description: |- + DeleteMemoShare revokes a share link. Requires the memo creator or an + instance administrator. operationId: MemoService_DeleteMemoShare parameters: - name: memo @@ -1310,18 +1376,18 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' - /api/v1/shares/{shareToken}/memo: + /api/shares/{shareToken}/memo: get: tags: - MemoService description: |- - GetSharedMemo resolves a share token to its memo. No authentication required. - Returns NOT_FOUND if the token is invalid or expired. + GetSharedMemo resolves a share token to its memo. No authentication is + required. Returns NOT_FOUND if the token is invalid or expired. operationId: MemoService_GetSharedMemo parameters: - name: shareToken in: path - description: Required. The opaque bearer token extracted from the share URL. + description: Required. The opaque bearer token from the share URL. required: true schema: type: string @@ -1338,22 +1404,22 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' - /api/v1/spaces: + /api/spaces: get: tags: - SpaceService - description: ListSpaces lists spaces of which the authenticated caller is a member. + description: ListSpaces lists the spaces of which the authenticated caller is a member. operationId: SpaceService_ListSpaces parameters: - name: pageSize in: query - description: Optional. The maximum number of spaces to return. + description: Optional. The maximum number of spaces to return. The service may return fewer. schema: type: integer format: int32 - name: pageToken in: query - description: Optional. A token from a previous ListSpaces response. + description: Optional. A page token from a previous call. Provide it to retrieve the next page. schema: type: string responses: @@ -1380,9 +1446,9 @@ paths: - name: spaceId in: query description: |- - Optional. The space UID to use for this space. - If empty, a canonical UUID v4 will be generated. - Format: ^[a-zA-Z0-9]([a-zA-Z0-9-]{0,34}[a-zA-Z0-9])?$ + Optional. The ID to use for the space, which becomes the final segment of + its resource name. If empty, a UUID v4 is generated. Must match + ^[a-zA-Z0-9]([a-zA-Z0-9-]{0,34}[a-zA-Z0-9])?$. schema: type: string requestBody: @@ -1404,11 +1470,13 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' - /api/v1/spaces/{space}: + /api/spaces/{space}: get: tags: - SpaceService - description: GetSpace gets a space of which the authenticated caller is a member. + description: |- + GetSpace gets a space of which the authenticated caller is a member. + Spaces the caller is not a member of are reported as not found. operationId: SpaceService_GetSpace parameters: - name: space @@ -1435,7 +1503,8 @@ paths: - SpaceService description: |- DeleteSpace permanently deletes a space and every memo currently placed - in it. It never follows memo relations to other memos. + in it. It never follows memo relations to other memos. Only a space + administrator can delete a space. operationId: SpaceService_DeleteSpace parameters: - name: space @@ -1457,7 +1526,9 @@ paths: patch: tags: - SpaceService - description: UpdateSpace updates space metadata. + description: |- + UpdateSpace updates space metadata. Only a space administrator can update + a space. operationId: SpaceService_UpdateSpace parameters: - name: space @@ -1468,7 +1539,7 @@ paths: type: string - name: updateMask in: query - description: 'Required. The fields to update: title or description.' + description: 'Required. The fields to update. Supported paths: title, description, icon.' schema: type: string format: field-mask @@ -1491,11 +1562,13 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' - /api/v1/spaces/{space}/invitations: + /api/spaces/{space}/invitations: get: tags: - SpaceService - description: ListSpaceInvitations lists the pending invitations for a space. + description: |- + ListSpaceInvitations lists the pending invitations for a space. Only a + space administrator can list them. operationId: SpaceService_ListSpaceInvitations parameters: - name: space @@ -1506,13 +1579,13 @@ paths: type: string - name: pageSize in: query - description: Optional. The maximum number of invitations to return. + description: Optional. The maximum number of invitations to return. The service may return fewer. schema: type: integer format: int32 - name: pageToken in: query - description: Optional. A token from a previous ListSpaceInvitations response. + description: Optional. A page token from a previous call. Provide it to retrieve the next page. schema: type: string responses: @@ -1531,7 +1604,10 @@ paths: post: tags: - SpaceService - description: CreateSpaceInvitation invites an existing active user to a space. + description: |- + CreateSpaceInvitation invites an existing active user to a space. Only a + space administrator can invite. The invitee gets no space access until + they accept. operationId: SpaceService_CreateSpaceInvitation parameters: - name: space @@ -1559,11 +1635,13 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' - /api/v1/spaces/{space}/invitations/{invitation}: + /api/spaces/{space}/invitations/{invitation}: get: tags: - SpaceService - description: GetSpaceInvitation gets one pending invitation. + description: |- + GetSpaceInvitation gets one pending invitation. Only the invitee or a + space administrator can get it. operationId: SpaceService_GetSpaceInvitation parameters: - name: space @@ -1594,7 +1672,9 @@ paths: delete: tags: - SpaceService - description: DeleteSpaceInvitation revokes a pending invitation. + description: |- + DeleteSpaceInvitation revokes a pending invitation. Only a space + administrator can revoke it. operationId: SpaceService_DeleteSpaceInvitation parameters: - name: space @@ -1619,11 +1699,13 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' - /api/v1/spaces/{space}/invitations/{invitation}:accept: + /api/spaces/{space}/invitations/{invitation}:accept: post: tags: - SpaceService - description: AcceptSpaceInvitation accepts a pending invitation and creates a membership. + description: |- + AcceptSpaceInvitation accepts a pending invitation and creates a + membership with the invited role. Only the invitee can accept it. operationId: SpaceService_AcceptSpaceInvitation parameters: - name: space @@ -1657,11 +1739,13 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' - /api/v1/spaces/{space}/invitations/{invitation}:decline: + /api/spaces/{space}/invitations/{invitation}:decline: post: tags: - SpaceService - description: DeclineSpaceInvitation declines a pending invitation. + description: |- + DeclineSpaceInvitation declines a pending invitation without creating a + membership. Only the invitee can decline it. operationId: SpaceService_DeclineSpaceInvitation parameters: - name: space @@ -1692,11 +1776,13 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' - /api/v1/spaces/{space}/members: + /api/spaces/{space}/members: get: tags: - SpaceService - description: ListSpaceMembers lists the members of a space. + description: |- + ListSpaceMembers lists the members of a space. The caller must be a member + of the space. operationId: SpaceService_ListSpaceMembers parameters: - name: space @@ -1707,13 +1793,13 @@ paths: type: string - name: pageSize in: query - description: Optional. The maximum number of members to return. + description: Optional. The maximum number of members to return. The service may return fewer. schema: type: integer format: int32 - name: pageToken in: query - description: Optional. A token from a previous ListSpaceMembers response. + description: Optional. A page token from a previous call. Provide it to retrieve the next page. schema: type: string responses: @@ -1729,11 +1815,13 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' - /api/v1/spaces/{space}/members/{member}: + /api/spaces/{space}/members/{member}: get: tags: - SpaceService - description: GetSpaceMember gets one membership in a space. + description: |- + GetSpaceMember gets one membership in a space. The caller must be a member + of the space. operationId: SpaceService_GetSpaceMember parameters: - name: space @@ -1765,8 +1853,9 @@ paths: tags: - SpaceService description: |- - DeleteSpaceMember removes a member. A member may delete their own - membership to leave the space. + DeleteSpaceMember removes a member. A space administrator can remove any + member, and a member may delete their own membership to leave the space. + A space must keep at least one administrator. operationId: SpaceService_DeleteSpaceMember parameters: - name: space @@ -1794,7 +1883,9 @@ paths: patch: tags: - SpaceService - description: UpdateSpaceMember changes a member's space role. + description: |- + UpdateSpaceMember changes a member's space role. Only a space administrator + can change roles, and a space must keep at least one administrator. operationId: SpaceService_UpdateSpaceMember parameters: - name: space @@ -1811,7 +1902,9 @@ paths: type: string - name: updateMask in: query - description: Required. Only role is supported. + description: |- + Required. The fields to update. Must include role. The user path is also + accepted, but the user must match the existing member and is never changed. schema: type: string format: field-mask @@ -1834,42 +1927,40 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' - /api/v1/users: + /api/users: get: tags: - UserService - description: ListUsers returns a list of users. + description: ListUsers lists users in every state. Only admins may call it. operationId: UserService_ListUsers parameters: - name: pageSize in: query description: |- - Optional. The maximum number of users to return. - The service may return fewer than this value. - If unspecified, at most 50 users will be returned. - The maximum value is 1000; values above 1000 will be coerced to 1000. + Optional. The maximum number of users to return. The service may return + fewer. If unspecified, at most 50 users are returned. The maximum value is + 1000; values above 1000 are coerced to 1000. schema: type: integer format: int32 - name: pageToken in: query description: |- - Optional. A page token, received from a previous `ListUsers` call. - Provide this to retrieve the subsequent page. + Optional. A page token from a previous call. Provide it to retrieve the + next page. schema: type: string - name: filter in: query description: |- - Optional. Filter to apply to the list results. + Optional. A CEL filter on the users. Only `username == ''` is + supported. Example: "username == 'steven'" - Supported operators: == - Supported fields: username schema: type: string - name: showDeleted in: query - description: Optional. If true, show deleted users in the response. + description: Optional. Currently ignored; the list includes users in every state. schema: type: boolean responses: @@ -1888,7 +1979,10 @@ paths: post: tags: - UserService - description: CreateUser creates a new user. + description: |- + 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. operationId: UserService_CreateUser parameters: - name: userId @@ -1901,14 +1995,12 @@ paths: type: string - name: validateOnly in: query - description: Optional. If set, validate the request but don't actually create the user. + description: Optional. If set, validate the request but do not create the user. schema: type: boolean - name: requestId in: query - description: |- - Optional. An idempotency token that can be used to ensure that multiple - requests to create a user have the same result. + description: Optional. An idempotency token. Currently ignored. schema: type: string requestBody: @@ -1930,13 +2022,11 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' - /api/v1/users/{user}: + /api/users/{user}: get: tags: - UserService - description: |- - GetUser gets a user by username. - Format: users/{user} (e.g., users/steven) + description: GetUser gets a user by resource name. operationId: UserService_GetUser parameters: - name: user @@ -1947,9 +2037,7 @@ paths: type: string - name: readMask in: query - description: |- - Optional. The fields to return in the response. - If not specified, all fields are returned. + description: Optional. Currently ignored; all fields are returned. schema: type: string format: field-mask @@ -1969,7 +2057,9 @@ paths: delete: tags: - UserService - description: DeleteUser deletes a user. + description: |- + DeleteUser deletes a user. Users may delete themselves; admins may delete + anyone. A user who belongs to any space cannot be deleted. operationId: UserService_DeleteUser parameters: - name: user @@ -1980,7 +2070,9 @@ paths: type: string - name: force in: query - description: Optional. If set to true, the user will be deleted even if they have associated data. + description: |- + Optional. Currently ignored; deleting a user who belongs to any space + fails with FAILED_PRECONDITION. schema: type: boolean responses: @@ -1996,7 +2088,9 @@ paths: patch: tags: - UserService - description: UpdateUser updates a user. + description: |- + UpdateUser updates a user. Users may update themselves; admins may update + anyone. Changing the password ends the user's other sessions. operationId: UserService_UpdateUser parameters: - name: user @@ -2007,13 +2101,16 @@ paths: type: string - name: updateMask in: query - description: Required. The list of fields to update. + description: |- + Required. The fields to update. Supported paths: username, display_name, + email, avatar_url, description, password, role, state. role and state + require an admin. schema: type: string format: field-mask - name: allowMissing in: query - description: Optional. If set to true, allows updating sensitive fields. + description: Optional. Currently ignored; updating a missing user fails with NOT_FOUND. schema: type: boolean requestBody: @@ -2035,11 +2132,13 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' - /api/v1/users/{user}/linkedIdentities: + /api/users/{user}/linkedIdentities: get: tags: - UserService - description: ListLinkedIdentities returns a list of linked SSO identities for a user. + description: |- + ListLinkedIdentities lists the SSO identities linked to a user. The user + and admins may call it. operationId: UserService_ListLinkedIdentities parameters: - name: user @@ -2064,7 +2163,9 @@ paths: post: tags: - UserService - description: CreateLinkedIdentity links an SSO identity to the authenticated user. + description: |- + CreateLinkedIdentity completes an OAuth flow and links the resulting SSO + identity to the authenticated user, who must be the parent. operationId: UserService_CreateLinkedIdentity parameters: - name: user @@ -2092,11 +2193,13 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' - /api/v1/users/{user}/linkedIdentities/{linkedIdentity}: + /api/users/{user}/linkedIdentities/{linkedIdentity}: get: tags: - UserService - description: GetLinkedIdentity gets a linked SSO identity for a user. + description: |- + GetLinkedIdentity gets an SSO identity linked to a user. The user and + admins may call it. operationId: UserService_GetLinkedIdentity parameters: - name: user @@ -2127,7 +2230,9 @@ paths: delete: tags: - UserService - description: DeleteLinkedIdentity unlinks an SSO identity from a user. + description: |- + DeleteLinkedIdentity unlinks an SSO identity from a user. The user and + admins may call it. operationId: UserService_DeleteLinkedIdentity parameters: - name: user @@ -2152,11 +2257,14 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' - /api/v1/users/{user}/notifications: + /api/users/{user}/notifications: get: tags: - UserService - description: ListUserNotifications lists notifications for a user. + description: |- + 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. operationId: UserService_ListUserNotifications parameters: - name: user @@ -2167,15 +2275,23 @@ paths: type: string - name: pageSize in: query + description: |- + Optional. The maximum number of notifications to return. The service may + return fewer. Currently ignored; all notifications are returned in one + page. schema: type: integer format: int32 - name: pageToken in: query + description: |- + Optional. A page token from a previous call. Provide it to retrieve the + next page. schema: type: string - name: filter in: query + description: Optional. A filter on the notifications. Currently ignored. schema: type: string responses: @@ -2191,11 +2307,13 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' - /api/v1/users/{user}/notifications/{notification}: + /api/users/{user}/notifications/{notification}: delete: tags: - UserService - description: DeleteUserNotification deletes a notification. + description: |- + DeleteUserNotification permanently deletes a notification. Only the + receiver may call it. operationId: UserService_DeleteUserNotification parameters: - name: user @@ -2223,7 +2341,9 @@ paths: patch: tags: - UserService - description: UpdateUserNotification updates a notification. + description: |- + UpdateUserNotification updates a notification's status. Only the receiver + may call it. operationId: UserService_UpdateUserNotification parameters: - name: user @@ -2240,6 +2360,7 @@ paths: type: string - name: updateMask in: query + description: Required. The fields to update. Only status is supported. schema: type: string format: field-mask @@ -2262,13 +2383,15 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' - /api/v1/users/{user}/personalAccessTokens: + /api/users/{user}/personalAccessTokens: get: tags: - UserService description: |- - ListPersonalAccessTokens returns a list of Personal Access Tokens (PATs) for a user. - PATs are long-lived tokens for API/script access, distinct from short-lived JWT access tokens. + 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. operationId: UserService_ListPersonalAccessTokens parameters: - name: user @@ -2279,13 +2402,17 @@ paths: type: string - name: pageSize in: query - description: Optional. The maximum number of tokens to return. + description: |- + Optional. The maximum number of tokens to return. The service may return + fewer. Currently ignored; all tokens are returned in one page. schema: type: integer format: int32 - name: pageToken in: query - description: Optional. A page token for pagination. + description: |- + Optional. A page token from a previous call. Provide it to retrieve the + next page. schema: type: string responses: @@ -2305,8 +2432,9 @@ paths: tags: - UserService description: |- - CreatePersonalAccessToken creates a new Personal Access Token for a user. - The token value is only returned once upon creation. + 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. operationId: UserService_CreatePersonalAccessToken parameters: - name: user @@ -2334,11 +2462,13 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' - /api/v1/users/{user}/personalAccessTokens/{personalAccessToken}: + /api/users/{user}/personalAccessTokens/{personalAccessToken}: delete: tags: - UserService - description: DeletePersonalAccessToken deletes a Personal Access Token. + description: |- + DeletePersonalAccessToken deletes a personal access token, which stops + working immediately. Only the owner may call it. operationId: UserService_DeletePersonalAccessToken parameters: - name: user @@ -2363,11 +2493,14 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' - /api/v1/users/{user}/settings: + /api/users/{user}/settings: get: tags: - UserService - description: ListUserSettings returns a list of user settings. + description: |- + 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. operationId: UserService_ListUserSettings parameters: - name: user @@ -2379,18 +2512,16 @@ paths: - name: pageSize in: query description: |- - Optional. The maximum number of settings to return. - The service may return fewer than this value. - If unspecified, at most 50 settings will be returned. - The maximum value is 1000; values above 1000 will be coerced to 1000. + Optional. The maximum number of settings to return. The service may return + fewer. Currently ignored; all settings are returned in one page. schema: type: integer format: int32 - name: pageToken in: query description: |- - Optional. A page token, received from a previous `ListUserSettings` call. - Provide this to retrieve the subsequent page. + Optional. A page token from a previous call. Provide it to retrieve the + next page. schema: type: string responses: @@ -2406,11 +2537,11 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' - /api/v1/users/{user}/settings/{setting}: + /api/users/{user}/settings/{setting}: get: tags: - UserService - description: GetUserSetting returns the user setting. + description: GetUserSetting gets a user setting. Only the user may call it. operationId: UserService_GetUserSetting parameters: - name: user @@ -2441,7 +2572,9 @@ paths: patch: tags: - UserService - description: UpdateUserSetting updates the user setting. + description: |- + UpdateUserSetting updates a user setting. Only the user may call it, and + only the GENERAL and TAGS settings can be updated. operationId: UserService_UpdateUserSetting parameters: - name: user @@ -2458,7 +2591,10 @@ paths: type: string - name: updateMask in: query - description: Required. The list of fields to update. + description: |- + Required. The fields to update, relative to the setting value. GENERAL + supports locale, memo_visibility, theme and save_media_metadata; TAGS + supports tags. schema: type: string format: field-mask @@ -2481,11 +2617,13 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' - /api/v1/users/{user}/spaceInvitations: + /api/users/{user}/spaceInvitations: get: tags: - SpaceService - description: ListUserSpaceInvitations lists the authenticated user's pending space invitations. + description: |- + ListUserSpaceInvitations lists the authenticated user's pending space + invitations. A user cannot list another user's invitations. operationId: SpaceService_ListUserSpaceInvitations parameters: - name: user @@ -2496,13 +2634,13 @@ paths: type: string - name: pageSize in: query - description: Optional. The maximum number of invitations to return. + description: Optional. The maximum number of invitations to return. The service may return fewer. schema: type: integer format: int32 - name: pageToken in: query - description: Optional. A token from a previous ListUserSpaceInvitations response. + description: Optional. A page token from a previous call. Provide it to retrieve the next page. schema: type: string responses: @@ -2518,14 +2656,62 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' - /api/v1/users/{user}/views: + /api/users/{user}/stats: get: tags: - UserService description: |- - ListMemoViews returns a user's memo views. Each view is a named, reusable + 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. + operationId: UserService_ListUserStats + parameters: + - name: user + in: path + description: The user id. + required: true + schema: + type: string + - name: filter + in: query + description: |- + Optional. A CEL expression selecting the memos to count. Uses the same + filter syntax as ListMemos. + schema: + type: string + - name: state + in: query + description: |- + Optional. The state of the memos to count. Defaults to NORMAL. ARCHIVED + counts only the caller's own memos. + schema: + enum: + - STATE_UNSPECIFIED + - NORMAL + - ARCHIVED + type: string + format: enum + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListUserStatsResponse' + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + /api/users/{user}/views: + get: + tags: + - UserService + description: |- + 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. + ListMemos `filter` argument. Only the user may call it. operationId: UserService_ListMemoViews parameters: - name: user @@ -2550,7 +2736,7 @@ paths: post: tags: - UserService - description: CreateMemoView creates a new memo view for a user. + description: CreateMemoView creates a memo view for a user. Only the user may call it. operationId: UserService_CreateMemoView parameters: - name: user @@ -2561,7 +2747,7 @@ paths: type: string - name: validateOnly in: query - description: Optional. If set, validate the request, but do not actually create the memo view. + description: Optional. If set, validate the request but do not create the memo view. schema: type: boolean requestBody: @@ -2583,11 +2769,11 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' - /api/v1/users/{user}/views/{view}: + /api/users/{user}/views/{view}: get: tags: - UserService - description: GetMemoView gets a memo view by name. + description: GetMemoView gets a memo view. Only the owner may call it. operationId: UserService_GetMemoView parameters: - name: user @@ -2618,7 +2804,7 @@ paths: delete: tags: - UserService - description: DeleteMemoView deletes a memo view for a user. + description: DeleteMemoView deletes a memo view. Only the owner may call it. operationId: UserService_DeleteMemoView parameters: - name: user @@ -2646,7 +2832,7 @@ paths: patch: tags: - UserService - description: UpdateMemoView updates a memo view for a user. + description: UpdateMemoView updates a memo view. Only the owner may call it. operationId: UserService_UpdateMemoView parameters: - name: user @@ -2663,7 +2849,9 @@ paths: type: string - name: updateMask in: query - description: Optional. The list of fields to update. + description: |- + Optional. The fields to update. Supported paths: title, filter, icon. The + service rejects an empty mask. schema: type: string format: field-mask @@ -2686,11 +2874,11 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' - /api/v1/users/{user}/webhooks: + /api/users/{user}/webhooks: get: tags: - UserService - description: ListUserWebhooks returns a list of webhooks for a user. + description: ListUserWebhooks lists a user's webhooks. Only the user may call it. operationId: UserService_ListUserWebhooks parameters: - name: user @@ -2715,7 +2903,9 @@ paths: post: tags: - UserService - description: CreateUserWebhook creates a new webhook for a user. + description: |- + CreateUserWebhook creates a webhook for a user. Only the user may call it. + The service generates a signing secret when none is given. operationId: UserService_CreateUserWebhook parameters: - name: user @@ -2743,11 +2933,11 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' - /api/v1/users/{user}/webhooks/{webhook}: + /api/users/{user}/webhooks/{webhook}: delete: tags: - UserService - description: DeleteUserWebhook deletes a webhook for a user. + description: DeleteUserWebhook deletes a webhook. Only the owner may call it. operationId: UserService_DeleteUserWebhook parameters: - name: user @@ -2775,7 +2965,7 @@ paths: patch: tags: - UserService - description: UpdateUserWebhook updates an existing webhook for a user. + description: UpdateUserWebhook updates a webhook. Only the owner may call it. operationId: UserService_UpdateUserWebhook parameters: - name: user @@ -2792,7 +2982,10 @@ paths: type: string - name: updateMask in: query - description: The list of fields to update. + description: |- + The fields to update. Supported paths: url, display_name, signing_secret. + When unset, all of them are updated, skipping an empty url or + signing_secret. schema: type: string format: field-mask @@ -2815,14 +3008,14 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' - /api/v1/users/{user}/webhooks/{webhook}:getSigningSecret: + /api/users/{user}/webhooks/{webhook}:getSigningSecret: get: tags: - UserService description: |- - GetUserWebhookSigningSecret returns the signing secret for a webhook. - The secret is returned only through this explicit, owner-gated call; it is - never included in List/Create/Update responses. + 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. operationId: UserService_GetUserWebhookSigningSecret parameters: - name: user @@ -2850,7 +3043,7 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' - /api/v1/users/{user}:exportMemos: + /api/users/{user}:exportMemos: get: tags: - UserService @@ -2878,11 +3071,13 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' - /api/v1/users/{user}:getStats: + /api/users/{user}:getStats: get: tags: - UserService - description: GetUserStats returns statistics for a specific user. + description: |- + GetUserStats returns memo statistics for one user, counting the user's + memos that the caller can read. operationId: UserService_GetUserStats parameters: - name: user @@ -2894,8 +3089,8 @@ paths: - name: filter in: query description: |- - Optional. CEL expression selecting the readable non-comment memos to - include. Supports the same fields as ListMemos, including `space`. + Optional. A CEL expression selecting the readable non-comment memos to + count. Supports the same fields as ListMemos, including `space`. schema: type: string responses: @@ -2911,13 +3106,13 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' - /api/v1/users/{user}:importMemos: + /api/users/{user}:importMemos: post: tags: - UserService description: |- - 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 + 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 @@ -2950,11 +3145,13 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' - /api/v1/users:batchGet: + /api/users:batchGet: post: tags: - UserService - description: BatchGetUsers returns active users by usernames. + description: |- + BatchGetUsers gets active users by username. Usernames that match no + active user are omitted from the response. operationId: UserService_BatchGetUsers requestBody: content: @@ -2975,43 +3172,6 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' - /api/v1/users:stats: - get: - tags: - - UserService - description: ListAllUserStats returns statistics for all users. - operationId: UserService_ListAllUserStats - parameters: - - name: state - in: query - description: Optional. The state of memos to include. Defaults to NORMAL. - schema: - enum: - - STATE_UNSPECIFIED - - NORMAL - - ARCHIVED - type: string - format: enum - - name: filter - in: query - description: |- - Optional. Filter to apply to memo stats. - Uses the same filter syntax as ListMemos. - schema: - type: string - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/ListAllUserStatsResponse' - default: - description: Default error response - content: - application/json: - schema: - $ref: '#/components/schemas/Status' components: schemas: AcceptSpaceInvitationRequest: @@ -3021,7 +3181,10 @@ components: properties: name: type: string - description: 'Required. Format: spaces/{space}/invitations/{username}.' + description: |- + Required. The resource name of the invitation. + Format: spaces/{space}/invitations/{invitation} + description: Request message for SpaceService.AcceptSpaceInvitation. Attachment: required: - filename @@ -3031,16 +3194,22 @@ components: name: type: string description: |- - The name of the attachment. + Identifier. The resource name of the attachment. Format: attachments/{attachment} - createTime: + creator: readOnly: true type: string - description: Output only. The creation timestamp. - format: date-time + description: |- + Output only. The user who uploaded the attachment, which may differ from the creator of the linked memo. + Format: users/{user} filename: type: string - description: The filename of the attachment. + description: Required. The filename of the attachment. + type: + type: string + description: |- + Required. The MIME type of the attachment. If empty on create, the service detects it from the filename and + content. content: writeOnly: true type: string @@ -3048,33 +3217,32 @@ components: format: bytes externalLink: type: string - description: Optional. The external link of the attachment. - type: - type: string - description: The MIME type of the attachment. - size: - readOnly: true - type: string - description: Output only. The size of the attachment in bytes. - memo: - type: string - description: |- - Optional. The related memo. Refer to `Memo.name`. - Format: memos/{memo} + description: Optional. The external link of the attachment. Set only for externally stored attachments; ignored on create. motionMedia: allOf: - $ref: '#/components/schemas/MotionMedia' - description: Optional. Motion media metadata. + description: |- + Optional. Motion photo metadata. Clients may only supply Apple Live Photo metadata; the service detects Android + motion photos in JPEG content. mediaMetadata: allOf: - $ref: '#/components/schemas/MediaMetadata' - description: Optional. Immutable normalized media metadata explicitly supplied by the client at creation time. - creator: - readOnly: true + description: Optional. Normalized media metadata supplied by the client at creation time. Immutable after creation. + memo: type: string description: |- - Output only. The user who uploaded this attachment, which may differ from - the creator of the linked memo. Format: users/{user}. + Optional. The memo the attachment is linked to. On create, the caller must be able to manage the memo. + Format: memos/{memo} + size: + readOnly: true + type: string + description: Output only. The size of the stored content in bytes. + createTime: + readOnly: true + type: string + description: Output only. The creation time. + format: date-time + description: Attachment is a file uploaded by a user, optionally linked to a memo. BatchDeleteAttachmentsRequest: required: - names @@ -3084,6 +3252,10 @@ components: type: array items: type: string + description: |- + Required. The names of the attachments to delete, at most 100. Duplicate names are ignored. + Format: attachments/{attachment} + description: Request message for AttachmentService.BatchDeleteAttachments. BatchGetInstanceSettingsRequest: required: - names @@ -3094,18 +3266,18 @@ components: items: type: string description: |- - The resource names of the instance settings. + Required. The resource names of the instance settings. At most 100. Format: instance/settings/{setting} - description: Request message for BatchGetInstanceSettings method. + description: Request message for InstanceService.BatchGetInstanceSettings. BatchGetInstanceSettingsResponse: type: object properties: - settings: + instanceSettings: type: array items: $ref: '#/components/schemas/InstanceSetting' - description: The instance settings in the same order as the input names. - description: Response message for BatchGetInstanceSettings method. + description: The instance settings, in the same order as the requested names. + description: Response message for InstanceService.BatchGetInstanceSettings. BatchGetLinkMetadataRequest: required: - urls @@ -3115,7 +3287,8 @@ components: type: array items: type: string - description: Required. The link URLs. + description: Required. The link URLs. At most 10. + description: Request message for MemoService.BatchGetLinkMetadata. BatchGetLinkMetadataResponse: type: object properties: @@ -3123,14 +3296,22 @@ components: type: array items: $ref: '#/components/schemas/LinkMetadata' - description: The link metadata list, in the same order as the input URLs. + description: The link metadata, in the same order as the requested URLs. + description: Response message for MemoService.BatchGetLinkMetadata. BatchGetUsersRequest: + required: + - names type: object properties: - usernames: + names: type: array items: type: string + description: |- + Required. The resource names of the users to get. Empty and duplicate + entries are ignored. At most 100 non-empty names are allowed. + Format: users/{user} + description: Request message for UserService.BatchGetUsers. BatchGetUsersResponse: type: object properties: @@ -3138,6 +3319,8 @@ components: type: array items: $ref: '#/components/schemas/User' + description: The active users that match the requested names. + description: Response message for UserService.BatchGetUsers. Color: type: object properties: @@ -3296,7 +3479,7 @@ components: CreateLinkedIdentityRequest: required: - parent - - idpName + - identityProvider - code - redirectUri type: object @@ -3304,9 +3487,9 @@ components: parent: type: string description: |- - Required. The parent user who owns the linked identity. + Required. The user who owns the linked identity. Must be the caller. Format: users/{user} - idpName: + identityProvider: type: string description: |- Required. The identity provider to link. @@ -3320,6 +3503,7 @@ components: codeVerifier: type: string description: Optional. The PKCE code verifier used in the OAuth flow. + description: Request message for UserService.CreateLinkedIdentity. CreatePersonalAccessTokenRequest: required: - parent @@ -3328,15 +3512,18 @@ components: parent: type: string description: |- - Required. The parent resource where this token will be created. + Required. The user who owns the token. Must be the caller. Format: users/{user} description: type: string - description: Optional. Description of the personal access token. + description: Optional. The description of the token. expiresInDays: type: integer - description: Optional. Expiration duration in days (0 = never expires). + description: |- + Optional. The lifetime of the token in days. 0 means the token never + expires. format: int32 + description: Request message for UserService.CreatePersonalAccessToken. CreatePersonalAccessTokenResponse: type: object properties: @@ -3346,9 +3533,8 @@ components: description: The personal access token metadata. token: type: string - description: |- - The actual token value - only returned on creation. - This is the only time the token value will be visible. + description: The token value. This is the only time it is returned. + description: Response message for UserService.CreatePersonalAccessToken. DeclineSpaceInvitationRequest: required: - name @@ -3356,41 +3542,56 @@ components: properties: name: type: string - description: 'Required. Format: spaces/{space}/invitations/{username}.' + description: |- + Required. The resource name of the invitation. + Format: spaces/{space}/invitations/{invitation} + description: Request message for SpaceService.DeclineSpaceInvitation. FieldMapping: type: object properties: identifier: type: string + description: The claim that uniquely identifies the user. Sign-in fails when it is missing or empty. displayName: type: string + description: The claim used as the display name. Falls back to the identifier when unset. email: type: string + description: The claim used as the email address. avatarUrl: type: string + description: The claim used as the avatar URL. + description: |- + FieldMapping maps user info claims of an OAuth2 identity provider to user fields. + Each field holds the name of a claim. GeneralSetting_CustomProfile: type: object properties: title: type: string + description: The instance title. description: type: string + description: The instance description. logoUrl: type: string - description: Custom profile configuration for instance branding. + description: The URL of the instance logo. + description: CustomProfile is the instance branding. GetCurrentUserResponse: type: object properties: user: allOf: - $ref: '#/components/schemas/User' - description: The authenticated user's information. + description: The authenticated user. + description: Response message for AuthService.GetCurrentUser. GetUserWebhookSigningSecretResponse: type: object properties: signingSecret: type: string description: The signing secret, in the Standard Webhooks "whsec_" form. + description: Response message for UserService.GetUserWebhookSigningSecret. GoogleProtobufAny: type: object properties: @@ -3409,7 +3610,7 @@ components: name: type: string description: |- - The resource name of the identity provider. + Identifier. The resource name of the identity provider. Format: identity-providers/{idp} type: enum: @@ -3423,16 +3624,101 @@ components: description: Required. The display title of the identity provider. identifierFilter: type: string - description: Optional. Filter applied to user identifiers. + description: Optional. A regular expression the user identifier must match to sign in. Empty allows every identifier. config: allOf: - $ref: '#/components/schemas/IdentityProviderConfig' - description: Required. Configuration for the identity provider. + description: Required. The type-specific configuration of the identity provider. + description: IdentityProvider is an external identity provider users can sign in with. IdentityProviderConfig: type: object properties: oauth2Config: - $ref: '#/components/schemas/OAuth2Config' + allOf: + - $ref: '#/components/schemas/OAuth2Config' + description: The configuration of an OAuth2 identity provider. + description: IdentityProviderConfig is the type-specific configuration of an identity provider. + ImportMemosIssue: + type: object + properties: + memoUid: + type: string + description: The archive memo UID the issue concerns, if any. + message: + type: string + description: A description of the issue. + description: |- + ImportMemosIssue is one warning or failure of an import, tied to the memo + UID from the archive when there is one. + ImportMemosPlan: + type: object + properties: + exportTime: + type: string + description: When the archive was written. + format: date-time + exporter: + type: string + description: Username of the user who exported the archive. + generator: + type: string + description: The software that wrote the archive. + memoCount: + type: integer + description: Number of memo records in the archive. + format: int32 + attachmentCount: + type: integer + description: Number of attachment files in the archive. + format: int32 + new: + type: integer + description: Memos whose UID nobody on the instance holds. + format: int32 + existing: + type: integer + description: Memos the user already holds; the conflict policy applies to them. + format: int32 + renamed: + type: integer + description: Memos whose UID another account holds; they are imported under fresh UIDs. + format: int32 + warnings: + type: array + items: + $ref: '#/components/schemas/ImportMemosIssue' + description: Deviations the archive reader corrected while validating. + description: ImportMemosPlan describes what importing a staged archive would do. + ImportMemosReport: + type: object + properties: + created: + type: integer + description: Number of memos created. + format: int32 + updated: + type: integer + description: Number of existing memos replaced under the REPLACE policy. + format: int32 + skipped: + type: integer + description: Number of existing memos left untouched under the SKIP policy. + format: int32 + failed: + type: integer + description: Number of memos that could not be imported. + format: int32 + warnings: + type: array + items: + $ref: '#/components/schemas/ImportMemosIssue' + description: Deviations the importer corrected or tolerated. + failures: + type: array + items: + $ref: '#/components/schemas/ImportMemosIssue' + description: One entry per failed memo, with the reason. + description: ImportMemosReport is the outcome of an import. ImportMemosRequest: required: - name @@ -3471,12 +3757,6 @@ components: then equal total_size. The archive is validated and, unless validate_only is set, imported. Any later call for an imported upload returns the same report. - validateOnly: - type: boolean - description: |- - Optional. On a finishing call, validate the archive and return the plan - without importing. The upload stays staged so a later finishing call can - import it. conflictPolicy: enum: - CONFLICT_POLICY_UNSPECIFIED @@ -3486,6 +3766,13 @@ components: type: string description: Optional. Read on the finishing call that imports. Unspecified means SKIP. format: enum + validateOnly: + type: boolean + description: |- + Optional. On a finishing call, validate the archive and return the plan + without importing. The upload stays staged so a later finishing call can + import it. + description: Request message for UserService.ImportMemos. ImportMemosResponse: type: object properties: @@ -3501,58 +3788,63 @@ components: format: int32 plan: allOf: - - $ref: '#/components/schemas/MemoImportPlan' + - $ref: '#/components/schemas/ImportMemosPlan' description: What the import would do. Set by a finishing call with validate_only. report: allOf: - - $ref: '#/components/schemas/MemoImportReport' + - $ref: '#/components/schemas/ImportMemosReport' description: What the import did. Set by a finishing call that imported. + description: Response message for UserService.ImportMemos. ImportMemosSpec: type: object properties: totalSize: type: string description: Optional. Total size of the archive in bytes. + description: ImportMemosSpec describes a new memo import upload. InstanceProfile: type: object properties: version: type: string - description: Version is the current version of instance. - demo: - type: boolean - description: Demo indicates if the instance is in demo mode. - instanceUrl: - type: string - description: Instance URL is the URL of the instance. - admin: - allOf: - - $ref: '#/components/schemas/User' - description: |- - The first administrator who set up this instance, for display purposes. - May be null on an instance that has lost all admins; use needs_setup to - determine whether initial setup is actually required. + description: The version of the running server. commit: type: string - description: Commit is the current build commit of instance. - needsSetup: + description: The build commit of the running server. + demo: type: boolean - description: |- - NeedsSetup is true when the instance has no users yet and requires initial - setup (creating the first admin account). Unlike a null admin, this stays - false once any user exists, so an instance that has lost its admins is not - mistaken for a fresh install. + description: Whether the instance runs in demo mode. + instanceUrl: + type: string + description: The configured URL of the instance. accessMode: enum: - INSTANCE_ACCESS_MODE_UNSPECIFIED - INSTANCE_ACCESS_MODE_PRIVATE - INSTANCE_ACCESS_MODE_PUBLIC type: string - description: Access mode controls whether unauthenticated users may access instance content. + description: Whether unauthenticated users may access instance content. format: enum + needsSetup: + type: boolean + description: |- + Whether the instance has no users yet and requires initial setup (creating the first admin account). + Unlike a null admin, this stays false once any user exists, so an instance that has lost its admins is not + mistaken for a fresh install. + admin: + allOf: + - $ref: '#/components/schemas/User' + description: |- + The first administrator of the instance, for display purposes. + May be null on an instance that has lost all admins; use needs_setup to determine whether initial setup is + required. challenge: - $ref: '#/components/schemas/InstanceProfile_Challenge' - description: Instance profile message containing basic instance information. + allOf: + - $ref: '#/components/schemas/InstanceProfile_Challenge' + description: |- + The proof-of-humanity challenge required on signup and password sign-in. + Absent when none is configured, which is the case on every self-hosted instance. + description: InstanceProfile is the basic information about the instance. InstanceProfile_Challenge: type: object properties: @@ -3562,62 +3854,77 @@ components: siteKey: type: string description: The provider's public site key for the widget. - description: |- - A proof-of-humanity challenge the deployment requires on signup and - password sign-in. Absent when none is configured, which is the case on - every self-hosted instance. + description: Challenge describes a proof-of-humanity challenge widget. InstanceSetting: type: object properties: name: type: string description: |- - The name of the instance setting. + Identifier. The resource name of the instance setting. {setting} is a Key value, such as GENERAL. Format: instance/settings/{setting} generalSetting: - $ref: '#/components/schemas/InstanceSetting_GeneralSetting' + allOf: + - $ref: '#/components/schemas/InstanceSetting_GeneralSetting' + description: The value of the GENERAL setting. storageSetting: - $ref: '#/components/schemas/InstanceSetting_StorageSetting' + allOf: + - $ref: '#/components/schemas/InstanceSetting_StorageSetting' + description: The value of the STORAGE setting. memoRelatedSetting: - $ref: '#/components/schemas/InstanceSetting_MemoRelatedSetting' + allOf: + - $ref: '#/components/schemas/InstanceSetting_MemoRelatedSetting' + description: The value of the MEMO_RELATED setting. tagsSetting: - $ref: '#/components/schemas/InstanceSetting_TagsSetting' + allOf: + - $ref: '#/components/schemas/InstanceSetting_TagsSetting' + description: The value of the TAGS setting. notificationSetting: - $ref: '#/components/schemas/InstanceSetting_NotificationSetting' + allOf: + - $ref: '#/components/schemas/InstanceSetting_NotificationSetting' + description: The value of the NOTIFICATION setting. aiSetting: - $ref: '#/components/schemas/InstanceSetting_AISetting' + allOf: + - $ref: '#/components/schemas/InstanceSetting_AISetting' + description: The value of the AI setting. accessSetting: - $ref: '#/components/schemas/InstanceSetting_AccessSetting' - description: An instance setting resource. + allOf: + - $ref: '#/components/schemas/InstanceSetting_AccessSetting' + description: The value of the ACCESS setting. + description: InstanceSetting is one group of instance-wide settings, selected by its key. InstanceSetting_AIProviderConfig: type: object properties: id: type: string + description: The provider ID. Generated when empty on update. title: type: string + description: The provider display title. type: enum: - AI_PROVIDER_TYPE_UNSPECIFIED - OPENAI - GEMINI type: string + description: The provider implementation type. format: enum endpoint: type: string + description: The provider API endpoint. Defaults to the provider's public endpoint when empty. apiKey: writeOnly: true type: string - description: api_key is write-only and is never returned by GetInstanceSetting. + description: Input only. The provider API key. Never returned; an empty value keeps the stored key. apiKeySet: readOnly: true type: boolean - description: api_key_set indicates whether an API key is stored for this provider. + description: Output only. Whether an API key is stored for this provider. apiKeyHint: readOnly: true type: string - description: api_key_hint is a masked hint for the stored API key. - description: AIProviderConfig represents one callable AI provider connection. + description: Output only. A masked hint of the stored API key. + description: AIProviderConfig is one callable AI provider connection. InstanceSetting_AISetting: type: object properties: @@ -3625,14 +3932,15 @@ components: type: array items: $ref: '#/components/schemas/InstanceSetting_AIProviderConfig' - description: providers is the list of AI provider configurations available instance-wide. + description: The AI provider configurations available instance-wide. transcription: allOf: - $ref: '#/components/schemas/InstanceSetting_TranscriptionConfig' description: |- - transcription is the speech-to-text feature configuration. - When unset or transcription.provider_id is empty, transcription is disabled. - description: AI provider configuration settings. + The speech-to-text feature configuration. + When unset or transcription.provider_id is empty, transcription is disabled. An update that omits it keeps the + stored configuration. + description: AISetting is the AI provider configuration. InstanceSetting_AccessSetting: type: object properties: @@ -3642,72 +3950,75 @@ components: - INSTANCE_ACCESS_MODE_PRIVATE - INSTANCE_ACCESS_MODE_PUBLIC type: string + description: Whether unauthenticated users may access instance content. Must be PRIVATE or PUBLIC on update. format: enum - description: Access policy configuration for the instance. + description: AccessSetting is the instance access policy. InstanceSetting_GeneralSetting: type: object properties: - disallowUserRegistration: - type: boolean - description: disallow_user_registration disallows user registration. - disallowPasswordAuth: - type: boolean - description: disallow_password_auth disallows password authentication. - additionalScript: - type: string - description: additional_script is the additional script. - additionalStyle: - type: string - description: additional_style is the additional style. customProfile: allOf: - $ref: '#/components/schemas/GeneralSetting_CustomProfile' - description: custom_profile is the custom profile. + description: Branding shown in the web app. + disallowUserRegistration: + type: boolean + description: Whether user self-registration is disabled. + disallowPasswordAuth: + type: boolean + description: Whether password authentication is disabled. + disallowChangeUsername: + type: boolean + description: Whether users are prevented from changing their username. + disallowChangeNickname: + type: boolean + description: Whether users are prevented from changing their nickname. weekStartDayOffset: type: integer description: |- - week_start_day_offset is the week start day offset from Sunday. - 0: Sunday, 1: Monday, 2: Tuesday, 3: Wednesday, 4: Thursday, 5: Friday, 6: Saturday + The first day of the week as an offset from Sunday. + 0: Sunday, 1: Monday, 2: Tuesday, 3: Wednesday, 4: Thursday, 5: Friday, 6: Saturday. Default is Sunday. format: int32 - disallowChangeUsername: - type: boolean - description: disallow_change_username disallows changing username. - disallowChangeNickname: - type: boolean - description: disallow_change_nickname disallows changing nickname. - description: General instance settings configuration. + additionalStyle: + type: string + description: Custom CSS injected into the web app. + additionalScript: + type: string + description: Custom JavaScript injected into the web app. + description: GeneralSetting is the general instance configuration. InstanceSetting_MemoRelatedSetting: type: object properties: contentLengthLimit: type: integer - description: content_length_limit is the limit of content length. Unit is byte. + description: The maximum memo content length in bytes. Default and minimum is 8192. format: int32 - enableDoubleClickEdit: - type: boolean - description: enable_double_click_edit enables editing on double click. reactions: type: array items: type: string - description: reactions is the list of reactions. - description: Memo-related instance settings and policies. + description: The reactions users can choose from. Defaults to a built-in emoji set when empty. + enableDoubleClickEdit: + type: boolean + description: Whether double-clicking a memo opens it for editing. + description: MemoRelatedSetting is the memo-related instance configuration. InstanceSetting_NotificationSetting: type: object properties: email: - $ref: '#/components/schemas/NotificationSetting_EmailSetting' - description: Notification transport configuration. + allOf: + - $ref: '#/components/schemas/NotificationSetting_EmailSetting' + description: The email delivery configuration. + description: NotificationSetting is the notification transport configuration. InstanceSetting_Storage: type: object properties: id: type: string - description: id is the stable identifier referenced by attachments. + description: The stable identifier referenced by attachments. name: type: string - description: name is the human-readable storage name. + description: The human-readable storage name. type: enum: - STORAGE_TYPE_UNSPECIFIED @@ -3715,13 +4026,32 @@ components: - LOCAL - S3 type: string + description: The storage backend. format: enum s3Config: - $ref: '#/components/schemas/Storage_S3Config' + allOf: + - $ref: '#/components/schemas/Storage_S3Config' + description: The configuration of an S3 storage. description: Storage is a configured attachment storage instance. InstanceSetting_StorageSetting: type: object properties: + storages: + type: array + items: + $ref: '#/components/schemas/InstanceSetting_Storage' + description: Configured storage instances, including inactive instances still referenced by attachments. + defaultStorageId: + type: string + description: The ID of the storage used for new attachments. + filepathTemplate: + type: string + description: |- + The template of attachment file paths. + Default is assets/{timestamp}_{uuid}_{filename}. + uploadSizeLimitMb: + type: string + description: The maximum upload size in megabytes. Default is 30. storageType: enum: - STORAGE_TYPE_UNSPECIFIED @@ -3731,40 +4061,22 @@ components: type: string description: Legacy compatibility field. New clients use default_storage_id. format: enum - filepathTemplate: - type: string - description: |- - The template of file path. - e.g. assets/{timestamp}_{filename} - uploadSizeLimitMb: - type: string - description: The max upload size in megabytes. s3Config: allOf: - $ref: '#/components/schemas/StorageSetting_S3Config' description: Legacy compatibility field. New clients use storages. - storages: - type: array - items: - $ref: '#/components/schemas/InstanceSetting_Storage' - description: Configured storage instances, including inactive instances referenced by attachments. - defaultStorageId: - type: string - description: Storage used for new attachments. - description: Storage configuration settings for instance attachments. + description: StorageSetting is the attachment storage configuration. InstanceSetting_TagMetadata: type: object properties: backgroundColor: allOf: - $ref: '#/components/schemas/Color' - description: |- - Optional background color for the tag label. - When unset, the default tag color is used. + description: The background color of the tag label. When unset, the default tag color is used. blurContent: type: boolean - description: Whether memos with this tag should have their content blurred. - description: Metadata for a tag. + description: Whether memos with this tag have their content blurred. + description: TagMetadata is the display metadata for a tag. InstanceSetting_TagsSetting: type: object properties: @@ -3774,101 +4086,95 @@ components: $ref: '#/components/schemas/InstanceSetting_TagMetadata' description: |- Map of tag name pattern to tag metadata. - Each key is treated as an anchored regular expression (^pattern$), - so a single entry like "project/.*" matches all tags under that prefix. - Exact tag names are also valid (they are trivially valid regex patterns). + Each key is treated as an anchored regular expression (^pattern$), so a single entry like "project/.*" matches + all tags under that prefix. Exact tag names are also valid. description: |- - Tag metadata configuration. - Active tag metadata is stored in per-user tag settings. - This message remains for backward compatibility with existing clients and migrations. + TagsSetting is the instance-wide tag metadata configuration. + Active tag metadata is stored in per-user tag settings. This message remains for backward compatibility with + existing clients and migrations. InstanceSetting_TranscriptionConfig: type: object properties: providerId: type: string description: |- - provider_id references an entry in AISetting.providers[].id. - Empty string means transcription is disabled. + The ID of the provider used for transcription; must reference an entry in AISetting.providers. + Empty means transcription is disabled. model: type: string description: |- - model is the provider-specific model identifier. - Empty string falls back to the engine default - (whisper-1 for OPENAI providers, gemini-2.5-flash for GEMINI providers). + The provider-specific model identifier. Hidden from non-admins. + Empty falls back to the engine default (whisper-1 for OPENAI providers, gemini-2.5-flash for GEMINI providers). language: type: string description: |- - language is the default ISO 639-1 language hint sent to the provider. - Empty string lets the provider auto-detect. + The default ISO 639-1 language hint sent to the provider. Hidden from non-admins. + Empty lets the provider auto-detect. prompt: type: string - description: prompt is a default spelling/vocabulary hint passed to the provider. - description: TranscriptionConfig configures the speech-to-text feature. + description: A default spelling and vocabulary hint passed to the provider. Hidden from non-admins. + description: TranscriptionConfig is the speech-to-text feature configuration. InstanceStats: type: object properties: database: - $ref: '#/components/schemas/InstanceStats_DatabaseStats' + allOf: + - $ref: '#/components/schemas/InstanceStats_DatabaseStats' + description: The database size statistics. localStorageBytes: type: string - description: Recursive size of the data directory in bytes. -1 if unavailable. + description: The recursive size of the data directory in bytes. -1 if unavailable. generatedTime: type: string - description: Server-side timestamp when the snapshot was generated. + description: The time the snapshot was generated on the server. format: date-time - description: Resource usage statistics for the instance. + description: InstanceStats is a snapshot of the instance's resource usage. InstanceStats_DatabaseStats: type: object properties: driver: type: string - description: driver is one of "sqlite", "mysql", "postgres". + description: 'The database driver: "sqlite", "mysql" or "postgres".' sizeBytes: type: string - description: size_bytes is the database size in bytes; -1 if unavailable. - description: Database size statistics. + description: The database size in bytes. -1 if unavailable. + description: DatabaseStats is the database size statistics. LinkMetadata: type: object properties: url: type: string - description: The original link URL. + description: The link URL as given in the request. title: type: string - description: The link title. + description: The page title. description: type: string - description: The link description. + description: The page description. image: type: string - description: The link image URL. + description: The preview image URL. + description: LinkMetadata is the preview metadata of a web link. LinkedIdentity: type: object properties: name: type: string description: |- - The resource name of the linked identity. + Identifier. The resource name of the linked identity. {linked_identity} is + the ID of the identity provider. Format: users/{user}/linkedIdentities/{linked_identity} - idpName: + identityProvider: readOnly: true type: string description: |- - The resource name of the identity provider. + Output only. The resource name of the identity provider. Format: identity-providers/{idp} - externUid: + externalUid: readOnly: true type: string - description: The external user identifier from the identity provider. - description: LinkedIdentity represents an SSO identity linked to a user account. - ListAllUserStatsResponse: - type: object - properties: - stats: - type: array - items: - $ref: '#/components/schemas/UserStats' - description: The list of user statistics. + description: Output only. The external user identifier from the identity provider. + description: LinkedIdentity is an SSO identity linked to a user account. ListAttachmentsResponse: type: object properties: @@ -3876,12 +4182,11 @@ components: type: array items: $ref: '#/components/schemas/Attachment' - description: The list of attachments. + description: The attachments. nextPageToken: type: string - description: |- - A token that can be sent as `page_token` to retrieve the next page. - If this field is omitted, there are no subsequent pages. + description: A token to retrieve the next page. Empty when there are no more pages. + description: Response message for AttachmentService.ListAttachments. ListIdentityProvidersResponse: type: object properties: @@ -3889,7 +4194,8 @@ components: type: array items: $ref: '#/components/schemas/IdentityProvider' - description: The list of identity providers. + description: The identity providers. + description: Response message for IdentityProviderService.ListIdentityProviders. ListLinkedIdentitiesResponse: type: object properties: @@ -3897,7 +4203,8 @@ components: type: array items: $ref: '#/components/schemas/LinkedIdentity' - description: The list of linked identities. + description: The linked identities. + description: Response message for UserService.ListLinkedIdentities. ListMemoAttachmentsResponse: type: object properties: @@ -3905,21 +4212,23 @@ components: type: array items: $ref: '#/components/schemas/Attachment' - description: The list of attachments. + description: The attachments. nextPageToken: type: string - description: A token for the next page of results. + description: A token to retrieve the next page. Empty when there are no more pages. + description: Response message for MemoService.ListMemoAttachments. ListMemoCommentsResponse: type: object properties: - memos: + comments: type: array items: $ref: '#/components/schemas/Memo' - description: The list of comment memos. + description: The comment memos. nextPageToken: type: string - description: A token for the next page of results. + description: A token to retrieve the next page. Empty when there are no more pages. + description: Response message for MemoService.ListMemoComments. ListMemoReactionsResponse: type: object properties: @@ -3927,10 +4236,11 @@ components: type: array items: $ref: '#/components/schemas/Reaction' - description: The list of reactions. + description: The reactions. nextPageToken: type: string - description: A token for the next page of results. + description: A token to retrieve the next page. Empty when there are no more pages. + description: Response message for MemoService.ListMemoReactions. ListMemoRelationsResponse: type: object properties: @@ -3938,10 +4248,11 @@ components: type: array items: $ref: '#/components/schemas/MemoRelation' - description: The list of relations. + description: The relations. nextPageToken: type: string - description: A token for the next page of results. + description: A token to retrieve the next page. Empty when there are no more pages. + description: Response message for MemoService.ListMemoRelations. ListMemoSharesResponse: type: object properties: @@ -3949,7 +4260,8 @@ components: type: array items: $ref: '#/components/schemas/MemoShare' - description: The list of share links. + description: The share links. + description: Response message for MemoService.ListMemoShares. ListMemoViewsResponse: type: object properties: @@ -3957,7 +4269,8 @@ components: type: array items: $ref: '#/components/schemas/MemoView' - description: The list of memo views. + description: The memo views. + description: Response message for UserService.ListMemoViews. ListMemosResponse: type: object properties: @@ -3965,12 +4278,11 @@ components: type: array items: $ref: '#/components/schemas/Memo' - description: The list of memos. + description: The memos. nextPageToken: type: string - description: |- - A token that can be sent as `page_token` to retrieve the next page. - If this field is omitted, there are no subsequent pages. + description: A token to retrieve the next page. Empty when there are no more pages. + description: Response message for MemoService.ListMemos. ListPersonalAccessTokensResponse: type: object properties: @@ -3978,10 +4290,11 @@ components: type: array items: $ref: '#/components/schemas/PersonalAccessToken' - description: The list of personal access tokens. + description: The personal access tokens, without their token values. nextPageToken: type: string - description: A token for the next page of results. + description: A token to retrieve the next page. Empty when there are no more pages. + description: Response message for UserService.ListPersonalAccessTokens. ListSpaceInvitationsResponse: type: object properties: @@ -3989,8 +4302,11 @@ components: type: array items: $ref: '#/components/schemas/SpaceInvitation' + description: The pending invitations for the space. nextPageToken: type: string + description: A token to retrieve the next page. Empty when there are no more pages. + description: Response message for SpaceService.ListSpaceInvitations. ListSpaceMembersResponse: type: object properties: @@ -3998,8 +4314,11 @@ components: type: array items: $ref: '#/components/schemas/SpaceMember' + description: The members of the space. nextPageToken: type: string + description: A token to retrieve the next page. Empty when there are no more pages. + description: Response message for SpaceService.ListSpaceMembers. ListSpacesResponse: type: object properties: @@ -4007,8 +4326,11 @@ components: type: array items: $ref: '#/components/schemas/Space' + description: The spaces of which the caller is a member. nextPageToken: type: string + description: A token to retrieve the next page. Empty when there are no more pages. + description: Response message for SpaceService.ListSpaces. ListUserNotificationsResponse: type: object properties: @@ -4016,22 +4338,23 @@ components: type: array items: $ref: '#/components/schemas/UserNotification' + description: The notifications. nextPageToken: type: string + description: A token to retrieve the next page. Empty when there are no more pages. + description: Response message for UserService.ListUserNotifications. ListUserSettingsResponse: type: object properties: - settings: + userSettings: type: array items: $ref: '#/components/schemas/UserSetting' - description: The list of user settings. + description: The user settings. nextPageToken: type: string - description: |- - A token that can be sent as `page_token` to retrieve the next page. - If this field is omitted, there are no subsequent pages. - description: Response message for ListUserSettings method. + description: A token to retrieve the next page. Empty when there are no more pages. + description: Response message for UserService.ListUserSettings. ListUserSpaceInvitationsResponse: type: object properties: @@ -4039,8 +4362,20 @@ components: type: array items: $ref: '#/components/schemas/SpaceInvitation' + description: The pending invitations received by the user. nextPageToken: type: string + description: A token to retrieve the next page. Empty when there are no more pages. + description: Response message for SpaceService.ListUserSpaceInvitations. + ListUserStatsResponse: + type: object + properties: + userStats: + type: array + items: + $ref: '#/components/schemas/UserStats' + description: The statistics, one entry per user. + description: Response message for UserService.ListUserStats. ListUserWebhooksResponse: type: object properties: @@ -4048,7 +4383,8 @@ components: type: array items: $ref: '#/components/schemas/UserWebhook' - description: The list of webhooks. + description: The webhooks. + description: Response message for UserService.ListUserWebhooks. ListUsersResponse: type: object properties: @@ -4056,99 +4392,108 @@ components: type: array items: $ref: '#/components/schemas/User' - description: The list of users. + description: The users. nextPageToken: type: string - description: |- - A token that can be sent as `page_token` to retrieve the next page. - If this field is omitted, there are no subsequent pages. + description: A token to retrieve the next page. Empty when there are no more pages. + description: Response message for UserService.ListUsers. Location: type: object properties: placeholder: type: string - description: A placeholder text for the location. + description: Optional. A human-readable label for the location. latitude: type: number - description: The latitude of the location. + description: Optional. The latitude of the location. format: double longitude: type: number - description: The longitude of the location. + description: Optional. The longitude of the location. format: double + description: Location is a geographic location attached to a memo. MediaCaptureTime: type: object properties: localDateTime: type: string + description: Local date and time without a time zone, formatted as YYYY-MM-DDTHH:mm:ss[.fraction]. utcOffset: type: string + description: UTC offset formatted as Z or +/-HH:MM. + description: MediaCaptureTime is the local time at which media was captured. MediaLocation: type: object properties: latitude: type: number + description: WGS84 latitude in decimal degrees. Must be provided with longitude. format: double longitude: type: number + description: WGS84 longitude in decimal degrees. Must be provided with latitude. format: double altitudeMeters: type: number + description: Signed altitude in meters relative to sea level. format: double + description: MediaLocation is the geographic location at which media was captured. MediaMetadata: type: object properties: width: type: integer + description: Display-oriented width in pixels. Must be provided with height. format: int32 height: type: integer + description: Display-oriented height in pixels. Must be provided with width. format: int32 photo: - $ref: '#/components/schemas/PhotoMetadata' + allOf: + - $ref: '#/components/schemas/PhotoMetadata' + description: Photo metadata, for image attachments. video: - $ref: '#/components/schemas/VideoMetadata' + allOf: + - $ref: '#/components/schemas/VideoMetadata' + description: Video metadata, for video attachments. + description: |- + MediaMetadata contains normalized metadata explicitly supplied by a client. + The service validates and stores this data but does not extract it from the media file. Memo: required: - - state - content - visibility + - state type: object properties: name: type: string description: |- - The resource name of the memo. - Format: memos/{memo}, where memo is the user-defined UID. - state: - enum: - - STATE_UNSPECIFIED - - NORMAL - - ARCHIVED - type: string - description: The state of the memo. - format: enum + Identifier. The resource name of the memo, where memo is the + user-defined UID. + Format: memos/{memo} creator: readOnly: true type: string description: |- - The name of the creator. + Output only. The resource name of the creator. Format: users/{user} - createTime: + space: type: string description: |- - The creation timestamp. - If not set on creation, the server will set it to the current time. - format: date-time - updateTime: - type: string - description: |- - The last update timestamp. - If not set on creation, the server will set it to the current time. - format: date-time + Optional. The space in which the memo is placed. Every memo, including a + comment, owns its placement independently. + Format: spaces/{space} content: type: string - description: Required. The content of the memo in Markdown format. + description: |- + Required. The content of the memo in Markdown. Must not exceed the + instance's content length limit. + location: + allOf: + - $ref: '#/components/schemas/Location' + description: Optional. The location of the memo. visibility: enum: - VISIBILITY_UNSPECIFIED @@ -4158,41 +4503,42 @@ components: - SPACE type: string description: |- - The visibility of the memo. - One of PRIVATE (creator only), PROTECTED (signed-in users), PUBLIC - (anonymous-eligible), or SPACE (active space members). Defaults to - PRIVATE on creation when unspecified. + Required. The visibility of the memo. Defaults to PRIVATE on creation when + unspecified. SPACE requires the memo to be placed in a space. + format: enum + state: + enum: + - STATE_UNSPECIFIED + - NORMAL + - ARCHIVED + type: string + description: |- + Required. The state of the memo. New memos are always NORMAL; change it + with UpdateMemo. format: enum - tags: - readOnly: true - type: array - items: - type: string - description: Output only. The tags extracted from the content. pinned: type: boolean - description: Whether the memo is pinned. + description: |- + Optional. Whether the memo is pinned. Ignored on creation; change it with + UpdateMemo. attachments: type: array items: $ref: '#/components/schemas/Attachment' - description: Optional. The attachments of the memo. + description: Optional. The attachments of the memo. Setting it replaces the full set. relations: type: array items: $ref: '#/components/schemas/MemoRelation' - description: Optional. The relations of the memo. + description: |- + Optional. The relations of the memo in both directions. Only REFERENCE + relations can be set; COMMENT relations are output only. reactions: readOnly: true type: array items: $ref: '#/components/schemas/Reaction' description: Output only. The reactions to the memo. - property: - readOnly: true - allOf: - - $ref: '#/components/schemas/Memo_Property' - description: Output only. The computed properties of the memo. parent: readOnly: true type: string @@ -4201,94 +4547,34 @@ components: Its identity is returned even when the caller cannot read the parent. Fetch the parent independently; this field does not grant read access. Format: memos/{memo} + tags: + readOnly: true + type: array + items: + type: string + description: Output only. The tags extracted from the content. + property: + readOnly: true + allOf: + - $ref: '#/components/schemas/Memo_Property' + description: Output only. The properties computed from the content. snippet: readOnly: true type: string - description: Output only. The snippet of the memo content. Plain text only. - location: - allOf: - - $ref: '#/components/schemas/Location' - description: Optional. The location of the memo. - space: + description: Output only. A plain-text snippet of the content. + createTime: type: string description: |- - Optional. The space in which this memo is placed. Format: spaces/{space}. - Every memo, including a comment, owns its placement independently. - MemoImportIssue: - type: object - properties: - memo: - type: string - description: The archive memo UID the issue concerns, if any. - message: - type: string - description: |- - MemoImportIssue is one warning or failure of an import, tied to the memo - UID from the archive when there is one. - MemoImportPlan: - type: object - properties: - exportTime: - type: string - description: When the archive was written. + Optional. The creation time. Defaults to the current time when unset on + creation. format: date-time - exporter: + updateTime: type: string - description: Username of the user who exported the archive. - generator: - type: string - description: The software that wrote the archive. - memos: - type: integer - description: Number of memo records in the archive. - format: int32 - attachments: - type: integer - description: Number of attachment files in the archive. - format: int32 - new: - type: integer - description: Memos whose UID nobody on the instance holds. - format: int32 - existing: - type: integer - description: Memos the user already holds; the conflict policy applies to them. - format: int32 - renamed: - type: integer - description: Memos whose UID another account holds; they are imported under fresh UIDs. - format: int32 - warnings: - type: array - items: - $ref: '#/components/schemas/MemoImportIssue' - description: Deviations the archive reader corrected while validating. - description: MemoImportPlan describes what importing a staged archive would do. - MemoImportReport: - type: object - properties: - created: - type: integer - format: int32 - updated: - type: integer - format: int32 - skipped: - type: integer - format: int32 - failed: - type: integer - format: int32 - warnings: - type: array - items: - $ref: '#/components/schemas/MemoImportIssue' - failures: - type: array - items: - $ref: '#/components/schemas/MemoImportIssue' - description: One entry per failed memo, with the reason. - description: MemoImportReport is the outcome of an import. + description: |- + Optional. The last update time. Defaults to the current time when unset on + creation. + format: date-time + description: Memo is a Markdown note written by a user. MemoRelation: required: - memo @@ -4298,20 +4584,24 @@ components: properties: memo: allOf: - - $ref: '#/components/schemas/MemoRelation_Memo' - description: The memo in the relation. + - $ref: '#/components/schemas/MemoRelation_MemoRef' + description: Required. The source memo of the relation. For COMMENT, the comment. relatedMemo: allOf: - - $ref: '#/components/schemas/MemoRelation_Memo' - description: The related memo. + - $ref: '#/components/schemas/MemoRelation_MemoRef' + description: |- + Required. The target memo of the relation. For COMMENT, the memo being + commented on. type: enum: - TYPE_UNSPECIFIED - REFERENCE - COMMENT type: string + description: Required. The type of the relation. format: enum - MemoRelation_Memo: + description: MemoRelation is a directed link from one memo to another. + MemoRelation_MemoRef: required: - name type: object @@ -4319,33 +4609,38 @@ components: name: type: string description: |- - The resource name of the memo. + Required. The resource name of the memo. Format: memos/{memo} snippet: readOnly: true type: string - description: Output only. The snippet of the memo content. Plain text only. - description: Memo reference in relations. + description: |- + Output only. A plain-text snippet of the memo content. Empty in + ListMemos and ListMemoComments responses. + description: MemoRef identifies a memo in a relation. MemoShare: type: object properties: name: type: string description: |- - The resource name of the share. Format: memos/{memo}/shares/{share} - The {share} segment is the opaque token used in the share URL. + Identifier. The resource name of the share. The {share} segment is the + opaque token used in the share URL. + Format: memos/{memo}/shares/{share} createTime: readOnly: true type: string - description: Output only. When this share link was created. + description: Output only. The creation time. format: date-time expireTime: type: string description: |- - Optional. When set, the share link stops working after this time. - If unset, the link never expires. + Optional. The time after which the share link stops working. Must be in + the future when set. If unset, the link never expires. format: date-time - description: MemoShare is an access grant that permits read-only access to a memo via an opaque bearer token. + description: |- + MemoShare is an access grant that permits read-only access to a memo via an + opaque bearer token. MemoView: required: - title @@ -4355,23 +4650,24 @@ components: name: type: string description: |- - The resource name of the memo view. + Identifier. The resource name of the memo view. Format: users/{user}/views/{view} title: type: string - description: The title of the memo view. + description: Required. The title of the memo view. filter: type: string description: |- - The CEL filter expression for the memo view, using the same grammar as the - ListMemos `filter` argument. Reuse it by passing this value to ListMemos. + Required. The CEL filter expression for the memo view, using the same + grammar as the ListMemos `filter` argument. Reuse it by passing this value + to ListMemos. icon: allOf: - $ref: '#/components/schemas/MemoView_Icon' description: |- - Optional. Display icon. Omit when updating with the "icon" mask to reset - to the default view icon. - description: Saved memo view messages + Optional. Display icon. Omit when updating with the "icon" mask to reset to + the default view icon. + description: MemoView is a user's saved memo filter. MemoView_Icon: type: object properties: @@ -4384,18 +4680,22 @@ components: Memo_Property: type: object properties: - hasLink: - type: boolean - hasTaskList: - type: boolean - hasCode: - type: boolean - hasIncompleteTasks: - type: boolean title: type: string - description: The title extracted from the first H1 heading, if present. - description: Computed properties of a memo. + description: The text of the H1 heading when it is the first block of the content. + hasLink: + type: boolean + description: Whether the content contains a link. + hasCode: + type: boolean + description: Whether the content contains inline code or a code block. + hasTaskList: + type: boolean + description: Whether the content contains a task list. + hasIncompleteTasks: + type: boolean + description: Whether the content contains an unchecked task. + description: Property holds properties computed from the memo content. MotionMedia: type: object properties: @@ -4405,6 +4705,7 @@ components: - APPLE_LIVE_PHOTO - ANDROID_MOTION_PHOTO type: string + description: The motion photo format. format: enum role: enum: @@ -4413,114 +4714,159 @@ components: - VIDEO - CONTAINER type: string + description: The part this attachment plays in the motion photo. format: enum groupId: type: string + description: |- + Groups the attachments that belong to one motion photo. Required for client-supplied Apple Live Photo metadata; + for an Android motion photo it is the attachment's own ID. presentationTimestampUs: type: string + description: Presentation timestamp of the still frame within the video, in microseconds. hasEmbeddedVideo: type: boolean + description: Whether the file embeds the motion video, as in an Android motion photo container. + description: MotionMedia links the parts of a motion photo. NotificationSetting_EmailSetting: type: object properties: enabled: type: boolean + description: Whether email notifications are enabled. smtpHost: type: string + description: The SMTP server host. smtpPort: type: integer + description: The SMTP server port. format: int32 smtpUsername: type: string + description: The SMTP username. smtpPassword: writeOnly: true type: string - fromEmail: - type: string - fromName: - type: string - replyTo: - type: string + description: |- + Input only. The SMTP password. Never returned. An empty value keeps the stored password, unless the host, + port, username or encryption settings change. useTls: type: boolean + description: Whether to use STARTTLS. useSsl: type: boolean - description: Email delivery configuration for notifications. + description: Whether to use implicit SSL/TLS. + fromEmail: + type: string + description: The sender email address. + fromName: + type: string + description: The sender display name. + replyTo: + type: string + description: The Reply-To email address. + description: EmailSetting is the SMTP configuration for notification emails. OAuth2Config: type: object properties: clientId: type: string + description: The OAuth2 client ID. clientSecret: type: string + description: 'The OAuth2 client secret. Write-only: it is never returned in responses.' authUrl: type: string + description: The authorization endpoint URL. tokenUrl: type: string + description: The token endpoint URL, used to exchange the authorization code for an access token. userInfoUrl: type: string + description: The user info endpoint URL, used to fetch the claims of the signed-in user. scopes: type: array items: type: string + description: The scopes to request. fieldMapping: - $ref: '#/components/schemas/FieldMapping' + allOf: + - $ref: '#/components/schemas/FieldMapping' + description: How user info claims map to user fields. + description: OAuth2Config is the configuration of an OAuth2 identity provider. PersonalAccessToken: type: object properties: name: type: string description: |- - The resource name of the personal access token. + Identifier. The resource name of the personal access token. Format: users/{user}/personalAccessTokens/{personal_access_token} description: type: string - description: The description of the token. - createdAt: + description: Optional. The description of the token. + createTime: readOnly: true type: string - description: Output only. The creation timestamp. + description: Output only. The creation time. format: date-time - expiresAt: + expireTime: type: string - description: Optional. The expiration timestamp. + description: Optional. The expiration time. Unset means the token never expires. format: date-time - lastUsedAt: + lastUseTime: readOnly: true type: string - description: Output only. The last used timestamp. + description: Output only. The time the token was last used. format: date-time description: |- - PersonalAccessToken represents a long-lived token for API/script access. - PATs are distinct from short-lived JWT access tokens used for session authentication. + PersonalAccessToken is a long-lived token for API and script access. + PATs are distinct from short-lived JWT access tokens used for session + authentication. PhotoMetadata: type: object properties: captureTime: - $ref: '#/components/schemas/MediaCaptureTime' + allOf: + - $ref: '#/components/schemas/MediaCaptureTime' + description: Capture time as recorded by the source media. location: - $ref: '#/components/schemas/MediaLocation' + allOf: + - $ref: '#/components/schemas/MediaLocation' + description: Geographic location recorded by the source media. sourceExifOrientation: type: integer + description: |- + EXIF orientation value from 1 through 8 as recorded by the source file. + This value is informational and must not be reapplied to the stored attachment; + width and height already describe its display-oriented dimensions. format: int32 cameraMake: type: string + description: The camera manufacturer. cameraModel: type: string + description: The camera model. lensModel: type: string + description: The lens model. fNumber: type: number + description: The aperture f-number. format: double exposureTimeSeconds: type: number + description: The exposure time in seconds. format: double iso: type: integer + description: The ISO sensitivity. format: int32 focalLengthMm: type: number + description: The focal length in millimeters. format: double + description: PhotoMetadata is metadata recorded by the source of a photo. Reaction: required: - reactionType @@ -4530,36 +4876,40 @@ components: readOnly: true type: string description: |- - The resource name of the reaction. + Identifier. The resource name of the reaction. Format: memos/{memo}/reactions/{reaction} creator: readOnly: true type: string description: |- - The resource name of the creator. + Output only. The resource name of the creator. Format: users/{user} reactionType: type: string - description: "Required. The type of reaction (e.g., \"\U0001F44D\", \"❤️\", \"\U0001F604\")." + description: "Required. The reaction, such as an emoji (\"\U0001F44D\", \"❤️\", \"\U0001F604\")." createTime: readOnly: true type: string - description: Output only. The creation timestamp. + description: Output only. The creation time. format: date-time - description: Reaction is a reaction attached to a memo. + description: Reaction is a reaction a user leaves on a memo. RefreshTokenRequest: type: object properties: {} + description: |- + Request message for AuthService.RefreshToken. + It has no fields: the refresh token is read from the HttpOnly cookie. RefreshTokenResponse: type: object properties: accessToken: type: string description: The new short-lived access token. - expiresAt: + accessTokenExpireTime: type: string - description: When the access token expires. + description: When the new access token expires. format: date-time + description: Response message for AuthService.RefreshToken. SetMemoAttachmentsRequest: required: - name @@ -4575,7 +4925,8 @@ components: type: array items: $ref: '#/components/schemas/Attachment' - description: Required. The attachments to set for the memo. + description: Required. The complete set of attachments for the memo. + description: Request message for MemoService.SetMemoAttachments. SetMemoRelationsRequest: required: - name @@ -4591,18 +4942,22 @@ components: type: array items: $ref: '#/components/schemas/MemoRelation' - description: Required. The REFERENCE relations to set for the memo. COMMENT is invalid. + description: |- + Required. The complete set of REFERENCE relations for the memo. COMMENT + relations are rejected. + description: Request message for MemoService.SetMemoRelations. SignInRequest: type: object properties: passwordCredentials: allOf: - $ref: '#/components/schemas/SignInRequest_PasswordCredentials' - description: Username and password authentication. + description: Username and password credentials. ssoCredentials: allOf: - - $ref: '#/components/schemas/SignInRequest_SSOCredentials' - description: SSO provider authentication. + - $ref: '#/components/schemas/SignInRequest_SsoCredentials' + description: SSO credentials from an OAuth2 authorization code flow. + description: Request message for AuthService.SignIn. SignInRequest_PasswordCredentials: required: - username @@ -4611,53 +4966,56 @@ components: properties: username: type: string - description: The username to sign in with. + description: Required. The username to sign in with. password: type: string - description: The password to sign in with. - description: Nested message for password-based authentication credentials. - SignInRequest_SSOCredentials: + description: Required. The password to sign in with. + description: |- + PasswordCredentials are a username and password. + Regular users cannot use them when the instance disallows password sign-in. + SignInRequest_SsoCredentials: required: - - idpName + - identityProvider - code - redirectUri type: object properties: - idpName: + identityProvider: type: string description: |- - The resource name of the SSO provider. + Required. The resource name of the identity provider. Format: identity-providers/{idp} code: type: string - description: The authorization code from the SSO provider. + description: Required. The authorization code returned by the identity provider. redirectUri: type: string - description: The redirect URI used in the SSO flow. + description: Required. The redirect URI used in the authorization request. codeVerifier: type: string - description: |- - The PKCE code verifier for enhanced security (RFC 7636). - Optional - enables PKCE flow protection against authorization code interception. - description: Nested message for SSO authentication credentials. + description: Optional. The PKCE code verifier (RFC 7636). Set it when the authorization request used a code challenge. + description: |- + SsoCredentials are the result of an OAuth2 authorization code flow with an identity provider. + A first sign-in creates a local user unless the instance disallows user registration. SignInResponse: type: object properties: user: allOf: - $ref: '#/components/schemas/User' - description: The authenticated user's information. + description: The signed-in user. accessToken: type: string description: |- The short-lived access token for API requests. - Store in memory only, not in localStorage. - accessTokenExpiresAt: + Keep it in memory only, not in localStorage. + accessTokenExpireTime: type: string description: |- When the access token expires. - Client should call RefreshToken before this time. + Call RefreshToken before this time. format: date-time + description: Response message for AuthService.SignIn. Space: required: - title @@ -4665,13 +5023,21 @@ components: properties: name: type: string - description: 'The resource name of the space. Format: spaces/{space}.' + description: |- + Identifier. The resource name of the space. + Format: spaces/{space} title: type: string description: Required. The human-readable title. description: type: string description: Optional. A description of the space. + icon: + allOf: + - $ref: '#/components/schemas/Space_Icon' + description: |- + Optional. The display icon. Omit it when updating with the "icon" mask to + reset to the default space mark. currentUserRole: readOnly: true enum: @@ -4681,21 +5047,15 @@ components: type: string description: |- Output only. The authenticated user's membership role in this space. - ROLE_UNSPECIFIED when this Space is exposed as metadata-only. + ROLE_UNSPECIFIED when this space is exposed as metadata only. format: enum memberCount: readOnly: true type: integer description: |- Output only. The number of accepted members in this space. Pending - invitations are excluded. Zero when this Space is exposed as metadata-only. + invitations are excluded. Zero when this space is exposed as metadata only. format: int32 - icon: - allOf: - - $ref: '#/components/schemas/Space_Icon' - description: |- - Optional. Display icon. Omit when updating with the "icon" mask to reset - to the default Space mark. description: Space is a collaboration boundary for placed memos. SpaceInvitation: required: @@ -4705,25 +5065,31 @@ components: properties: name: type: string - description: 'The resource name. Format: spaces/{space}/invitations/{username}.' + description: |- + Identifier. The resource name of the invitation. The invitation segment + is the invitee's username. + Format: spaces/{space}/invitations/{invitation} invitee: type: string - description: 'Required. The invited user. Format: users/{username}.' + description: |- + Required. The invited user. + Format: users/{user} role: enum: - ROLE_UNSPECIFIED - ADMIN - USER type: string - description: Required. The role the user will receive after accepting the invitation. + description: Required. The role the user receives after accepting the invitation. format: enum space: readOnly: true allOf: - $ref: '#/components/schemas/Space' description: |- - Output only. The Space the user is invited to. This lets an invitee - understand the invitation without granting membership-based GetSpace access. + Output only. The space the user is invited to, as metadata only. This lets + an invitee understand the invitation without membership-based GetSpace + access. description: SpaceInvitation is a pending invitation for an existing user to join a space. SpaceMember: required: @@ -4733,10 +5099,15 @@ components: properties: name: type: string - description: 'The resource name. Format: spaces/{space}/members/{username}.' + description: |- + Identifier. The resource name of the membership. The member segment is + the member's username. + Format: spaces/{space}/members/{member} user: type: string - description: 'Required. The member user. Format: users/{username}.' + description: |- + Required. The member user. + Format: users/{user} role: enum: - ROLE_UNSPECIFIED @@ -4755,6 +5126,7 @@ components: lucide: type: string description: A canonical Lucide icon name, such as "leaf". + description: Icon is the display icon of a space. Status: type: object properties: @@ -4774,52 +5146,64 @@ components: StorageSetting_S3Config: type: object properties: + endpoint: + type: string + description: The S3 endpoint URL. + region: + type: string + description: The S3 region. + bucket: + type: string + description: The S3 bucket. accessKeyId: type: string + description: The S3 access key ID. accessKeySecret: writeOnly: true type: string - endpoint: - type: string - region: - type: string - bucket: - type: string + description: Input only. The S3 access key secret. Never returned; an empty value keeps the stored secret. usePathStyle: type: boolean + description: Whether to use path-style addressing instead of virtual-hosted-style. insecureSkipTlsVerify: type: boolean description: |- - insecure_skip_tls_verify disables TLS certificate verification when connecting - to the S3 endpoint. Only enable this for trusted endpoints that use a self-signed - certificate; it removes protection against man-in-the-middle attacks. + Whether to skip TLS certificate verification when connecting to the S3 endpoint. + Only enable this for trusted endpoints that use a self-signed certificate; it removes protection against + man-in-the-middle attacks. description: |- - Legacy S3 configuration retained for compatibility with existing clients. + S3Config is the legacy S3 configuration, retained for compatibility with existing clients. Reference: https://developers.cloudflare.com/r2/examples/aws/aws-sdk-go/ Storage_S3Config: type: object properties: + endpoint: + type: string + description: The S3 endpoint URL. + region: + type: string + description: The S3 region. + bucket: + type: string + description: The S3 bucket. accessKeyId: type: string + description: The S3 access key ID. accessKeySecret: writeOnly: true type: string - endpoint: - type: string - region: - type: string - bucket: - type: string + description: Input only. The S3 access key secret. Never returned; an empty value keeps the stored secret. usePathStyle: type: boolean + description: Whether to use path-style addressing instead of virtual-hosted-style. insecureSkipTlsVerify: type: boolean description: |- - insecure_skip_tls_verify disables TLS certificate verification when connecting - to the S3 endpoint. Only enable this for trusted endpoints that use a self-signed - certificate; it removes protection against man-in-the-middle attacks. + Whether to skip TLS certificate verification when connecting to the S3 endpoint. + Only enable this for trusted endpoints that use a self-signed certificate; it removes protection against + man-in-the-middle attacks. description: |- - S3 configuration for an S3-compatible object store. + S3Config is the configuration of an S3-compatible object store. Reference: https://developers.cloudflare.com/r2/examples/aws/aws-sdk-go/ TestInstanceEmailSettingRequest: type: object @@ -4827,11 +5211,13 @@ components: email: allOf: - $ref: '#/components/schemas/NotificationSetting_EmailSetting' - description: Optional. SMTP email settings to test. If omitted, the stored notification email setting is used. + description: |- + Optional. The SMTP settings to test. If omitted, the stored notification email setting is used. An empty + password reuses the stored password when the connection settings are unchanged. recipientEmail: type: string - description: Optional. Recipient email address. If omitted, the current user's email address is used. - description: Request message for TestInstanceEmailSetting method. + description: Optional. The recipient email address. If omitted, the current user's email address is used. + description: Request message for InstanceService.TestInstanceEmailSetting. TranscribeRequest: required: - audio @@ -4840,30 +5226,33 @@ components: audio: allOf: - $ref: '#/components/schemas/TranscriptionAudio' - description: Required. Audio input. + description: Required. The audio to transcribe. + description: Request message for AIService.Transcribe. TranscribeResponse: type: object properties: text: type: string description: The transcribed text. + description: Response message for AIService.Transcribe. TranscriptionAudio: type: object properties: content: writeOnly: true type: string - description: Inline audio bytes. + description: Input only. Inline audio bytes, at most 25 MiB. format: bytes uri: type: string - description: URI for audio content. Reserved for future use. + description: URI of the audio content. Reserved for future use; the service rejects requests that set it. filename: type: string - description: Optional. The uploaded filename. + description: Optional. The uploaded filename, at most 255 characters. contentType: type: string - description: Optional. The MIME type of the input audio. + description: Optional. The MIME type of the audio. If empty, the service detects it from the content. + description: TranscriptionAudio is the audio input for a transcription. UploadAttachmentRequest: required: - writeOffset @@ -4879,22 +5268,20 @@ components: writeOffset: type: string description: |- - Required. Zero-based byte offset at which data is written. Must equal the - committed size, except when retrying the most recently accepted chunk - with identical bytes and offset, which is accepted without writing again. + Required. Zero-based byte offset at which data is written. Must equal the committed size, except when retrying + the most recently accepted chunk with identical bytes and offset, which is accepted without writing again. data: type: string description: |- - Optional. File bytes, at most max_chunk_size long. With no data and - finish_write false, the call reports progress without writing, and - write_offset is ignored. + Optional. File bytes, at most max_chunk_size long. With no data and finish_write false, the call reports + progress without writing, and write_offset is ignored. format: bytes finishWrite: type: boolean description: |- - Optional. Finalize the upload after writing data. The committed size must - then equal total_size. Any later call for the same upload_id returns the - created attachment. + Optional. Finalize the upload after writing data. The committed size must then equal total_size. Any later call + for the same upload_id returns the created attachment. + description: Request message for AttachmentService.UploadAttachment. UploadAttachmentResponse: type: object properties: @@ -4904,14 +5291,15 @@ components: committedSize: type: string description: Number of file bytes committed so far. - attachment: - allOf: - - $ref: '#/components/schemas/Attachment' - description: Set once the upload has been finalized. maxChunkSize: type: integer description: Maximum number of data bytes accepted in one call. format: int32 + attachment: + allOf: + - $ref: '#/components/schemas/Attachment' + description: The created attachment. Set once the upload has been finalized. + description: Response message for AttachmentService.UploadAttachment. UploadAttachmentSpec: required: - attachment @@ -4920,27 +5308,23 @@ components: attachment: allOf: - $ref: '#/components/schemas/Attachment' - description: |- - Required. Metadata for the attachment to create. content must be empty; - file bytes are sent in data. + description: Required. Metadata for the attachment to create. content must be empty; file bytes are sent in data. attachmentId: type: string description: |- - Optional. The attachment ID to use for this attachment. - If empty, a unique ID will be generated. + Optional. The ID to use for the attachment. If empty, a unique ID is generated. Format: ^[a-zA-Z0-9]([a-zA-Z0-9-]{0,34}[a-zA-Z0-9])?$ totalSize: type: string - description: |- - Optional. Total size of the file in bytes before media processing. - Zero represents an empty file. + description: Optional. Total size of the file in bytes before media processing. Zero represents an empty file. + description: UploadAttachmentSpec describes the attachment that a new upload creates. UpsertMemoReactionRequest: required: - - name + - parent - reaction type: object properties: - name: + parent: type: string description: |- Required. The resource name of the memo. @@ -4948,56 +5332,60 @@ components: reaction: allOf: - $ref: '#/components/schemas/Reaction' - description: Required. The reaction to upsert. + description: Required. The reaction to upsert. Only reaction_type is used. + description: Request message for MemoService.UpsertMemoReaction. User: required: - - role - username + - role - state type: object properties: name: type: string description: |- - The resource name of the user. + Identifier. The resource name of the user. {user} is the username. Format: users/{user} - role: - enum: - - ROLE_UNSPECIFIED - - ADMIN - - USER - type: string - description: The role of the user. - format: enum username: type: string - description: Required. The unique username for login. + description: Required. The unique username, used to sign in. + displayName: + type: string + description: Optional. The display name of the user. email: type: string description: |- Optional. The email address of the user. Stored trimmed and lowercased; empty means no address. An address belongs to at most one user on the instance, so writes that would reuse one fail with ALREADY_EXISTS. - displayName: - type: string - description: Optional. The display name of the user. + Returned only to the user and to admins. avatarUrl: type: string - description: Optional. The avatar URL of the user. + description: |- + Optional. The avatar URL of the user. An avatar set as a data URI (PNG, + JPEG, GIF or WebP, at most 2 MiB) is returned as a file server URL. description: type: string description: Optional. The description of the user. password: writeOnly: true type: string - description: Input only. The password for the user. + description: Input only. The password of the user. Never returned. + role: + enum: + - ROLE_UNSPECIFIED + - ADMIN + - USER + type: string + description: Required. The role of the user. Only admins can change it. + format: enum state: enum: - STATE_UNSPECIFIED - NORMAL - ARCHIVED type: string - description: The state of the user. + description: Required. The state of the user. Only admins can change it. format: enum createTime: readOnly: true @@ -5009,6 +5397,7 @@ components: type: string description: Output only. The last update timestamp. format: date-time + description: User is an account on the instance. UserNotification: type: object properties: @@ -5016,32 +5405,19 @@ components: readOnly: true type: string description: |- - The resource name of the notification. + Identifier. The resource name of the notification. Format: users/{user}/notifications/{notification} sender: readOnly: true type: string description: |- - The sender of the notification. + Output only. The user who caused the notification. Format: users/{user} senderUser: readOnly: true allOf: - $ref: '#/components/schemas/User' - description: The sender user details. - status: - enum: - - STATUS_UNSPECIFIED - - UNREAD - - ARCHIVED - type: string - description: The status of the notification. - format: enum - createTime: - readOnly: true - type: string - description: The creation timestamp. - format: date-time + description: Output only. The sender user details. type: readOnly: true enum: @@ -5050,32 +5426,49 @@ components: - MEMO_MENTION - SPACE_INVITATION type: string - description: The type of the notification. + description: Output only. The type of the notification. format: enum memoComment: readOnly: true allOf: - $ref: '#/components/schemas/UserNotification_MemoCommentPayload' + description: Output only. Details of a MEMO_COMMENT notification. memoMention: readOnly: true allOf: - $ref: '#/components/schemas/UserNotification_MemoMentionPayload' + description: Output only. Details of a MEMO_MENTION notification. spaceInvitation: readOnly: true allOf: - $ref: '#/components/schemas/UserNotification_SpaceInvitationPayload' + description: Output only. Details of a SPACE_INVITATION notification. + status: + enum: + - STATUS_UNSPECIFIED + - UNREAD + - ARCHIVED + type: string + description: Optional. The status of the notification. + format: enum + createTime: + readOnly: true + type: string + description: Output only. The creation timestamp. + format: date-time + description: UserNotification is a notification delivered to a user. UserNotification_MemoCommentPayload: type: object properties: memo: type: string description: |- - The memo name of comment. + The comment memo. Format: memos/{memo} relatedMemo: type: string description: |- - The name of related memo. + The memo that was commented on. Format: memos/{memo} memoSnippet: type: string @@ -5083,6 +5476,7 @@ components: relatedMemoSnippet: type: string description: Preview text of the related memo. + description: MemoCommentPayload holds the details of a MEMO_COMMENT notification. UserNotification_MemoMentionPayload: type: object properties: @@ -5102,14 +5496,15 @@ components: relatedMemoSnippet: type: string description: Preview text of the related parent memo. + description: MemoMentionPayload holds the details of a MEMO_MENTION notification. UserNotification_SpaceInvitationPayload: type: object properties: spaceInvitation: type: string description: |- - The invitation resource. - Format: spaces/{space}/invitations/{username} + The invitation. + Format: spaces/{space}/invitations/{invitation} space: allOf: - $ref: '#/components/schemas/Space' @@ -5130,41 +5525,53 @@ components: type: string description: The current state of the invitation for the receiver. format: enum + description: |- + SpaceInvitationPayload holds the details of a SPACE_INVITATION + notification. UserSetting: type: object properties: name: type: string description: |- - The name of the user setting. - Format: users/{user}/settings/{setting}, {setting} is the key for the setting. - For example, "users/steven/settings/GENERAL" for general settings. + Identifier. The resource name of the user setting. {setting} is the + setting key, such as GENERAL. + Format: users/{user}/settings/{setting} generalSetting: - $ref: '#/components/schemas/UserSetting_GeneralSetting' + allOf: + - $ref: '#/components/schemas/UserSetting_GeneralSetting' + description: The value of the GENERAL setting. webhooksSetting: - $ref: '#/components/schemas/UserSetting_WebhooksSetting' + allOf: + - $ref: '#/components/schemas/UserSetting_WebhooksSetting' + description: The value of the WEBHOOKS setting. tagsSetting: - $ref: '#/components/schemas/UserSetting_TagsSetting' - description: User settings message + allOf: + - $ref: '#/components/schemas/UserSetting_TagsSetting' + description: The value of the TAGS setting. + description: UserSetting is one group of a user's preferences, identified by its key. UserSetting_GeneralSetting: type: object properties: locale: type: string - description: The preferred locale of the user. + description: Optional. The preferred locale of the user. memoVisibility: type: string - description: The default visibility of the memo. + description: |- + Optional. The default visibility of new memos: PRIVATE, PROTECTED or + PUBLIC. theme: type: string description: |- - The preferred theme of the user. - This references a CSS file in the web/public/themes/ directory. - If not set, the default theme will be used. + Optional. The preferred theme of the user. This references a CSS file in + the web/public/themes/ directory. If not set, the default theme is used. saveMediaMetadata: type: boolean - description: Whether the official client should save metadata from future media uploads. - description: General user settings configuration. + description: |- + Optional. Whether the official client should save metadata from future + media uploads. + description: GeneralSetting holds general user preferences. UserSetting_TagMetadata: type: object properties: @@ -5172,12 +5579,12 @@ components: allOf: - $ref: '#/components/schemas/Color' description: |- - Optional background color for the tag label. - When unset, the default tag color is used. + Optional. The background color of the tag label. When unset, the default + tag color is used. blurContent: type: boolean - description: Whether memos with this tag should have their content blurred. - description: Tag metadata for user-specific display rules. + description: Optional. Whether memos with this tag have their content blurred. + description: TagMetadata holds user-specific display rules for a tag. UserSetting_TagsSetting: type: object properties: @@ -5186,9 +5593,9 @@ components: additionalProperties: $ref: '#/components/schemas/UserSetting_TagMetadata' description: |- - Map of tag name pattern to tag metadata. - Each key is treated as an anchored regular expression (^pattern$). - description: User-specific tag metadata. + Optional. Map of tag name pattern to tag metadata. Each key is treated as + an anchored regular expression (^pattern$). + description: TagsSetting holds user-specific tag metadata. UserSetting_WebhooksSetting: type: object properties: @@ -5196,123 +5603,143 @@ components: type: array items: $ref: '#/components/schemas/UserWebhook' - description: List of user webhooks. - description: User webhooks configuration. + description: The user's webhooks. + description: WebhooksSetting holds a user's webhooks. UserStats: type: object properties: name: type: string description: |- - The resource name of the user statistics singleton. + Identifier. The resource name of the user statistics singleton. Format: users/{user}/stats + totalMemoCount: + type: integer + description: The number of counted memos. + format: int32 memoTypeStats: allOf: - $ref: '#/components/schemas/UserStats_MemoTypeStats' - description: The stats of memo types. - tagCount: + description: The number of counted memos by content type. + tagCounts: type: object additionalProperties: type: integer format: int32 - description: The count of tags. + description: The number of counted memos per tag. + pinnedMemos: + type: array + items: + type: string + description: |- + The pinned memos among the counted memos. + Format: memos/{memo} memoCreatedTimestamps: type: array items: type: string format: date-time - description: The creation timestamps of the user's memos. + description: The creation timestamps of the counted memos, one per memo. memoUpdatedTimestamps: type: array items: type: string format: date-time description: |- - The latest update timestamps of the user's memos (one per memo, - mirrors memo_created_timestamps). Used by the activity heatmap when - the client's view is set to update_time basis. - pinnedMemos: - type: array - items: - type: string - description: The pinned memos of the user. - totalMemoCount: - type: integer - description: Total memo count. - format: int32 + The latest update timestamps of the counted memos (one per memo, mirrors + memo_created_timestamps). Used by the activity heatmap when the client's + view is set to update_time basis. attachmentStorageBytes: readOnly: true type: string description: |- - Total persisted attachment size in bytes, including unlinked uploads and - attachments in all spaces. Excludes temporary uploads and derived files. - Returned only by GetUserStats for the authenticated user's own stats, - independently of the request's memo filter. - description: User statistics messages + Output only. Total persisted attachment size in bytes, including unlinked + uploads and attachments in all spaces. Excludes temporary uploads and + derived files. Returned only by GetUserStats for the authenticated user's + own stats, independently of the request's memo filter. + description: UserStats is a summary of a user's memos. Comments are not counted. UserStats_MemoTypeStats: type: object properties: linkCount: type: integer + description: The number of memos that contain a link. format: int32 codeCount: type: integer + description: The number of memos that contain code. format: int32 todoCount: type: integer + description: The number of memos that contain a task list. format: int32 undoCount: type: integer + description: The number of memos that contain incomplete tasks. format: int32 - description: Memo type statistics. + description: MemoTypeStats counts memos by the kind of content they contain. UserWebhook: type: object properties: name: type: string description: |- - The name of the webhook. + Identifier. The resource name of the webhook. Format: users/{user}/webhooks/{webhook} - url: - type: string - description: The URL to send the webhook to. displayName: type: string - description: Optional. Human-readable name for the webhook. - createTime: - readOnly: true + description: A human-readable name for the webhook. + url: type: string - description: The creation time of the webhook. - format: date-time - updateTime: - readOnly: true - type: string - description: The last update time of the webhook. - format: date-time + description: The URL the webhook request is sent to. Required on create. signingSecret: writeOnly: true type: string description: |- - Optional. Signing secret used to HMAC-SHA256 sign the webhook request body. - This field is input-only; it is never returned in responses. + Input only. The secret used to HMAC-SHA256 sign the webhook request body. + Never returned; use GetUserWebhookSigningSecret to read it. signingSecretSet: readOnly: true type: boolean - description: Whether a signing secret is configured for this webhook. - description: UserWebhook represents a webhook owned by a user. + description: Output only. Whether a signing secret is configured for this webhook. + createTime: + readOnly: true + type: string + description: Output only. The creation timestamp. Currently never set. + format: date-time + updateTime: + readOnly: true + type: string + description: Output only. The last update timestamp. Currently never set. + format: date-time + description: UserWebhook is a webhook owned by a user. VideoMetadata: type: object properties: durationSeconds: type: number + description: The duration of the video in seconds. format: double + description: VideoMetadata is metadata recorded by the source of a video. tags: - name: AIService + description: AIService runs AI tasks through the AI providers configured on the instance. - name: AttachmentService + description: AttachmentService manages files attached to memos. - name: AuthService + description: 'AuthService manages sign-in sessions: it issues, refreshes, and revokes the tokens that authenticate API calls.' - name: IdentityProviderService + description: IdentityProviderService manages the external identity providers users can sign in with. - name: InstanceService + description: InstanceService exposes the instance profile, instance-wide settings and usage statistics. - name: MemoService + description: |- + MemoService manages memos and their attachments, relations, comments, + reactions, and share links. - name: SpaceService - description: SpaceService manages collaborative spaces and their memberships. + description: SpaceService manages collaborative spaces, their members and their invitations. - name: UserService + description: |- + UserService manages users and the resources they own: settings, statistics, + memo views, notifications, webhooks, linked identities, personal access + tokens, and memo export files. diff --git a/scripts/release_smoke_test.sh b/scripts/release_smoke_test.sh index 264790af6..9fc3ebe18 100755 --- a/scripts/release_smoke_test.sh +++ b/scripts/release_smoke_test.sh @@ -218,6 +218,16 @@ set_current_base_url() { current_base_url="http://127.0.0.1:$port" } +# api_url prints the API root of the running container. Older releases serve the +# API under /api/v1; current releases serve it under /api. +api_url() { + if curl --fail --silent --output /dev/null --max-time 2 "$current_base_url/api/instance/profile"; then + printf '%s/api\n' "$current_base_url" + else + printf '%s/api/v1\n' "$current_base_url" + fi +} + start_container() { local container_name="$1" local image="$2" @@ -257,7 +267,7 @@ create_admin() { response="$(curl --fail --silent --show-error \ --header 'Content-Type: application/json' \ --data "$payload" \ - "$current_base_url/api/v1/users")" + "$(api_url)/users")" jq -e '.username == "smoke-admin" and .role == "ADMIN"' <<<"$response" >/dev/null } @@ -267,7 +277,7 @@ sign_in() { curl --fail --silent --show-error \ --header 'Content-Type: application/json' \ --data "$payload" \ - "$current_base_url/api/v1/auth/signin" | jq -er '.accessToken' + "$(api_url)/auth/signin" | jq -er '.accessToken' } create_memo() { @@ -280,7 +290,7 @@ create_memo() { --header "Authorization: Bearer $token" \ --header 'Content-Type: application/json' \ --data "$payload" \ - "$current_base_url/api/v1/memos?memoId=$memo_id")" + "$(api_url)/memos?memoId=$memo_id")" jq -e --arg name "memos/$memo_id" --arg content "$content" '.name == $name and .content == $content' <<<"$response" >/dev/null } @@ -290,7 +300,7 @@ assert_memo() { local content="$3" curl --fail --silent --show-error \ --header "Authorization: Bearer $token" \ - "$current_base_url/api/v1/memos/$memo_id" | + "$(api_url)/memos/$memo_id" | jq -e --arg content "$content" '.content == $content' >/dev/null } diff --git a/server/api/v1/acl_config.go b/server/api/acl_config.go similarity index 54% rename from server/api/v1/acl_config.go rename to server/api/acl_config.go index f0e69ab09..d9f1ba92d 100644 --- a/server/api/v1/acl_config.go +++ b/server/api/acl_config.go @@ -1,4 +1,4 @@ -package v1 +package api // PublicMethods defines API endpoints that don't require authentication. // All other endpoints require a valid session or access token. @@ -10,40 +10,40 @@ package v1 // or info.FullMethod (gRPC interceptor). var PublicMethods = map[string]struct{}{ // Auth Service - login/token endpoints must be accessible without auth - "/memos.api.v1.AuthService/SignIn": {}, - "/memos.api.v1.AuthService/RefreshToken": {}, // Token refresh uses cookie, must be accessible when access token expired + "/memos.api.AuthService/SignIn": {}, + "/memos.api.AuthService/RefreshToken": {}, // Token refresh uses cookie, must be accessible when access token expired // Instance Service - needed before login to show instance info - "/memos.api.v1.InstanceService/GetInstanceProfile": {}, - "/memos.api.v1.InstanceService/GetInstanceSetting": {}, - "/memos.api.v1.InstanceService/BatchGetInstanceSettings": {}, + "/memos.api.InstanceService/GetInstanceProfile": {}, + "/memos.api.InstanceService/GetInstanceSetting": {}, + "/memos.api.InstanceService/BatchGetInstanceSettings": {}, // User Service - public user profiles and stats - "/memos.api.v1.UserService/CreateUser": {}, // Registration policy is enforced in UserService - "/memos.api.v1.UserService/GetUser": {}, - "/memos.api.v1.UserService/BatchGetUsers": {}, - "/memos.api.v1.UserService/GetUserAvatar": {}, - "/memos.api.v1.UserService/GetUserStats": {}, - "/memos.api.v1.UserService/ListAllUserStats": {}, + "/memos.api.UserService/CreateUser": {}, // Registration policy is enforced in UserService + "/memos.api.UserService/GetUser": {}, + "/memos.api.UserService/BatchGetUsers": {}, + "/memos.api.UserService/GetUserAvatar": {}, + "/memos.api.UserService/GetUserStats": {}, + "/memos.api.UserService/ListUserStats": {}, // Identity Provider Service - SSO buttons on login page - "/memos.api.v1.IdentityProviderService/ListIdentityProviders": {}, + "/memos.api.IdentityProviderService/ListIdentityProviders": {}, // Memo Service - public memos (visibility filtering done in service layer) - "/memos.api.v1.MemoService/GetMemo": {}, - "/memos.api.v1.MemoService/ListMemos": {}, - "/memos.api.v1.MemoService/ListMemoComments": {}, - "/memos.api.v1.MemoService/ListMemoAttachments": {}, - "/memos.api.v1.MemoService/ListMemoReactions": {}, - "/memos.api.v1.MemoService/ListMemoRelations": {}, - "/memos.api.v1.MemoService/GetLinkMetadata": {}, - "/memos.api.v1.MemoService/BatchGetLinkMetadata": {}, + "/memos.api.MemoService/GetMemo": {}, + "/memos.api.MemoService/ListMemos": {}, + "/memos.api.MemoService/ListMemoComments": {}, + "/memos.api.MemoService/ListMemoAttachments": {}, + "/memos.api.MemoService/ListMemoReactions": {}, + "/memos.api.MemoService/ListMemoRelations": {}, + "/memos.api.MemoService/GetLinkMetadata": {}, + "/memos.api.MemoService/BatchGetLinkMetadata": {}, // Attachment metadata follows the visibility of its linked memo. - "/memos.api.v1.AttachmentService/GetAttachment": {}, + "/memos.api.AttachmentService/GetAttachment": {}, // Memo sharing - share-token endpoints require no authentication - "/memos.api.v1.MemoService/GetSharedMemo": {}, + "/memos.api.MemoService/GetSharedMemo": {}, } // IsPublicMethod checks if a procedure path is public (no authentication required). @@ -61,22 +61,22 @@ func IsPublicMethod(procedure string) bool { // MUST also exist in PublicMethods. var AuthBootstrapMethods = map[string]struct{}{ // Auth Service - sign-in and token refresh. - "/memos.api.v1.AuthService/SignIn": {}, - "/memos.api.v1.AuthService/RefreshToken": {}, + "/memos.api.AuthService/SignIn": {}, + "/memos.api.AuthService/RefreshToken": {}, // Instance Service - needed to render the sign-in page (branding, auth options). - "/memos.api.v1.InstanceService/GetInstanceProfile": {}, - "/memos.api.v1.InstanceService/GetInstanceSetting": {}, - "/memos.api.v1.InstanceService/BatchGetInstanceSettings": {}, + "/memos.api.InstanceService/GetInstanceProfile": {}, + "/memos.api.InstanceService/GetInstanceSetting": {}, + "/memos.api.InstanceService/BatchGetInstanceSettings": {}, // Identity Provider Service - SSO buttons on the sign-in page. - "/memos.api.v1.IdentityProviderService/ListIdentityProviders": {}, + "/memos.api.IdentityProviderService/ListIdentityProviders": {}, // User Service - CreateUser applies registration and password-auth settings. - "/memos.api.v1.UserService/CreateUser": {}, + "/memos.api.UserService/CreateUser": {}, // Memo sharing - share-token access stays public even on a private instance. - "/memos.api.v1.MemoService/GetSharedMemo": {}, + "/memos.api.MemoService/GetSharedMemo": {}, } // IsAuthBootstrapMethod reports whether an anonymous request to procedure is one diff --git a/server/api/acl_config_test.go b/server/api/acl_config_test.go new file mode 100644 index 000000000..801709e13 --- /dev/null +++ b/server/api/acl_config_test.go @@ -0,0 +1,165 @@ +package api + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +// TestPublicMethodsArePublic verifies that methods in PublicMethods are recognized as public. +func TestPublicMethodsArePublic(t *testing.T) { + publicMethods := []string{ + // Auth Service + "/memos.api.AuthService/SignIn", + "/memos.api.AuthService/RefreshToken", + // Instance Service + "/memos.api.InstanceService/GetInstanceProfile", + "/memos.api.InstanceService/GetInstanceSetting", + "/memos.api.InstanceService/BatchGetInstanceSettings", + // User Service + "/memos.api.UserService/CreateUser", + "/memos.api.UserService/GetUser", + "/memos.api.UserService/BatchGetUsers", + "/memos.api.UserService/GetUserAvatar", + "/memos.api.UserService/GetUserStats", + "/memos.api.UserService/ListUserStats", + // Identity Provider Service + "/memos.api.IdentityProviderService/ListIdentityProviders", + // Memo Service + "/memos.api.MemoService/GetMemo", + "/memos.api.MemoService/ListMemos", + "/memos.api.MemoService/ListMemoComments", + "/memos.api.MemoService/ListMemoAttachments", + "/memos.api.MemoService/ListMemoReactions", + "/memos.api.MemoService/ListMemoRelations", + "/memos.api.MemoService/GetLinkMetadata", + "/memos.api.MemoService/BatchGetLinkMetadata", + // Attachment Service metadata follows linked memo visibility. + "/memos.api.AttachmentService/GetAttachment", + } + + for _, method := range publicMethods { + t.Run(method, func(t *testing.T) { + assert.True(t, IsPublicMethod(method), "Expected %s to be public", method) + }) + } +} + +// TestProtectedMethodsRequireAuth verifies that non-public methods are recognized as protected. +func TestProtectedMethodsRequireAuth(t *testing.T) { + protectedMethods := []string{ + "/memos.api.AttachmentService/UploadAttachment", + // Auth Service - logout and get current user require auth + "/memos.api.AuthService/SignOut", + "/memos.api.AuthService/GetCurrentUser", + // Instance Service - admin operations + "/memos.api.InstanceService/UpdateInstanceSetting", + "/memos.api.InstanceService/TestInstanceEmailSetting", + // User Service - modification operations + "/memos.api.UserService/ListUsers", + "/memos.api.UserService/UpdateUser", + "/memos.api.UserService/DeleteUser", + // Memo Service - write operations + "/memos.api.MemoService/CreateMemo", + "/memos.api.MemoService/UpdateMemo", + "/memos.api.MemoService/DeleteMemo", + // Space Service - every operation requires an authenticated member. + "/memos.api.SpaceService/CreateSpace", + "/memos.api.SpaceService/ListSpaces", + "/memos.api.SpaceService/GetSpace", + "/memos.api.SpaceService/UpdateSpace", + "/memos.api.SpaceService/DeleteSpace", + "/memos.api.SpaceService/CreateSpaceInvitation", + "/memos.api.SpaceService/ListSpaceInvitations", + "/memos.api.SpaceService/ListUserSpaceInvitations", + "/memos.api.SpaceService/GetSpaceInvitation", + "/memos.api.SpaceService/DeleteSpaceInvitation", + "/memos.api.SpaceService/AcceptSpaceInvitation", + "/memos.api.SpaceService/DeclineSpaceInvitation", + "/memos.api.SpaceService/ListSpaceMembers", + "/memos.api.SpaceService/GetSpaceMember", + "/memos.api.SpaceService/UpdateSpaceMember", + "/memos.api.SpaceService/DeleteSpaceMember", + // Attachment Service - write operations + "/memos.api.AttachmentService/CreateAttachment", + "/memos.api.AttachmentService/DeleteAttachment", + // User Service - saved memo views + "/memos.api.UserService/CreateMemoView", + "/memos.api.UserService/GetMemoView", + "/memos.api.UserService/ListMemoViews", + "/memos.api.UserService/UpdateMemoView", + "/memos.api.UserService/DeleteMemoView", + } + + for _, method := range protectedMethods { + t.Run(method, func(t *testing.T) { + assert.False(t, IsPublicMethod(method), "Expected %s to require auth", method) + }) + } +} + +// TestUnknownMethodsRequireAuth verifies that unknown methods default to requiring auth. +func TestUnknownMethodsRequireAuth(t *testing.T) { + unknownMethods := []string{ + "/unknown.Service/Method", + "/memos.api.UnknownService/Method", + "", + "invalid", + } + + for _, method := range unknownMethods { + t.Run(method, func(t *testing.T) { + assert.False(t, IsPublicMethod(method), "Unknown method %q should require auth", method) + }) + } +} + +// TestAuthBootstrapMethodsAreSubsetOfPublic verifies every auth-bootstrap method is +// also a public method. A bootstrap method that wasn't public would be rejected before +// the private-instance check runs, breaking sign-in on a private instance. +func TestAuthBootstrapMethodsAreSubsetOfPublic(t *testing.T) { + for method := range AuthBootstrapMethods { + t.Run(method, func(t *testing.T) { + assert.True(t, IsPublicMethod(method), "auth-bootstrap method %s must also be a public method", method) + }) + } +} + +// TestAuthBootstrapClassification verifies which endpoints remain reachable by +// anonymous callers when the instance access mode is PRIVATE. +func TestAuthBootstrapClassification(t *testing.T) { + // Reachable while private: sign-in flow, registration, instance metadata, SSO, share links. + bootstrap := []string{ + "/memos.api.AuthService/SignIn", + "/memos.api.AuthService/RefreshToken", + "/memos.api.UserService/CreateUser", + "/memos.api.InstanceService/GetInstanceProfile", + "/memos.api.InstanceService/GetInstanceSetting", + "/memos.api.InstanceService/BatchGetInstanceSettings", + "/memos.api.IdentityProviderService/ListIdentityProviders", + "/memos.api.MemoService/GetSharedMemo", + } + for _, method := range bootstrap { + t.Run("bootstrap/"+method, func(t *testing.T) { + assert.True(t, IsAuthBootstrapMethod(method), "expected %s to be reachable on a private instance", method) + }) + } + + // Public in PUBLIC mode, but gated in PRIVATE mode: browsing and profiles. + gatedWhilePrivate := []string{ + "/memos.api.MemoService/ListMemos", + "/memos.api.MemoService/GetMemo", + "/memos.api.MemoService/ListMemoComments", + "/memos.api.MemoService/ListMemoAttachments", + "/memos.api.MemoService/ListMemoReactions", + "/memos.api.MemoService/ListMemoRelations", + "/memos.api.AttachmentService/GetAttachment", + "/memos.api.UserService/GetUser", + "/memos.api.UserService/ListUserStats", + } + for _, method := range gatedWhilePrivate { + t.Run("gated/"+method, func(t *testing.T) { + assert.False(t, IsAuthBootstrapMethod(method), "expected %s to be gated on a private instance", method) + }) + } +} diff --git a/server/api/v1/ai_service.go b/server/api/ai_service.go similarity index 94% rename from server/api/v1/ai_service.go rename to server/api/ai_service.go index 2ad0ee879..a27b0d224 100644 --- a/server/api/v1/ai_service.go +++ b/server/api/ai_service.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "bytes" @@ -12,7 +12,7 @@ import ( "google.golang.org/grpc/status" "github.com/usememos/memos/internal/ratelimit" - v1pb "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" storepb "github.com/usememos/memos/proto/gen/store" "github.com/usememos/memos/provider/ai" "github.com/usememos/memos/provider/ai/audiollm" @@ -46,7 +46,7 @@ var supportedTranscriptionContentTypes = map[string]bool{ } // Transcribe transcribes an audio file using an instance AI provider. -func (s *APIV1Service) Transcribe(ctx context.Context, request *v1pb.TranscribeRequest) (*v1pb.TranscribeResponse, error) { +func (s *APIService) Transcribe(ctx context.Context, request *apipb.TranscribeRequest) (*apipb.TranscribeResponse, error) { user, err := s.fetchCurrentUser(ctx) if err != nil { return nil, status.Errorf(codes.Internal, "failed to get current user: %v", err) @@ -121,10 +121,10 @@ func (s *APIV1Service) Transcribe(ctx context.Context, request *v1pb.TranscribeR if err != nil { return nil, status.Errorf(codes.Internal, "failed to transcribe audio: %v", err) } - return &v1pb.TranscribeResponse{Text: text}, nil + return &apipb.TranscribeResponse{Text: text}, nil } -func (*APIV1Service) transcribeViaSTT( +func (*APIService) transcribeViaSTT( ctx context.Context, provider ai.ProviderConfig, persisted *storepb.TranscriptionConfig, @@ -152,7 +152,7 @@ func (*APIV1Service) transcribeViaSTT( return resp.Text, nil } -func (*APIV1Service) transcribeViaAudioLLM( +func (*APIService) transcribeViaAudioLLM( ctx context.Context, provider ai.ProviderConfig, persisted *storepb.TranscriptionConfig, @@ -197,7 +197,7 @@ func buildTranscriptionInstructions(prompt, language string) string { return strings.Join(parts, "\n\n") } -func (*APIV1Service) resolveAIProvider(setting *storepb.InstanceAISetting, providerID string) (ai.ProviderConfig, error) { +func (*APIService) resolveAIProvider(setting *storepb.InstanceAISetting, providerID string) (ai.ProviderConfig, error) { providers := make([]ai.ProviderConfig, 0, len(setting.GetProviders())) for _, provider := range setting.GetProviders() { if provider == nil { diff --git a/server/api/v1/v1.go b/server/api/api.go similarity index 79% rename from server/api/v1/v1.go rename to server/api/api.go index 7c270e20c..7a67b8905 100644 --- a/server/api/v1/v1.go +++ b/server/api/api.go @@ -1,10 +1,11 @@ -package v1 +package api import ( "context" "log/slog" "net/http" + "google.golang.org/grpc/codes" "google.golang.org/grpc/status" "google.golang.org/protobuf/encoding/protojson" @@ -19,7 +20,7 @@ import ( "github.com/usememos/memos/internal/profile" "github.com/usememos/memos/internal/ratelimit" "github.com/usememos/memos/markdown" - v1pb "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" "github.com/usememos/memos/server/auth" "github.com/usememos/memos/store" ) @@ -39,8 +40,8 @@ const maxGeneralRequestBytes = 16 << 20 // the large cap; the size of that content is checked again by the handler // against the instance upload limit. var inlineContentProcedures = map[string]struct{}{ - "/memos.api.v1.AttachmentService/CreateAttachment": {}, - "/memos.api.v1.AIService/Transcribe": {}, + "/memos.api.AttachmentService/CreateAttachment": {}, + "/memos.api.AIService/Transcribe": {}, } // requestBodyLimit returns the request body cap for a procedure. Chunked @@ -55,15 +56,15 @@ func requestBodyLimit(procedure string) int64 { return maxGeneralRequestBytes } -type APIV1Service struct { - v1pb.UnimplementedInstanceServiceServer - v1pb.UnimplementedAuthServiceServer - v1pb.UnimplementedUserServiceServer - v1pb.UnimplementedMemoServiceServer - v1pb.UnimplementedSpaceServiceServer - v1pb.UnimplementedAttachmentServiceServer - v1pb.UnimplementedAIServiceServer - v1pb.UnimplementedIdentityProviderServiceServer +type APIService struct { + apipb.UnimplementedInstanceServiceServer + apipb.UnimplementedAuthServiceServer + apipb.UnimplementedUserServiceServer + apipb.UnimplementedMemoServiceServer + apipb.UnimplementedSpaceServiceServer + apipb.UnimplementedAttachmentServiceServer + apipb.UnimplementedAIServiceServer + apipb.UnimplementedIdentityProviderServiceServer Secret string Profile *profile.Profile @@ -93,13 +94,13 @@ type APIV1Service struct { memoImports memoImports } -// NewAPIV1Service creates an API v1 service with its shared dependencies. -func NewAPIV1Service(secret string, profile *profile.Profile, store *store.Store) *APIV1Service { +// NewAPIService creates an API v1 service with its shared dependencies. +func NewAPIService(secret string, profile *profile.Profile, store *store.Store) *APIService { markdownService := markdown.NewService( markdown.WithTagExtension(), markdown.WithMentionExtension(), ) - service := &APIV1Service{ + service := &APIService{ Secret: secret, Profile: profile, Store: store, @@ -134,7 +135,7 @@ func newGatewayMarshaler() *runtime.HTTPBodyMarshaler { } // RegisterGateway registers the gRPC-Gateway and Connect handlers with the given Echo instance. -func (s *APIV1Service) RegisterGateway(ctx context.Context, echoServer *echo.Echo) error { +func (s *APIService) RegisterGateway(ctx context.Context, echoServer *echo.Echo) error { // Shared authorizer: one source of truth for authentication and anonymous-access // policy, used by both the gRPC-Gateway middleware and the Connect interceptor. authorizer := NewAuthorizer(s.Store, s.Secret).WithRateLimiter(s.RateLimiter) @@ -190,37 +191,38 @@ func (s *APIV1Service) RegisterGateway(ctx context.Context, echoServer *echo.Ech runtime.WithErrorHandler(gatewayErrorHandler), runtime.WithIncomingHeaderMatcher(gatewayIncomingHeaderMatcher), ) - if err := v1pb.RegisterInstanceServiceHandlerServer(ctx, gwMux, s); err != nil { + if err := apipb.RegisterInstanceServiceHandlerServer(ctx, gwMux, s); err != nil { return err } - if err := v1pb.RegisterAuthServiceHandlerServer(ctx, gwMux, s); err != nil { + if err := apipb.RegisterAuthServiceHandlerServer(ctx, gwMux, s); err != nil { return err } - if err := v1pb.RegisterUserServiceHandlerServer(ctx, gwMux, s); err != nil { + if err := apipb.RegisterUserServiceHandlerServer(ctx, gwMux, s); err != nil { return err } - if err := v1pb.RegisterMemoServiceHandlerServer(ctx, gwMux, s); err != nil { + if err := apipb.RegisterMemoServiceHandlerServer(ctx, gwMux, s); err != nil { return err } - if err := v1pb.RegisterSpaceServiceHandlerServer(ctx, gwMux, s); err != nil { + if err := apipb.RegisterSpaceServiceHandlerServer(ctx, gwMux, s); err != nil { return err } - if err := v1pb.RegisterAttachmentServiceHandlerServer(ctx, gwMux, s); err != nil { + if err := apipb.RegisterAttachmentServiceHandlerServer(ctx, gwMux, s); err != nil { return err } - if err := v1pb.RegisterAIServiceHandlerServer(ctx, gwMux, s); err != nil { + if err := apipb.RegisterAIServiceHandlerServer(ctx, gwMux, s); err != nil { return err } - if err := v1pb.RegisterIdentityProviderServiceHandlerServer(ctx, gwMux, s); err != nil { + if err := apipb.RegisterIdentityProviderServiceHandlerServer(ctx, gwMux, s); err != nil { return err } gwGroup := echoServer.Group("") - // Register SSE endpoint with same CORS as rest of /api/v1. + // Register SSE endpoint with same CORS as rest of /api. RegisterSSERoutes(gwGroup, s.SSEHub, s.Store, s.Secret) handler := echo.WrapHandler(gwMux) - gwGroup.Any("/api/v1/*", handler) + gwGroup.Any("/api/*", handler) gwGroup.Any("/file/*", handler) + gwGroup.Any("/api/v1/*", removedAPIVersionHandler(false)) // Connect handlers for browser clients (replaces grpc-web). logStacktraces := s.Profile.Demo @@ -239,14 +241,32 @@ func (s *APIV1Service) RegisterGateway(ctx context.Context, echoServer *echo.Ech })) connectGroup := echoServer.Group("") - connectGroup.Any("/memos.api.v1.*", echo.WrapHandler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + connectGroup.Any("/memos.api.*", echo.WrapHandler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { r.Body = http.MaxBytesReader(w, r.Body, requestBodyLimit(r.URL.Path)) connectMux.ServeHTTP(w, r) }))) + connectGroup.Any("/memos.api.v1.*", removedAPIVersionHandler(true)) return nil } +// removedAPIMessage tells clients of the removed v1 API where it went. +const removedAPIMessage = "API v1 has been removed. Use /api/... for REST and /memos.api./ for Connect. " + + "See https://github.com/usememos/memos/blob/main/proto/api/CHANGELOG.md" + +// removedAPIVersionHandler answers requests to the removed /api/v1 and +// memos.api.v1 routes with 410 Gone, in the error body shape each transport's +// clients decode. It exists for one release so old clients fail with a +// pointer to the migration; delete it in the release after. +func removedAPIVersionHandler(connectProtocol bool) echo.HandlerFunc { + return func(c *echo.Context) error { + if connectProtocol { + return c.JSON(http.StatusGone, map[string]string{"code": connect.CodeUnimplemented.String(), "message": removedAPIMessage}) + } + return c.JSON(http.StatusGone, map[string]any{"code": int(codes.Unimplemented), "message": removedAPIMessage}) + } +} + func setAPIResponseNoStoreHeaders(header http.Header) { header.Set("Cache-Control", "no-cache, no-store, must-revalidate") header.Set("Pragma", "no-cache") diff --git a/server/api/api_test.go b/server/api/api_test.go new file mode 100644 index 000000000..1b03cc6de --- /dev/null +++ b/server/api/api_test.go @@ -0,0 +1,49 @@ +package api + +import ( + "context" + "encoding/json" + "net/http" + "net/http/httptest" + "strings" + "testing" + + "github.com/labstack/echo/v5" + "github.com/stretchr/testify/require" +) + +func TestRemovedAPIVersionRoutesReturnGone(t *testing.T) { + svc, _ := newUploadTestService(t) + e := echo.New() + require.NoError(t, svc.RegisterGateway(context.Background(), e)) + + tests := []struct { + method string + path string + wantCode any + }{ + {http.MethodGet, "/api/v1/memos", float64(12)}, + {http.MethodPost, "/api/v1/auth/signin", float64(12)}, + {http.MethodPost, "/memos.api.v1.MemoService/ListMemos", "unimplemented"}, + } + for _, tt := range tests { + t.Run(tt.path, func(t *testing.T) { + req := httptest.NewRequest(tt.method, tt.path, strings.NewReader("{}")) + req.Header.Set("Content-Type", "application/json") + rec := httptest.NewRecorder() + e.ServeHTTP(rec, req) + + require.Equal(t, http.StatusGone, rec.Code) + var body map[string]any + require.NoError(t, json.Unmarshal(rec.Body.Bytes(), &body)) + require.Equal(t, tt.wantCode, body["code"]) + require.Equal(t, removedAPIMessage, body["message"]) + }) + } + + // The current routes are unaffected. + req := httptest.NewRequest(http.MethodGet, "/api/instance/profile", nil) + rec := httptest.NewRecorder() + e.ServeHTTP(rec, req) + require.Equal(t, http.StatusOK, rec.Code) +} diff --git a/server/api/v1/attachment_exif_sniff_test.go b/server/api/attachment_exif_sniff_test.go similarity index 93% rename from server/api/v1/attachment_exif_sniff_test.go rename to server/api/attachment_exif_sniff_test.go index 4962c8ea0..6fc0130a2 100644 --- a/server/api/v1/attachment_exif_sniff_test.go +++ b/server/api/attachment_exif_sniff_test.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "bytes" @@ -11,7 +11,7 @@ import ( "github.com/stretchr/testify/require" - v1pb "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" "github.com/usememos/memos/store" ) @@ -65,7 +65,7 @@ func TestCreateAttachmentStripsExifFromMislabeledJPEG(t *testing.T) { content := jpegWithExifMarker(t) require.Contains(t, string(content), exifTestMarker) - created, err := svc.CreateAttachment(userCtx(ctx, user.ID), &v1pb.CreateAttachmentRequest{Attachment: &v1pb.Attachment{ + created, err := svc.CreateAttachment(userCtx(ctx, user.ID), &apipb.CreateAttachmentRequest{Attachment: &apipb.Attachment{ Filename: "photo.bin", Type: "application/octet-stream", Content: content, }}) require.NoError(t, err) diff --git a/server/api/v1/attachment_exif_test.go b/server/api/attachment_exif_test.go similarity index 99% rename from server/api/v1/attachment_exif_test.go rename to server/api/attachment_exif_test.go index 9531a1a04..07f4e3807 100644 --- a/server/api/v1/attachment_exif_test.go +++ b/server/api/attachment_exif_test.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "bytes" diff --git a/server/api/v1/attachment_media_metadata.go b/server/api/attachment_media_metadata.go similarity index 92% rename from server/api/v1/attachment_media_metadata.go rename to server/api/attachment_media_metadata.go index 2b4e0df2f..efd92681d 100644 --- a/server/api/v1/attachment_media_metadata.go +++ b/server/api/attachment_media_metadata.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "math" @@ -13,7 +13,7 @@ import ( "google.golang.org/grpc/status" "google.golang.org/protobuf/proto" - v1pb "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" storepb "github.com/usememos/memos/proto/gen/store" ) @@ -24,7 +24,7 @@ var ( mediaUTCOffsetPattern = regexp.MustCompile(`^[+-](\d{2}):(\d{2})$`) ) -func validateClientMediaMetadata(metadata *v1pb.MediaMetadata, mimeType string) (*storepb.MediaMetadata, error) { +func validateClientMediaMetadata(metadata *apipb.MediaMetadata, mimeType string) (*storepb.MediaMetadata, error) { if metadata == nil { return nil, nil } @@ -48,7 +48,7 @@ func validateClientMediaMetadata(metadata *v1pb.MediaMetadata, mimeType string) if metadata.Width == nil { return nil, status.Errorf(codes.InvalidArgument, "media_metadata must contain at least one value") } - case *v1pb.MediaMetadata_Photo: + case *apipb.MediaMetadata_Photo: if !isImage { return nil, status.Errorf(codes.InvalidArgument, "photo metadata requires an image MIME type") } @@ -58,7 +58,7 @@ func validateClientMediaMetadata(metadata *v1pb.MediaMetadata, mimeType string) if err := validatePhotoMetadata(details.Photo); err != nil { return nil, err } - case *v1pb.MediaMetadata_Video: + case *apipb.MediaMetadata_Video: if !isVideo { return nil, status.Errorf(codes.InvalidArgument, "video metadata requires a video MIME type") } @@ -79,7 +79,7 @@ func validateClientMediaMetadata(metadata *v1pb.MediaMetadata, mimeType string) return storeMetadata, nil } -func validatePhotoMetadata(photo *v1pb.PhotoMetadata) error { +func validatePhotoMetadata(photo *apipb.PhotoMetadata) error { if photo.SourceExifOrientation != nil && (*photo.SourceExifOrientation < 1 || *photo.SourceExifOrientation > 8) { return status.Errorf(codes.InvalidArgument, "photo source_exif_orientation must be between 1 and 8") } @@ -125,7 +125,7 @@ func validatePhotoMetadata(photo *v1pb.PhotoMetadata) error { return validateMediaLocation(photo.Location) } -func validateMediaCaptureTime(captureTime *v1pb.MediaCaptureTime) error { +func validateMediaCaptureTime(captureTime *apipb.MediaCaptureTime) error { if captureTime == nil { return nil } @@ -154,7 +154,7 @@ func validateMediaCaptureTime(captureTime *v1pb.MediaCaptureTime) error { return nil } -func validateMediaLocation(location *v1pb.MediaLocation) error { +func validateMediaLocation(location *apipb.MediaLocation) error { if location == nil { return nil } @@ -192,11 +192,11 @@ func transcodeProto(src, dst proto.Message) error { return nil } -func convertMediaMetadataFromStore(metadata *storepb.MediaMetadata) *v1pb.MediaMetadata { +func convertMediaMetadataFromStore(metadata *storepb.MediaMetadata) *apipb.MediaMetadata { if metadata == nil { return nil } - apiMetadata := &v1pb.MediaMetadata{} + apiMetadata := &apipb.MediaMetadata{} if err := transcodeProto(metadata, apiMetadata); err != nil { return nil } diff --git a/server/api/v1/attachment_media_metadata_test.go b/server/api/attachment_media_metadata_test.go similarity index 53% rename from server/api/v1/attachment_media_metadata_test.go rename to server/api/attachment_media_metadata_test.go index 431a06c43..b4b230d65 100644 --- a/server/api/v1/attachment_media_metadata_test.go +++ b/server/api/attachment_media_metadata_test.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "math" @@ -10,22 +10,22 @@ import ( "google.golang.org/grpc/status" "google.golang.org/protobuf/proto" - v1pb "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" ) func TestValidateClientMediaMetadata(t *testing.T) { t.Parallel() - validPhoto := func() *v1pb.MediaMetadata { - return &v1pb.MediaMetadata{ + validPhoto := func() *apipb.MediaMetadata { + return &apipb.MediaMetadata{ Width: proto.Int32(4032), Height: proto.Int32(3024), - Details: &v1pb.MediaMetadata_Photo{Photo: &v1pb.PhotoMetadata{ - CaptureTime: &v1pb.MediaCaptureTime{ + Details: &apipb.MediaMetadata_Photo{Photo: &apipb.PhotoMetadata{ + CaptureTime: &apipb.MediaCaptureTime{ LocalDateTime: "2026-08-10T14:32:18.123", UtcOffset: proto.String("+08:00"), }, - Location: &v1pb.MediaLocation{ + Location: &apipb.MediaLocation{ Latitude: proto.Float64(1.3521), Longitude: proto.Float64(103.8198), AltitudeMeters: proto.Float64(18.4), @@ -50,7 +50,7 @@ func TestValidateClientMediaMetadata(t *testing.T) { }) t.Run("accepts dimensions without details", func(t *testing.T) { - metadata, err := validateClientMediaMetadata(&v1pb.MediaMetadata{ + metadata, err := validateClientMediaMetadata(&apipb.MediaMetadata{ Width: proto.Int32(1920), Height: proto.Int32(1080), }, "video/mp4") require.NoError(t, err) @@ -58,8 +58,8 @@ func TestValidateClientMediaMetadata(t *testing.T) { }) t.Run("accepts video metadata", func(t *testing.T) { - metadata, err := validateClientMediaMetadata(&v1pb.MediaMetadata{ - Details: &v1pb.MediaMetadata_Video{Video: &v1pb.VideoMetadata{DurationSeconds: proto.Float64(12.5)}}, + metadata, err := validateClientMediaMetadata(&apipb.MediaMetadata{ + Details: &apipb.MediaMetadata_Video{Video: &apipb.VideoMetadata{DurationSeconds: proto.Float64(12.5)}}, }, "video/mp4") require.NoError(t, err) require.Equal(t, 12.5, metadata.GetVideo().GetDurationSeconds()) @@ -72,8 +72,8 @@ func TestValidateClientMediaMetadata(t *testing.T) { }) t.Run("accepts Z UTC offset", func(t *testing.T) { - metadata, err := validateClientMediaMetadata(photoOnly(&v1pb.PhotoMetadata{ - CaptureTime: &v1pb.MediaCaptureTime{LocalDateTime: "2026-08-10T14:32:18", UtcOffset: proto.String("Z")}, + metadata, err := validateClientMediaMetadata(photoOnly(&apipb.PhotoMetadata{ + CaptureTime: &apipb.MediaCaptureTime{LocalDateTime: "2026-08-10T14:32:18", UtcOffset: proto.String("Z")}, }), "image/jpeg") require.NoError(t, err) require.Equal(t, "Z", metadata.GetPhoto().GetCaptureTime().GetUtcOffset()) @@ -82,31 +82,31 @@ func TestValidateClientMediaMetadata(t *testing.T) { tests := []struct { name string mimeType string - metadata *v1pb.MediaMetadata + metadata *apipb.MediaMetadata }{ - {name: "empty", mimeType: "image/jpeg", metadata: &v1pb.MediaMetadata{}}, + {name: "empty", mimeType: "image/jpeg", metadata: &apipb.MediaMetadata{}}, {name: "non-media MIME", mimeType: "application/pdf", metadata: validPhoto()}, - {name: "width without height", mimeType: "image/jpeg", metadata: &v1pb.MediaMetadata{Width: proto.Int32(100)}}, - {name: "non-positive dimension", mimeType: "image/jpeg", metadata: &v1pb.MediaMetadata{Width: proto.Int32(0), Height: proto.Int32(100)}}, + {name: "width without height", mimeType: "image/jpeg", metadata: &apipb.MediaMetadata{Width: proto.Int32(100)}}, + {name: "non-positive dimension", mimeType: "image/jpeg", metadata: &apipb.MediaMetadata{Width: proto.Int32(0), Height: proto.Int32(100)}}, {name: "photo on video", mimeType: "video/mp4", metadata: validPhoto()}, - {name: "empty photo", mimeType: "image/jpeg", metadata: &v1pb.MediaMetadata{Details: &v1pb.MediaMetadata_Photo{Photo: &v1pb.PhotoMetadata{}}}}, - {name: "video on image", mimeType: "image/jpeg", metadata: &v1pb.MediaMetadata{Details: &v1pb.MediaMetadata_Video{Video: &v1pb.VideoMetadata{DurationSeconds: proto.Float64(1)}}}}, - {name: "empty video", mimeType: "video/mp4", metadata: &v1pb.MediaMetadata{Details: &v1pb.MediaMetadata_Video{Video: &v1pb.VideoMetadata{}}}}, - {name: "invalid source EXIF orientation", mimeType: "image/jpeg", metadata: photoOnly(&v1pb.PhotoMetadata{SourceExifOrientation: proto.Int32(9)})}, - {name: "blank camera make", mimeType: "image/jpeg", metadata: photoOnly(&v1pb.PhotoMetadata{CameraMake: " "})}, - {name: "control character in camera make", mimeType: "image/jpeg", metadata: photoOnly(&v1pb.PhotoMetadata{CameraMake: "Apple\nCo"})}, - {name: "null byte in lens model", mimeType: "image/jpeg", metadata: photoOnly(&v1pb.PhotoMetadata{LensModel: "Main\x00Camera"})}, - {name: "long camera model", mimeType: "image/jpeg", metadata: photoOnly(&v1pb.PhotoMetadata{CameraModel: strings.Repeat("x", maxMediaMetadataStringBytes+1)})}, - {name: "non-finite aperture", mimeType: "image/jpeg", metadata: photoOnly(&v1pb.PhotoMetadata{FNumber: proto.Float64(math.NaN())})}, - {name: "zero exposure", mimeType: "image/jpeg", metadata: photoOnly(&v1pb.PhotoMetadata{ExposureTimeSeconds: proto.Float64(0)})}, - {name: "zero ISO", mimeType: "image/jpeg", metadata: photoOnly(&v1pb.PhotoMetadata{Iso: proto.Int32(0)})}, - {name: "invalid capture format", mimeType: "image/jpeg", metadata: photoOnly(&v1pb.PhotoMetadata{CaptureTime: &v1pb.MediaCaptureTime{LocalDateTime: "2026:08:10 14:32:18"}})}, - {name: "invalid calendar date", mimeType: "image/jpeg", metadata: photoOnly(&v1pb.PhotoMetadata{CaptureTime: &v1pb.MediaCaptureTime{LocalDateTime: "2026-02-30T14:32:18"}})}, - {name: "invalid offset", mimeType: "image/jpeg", metadata: photoOnly(&v1pb.PhotoMetadata{CaptureTime: &v1pb.MediaCaptureTime{LocalDateTime: "2026-08-10T14:32:18", UtcOffset: proto.String("+14:30")}})}, - {name: "missing longitude", mimeType: "image/jpeg", metadata: photoOnly(&v1pb.PhotoMetadata{Location: &v1pb.MediaLocation{Latitude: proto.Float64(1)}})}, - {name: "latitude out of range", mimeType: "image/jpeg", metadata: photoOnly(&v1pb.PhotoMetadata{Location: &v1pb.MediaLocation{Latitude: proto.Float64(91), Longitude: proto.Float64(1)}})}, - {name: "non-finite altitude", mimeType: "image/jpeg", metadata: photoOnly(&v1pb.PhotoMetadata{Location: &v1pb.MediaLocation{Latitude: proto.Float64(1), Longitude: proto.Float64(1), AltitudeMeters: proto.Float64(math.Inf(1))}})}, - {name: "negative duration", mimeType: "video/mp4", metadata: &v1pb.MediaMetadata{Details: &v1pb.MediaMetadata_Video{Video: &v1pb.VideoMetadata{DurationSeconds: proto.Float64(-1)}}}}, + {name: "empty photo", mimeType: "image/jpeg", metadata: &apipb.MediaMetadata{Details: &apipb.MediaMetadata_Photo{Photo: &apipb.PhotoMetadata{}}}}, + {name: "video on image", mimeType: "image/jpeg", metadata: &apipb.MediaMetadata{Details: &apipb.MediaMetadata_Video{Video: &apipb.VideoMetadata{DurationSeconds: proto.Float64(1)}}}}, + {name: "empty video", mimeType: "video/mp4", metadata: &apipb.MediaMetadata{Details: &apipb.MediaMetadata_Video{Video: &apipb.VideoMetadata{}}}}, + {name: "invalid source EXIF orientation", mimeType: "image/jpeg", metadata: photoOnly(&apipb.PhotoMetadata{SourceExifOrientation: proto.Int32(9)})}, + {name: "blank camera make", mimeType: "image/jpeg", metadata: photoOnly(&apipb.PhotoMetadata{CameraMake: " "})}, + {name: "control character in camera make", mimeType: "image/jpeg", metadata: photoOnly(&apipb.PhotoMetadata{CameraMake: "Apple\nCo"})}, + {name: "null byte in lens model", mimeType: "image/jpeg", metadata: photoOnly(&apipb.PhotoMetadata{LensModel: "Main\x00Camera"})}, + {name: "long camera model", mimeType: "image/jpeg", metadata: photoOnly(&apipb.PhotoMetadata{CameraModel: strings.Repeat("x", maxMediaMetadataStringBytes+1)})}, + {name: "non-finite aperture", mimeType: "image/jpeg", metadata: photoOnly(&apipb.PhotoMetadata{FNumber: proto.Float64(math.NaN())})}, + {name: "zero exposure", mimeType: "image/jpeg", metadata: photoOnly(&apipb.PhotoMetadata{ExposureTimeSeconds: proto.Float64(0)})}, + {name: "zero ISO", mimeType: "image/jpeg", metadata: photoOnly(&apipb.PhotoMetadata{Iso: proto.Int32(0)})}, + {name: "invalid capture format", mimeType: "image/jpeg", metadata: photoOnly(&apipb.PhotoMetadata{CaptureTime: &apipb.MediaCaptureTime{LocalDateTime: "2026:08:10 14:32:18"}})}, + {name: "invalid calendar date", mimeType: "image/jpeg", metadata: photoOnly(&apipb.PhotoMetadata{CaptureTime: &apipb.MediaCaptureTime{LocalDateTime: "2026-02-30T14:32:18"}})}, + {name: "invalid offset", mimeType: "image/jpeg", metadata: photoOnly(&apipb.PhotoMetadata{CaptureTime: &apipb.MediaCaptureTime{LocalDateTime: "2026-08-10T14:32:18", UtcOffset: proto.String("+14:30")}})}, + {name: "missing longitude", mimeType: "image/jpeg", metadata: photoOnly(&apipb.PhotoMetadata{Location: &apipb.MediaLocation{Latitude: proto.Float64(1)}})}, + {name: "latitude out of range", mimeType: "image/jpeg", metadata: photoOnly(&apipb.PhotoMetadata{Location: &apipb.MediaLocation{Latitude: proto.Float64(91), Longitude: proto.Float64(1)}})}, + {name: "non-finite altitude", mimeType: "image/jpeg", metadata: photoOnly(&apipb.PhotoMetadata{Location: &apipb.MediaLocation{Latitude: proto.Float64(1), Longitude: proto.Float64(1), AltitudeMeters: proto.Float64(math.Inf(1))}})}, + {name: "negative duration", mimeType: "video/mp4", metadata: &apipb.MediaMetadata{Details: &apipb.MediaMetadata_Video{Video: &apipb.VideoMetadata{DurationSeconds: proto.Float64(-1)}}}}, } for _, test := range tests { @@ -118,6 +118,6 @@ func TestValidateClientMediaMetadata(t *testing.T) { } } -func photoOnly(photo *v1pb.PhotoMetadata) *v1pb.MediaMetadata { - return &v1pb.MediaMetadata{Details: &v1pb.MediaMetadata_Photo{Photo: photo}} +func photoOnly(photo *apipb.PhotoMetadata) *apipb.MediaMetadata { + return &apipb.MediaMetadata{Details: &apipb.MediaMetadata_Photo{Photo: photo}} } diff --git a/server/api/v1/attachment_mime_test.go b/server/api/attachment_mime_test.go similarity index 98% rename from server/api/v1/attachment_mime_test.go rename to server/api/attachment_mime_test.go index 2a93ff1af..2096bc346 100644 --- a/server/api/v1/attachment_mime_test.go +++ b/server/api/attachment_mime_test.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "testing" diff --git a/server/api/v1/attachment_motion.go b/server/api/attachment_motion.go similarity index 80% rename from server/api/v1/attachment_motion.go rename to server/api/attachment_motion.go index 9d0f849d9..cacf9f0c9 100644 --- a/server/api/v1/attachment_motion.go +++ b/server/api/attachment_motion.go @@ -1,26 +1,26 @@ -package v1 +package api import ( - v1pb "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" storepb "github.com/usememos/memos/proto/gen/store" "github.com/usememos/memos/store" ) -func convertMotionMediaFromStore(motion *storepb.MotionMedia) *v1pb.MotionMedia { +func convertMotionMediaFromStore(motion *storepb.MotionMedia) *apipb.MotionMedia { if motion == nil { return nil } - return &v1pb.MotionMedia{ - Family: v1pb.MotionMediaFamily(motion.Family), - Role: v1pb.MotionMediaRole(motion.Role), + return &apipb.MotionMedia{ + Family: apipb.MotionMediaFamily(motion.Family), + Role: apipb.MotionMediaRole(motion.Role), GroupId: motion.GroupId, PresentationTimestampUs: motion.PresentationTimestampUs, HasEmbeddedVideo: motion.HasEmbeddedVideo, } } -func convertMotionMediaToStore(motion *v1pb.MotionMedia) *storepb.MotionMedia { +func convertMotionMediaToStore(motion *apipb.MotionMedia) *storepb.MotionMedia { if motion == nil { return nil } diff --git a/server/api/v1/attachment_service.go b/server/api/attachment_service.go similarity index 92% rename from server/api/v1/attachment_service.go rename to server/api/attachment_service.go index e8ebeccf3..b14c2382d 100644 --- a/server/api/v1/attachment_service.go +++ b/server/api/attachment_service.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "bytes" @@ -20,7 +20,7 @@ import ( "github.com/usememos/memos/core/access" "github.com/usememos/memos/internal/motionphoto" "github.com/usememos/memos/internal/ratelimit" - v1pb "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" storepb "github.com/usememos/memos/proto/gen/store" "github.com/usememos/memos/store" ) @@ -74,7 +74,7 @@ func detectAttachmentMimeType(filename string, content []byte) string { return http.DetectContentType(content) } -func (s *APIV1Service) prepareAttachment(ctx context.Context, request *v1pb.CreateAttachmentRequest) (*store.Attachment, error) { +func (s *APIService) prepareAttachment(ctx context.Context, request *apipb.CreateAttachmentRequest) (*store.Attachment, error) { user, err := s.fetchCurrentUser(ctx) if err != nil { return nil, status.Errorf(codes.Internal, "failed to get current user: %v", err) @@ -164,7 +164,7 @@ func (s *APIV1Service) prepareAttachment(ctx context.Context, request *v1pb.Crea return create, nil } -func (s *APIV1Service) CreateAttachment(ctx context.Context, request *v1pb.CreateAttachmentRequest) (*v1pb.Attachment, error) { +func (s *APIService) CreateAttachment(ctx context.Context, request *apipb.CreateAttachmentRequest) (*apipb.Attachment, error) { create, err := s.prepareAttachment(ctx, request) if err != nil { return nil, err @@ -208,7 +208,7 @@ type attachmentSource interface { // processAndSaveAttachment detects motion photos, strips EXIF metadata, stores // the content, and creates the database row. create.Size must hold the source // length on entry; it is updated when stripping re-encodes the image. -func (s *APIV1Service) processAndSaveAttachment(ctx context.Context, create *store.Attachment, instanceStorageSetting *storepb.InstanceStorageSetting, source attachmentSource) (*v1pb.Attachment, error) { +func (s *APIService) processAndSaveAttachment(ctx context.Context, create *store.Attachment, instanceStorageSetting *storepb.InstanceStorageSetting, source attachmentSource) (*apipb.Attachment, error) { if create.Payload.GetMotionMedia() == nil && (create.Type == "image/jpeg" || create.Type == "image/jpg") { detected, err := motionphoto.DetectJPEGReader(source, create.Size) if err != nil { @@ -263,7 +263,7 @@ func (s *APIV1Service) processAndSaveAttachment(ctx context.Context, create *sto return s.persistAttachment(ctx, create, instanceStorageSetting) } -func (s *APIV1Service) persistAttachment(ctx context.Context, create *store.Attachment, instanceStorageSetting *storepb.InstanceStorageSetting) (*v1pb.Attachment, error) { +func (s *APIService) persistAttachment(ctx context.Context, create *store.Attachment, instanceStorageSetting *storepb.InstanceStorageSetting) (*apipb.Attachment, error) { attachment, err := s.Store.CreateAttachment(ctx, create) if err != nil { createErr := mapMemoWriteError(err, "failed to create attachment") @@ -289,7 +289,7 @@ func (s *APIV1Service) persistAttachment(ctx context.Context, create *store.Atta return convertAttachmentFromStore(attachment), nil } -func (s *APIV1Service) ListAttachments(ctx context.Context, request *v1pb.ListAttachmentsRequest) (*v1pb.ListAttachmentsResponse, error) { +func (s *APIService) ListAttachments(ctx context.Context, request *apipb.ListAttachmentsRequest) (*apipb.ListAttachmentsResponse, error) { user, err := s.fetchCurrentUser(ctx) if err != nil { return nil, status.Errorf(codes.Internal, "failed to get current user: %v", err) @@ -328,7 +328,7 @@ func (s *APIV1Service) ListAttachments(ctx context.Context, request *v1pb.ListAt return nil, status.Errorf(codes.Internal, "failed to list attachments: %v", err) } - response := &v1pb.ListAttachmentsResponse{} + response := &apipb.ListAttachmentsResponse{} for _, attachment := range attachments { response.Attachments = append(response.Attachments, convertAttachmentFromStore(attachment)) @@ -342,7 +342,7 @@ func (s *APIV1Service) ListAttachments(ctx context.Context, request *v1pb.ListAt return response, nil } -func (s *APIV1Service) GetAttachment(ctx context.Context, request *v1pb.GetAttachmentRequest) (*v1pb.Attachment, error) { +func (s *APIService) GetAttachment(ctx context.Context, request *apipb.GetAttachmentRequest) (*apipb.Attachment, error) { attachmentUID, err := ExtractAttachmentUIDFromName(request.Name) if err != nil { return nil, status.Errorf(codes.InvalidArgument, "invalid attachment id: %v", err) @@ -363,7 +363,7 @@ func (s *APIV1Service) GetAttachment(ctx context.Context, request *v1pb.GetAttac return convertAttachmentFromStore(attachment), nil } -func (s *APIV1Service) UpdateAttachment(ctx context.Context, request *v1pb.UpdateAttachmentRequest) (*v1pb.Attachment, error) { +func (s *APIService) UpdateAttachment(ctx context.Context, request *apipb.UpdateAttachmentRequest) (*apipb.Attachment, error) { attachmentUID, err := ExtractAttachmentUIDFromName(request.Attachment.Name) if err != nil { return nil, status.Errorf(codes.InvalidArgument, "invalid attachment id: %v", err) @@ -424,7 +424,7 @@ func (s *APIV1Service) UpdateAttachment(ctx context.Context, request *v1pb.Updat return convertAttachmentFromStore(updatedAttachment), nil } -func (s *APIV1Service) DeleteAttachment(ctx context.Context, request *v1pb.DeleteAttachmentRequest) (*emptypb.Empty, error) { +func (s *APIService) DeleteAttachment(ctx context.Context, request *apipb.DeleteAttachmentRequest) (*emptypb.Empty, error) { attachmentUID, err := ExtractAttachmentUIDFromName(request.Name) if err != nil { return nil, status.Errorf(codes.InvalidArgument, "invalid attachment id: %v", err) @@ -453,7 +453,7 @@ func (s *APIV1Service) DeleteAttachment(ctx context.Context, request *v1pb.Delet return &emptypb.Empty{}, nil } -func (s *APIV1Service) BatchDeleteAttachments(ctx context.Context, request *v1pb.BatchDeleteAttachmentsRequest) (*emptypb.Empty, error) { +func (s *APIService) BatchDeleteAttachments(ctx context.Context, request *apipb.BatchDeleteAttachmentsRequest) (*emptypb.Empty, error) { user, err := s.fetchCurrentUser(ctx) if err != nil { return nil, status.Errorf(codes.Internal, "failed to get current user: %v", err) @@ -502,7 +502,7 @@ func (s *APIV1Service) BatchDeleteAttachments(ctx context.Context, request *v1pb return &emptypb.Empty{}, nil } -func (s *APIV1Service) validateAttachmentDeletionPreflight(ctx context.Context, user *store.User, attachments []*store.Attachment) (map[int32]string, error) { +func (s *APIService) validateAttachmentDeletionPreflight(ctx context.Context, user *store.User, attachments []*store.Attachment) (map[int32]string, error) { deletingUIDs, err := s.validateAttachmentMotionGroupDeletion(ctx, user, attachments) if err != nil { return nil, err @@ -546,7 +546,7 @@ func (s *APIV1Service) validateAttachmentDeletionPreflight(ctx context.Context, return expectedMemoContents, nil } -func (s *APIV1Service) validateAttachmentMotionGroupDeletion( +func (s *APIService) validateAttachmentMotionGroupDeletion( ctx context.Context, user *store.User, attachments []*store.Attachment, @@ -591,7 +591,7 @@ func (s *APIV1Service) validateAttachmentMotionGroupDeletion( return deletingUIDs, nil } -func (s *APIV1Service) deleteAttachmentsAtomically(ctx context.Context, user *store.User, attachments []*store.Attachment) error { +func (s *APIService) deleteAttachmentsAtomically(ctx context.Context, user *store.User, attachments []*store.Attachment) error { expectedMemoContents, err := s.validateAttachmentDeletionPreflight(ctx, user, attachments) if err != nil { return err @@ -627,7 +627,7 @@ func attachmentsIncludeMemo(attachments []*store.Attachment) bool { // checkAttachmentAccess verifies the user has permission to access the attachment. // For unlinked attachments (no memo), only the creator can access. // For linked attachments, access follows the memo's visibility rules. -func (s *APIV1Service) checkAttachmentAccess(ctx context.Context, attachment *store.Attachment) error { +func (s *APIService) checkAttachmentAccess(ctx context.Context, attachment *store.Attachment) error { // For unlinked attachments, only the creator can access. if attachment.MemoID == nil { user, err := s.fetchCurrentUser(ctx) diff --git a/server/api/v1/attachment_service_image.go b/server/api/attachment_service_image.go similarity index 90% rename from server/api/v1/attachment_service_image.go rename to server/api/attachment_service_image.go index 39a3ffbb7..02127a547 100644 --- a/server/api/v1/attachment_service_image.go +++ b/server/api/attachment_service_image.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "bytes" @@ -12,19 +12,19 @@ import ( "google.golang.org/grpc/status" "github.com/usememos/memos/internal/imagelimit" - v1pb "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" storepb "github.com/usememos/memos/proto/gen/store" ) -func validateClientMotionMedia(motion *v1pb.MotionMedia, attachmentUID string) (*storepb.MotionMedia, error) { +func validateClientMotionMedia(motion *apipb.MotionMedia, attachmentUID string) (*storepb.MotionMedia, error) { if motion == nil { return nil, nil } - if motion.Family != v1pb.MotionMediaFamily_APPLE_LIVE_PHOTO { + if motion.Family != apipb.MotionMediaFamily_APPLE_LIVE_PHOTO { return nil, status.Errorf(codes.InvalidArgument, "only Apple Live Photo motion metadata can be provided by clients") } - if motion.Role != v1pb.MotionMediaRole_STILL && motion.Role != v1pb.MotionMediaRole_VIDEO { + if motion.Role != apipb.MotionMediaRole_STILL && motion.Role != apipb.MotionMediaRole_VIDEO { return nil, status.Errorf(codes.InvalidArgument, "invalid Apple Live Photo motion role") } @@ -68,7 +68,7 @@ func shouldStripExifContent(source io.ReadSeeker, declaredType string) (bool, er return ok && shouldStripExif(sniffed), nil } -func (s *APIV1Service) acquireImageProcessingSlot(ctx context.Context) (func(), error) { +func (s *APIService) acquireImageProcessingSlot(ctx context.Context) (func(), error) { if s.imageProcessingSemaphore == nil { return func() {}, nil } diff --git a/server/api/v1/attachment_service_storage.go b/server/api/attachment_service_storage.go similarity index 95% rename from server/api/v1/attachment_service_storage.go rename to server/api/attachment_service_storage.go index f8567c13b..2bc2cae12 100644 --- a/server/api/v1/attachment_service_storage.go +++ b/server/api/attachment_service_storage.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "bytes" @@ -17,13 +17,13 @@ import ( "github.com/usememos/memos/internal/profile" "github.com/usememos/memos/internal/random" - v1pb "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" storepb "github.com/usememos/memos/proto/gen/store" "github.com/usememos/memos/store" ) -func convertAttachmentFromStore(attachment *store.Attachment) *v1pb.Attachment { - attachmentMessage := &v1pb.Attachment{ +func convertAttachmentFromStore(attachment *store.Attachment) *apipb.Attachment { + attachmentMessage := &apipb.Attachment{ Name: fmt.Sprintf("%s%s", AttachmentNamePrefix, attachment.UID), CreateTime: timestamppb.New(time.Unix(attachment.CreatedTs, 0)), Filename: attachment.Filename, @@ -223,7 +223,7 @@ func hasSameManagedStorageObject(left, right *store.Attachment) bool { } } -func (s *APIV1Service) cleanupDeletedAttachmentStorage(ctx context.Context, attachments []*store.Attachment) error { +func (s *APIService) cleanupDeletedAttachmentStorage(ctx context.Context, attachments []*store.Attachment) error { var instanceStorageSetting *storepb.InstanceStorageSetting var instanceStorageSettingErr error for _, attachment := range attachments { @@ -252,7 +252,7 @@ func (s *APIV1Service) cleanupDeletedAttachmentStorage(ctx context.Context, atta } // GetAttachmentBlob reads an attachment from its configured storage. -func (s *APIV1Service) GetAttachmentBlob(ctx context.Context, attachment *store.Attachment) ([]byte, error) { +func (s *APIService) GetAttachmentBlob(ctx context.Context, attachment *store.Attachment) ([]byte, error) { content, err := s.openAttachmentContent(ctx, attachment) if err != nil { return nil, err @@ -268,7 +268,7 @@ func (s *APIV1Service) GetAttachmentBlob(ctx context.Context, attachment *store. // openAttachmentContent streams an attachment from its configured storage. // Database-backed attachments are re-read with their blob when the caller // listed them without it. -func (s *APIV1Service) openAttachmentContent(ctx context.Context, attachment *store.Attachment) (io.ReadCloser, error) { +func (s *APIService) openAttachmentContent(ctx context.Context, attachment *store.Attachment) (io.ReadCloser, error) { switch attachment.StorageType { case storepb.AttachmentStorageType_LOCAL: attachmentPath := filepath.FromSlash(attachment.Reference) diff --git a/server/api/v1/attachment_service_storage_test.go b/server/api/attachment_service_storage_test.go similarity index 98% rename from server/api/v1/attachment_service_storage_test.go rename to server/api/attachment_service_storage_test.go index f73275abc..246b5aee0 100644 --- a/server/api/v1/attachment_service_storage_test.go +++ b/server/api/attachment_service_storage_test.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "testing" diff --git a/server/api/v1/attachment_upload.go b/server/api/attachment_upload.go similarity index 83% rename from server/api/v1/attachment_upload.go rename to server/api/attachment_upload.go index 16aff6070..374c87bd3 100644 --- a/server/api/v1/attachment_upload.go +++ b/server/api/attachment_upload.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "context" @@ -11,20 +11,20 @@ import ( "google.golang.org/protobuf/proto" "github.com/usememos/memos/internal/ratelimit" - v1pb "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" "github.com/usememos/memos/store" ) const ( attachmentUploadMetadataLimit = 64 << 10 attachmentUploadTempPrefix = ".memos-rpc-upload-" - attachmentUploadProcedure = "/memos.api.v1.AttachmentService/UploadAttachment" + attachmentUploadProcedure = "/memos.api.AttachmentService/UploadAttachment" ) // attachmentUploadState is what an attachment upload carries besides its // bytes. Only Attachment is an API resource. type attachmentUploadState struct { - metadata *v1pb.Attachment + metadata *apipb.Attachment uid string finalizeAttempted bool } @@ -37,7 +37,7 @@ type ( // UploadAttachment accepts bounded unary chunks. A call carrying a spec opens // a new upload; a call carrying an upload ID continues one. Either kind may // write data and finalize. -func (s *APIV1Service) UploadAttachment(ctx context.Context, request *v1pb.UploadAttachmentRequest) (*v1pb.UploadAttachmentResponse, error) { +func (s *APIService) UploadAttachment(ctx context.Context, request *apipb.UploadAttachmentRequest) (*apipb.UploadAttachmentResponse, error) { user, err := s.requireCurrentSpaceUser(ctx) if err != nil { return nil, err @@ -48,7 +48,7 @@ func (s *APIV1Service) UploadAttachment(ctx context.Context, request *v1pb.Uploa var id string var upload *attachmentUpload switch u := request.Upload.(type) { - case *v1pb.UploadAttachmentRequest_Spec: + case *apipb.UploadAttachmentRequest_Spec: if err := s.throttleAndCharge(ratelimit.ScopeUploadUser, userKey(user.ID), 1); err != nil { return nil, err } @@ -57,7 +57,7 @@ func (s *APIV1Service) UploadAttachment(ctx context.Context, request *v1pb.Uploa return nil, err } upload.mu.Lock() - case *v1pb.UploadAttachmentRequest_UploadId: + case *apipb.UploadAttachmentRequest_UploadId: id = u.UploadId upload, err = s.attachmentUploads.resume(id, user.ID) if err != nil { @@ -73,11 +73,11 @@ func (s *APIV1Service) UploadAttachment(ctx context.Context, request *v1pb.Uploa if err := upload.write(request.WriteOffset, request.Data, request.FinishWrite); err != nil { return nil, err } - var attachment *v1pb.Attachment + var attachment *apipb.Attachment if upload.complete { // Recheck access and existence; a completed upload must not resurrect a // deleted attachment or disclose metadata after access is revoked. - attachment, err = s.GetAttachment(ctx, &v1pb.GetAttachmentRequest{Name: "attachments/" + upload.state.uid}) + attachment, err = s.GetAttachment(ctx, &apipb.GetAttachmentRequest{Name: "attachments/" + upload.state.uid}) } else if request.FinishWrite { if upload.committedSize != upload.totalSize { return nil, status.Errorf(codes.FailedPrecondition, "upload is incomplete") @@ -92,7 +92,7 @@ func (s *APIV1Service) UploadAttachment(ctx context.Context, request *v1pb.Uploa return nil, err } upload.expireTime = time.Now().Add(uploadTTL) - return &v1pb.UploadAttachmentResponse{ + return &apipb.UploadAttachmentResponse{ UploadId: id, CommittedSize: upload.committedSize, Attachment: attachment, MaxChunkSize: uploadChunkSize, }, nil } @@ -100,7 +100,7 @@ func (s *APIV1Service) UploadAttachment(ctx context.Context, request *v1pb.Uploa // startAttachmentUpload validates the spec and registers a new upload. Every // check that can fail on the accompanying data runs first, so a rejected call // never leaves an orphaned upload behind. -func (s *APIV1Service) startAttachmentUpload(ctx context.Context, request *v1pb.UploadAttachmentRequest, spec *v1pb.UploadAttachmentSpec, ownerID int32) (string, *attachmentUpload, error) { +func (s *APIService) startAttachmentUpload(ctx context.Context, request *apipb.UploadAttachmentRequest, spec *apipb.UploadAttachmentSpec, ownerID int32) (string, *attachmentUpload, error) { if spec.Attachment == nil { return "", nil, status.Errorf(codes.InvalidArgument, "spec.attachment is required") } @@ -131,7 +131,7 @@ func (s *APIV1Service) startAttachmentUpload(ctx context.Context, request *v1pb. // Type-dependent metadata validation must wait for content sniffing. validationMetadata.MediaMetadata = nil } - create, err := s.prepareAttachment(ctx, &v1pb.CreateAttachmentRequest{Attachment: validationMetadata, AttachmentId: spec.AttachmentId}) + create, err := s.prepareAttachment(ctx, &apipb.CreateAttachmentRequest{Attachment: validationMetadata, AttachmentId: spec.AttachmentId}) if err != nil { return "", nil, err } @@ -139,7 +139,7 @@ func (s *APIV1Service) startAttachmentUpload(ctx context.Context, request *v1pb. return s.attachmentUploads.create(s.Profile.Data, attachmentUploadTempPrefix, ownerID, spec.TotalSize, state) } -func (s *APIV1Service) finishAttachmentUpload(ctx context.Context, upload *attachmentUpload) (*v1pb.Attachment, error) { +func (s *APIService) finishAttachmentUpload(ctx context.Context, upload *attachmentUpload) (*apipb.Attachment, error) { if upload.state.finalizeAttempted { // A database operation may commit before returning an error. Resolve that // outcome before saving another object under the upload's stable UID. @@ -151,7 +151,7 @@ func (s *APIV1Service) finishAttachmentUpload(ctx context.Context, upload *attac if persisted.CreatorID != upload.ownerID { return nil, status.Errorf(codes.AlreadyExists, "attachment ID already exists") } - return s.GetAttachment(ctx, &v1pb.GetAttachmentRequest{Name: "attachments/" + upload.state.uid}) + return s.GetAttachment(ctx, &apipb.GetAttachmentRequest{Name: "attachments/" + upload.state.uid}) } } setting, err := s.Store.GetInstanceStorageSetting(ctx) @@ -172,7 +172,7 @@ func (s *APIV1Service) finishAttachmentUpload(ctx context.Context, upload *attac return nil, status.Errorf(codes.Internal, "failed to read attachment header: %v", err) } // Revalidate memo permissions and media metadata with the actual MIME type. - create, err := s.prepareAttachment(ctx, &v1pb.CreateAttachmentRequest{Attachment: metadata, AttachmentId: upload.state.uid}) + create, err := s.prepareAttachment(ctx, &apipb.CreateAttachmentRequest{Attachment: metadata, AttachmentId: upload.state.uid}) if err != nil { return nil, err } diff --git a/server/api/v1/attachment_upload_test.go b/server/api/attachment_upload_test.go similarity index 69% rename from server/api/v1/attachment_upload_test.go rename to server/api/attachment_upload_test.go index d7b15772b..58d4c2702 100644 --- a/server/api/v1/attachment_upload_test.go +++ b/server/api/attachment_upload_test.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "bytes" @@ -17,12 +17,12 @@ import ( "google.golang.org/protobuf/proto" "github.com/usememos/memos/internal/testutil" - v1pb "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" storepb "github.com/usememos/memos/proto/gen/store" "github.com/usememos/memos/store" ) -func newUploadTestService(t *testing.T) (*APIV1Service, context.Context) { +func newUploadTestService(t *testing.T) (*APIService, context.Context) { t.Helper() svc := newIntegrationService(t) t.Cleanup(svc.CloseUploads) @@ -30,19 +30,19 @@ func newUploadTestService(t *testing.T) (*APIV1Service, context.Context) { return svc, userCtx(context.Background(), user.ID) } -func uploadSpec(filename string, size int64) *v1pb.UploadAttachmentRequest_Spec { - return &v1pb.UploadAttachmentRequest_Spec{Spec: &v1pb.UploadAttachmentSpec{Attachment: &v1pb.Attachment{Filename: filename}, TotalSize: size}} +func uploadSpec(filename string, size int64) *apipb.UploadAttachmentRequest_Spec { + return &apipb.UploadAttachmentRequest_Spec{Spec: &apipb.UploadAttachmentSpec{Attachment: &apipb.Attachment{Filename: filename}, TotalSize: size}} } -func uploadID(id string) *v1pb.UploadAttachmentRequest_UploadId { - return &v1pb.UploadAttachmentRequest_UploadId{UploadId: id} +func uploadID(id string) *apipb.UploadAttachmentRequest_UploadId { + return &apipb.UploadAttachmentRequest_UploadId{UploadId: id} } -func startTestUpload(ctx context.Context, t *testing.T, svc *APIV1Service, size int64) string { +func startTestUpload(ctx context.Context, t *testing.T, svc *APIService, size int64) string { t.Helper() spec := uploadSpec("file.bin", size) spec.Spec.Attachment.Type = "application/octet-stream" - response, err := svc.UploadAttachment(ctx, &v1pb.UploadAttachmentRequest{Upload: spec}) + response, err := svc.UploadAttachment(ctx, &apipb.UploadAttachmentRequest{Upload: spec}) require.NoError(t, err) require.NotEmpty(t, response.UploadId) require.EqualValues(t, uploadChunkSize, response.MaxChunkSize) @@ -54,14 +54,14 @@ func startTestUpload(ctx context.Context, t *testing.T, svc *APIV1Service, size func TestUploadAttachmentChunksAndRetries(t *testing.T) { svc, ctx := newUploadTestService(t) id := startTestUpload(ctx, t, svc, 6) - first := &v1pb.UploadAttachmentRequest{Upload: uploadID(id), Data: []byte("abc")} + first := &apipb.UploadAttachmentRequest{Upload: uploadID(id), Data: []byte("abc")} for range 2 { response, err := svc.UploadAttachment(ctx, first) require.NoError(t, err) require.Equal(t, id, response.UploadId) require.EqualValues(t, 3, response.CommittedSize) } - for _, request := range []*v1pb.UploadAttachmentRequest{ + for _, request := range []*apipb.UploadAttachmentRequest{ {Upload: uploadID(id), Data: []byte("xyz")}, {Upload: uploadID(id), WriteOffset: 4, Data: []byte("d")}, {Upload: uploadID(id), WriteOffset: -1, Data: []byte("d")}, @@ -69,17 +69,17 @@ func TestUploadAttachmentChunksAndRetries(t *testing.T) { _, err := svc.UploadAttachment(ctx, request) require.Equal(t, codes.OutOfRange, status.Code(err)) } - progress, err := svc.UploadAttachment(ctx, &v1pb.UploadAttachmentRequest{Upload: uploadID(id), WriteOffset: -1}) + progress, err := svc.UploadAttachment(ctx, &apipb.UploadAttachmentRequest{Upload: uploadID(id), WriteOffset: -1}) require.NoError(t, err) require.EqualValues(t, 3, progress.CommittedSize) - _, err = svc.UploadAttachment(ctx, &v1pb.UploadAttachmentRequest{Upload: uploadID(id), WriteOffset: 3, FinishWrite: true}) + _, err = svc.UploadAttachment(ctx, &apipb.UploadAttachmentRequest{Upload: uploadID(id), WriteOffset: 3, FinishWrite: true}) require.Equal(t, codes.FailedPrecondition, status.Code(err)) - last := &v1pb.UploadAttachmentRequest{Upload: uploadID(id), WriteOffset: 3, Data: []byte("def"), FinishWrite: true} + last := &apipb.UploadAttachmentRequest{Upload: uploadID(id), WriteOffset: 3, Data: []byte("def"), FinishWrite: true} result, err := svc.UploadAttachment(ctx, last) require.NoError(t, err) require.EqualValues(t, 6, result.Attachment.Size) - for _, request := range []*v1pb.UploadAttachmentRequest{last, {Upload: uploadID(id)}, {Upload: uploadID(id), WriteOffset: 6, FinishWrite: true}} { + for _, request := range []*apipb.UploadAttachmentRequest{last, {Upload: uploadID(id)}, {Upload: uploadID(id), WriteOffset: 6, FinishWrite: true}} { repeated, err := svc.UploadAttachment(ctx, request) require.NoError(t, err) require.Equal(t, result.Attachment.Name, repeated.Attachment.Name) @@ -92,7 +92,7 @@ func TestUploadAttachmentChunksAndRetries(t *testing.T) { require.Equal(t, "abcdef", string(content)) require.NoFileExists(t, svc.attachmentUploads.entries[id].path) - _, err = svc.DeleteAttachment(ctx, &v1pb.DeleteAttachmentRequest{Name: result.Attachment.Name}) + _, err = svc.DeleteAttachment(ctx, &apipb.DeleteAttachmentRequest{Name: result.Attachment.Name}) require.NoError(t, err) _, err = svc.UploadAttachment(ctx, last) require.Equal(t, codes.NotFound, status.Code(err)) @@ -102,22 +102,22 @@ func TestUploadAttachmentSingleCall(t *testing.T) { svc, ctx := newUploadTestService(t) spec := uploadSpec("note.txt", 3) spec.Spec.AttachmentId = "chosen-id" - result, err := svc.UploadAttachment(ctx, &v1pb.UploadAttachmentRequest{Upload: spec, Data: []byte("abc"), FinishWrite: true}) + result, err := svc.UploadAttachment(ctx, &apipb.UploadAttachmentRequest{Upload: spec, Data: []byte("abc"), FinishWrite: true}) require.NoError(t, err) require.Equal(t, "attachments/chosen-id", result.Attachment.Name) require.EqualValues(t, 3, result.Attachment.Size) require.EqualValues(t, 3, result.CommittedSize) - empty, err := svc.UploadAttachment(ctx, &v1pb.UploadAttachmentRequest{Upload: uploadSpec("empty.txt", 0), FinishWrite: true}) + empty, err := svc.UploadAttachment(ctx, &apipb.UploadAttachmentRequest{Upload: uploadSpec("empty.txt", 0), FinishWrite: true}) require.NoError(t, err) require.Zero(t, empty.Attachment.Size) // A spec call may carry the first chunk without finishing. - partial, err := svc.UploadAttachment(ctx, &v1pb.UploadAttachmentRequest{Upload: uploadSpec("two.bin", 4), Data: []byte("ab")}) + partial, err := svc.UploadAttachment(ctx, &apipb.UploadAttachmentRequest{Upload: uploadSpec("two.bin", 4), Data: []byte("ab")}) require.NoError(t, err) require.Nil(t, partial.Attachment) require.EqualValues(t, 2, partial.CommittedSize) - done, err := svc.UploadAttachment(ctx, &v1pb.UploadAttachmentRequest{Upload: uploadID(partial.UploadId), WriteOffset: 2, Data: []byte("cd"), FinishWrite: true}) + done, err := svc.UploadAttachment(ctx, &apipb.UploadAttachmentRequest{Upload: uploadID(partial.UploadId), WriteOffset: 2, Data: []byte("cd"), FinishWrite: true}) require.NoError(t, err) require.EqualValues(t, 4, done.Attachment.Size) @@ -128,15 +128,15 @@ func TestUploadAttachmentSingleCall(t *testing.T) { func TestUploadAttachmentValidation(t *testing.T) { svc, ctx := newUploadTestService(t) - _, err := svc.UploadAttachment(context.Background(), &v1pb.UploadAttachmentRequest{}) + _, err := svc.UploadAttachment(context.Background(), &apipb.UploadAttachmentRequest{}) require.Equal(t, codes.Unauthenticated, status.Code(err)) badID := uploadSpec("file", 0) badID.Spec.AttachmentId = "bad id!" withContent := uploadSpec("file", 0) withContent.Spec.Attachment.Content = []byte("not metadata") - for _, request := range []*v1pb.UploadAttachmentRequest{ + for _, request := range []*apipb.UploadAttachmentRequest{ {}, - {Upload: &v1pb.UploadAttachmentRequest_Spec{Spec: &v1pb.UploadAttachmentSpec{}}}, + {Upload: &apipb.UploadAttachmentRequest_Spec{Spec: &apipb.UploadAttachmentSpec{}}}, {Upload: uploadSpec("file", -1)}, {Upload: uploadSpec("../file", 0)}, {Upload: withContent}, @@ -147,27 +147,27 @@ func TestUploadAttachmentValidation(t *testing.T) { _, err := svc.UploadAttachment(ctx, request) require.Equal(t, codes.InvalidArgument, status.Code(err), request.String()) } - _, err = svc.UploadAttachment(ctx, &v1pb.UploadAttachmentRequest{Upload: uploadSpec("file", 3), WriteOffset: 1, Data: []byte("abc")}) + _, err = svc.UploadAttachment(ctx, &apipb.UploadAttachmentRequest{Upload: uploadSpec("file", 3), WriteOffset: 1, Data: []byte("abc")}) require.Equal(t, codes.OutOfRange, status.Code(err)) - _, err = svc.UploadAttachment(ctx, &v1pb.UploadAttachmentRequest{Upload: uploadSpec("file", 1<<60)}) + _, err = svc.UploadAttachment(ctx, &apipb.UploadAttachmentRequest{Upload: uploadSpec("file", 1<<60)}) require.Equal(t, codes.ResourceExhausted, status.Code(err)) require.Empty(t, svc.attachmentUploads.entries, "rejected spec calls must not register uploads") id := startTestUpload(ctx, t, svc, 3) other := createSpaceTestUser(context.Background(), t, svc, "other-uploader", store.RoleUser) - _, err = svc.UploadAttachment(userCtx(context.Background(), other.ID), &v1pb.UploadAttachmentRequest{Upload: uploadID(id)}) + _, err = svc.UploadAttachment(userCtx(context.Background(), other.ID), &apipb.UploadAttachmentRequest{Upload: uploadID(id)}) require.Equal(t, codes.NotFound, status.Code(err)) - _, err = svc.UploadAttachment(ctx, &v1pb.UploadAttachmentRequest{Upload: uploadID("unknown")}) + _, err = svc.UploadAttachment(ctx, &apipb.UploadAttachmentRequest{Upload: uploadID("unknown")}) require.Equal(t, codes.NotFound, status.Code(err)) - _, err = svc.UploadAttachment(ctx, &v1pb.UploadAttachmentRequest{Upload: uploadID(id), Data: make([]byte, uploadChunkSize+1)}) + _, err = svc.UploadAttachment(ctx, &apipb.UploadAttachmentRequest{Upload: uploadID(id), Data: make([]byte, uploadChunkSize+1)}) require.Equal(t, codes.ResourceExhausted, status.Code(err)) - _, err = svc.UploadAttachment(ctx, &v1pb.UploadAttachmentRequest{Upload: uploadID(id), Data: []byte("four")}) + _, err = svc.UploadAttachment(ctx, &apipb.UploadAttachmentRequest{Upload: uploadID(id), Data: []byte("four")}) require.Equal(t, codes.InvalidArgument, status.Code(err)) canceled, cancel := context.WithCancel(ctx) cancel() - _, err = svc.UploadAttachment(canceled, &v1pb.UploadAttachmentRequest{Upload: uploadID(id), Data: []byte("abc")}) + _, err = svc.UploadAttachment(canceled, &apipb.UploadAttachmentRequest{Upload: uploadID(id), Data: []byte("abc")}) require.Error(t, err) - progress, err := svc.UploadAttachment(ctx, &v1pb.UploadAttachmentRequest{Upload: uploadID(id)}) + progress, err := svc.UploadAttachment(ctx, &apipb.UploadAttachmentRequest{Upload: uploadID(id)}) require.NoError(t, err) require.Zero(t, progress.CommittedSize) } @@ -176,11 +176,11 @@ func TestUploadAttachmentEmptyAndConcurrentFinish(t *testing.T) { svc, ctx := newUploadTestService(t) id := startTestUpload(ctx, t, svc, 0) var wg sync.WaitGroup - results := make(chan *v1pb.UploadAttachmentResponse, 8) + results := make(chan *apipb.UploadAttachmentResponse, 8) errs := make(chan error, 8) for range 8 { wg.Go(func() { - response, err := svc.UploadAttachment(ctx, &v1pb.UploadAttachmentRequest{Upload: uploadID(id), FinishWrite: true}) + response, err := svc.UploadAttachment(ctx, &apipb.UploadAttachmentRequest{Upload: uploadID(id), FinishWrite: true}) results <- response errs <- err }) @@ -207,7 +207,7 @@ func TestUploadAttachmentEmptyAndConcurrentFinish(t *testing.T) { func TestUploadAttachmentFinalizationRecovery(t *testing.T) { svc, ctx := newUploadTestService(t) id := startTestUpload(ctx, t, svc, 3) - last := &v1pb.UploadAttachmentRequest{Upload: uploadID(id), Data: []byte("abc"), FinishWrite: true} + last := &apipb.UploadAttachmentRequest{Upload: uploadID(id), Data: []byte("abc"), FinishWrite: true} _, err := svc.UploadAttachment(store.WithCreateAttachmentPostCommitFailpoint(ctx), last) require.Equal(t, codes.Internal, status.Code(err)) result, err := svc.UploadAttachment(ctx, last) @@ -223,15 +223,15 @@ func TestUploadAttachmentFinalizationRecovery(t *testing.T) { func TestUploadAttachmentRechecksMemoAndSize(t *testing.T) { svc, ctx := newUploadTestService(t) - memo, err := svc.CreateMemo(ctx, &v1pb.CreateMemoRequest{Memo: &v1pb.Memo{Content: "upload target"}}) + memo, err := svc.CreateMemo(ctx, &apipb.CreateMemoRequest{Memo: &apipb.Memo{Content: "upload target"}}) require.NoError(t, err) spec := uploadSpec("file.txt", 3) spec.Spec.Attachment.Memo = &memo.Name - initial, err := svc.UploadAttachment(ctx, &v1pb.UploadAttachmentRequest{Upload: spec}) + initial, err := svc.UploadAttachment(ctx, &apipb.UploadAttachmentRequest{Upload: spec}) require.NoError(t, err) - _, err = svc.DeleteMemo(ctx, &v1pb.DeleteMemoRequest{Name: memo.Name, Force: true}) + _, err = svc.DeleteMemo(ctx, &apipb.DeleteMemoRequest{Name: memo.Name, Force: true}) require.NoError(t, err) - _, err = svc.UploadAttachment(ctx, &v1pb.UploadAttachmentRequest{Upload: uploadID(initial.UploadId), Data: []byte("abc"), FinishWrite: true}) + _, err = svc.UploadAttachment(ctx, &apipb.UploadAttachmentRequest{Upload: uploadID(initial.UploadId), Data: []byte("abc"), FinishWrite: true}) require.Equal(t, codes.NotFound, status.Code(err)) id := startTestUpload(ctx, t, svc, 2*MebiByte) @@ -239,7 +239,7 @@ func TestUploadAttachmentRechecksMemoAndSize(t *testing.T) { Value: &storepb.InstanceSetting_StorageSetting{StorageSetting: &storepb.InstanceStorageSetting{UploadSizeLimitMb: 1}}, }) require.NoError(t, err) - _, err = svc.UploadAttachment(ctx, &v1pb.UploadAttachmentRequest{Upload: uploadID(id), Data: make([]byte, 2*MebiByte), FinishWrite: true}) + _, err = svc.UploadAttachment(ctx, &apipb.UploadAttachmentRequest{Upload: uploadID(id), Data: make([]byte, 2*MebiByte), FinishWrite: true}) require.Equal(t, codes.ResourceExhausted, status.Code(err)) rows, err := svc.Store.ListAttachments(ctx, &store.FindAttachment{}) require.NoError(t, err) @@ -252,16 +252,16 @@ func TestUploadAttachmentExpiryAndLimits(t *testing.T) { for i := range ids { ids[i] = startTestUpload(ctx, t, svc, 0) } - _, err := svc.UploadAttachment(ctx, &v1pb.UploadAttachmentRequest{Upload: uploadSpec("too-many", 0)}) + _, err := svc.UploadAttachment(ctx, &apipb.UploadAttachmentRequest{Upload: uploadSpec("too-many", 0)}) require.Equal(t, codes.ResourceExhausted, status.Code(err)) - _, err = svc.UploadAttachment(ctx, &v1pb.UploadAttachmentRequest{Upload: uploadID(ids[0]), FinishWrite: true}) + _, err = svc.UploadAttachment(ctx, &apipb.UploadAttachmentRequest{Upload: uploadID(ids[0]), FinishWrite: true}) require.NoError(t, err) startTestUpload(ctx, t, svc, 0) // Completed uploads do not consume an active slot. upload := svc.attachmentUploads.entries[ids[1]] upload.mu.Lock() upload.expireTime = time.Now().Add(-time.Second) upload.mu.Unlock() - _, err = svc.UploadAttachment(ctx, &v1pb.UploadAttachmentRequest{Upload: uploadID(ids[1])}) + _, err = svc.UploadAttachment(ctx, &apipb.UploadAttachmentRequest{Upload: uploadID(ids[1])}) require.Equal(t, codes.NotFound, status.Code(err)) orphan := filepath.Join(svc.Profile.Data, attachmentUploadTempPrefix+"orphan") @@ -294,9 +294,9 @@ func TestUploadAttachmentAboveLegacyRequestLimit(t *testing.T) { require.NoError(t, err) id := startTestUpload(ctx, t, svc, size) chunk := bytes.Repeat([]byte{0x5a}, uploadChunkSize) - var response *v1pb.UploadAttachmentResponse + var response *apipb.UploadAttachmentResponse for offset := int64(0); offset < size; offset += int64(len(chunk)) { - response, err = svc.UploadAttachment(ctx, &v1pb.UploadAttachmentRequest{ + response, err = svc.UploadAttachment(ctx, &apipb.UploadAttachmentRequest{ Upload: uploadID(id), WriteOffset: offset, Data: chunk, FinishWrite: offset+int64(len(chunk)) == size, }) require.NoError(t, err) @@ -330,11 +330,11 @@ func TestUploadAttachmentMediaProcessing(t *testing.T) { } { t.Run(tc.name, func(t *testing.T) { svc, ctx := newUploadTestService(t) - metadata := &v1pb.Attachment{Filename: "image.unknown", MediaMetadata: &v1pb.MediaMetadata{Width: proto.Int32(20), Height: proto.Int32(10)}} - spec := &v1pb.UploadAttachmentRequest_Spec{Spec: &v1pb.UploadAttachmentSpec{Attachment: metadata, TotalSize: int64(len(tc.content))}} - initial, err := svc.UploadAttachment(ctx, &v1pb.UploadAttachmentRequest{Upload: spec}) + metadata := &apipb.Attachment{Filename: "image.unknown", MediaMetadata: &apipb.MediaMetadata{Width: proto.Int32(20), Height: proto.Int32(10)}} + spec := &apipb.UploadAttachmentRequest_Spec{Spec: &apipb.UploadAttachmentSpec{Attachment: metadata, TotalSize: int64(len(tc.content))}} + initial, err := svc.UploadAttachment(ctx, &apipb.UploadAttachmentRequest{Upload: spec}) require.NoError(t, err) - result, err := svc.UploadAttachment(ctx, &v1pb.UploadAttachmentRequest{Upload: uploadID(initial.UploadId), Data: tc.content, FinishWrite: true}) + result, err := svc.UploadAttachment(ctx, &apipb.UploadAttachmentRequest{Upload: uploadID(initial.UploadId), Data: tc.content, FinishWrite: true}) require.NoError(t, err) require.Equal(t, "image/jpeg", result.Attachment.Type) require.True(t, proto.Equal(metadata.MediaMetadata, result.Attachment.MediaMetadata)) diff --git a/server/api/v1/attachment_upload_transport_test.go b/server/api/attachment_upload_transport_test.go similarity index 76% rename from server/api/v1/attachment_upload_transport_test.go rename to server/api/attachment_upload_transport_test.go index 6276a0028..03cddec52 100644 --- a/server/api/v1/attachment_upload_transport_test.go +++ b/server/api/attachment_upload_transport_test.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "bytes" @@ -15,8 +15,8 @@ import ( "google.golang.org/protobuf/encoding/protojson" "google.golang.org/protobuf/proto" - v1pb "github.com/usememos/memos/proto/gen/api/v1" - "github.com/usememos/memos/proto/gen/api/v1/apiv1connect" + apipb "github.com/usememos/memos/proto/gen/api" + "github.com/usememos/memos/proto/gen/api/apiconnect" "github.com/usememos/memos/server/auth" ) @@ -40,7 +40,7 @@ func TestUploadAttachmentTransports(t *testing.T) { e := echo.New() require.NoError(t, svc.RegisterGateway(context.Background(), e)) - for _, path := range []string{"/api/v1/attachments:upload", attachmentUploadProcedure} { + for _, path := range []string{"/api/attachments:upload", attachmentUploadProcedure} { t.Run(path, func(t *testing.T) { call := func(message proto.Message, authenticated bool) *httptest.ResponseRecorder { t.Helper() @@ -55,18 +55,18 @@ func TestUploadAttachmentTransports(t *testing.T) { e.ServeHTTP(rec, req) return rec } - initial := &v1pb.UploadAttachmentRequest{Upload: uploadSpec("file.txt", 3)} + initial := &apipb.UploadAttachmentRequest{Upload: uploadSpec("file.txt", 3)} require.Equal(t, http.StatusUnauthorized, call(initial, false).Code) rec := call(initial, true) require.Equal(t, http.StatusOK, rec.Code, rec.Body.String()) - response := &v1pb.UploadAttachmentResponse{} + response := &apipb.UploadAttachmentResponse{} require.NoError(t, protojson.Unmarshal(rec.Body.Bytes(), response)) - rec = call(&v1pb.UploadAttachmentRequest{Upload: uploadID(response.UploadId), Data: []byte("abc"), FinishWrite: true}, true) + rec = call(&apipb.UploadAttachmentRequest{Upload: uploadID(response.UploadId), Data: []byte("abc"), FinishWrite: true}, true) require.Equal(t, http.StatusOK, rec.Code, rec.Body.String()) require.NoError(t, protojson.Unmarshal(rec.Body.Bytes(), response)) require.NotNil(t, response.Attachment) - oversized, err := protojson.Marshal(&v1pb.UploadAttachmentRequest{Data: make([]byte, uploadRequestLimit)}) + oversized, err := protojson.Marshal(&apipb.UploadAttachmentRequest{Data: make([]byte, uploadRequestLimit)}) require.NoError(t, err) reader := &uploadCountingReader{reader: bytes.NewReader(oversized)} req := httptest.NewRequest(http.MethodPost, path, reader) @@ -81,18 +81,18 @@ func TestUploadAttachmentTransports(t *testing.T) { t.Run("Connect protobuf and compressed message limit", func(t *testing.T) { server := httptest.NewTestServer(t, e) - client := apiv1connect.NewAttachmentServiceClient(server.Client(), server.URL) - initial := connect.NewRequest(&v1pb.UploadAttachmentRequest{Upload: uploadSpec("binary.bin", uploadChunkSize)}) + client := apiconnect.NewAttachmentServiceClient(server.Client(), server.URL) + initial := connect.NewRequest(&apipb.UploadAttachmentRequest{Upload: uploadSpec("binary.bin", uploadChunkSize)}) initial.Header().Set("Authorization", "Bearer "+token) response, err := client.UploadAttachment(context.Background(), initial) require.NoError(t, err) - last := connect.NewRequest(&v1pb.UploadAttachmentRequest{Upload: uploadID(response.Msg.UploadId), Data: make([]byte, uploadChunkSize), FinishWrite: true}) + last := connect.NewRequest(&apipb.UploadAttachmentRequest{Upload: uploadID(response.Msg.UploadId), Data: make([]byte, uploadChunkSize), FinishWrite: true}) last.Header().Set("Authorization", "Bearer "+token) finished, err := client.UploadAttachment(context.Background(), last) require.NoError(t, err) require.EqualValues(t, uploadChunkSize, finished.Msg.Attachment.Size) - data, err := proto.Marshal(&v1pb.UploadAttachmentRequest{Data: make([]byte, uploadRequestLimit+1)}) + data, err := proto.Marshal(&apipb.UploadAttachmentRequest{Data: make([]byte, uploadRequestLimit+1)}) require.NoError(t, err) var compressed bytes.Buffer writer := gzip.NewWriter(&compressed) diff --git a/server/api/v1/auth_service.go b/server/api/auth_service.go similarity index 89% rename from server/api/v1/auth_service.go rename to server/api/auth_service.go index 28ab5f263..d0580f896 100644 --- a/server/api/v1/auth_service.go +++ b/server/api/auth_service.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "context" @@ -10,7 +10,7 @@ import ( "github.com/usememos/memos/internal/clientip" "github.com/usememos/memos/internal/ratelimit" - v1pb "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" "github.com/usememos/memos/store" ) @@ -23,7 +23,7 @@ const ( // // Authentication: Required (access token). // Returns: User information. -func (s *APIV1Service) GetCurrentUser(ctx context.Context, _ *v1pb.GetCurrentUserRequest) (*v1pb.GetCurrentUserResponse, error) { +func (s *APIService) GetCurrentUser(ctx context.Context, _ *apipb.GetCurrentUserRequest) (*apipb.GetCurrentUserResponse, error) { user, err := s.fetchCurrentUser(ctx) if err != nil { return nil, status.Errorf(codes.Unauthenticated, "failed to get current user: %v", err) @@ -36,7 +36,7 @@ func (s *APIV1Service) GetCurrentUser(ctx context.Context, _ *v1pb.GetCurrentUse return nil, status.Errorf(codes.Unauthenticated, "user not found") } - return &v1pb.GetCurrentUserResponse{ + return &apipb.GetCurrentUserResponse{ User: convertUserFromStore(user, user), }, nil } @@ -50,7 +50,7 @@ func (s *APIV1Service) GetCurrentUser(ctx context.Context, _ *v1pb.GetCurrentUse // // Authentication: Not required (public endpoint). // Returns: User info, access token, and token expiry. -func (s *APIV1Service) SignIn(ctx context.Context, request *v1pb.SignInRequest) (*v1pb.SignInResponse, error) { +func (s *APIService) SignIn(ctx context.Context, request *apipb.SignInRequest) (*apipb.SignInResponse, error) { var existingUser *store.User // Rate limits run before any lookup or hashing so a flood costs nothing. @@ -97,7 +97,7 @@ func (s *APIV1Service) SignIn(ctx context.Context, request *v1pb.SignInRequest) existingUser = user } else if ssoCredentials := request.GetSsoCredentials(); ssoCredentials != nil { // Authentication Method 2: SSO (OAuth2) authentication - identityProvider, userInfo, err := s.resolveSSOIdentity(ctx, ssoCredentials.IdpName, ssoCredentials.Code, ssoCredentials.RedirectUri, ssoCredentials.CodeVerifier) + identityProvider, userInfo, err := s.resolveSSOIdentity(ctx, ssoCredentials.IdentityProvider, ssoCredentials.Code, ssoCredentials.RedirectUri, ssoCredentials.CodeVerifier) if err != nil { // A rejected exchange is a credential failure and stays counted. return nil, err @@ -127,10 +127,10 @@ func (s *APIV1Service) SignIn(ctx context.Context, request *v1pb.SignInRequest) return nil, status.Errorf(codes.Internal, "failed to sign in: %v", err) } - return &v1pb.SignInResponse{ - User: convertUserFromStore(existingUser, existingUser), - AccessToken: accessToken, - AccessTokenExpiresAt: timestamppb.New(accessExpiresAt), + return &apipb.SignInResponse{ + User: convertUserFromStore(existingUser, existingUser), + AccessToken: accessToken, + AccessTokenExpireTime: timestamppb.New(accessExpiresAt), }, nil } diff --git a/server/api/v1/auth_service_client_info_test.go b/server/api/auth_service_client_info_test.go similarity index 98% rename from server/api/v1/auth_service_client_info_test.go rename to server/api/auth_service_client_info_test.go index 118f0168f..265863188 100644 --- a/server/api/v1/auth_service_client_info_test.go +++ b/server/api/auth_service_client_info_test.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "context" @@ -14,7 +14,7 @@ import ( ) func TestParseUserAgent(t *testing.T) { - service := &APIV1Service{} + service := &APIService{} tests := []struct { name string @@ -93,7 +93,7 @@ func TestParseUserAgent(t *testing.T) { } func TestExtractClientInfo(t *testing.T) { - service := &APIV1Service{} + service := &APIService{} // The user agent comes from metadata; the address comes only from the // trusted-proxy resolver, so forwarding headers in metadata are ignored. @@ -126,7 +126,7 @@ func TestExtractClientInfo(t *testing.T) { // TestClientInfoExamples demonstrates the enhanced client info extraction with various user agents. func TestClientInfoExamples(t *testing.T) { - service := &APIV1Service{} + service := &APIService{} examples := []struct { description string @@ -184,7 +184,7 @@ func TestClientInfoExamples(t *testing.T) { } func TestBuildRefreshTokenCookieSecureFlag(t *testing.T) { - service := &APIV1Service{} + service := &APIService{} t.Run("sets Secure for https origin", func(t *testing.T) { ctx := metadata.NewIncomingContext(context.Background(), metadata.Pairs( diff --git a/server/api/v1/auth_service_session.go b/server/api/auth_service_session.go similarity index 94% rename from server/api/v1/auth_service_session.go rename to server/api/auth_service_session.go index 55bb0b3df..1c4a45497 100644 --- a/server/api/v1/auth_service_session.go +++ b/server/api/auth_service_session.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "context" @@ -16,13 +16,13 @@ import ( "github.com/usememos/memos/internal/clientip" "github.com/usememos/memos/internal/random" - v1pb "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" storepb "github.com/usememos/memos/proto/gen/store" "github.com/usememos/memos/server/auth" "github.com/usememos/memos/store" ) -func (s *APIV1Service) doSignIn(ctx context.Context, user *store.User) (string, time.Time, error) { +func (s *APIService) doSignIn(ctx context.Context, user *store.User) (string, time.Time, error) { // Generate refresh token tokenID := random.UUID() refreshToken, refreshExpiresAt, err := auth.GenerateRefreshToken(user.ID, tokenID, []byte(s.Secret)) @@ -68,7 +68,7 @@ func (s *APIV1Service) doSignIn(ctx context.Context, user *store.User) (string, // // Authentication: Required (access token). // Returns: Empty response on success. -func (s *APIV1Service) SignOut(ctx context.Context, _ *v1pb.SignOutRequest) (*emptypb.Empty, error) { +func (s *APIService) SignOut(ctx context.Context, _ *apipb.SignOutRequest) (*emptypb.Empty, error) { // Get user from access token claims claims := auth.GetUserClaims(ctx) if claims != nil { @@ -111,7 +111,7 @@ func (s *APIV1Service) SignOut(ctx context.Context, _ *v1pb.SignOutRequest) (*em // // Authentication: Requires valid refresh token in cookie (public endpoint) // Returns: New access token and expiry timestamp. -func (s *APIV1Service) RefreshToken(ctx context.Context, _ *v1pb.RefreshTokenRequest) (*v1pb.RefreshTokenResponse, error) { +func (s *APIService) RefreshToken(ctx context.Context, _ *apipb.RefreshTokenRequest) (*apipb.RefreshTokenResponse, error) { // Extract refresh token from cookie refreshToken := "" if md, ok := metadata.FromIncomingContext(ctx); ok { @@ -176,9 +176,9 @@ func (s *APIV1Service) RefreshToken(ctx context.Context, _ *v1pb.RefreshTokenReq return nil, status.Errorf(codes.Internal, "failed to generate access token: %v", err) } - return &v1pb.RefreshTokenResponse{ - AccessToken: accessToken, - ExpiresAt: timestamppb.New(expiresAt), + return &apipb.RefreshTokenResponse{ + AccessToken: accessToken, + AccessTokenExpireTime: timestamppb.New(expiresAt), }, nil } @@ -204,7 +204,7 @@ func currentRefreshTokenID(ctx context.Context, secret string) string { return claims.TokenID } -func (s *APIV1Service) clearAuthCookies(ctx context.Context) error { +func (s *APIService) clearAuthCookies(ctx context.Context) error { // Clear refresh token cookie refreshCookie := s.buildRefreshTokenCookie(ctx, "", time.Time{}) if err := SetResponseHeader(ctx, "Set-Cookie", refreshCookie); err != nil { @@ -244,7 +244,7 @@ func isSecureRequest(ctx context.Context) bool { return false } -func (*APIV1Service) buildRefreshTokenCookie(ctx context.Context, refreshToken string, expireTime time.Time) string { +func (*APIService) buildRefreshTokenCookie(ctx context.Context, refreshToken string, expireTime time.Time) string { attrs := []string{ fmt.Sprintf("%s=%s", auth.RefreshTokenCookieName, refreshToken), "Path=/", @@ -266,7 +266,7 @@ func (*APIV1Service) buildRefreshTokenCookie(ctx context.Context, refreshToken s return strings.Join(attrs, "; ") } -func (s *APIV1Service) fetchCurrentUser(ctx context.Context) (*store.User, error) { +func (s *APIService) fetchCurrentUser(ctx context.Context) (*store.User, error) { userID := auth.GetUserID(ctx) if userID == 0 { return nil, nil @@ -303,7 +303,7 @@ func isActiveCurrentUser(user *store.User) bool { // - See all active sessions with device details // - Identify suspicious login attempts // - Revoke specific sessions from unknown devices. -func (s *APIV1Service) extractClientInfo(ctx context.Context) *storepb.RefreshTokensUserSetting_ClientInfo { +func (s *APIService) extractClientInfo(ctx context.Context) *storepb.RefreshTokensUserSetting_ClientInfo { clientInfo := &storepb.RefreshTokensUserSetting_ClientInfo{} // Extract user agent from metadata if available @@ -332,7 +332,7 @@ func (s *APIV1Service) extractClientInfo(ctx context.Context) *storepb.RefreshTo // // Note: This is a simplified parser. For production use with high accuracy requirements, // consider using a dedicated user agent parsing library. -func (*APIV1Service) parseUserAgent(userAgent string, clientInfo *storepb.RefreshTokensUserSetting_ClientInfo) { +func (*APIService) parseUserAgent(userAgent string, clientInfo *storepb.RefreshTokensUserSetting_ClientInfo) { if userAgent == "" { return } diff --git a/server/api/v1/auth_service_session_status_test.go b/server/api/auth_service_session_status_test.go similarity index 98% rename from server/api/v1/auth_service_session_status_test.go rename to server/api/auth_service_session_status_test.go index f557c1ba9..8a991c78b 100644 --- a/server/api/v1/auth_service_session_status_test.go +++ b/server/api/auth_service_session_status_test.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "testing" diff --git a/server/api/v1/auth_service_sso.go b/server/api/auth_service_sso.go similarity index 93% rename from server/api/v1/auth_service_sso.go rename to server/api/auth_service_sso.go index 95e688806..5e3771fc2 100644 --- a/server/api/v1/auth_service_sso.go +++ b/server/api/auth_service_sso.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "context" @@ -17,7 +17,7 @@ import ( "github.com/usememos/memos/store" ) -func (s *APIV1Service) resolveSSOUser(ctx context.Context, currentUser *store.User, identityProvider *storepb.IdentityProvider, userInfo *idp.IdentityProviderUserInfo) (*store.User, error) { +func (s *APIService) resolveSSOUser(ctx context.Context, currentUser *store.User, identityProvider *storepb.IdentityProvider, userInfo *idp.IdentityProviderUserInfo) (*store.User, error) { provider := identityProvider.Uid externUID := userInfo.Identifier // Defense in depth: an empty subject must never key a lookup or provision an @@ -72,7 +72,7 @@ func (s *APIV1Service) resolveSSOUser(ctx context.Context, currentUser *store.Us // instance, so the new account is never linked to the existing holder. The // database index remains the guarantee; a concurrent claim between this check // and the insert is handled by createSSOUser. -func (s *APIV1Service) resolveSSOEmail(ctx context.Context, rawEmail, provider, externUID string) string { +func (s *APIService) resolveSSOEmail(ctx context.Context, rawEmail, provider, externUID string) string { email, err := store.NormalizeEmail(rawEmail) if err != nil { slog.Warn("ignoring malformed email from identity provider", @@ -112,7 +112,7 @@ func (s *APIV1Service) resolveSSOEmail(ctx context.Context, rawEmail, provider, // tryUsername returns a non-nil user when the identity is resolved (either newly // created or reconciled to a concurrent winner) and (nil, nil) when the username // is already taken and the caller should retry with a different one. -func (s *APIV1Service) createSSOUser( +func (s *APIService) createSSOUser( ctx context.Context, userInfo *idp.IdentityProviderUserInfo, email string, @@ -190,7 +190,7 @@ func (s *APIV1Service) createSSOUser( return nil, errors.Errorf("exhausted %d UUID username attempts", ssoUsernameFallbackAttempts) } -func (s *APIV1Service) resolveSSOIdentity(ctx context.Context, idpName, code, redirectURI, codeVerifier string) (*storepb.IdentityProvider, *idp.IdentityProviderUserInfo, error) { +func (s *APIService) resolveSSOIdentity(ctx context.Context, idpName, code, redirectURI, codeVerifier string) (*storepb.IdentityProvider, *idp.IdentityProviderUserInfo, error) { idpUID, err := ExtractIdentityProviderUIDFromName(idpName) if err != nil { return nil, nil, status.Errorf(codes.InvalidArgument, "invalid identity provider name: %v", err) @@ -236,7 +236,7 @@ func (s *APIV1Service) resolveSSOIdentity(ctx context.Context, idpName, code, re return identityProvider, userInfo, nil } -func (s *APIV1Service) getLinkedSSOUser(ctx context.Context, provider, externUID string) (*store.User, error) { +func (s *APIService) getLinkedSSOUser(ctx context.Context, provider, externUID string) (*store.User, error) { identity, err := s.Store.GetUserIdentity(ctx, &store.FindUserIdentity{ Provider: &provider, ExternUID: &externUID, @@ -257,7 +257,7 @@ func (s *APIV1Service) getLinkedSSOUser(ctx context.Context, provider, externUID return user, nil } -func (s *APIV1Service) bindSSOIdentityToUser(ctx context.Context, currentUser *store.User, provider, externUID string) (*store.User, error) { +func (s *APIService) bindSSOIdentityToUser(ctx context.Context, currentUser *store.User, provider, externUID string) (*store.User, error) { existingForProvider, err := s.Store.GetUserIdentity(ctx, &store.FindUserIdentity{ UserID: ¤tUser.ID, Provider: &provider, diff --git a/server/api/v1/authz.go b/server/api/authz.go similarity index 99% rename from server/api/v1/authz.go rename to server/api/authz.go index a4ed1a003..638646fa7 100644 --- a/server/api/v1/authz.go +++ b/server/api/authz.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "context" diff --git a/server/api/v1/authz_test.go b/server/api/authz_test.go similarity index 87% rename from server/api/v1/authz_test.go rename to server/api/authz_test.go index 700ada595..14b93ddb9 100644 --- a/server/api/v1/authz_test.go +++ b/server/api/authz_test.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "context" @@ -43,13 +43,13 @@ func TestAuthorizerCheckAccess(t *testing.T) { unavailableInstance := &Authorizer{accessStore: stubAnonymousAccessStore{err: accessStoreError}} const ( - protectedMethod = "/memos.api.v1.MemoService/CreateMemo" - publicMethod = "/memos.api.v1.MemoService/ListMemos" - listReactions = "/memos.api.v1.MemoService/ListMemoReactions" - listRelations = "/memos.api.v1.MemoService/ListMemoRelations" - bootstrapMethod = "/memos.api.v1.AuthService/SignIn" - createUser = "/memos.api.v1.UserService/CreateUser" - shareMethod = "/memos.api.v1.MemoService/GetSharedMemo" + protectedMethod = "/memos.api.MemoService/CreateMemo" + publicMethod = "/memos.api.MemoService/ListMemos" + listReactions = "/memos.api.MemoService/ListMemoReactions" + listRelations = "/memos.api.MemoService/ListMemoRelations" + bootstrapMethod = "/memos.api.AuthService/SignIn" + createUser = "/memos.api.UserService/CreateUser" + shareMethod = "/memos.api.MemoService/GetSharedMemo" ) cases := []struct { diff --git a/server/api/v1/common.go b/server/api/common.go similarity index 70% rename from server/api/v1/common.go rename to server/api/common.go index c4cfcc8c7..acf81d549 100644 --- a/server/api/v1/common.go +++ b/server/api/common.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "encoding/base64" @@ -6,7 +6,7 @@ import ( "github.com/pkg/errors" "google.golang.org/protobuf/proto" - v1pb "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" "github.com/usememos/memos/store" ) @@ -17,20 +17,20 @@ const ( MaxPageSize = 1000 ) -func convertStateFromStore(rowStatus store.RowStatus) v1pb.State { +func convertStateFromStore(rowStatus store.RowStatus) apipb.State { switch rowStatus { case store.Normal: - return v1pb.State_NORMAL + return apipb.State_NORMAL case store.Archived: - return v1pb.State_ARCHIVED + return apipb.State_ARCHIVED default: - return v1pb.State_STATE_UNSPECIFIED + return apipb.State_STATE_UNSPECIFIED } } -func convertStateToStore(state v1pb.State) store.RowStatus { +func convertStateToStore(state apipb.State) store.RowStatus { switch state { - case v1pb.State_ARCHIVED: + case apipb.State_ARCHIVED: return store.Archived default: return store.Normal @@ -38,7 +38,7 @@ func convertStateToStore(state v1pb.State) store.RowStatus { } func getPageToken(limit int, offset int) (string, error) { - return marshalPageToken(&v1pb.PageToken{ + return marshalPageToken(&apipb.PageToken{ Limit: int32(limit), Offset: int32(offset), }) @@ -55,7 +55,7 @@ func normalizePageSize(pageSize int32) int { return limit } -func marshalPageToken(pageToken *v1pb.PageToken) (string, error) { +func marshalPageToken(pageToken *apipb.PageToken) (string, error) { b, err := proto.Marshal(pageToken) if err != nil { return "", errors.Wrapf(err, "failed to marshal page token") @@ -63,7 +63,7 @@ func marshalPageToken(pageToken *v1pb.PageToken) (string, error) { return base64.StdEncoding.EncodeToString(b), nil } -func unmarshalPageToken(s string, pageToken *v1pb.PageToken) error { +func unmarshalPageToken(s string, pageToken *apipb.PageToken) error { b, err := base64.StdEncoding.DecodeString(s) if err != nil { return errors.Wrapf(err, "failed to decode page token") diff --git a/server/api/v1/common_test.go b/server/api/common_test.go similarity index 98% rename from server/api/v1/common_test.go rename to server/api/common_test.go index 28cf39abb..20589eea1 100644 --- a/server/api/v1/common_test.go +++ b/server/api/common_test.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "testing" diff --git a/server/api/v1/connect_handler.go b/server/api/connect_handler.go similarity index 75% rename from server/api/v1/connect_handler.go rename to server/api/connect_handler.go index 2dcb8c10e..a8771cd28 100644 --- a/server/api/v1/connect_handler.go +++ b/server/api/connect_handler.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "net/http" @@ -8,10 +8,10 @@ import ( "google.golang.org/grpc/codes" "google.golang.org/grpc/status" - "github.com/usememos/memos/proto/gen/api/v1/apiv1connect" + "github.com/usememos/memos/proto/gen/api/apiconnect" ) -// ConnectServiceHandler wraps APIV1Service to implement Connect handler interfaces. +// ConnectServiceHandler wraps APIService to implement Connect handler interfaces. // It adapts the existing gRPC service implementations to work with Connect's // request/response wrapper types. // @@ -20,12 +20,12 @@ import ( // - Support both native gRPC and Connect protocols // - Maintain a single source of truth for business logic. type ConnectServiceHandler struct { - *APIV1Service + *APIService } // NewConnectServiceHandler creates a new Connect service handler. -func NewConnectServiceHandler(svc *APIV1Service) *ConnectServiceHandler { - return &ConnectServiceHandler{APIV1Service: svc} +func NewConnectServiceHandler(svc *APIService) *ConnectServiceHandler { + return &ConnectServiceHandler{APIService: svc} } // RegisterConnectHandlers registers all Connect service handlers on the given mux. @@ -35,14 +35,14 @@ func (s *ConnectServiceHandler) RegisterConnectHandlers(mux *http.ServeMux, opts path string handler http.Handler }{ - wrap(apiv1connect.NewInstanceServiceHandler(s, opts...)), - wrap(apiv1connect.NewAuthServiceHandler(s, opts...)), - wrap(apiv1connect.NewUserServiceHandler(s, opts...)), - wrap(apiv1connect.NewMemoServiceHandler(s, opts...)), - wrap(apiv1connect.NewSpaceServiceHandler(s, opts...)), - wrap(apiv1connect.NewAttachmentServiceHandler(s, opts...)), - wrap(apiv1connect.NewAIServiceHandler(s, opts...)), - wrap(apiv1connect.NewIdentityProviderServiceHandler(s, opts...)), + wrap(apiconnect.NewInstanceServiceHandler(s, opts...)), + wrap(apiconnect.NewAuthServiceHandler(s, opts...)), + wrap(apiconnect.NewUserServiceHandler(s, opts...)), + wrap(apiconnect.NewMemoServiceHandler(s, opts...)), + wrap(apiconnect.NewSpaceServiceHandler(s, opts...)), + wrap(apiconnect.NewAttachmentServiceHandler(s, opts...)), + wrap(apiconnect.NewAIServiceHandler(s, opts...)), + wrap(apiconnect.NewIdentityProviderServiceHandler(s, opts...)), } for _, h := range handlers { diff --git a/server/api/v1/connect_handler_test.go b/server/api/connect_handler_test.go similarity index 98% rename from server/api/v1/connect_handler_test.go rename to server/api/connect_handler_test.go index 39a62ed4a..7a81f0c89 100644 --- a/server/api/v1/connect_handler_test.go +++ b/server/api/connect_handler_test.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "strings" diff --git a/server/api/v1/connect_interceptors.go b/server/api/connect_interceptors.go similarity index 99% rename from server/api/v1/connect_interceptors.go rename to server/api/connect_interceptors.go index 8da857a8d..783402155 100644 --- a/server/api/v1/connect_interceptors.go +++ b/server/api/connect_interceptors.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "context" diff --git a/server/api/v1/connect_interceptors_test.go b/server/api/connect_interceptors_test.go similarity index 99% rename from server/api/v1/connect_interceptors_test.go rename to server/api/connect_interceptors_test.go index 4c2555d44..c635e5197 100644 --- a/server/api/v1/connect_interceptors_test.go +++ b/server/api/connect_interceptors_test.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "context" diff --git a/server/api/v1/connect_services.go b/server/api/connect_services.go similarity index 50% rename from server/api/v1/connect_services.go rename to server/api/connect_services.go index b455b8a65..06fcdb259 100644 --- a/server/api/v1/connect_services.go +++ b/server/api/connect_services.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "context" @@ -7,7 +7,7 @@ import ( "google.golang.org/genproto/googleapis/api/httpbody" "google.golang.org/protobuf/types/known/emptypb" - v1pb "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" ) // This file contains all Connect service handler method implementations. @@ -16,48 +16,48 @@ import ( // InstanceService -func (s *ConnectServiceHandler) GetInstanceProfile(ctx context.Context, req *connect.Request[v1pb.GetInstanceProfileRequest]) (*connect.Response[v1pb.InstanceProfile], error) { - resp, err := s.APIV1Service.GetInstanceProfile(ctx, req.Msg) +func (s *ConnectServiceHandler) GetInstanceProfile(ctx context.Context, req *connect.Request[apipb.GetInstanceProfileRequest]) (*connect.Response[apipb.InstanceProfile], error) { + resp, err := s.APIService.GetInstanceProfile(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } return connect.NewResponse(resp), nil } -func (s *ConnectServiceHandler) GetInstanceSetting(ctx context.Context, req *connect.Request[v1pb.GetInstanceSettingRequest]) (*connect.Response[v1pb.InstanceSetting], error) { - resp, err := s.APIV1Service.GetInstanceSetting(ctx, req.Msg) +func (s *ConnectServiceHandler) GetInstanceSetting(ctx context.Context, req *connect.Request[apipb.GetInstanceSettingRequest]) (*connect.Response[apipb.InstanceSetting], error) { + resp, err := s.APIService.GetInstanceSetting(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } return connect.NewResponse(resp), nil } -func (s *ConnectServiceHandler) BatchGetInstanceSettings(ctx context.Context, req *connect.Request[v1pb.BatchGetInstanceSettingsRequest]) (*connect.Response[v1pb.BatchGetInstanceSettingsResponse], error) { - resp, err := s.APIV1Service.BatchGetInstanceSettings(ctx, req.Msg) +func (s *ConnectServiceHandler) BatchGetInstanceSettings(ctx context.Context, req *connect.Request[apipb.BatchGetInstanceSettingsRequest]) (*connect.Response[apipb.BatchGetInstanceSettingsResponse], error) { + resp, err := s.APIService.BatchGetInstanceSettings(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } return connect.NewResponse(resp), nil } -func (s *ConnectServiceHandler) UpdateInstanceSetting(ctx context.Context, req *connect.Request[v1pb.UpdateInstanceSettingRequest]) (*connect.Response[v1pb.InstanceSetting], error) { - resp, err := s.APIV1Service.UpdateInstanceSetting(ctx, req.Msg) +func (s *ConnectServiceHandler) UpdateInstanceSetting(ctx context.Context, req *connect.Request[apipb.UpdateInstanceSettingRequest]) (*connect.Response[apipb.InstanceSetting], error) { + resp, err := s.APIService.UpdateInstanceSetting(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } return connect.NewResponse(resp), nil } -func (s *ConnectServiceHandler) TestInstanceEmailSetting(ctx context.Context, req *connect.Request[v1pb.TestInstanceEmailSettingRequest]) (*connect.Response[emptypb.Empty], error) { - resp, err := s.APIV1Service.TestInstanceEmailSetting(ctx, req.Msg) +func (s *ConnectServiceHandler) TestInstanceEmailSetting(ctx context.Context, req *connect.Request[apipb.TestInstanceEmailSettingRequest]) (*connect.Response[emptypb.Empty], error) { + resp, err := s.APIService.TestInstanceEmailSetting(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } return connect.NewResponse(resp), nil } -func (s *ConnectServiceHandler) GetInstanceStats(ctx context.Context, req *connect.Request[v1pb.GetInstanceStatsRequest]) (*connect.Response[v1pb.InstanceStats], error) { - resp, err := s.APIV1Service.GetInstanceStats(ctx, req.Msg) +func (s *ConnectServiceHandler) GetInstanceStats(ctx context.Context, req *connect.Request[apipb.GetInstanceStatsRequest]) (*connect.Response[apipb.InstanceStats], error) { + resp, err := s.APIService.GetInstanceStats(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } @@ -70,248 +70,248 @@ func (s *ConnectServiceHandler) GetInstanceStats(ctx context.Context, req *conne // We use connectWithHeaderCarrier helper to inject a header carrier into the context, // which allows the service to set headers in a protocol-agnostic way. -func (s *ConnectServiceHandler) GetCurrentUser(ctx context.Context, req *connect.Request[v1pb.GetCurrentUserRequest]) (*connect.Response[v1pb.GetCurrentUserResponse], error) { - return connectWithHeaderCarrier(ctx, func(ctx context.Context) (*v1pb.GetCurrentUserResponse, error) { - return s.APIV1Service.GetCurrentUser(ctx, req.Msg) +func (s *ConnectServiceHandler) GetCurrentUser(ctx context.Context, req *connect.Request[apipb.GetCurrentUserRequest]) (*connect.Response[apipb.GetCurrentUserResponse], error) { + return connectWithHeaderCarrier(ctx, func(ctx context.Context) (*apipb.GetCurrentUserResponse, error) { + return s.APIService.GetCurrentUser(ctx, req.Msg) }) } -func (s *ConnectServiceHandler) SignIn(ctx context.Context, req *connect.Request[v1pb.SignInRequest]) (*connect.Response[v1pb.SignInResponse], error) { - return connectWithHeaderCarrier(ctx, func(ctx context.Context) (*v1pb.SignInResponse, error) { - return s.APIV1Service.SignIn(ctx, req.Msg) +func (s *ConnectServiceHandler) SignIn(ctx context.Context, req *connect.Request[apipb.SignInRequest]) (*connect.Response[apipb.SignInResponse], error) { + return connectWithHeaderCarrier(ctx, func(ctx context.Context) (*apipb.SignInResponse, error) { + return s.APIService.SignIn(ctx, req.Msg) }) } -func (s *ConnectServiceHandler) SignOut(ctx context.Context, req *connect.Request[v1pb.SignOutRequest]) (*connect.Response[emptypb.Empty], error) { +func (s *ConnectServiceHandler) SignOut(ctx context.Context, req *connect.Request[apipb.SignOutRequest]) (*connect.Response[emptypb.Empty], error) { return connectWithHeaderCarrier(ctx, func(ctx context.Context) (*emptypb.Empty, error) { - return s.APIV1Service.SignOut(ctx, req.Msg) + return s.APIService.SignOut(ctx, req.Msg) }) } -func (s *ConnectServiceHandler) RefreshToken(ctx context.Context, req *connect.Request[v1pb.RefreshTokenRequest]) (*connect.Response[v1pb.RefreshTokenResponse], error) { - return connectWithHeaderCarrier(ctx, func(ctx context.Context) (*v1pb.RefreshTokenResponse, error) { - return s.APIV1Service.RefreshToken(ctx, req.Msg) +func (s *ConnectServiceHandler) RefreshToken(ctx context.Context, req *connect.Request[apipb.RefreshTokenRequest]) (*connect.Response[apipb.RefreshTokenResponse], error) { + return connectWithHeaderCarrier(ctx, func(ctx context.Context) (*apipb.RefreshTokenResponse, error) { + return s.APIService.RefreshToken(ctx, req.Msg) }) } // UserService -func (s *ConnectServiceHandler) ListUsers(ctx context.Context, req *connect.Request[v1pb.ListUsersRequest]) (*connect.Response[v1pb.ListUsersResponse], error) { - resp, err := s.APIV1Service.ListUsers(ctx, req.Msg) +func (s *ConnectServiceHandler) ListUsers(ctx context.Context, req *connect.Request[apipb.ListUsersRequest]) (*connect.Response[apipb.ListUsersResponse], error) { + resp, err := s.APIService.ListUsers(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } return connect.NewResponse(resp), nil } -func (s *ConnectServiceHandler) BatchGetUsers(ctx context.Context, req *connect.Request[v1pb.BatchGetUsersRequest]) (*connect.Response[v1pb.BatchGetUsersResponse], error) { - resp, err := s.APIV1Service.BatchGetUsers(ctx, req.Msg) +func (s *ConnectServiceHandler) BatchGetUsers(ctx context.Context, req *connect.Request[apipb.BatchGetUsersRequest]) (*connect.Response[apipb.BatchGetUsersResponse], error) { + resp, err := s.APIService.BatchGetUsers(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } return connect.NewResponse(resp), nil } -func (s *ConnectServiceHandler) GetUser(ctx context.Context, req *connect.Request[v1pb.GetUserRequest]) (*connect.Response[v1pb.User], error) { - resp, err := s.APIV1Service.GetUser(ctx, req.Msg) +func (s *ConnectServiceHandler) GetUser(ctx context.Context, req *connect.Request[apipb.GetUserRequest]) (*connect.Response[apipb.User], error) { + resp, err := s.APIService.GetUser(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } return connect.NewResponse(resp), nil } -func (s *ConnectServiceHandler) CreateUser(ctx context.Context, req *connect.Request[v1pb.CreateUserRequest]) (*connect.Response[v1pb.User], error) { - resp, err := s.APIV1Service.CreateUser(ctx, req.Msg) +func (s *ConnectServiceHandler) CreateUser(ctx context.Context, req *connect.Request[apipb.CreateUserRequest]) (*connect.Response[apipb.User], error) { + resp, err := s.APIService.CreateUser(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } return connect.NewResponse(resp), nil } -func (s *ConnectServiceHandler) UpdateUser(ctx context.Context, req *connect.Request[v1pb.UpdateUserRequest]) (*connect.Response[v1pb.User], error) { - resp, err := s.APIV1Service.UpdateUser(ctx, req.Msg) +func (s *ConnectServiceHandler) UpdateUser(ctx context.Context, req *connect.Request[apipb.UpdateUserRequest]) (*connect.Response[apipb.User], error) { + resp, err := s.APIService.UpdateUser(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } return connect.NewResponse(resp), nil } -func (s *ConnectServiceHandler) DeleteUser(ctx context.Context, req *connect.Request[v1pb.DeleteUserRequest]) (*connect.Response[emptypb.Empty], error) { +func (s *ConnectServiceHandler) DeleteUser(ctx context.Context, req *connect.Request[apipb.DeleteUserRequest]) (*connect.Response[emptypb.Empty], error) { return connectWithHeaderCarrier(ctx, func(ctx context.Context) (*emptypb.Empty, error) { - return s.APIV1Service.DeleteUser(ctx, req.Msg) + return s.APIService.DeleteUser(ctx, req.Msg) }) } -func (s *ConnectServiceHandler) ListAllUserStats(ctx context.Context, req *connect.Request[v1pb.ListAllUserStatsRequest]) (*connect.Response[v1pb.ListAllUserStatsResponse], error) { - resp, err := s.APIV1Service.ListAllUserStats(ctx, req.Msg) +func (s *ConnectServiceHandler) ListUserStats(ctx context.Context, req *connect.Request[apipb.ListUserStatsRequest]) (*connect.Response[apipb.ListUserStatsResponse], error) { + resp, err := s.APIService.ListUserStats(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } return connect.NewResponse(resp), nil } -func (s *ConnectServiceHandler) GetUserStats(ctx context.Context, req *connect.Request[v1pb.GetUserStatsRequest]) (*connect.Response[v1pb.UserStats], error) { - resp, err := s.APIV1Service.GetUserStats(ctx, req.Msg) +func (s *ConnectServiceHandler) GetUserStats(ctx context.Context, req *connect.Request[apipb.GetUserStatsRequest]) (*connect.Response[apipb.UserStats], error) { + resp, err := s.APIService.GetUserStats(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } return connect.NewResponse(resp), nil } -func (s *ConnectServiceHandler) ExportMemos(ctx context.Context, req *connect.Request[v1pb.ExportMemosRequest]) (*connect.Response[httpbody.HttpBody], error) { - resp, err := s.APIV1Service.ExportMemos(ctx, req.Msg) +func (s *ConnectServiceHandler) ExportMemos(ctx context.Context, req *connect.Request[apipb.ExportMemosRequest]) (*connect.Response[httpbody.HttpBody], error) { + resp, err := s.APIService.ExportMemos(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } return connect.NewResponse(resp), nil } -func (s *ConnectServiceHandler) ImportMemos(ctx context.Context, req *connect.Request[v1pb.ImportMemosRequest]) (*connect.Response[v1pb.ImportMemosResponse], error) { - resp, err := s.APIV1Service.ImportMemos(ctx, req.Msg) +func (s *ConnectServiceHandler) ImportMemos(ctx context.Context, req *connect.Request[apipb.ImportMemosRequest]) (*connect.Response[apipb.ImportMemosResponse], error) { + resp, err := s.APIService.ImportMemos(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } return connect.NewResponse(resp), nil } -func (s *ConnectServiceHandler) GetUserSetting(ctx context.Context, req *connect.Request[v1pb.GetUserSettingRequest]) (*connect.Response[v1pb.UserSetting], error) { - resp, err := s.APIV1Service.GetUserSetting(ctx, req.Msg) +func (s *ConnectServiceHandler) GetUserSetting(ctx context.Context, req *connect.Request[apipb.GetUserSettingRequest]) (*connect.Response[apipb.UserSetting], error) { + resp, err := s.APIService.GetUserSetting(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } return connect.NewResponse(resp), nil } -func (s *ConnectServiceHandler) UpdateUserSetting(ctx context.Context, req *connect.Request[v1pb.UpdateUserSettingRequest]) (*connect.Response[v1pb.UserSetting], error) { - resp, err := s.APIV1Service.UpdateUserSetting(ctx, req.Msg) +func (s *ConnectServiceHandler) UpdateUserSetting(ctx context.Context, req *connect.Request[apipb.UpdateUserSettingRequest]) (*connect.Response[apipb.UserSetting], error) { + resp, err := s.APIService.UpdateUserSetting(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } return connect.NewResponse(resp), nil } -func (s *ConnectServiceHandler) ListUserSettings(ctx context.Context, req *connect.Request[v1pb.ListUserSettingsRequest]) (*connect.Response[v1pb.ListUserSettingsResponse], error) { - resp, err := s.APIV1Service.ListUserSettings(ctx, req.Msg) +func (s *ConnectServiceHandler) ListUserSettings(ctx context.Context, req *connect.Request[apipb.ListUserSettingsRequest]) (*connect.Response[apipb.ListUserSettingsResponse], error) { + resp, err := s.APIService.ListUserSettings(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } return connect.NewResponse(resp), nil } -func (s *ConnectServiceHandler) ListLinkedIdentities(ctx context.Context, req *connect.Request[v1pb.ListLinkedIdentitiesRequest]) (*connect.Response[v1pb.ListLinkedIdentitiesResponse], error) { - resp, err := s.APIV1Service.ListLinkedIdentities(ctx, req.Msg) +func (s *ConnectServiceHandler) ListLinkedIdentities(ctx context.Context, req *connect.Request[apipb.ListLinkedIdentitiesRequest]) (*connect.Response[apipb.ListLinkedIdentitiesResponse], error) { + resp, err := s.APIService.ListLinkedIdentities(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } return connect.NewResponse(resp), nil } -func (s *ConnectServiceHandler) CreateLinkedIdentity(ctx context.Context, req *connect.Request[v1pb.CreateLinkedIdentityRequest]) (*connect.Response[v1pb.LinkedIdentity], error) { - resp, err := s.APIV1Service.CreateLinkedIdentity(ctx, req.Msg) +func (s *ConnectServiceHandler) CreateLinkedIdentity(ctx context.Context, req *connect.Request[apipb.CreateLinkedIdentityRequest]) (*connect.Response[apipb.LinkedIdentity], error) { + resp, err := s.APIService.CreateLinkedIdentity(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } return connect.NewResponse(resp), nil } -func (s *ConnectServiceHandler) GetLinkedIdentity(ctx context.Context, req *connect.Request[v1pb.GetLinkedIdentityRequest]) (*connect.Response[v1pb.LinkedIdentity], error) { - resp, err := s.APIV1Service.GetLinkedIdentity(ctx, req.Msg) +func (s *ConnectServiceHandler) GetLinkedIdentity(ctx context.Context, req *connect.Request[apipb.GetLinkedIdentityRequest]) (*connect.Response[apipb.LinkedIdentity], error) { + resp, err := s.APIService.GetLinkedIdentity(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } return connect.NewResponse(resp), nil } -func (s *ConnectServiceHandler) DeleteLinkedIdentity(ctx context.Context, req *connect.Request[v1pb.DeleteLinkedIdentityRequest]) (*connect.Response[emptypb.Empty], error) { - resp, err := s.APIV1Service.DeleteLinkedIdentity(ctx, req.Msg) +func (s *ConnectServiceHandler) DeleteLinkedIdentity(ctx context.Context, req *connect.Request[apipb.DeleteLinkedIdentityRequest]) (*connect.Response[emptypb.Empty], error) { + resp, err := s.APIService.DeleteLinkedIdentity(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } return connect.NewResponse(resp), nil } -func (s *ConnectServiceHandler) ListPersonalAccessTokens(ctx context.Context, req *connect.Request[v1pb.ListPersonalAccessTokensRequest]) (*connect.Response[v1pb.ListPersonalAccessTokensResponse], error) { - resp, err := s.APIV1Service.ListPersonalAccessTokens(ctx, req.Msg) +func (s *ConnectServiceHandler) ListPersonalAccessTokens(ctx context.Context, req *connect.Request[apipb.ListPersonalAccessTokensRequest]) (*connect.Response[apipb.ListPersonalAccessTokensResponse], error) { + resp, err := s.APIService.ListPersonalAccessTokens(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } return connect.NewResponse(resp), nil } -func (s *ConnectServiceHandler) CreatePersonalAccessToken(ctx context.Context, req *connect.Request[v1pb.CreatePersonalAccessTokenRequest]) (*connect.Response[v1pb.CreatePersonalAccessTokenResponse], error) { - resp, err := s.APIV1Service.CreatePersonalAccessToken(ctx, req.Msg) +func (s *ConnectServiceHandler) CreatePersonalAccessToken(ctx context.Context, req *connect.Request[apipb.CreatePersonalAccessTokenRequest]) (*connect.Response[apipb.CreatePersonalAccessTokenResponse], error) { + resp, err := s.APIService.CreatePersonalAccessToken(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } return connect.NewResponse(resp), nil } -func (s *ConnectServiceHandler) DeletePersonalAccessToken(ctx context.Context, req *connect.Request[v1pb.DeletePersonalAccessTokenRequest]) (*connect.Response[emptypb.Empty], error) { - resp, err := s.APIV1Service.DeletePersonalAccessToken(ctx, req.Msg) +func (s *ConnectServiceHandler) DeletePersonalAccessToken(ctx context.Context, req *connect.Request[apipb.DeletePersonalAccessTokenRequest]) (*connect.Response[emptypb.Empty], error) { + resp, err := s.APIService.DeletePersonalAccessToken(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } return connect.NewResponse(resp), nil } -func (s *ConnectServiceHandler) ListUserWebhooks(ctx context.Context, req *connect.Request[v1pb.ListUserWebhooksRequest]) (*connect.Response[v1pb.ListUserWebhooksResponse], error) { - resp, err := s.APIV1Service.ListUserWebhooks(ctx, req.Msg) +func (s *ConnectServiceHandler) ListUserWebhooks(ctx context.Context, req *connect.Request[apipb.ListUserWebhooksRequest]) (*connect.Response[apipb.ListUserWebhooksResponse], error) { + resp, err := s.APIService.ListUserWebhooks(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } return connect.NewResponse(resp), nil } -func (s *ConnectServiceHandler) CreateUserWebhook(ctx context.Context, req *connect.Request[v1pb.CreateUserWebhookRequest]) (*connect.Response[v1pb.UserWebhook], error) { - resp, err := s.APIV1Service.CreateUserWebhook(ctx, req.Msg) +func (s *ConnectServiceHandler) CreateUserWebhook(ctx context.Context, req *connect.Request[apipb.CreateUserWebhookRequest]) (*connect.Response[apipb.UserWebhook], error) { + resp, err := s.APIService.CreateUserWebhook(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } return connect.NewResponse(resp), nil } -func (s *ConnectServiceHandler) UpdateUserWebhook(ctx context.Context, req *connect.Request[v1pb.UpdateUserWebhookRequest]) (*connect.Response[v1pb.UserWebhook], error) { - resp, err := s.APIV1Service.UpdateUserWebhook(ctx, req.Msg) +func (s *ConnectServiceHandler) UpdateUserWebhook(ctx context.Context, req *connect.Request[apipb.UpdateUserWebhookRequest]) (*connect.Response[apipb.UserWebhook], error) { + resp, err := s.APIService.UpdateUserWebhook(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } return connect.NewResponse(resp), nil } -func (s *ConnectServiceHandler) DeleteUserWebhook(ctx context.Context, req *connect.Request[v1pb.DeleteUserWebhookRequest]) (*connect.Response[emptypb.Empty], error) { - resp, err := s.APIV1Service.DeleteUserWebhook(ctx, req.Msg) +func (s *ConnectServiceHandler) DeleteUserWebhook(ctx context.Context, req *connect.Request[apipb.DeleteUserWebhookRequest]) (*connect.Response[emptypb.Empty], error) { + resp, err := s.APIService.DeleteUserWebhook(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } return connect.NewResponse(resp), nil } -func (s *ConnectServiceHandler) GetUserWebhookSigningSecret(ctx context.Context, req *connect.Request[v1pb.GetUserWebhookSigningSecretRequest]) (*connect.Response[v1pb.GetUserWebhookSigningSecretResponse], error) { - resp, err := s.APIV1Service.GetUserWebhookSigningSecret(ctx, req.Msg) +func (s *ConnectServiceHandler) GetUserWebhookSigningSecret(ctx context.Context, req *connect.Request[apipb.GetUserWebhookSigningSecretRequest]) (*connect.Response[apipb.GetUserWebhookSigningSecretResponse], error) { + resp, err := s.APIService.GetUserWebhookSigningSecret(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } return connect.NewResponse(resp), nil } -func (s *ConnectServiceHandler) ListUserNotifications(ctx context.Context, req *connect.Request[v1pb.ListUserNotificationsRequest]) (*connect.Response[v1pb.ListUserNotificationsResponse], error) { - resp, err := s.APIV1Service.ListUserNotifications(ctx, req.Msg) +func (s *ConnectServiceHandler) ListUserNotifications(ctx context.Context, req *connect.Request[apipb.ListUserNotificationsRequest]) (*connect.Response[apipb.ListUserNotificationsResponse], error) { + resp, err := s.APIService.ListUserNotifications(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } return connect.NewResponse(resp), nil } -func (s *ConnectServiceHandler) UpdateUserNotification(ctx context.Context, req *connect.Request[v1pb.UpdateUserNotificationRequest]) (*connect.Response[v1pb.UserNotification], error) { - resp, err := s.APIV1Service.UpdateUserNotification(ctx, req.Msg) +func (s *ConnectServiceHandler) UpdateUserNotification(ctx context.Context, req *connect.Request[apipb.UpdateUserNotificationRequest]) (*connect.Response[apipb.UserNotification], error) { + resp, err := s.APIService.UpdateUserNotification(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } return connect.NewResponse(resp), nil } -func (s *ConnectServiceHandler) DeleteUserNotification(ctx context.Context, req *connect.Request[v1pb.DeleteUserNotificationRequest]) (*connect.Response[emptypb.Empty], error) { - resp, err := s.APIV1Service.DeleteUserNotification(ctx, req.Msg) +func (s *ConnectServiceHandler) DeleteUserNotification(ctx context.Context, req *connect.Request[apipb.DeleteUserNotificationRequest]) (*connect.Response[emptypb.Empty], error) { + resp, err := s.APIService.DeleteUserNotification(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } @@ -319,8 +319,8 @@ func (s *ConnectServiceHandler) DeleteUserNotification(ctx context.Context, req } // ListMemoViews lists the saved memo views owned by a user. -func (s *ConnectServiceHandler) ListMemoViews(ctx context.Context, req *connect.Request[v1pb.ListMemoViewsRequest]) (*connect.Response[v1pb.ListMemoViewsResponse], error) { - resp, err := s.APIV1Service.ListMemoViews(ctx, req.Msg) +func (s *ConnectServiceHandler) ListMemoViews(ctx context.Context, req *connect.Request[apipb.ListMemoViewsRequest]) (*connect.Response[apipb.ListMemoViewsResponse], error) { + resp, err := s.APIService.ListMemoViews(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } @@ -328,8 +328,8 @@ func (s *ConnectServiceHandler) ListMemoViews(ctx context.Context, req *connect. } // GetMemoView returns a saved memo view by resource name. -func (s *ConnectServiceHandler) GetMemoView(ctx context.Context, req *connect.Request[v1pb.GetMemoViewRequest]) (*connect.Response[v1pb.MemoView], error) { - resp, err := s.APIV1Service.GetMemoView(ctx, req.Msg) +func (s *ConnectServiceHandler) GetMemoView(ctx context.Context, req *connect.Request[apipb.GetMemoViewRequest]) (*connect.Response[apipb.MemoView], error) { + resp, err := s.APIService.GetMemoView(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } @@ -337,8 +337,8 @@ func (s *ConnectServiceHandler) GetMemoView(ctx context.Context, req *connect.Re } // CreateMemoView creates a saved memo view for a user. -func (s *ConnectServiceHandler) CreateMemoView(ctx context.Context, req *connect.Request[v1pb.CreateMemoViewRequest]) (*connect.Response[v1pb.MemoView], error) { - resp, err := s.APIV1Service.CreateMemoView(ctx, req.Msg) +func (s *ConnectServiceHandler) CreateMemoView(ctx context.Context, req *connect.Request[apipb.CreateMemoViewRequest]) (*connect.Response[apipb.MemoView], error) { + resp, err := s.APIService.CreateMemoView(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } @@ -346,8 +346,8 @@ func (s *ConnectServiceHandler) CreateMemoView(ctx context.Context, req *connect } // UpdateMemoView updates the selected fields of a saved memo view. -func (s *ConnectServiceHandler) UpdateMemoView(ctx context.Context, req *connect.Request[v1pb.UpdateMemoViewRequest]) (*connect.Response[v1pb.MemoView], error) { - resp, err := s.APIV1Service.UpdateMemoView(ctx, req.Msg) +func (s *ConnectServiceHandler) UpdateMemoView(ctx context.Context, req *connect.Request[apipb.UpdateMemoViewRequest]) (*connect.Response[apipb.MemoView], error) { + resp, err := s.APIService.UpdateMemoView(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } @@ -355,8 +355,8 @@ func (s *ConnectServiceHandler) UpdateMemoView(ctx context.Context, req *connect } // DeleteMemoView deletes a saved memo view by resource name. -func (s *ConnectServiceHandler) DeleteMemoView(ctx context.Context, req *connect.Request[v1pb.DeleteMemoViewRequest]) (*connect.Response[emptypb.Empty], error) { - resp, err := s.APIV1Service.DeleteMemoView(ctx, req.Msg) +func (s *ConnectServiceHandler) DeleteMemoView(ctx context.Context, req *connect.Request[apipb.DeleteMemoViewRequest]) (*connect.Response[emptypb.Empty], error) { + resp, err := s.APIService.DeleteMemoView(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } @@ -365,160 +365,160 @@ func (s *ConnectServiceHandler) DeleteMemoView(ctx context.Context, req *connect // MemoService -func (s *ConnectServiceHandler) CreateMemo(ctx context.Context, req *connect.Request[v1pb.CreateMemoRequest]) (*connect.Response[v1pb.Memo], error) { - resp, err := s.APIV1Service.CreateMemo(ctx, req.Msg) +func (s *ConnectServiceHandler) CreateMemo(ctx context.Context, req *connect.Request[apipb.CreateMemoRequest]) (*connect.Response[apipb.Memo], error) { + resp, err := s.APIService.CreateMemo(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } return connect.NewResponse(resp), nil } -func (s *ConnectServiceHandler) ListMemos(ctx context.Context, req *connect.Request[v1pb.ListMemosRequest]) (*connect.Response[v1pb.ListMemosResponse], error) { - resp, err := s.APIV1Service.ListMemos(ctx, req.Msg) +func (s *ConnectServiceHandler) ListMemos(ctx context.Context, req *connect.Request[apipb.ListMemosRequest]) (*connect.Response[apipb.ListMemosResponse], error) { + resp, err := s.APIService.ListMemos(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } return connect.NewResponse(resp), nil } -func (s *ConnectServiceHandler) GetMemo(ctx context.Context, req *connect.Request[v1pb.GetMemoRequest]) (*connect.Response[v1pb.Memo], error) { - resp, err := s.APIV1Service.GetMemo(ctx, req.Msg) +func (s *ConnectServiceHandler) GetMemo(ctx context.Context, req *connect.Request[apipb.GetMemoRequest]) (*connect.Response[apipb.Memo], error) { + resp, err := s.APIService.GetMemo(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } return connect.NewResponse(resp), nil } -func (s *ConnectServiceHandler) UpdateMemo(ctx context.Context, req *connect.Request[v1pb.UpdateMemoRequest]) (*connect.Response[v1pb.Memo], error) { - resp, err := s.APIV1Service.UpdateMemo(ctx, req.Msg) +func (s *ConnectServiceHandler) UpdateMemo(ctx context.Context, req *connect.Request[apipb.UpdateMemoRequest]) (*connect.Response[apipb.Memo], error) { + resp, err := s.APIService.UpdateMemo(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } return connect.NewResponse(resp), nil } -func (s *ConnectServiceHandler) DeleteMemo(ctx context.Context, req *connect.Request[v1pb.DeleteMemoRequest]) (*connect.Response[emptypb.Empty], error) { - resp, err := s.APIV1Service.DeleteMemo(ctx, req.Msg) +func (s *ConnectServiceHandler) DeleteMemo(ctx context.Context, req *connect.Request[apipb.DeleteMemoRequest]) (*connect.Response[emptypb.Empty], error) { + resp, err := s.APIService.DeleteMemo(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } return connect.NewResponse(resp), nil } -func (s *ConnectServiceHandler) SetMemoAttachments(ctx context.Context, req *connect.Request[v1pb.SetMemoAttachmentsRequest]) (*connect.Response[emptypb.Empty], error) { - resp, err := s.APIV1Service.SetMemoAttachments(ctx, req.Msg) +func (s *ConnectServiceHandler) SetMemoAttachments(ctx context.Context, req *connect.Request[apipb.SetMemoAttachmentsRequest]) (*connect.Response[emptypb.Empty], error) { + resp, err := s.APIService.SetMemoAttachments(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } return connect.NewResponse(resp), nil } -func (s *ConnectServiceHandler) ListMemoAttachments(ctx context.Context, req *connect.Request[v1pb.ListMemoAttachmentsRequest]) (*connect.Response[v1pb.ListMemoAttachmentsResponse], error) { - resp, err := s.APIV1Service.ListMemoAttachments(ctx, req.Msg) +func (s *ConnectServiceHandler) ListMemoAttachments(ctx context.Context, req *connect.Request[apipb.ListMemoAttachmentsRequest]) (*connect.Response[apipb.ListMemoAttachmentsResponse], error) { + resp, err := s.APIService.ListMemoAttachments(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } return connect.NewResponse(resp), nil } -func (s *ConnectServiceHandler) SetMemoRelations(ctx context.Context, req *connect.Request[v1pb.SetMemoRelationsRequest]) (*connect.Response[emptypb.Empty], error) { - resp, err := s.APIV1Service.SetMemoRelations(ctx, req.Msg) +func (s *ConnectServiceHandler) SetMemoRelations(ctx context.Context, req *connect.Request[apipb.SetMemoRelationsRequest]) (*connect.Response[emptypb.Empty], error) { + resp, err := s.APIService.SetMemoRelations(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } return connect.NewResponse(resp), nil } -func (s *ConnectServiceHandler) ListMemoRelations(ctx context.Context, req *connect.Request[v1pb.ListMemoRelationsRequest]) (*connect.Response[v1pb.ListMemoRelationsResponse], error) { - resp, err := s.APIV1Service.ListMemoRelations(ctx, req.Msg) +func (s *ConnectServiceHandler) ListMemoRelations(ctx context.Context, req *connect.Request[apipb.ListMemoRelationsRequest]) (*connect.Response[apipb.ListMemoRelationsResponse], error) { + resp, err := s.APIService.ListMemoRelations(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } return connect.NewResponse(resp), nil } -func (s *ConnectServiceHandler) CreateMemoComment(ctx context.Context, req *connect.Request[v1pb.CreateMemoCommentRequest]) (*connect.Response[v1pb.Memo], error) { - resp, err := s.APIV1Service.CreateMemoComment(ctx, req.Msg) +func (s *ConnectServiceHandler) CreateMemoComment(ctx context.Context, req *connect.Request[apipb.CreateMemoCommentRequest]) (*connect.Response[apipb.Memo], error) { + resp, err := s.APIService.CreateMemoComment(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } return connect.NewResponse(resp), nil } -func (s *ConnectServiceHandler) ListMemoComments(ctx context.Context, req *connect.Request[v1pb.ListMemoCommentsRequest]) (*connect.Response[v1pb.ListMemoCommentsResponse], error) { - resp, err := s.APIV1Service.ListMemoComments(ctx, req.Msg) +func (s *ConnectServiceHandler) ListMemoComments(ctx context.Context, req *connect.Request[apipb.ListMemoCommentsRequest]) (*connect.Response[apipb.ListMemoCommentsResponse], error) { + resp, err := s.APIService.ListMemoComments(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } return connect.NewResponse(resp), nil } -func (s *ConnectServiceHandler) ListMemoReactions(ctx context.Context, req *connect.Request[v1pb.ListMemoReactionsRequest]) (*connect.Response[v1pb.ListMemoReactionsResponse], error) { - resp, err := s.APIV1Service.ListMemoReactions(ctx, req.Msg) +func (s *ConnectServiceHandler) ListMemoReactions(ctx context.Context, req *connect.Request[apipb.ListMemoReactionsRequest]) (*connect.Response[apipb.ListMemoReactionsResponse], error) { + resp, err := s.APIService.ListMemoReactions(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } return connect.NewResponse(resp), nil } -func (s *ConnectServiceHandler) UpsertMemoReaction(ctx context.Context, req *connect.Request[v1pb.UpsertMemoReactionRequest]) (*connect.Response[v1pb.Reaction], error) { - resp, err := s.APIV1Service.UpsertMemoReaction(ctx, req.Msg) +func (s *ConnectServiceHandler) UpsertMemoReaction(ctx context.Context, req *connect.Request[apipb.UpsertMemoReactionRequest]) (*connect.Response[apipb.Reaction], error) { + resp, err := s.APIService.UpsertMemoReaction(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } return connect.NewResponse(resp), nil } -func (s *ConnectServiceHandler) DeleteMemoReaction(ctx context.Context, req *connect.Request[v1pb.DeleteMemoReactionRequest]) (*connect.Response[emptypb.Empty], error) { - resp, err := s.APIV1Service.DeleteMemoReaction(ctx, req.Msg) +func (s *ConnectServiceHandler) DeleteMemoReaction(ctx context.Context, req *connect.Request[apipb.DeleteMemoReactionRequest]) (*connect.Response[emptypb.Empty], error) { + resp, err := s.APIService.DeleteMemoReaction(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } return connect.NewResponse(resp), nil } -func (s *ConnectServiceHandler) CreateMemoShare(ctx context.Context, req *connect.Request[v1pb.CreateMemoShareRequest]) (*connect.Response[v1pb.MemoShare], error) { - resp, err := s.APIV1Service.CreateMemoShare(ctx, req.Msg) +func (s *ConnectServiceHandler) CreateMemoShare(ctx context.Context, req *connect.Request[apipb.CreateMemoShareRequest]) (*connect.Response[apipb.MemoShare], error) { + resp, err := s.APIService.CreateMemoShare(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } return connect.NewResponse(resp), nil } -func (s *ConnectServiceHandler) ListMemoShares(ctx context.Context, req *connect.Request[v1pb.ListMemoSharesRequest]) (*connect.Response[v1pb.ListMemoSharesResponse], error) { - resp, err := s.APIV1Service.ListMemoShares(ctx, req.Msg) +func (s *ConnectServiceHandler) ListMemoShares(ctx context.Context, req *connect.Request[apipb.ListMemoSharesRequest]) (*connect.Response[apipb.ListMemoSharesResponse], error) { + resp, err := s.APIService.ListMemoShares(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } return connect.NewResponse(resp), nil } -func (s *ConnectServiceHandler) DeleteMemoShare(ctx context.Context, req *connect.Request[v1pb.DeleteMemoShareRequest]) (*connect.Response[emptypb.Empty], error) { - resp, err := s.APIV1Service.DeleteMemoShare(ctx, req.Msg) +func (s *ConnectServiceHandler) DeleteMemoShare(ctx context.Context, req *connect.Request[apipb.DeleteMemoShareRequest]) (*connect.Response[emptypb.Empty], error) { + resp, err := s.APIService.DeleteMemoShare(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } return connect.NewResponse(resp), nil } -func (s *ConnectServiceHandler) GetSharedMemo(ctx context.Context, req *connect.Request[v1pb.GetSharedMemoRequest]) (*connect.Response[v1pb.Memo], error) { - resp, err := s.APIV1Service.GetSharedMemo(ctx, req.Msg) +func (s *ConnectServiceHandler) GetSharedMemo(ctx context.Context, req *connect.Request[apipb.GetSharedMemoRequest]) (*connect.Response[apipb.Memo], error) { + resp, err := s.APIService.GetSharedMemo(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } return connect.NewResponse(resp), nil } -func (s *ConnectServiceHandler) GetLinkMetadata(ctx context.Context, req *connect.Request[v1pb.GetLinkMetadataRequest]) (*connect.Response[v1pb.LinkMetadata], error) { - resp, err := s.APIV1Service.GetLinkMetadata(ctx, req.Msg) +func (s *ConnectServiceHandler) GetLinkMetadata(ctx context.Context, req *connect.Request[apipb.GetLinkMetadataRequest]) (*connect.Response[apipb.LinkMetadata], error) { + resp, err := s.APIService.GetLinkMetadata(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } return connect.NewResponse(resp), nil } -func (s *ConnectServiceHandler) BatchGetLinkMetadata(ctx context.Context, req *connect.Request[v1pb.BatchGetLinkMetadataRequest]) (*connect.Response[v1pb.BatchGetLinkMetadataResponse], error) { - resp, err := s.APIV1Service.BatchGetLinkMetadata(ctx, req.Msg) +func (s *ConnectServiceHandler) BatchGetLinkMetadata(ctx context.Context, req *connect.Request[apipb.BatchGetLinkMetadataRequest]) (*connect.Response[apipb.BatchGetLinkMetadataResponse], error) { + resp, err := s.APIService.BatchGetLinkMetadata(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } @@ -527,128 +527,128 @@ func (s *ConnectServiceHandler) BatchGetLinkMetadata(ctx context.Context, req *c // SpaceService -func (s *ConnectServiceHandler) CreateSpace(ctx context.Context, req *connect.Request[v1pb.CreateSpaceRequest]) (*connect.Response[v1pb.Space], error) { - resp, err := s.APIV1Service.CreateSpace(ctx, req.Msg) +func (s *ConnectServiceHandler) CreateSpace(ctx context.Context, req *connect.Request[apipb.CreateSpaceRequest]) (*connect.Response[apipb.Space], error) { + resp, err := s.APIService.CreateSpace(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } return connect.NewResponse(resp), nil } -func (s *ConnectServiceHandler) ListSpaces(ctx context.Context, req *connect.Request[v1pb.ListSpacesRequest]) (*connect.Response[v1pb.ListSpacesResponse], error) { - resp, err := s.APIV1Service.ListSpaces(ctx, req.Msg) +func (s *ConnectServiceHandler) ListSpaces(ctx context.Context, req *connect.Request[apipb.ListSpacesRequest]) (*connect.Response[apipb.ListSpacesResponse], error) { + resp, err := s.APIService.ListSpaces(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } return connect.NewResponse(resp), nil } -func (s *ConnectServiceHandler) GetSpace(ctx context.Context, req *connect.Request[v1pb.GetSpaceRequest]) (*connect.Response[v1pb.Space], error) { - resp, err := s.APIV1Service.GetSpace(ctx, req.Msg) +func (s *ConnectServiceHandler) GetSpace(ctx context.Context, req *connect.Request[apipb.GetSpaceRequest]) (*connect.Response[apipb.Space], error) { + resp, err := s.APIService.GetSpace(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } return connect.NewResponse(resp), nil } -func (s *ConnectServiceHandler) UpdateSpace(ctx context.Context, req *connect.Request[v1pb.UpdateSpaceRequest]) (*connect.Response[v1pb.Space], error) { - resp, err := s.APIV1Service.UpdateSpace(ctx, req.Msg) +func (s *ConnectServiceHandler) UpdateSpace(ctx context.Context, req *connect.Request[apipb.UpdateSpaceRequest]) (*connect.Response[apipb.Space], error) { + resp, err := s.APIService.UpdateSpace(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } return connect.NewResponse(resp), nil } -func (s *ConnectServiceHandler) DeleteSpace(ctx context.Context, req *connect.Request[v1pb.DeleteSpaceRequest]) (*connect.Response[emptypb.Empty], error) { - resp, err := s.APIV1Service.DeleteSpace(ctx, req.Msg) +func (s *ConnectServiceHandler) DeleteSpace(ctx context.Context, req *connect.Request[apipb.DeleteSpaceRequest]) (*connect.Response[emptypb.Empty], error) { + resp, err := s.APIService.DeleteSpace(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } return connect.NewResponse(resp), nil } -func (s *ConnectServiceHandler) CreateSpaceInvitation(ctx context.Context, req *connect.Request[v1pb.CreateSpaceInvitationRequest]) (*connect.Response[v1pb.SpaceInvitation], error) { - resp, err := s.APIV1Service.CreateSpaceInvitation(ctx, req.Msg) +func (s *ConnectServiceHandler) CreateSpaceInvitation(ctx context.Context, req *connect.Request[apipb.CreateSpaceInvitationRequest]) (*connect.Response[apipb.SpaceInvitation], error) { + resp, err := s.APIService.CreateSpaceInvitation(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } return connect.NewResponse(resp), nil } -func (s *ConnectServiceHandler) ListSpaceInvitations(ctx context.Context, req *connect.Request[v1pb.ListSpaceInvitationsRequest]) (*connect.Response[v1pb.ListSpaceInvitationsResponse], error) { - resp, err := s.APIV1Service.ListSpaceInvitations(ctx, req.Msg) +func (s *ConnectServiceHandler) ListSpaceInvitations(ctx context.Context, req *connect.Request[apipb.ListSpaceInvitationsRequest]) (*connect.Response[apipb.ListSpaceInvitationsResponse], error) { + resp, err := s.APIService.ListSpaceInvitations(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } return connect.NewResponse(resp), nil } -func (s *ConnectServiceHandler) ListUserSpaceInvitations(ctx context.Context, req *connect.Request[v1pb.ListUserSpaceInvitationsRequest]) (*connect.Response[v1pb.ListUserSpaceInvitationsResponse], error) { - resp, err := s.APIV1Service.ListUserSpaceInvitations(ctx, req.Msg) +func (s *ConnectServiceHandler) ListUserSpaceInvitations(ctx context.Context, req *connect.Request[apipb.ListUserSpaceInvitationsRequest]) (*connect.Response[apipb.ListUserSpaceInvitationsResponse], error) { + resp, err := s.APIService.ListUserSpaceInvitations(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } return connect.NewResponse(resp), nil } -func (s *ConnectServiceHandler) GetSpaceInvitation(ctx context.Context, req *connect.Request[v1pb.GetSpaceInvitationRequest]) (*connect.Response[v1pb.SpaceInvitation], error) { - resp, err := s.APIV1Service.GetSpaceInvitation(ctx, req.Msg) +func (s *ConnectServiceHandler) GetSpaceInvitation(ctx context.Context, req *connect.Request[apipb.GetSpaceInvitationRequest]) (*connect.Response[apipb.SpaceInvitation], error) { + resp, err := s.APIService.GetSpaceInvitation(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } return connect.NewResponse(resp), nil } -func (s *ConnectServiceHandler) DeleteSpaceInvitation(ctx context.Context, req *connect.Request[v1pb.DeleteSpaceInvitationRequest]) (*connect.Response[emptypb.Empty], error) { - resp, err := s.APIV1Service.DeleteSpaceInvitation(ctx, req.Msg) +func (s *ConnectServiceHandler) DeleteSpaceInvitation(ctx context.Context, req *connect.Request[apipb.DeleteSpaceInvitationRequest]) (*connect.Response[emptypb.Empty], error) { + resp, err := s.APIService.DeleteSpaceInvitation(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } return connect.NewResponse(resp), nil } -func (s *ConnectServiceHandler) AcceptSpaceInvitation(ctx context.Context, req *connect.Request[v1pb.AcceptSpaceInvitationRequest]) (*connect.Response[v1pb.SpaceMember], error) { - resp, err := s.APIV1Service.AcceptSpaceInvitation(ctx, req.Msg) +func (s *ConnectServiceHandler) AcceptSpaceInvitation(ctx context.Context, req *connect.Request[apipb.AcceptSpaceInvitationRequest]) (*connect.Response[apipb.SpaceMember], error) { + resp, err := s.APIService.AcceptSpaceInvitation(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } return connect.NewResponse(resp), nil } -func (s *ConnectServiceHandler) DeclineSpaceInvitation(ctx context.Context, req *connect.Request[v1pb.DeclineSpaceInvitationRequest]) (*connect.Response[emptypb.Empty], error) { - resp, err := s.APIV1Service.DeclineSpaceInvitation(ctx, req.Msg) +func (s *ConnectServiceHandler) DeclineSpaceInvitation(ctx context.Context, req *connect.Request[apipb.DeclineSpaceInvitationRequest]) (*connect.Response[emptypb.Empty], error) { + resp, err := s.APIService.DeclineSpaceInvitation(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } return connect.NewResponse(resp), nil } -func (s *ConnectServiceHandler) ListSpaceMembers(ctx context.Context, req *connect.Request[v1pb.ListSpaceMembersRequest]) (*connect.Response[v1pb.ListSpaceMembersResponse], error) { - resp, err := s.APIV1Service.ListSpaceMembers(ctx, req.Msg) +func (s *ConnectServiceHandler) ListSpaceMembers(ctx context.Context, req *connect.Request[apipb.ListSpaceMembersRequest]) (*connect.Response[apipb.ListSpaceMembersResponse], error) { + resp, err := s.APIService.ListSpaceMembers(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } return connect.NewResponse(resp), nil } -func (s *ConnectServiceHandler) GetSpaceMember(ctx context.Context, req *connect.Request[v1pb.GetSpaceMemberRequest]) (*connect.Response[v1pb.SpaceMember], error) { - resp, err := s.APIV1Service.GetSpaceMember(ctx, req.Msg) +func (s *ConnectServiceHandler) GetSpaceMember(ctx context.Context, req *connect.Request[apipb.GetSpaceMemberRequest]) (*connect.Response[apipb.SpaceMember], error) { + resp, err := s.APIService.GetSpaceMember(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } return connect.NewResponse(resp), nil } -func (s *ConnectServiceHandler) UpdateSpaceMember(ctx context.Context, req *connect.Request[v1pb.UpdateSpaceMemberRequest]) (*connect.Response[v1pb.SpaceMember], error) { - resp, err := s.APIV1Service.UpdateSpaceMember(ctx, req.Msg) +func (s *ConnectServiceHandler) UpdateSpaceMember(ctx context.Context, req *connect.Request[apipb.UpdateSpaceMemberRequest]) (*connect.Response[apipb.SpaceMember], error) { + resp, err := s.APIService.UpdateSpaceMember(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } return connect.NewResponse(resp), nil } -func (s *ConnectServiceHandler) DeleteSpaceMember(ctx context.Context, req *connect.Request[v1pb.DeleteSpaceMemberRequest]) (*connect.Response[emptypb.Empty], error) { - resp, err := s.APIV1Service.DeleteSpaceMember(ctx, req.Msg) +func (s *ConnectServiceHandler) DeleteSpaceMember(ctx context.Context, req *connect.Request[apipb.DeleteSpaceMemberRequest]) (*connect.Response[emptypb.Empty], error) { + resp, err := s.APIService.DeleteSpaceMember(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } @@ -657,56 +657,56 @@ func (s *ConnectServiceHandler) DeleteSpaceMember(ctx context.Context, req *conn // AttachmentService -func (s *ConnectServiceHandler) UploadAttachment(ctx context.Context, req *connect.Request[v1pb.UploadAttachmentRequest]) (*connect.Response[v1pb.UploadAttachmentResponse], error) { - resp, err := s.APIV1Service.UploadAttachment(ctx, req.Msg) +func (s *ConnectServiceHandler) UploadAttachment(ctx context.Context, req *connect.Request[apipb.UploadAttachmentRequest]) (*connect.Response[apipb.UploadAttachmentResponse], error) { + resp, err := s.APIService.UploadAttachment(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } return connect.NewResponse(resp), nil } -func (s *ConnectServiceHandler) CreateAttachment(ctx context.Context, req *connect.Request[v1pb.CreateAttachmentRequest]) (*connect.Response[v1pb.Attachment], error) { - resp, err := s.APIV1Service.CreateAttachment(ctx, req.Msg) +func (s *ConnectServiceHandler) CreateAttachment(ctx context.Context, req *connect.Request[apipb.CreateAttachmentRequest]) (*connect.Response[apipb.Attachment], error) { + resp, err := s.APIService.CreateAttachment(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } return connect.NewResponse(resp), nil } -func (s *ConnectServiceHandler) ListAttachments(ctx context.Context, req *connect.Request[v1pb.ListAttachmentsRequest]) (*connect.Response[v1pb.ListAttachmentsResponse], error) { - resp, err := s.APIV1Service.ListAttachments(ctx, req.Msg) +func (s *ConnectServiceHandler) ListAttachments(ctx context.Context, req *connect.Request[apipb.ListAttachmentsRequest]) (*connect.Response[apipb.ListAttachmentsResponse], error) { + resp, err := s.APIService.ListAttachments(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } return connect.NewResponse(resp), nil } -func (s *ConnectServiceHandler) GetAttachment(ctx context.Context, req *connect.Request[v1pb.GetAttachmentRequest]) (*connect.Response[v1pb.Attachment], error) { - resp, err := s.APIV1Service.GetAttachment(ctx, req.Msg) +func (s *ConnectServiceHandler) GetAttachment(ctx context.Context, req *connect.Request[apipb.GetAttachmentRequest]) (*connect.Response[apipb.Attachment], error) { + resp, err := s.APIService.GetAttachment(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } return connect.NewResponse(resp), nil } -func (s *ConnectServiceHandler) UpdateAttachment(ctx context.Context, req *connect.Request[v1pb.UpdateAttachmentRequest]) (*connect.Response[v1pb.Attachment], error) { - resp, err := s.APIV1Service.UpdateAttachment(ctx, req.Msg) +func (s *ConnectServiceHandler) UpdateAttachment(ctx context.Context, req *connect.Request[apipb.UpdateAttachmentRequest]) (*connect.Response[apipb.Attachment], error) { + resp, err := s.APIService.UpdateAttachment(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } return connect.NewResponse(resp), nil } -func (s *ConnectServiceHandler) DeleteAttachment(ctx context.Context, req *connect.Request[v1pb.DeleteAttachmentRequest]) (*connect.Response[emptypb.Empty], error) { - resp, err := s.APIV1Service.DeleteAttachment(ctx, req.Msg) +func (s *ConnectServiceHandler) DeleteAttachment(ctx context.Context, req *connect.Request[apipb.DeleteAttachmentRequest]) (*connect.Response[emptypb.Empty], error) { + resp, err := s.APIService.DeleteAttachment(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } return connect.NewResponse(resp), nil } -func (s *ConnectServiceHandler) BatchDeleteAttachments(ctx context.Context, req *connect.Request[v1pb.BatchDeleteAttachmentsRequest]) (*connect.Response[emptypb.Empty], error) { - resp, err := s.APIV1Service.BatchDeleteAttachments(ctx, req.Msg) +func (s *ConnectServiceHandler) BatchDeleteAttachments(ctx context.Context, req *connect.Request[apipb.BatchDeleteAttachmentsRequest]) (*connect.Response[emptypb.Empty], error) { + resp, err := s.APIService.BatchDeleteAttachments(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } @@ -715,8 +715,8 @@ func (s *ConnectServiceHandler) BatchDeleteAttachments(ctx context.Context, req // AIService -func (s *ConnectServiceHandler) Transcribe(ctx context.Context, req *connect.Request[v1pb.TranscribeRequest]) (*connect.Response[v1pb.TranscribeResponse], error) { - resp, err := s.APIV1Service.Transcribe(ctx, req.Msg) +func (s *ConnectServiceHandler) Transcribe(ctx context.Context, req *connect.Request[apipb.TranscribeRequest]) (*connect.Response[apipb.TranscribeResponse], error) { + resp, err := s.APIService.Transcribe(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } @@ -725,40 +725,40 @@ func (s *ConnectServiceHandler) Transcribe(ctx context.Context, req *connect.Req // IdentityProviderService -func (s *ConnectServiceHandler) ListIdentityProviders(ctx context.Context, req *connect.Request[v1pb.ListIdentityProvidersRequest]) (*connect.Response[v1pb.ListIdentityProvidersResponse], error) { - resp, err := s.APIV1Service.ListIdentityProviders(ctx, req.Msg) +func (s *ConnectServiceHandler) ListIdentityProviders(ctx context.Context, req *connect.Request[apipb.ListIdentityProvidersRequest]) (*connect.Response[apipb.ListIdentityProvidersResponse], error) { + resp, err := s.APIService.ListIdentityProviders(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } return connect.NewResponse(resp), nil } -func (s *ConnectServiceHandler) GetIdentityProvider(ctx context.Context, req *connect.Request[v1pb.GetIdentityProviderRequest]) (*connect.Response[v1pb.IdentityProvider], error) { - resp, err := s.APIV1Service.GetIdentityProvider(ctx, req.Msg) +func (s *ConnectServiceHandler) GetIdentityProvider(ctx context.Context, req *connect.Request[apipb.GetIdentityProviderRequest]) (*connect.Response[apipb.IdentityProvider], error) { + resp, err := s.APIService.GetIdentityProvider(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } return connect.NewResponse(resp), nil } -func (s *ConnectServiceHandler) CreateIdentityProvider(ctx context.Context, req *connect.Request[v1pb.CreateIdentityProviderRequest]) (*connect.Response[v1pb.IdentityProvider], error) { - resp, err := s.APIV1Service.CreateIdentityProvider(ctx, req.Msg) +func (s *ConnectServiceHandler) CreateIdentityProvider(ctx context.Context, req *connect.Request[apipb.CreateIdentityProviderRequest]) (*connect.Response[apipb.IdentityProvider], error) { + resp, err := s.APIService.CreateIdentityProvider(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } return connect.NewResponse(resp), nil } -func (s *ConnectServiceHandler) UpdateIdentityProvider(ctx context.Context, req *connect.Request[v1pb.UpdateIdentityProviderRequest]) (*connect.Response[v1pb.IdentityProvider], error) { - resp, err := s.APIV1Service.UpdateIdentityProvider(ctx, req.Msg) +func (s *ConnectServiceHandler) UpdateIdentityProvider(ctx context.Context, req *connect.Request[apipb.UpdateIdentityProviderRequest]) (*connect.Response[apipb.IdentityProvider], error) { + resp, err := s.APIService.UpdateIdentityProvider(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } return connect.NewResponse(resp), nil } -func (s *ConnectServiceHandler) DeleteIdentityProvider(ctx context.Context, req *connect.Request[v1pb.DeleteIdentityProviderRequest]) (*connect.Response[emptypb.Empty], error) { - resp, err := s.APIV1Service.DeleteIdentityProvider(ctx, req.Msg) +func (s *ConnectServiceHandler) DeleteIdentityProvider(ctx context.Context, req *connect.Request[apipb.DeleteIdentityProviderRequest]) (*connect.Response[emptypb.Empty], error) { + resp, err := s.APIService.DeleteIdentityProvider(ctx, req.Msg) if err != nil { return nil, convertGRPCError(err) } diff --git a/server/api/v1/filter_access.go b/server/api/filter_access.go similarity index 91% rename from server/api/v1/filter_access.go rename to server/api/filter_access.go index 47784093d..a54f9a3b1 100644 --- a/server/api/v1/filter_access.go +++ b/server/api/filter_access.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "context" @@ -12,7 +12,7 @@ import ( "github.com/usememos/memos/store" ) -func (s *APIV1Service) validateMemoFilterForUser(ctx context.Context, filterText string, user *store.User) error { +func (s *APIService) validateMemoFilterForUser(ctx context.Context, filterText string, user *store.User) error { engine, err := filterpkg.DefaultEngine() if err != nil { return status.Errorf(codes.Internal, "failed to initialize filter: %v", err) @@ -20,7 +20,7 @@ func (s *APIV1Service) validateMemoFilterForUser(ctx context.Context, filterText return s.validateFilterSpaceAccess(ctx, filterText, engine, user) } -func (s *APIV1Service) validateAttachmentFilterForUser(ctx context.Context, filterText string, user *store.User) error { +func (s *APIService) validateAttachmentFilterForUser(ctx context.Context, filterText string, user *store.User) error { engine, err := filterpkg.DefaultAttachmentEngine() if err != nil { return status.Errorf(codes.Internal, "failed to initialize filter: %v", err) @@ -28,7 +28,7 @@ func (s *APIV1Service) validateAttachmentFilterForUser(ctx context.Context, filt return s.validateFilterSpaceAccess(ctx, filterText, engine, user) } -func (s *APIV1Service) validateFilterSpaceAccess(ctx context.Context, filterText string, engine *filterpkg.Engine, user *store.User) error { +func (s *APIService) validateFilterSpaceAccess(ctx context.Context, filterText string, engine *filterpkg.Engine, user *store.User) error { program, err := engine.Compile(ctx, filterText) if err != nil { return status.Errorf(codes.InvalidArgument, "invalid filter: %v", err) diff --git a/server/api/v1/gateway_marshaler_test.go b/server/api/gateway_marshaler_test.go similarity index 86% rename from server/api/v1/gateway_marshaler_test.go rename to server/api/gateway_marshaler_test.go index 420f50d25..caab32a1d 100644 --- a/server/api/v1/gateway_marshaler_test.go +++ b/server/api/gateway_marshaler_test.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "encoding/json" @@ -9,7 +9,7 @@ import ( "google.golang.org/protobuf/proto" "google.golang.org/protobuf/types/known/timestamppb" - v1pb "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" ) // TestGatewayMarshalerOmitsUnsetMessageFields pins the REST payload shape the @@ -19,7 +19,7 @@ import ( // MCP clients, whose tool outputSchema is that same schema — reject the // response outright. func TestGatewayMarshalerOmitsUnsetMessageFields(t *testing.T) { - attachment := &v1pb.Attachment{ + attachment := &apipb.Attachment{ Name: "attachments/plainimage1", CreateTime: timestamppb.New(time.Unix(1700000000, 0).UTC()), Filename: "sunset.png", @@ -39,14 +39,14 @@ func TestGatewayMarshalerOmitsUnsetMessageFields(t *testing.T) { } func TestGatewayMarshalerKeepsMediaMetadataFieldNames(t *testing.T) { - attachment := &v1pb.Attachment{ + attachment := &apipb.Attachment{ Name: "attachments/video1", Filename: "clip.mp4", Type: "video/mp4", - MediaMetadata: &v1pb.MediaMetadata{ + MediaMetadata: &apipb.MediaMetadata{ Width: proto.Int32(1920), Height: proto.Int32(1080), - Details: &v1pb.MediaMetadata_Video{Video: &v1pb.VideoMetadata{ + Details: &apipb.MediaMetadata_Video{Video: &apipb.VideoMetadata{ DurationSeconds: proto.Float64(12.5), }}, }, @@ -63,12 +63,12 @@ func TestGatewayMarshalerKeepsMediaMetadataFieldNames(t *testing.T) { } func TestGatewayMarshalerNamesSourceExifOrientationExplicitly(t *testing.T) { - attachment := &v1pb.Attachment{ + attachment := &apipb.Attachment{ Name: "attachments/photo1", Filename: "photo.jpg", Type: "image/jpeg", - MediaMetadata: &v1pb.MediaMetadata{ - Details: &v1pb.MediaMetadata_Photo{Photo: &v1pb.PhotoMetadata{ + MediaMetadata: &apipb.MediaMetadata{ + Details: &apipb.MediaMetadata_Photo{Photo: &apipb.PhotoMetadata{ SourceExifOrientation: proto.Int32(6), }}, }, @@ -85,13 +85,13 @@ func TestGatewayMarshalerNamesSourceExifOrientationExplicitly(t *testing.T) { } func TestGatewayMarshalerKeepsPopulatedMessageFields(t *testing.T) { - attachment := &v1pb.Attachment{ + attachment := &apipb.Attachment{ Name: "attachments/livephoto1", Filename: "walk.heic", Type: "image/heic", - MotionMedia: &v1pb.MotionMedia{ - Family: v1pb.MotionMediaFamily_APPLE_LIVE_PHOTO, - Role: v1pb.MotionMediaRole_STILL, + MotionMedia: &apipb.MotionMedia{ + Family: apipb.MotionMediaFamily_APPLE_LIVE_PHOTO, + Role: apipb.MotionMediaRole_STILL, GroupId: "group1", }, } @@ -108,11 +108,11 @@ func TestGatewayMarshalerKeepsPopulatedMessageFields(t *testing.T) { // default-value behaviour: list fields the schema types as arrays must not // disappear when empty. func TestGatewayMarshalerKeepsEmptyCollections(t *testing.T) { - memo := &v1pb.Memo{ + memo := &apipb.Memo{ Name: "memos/plainmemo1", Content: "", - State: v1pb.State_NORMAL, - Visibility: v1pb.Visibility_PRIVATE, + State: apipb.State_NORMAL, + Visibility: apipb.Visibility_PRIVATE, } payload := marshalThroughGateway(t, memo) diff --git a/server/api/v1/gateway_route_resolver.go b/server/api/gateway_route_resolver.go similarity index 99% rename from server/api/v1/gateway_route_resolver.go rename to server/api/gateway_route_resolver.go index 190e34155..e6fa6e8ec 100644 --- a/server/api/v1/gateway_route_resolver.go +++ b/server/api/gateway_route_resolver.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "net/http" @@ -13,7 +13,7 @@ import ( ) // apiPackage is the proto package whose HTTP bindings the gateway serves. -const apiPackage = "memos.api.v1" +const apiPackage = "memos.api" type gatewayRouteKey struct { httpMethod string diff --git a/server/api/v1/gateway_route_resolver_test.go b/server/api/gateway_route_resolver_test.go similarity index 54% rename from server/api/v1/gateway_route_resolver_test.go rename to server/api/gateway_route_resolver_test.go index 777ddcaab..08ebbaa1c 100644 --- a/server/api/v1/gateway_route_resolver_test.go +++ b/server/api/gateway_route_resolver_test.go @@ -1,17 +1,24 @@ -package v1 +package api import ( + "context" "net/http" "net/http/httptest" + "regexp" "strings" "testing" "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" + "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "google.golang.org/genproto/googleapis/api/annotations" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/reflect/protoreflect" "google.golang.org/protobuf/reflect/protoregistry" + "gopkg.in/yaml.v3" + + memosproto "github.com/usememos/memos/proto" + apipb "github.com/usememos/memos/proto/gen/api" ) func TestCanonicalGatewayPattern(t *testing.T) { @@ -23,37 +30,37 @@ func TestCanonicalGatewayPattern(t *testing.T) { }{ { name: "literal", - template: "/api/v1/users", - want: "/api/v1/users", + template: "/api/users", + want: "/api/users", }, { name: "bare variable", - template: "/api/v1/shares/{share_token}/memo", - want: "/api/v1/shares/{share_token=*}/memo", + template: "/api/shares/{share_token}/memo", + want: "/api/shares/{share_token=*}/memo", }, { name: "resource name variable", - template: "/api/v1/{name=users/*}", - want: "/api/v1/{name=users/*}", + template: "/api/{name=users/*}", + want: "/api/{name=users/*}", }, { name: "variable with verb", - template: "/api/v1/{name=users/*}:getStats", - want: "/api/v1/{name=users/*}:getStats", + template: "/api/{name=users/*}:getStats", + want: "/api/{name=users/*}:getStats", }, { name: "missing leading slash", - template: "api/v1/users", + template: "api/users", wantErr: true, }, { name: "unclosed variable", - template: "/api/v1/{name", + template: "/api/{name", wantErr: true, }, { name: "unexpected closing brace", - template: "/api/v1/name}", + template: "/api/name}", wantErr: true, }, } @@ -84,28 +91,30 @@ func TestGatewayRouteResolverResolvesKnownRoutes(t *testing.T) { path string procedure string }{ - {http.MethodPost, "/api/v1/auth/signin", "/api/v1/auth/signin", "/memos.api.v1.AuthService/SignIn"}, - {http.MethodGet, "/api/v1/instance/profile", "/api/v1/instance/profile", "/memos.api.v1.InstanceService/GetInstanceProfile"}, - {http.MethodPost, "/api/v1/users", "/api/v1/users", "/memos.api.v1.UserService/CreateUser"}, - {http.MethodGet, "/api/v1/users", "/api/v1/users", "/memos.api.v1.UserService/ListUsers"}, - {http.MethodGet, "/api/v1/{name=users/*}", "/api/v1/users/1", "/memos.api.v1.UserService/GetUser"}, - {http.MethodGet, "/api/v1/{parent=users/*}/views", "/api/v1/users/alice/views", "/memos.api.v1.UserService/ListMemoViews"}, - {http.MethodPost, "/api/v1/{parent=users/*}/views", "/api/v1/users/alice/views", "/memos.api.v1.UserService/CreateMemoView"}, - {http.MethodGet, "/api/v1/{name=users/*/views/*}", "/api/v1/users/alice/views/work", "/memos.api.v1.UserService/GetMemoView"}, - {http.MethodPatch, "/api/v1/{memo_view.name=users/*/views/*}", "/api/v1/users/alice/views/work", "/memos.api.v1.UserService/UpdateMemoView"}, - {http.MethodDelete, "/api/v1/{name=users/*/views/*}", "/api/v1/users/alice/views/work", "/memos.api.v1.UserService/DeleteMemoView"}, - {http.MethodGet, "/api/v1/memos", "/api/v1/memos", "/memos.api.v1.MemoService/ListMemos"}, - {http.MethodGet, "/api/v1/{name=memos/*}", "/api/v1/memos/abc", "/memos.api.v1.MemoService/GetMemo"}, - {http.MethodPost, "/api/v1/memos", "/api/v1/memos", "/memos.api.v1.MemoService/CreateMemo"}, - {http.MethodPost, "/api/v1/spaces", "/api/v1/spaces", "/memos.api.v1.SpaceService/CreateSpace"}, - {http.MethodGet, "/api/v1/{name=spaces/*}", "/api/v1/spaces/team", "/memos.api.v1.SpaceService/GetSpace"}, - {http.MethodDelete, "/api/v1/{name=spaces/*}", "/api/v1/spaces/team", "/memos.api.v1.SpaceService/DeleteSpace"}, - {http.MethodGet, "/api/v1/{name=spaces/*/members/*}", "/api/v1/spaces/team/members/alice", "/memos.api.v1.SpaceService/GetSpaceMember"}, + {http.MethodPost, "/api/auth/signin", "/api/auth/signin", "/memos.api.AuthService/SignIn"}, + {http.MethodGet, "/api/instance/profile", "/api/instance/profile", "/memos.api.InstanceService/GetInstanceProfile"}, + {http.MethodPost, "/api/users", "/api/users", "/memos.api.UserService/CreateUser"}, + {http.MethodGet, "/api/users", "/api/users", "/memos.api.UserService/ListUsers"}, + {http.MethodGet, "/api/{name=users/*}", "/api/users/1", "/memos.api.UserService/GetUser"}, + {http.MethodGet, "/api/{parent=users/*}/stats", "/api/users/-/stats", "/memos.api.UserService/ListUserStats"}, + {http.MethodGet, "/api/{parent=users/*}/stats", "/api/users/alice/stats", "/memos.api.UserService/ListUserStats"}, + {http.MethodGet, "/api/{parent=users/*}/views", "/api/users/alice/views", "/memos.api.UserService/ListMemoViews"}, + {http.MethodPost, "/api/{parent=users/*}/views", "/api/users/alice/views", "/memos.api.UserService/CreateMemoView"}, + {http.MethodGet, "/api/{name=users/*/views/*}", "/api/users/alice/views/work", "/memos.api.UserService/GetMemoView"}, + {http.MethodPatch, "/api/{memo_view.name=users/*/views/*}", "/api/users/alice/views/work", "/memos.api.UserService/UpdateMemoView"}, + {http.MethodDelete, "/api/{name=users/*/views/*}", "/api/users/alice/views/work", "/memos.api.UserService/DeleteMemoView"}, + {http.MethodGet, "/api/memos", "/api/memos", "/memos.api.MemoService/ListMemos"}, + {http.MethodGet, "/api/{name=memos/*}", "/api/memos/abc", "/memos.api.MemoService/GetMemo"}, + {http.MethodPost, "/api/memos", "/api/memos", "/memos.api.MemoService/CreateMemo"}, + {http.MethodPost, "/api/spaces", "/api/spaces", "/memos.api.SpaceService/CreateSpace"}, + {http.MethodGet, "/api/{name=spaces/*}", "/api/spaces/team", "/memos.api.SpaceService/GetSpace"}, + {http.MethodDelete, "/api/{name=spaces/*}", "/api/spaces/team", "/memos.api.SpaceService/DeleteSpace"}, + {http.MethodGet, "/api/{name=spaces/*/members/*}", "/api/spaces/team/members/alice", "/memos.api.SpaceService/GetSpaceMember"}, { http.MethodGet, - "/api/v1/shares/{share_token}/memo", - "/api/v1/shares/token:with-colon/memo", - "/memos.api.v1.MemoService/GetSharedMemo", + "/api/shares/{share_token}/memo", + "/api/shares/token:with-colon/memo", + "/memos.api.MemoService/GetSharedMemo", }, } @@ -127,13 +136,13 @@ func TestGatewayRouteResolverResolvesFormPostFallback(t *testing.T) { t, resolver, http.MethodGet, - "/api/v1/instance/profile", + "/api/instance/profile", http.MethodPost, - "/api/v1/instance/profile", + "/api/instance/profile", "application/x-www-form-urlencoded", ) require.True(t, ok) - require.Equal(t, "/memos.api.v1.InstanceService/GetInstanceProfile", procedure) + require.Equal(t, "/memos.api.InstanceService/GetInstanceProfile", procedure) }) t.Run("uses matching POST binding", func(t *testing.T) { @@ -141,13 +150,13 @@ func TestGatewayRouteResolverResolvesFormPostFallback(t *testing.T) { t, resolver, http.MethodPost, - "/api/v1/memos", + "/api/memos", http.MethodPost, - "/api/v1/memos", + "/api/memos", "application/x-www-form-urlencoded", ) require.True(t, ok) - require.Equal(t, "/memos.api.v1.MemoService/CreateMemo", procedure) + require.Equal(t, "/memos.api.MemoService/CreateMemo", procedure) }) } @@ -155,7 +164,7 @@ func TestGatewayRouteResolverRequiresMatchedPattern(t *testing.T) { resolver, err := newGatewayRouteResolver() require.NoError(t, err) - request := httptest.NewRequest(http.MethodGet, "/api/v1/memos", nil) + request := httptest.NewRequest(http.MethodGet, "/api/memos", nil) _, ok := resolver.resolveRequest(request) require.False(t, ok) } @@ -206,6 +215,66 @@ func TestGatewayRouteResolverCoversEveryBinding(t *testing.T) { t.Logf("verified %d HTTP bindings", checked) } +// TestOpenAPIPathsReachTheirGatewayMethods checks the published contract: every +// path in the generated OpenAPI spec, filled with a sample value per parameter, +// must reach the gateway method its operationId names. The OpenAPI generator +// rewrites path templates, so a binding the gateway cannot match from the +// advertised path (for example a literal inside a variable) fails here. +func TestOpenAPIPathsReachTheirGatewayMethods(t *testing.T) { + resolver, err := newGatewayRouteResolver() + require.NoError(t, err) + + // Register the services in production order with stub servers; the + // middleware records the matched procedure without calling a handler. + var matched string + mux := runtime.NewServeMux(runtime.WithMiddlewares(func(runtime.HandlerFunc) runtime.HandlerFunc { + return func(_ http.ResponseWriter, request *http.Request, _ map[string]string) { + matched, _ = resolver.resolveRequest(request) + } + })) + ctx := context.Background() + require.NoError(t, apipb.RegisterInstanceServiceHandlerServer(ctx, mux, apipb.UnimplementedInstanceServiceServer{})) + require.NoError(t, apipb.RegisterAuthServiceHandlerServer(ctx, mux, apipb.UnimplementedAuthServiceServer{})) + require.NoError(t, apipb.RegisterUserServiceHandlerServer(ctx, mux, apipb.UnimplementedUserServiceServer{})) + require.NoError(t, apipb.RegisterMemoServiceHandlerServer(ctx, mux, apipb.UnimplementedMemoServiceServer{})) + require.NoError(t, apipb.RegisterSpaceServiceHandlerServer(ctx, mux, apipb.UnimplementedSpaceServiceServer{})) + require.NoError(t, apipb.RegisterAttachmentServiceHandlerServer(ctx, mux, apipb.UnimplementedAttachmentServiceServer{})) + require.NoError(t, apipb.RegisterAIServiceHandlerServer(ctx, mux, apipb.UnimplementedAIServiceServer{})) + require.NoError(t, apipb.RegisterIdentityProviderServiceHandlerServer(ctx, mux, apipb.UnimplementedIdentityProviderServiceServer{})) + + var spec struct { + Paths map[string]map[string]struct { + OperationID string `yaml:"operationId"` + } `yaml:"paths"` + } + require.NoError(t, yaml.Unmarshal(memosproto.OpenAPIYAML(), &spec)) + require.NotEmpty(t, spec.Paths) + + // The generator renders instance/settings/{setting} as /api/instance/{instance}/*, + // which no client can call. Fixing it needs a different resource pattern; + // remove an entry once its path is correct. + knownBroken := map[string]bool{ + "InstanceService_GetInstanceSetting": true, + "InstanceService_UpdateInstanceSetting": true, + } + + parameter := regexp.MustCompile(`\{[^}]+\}`) + for path, operations := range spec.Paths { + for method, operation := range operations { + if knownBroken[operation.OperationID] { + continue + } + service, rpc, ok := strings.Cut(operation.OperationID, "_") + require.True(t, ok, "operationId %q", operation.OperationID) + + matched = "" + request := httptest.NewRequest(strings.ToUpper(method), parameter.ReplaceAllString(path, "sample"), nil) + mux.ServeHTTP(httptest.NewRecorder(), request) + assert.Equal(t, "/"+apiPackage+"."+service+"/"+rpc, matched, "%s %s", strings.ToUpper(method), path) + } + } +} + func resolveThroughGateway( t *testing.T, resolver *gatewayRouteResolver, diff --git a/server/api/v1/header_carrier.go b/server/api/header_carrier.go similarity index 93% rename from server/api/v1/header_carrier.go rename to server/api/header_carrier.go index 7aa806948..4beaccfb7 100644 --- a/server/api/v1/header_carrier.go +++ b/server/api/header_carrier.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "context" @@ -90,14 +90,14 @@ func SetResponseHeader(ctx context.Context, key, value string) error { // It injects a HeaderCarrier into the context, calls the service method, // and applies any headers from the carrier to the Connect response. // -// The generic parameter T is the non-pointer protobuf message type (e.g., v1pb.CreateSessionResponse), +// The generic parameter T is the non-pointer protobuf message type (e.g., apipb.CreateSessionResponse), // while fn returns *T (the pointer type) as is standard for protobuf messages. // // Usage in Connect wrappers: // -// func (s *ConnectServiceHandler) CreateSession(ctx context.Context, req *connect.Request[v1pb.CreateSessionRequest]) (*connect.Response[v1pb.CreateSessionResponse], error) { -// return connectWithHeaderCarrier(ctx, func(ctx context.Context) (*v1pb.CreateSessionResponse, error) { -// return s.APIV1Service.CreateSession(ctx, req.Msg) +// func (s *ConnectServiceHandler) CreateSession(ctx context.Context, req *connect.Request[apipb.CreateSessionRequest]) (*connect.Response[apipb.CreateSessionResponse], error) { +// return connectWithHeaderCarrier(ctx, func(ctx context.Context) (*apipb.CreateSessionResponse, error) { +// return s.APIService.CreateSession(ctx, req.Msg) // }) // } func connectWithHeaderCarrier[T any](ctx context.Context, fn func(context.Context) (*T, error)) (*connect.Response[T], error) { diff --git a/server/api/v1/health_service.go b/server/api/health_service.go similarity index 92% rename from server/api/v1/health_service.go rename to server/api/health_service.go index 4afc6145f..66802b3fd 100644 --- a/server/api/v1/health_service.go +++ b/server/api/health_service.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "context" @@ -8,7 +8,7 @@ import ( "google.golang.org/grpc/status" ) -func (s *APIV1Service) Check(ctx context.Context, +func (s *APIService) Check(ctx context.Context, _ *grpc_health_v1.HealthCheckRequest) (*grpc_health_v1.HealthCheckResponse, error) { // Check if database is initialized by verifying instance basic setting exists instanceBasicSetting, err := s.Store.GetInstanceBasicSetting(ctx) diff --git a/server/api/v1/idp_service.go b/server/api/idp_service.go similarity index 84% rename from server/api/v1/idp_service.go rename to server/api/idp_service.go index 3e933f59e..aad94ec70 100644 --- a/server/api/v1/idp_service.go +++ b/server/api/idp_service.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "context" @@ -9,12 +9,12 @@ import ( "google.golang.org/grpc/status" "google.golang.org/protobuf/types/known/emptypb" - v1pb "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" storepb "github.com/usememos/memos/proto/gen/store" "github.com/usememos/memos/store" ) -func (s *APIV1Service) CreateIdentityProvider(ctx context.Context, request *v1pb.CreateIdentityProviderRequest) (*v1pb.IdentityProvider, error) { +func (s *APIService) CreateIdentityProvider(ctx context.Context, request *apipb.CreateIdentityProviderRequest) (*apipb.IdentityProvider, error) { currentUser, err := s.fetchCurrentUser(ctx) if err != nil { return nil, status.Errorf(codes.Internal, "failed to get user: %v", err) @@ -44,14 +44,14 @@ func (s *APIV1Service) CreateIdentityProvider(ctx context.Context, request *v1pb return convertIdentityProviderFromStore(identityProvider), nil } -func (s *APIV1Service) ListIdentityProviders(ctx context.Context, _ *v1pb.ListIdentityProvidersRequest) (*v1pb.ListIdentityProvidersResponse, error) { +func (s *APIService) ListIdentityProviders(ctx context.Context, _ *apipb.ListIdentityProvidersRequest) (*apipb.ListIdentityProvidersResponse, error) { identityProviders, err := s.Store.ListIdentityProviders(ctx, &store.FindIdentityProvider{}) if err != nil { return nil, status.Errorf(codes.Internal, "failed to list identity providers, error: %+v", err) } - response := &v1pb.ListIdentityProvidersResponse{ - IdentityProviders: []*v1pb.IdentityProvider{}, + response := &apipb.ListIdentityProvidersResponse{ + IdentityProviders: []*apipb.IdentityProvider{}, } for _, identityProvider := range identityProviders { response.IdentityProviders = append(response.IdentityProviders, convertIdentityProviderFromStore(identityProvider)) @@ -59,7 +59,7 @@ func (s *APIV1Service) ListIdentityProviders(ctx context.Context, _ *v1pb.ListId return response, nil } -func (s *APIV1Service) GetIdentityProvider(ctx context.Context, request *v1pb.GetIdentityProviderRequest) (*v1pb.IdentityProvider, error) { +func (s *APIService) GetIdentityProvider(ctx context.Context, request *apipb.GetIdentityProviderRequest) (*apipb.IdentityProvider, error) { uid, err := ExtractIdentityProviderUIDFromName(request.Name) if err != nil { return nil, status.Errorf(codes.InvalidArgument, "invalid identity provider name: %v", err) @@ -77,7 +77,7 @@ func (s *APIV1Service) GetIdentityProvider(ctx context.Context, request *v1pb.Ge return convertIdentityProviderFromStore(identityProvider), nil } -func (s *APIV1Service) UpdateIdentityProvider(ctx context.Context, request *v1pb.UpdateIdentityProviderRequest) (*v1pb.IdentityProvider, error) { +func (s *APIService) UpdateIdentityProvider(ctx context.Context, request *apipb.UpdateIdentityProviderRequest) (*apipb.IdentityProvider, error) { currentUser, err := s.fetchCurrentUser(ctx) if err != nil { return nil, status.Errorf(codes.Internal, "failed to get user: %v", err) @@ -143,7 +143,7 @@ func (s *APIV1Service) UpdateIdentityProvider(ctx context.Context, request *v1pb return convertIdentityProviderFromStore(identityProvider), nil } -func (s *APIV1Service) DeleteIdentityProvider(ctx context.Context, request *v1pb.DeleteIdentityProviderRequest) (*emptypb.Empty, error) { +func (s *APIService) DeleteIdentityProvider(ctx context.Context, request *apipb.DeleteIdentityProviderRequest) (*emptypb.Empty, error) { currentUser, err := s.fetchCurrentUser(ctx) if err != nil { return nil, status.Errorf(codes.Internal, "failed to get user: %v", err) @@ -181,25 +181,25 @@ func (s *APIV1Service) DeleteIdentityProvider(ctx context.Context, request *v1pb return &emptypb.Empty{}, nil } -func convertIdentityProviderFromStore(identityProvider *storepb.IdentityProvider) *v1pb.IdentityProvider { - temp := &v1pb.IdentityProvider{ +func convertIdentityProviderFromStore(identityProvider *storepb.IdentityProvider) *apipb.IdentityProvider { + temp := &apipb.IdentityProvider{ Name: fmt.Sprintf("%s%s", IdentityProviderNamePrefix, identityProvider.Uid), Title: identityProvider.Name, IdentifierFilter: identityProvider.IdentifierFilter, - Type: v1pb.IdentityProvider_Type(v1pb.IdentityProvider_Type_value[identityProvider.Type.String()]), + Type: apipb.IdentityProvider_Type(apipb.IdentityProvider_Type_value[identityProvider.Type.String()]), } if identityProvider.Type == storepb.IdentityProvider_OAUTH2 { oauth2Config := identityProvider.Config.GetOauth2Config() - temp.Config = &v1pb.IdentityProviderConfig{ - Config: &v1pb.IdentityProviderConfig_Oauth2Config{ - Oauth2Config: &v1pb.OAuth2Config{ + temp.Config = &apipb.IdentityProviderConfig{ + Config: &apipb.IdentityProviderConfig_Oauth2Config{ + Oauth2Config: &apipb.OAuth2Config{ ClientId: oauth2Config.ClientId, // ClientSecret is write-only: never returned in responses. AuthUrl: oauth2Config.AuthUrl, TokenUrl: oauth2Config.TokenUrl, UserInfoUrl: oauth2Config.UserInfoUrl, Scopes: oauth2Config.Scopes, - FieldMapping: &v1pb.FieldMapping{ + FieldMapping: &apipb.FieldMapping{ Identifier: oauth2Config.FieldMapping.Identifier, DisplayName: oauth2Config.FieldMapping.DisplayName, Email: oauth2Config.FieldMapping.Email, @@ -212,7 +212,7 @@ func convertIdentityProviderFromStore(identityProvider *storepb.IdentityProvider return temp } -func convertIdentityProviderToStore(identityProvider *v1pb.IdentityProvider) *storepb.IdentityProvider { +func convertIdentityProviderToStore(identityProvider *apipb.IdentityProvider) *storepb.IdentityProvider { temp := &storepb.IdentityProvider{ Name: identityProvider.Title, IdentifierFilter: identityProvider.IdentifierFilter, @@ -222,8 +222,8 @@ func convertIdentityProviderToStore(identityProvider *v1pb.IdentityProvider) *st return temp } -func convertIdentityProviderConfigToStore(identityProviderType v1pb.IdentityProvider_Type, config *v1pb.IdentityProviderConfig) *storepb.IdentityProviderConfig { - if identityProviderType == v1pb.IdentityProvider_OAUTH2 { +func convertIdentityProviderConfigToStore(identityProviderType apipb.IdentityProvider_Type, config *apipb.IdentityProviderConfig) *storepb.IdentityProviderConfig { + if identityProviderType == apipb.IdentityProvider_OAUTH2 { oauth2Config := config.GetOauth2Config() return &storepb.IdentityProviderConfig{ Config: &storepb.IdentityProviderConfig_Oauth2Config{ diff --git a/server/api/v1/instance_service.go b/server/api/instance_service.go similarity index 87% rename from server/api/v1/instance_service.go rename to server/api/instance_service.go index dc0a3ea46..3a2ce5484 100644 --- a/server/api/v1/instance_service.go +++ b/server/api/instance_service.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "context" @@ -11,7 +11,7 @@ import ( "google.golang.org/protobuf/types/known/emptypb" "github.com/usememos/memos/core/notification" - v1pb "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" storepb "github.com/usememos/memos/proto/gen/store" "github.com/usememos/memos/store" ) @@ -28,7 +28,7 @@ type instanceSettingCaller struct { loaded bool } -func (c *instanceSettingCaller) currentUser(ctx context.Context, service *APIV1Service) (*store.User, error) { +func (c *instanceSettingCaller) currentUser(ctx context.Context, service *APIService) (*store.User, error) { if c.loaded { return c.user, nil } @@ -42,7 +42,7 @@ func (c *instanceSettingCaller) currentUser(ctx context.Context, service *APIV1S } // GetInstanceProfile returns the instance profile. -func (s *APIV1Service) GetInstanceProfile(ctx context.Context, _ *v1pb.GetInstanceProfileRequest) (*v1pb.InstanceProfile, error) { +func (s *APIService) GetInstanceProfile(ctx context.Context, _ *apipb.GetInstanceProfileRequest) (*apipb.InstanceProfile, error) { admin, err := s.GetInstanceAdmin(ctx) if err != nil { return nil, status.Errorf(codes.Internal, "failed to get instance admin: %v", err) @@ -62,7 +62,7 @@ func (s *APIV1Service) GetInstanceProfile(ctx context.Context, _ *v1pb.GetInstan return nil, status.Errorf(codes.Internal, "failed to get instance access setting: %v", err) } - instanceProfile := &v1pb.InstanceProfile{ + instanceProfile := &apipb.InstanceProfile{ Version: s.Profile.Version, Demo: s.Profile.Demo, InstanceUrl: s.Profile.InstanceURL, @@ -75,18 +75,18 @@ func (s *APIV1Service) GetInstanceProfile(ctx context.Context, _ *v1pb.GetInstan return instanceProfile, nil } -func (s *APIV1Service) GetInstanceSetting(ctx context.Context, request *v1pb.GetInstanceSettingRequest) (*v1pb.InstanceSetting, error) { +func (s *APIService) GetInstanceSetting(ctx context.Context, request *apipb.GetInstanceSettingRequest) (*apipb.InstanceSetting, error) { return s.getInstanceSettingByName(ctx, request.Name, &instanceSettingCaller{}) } // BatchGetInstanceSettings returns multiple instance settings in request order. -func (s *APIV1Service) BatchGetInstanceSettings(ctx context.Context, request *v1pb.BatchGetInstanceSettingsRequest) (*v1pb.BatchGetInstanceSettingsResponse, error) { +func (s *APIService) BatchGetInstanceSettings(ctx context.Context, request *apipb.BatchGetInstanceSettingsRequest) (*apipb.BatchGetInstanceSettingsResponse, error) { if len(request.Names) > maxBatchGetInstanceSettings { return nil, status.Errorf(codes.InvalidArgument, "too many instance setting names (max %d)", maxBatchGetInstanceSettings) } caller := &instanceSettingCaller{} - settings := make([]*v1pb.InstanceSetting, 0, len(request.Names)) + settings := make([]*apipb.InstanceSetting, 0, len(request.Names)) for _, name := range request.Names { setting, err := s.getInstanceSettingByName(ctx, name, caller) if err != nil { @@ -95,10 +95,10 @@ func (s *APIV1Service) BatchGetInstanceSettings(ctx context.Context, request *v1 settings = append(settings, setting) } - return &v1pb.BatchGetInstanceSettingsResponse{Settings: settings}, nil + return &apipb.BatchGetInstanceSettingsResponse{InstanceSettings: settings}, nil } -func (s *APIV1Service) getInstanceSettingByName(ctx context.Context, name string, caller *instanceSettingCaller) (*v1pb.InstanceSetting, error) { +func (s *APIService) getInstanceSettingByName(ctx context.Context, name string, caller *instanceSettingCaller) (*apipb.InstanceSetting, error) { instanceSettingKeyString, err := ExtractInstanceSettingKeyFromName(name) if err != nil { return nil, status.Errorf(codes.InvalidArgument, "invalid instance setting name: %v", err) @@ -188,7 +188,7 @@ func (s *APIV1Service) getInstanceSettingByName(ctx context.Context, name string return result, nil } -func (s *APIV1Service) UpdateInstanceSetting(ctx context.Context, request *v1pb.UpdateInstanceSettingRequest) (*v1pb.InstanceSetting, error) { +func (s *APIService) UpdateInstanceSetting(ctx context.Context, request *apipb.UpdateInstanceSettingRequest) (*apipb.InstanceSetting, error) { user, err := s.fetchCurrentUser(ctx) if err != nil { return nil, status.Errorf(codes.Internal, "failed to get current user: %v", err) @@ -199,10 +199,10 @@ func (s *APIV1Service) UpdateInstanceSetting(ctx context.Context, request *v1pb. if user.Role != store.RoleAdmin { return nil, status.Errorf(codes.PermissionDenied, "permission denied") } - if request.Setting == nil { + if request.InstanceSetting == nil { return nil, status.Errorf(codes.InvalidArgument, "instance setting is required") } - settingKeyString, err := ExtractInstanceSettingKeyFromName(request.Setting.Name) + settingKeyString, err := ExtractInstanceSettingKeyFromName(request.InstanceSetting.Name) if err != nil { return nil, status.Errorf(codes.InvalidArgument, "invalid instance setting name: %v", err) } @@ -211,15 +211,15 @@ func (s *APIV1Service) UpdateInstanceSetting(ctx context.Context, request *v1pb. return nil, status.Errorf(codes.FailedPrecondition, "instance setting %q is configured by the deployment", settingKeyString) } - applyInstanceSettingDefaults(request.Setting) + applyInstanceSettingDefaults(request.InstanceSetting) // TODO: Apply update_mask if specified _ = request.UpdateMask - if err := validateInstanceSetting(request.Setting); err != nil { + if err := validateInstanceSetting(request.InstanceSetting); err != nil { return nil, status.Errorf(codes.InvalidArgument, "invalid instance setting: %v", err) } - updateSetting := convertInstanceSettingToStore(request.Setting) + updateSetting := convertInstanceSettingToStore(request.InstanceSetting) // Preserve write-only credential fields when the caller sends an empty value. // An empty string means "no change", not "clear the credential". @@ -271,17 +271,17 @@ func (s *APIV1Service) UpdateInstanceSetting(ctx context.Context, request *v1pb. // challengeProfile describes the configured challenge so the web app can // render the matching widget, or nil when none is configured. -func (s *APIV1Service) challengeProfile() *v1pb.InstanceProfile_Challenge { +func (s *APIService) challengeProfile() *apipb.InstanceProfile_Challenge { if s.Challenge == nil { return nil } - return &v1pb.InstanceProfile_Challenge{ + return &apipb.InstanceProfile_Challenge{ Provider: s.Challenge.Provider(), SiteKey: s.Challenge.SiteKey(), } } -func (s *APIV1Service) TestInstanceEmailSetting(ctx context.Context, request *v1pb.TestInstanceEmailSettingRequest) (*emptypb.Empty, error) { +func (s *APIService) TestInstanceEmailSetting(ctx context.Context, request *apipb.TestInstanceEmailSettingRequest) (*emptypb.Empty, error) { user, err := s.fetchCurrentUser(ctx) if err != nil { return nil, status.Errorf(codes.Internal, "failed to get current user: %v", err) @@ -317,7 +317,7 @@ func (s *APIV1Service) TestInstanceEmailSetting(ctx context.Context, request *v1 return &emptypb.Empty{}, nil } -func (s *APIV1Service) resolveTestEmailSetting(ctx context.Context, requestEmail *v1pb.InstanceSetting_NotificationSetting_EmailSetting) (*storepb.InstanceNotificationSetting_EmailSetting, error) { +func (s *APIService) resolveTestEmailSetting(ctx context.Context, requestEmail *apipb.InstanceSetting_NotificationSetting_EmailSetting) (*storepb.InstanceNotificationSetting_EmailSetting, error) { if requestEmail == nil { existing, err := s.Store.GetInstanceNotificationSetting(ctx) if err != nil { @@ -326,7 +326,7 @@ func (s *APIV1Service) resolveTestEmailSetting(ctx context.Context, requestEmail return existing.GetEmail(), nil } - emailSetting := convertInstanceNotificationSettingToStore(&v1pb.InstanceSetting_NotificationSetting{Email: requestEmail}).GetEmail() + emailSetting := convertInstanceNotificationSettingToStore(&apipb.InstanceSetting_NotificationSetting{Email: requestEmail}).GetEmail() if emailSetting.SmtpPassword != "" { return emailSetting, nil } @@ -357,7 +357,7 @@ func sameSMTPConnectionIdentity(setting, existing *storepb.InstanceNotificationS setting.UseSsl == existing.UseSsl } -func (s *APIV1Service) GetInstanceAdmin(ctx context.Context) (*v1pb.User, error) { +func (s *APIService) GetInstanceAdmin(ctx context.Context) (*apipb.User, error) { adminUserType := store.RoleAdmin user, err := s.Store.GetUser(ctx, &store.FindUser{ Role: &adminUserType, diff --git a/server/api/v1/instance_service_converters.go b/server/api/instance_service_converters.go similarity index 76% rename from server/api/v1/instance_service_converters.go rename to server/api/instance_service_converters.go index 8054d7af6..a977b719c 100644 --- a/server/api/v1/instance_service_converters.go +++ b/server/api/instance_service_converters.go @@ -1,43 +1,43 @@ -package v1 +package api import ( "fmt" - v1pb "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" storepb "github.com/usememos/memos/proto/gen/store" ) -func convertInstanceSettingFromStore(setting *storepb.InstanceSetting) *v1pb.InstanceSetting { - instanceSetting := &v1pb.InstanceSetting{ +func convertInstanceSettingFromStore(setting *storepb.InstanceSetting) *apipb.InstanceSetting { + instanceSetting := &apipb.InstanceSetting{ Name: fmt.Sprintf("instance/settings/%s", setting.Key.String()), } switch setting.Value.(type) { case *storepb.InstanceSetting_GeneralSetting: - instanceSetting.Value = &v1pb.InstanceSetting_GeneralSetting_{ + instanceSetting.Value = &apipb.InstanceSetting_GeneralSetting_{ GeneralSetting: convertInstanceGeneralSettingFromStore(setting.GetGeneralSetting()), } case *storepb.InstanceSetting_StorageSetting: - instanceSetting.Value = &v1pb.InstanceSetting_StorageSetting_{ + instanceSetting.Value = &apipb.InstanceSetting_StorageSetting_{ StorageSetting: convertInstanceStorageSettingFromStore(setting.GetStorageSetting()), } case *storepb.InstanceSetting_MemoRelatedSetting: - instanceSetting.Value = &v1pb.InstanceSetting_MemoRelatedSetting_{ + instanceSetting.Value = &apipb.InstanceSetting_MemoRelatedSetting_{ MemoRelatedSetting: convertInstanceMemoRelatedSettingFromStore(setting.GetMemoRelatedSetting()), } case *storepb.InstanceSetting_TagsSetting: - instanceSetting.Value = &v1pb.InstanceSetting_TagsSetting_{ + instanceSetting.Value = &apipb.InstanceSetting_TagsSetting_{ TagsSetting: convertInstanceTagsSettingFromStore(setting.GetTagsSetting()), } case *storepb.InstanceSetting_NotificationSetting: - instanceSetting.Value = &v1pb.InstanceSetting_NotificationSetting_{ + instanceSetting.Value = &apipb.InstanceSetting_NotificationSetting_{ NotificationSetting: convertInstanceNotificationSettingFromStore(setting.GetNotificationSetting()), } case *storepb.InstanceSetting_AiSetting: - instanceSetting.Value = &v1pb.InstanceSetting_AiSetting{ + instanceSetting.Value = &apipb.InstanceSetting_AiSetting{ AiSetting: convertInstanceAISettingFromStore(setting.GetAiSetting()), } case *storepb.InstanceSetting_AccessSetting: - instanceSetting.Value = &v1pb.InstanceSetting_AccessSetting_{ + instanceSetting.Value = &apipb.InstanceSetting_AccessSetting_{ AccessSetting: convertInstanceAccessSettingFromStore(setting.GetAccessSetting()), } default: @@ -46,7 +46,7 @@ func convertInstanceSettingFromStore(setting *storepb.InstanceSetting) *v1pb.Ins return instanceSetting } -func convertInstanceSettingToStore(setting *v1pb.InstanceSetting) *storepb.InstanceSetting { +func convertInstanceSettingToStore(setting *apipb.InstanceSetting) *storepb.InstanceSetting { settingKeyString, _ := ExtractInstanceSettingKeyFromName(setting.Name) instanceSetting := &storepb.InstanceSetting{ Key: storepb.InstanceSettingKey(storepb.InstanceSettingKey_value[settingKeyString]), @@ -89,16 +89,16 @@ func convertInstanceSettingToStore(setting *v1pb.InstanceSetting) *storepb.Insta return instanceSetting } -func convertInstanceAccessSettingFromStore(setting *storepb.InstanceAccessSetting) *v1pb.InstanceSetting_AccessSetting { +func convertInstanceAccessSettingFromStore(setting *storepb.InstanceAccessSetting) *apipb.InstanceSetting_AccessSetting { if setting == nil { return nil } - return &v1pb.InstanceSetting_AccessSetting{ + return &apipb.InstanceSetting_AccessSetting{ AccessMode: convertInstanceAccessModeFromStore(setting.AccessMode), } } -func convertInstanceAccessSettingToStore(setting *v1pb.InstanceSetting_AccessSetting) *storepb.InstanceAccessSetting { +func convertInstanceAccessSettingToStore(setting *apipb.InstanceSetting_AccessSetting) *storepb.InstanceAccessSetting { if setting == nil { return nil } @@ -107,16 +107,16 @@ func convertInstanceAccessSettingToStore(setting *v1pb.InstanceSetting_AccessSet } } -func convertInstanceAccessModeFromStore(mode storepb.InstanceAccessMode) v1pb.InstanceAccessMode { - return v1pb.InstanceAccessMode(mode) +func convertInstanceAccessModeFromStore(mode storepb.InstanceAccessMode) apipb.InstanceAccessMode { + return apipb.InstanceAccessMode(mode) } -func convertInstanceGeneralSettingFromStore(setting *storepb.InstanceGeneralSetting) *v1pb.InstanceSetting_GeneralSetting { +func convertInstanceGeneralSettingFromStore(setting *storepb.InstanceGeneralSetting) *apipb.InstanceSetting_GeneralSetting { if setting == nil { return nil } - generalSetting := &v1pb.InstanceSetting_GeneralSetting{ + generalSetting := &apipb.InstanceSetting_GeneralSetting{ DisallowUserRegistration: setting.DisallowUserRegistration, DisallowPasswordAuth: setting.DisallowPasswordAuth, AdditionalScript: setting.AdditionalScript, @@ -126,7 +126,7 @@ func convertInstanceGeneralSettingFromStore(setting *storepb.InstanceGeneralSett DisallowChangeNickname: setting.DisallowChangeNickname, } if setting.CustomProfile != nil { - generalSetting.CustomProfile = &v1pb.InstanceSetting_GeneralSetting_CustomProfile{ + generalSetting.CustomProfile = &apipb.InstanceSetting_GeneralSetting_CustomProfile{ Title: setting.CustomProfile.Title, Description: setting.CustomProfile.Description, LogoUrl: setting.CustomProfile.LogoUrl, @@ -135,7 +135,7 @@ func convertInstanceGeneralSettingFromStore(setting *storepb.InstanceGeneralSett return generalSetting } -func convertInstanceGeneralSettingToStore(setting *v1pb.InstanceSetting_GeneralSetting) *storepb.InstanceGeneralSetting { +func convertInstanceGeneralSettingToStore(setting *apipb.InstanceSetting_GeneralSetting) *storepb.InstanceGeneralSetting { if setting == nil { return nil } @@ -158,12 +158,12 @@ func convertInstanceGeneralSettingToStore(setting *v1pb.InstanceSetting_GeneralS return generalSetting } -func convertInstanceStorageSettingFromStore(settingpb *storepb.InstanceStorageSetting) *v1pb.InstanceSetting_StorageSetting { +func convertInstanceStorageSettingFromStore(settingpb *storepb.InstanceStorageSetting) *apipb.InstanceSetting_StorageSetting { if settingpb == nil { return nil } - setting := &v1pb.InstanceSetting_StorageSetting{ - StorageType: v1pb.InstanceSetting_StorageSetting_StorageType(settingpb.StorageType), + setting := &apipb.InstanceSetting_StorageSetting{ + StorageType: apipb.InstanceSetting_StorageSetting_StorageType(settingpb.StorageType), FilepathTemplate: settingpb.FilepathTemplate, UploadSizeLimitMb: settingpb.UploadSizeLimitMb, DefaultStorageId: settingpb.DefaultStorageId, @@ -172,7 +172,7 @@ func convertInstanceStorageSettingFromStore(settingpb *storepb.InstanceStorageSe setting.Storages = append(setting.Storages, convertStorageFromStore(storagepb)) } if settingpb.S3Config != nil { - setting.S3Config = &v1pb.InstanceSetting_StorageSetting_S3Config{ + setting.S3Config = &apipb.InstanceSetting_StorageSetting_S3Config{ AccessKeyId: settingpb.S3Config.AccessKeyId, // AccessKeySecret is write-only: never returned in responses. Endpoint: settingpb.S3Config.Endpoint, @@ -185,7 +185,7 @@ func convertInstanceStorageSettingFromStore(settingpb *storepb.InstanceStorageSe return setting } -func convertInstanceStorageSettingToStore(setting *v1pb.InstanceSetting_StorageSetting) *storepb.InstanceStorageSetting { +func convertInstanceStorageSettingToStore(setting *apipb.InstanceSetting_StorageSetting) *storepb.InstanceStorageSetting { if setting == nil { return nil } @@ -212,18 +212,18 @@ func convertInstanceStorageSettingToStore(setting *v1pb.InstanceSetting_StorageS return settingpb } -func convertStorageFromStore(storagepb *storepb.Storage) *v1pb.InstanceSetting_Storage { +func convertStorageFromStore(storagepb *storepb.Storage) *apipb.InstanceSetting_Storage { if storagepb == nil { return nil } - storage := &v1pb.InstanceSetting_Storage{ + storage := &apipb.InstanceSetting_Storage{ Id: storagepb.Id, Name: storagepb.Name, - Type: v1pb.InstanceSetting_StorageType(storagepb.Type), + Type: apipb.InstanceSetting_StorageType(storagepb.Type), } if s3Config := storagepb.GetS3Config(); s3Config != nil { - storage.Config = &v1pb.InstanceSetting_Storage_S3Config_{ - S3Config: &v1pb.InstanceSetting_Storage_S3Config{ + storage.Config = &apipb.InstanceSetting_Storage_S3Config_{ + S3Config: &apipb.InstanceSetting_Storage_S3Config{ AccessKeyId: s3Config.AccessKeyId, // AccessKeySecret is write-only: never returned in responses. Endpoint: s3Config.Endpoint, @@ -237,7 +237,7 @@ func convertStorageFromStore(storagepb *storepb.Storage) *v1pb.InstanceSetting_S return storage } -func convertStorageToStore(storage *v1pb.InstanceSetting_Storage) *storepb.Storage { +func convertStorageToStore(storage *apipb.InstanceSetting_Storage) *storepb.Storage { if storage == nil { return nil } @@ -262,18 +262,18 @@ func convertStorageToStore(storage *v1pb.InstanceSetting_Storage) *storepb.Stora return storagepb } -func convertInstanceMemoRelatedSettingFromStore(setting *storepb.InstanceMemoRelatedSetting) *v1pb.InstanceSetting_MemoRelatedSetting { +func convertInstanceMemoRelatedSettingFromStore(setting *storepb.InstanceMemoRelatedSetting) *apipb.InstanceSetting_MemoRelatedSetting { if setting == nil { return nil } - return &v1pb.InstanceSetting_MemoRelatedSetting{ + return &apipb.InstanceSetting_MemoRelatedSetting{ ContentLengthLimit: setting.ContentLengthLimit, EnableDoubleClickEdit: setting.EnableDoubleClickEdit, Reactions: setting.Reactions, } } -func convertInstanceMemoRelatedSettingToStore(setting *v1pb.InstanceSetting_MemoRelatedSetting) *storepb.InstanceMemoRelatedSetting { +func convertInstanceMemoRelatedSettingToStore(setting *apipb.InstanceSetting_MemoRelatedSetting) *storepb.InstanceMemoRelatedSetting { if setting == nil { return nil } @@ -284,23 +284,23 @@ func convertInstanceMemoRelatedSettingToStore(setting *v1pb.InstanceSetting_Memo } } -func convertInstanceTagsSettingFromStore(setting *storepb.InstanceTagsSetting) *v1pb.InstanceSetting_TagsSetting { +func convertInstanceTagsSettingFromStore(setting *storepb.InstanceTagsSetting) *apipb.InstanceSetting_TagsSetting { if setting == nil { return nil } - tags := make(map[string]*v1pb.InstanceSetting_TagMetadata, len(setting.Tags)) + tags := make(map[string]*apipb.InstanceSetting_TagMetadata, len(setting.Tags)) for tag, metadata := range setting.Tags { - tags[tag] = &v1pb.InstanceSetting_TagMetadata{ + tags[tag] = &apipb.InstanceSetting_TagMetadata{ BackgroundColor: metadata.GetBackgroundColor(), BlurContent: metadata.GetBlurContent(), } } - return &v1pb.InstanceSetting_TagsSetting{ + return &apipb.InstanceSetting_TagsSetting{ Tags: tags, } } -func convertInstanceTagsSettingToStore(setting *v1pb.InstanceSetting_TagsSetting) *storepb.InstanceTagsSetting { +func convertInstanceTagsSettingToStore(setting *apipb.InstanceSetting_TagsSetting) *storepb.InstanceTagsSetting { if setting == nil { return nil } @@ -316,14 +316,14 @@ func convertInstanceTagsSettingToStore(setting *v1pb.InstanceSetting_TagsSetting } } -func convertInstanceNotificationSettingFromStore(setting *storepb.InstanceNotificationSetting) *v1pb.InstanceSetting_NotificationSetting { +func convertInstanceNotificationSettingFromStore(setting *storepb.InstanceNotificationSetting) *apipb.InstanceSetting_NotificationSetting { if setting == nil { return nil } - notificationSetting := &v1pb.InstanceSetting_NotificationSetting{} + notificationSetting := &apipb.InstanceSetting_NotificationSetting{} if setting.Email != nil { - notificationSetting.Email = &v1pb.InstanceSetting_NotificationSetting_EmailSetting{ + notificationSetting.Email = &apipb.InstanceSetting_NotificationSetting_EmailSetting{ Enabled: setting.Email.Enabled, SmtpHost: setting.Email.SmtpHost, SmtpPort: setting.Email.SmtpPort, @@ -339,7 +339,7 @@ func convertInstanceNotificationSettingFromStore(setting *storepb.InstanceNotifi return notificationSetting } -func convertInstanceNotificationSettingToStore(setting *v1pb.InstanceSetting_NotificationSetting) *storepb.InstanceNotificationSetting { +func convertInstanceNotificationSettingToStore(setting *apipb.InstanceSetting_NotificationSetting) *storepb.InstanceNotificationSetting { if setting == nil { return nil } @@ -362,13 +362,13 @@ func convertInstanceNotificationSettingToStore(setting *v1pb.InstanceSetting_Not return notificationSetting } -func convertInstanceAISettingFromStore(setting *storepb.InstanceAISetting) *v1pb.InstanceSetting_AISetting { +func convertInstanceAISettingFromStore(setting *storepb.InstanceAISetting) *apipb.InstanceSetting_AISetting { if setting == nil { return nil } - aiSetting := &v1pb.InstanceSetting_AISetting{ - Providers: make([]*v1pb.InstanceSetting_AIProviderConfig, 0, len(setting.Providers)), + aiSetting := &apipb.InstanceSetting_AISetting{ + Providers: make([]*apipb.InstanceSetting_AIProviderConfig, 0, len(setting.Providers)), Transcription: convertTranscriptionConfigFromStore(setting.GetTranscription()), } for _, provider := range setting.Providers { @@ -376,10 +376,10 @@ func convertInstanceAISettingFromStore(setting *storepb.InstanceAISetting) *v1pb continue } apiKey := provider.GetApiKey() - aiSetting.Providers = append(aiSetting.Providers, &v1pb.InstanceSetting_AIProviderConfig{ + aiSetting.Providers = append(aiSetting.Providers, &apipb.InstanceSetting_AIProviderConfig{ Id: provider.GetId(), Title: provider.GetTitle(), - Type: v1pb.InstanceSetting_AIProviderType(provider.GetType()), + Type: apipb.InstanceSetting_AIProviderType(provider.GetType()), Endpoint: provider.GetEndpoint(), ApiKeySet: apiKey != "", ApiKeyHint: maskAPIKey(apiKey), @@ -388,7 +388,7 @@ func convertInstanceAISettingFromStore(setting *storepb.InstanceAISetting) *v1pb return aiSetting } -func convertInstanceAISettingToStore(setting *v1pb.InstanceSetting_AISetting) *storepb.InstanceAISetting { +func convertInstanceAISettingToStore(setting *apipb.InstanceSetting_AISetting) *storepb.InstanceAISetting { if setting == nil { return nil } @@ -412,11 +412,11 @@ func convertInstanceAISettingToStore(setting *v1pb.InstanceSetting_AISetting) *s return aiSetting } -func convertTranscriptionConfigFromStore(setting *storepb.TranscriptionConfig) *v1pb.InstanceSetting_TranscriptionConfig { +func convertTranscriptionConfigFromStore(setting *storepb.TranscriptionConfig) *apipb.InstanceSetting_TranscriptionConfig { if setting == nil { return nil } - return &v1pb.InstanceSetting_TranscriptionConfig{ + return &apipb.InstanceSetting_TranscriptionConfig{ ProviderId: setting.GetProviderId(), Model: setting.GetModel(), Language: setting.GetLanguage(), @@ -424,7 +424,7 @@ func convertTranscriptionConfigFromStore(setting *storepb.TranscriptionConfig) * } } -func convertTranscriptionConfigToStore(setting *v1pb.InstanceSetting_TranscriptionConfig) *storepb.TranscriptionConfig { +func convertTranscriptionConfigToStore(setting *apipb.InstanceSetting_TranscriptionConfig) *storepb.TranscriptionConfig { if setting == nil { return nil } diff --git a/server/api/v1/instance_service_validation.go b/server/api/instance_service_validation.go similarity index 90% rename from server/api/v1/instance_service_validation.go rename to server/api/instance_service_validation.go index c0b569720..e16724b19 100644 --- a/server/api/v1/instance_service_validation.go +++ b/server/api/instance_service_validation.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "context" @@ -10,12 +10,12 @@ import ( "github.com/pkg/errors" colorpb "google.golang.org/genproto/googleapis/type/color" - v1pb "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" storepb "github.com/usememos/memos/proto/gen/store" "github.com/usememos/memos/store" ) -func applyInstanceSettingDefaults(setting *v1pb.InstanceSetting) { +func applyInstanceSettingDefaults(setting *apipb.InstanceSetting) { memoRelatedSetting := setting.GetMemoRelatedSetting() if memoRelatedSetting == nil || memoRelatedSetting.ContentLengthLimit != 0 { return @@ -23,7 +23,7 @@ func applyInstanceSettingDefaults(setting *v1pb.InstanceSetting) { memoRelatedSetting.ContentLengthLimit = store.DefaultContentLengthLimit } -func validateInstanceSetting(setting *v1pb.InstanceSetting) error { +func validateInstanceSetting(setting *apipb.InstanceSetting) error { key, err := ExtractInstanceSettingKeyFromName(setting.Name) if err != nil { return err @@ -40,7 +40,7 @@ func validateInstanceSetting(setting *v1pb.InstanceSetting) error { } } -func validateInstanceMemoRelatedSetting(setting *v1pb.InstanceSetting_MemoRelatedSetting) error { +func validateInstanceMemoRelatedSetting(setting *apipb.InstanceSetting_MemoRelatedSetting) error { if setting == nil { return errors.New("memo related setting is required") } @@ -50,19 +50,19 @@ func validateInstanceMemoRelatedSetting(setting *v1pb.InstanceSetting_MemoRelate return nil } -func validateInstanceAccessSetting(setting *v1pb.InstanceSetting_AccessSetting) error { +func validateInstanceAccessSetting(setting *apipb.InstanceSetting_AccessSetting) error { if setting == nil { return errors.New("access setting is required") } switch setting.AccessMode { - case v1pb.InstanceAccessMode_INSTANCE_ACCESS_MODE_PRIVATE, v1pb.InstanceAccessMode_INSTANCE_ACCESS_MODE_PUBLIC: + case apipb.InstanceAccessMode_INSTANCE_ACCESS_MODE_PRIVATE, apipb.InstanceAccessMode_INSTANCE_ACCESS_MODE_PUBLIC: return nil default: return errors.New("access_mode must be PRIVATE or PUBLIC") } } -func (s *APIV1Service) prepareInstanceAISettingForUpdate(ctx context.Context, setting *storepb.InstanceAISetting) error { +func (s *APIService) prepareInstanceAISettingForUpdate(ctx context.Context, setting *storepb.InstanceAISetting) error { if setting == nil { return errors.New("AI setting is required") } @@ -181,7 +181,7 @@ func maskAPIKey(apiKey string) string { return apiKey[:prefixLength] + "..." + apiKey[len(apiKey)-4:] } -func validateInstanceTagsSetting(setting *v1pb.InstanceSetting_TagsSetting) error { +func validateInstanceTagsSetting(setting *apipb.InstanceSetting_TagsSetting) error { if setting == nil { return errors.New("tags setting is required") } diff --git a/server/api/v1/instance_stats.go b/server/api/instance_stats.go similarity index 87% rename from server/api/v1/instance_stats.go rename to server/api/instance_stats.go index f0015e5b0..4d4bdcb83 100644 --- a/server/api/v1/instance_stats.go +++ b/server/api/instance_stats.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "context" @@ -14,7 +14,7 @@ import ( "google.golang.org/grpc/status" "google.golang.org/protobuf/types/known/timestamppb" - v1pb "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" "github.com/usememos/memos/store" ) @@ -23,11 +23,11 @@ const instanceStatsCacheTTL = 60 * time.Second // instanceStatsCache is a single-value, mutex-guarded cache for InstanceStats. type instanceStatsCache struct { mu sync.Mutex - value *v1pb.InstanceStats + value *apipb.InstanceStats expiry time.Time } -func (c *instanceStatsCache) get() (*v1pb.InstanceStats, bool) { +func (c *instanceStatsCache) get() (*apipb.InstanceStats, bool) { c.mu.Lock() defer c.mu.Unlock() if c.value == nil || time.Now().After(c.expiry) { @@ -36,7 +36,7 @@ func (c *instanceStatsCache) get() (*v1pb.InstanceStats, bool) { return c.value, true } -func (c *instanceStatsCache) set(v *v1pb.InstanceStats, ttl time.Duration) { +func (c *instanceStatsCache) set(v *apipb.InstanceStats, ttl time.Duration) { c.mu.Lock() defer c.mu.Unlock() c.value = v @@ -44,7 +44,7 @@ func (c *instanceStatsCache) set(v *v1pb.InstanceStats, ttl time.Duration) { } // GetInstanceStats returns resource usage statistics. Admin only. -func (s *APIV1Service) GetInstanceStats(ctx context.Context, _ *v1pb.GetInstanceStatsRequest) (*v1pb.InstanceStats, error) { +func (s *APIService) GetInstanceStats(ctx context.Context, _ *apipb.GetInstanceStatsRequest) (*apipb.InstanceStats, error) { user, err := s.fetchCurrentUser(ctx) if err != nil { return nil, status.Errorf(codes.Internal, "failed to get current user: %v", err) @@ -71,9 +71,9 @@ func (s *APIV1Service) GetInstanceStats(ctx context.Context, _ *v1pb.GetInstance // computeInstanceStats runs all stat subqueries in parallel and assembles the result. // Per-subtask failures degrade to -1 sentinel values; only a total failure (every // subtask errored) is propagated as an error. -func (s *APIV1Service) computeInstanceStats(ctx context.Context) (*v1pb.InstanceStats, error) { - stats := &v1pb.InstanceStats{ - Database: &v1pb.InstanceStats_DatabaseStats{ +func (s *APIService) computeInstanceStats(ctx context.Context) (*apipb.InstanceStats, error) { + stats := &apipb.InstanceStats{ + Database: &apipb.InstanceStats_DatabaseStats{ Driver: s.Profile.Driver, SizeBytes: -1, }, diff --git a/server/api/v1/instance_stats_test.go b/server/api/instance_stats_test.go similarity index 98% rename from server/api/v1/instance_stats_test.go rename to server/api/instance_stats_test.go index 5414961f8..1356cb36a 100644 --- a/server/api/v1/instance_stats_test.go +++ b/server/api/instance_stats_test.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "os" diff --git a/server/api/v1/link_metadata_test.go b/server/api/link_metadata_test.go similarity index 81% rename from server/api/v1/link_metadata_test.go rename to server/api/link_metadata_test.go index 175178ea8..77b74ae71 100644 --- a/server/api/v1/link_metadata_test.go +++ b/server/api/link_metadata_test.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "context" @@ -11,7 +11,7 @@ import ( "google.golang.org/grpc/status" "github.com/usememos/memos/internal/linkmeta" - v1pb "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" ) type fakeLinkMetadataFetcher func(context.Context, string) (*linkmeta.HTMLMeta, error) @@ -24,7 +24,7 @@ func (fetch fakeLinkMetadataFetcher) Get(ctx context.Context, url string) (*link func TestGetLinkMetadata(t *testing.T) { requestContext := context.WithValue(context.Background(), linkMetadataContextKey{}, "context value") - service := &APIV1Service{ + service := &APIService{ linkMetadataFetcher: fakeLinkMetadataFetcher(func(ctx context.Context, url string) (*linkmeta.HTMLMeta, error) { require.Same(t, requestContext, ctx) require.Equal(t, "https://example.com/article", url) @@ -36,7 +36,7 @@ func TestGetLinkMetadata(t *testing.T) { }), } - metadata, err := service.GetLinkMetadata(requestContext, &v1pb.GetLinkMetadataRequest{ + metadata, err := service.GetLinkMetadata(requestContext, &apipb.GetLinkMetadataRequest{ Url: "https://example.com/article", }) require.NoError(t, err) @@ -47,26 +47,26 @@ func TestGetLinkMetadata(t *testing.T) { } func TestGetLinkMetadataEmptyURL(t *testing.T) { - _, err := (&APIV1Service{}).GetLinkMetadata(context.Background(), &v1pb.GetLinkMetadataRequest{}) + _, err := (&APIService{}).GetLinkMetadata(context.Background(), &apipb.GetLinkMetadataRequest{}) require.Error(t, err) require.Equal(t, codes.InvalidArgument, status.Code(err)) } func TestGetLinkMetadataFetchError(t *testing.T) { - service := &APIV1Service{ + service := &APIService{ linkMetadataFetcher: fakeLinkMetadataFetcher(func(context.Context, string) (*linkmeta.HTMLMeta, error) { return nil, errors.New("fetch failed") }), } - _, err := service.GetLinkMetadata(context.Background(), &v1pb.GetLinkMetadataRequest{Url: "https://example.com"}) + _, err := service.GetLinkMetadata(context.Background(), &apipb.GetLinkMetadataRequest{Url: "https://example.com"}) require.Error(t, err) require.Equal(t, codes.InvalidArgument, status.Code(err)) require.Contains(t, err.Error(), "failed to fetch link metadata") } func TestGetLinkMetadataInternalURL(t *testing.T) { - service := &APIV1Service{linkMetadataFetcher: linkmeta.NewHTMLMetaFetcher()} - _, err := service.GetLinkMetadata(context.Background(), &v1pb.GetLinkMetadataRequest{ + service := &APIService{linkMetadataFetcher: linkmeta.NewHTMLMetaFetcher()} + _, err := service.GetLinkMetadata(context.Background(), &apipb.GetLinkMetadataRequest{ Url: "http://192.168.0.1", }) require.Error(t, err) @@ -75,7 +75,7 @@ func TestGetLinkMetadataInternalURL(t *testing.T) { func TestBatchGetLinkMetadataPreservesOrder(t *testing.T) { var fetchedURLs []string - service := &APIV1Service{ + service := &APIService{ linkMetadataFetcher: fakeLinkMetadataFetcher(func(_ context.Context, url string) (*linkmeta.HTMLMeta, error) { fetchedURLs = append(fetchedURLs, url) return &linkmeta.HTMLMeta{ @@ -86,7 +86,7 @@ func TestBatchGetLinkMetadataPreservesOrder(t *testing.T) { }), } - response, err := service.BatchGetLinkMetadata(context.Background(), &v1pb.BatchGetLinkMetadataRequest{ + response, err := service.BatchGetLinkMetadata(context.Background(), &apipb.BatchGetLinkMetadataRequest{ Urls: []string{ "https://example.com/one", "https://example.com/two", @@ -103,7 +103,7 @@ func TestBatchGetLinkMetadataPreservesOrder(t *testing.T) { func TestBatchGetLinkMetadataStopsOnError(t *testing.T) { var fetchedURLs []string - service := &APIV1Service{ + service := &APIService{ linkMetadataFetcher: fakeLinkMetadataFetcher(func(_ context.Context, url string) (*linkmeta.HTMLMeta, error) { fetchedURLs = append(fetchedURLs, url) if url == "https://example.com/two" { @@ -113,7 +113,7 @@ func TestBatchGetLinkMetadataStopsOnError(t *testing.T) { }), } - _, err := service.BatchGetLinkMetadata(context.Background(), &v1pb.BatchGetLinkMetadataRequest{ + _, err := service.BatchGetLinkMetadata(context.Background(), &apipb.BatchGetLinkMetadataRequest{ Urls: []string{"https://example.com/one", "https://example.com/two", "https://example.com/three"}, }) require.Error(t, err) @@ -122,7 +122,7 @@ func TestBatchGetLinkMetadataStopsOnError(t *testing.T) { } func TestBatchGetLinkMetadataEmptyURLs(t *testing.T) { - _, err := (&APIV1Service{}).BatchGetLinkMetadata(context.Background(), &v1pb.BatchGetLinkMetadataRequest{}) + _, err := (&APIService{}).BatchGetLinkMetadata(context.Background(), &apipb.BatchGetLinkMetadataRequest{}) require.Error(t, err) require.Equal(t, codes.InvalidArgument, status.Code(err)) } @@ -133,7 +133,7 @@ func TestBatchGetLinkMetadataTooManyURLs(t *testing.T) { urls[i] = fmt.Sprintf("https://example.com/%d", i) } - _, err := (&APIV1Service{}).BatchGetLinkMetadata(context.Background(), &v1pb.BatchGetLinkMetadataRequest{ + _, err := (&APIService{}).BatchGetLinkMetadata(context.Background(), &apipb.BatchGetLinkMetadataRequest{ Urls: urls, }) require.Error(t, err) diff --git a/server/api/v1/memo_access.go b/server/api/memo_access.go similarity index 86% rename from server/api/v1/memo_access.go rename to server/api/memo_access.go index 028e8d5be..e1ca1167a 100644 --- a/server/api/v1/memo_access.go +++ b/server/api/memo_access.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "context" @@ -14,7 +14,7 @@ import ( // buildMemoReadContext resolves authorization inputs for exactly one memo. // Relations never contribute access to either endpoint. -func (s *APIV1Service) buildMemoReadContext(ctx context.Context, memo *store.Memo, sharedMemoID *int32) (access.MemoReadContext, error) { +func (s *APIService) buildMemoReadContext(ctx context.Context, memo *store.Memo, sharedMemoID *int32) (access.MemoReadContext, error) { viewer, err := s.fetchCurrentUser(ctx) if err != nil { return access.MemoReadContext{}, status.Errorf(codes.Internal, "failed to get user") @@ -29,7 +29,7 @@ func (s *APIV1Service) buildMemoReadContext(ctx context.Context, memo *store.Mem return s.buildMemoReadContextForViewer(ctx, memo, viewer, allowAnonymous, sharedMemoID) } -func (s *APIV1Service) buildMemoReadContextForViewer(ctx context.Context, memo *store.Memo, viewer *store.User, allowAnonymous bool, sharedMemoID *int32) (access.MemoReadContext, error) { +func (s *APIService) buildMemoReadContextForViewer(ctx context.Context, memo *store.Memo, viewer *store.User, allowAnonymous bool, sharedMemoID *int32) (access.MemoReadContext, error) { if memo == nil { return access.MemoReadContext{}, status.Error(codes.NotFound, "memo not found") } @@ -40,7 +40,7 @@ func (s *APIV1Service) buildMemoReadContextForViewer(ctx context.Context, memo * return readContext, nil } -func (s *APIV1Service) checkMemoReadAccess(ctx context.Context, memo *store.Memo) error { +func (s *APIService) checkMemoReadAccess(ctx context.Context, memo *store.Memo) error { readContext, err := s.buildMemoReadContext(ctx, memo, nil) if err != nil { return err @@ -76,7 +76,7 @@ func newMemoAccessScope(currentUser *store.User, allowPublic bool) *store.MemoAc // scope. For an anonymous caller the instance access policy decides whether // PUBLIC memos are readable at all. Callers map the returned error to their own // transport representation. -func (s *APIV1Service) resolveMemoAccessScope(ctx context.Context) (*store.MemoAccessScope, *store.User, error) { +func (s *APIService) resolveMemoAccessScope(ctx context.Context) (*store.MemoAccessScope, *store.User, error) { currentUser, err := s.fetchCurrentUser(ctx) if err != nil { return nil, nil, errors.Wrap(err, "failed to get current user") @@ -93,7 +93,7 @@ func (s *APIV1Service) resolveMemoAccessScope(ctx context.Context) (*store.MemoA // resolveSpaceByName resolves a space resource name to an existing Space // without any membership check. -func (s *APIV1Service) resolveSpaceByName(ctx context.Context, name string) (*store.Space, error) { +func (s *APIService) resolveSpaceByName(ctx context.Context, name string) (*store.Space, error) { spaceUID, err := ExtractSpaceUIDFromName(name) if err != nil { return nil, status.Errorf(codes.InvalidArgument, "invalid space name: %v", err) @@ -112,7 +112,7 @@ func (s *APIV1Service) resolveSpaceByName(ctx context.Context, name string) (*st // caller to be an active member of it. A non-member receives NotFound so that // an existing collaboration boundary stays indistinguishable from a missing // resource. -func (s *APIV1Service) resolveWritableSpaceByName(ctx context.Context, name string, userID int32) (*store.Space, error) { +func (s *APIService) resolveWritableSpaceByName(ctx context.Context, name string, userID int32) (*store.Space, error) { space, err := s.resolveSpaceByName(ctx, name) if err != nil { return nil, err @@ -131,14 +131,14 @@ func (s *APIV1Service) resolveWritableSpaceByName(ctx context.Context, name stri // An instance administrator may place memos in any existing Space; every // other caller must be an active member. Collection scopes such as the space // filter keep using resolveWritableSpaceByName, so feeds stay membership-only. -func (s *APIV1Service) resolveSpaceForMemoPlacement(ctx context.Context, name string, user *store.User) (*store.Space, error) { +func (s *APIService) resolveSpaceForMemoPlacement(ctx context.Context, name string, user *store.User) (*store.Space, error) { if access.IsInstanceAdmin(user) { return s.resolveSpaceByName(ctx, name) } return s.resolveWritableSpaceByName(ctx, name, user.ID) } -func (s *APIV1Service) isActiveSpaceMember(ctx context.Context, spaceID, userID int32) (bool, error) { +func (s *APIService) isActiveSpaceMember(ctx context.Context, spaceID, userID int32) (bool, error) { user, err := s.Store.GetUser(ctx, &store.FindUser{ID: &userID}) if err != nil { return false, err @@ -185,7 +185,7 @@ func mapMemoWriteError(err error, operation string) error { // requireAssignedMemoWritable requires the placement of an assigned memo to be // valid and the actor to be an active member of it. An instance administrator // is exempt from membership but not from placement validity. -func (s *APIV1Service) requireAssignedMemoWritable(ctx context.Context, memo *store.Memo, user *store.User) error { +func (s *APIService) requireAssignedMemoWritable(ctx context.Context, memo *store.Memo, user *store.User) error { if memo.SpaceID == nil { return nil } diff --git a/server/api/v1/memo_attachment_service.go b/server/api/memo_attachment_service.go similarity index 94% rename from server/api/v1/memo_attachment_service.go rename to server/api/memo_attachment_service.go index 43821f103..a287d1a95 100644 --- a/server/api/v1/memo_attachment_service.go +++ b/server/api/memo_attachment_service.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "context" @@ -13,12 +13,12 @@ import ( "github.com/usememos/memos/core/access" "github.com/usememos/memos/markdown" - v1pb "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" storepb "github.com/usememos/memos/proto/gen/store" "github.com/usememos/memos/store" ) -func (s *APIV1Service) SetMemoAttachments(ctx context.Context, request *v1pb.SetMemoAttachmentsRequest) (*emptypb.Empty, error) { +func (s *APIService) SetMemoAttachments(ctx context.Context, request *apipb.SetMemoAttachmentsRequest) (*emptypb.Empty, error) { user, err := s.fetchCurrentUser(ctx) if err != nil { return nil, status.Errorf(codes.Internal, "failed to get current user: %v", err) @@ -67,11 +67,11 @@ type preparedMemoAttachments struct { removed []*store.Attachment } -func (s *APIV1Service) prepareMemoAttachments( +func (s *APIService) prepareMemoAttachments( ctx context.Context, user *store.User, memo *store.Memo, - requestAttachments []*v1pb.Attachment, + requestAttachments []*apipb.Attachment, ) (*preparedMemoAttachments, error) { currentAttachments := []*store.Attachment{} if memo.ID > 0 { @@ -153,7 +153,7 @@ func buildMemoAttachmentMutationBindings(prepared *preparedMemoAttachments) ([]* // createMemoWithMutation creates the memo row, binds attachments, and writes // reference relations in one database transaction. A failure in any dependent // write therefore cannot leave an orphan memo behind. -func (s *APIV1Service) createMemoWithMutation( +func (s *APIService) createMemoWithMutation( ctx context.Context, user *store.User, create *store.Memo, @@ -188,7 +188,7 @@ func (s *APIV1Service) createMemoWithMutation( }) } -func (s *APIV1Service) applyMemoMutation( +func (s *APIService) applyMemoMutation( ctx context.Context, memo *store.Memo, prepared *preparedMemoAttachments, @@ -255,12 +255,12 @@ func (s *APIV1Service) applyMemoMutation( return nil } -func (s *APIV1Service) normalizeMemoAttachmentRequest( +func (s *APIService) normalizeMemoAttachmentRequest( ctx context.Context, user *store.User, memo *store.Memo, currentAttachments []*store.Attachment, - requestAttachments []*v1pb.Attachment, + requestAttachments []*apipb.Attachment, ) ([]*store.Attachment, error) { currentByID := make(map[int32]struct{}, len(currentAttachments)) for _, attachment := range currentAttachments { @@ -357,7 +357,7 @@ func (s *APIV1Service) normalizeMemoAttachmentRequest( return normalized, nil } -func (s *APIV1Service) resolveMemoAttachmentReferences(content string, attachments []*store.Attachment) ([]int32, error) { +func (s *APIService) resolveMemoAttachmentReferences(content string, attachments []*store.Attachment) ([]int32, error) { references, err := s.extractManagedAttachmentReferences(content) if err != nil { return nil, err @@ -384,7 +384,7 @@ func (s *APIV1Service) resolveMemoAttachmentReferences(content string, attachmen return requiredAttachmentIDs, nil } -func (s *APIV1Service) extractManagedAttachmentReferences(content string) ([]markdown.ManagedAttachmentReference, error) { +func (s *APIService) extractManagedAttachmentReferences(content string) ([]markdown.ManagedAttachmentReference, error) { data, err := s.MarkdownService.ExtractAll([]byte(content)) if err != nil { return nil, status.Errorf(codes.InvalidArgument, "invalid markdown content: %v", err) @@ -486,8 +486,8 @@ func allGroupMembersRequested(group []*store.Attachment, requestedNames map[stri return true } -func (s *APIV1Service) ListMemoAttachments(ctx context.Context, request *v1pb.ListMemoAttachmentsRequest) (*v1pb.ListMemoAttachmentsResponse, error) { - memoUID, err := ExtractMemoUIDFromName(request.Name) +func (s *APIService) ListMemoAttachments(ctx context.Context, request *apipb.ListMemoAttachmentsRequest) (*apipb.ListMemoAttachmentsResponse, error) { + memoUID, err := ExtractMemoUIDFromName(request.Parent) if err != nil { return nil, status.Errorf(codes.InvalidArgument, "invalid memo name: %v", err) } @@ -510,8 +510,8 @@ func (s *APIV1Service) ListMemoAttachments(ctx context.Context, request *v1pb.Li return nil, status.Errorf(codes.Internal, "failed to list attachments: %v", err) } - response := &v1pb.ListMemoAttachmentsResponse{ - Attachments: []*v1pb.Attachment{}, + response := &apipb.ListMemoAttachmentsResponse{ + Attachments: []*apipb.Attachment{}, } for _, attachment := range attachments { response.Attachments = append(response.Attachments, convertAttachmentFromStore(attachment)) diff --git a/server/api/v1/memo_batch_helpers.go b/server/api/memo_batch_helpers.go similarity index 84% rename from server/api/v1/memo_batch_helpers.go rename to server/api/memo_batch_helpers.go index 899c95e49..9d5f7548e 100644 --- a/server/api/v1/memo_batch_helpers.go +++ b/server/api/memo_batch_helpers.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "context" @@ -6,7 +6,7 @@ import ( "github.com/usememos/memos/store" ) -func (s *APIV1Service) listMemosByID(ctx context.Context, memoIDs []int32) (map[int32]*store.Memo, error) { +func (s *APIService) listMemosByID(ctx context.Context, memoIDs []int32) (map[int32]*store.Memo, error) { if len(memoIDs) == 0 { return map[int32]*store.Memo{}, nil } diff --git a/server/api/v1/memo_comment_relations_test.go b/server/api/memo_comment_relations_test.go similarity index 72% rename from server/api/v1/memo_comment_relations_test.go rename to server/api/memo_comment_relations_test.go index c1571cad2..ac813aad7 100644 --- a/server/api/v1/memo_comment_relations_test.go +++ b/server/api/memo_comment_relations_test.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "context" @@ -7,7 +7,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - v1pb "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" "github.com/usememos/memos/store" ) @@ -26,20 +26,20 @@ func TestCreateMemoComment_ReturnsParentRelation(t *testing.T) { require.NoError(t, err) authorCtx := userCtx(ctx, author.ID) - parent, err := svc.CreateMemo(authorCtx, &v1pb.CreateMemoRequest{ - Memo: &v1pb.Memo{Content: "parent memo", Visibility: v1pb.Visibility_PUBLIC}, + parent, err := svc.CreateMemo(authorCtx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{Content: "parent memo", Visibility: apipb.Visibility_PUBLIC}, }) require.NoError(t, err) - comment, err := svc.CreateMemoComment(authorCtx, &v1pb.CreateMemoCommentRequest{ - Name: parent.Name, - Comment: &v1pb.Memo{Content: "a comment", Visibility: v1pb.Visibility_PUBLIC}, + comment, err := svc.CreateMemoComment(authorCtx, &apipb.CreateMemoCommentRequest{ + Parent: parent.Name, + Comment: &apipb.Memo{Content: "a comment", Visibility: apipb.Visibility_PUBLIC}, }) require.NoError(t, err) require.Len(t, comment.Relations, 1, "comment memo should carry its parent relation") rel := comment.Relations[0] - assert.Equal(t, v1pb.MemoRelation_COMMENT, rel.Type) + assert.Equal(t, apipb.MemoRelation_COMMENT, rel.Type) require.NotNil(t, rel.Memo) require.NotNil(t, rel.RelatedMemo) assert.Equal(t, comment.Name, rel.Memo.Name) diff --git a/server/api/v1/memo_create_helpers.go b/server/api/memo_create_helpers.go similarity index 93% rename from server/api/v1/memo_create_helpers.go rename to server/api/memo_create_helpers.go index aab1c69e3..a7109a2cc 100644 --- a/server/api/v1/memo_create_helpers.go +++ b/server/api/memo_create_helpers.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "context" @@ -8,7 +8,7 @@ import ( "google.golang.org/grpc/status" "github.com/usememos/memos/core/memopayload" - v1pb "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" "github.com/usememos/memos/store" ) @@ -31,7 +31,7 @@ type preparedMemoCreate struct { // prepareMemoCreate validates and prepares the fields shared by top-level // memo and comment creation. It does not write database or external state. -func (s *APIV1Service) prepareMemoCreate(ctx context.Context, user *store.User, input *v1pb.Memo, uid string) (*preparedMemoCreate, error) { +func (s *APIService) prepareMemoCreate(ctx context.Context, user *store.User, input *apipb.Memo, uid string) (*preparedMemoCreate, error) { if user == nil || input == nil { return nil, status.Error(codes.InvalidArgument, "memo is required") } diff --git a/server/api/v1/memo_create_helpers_test.go b/server/api/memo_create_helpers_test.go similarity index 62% rename from server/api/v1/memo_create_helpers_test.go rename to server/api/memo_create_helpers_test.go index 24ade512d..355d37ab0 100644 --- a/server/api/v1/memo_create_helpers_test.go +++ b/server/api/memo_create_helpers_test.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "context" @@ -12,7 +12,7 @@ import ( "google.golang.org/grpc/status" "google.golang.org/protobuf/types/known/timestamppb" - v1pb "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" "github.com/usememos/memos/store" ) @@ -22,17 +22,17 @@ func TestMemoCreateSharedPreparationPreservesFields(t *testing.T) { user := createSpaceTestUser(ctx, t, service, "memo-create-fields", store.RoleUser) userCtx := userCtx(ctx, user.ID) - referenceTarget, err := service.CreateMemo(userCtx, &v1pb.CreateMemoRequest{ + referenceTarget, err := service.CreateMemo(userCtx, &apipb.CreateMemoRequest{ MemoId: "create-fields-reference", - Memo: &v1pb.Memo{Content: "reference target", Visibility: v1pb.Visibility_PRIVATE}, + Memo: &apipb.Memo{Content: "reference target", Visibility: apipb.Visibility_PRIVATE}, }) require.NoError(t, err) - createAttachment := func(id string) *v1pb.Attachment { + createAttachment := func(id string) *apipb.Attachment { t.Helper() - attachment, err := service.CreateAttachment(userCtx, &v1pb.CreateAttachmentRequest{ + attachment, err := service.CreateAttachment(userCtx, &apipb.CreateAttachmentRequest{ AttachmentId: id, - Attachment: &v1pb.Attachment{ + Attachment: &apipb.Attachment{ Filename: id + ".png", Type: "image/png", Content: []byte("test image"), @@ -41,10 +41,10 @@ func TestMemoCreateSharedPreparationPreservesFields(t *testing.T) { require.NoError(t, err) return attachment } - createReference := func() *v1pb.MemoRelation { - return &v1pb.MemoRelation{ - RelatedMemo: &v1pb.MemoRelation_Memo{Name: referenceTarget.Name}, - Type: v1pb.MemoRelation_REFERENCE, + createReference := func() *apipb.MemoRelation { + return &apipb.MemoRelation{ + RelatedMemo: &apipb.MemoRelation_MemoRef{Name: referenceTarget.Name}, + Type: apipb.MemoRelation_REFERENCE, } } @@ -52,16 +52,16 @@ func TestMemoCreateSharedPreparationPreservesFields(t *testing.T) { topAttachmentUID := strings.TrimPrefix(topAttachment.Name, "attachments/") topCreateTime := time.Date(2022, time.March, 4, 5, 6, 7, 0, time.UTC) topUpdateTime := topCreateTime.Add(2 * time.Hour) - topLocation := &v1pb.Location{Placeholder: "top location", Latitude: 1.25, Longitude: 2.5} - topMemo, err := service.CreateMemo(userCtx, &v1pb.CreateMemoRequest{ + topLocation := &apipb.Location{Placeholder: "top location", Latitude: 1.25, Longitude: 2.5} + topMemo, err := service.CreateMemo(userCtx, &apipb.CreateMemoRequest{ MemoId: "create-fields-top", - Memo: &v1pb.Memo{ + Memo: &apipb.Memo{ Content: fmt.Sprintf("![top](/file/attachments/%s)", topAttachmentUID), - Visibility: v1pb.Visibility_PRIVATE, + Visibility: apipb.Visibility_PRIVATE, CreateTime: timestamppb.New(topCreateTime), UpdateTime: timestamppb.New(topUpdateTime), - Attachments: []*v1pb.Attachment{{Name: topAttachment.Name}}, - Relations: []*v1pb.MemoRelation{createReference()}, + Attachments: []*apipb.Attachment{{Name: topAttachment.Name}}, + Relations: []*apipb.MemoRelation{createReference()}, Location: topLocation, }, }) @@ -73,23 +73,23 @@ func TestMemoCreateSharedPreparationPreservesFields(t *testing.T) { require.Equal(t, topLocation.Longitude, topMemo.Location.Longitude) require.Len(t, topMemo.Attachments, 1) require.Equal(t, topAttachment.Name, topMemo.Attachments[0].Name) - requireMemoCreateRelation(t, topMemo, v1pb.MemoRelation_REFERENCE, referenceTarget.Name) + requireMemoCreateRelation(t, topMemo, apipb.MemoRelation_REFERENCE, referenceTarget.Name) commentAttachment := createAttachment("create-fields-comment-image") commentAttachmentUID := strings.TrimPrefix(commentAttachment.Name, "attachments/") commentCreateTime := time.Date(2023, time.April, 5, 6, 7, 8, 0, time.UTC) commentUpdateTime := commentCreateTime.Add(3 * time.Hour) - commentLocation := &v1pb.Location{Placeholder: "comment location", Latitude: 3.75, Longitude: 4.5} - comment, err := service.CreateMemoComment(userCtx, &v1pb.CreateMemoCommentRequest{ - Name: topMemo.Name, + commentLocation := &apipb.Location{Placeholder: "comment location", Latitude: 3.75, Longitude: 4.5} + comment, err := service.CreateMemoComment(userCtx, &apipb.CreateMemoCommentRequest{ + Parent: topMemo.Name, CommentId: "create-fields-comment", - Comment: &v1pb.Memo{ + Comment: &apipb.Memo{ Content: fmt.Sprintf("![comment](/file/attachments/%s)", commentAttachmentUID), - Visibility: v1pb.Visibility_PROTECTED, + Visibility: apipb.Visibility_PROTECTED, CreateTime: timestamppb.New(commentCreateTime), UpdateTime: timestamppb.New(commentUpdateTime), - Attachments: []*v1pb.Attachment{{Name: commentAttachment.Name}}, - Relations: []*v1pb.MemoRelation{createReference()}, + Attachments: []*apipb.Attachment{{Name: commentAttachment.Name}}, + Relations: []*apipb.MemoRelation{createReference()}, Location: commentLocation, }, }) @@ -99,11 +99,11 @@ func TestMemoCreateSharedPreparationPreservesFields(t *testing.T) { require.Equal(t, commentLocation.Placeholder, comment.Location.Placeholder) require.Equal(t, commentLocation.Latitude, comment.Location.Latitude) require.Equal(t, commentLocation.Longitude, comment.Location.Longitude) - require.Equal(t, v1pb.Visibility_PROTECTED, comment.Visibility) + require.Equal(t, apipb.Visibility_PROTECTED, comment.Visibility) require.Len(t, comment.Attachments, 1) require.Equal(t, commentAttachment.Name, comment.Attachments[0].Name) - requireMemoCreateRelation(t, comment, v1pb.MemoRelation_COMMENT, topMemo.Name) - requireMemoCreateRelation(t, comment, v1pb.MemoRelation_REFERENCE, referenceTarget.Name) + requireMemoCreateRelation(t, comment, apipb.MemoRelation_COMMENT, topMemo.Name) + requireMemoCreateRelation(t, comment, apipb.MemoRelation_REFERENCE, referenceTarget.Name) } func TestMemoCreateDuplicateIDsUseAlreadyExists(t *testing.T) { @@ -112,22 +112,22 @@ func TestMemoCreateDuplicateIDsUseAlreadyExists(t *testing.T) { user := createSpaceTestUser(ctx, t, service, "memo-create-duplicates", store.RoleUser) userCtx := userCtx(ctx, user.ID) - parent, err := service.CreateMemo(userCtx, &v1pb.CreateMemoRequest{ + parent, err := service.CreateMemo(userCtx, &apipb.CreateMemoRequest{ MemoId: "duplicate-parent", - Memo: &v1pb.Memo{Content: "parent", Visibility: v1pb.Visibility_PRIVATE}, + Memo: &apipb.Memo{Content: "parent", Visibility: apipb.Visibility_PRIVATE}, }) require.NoError(t, err) - _, err = service.CreateMemo(userCtx, &v1pb.CreateMemoRequest{ + _, err = service.CreateMemo(userCtx, &apipb.CreateMemoRequest{ MemoId: "duplicate-parent", - Memo: &v1pb.Memo{Content: "duplicate", Visibility: v1pb.Visibility_PRIVATE}, + Memo: &apipb.Memo{Content: "duplicate", Visibility: apipb.Visibility_PRIVATE}, }) require.Equal(t, codes.AlreadyExists, status.Code(err)) createComment := func() error { - _, err := service.CreateMemoComment(userCtx, &v1pb.CreateMemoCommentRequest{ - Name: parent.Name, + _, err := service.CreateMemoComment(userCtx, &apipb.CreateMemoCommentRequest{ + Parent: parent.Name, CommentId: "duplicate-comment", - Comment: &v1pb.Memo{Content: "comment", Visibility: v1pb.Visibility_PRIVATE}, + Comment: &apipb.Memo{Content: "comment", Visibility: apipb.Visibility_PRIVATE}, }) return err } @@ -135,7 +135,7 @@ func TestMemoCreateDuplicateIDsUseAlreadyExists(t *testing.T) { require.Equal(t, codes.AlreadyExists, status.Code(createComment())) } -func requireMemoCreateRelation(t *testing.T, memo *v1pb.Memo, relationType v1pb.MemoRelation_Type, relatedMemoName string) { +func requireMemoCreateRelation(t *testing.T, memo *apipb.Memo, relationType apipb.MemoRelation_Type, relatedMemoName string) { t.Helper() for _, relation := range memo.Relations { if relation.Type == relationType && relation.GetRelatedMemo().GetName() == relatedMemoName { diff --git a/server/api/v1/memo_delete_webhook_test.go b/server/api/memo_delete_webhook_test.go similarity index 76% rename from server/api/v1/memo_delete_webhook_test.go rename to server/api/memo_delete_webhook_test.go index b1d1f3174..057673f58 100644 --- a/server/api/v1/memo_delete_webhook_test.go +++ b/server/api/memo_delete_webhook_test.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "context" @@ -15,7 +15,7 @@ import ( "google.golang.org/grpc/status" "github.com/usememos/memos/internal/webhook" - v1pb "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" "github.com/usememos/memos/store" ) @@ -27,35 +27,35 @@ func TestDeleteMemoWebhooksRespectCurrentReadAccess(t *testing.T) { ownerCtx := userCtx(ctx, owner.ID) successorCtx := userCtx(ctx, successor.ID) - space, err := service.CreateSpace(ownerCtx, &v1pb.CreateSpaceRequest{ + space, err := service.CreateSpace(ownerCtx, &apipb.CreateSpaceRequest{ SpaceId: "delete-webhook-space", - Space: &v1pb.Space{Title: "Delete webhook space"}, + Space: &apipb.Space{Title: "Delete webhook space"}, }) require.NoError(t, err) - inviteAndAcceptSpaceTestUser(ctx, t, service, owner, successor, space, v1pb.SpaceMember_ADMIN) + inviteAndAcceptSpaceTestUser(ctx, t, service, owner, successor, space, apipb.SpaceMember_ADMIN) assignedSpace := space.Name - hiddenMemo, err := service.CreateMemo(ownerCtx, &v1pb.CreateMemoRequest{ - Memo: &v1pb.Memo{ + hiddenMemo, err := service.CreateMemo(ownerCtx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{ Content: "must not leave through a webhook", - Visibility: v1pb.Visibility_SPACE, + Visibility: apipb.Visibility_SPACE, Space: &assignedSpace, }, }) require.NoError(t, err) - readableMemo, err := service.CreateMemo(ownerCtx, &v1pb.CreateMemoRequest{ - Memo: &v1pb.Memo{ + readableMemo, err := service.CreateMemo(ownerCtx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{ Content: "readable deletion payload", - Visibility: v1pb.Visibility_PRIVATE, + Visibility: apipb.Visibility_PRIVATE, }, }) require.NoError(t, err) - _, err = service.DeleteSpaceMember(successorCtx, &v1pb.DeleteSpaceMemberRequest{ + _, err = service.DeleteSpaceMember(successorCtx, &apipb.DeleteSpaceMemberRequest{ Name: buildSpaceMemberName("delete-webhook-space", owner.Username), }) require.NoError(t, err) - _, err = service.GetMemo(ownerCtx, &v1pb.GetMemoRequest{Name: hiddenMemo.Name}) + _, err = service.GetMemo(ownerCtx, &apipb.GetMemoRequest{Name: hiddenMemo.Name}) require.Equal(t, codes.PermissionDenied, status.Code(err)) received := make(chan []byte, 4) @@ -77,16 +77,16 @@ func TestDeleteMemoWebhooksRespectCurrentReadAccess(t *testing.T) { defer func() { require.NoError(t, webhook.ConfigurePrivateDestinationAllowlist(nil)) }() - _, err = service.CreateUserWebhook(ownerCtx, &v1pb.CreateUserWebhookRequest{ + _, err = service.CreateUserWebhook(ownerCtx, &apipb.CreateUserWebhookRequest{ Parent: BuildUserName(owner.Username), - Webhook: &v1pb.UserWebhook{ + Webhook: &apipb.UserWebhook{ DisplayName: "delete-capture", Url: receiver.URL, }, }) require.NoError(t, err) - _, err = service.DeleteMemo(ownerCtx, &v1pb.DeleteMemoRequest{Name: hiddenMemo.Name}) + _, err = service.DeleteMemo(ownerCtx, &apipb.DeleteMemoRequest{Name: hiddenMemo.Name}) require.NoError(t, err, "the author retains narrow lifecycle authority after losing membership") select { case body := <-received: @@ -94,7 +94,7 @@ func TestDeleteMemoWebhooksRespectCurrentReadAccess(t *testing.T) { case <-time.After(500 * time.Millisecond): } - _, err = service.DeleteMemo(ownerCtx, &v1pb.DeleteMemoRequest{Name: readableMemo.Name}) + _, err = service.DeleteMemo(ownerCtx, &apipb.DeleteMemoRequest{Name: readableMemo.Name}) require.NoError(t, err) var body []byte select { diff --git a/server/api/v1/memo_mention_helpers.go b/server/api/memo_mention_helpers.go similarity index 79% rename from server/api/v1/memo_mention_helpers.go rename to server/api/memo_mention_helpers.go index d3ee3ea88..57329298d 100644 --- a/server/api/v1/memo_mention_helpers.go +++ b/server/api/memo_mention_helpers.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "context" @@ -11,7 +11,7 @@ import ( "github.com/usememos/memos/store" ) -func (s *APIV1Service) resolveMentionTargets(ctx context.Context, content string) (map[int32]*store.User, error) { +func (s *APIService) resolveMentionTargets(ctx context.Context, content string) (map[int32]*store.User, error) { targets := make(map[int32]*store.User) if content == "" { return targets, nil @@ -49,7 +49,7 @@ type mentionContextFacts struct { related *access.MemoReadFacts } -func (s *APIV1Service) resolveMentionContextFacts(ctx context.Context, memo *store.Memo, relatedMemo *store.Memo) (*mentionContextFacts, error) { +func (s *APIService) resolveMentionContextFacts(ctx context.Context, memo *store.Memo, relatedMemo *store.Memo) (*mentionContextFacts, error) { memoFacts, err := access.ResolveMemoReadFacts(ctx, s.Store, memo) if err != nil { return nil, err @@ -65,7 +65,7 @@ func (s *APIV1Service) resolveMentionContextFacts(ctx context.Context, memo *sto return facts, nil } -func (s *APIV1Service) canUserAccessMentionContext(ctx context.Context, facts *mentionContextFacts, target *store.User) bool { +func (s *APIService) canUserAccessMentionContext(ctx context.Context, facts *mentionContextFacts, target *store.User) bool { if target == nil || facts == nil || facts.memo.Memo == nil { return false } @@ -85,7 +85,7 @@ func (s *APIV1Service) canUserAccessMentionContext(ctx context.Context, facts *m // canUserAccessMentionMemos is the one-shot form for a single target, where // there is no fan-out to amortize the fact resolution over. -func (s *APIV1Service) canUserAccessMentionMemos(ctx context.Context, target *store.User, memo *store.Memo, relatedMemo *store.Memo) bool { +func (s *APIService) canUserAccessMentionMemos(ctx context.Context, target *store.User, memo *store.Memo, relatedMemo *store.Memo) bool { facts, err := s.resolveMentionContextFacts(ctx, memo, relatedMemo) if err != nil { return false @@ -93,7 +93,7 @@ func (s *APIV1Service) canUserAccessMentionMemos(ctx context.Context, target *st return s.canUserAccessMentionContext(ctx, facts, target) } -func (s *APIV1Service) shouldSkipMentionInbox(ctx context.Context, facts *mentionContextFacts, target *store.User, memo *store.Memo, relatedMemo *store.Memo) bool { +func (s *APIService) shouldSkipMentionInbox(ctx context.Context, facts *mentionContextFacts, target *store.User, memo *store.Memo, relatedMemo *store.Memo) bool { if target == nil || memo == nil { return true } @@ -110,7 +110,7 @@ func (s *APIV1Service) shouldSkipMentionInbox(ctx context.Context, facts *mentio return !s.canUserAccessMentionContext(ctx, facts, target) } -func (s *APIV1Service) dispatchMemoMentionNotifications(ctx context.Context, memo *store.Memo, relatedMemo *store.Memo, previousContent string) error { +func (s *APIService) dispatchMemoMentionNotifications(ctx context.Context, memo *store.Memo, relatedMemo *store.Memo, previousContent string) error { if memo == nil { return nil } @@ -166,7 +166,7 @@ func (s *APIV1Service) dispatchMemoMentionNotifications(ctx context.Context, mem return nil } -func (s *APIV1Service) dispatchMemoMentionNotificationsBestEffort(ctx context.Context, memo *store.Memo, relatedMemo *store.Memo, previousContent string) { +func (s *APIService) dispatchMemoMentionNotificationsBestEffort(ctx context.Context, memo *store.Memo, relatedMemo *store.Memo, previousContent string) { if err := s.dispatchMemoMentionNotifications(ctx, memo, relatedMemo, previousContent); err != nil { slog.Warn("Failed to dispatch memo mention notifications", slog.Any("err", err), slog.Int64("memo_id", int64(memo.ID))) } diff --git a/server/api/v1/memo_relation_service.go b/server/api/memo_relation_service.go similarity index 83% rename from server/api/v1/memo_relation_service.go rename to server/api/memo_relation_service.go index 5509b7b08..735bd2e65 100644 --- a/server/api/v1/memo_relation_service.go +++ b/server/api/memo_relation_service.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "context" @@ -9,11 +9,11 @@ import ( "google.golang.org/protobuf/types/known/emptypb" "github.com/usememos/memos/core/access" - v1pb "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" "github.com/usememos/memos/store" ) -func (s *APIV1Service) SetMemoRelations(ctx context.Context, request *v1pb.SetMemoRelationsRequest) (*emptypb.Empty, error) { +func (s *APIService) SetMemoRelations(ctx context.Context, request *apipb.SetMemoRelationsRequest) (*emptypb.Empty, error) { user, err := s.fetchCurrentUser(ctx) if err != nil { return nil, status.Errorf(codes.Internal, "failed to get current user: %v", err) @@ -52,7 +52,7 @@ func (s *APIV1Service) SetMemoRelations(ctx context.Context, request *v1pb.SetMe return &emptypb.Empty{}, nil } -func (s *APIV1Service) prepareMemoRelations(ctx context.Context, memo *store.Memo, relations []*v1pb.MemoRelation) ([]*store.MemoRelation, error) { +func (s *APIService) prepareMemoRelations(ctx context.Context, memo *store.Memo, relations []*apipb.MemoRelation) ([]*store.MemoRelation, error) { prepared := make([]*store.MemoRelation, 0, len(relations)) seenRelatedMemoIDs := make(map[int32]struct{}, len(relations)) for _, relation := range relations { @@ -60,9 +60,9 @@ func (s *APIV1Service) prepareMemoRelations(ctx context.Context, memo *store.Mem return nil, status.Errorf(codes.InvalidArgument, "related memo is required") } switch relation.Type { - case v1pb.MemoRelation_REFERENCE: + case apipb.MemoRelation_REFERENCE: // REFERENCE is the only client-mutable relation type. - case v1pb.MemoRelation_COMMENT: + case apipb.MemoRelation_COMMENT: // COMMENT context is immutable and may only be created atomically with a // new memo through CreateMemoComment. return nil, status.Errorf(codes.InvalidArgument, "COMMENT relations are output only") @@ -100,8 +100,8 @@ func (s *APIV1Service) prepareMemoRelations(ctx context.Context, memo *store.Mem return prepared, nil } -func (s *APIV1Service) ListMemoRelations(ctx context.Context, request *v1pb.ListMemoRelationsRequest) (*v1pb.ListMemoRelationsResponse, error) { - memoUID, err := ExtractMemoUIDFromName(request.Name) +func (s *APIService) ListMemoRelations(ctx context.Context, request *apipb.ListMemoRelationsRequest) (*apipb.ListMemoRelationsResponse, error) { + memoUID, err := ExtractMemoUIDFromName(request.Parent) if err != nil { return nil, status.Errorf(codes.InvalidArgument, "invalid memo name: %v", err) } @@ -121,12 +121,12 @@ func (s *APIV1Service) ListMemoRelations(ctx context.Context, request *v1pb.List } relationList := relationMap[memo.ID] if relationList == nil { - relationList = []*v1pb.MemoRelation{} + relationList = []*apipb.MemoRelation{} } limit := normalizePageSize(request.PageSize) offset := 0 if request.PageToken != "" { - var token v1pb.PageToken + var token apipb.PageToken if err := unmarshalPageToken(request.PageToken, &token); err != nil { return nil, status.Errorf(codes.InvalidArgument, "invalid page token: %v", err) } @@ -145,27 +145,27 @@ func (s *APIV1Service) ListMemoRelations(ctx context.Context, request *v1pb.List } } - response := &v1pb.ListMemoRelationsResponse{ + response := &apipb.ListMemoRelationsResponse{ Relations: relationList[offset:end], NextPageToken: nextPageToken, } return response, nil } -func convertMemoRelationTypeFromStore(relationType store.MemoRelationType) v1pb.MemoRelation_Type { +func convertMemoRelationTypeFromStore(relationType store.MemoRelationType) apipb.MemoRelation_Type { switch relationType { case store.MemoRelationReference: - return v1pb.MemoRelation_REFERENCE + return apipb.MemoRelation_REFERENCE case store.MemoRelationComment: - return v1pb.MemoRelation_COMMENT + return apipb.MemoRelation_COMMENT default: - return v1pb.MemoRelation_TYPE_UNSPECIFIED + return apipb.MemoRelation_TYPE_UNSPECIFIED } } -func convertMemoRelationTypeToStore(relationType v1pb.MemoRelation_Type) store.MemoRelationType { +func convertMemoRelationTypeToStore(relationType apipb.MemoRelation_Type) store.MemoRelationType { switch relationType { - case v1pb.MemoRelation_COMMENT: + case apipb.MemoRelation_COMMENT: return store.MemoRelationComment default: return store.MemoRelationReference diff --git a/server/api/v1/memo_service.go b/server/api/memo_service.go similarity index 95% rename from server/api/v1/memo_service.go rename to server/api/memo_service.go index 2334ac736..80a7a8f9b 100644 --- a/server/api/v1/memo_service.go +++ b/server/api/memo_service.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "context" @@ -15,14 +15,14 @@ import ( "github.com/usememos/memos/core/access" "github.com/usememos/memos/core/memopayload" "github.com/usememos/memos/internal/ratelimit" - v1pb "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" storepb "github.com/usememos/memos/proto/gen/store" "github.com/usememos/memos/store" ) const maxBatchGetLinkMetadata = 10 -func (s *APIV1Service) CreateMemo(ctx context.Context, request *v1pb.CreateMemoRequest) (*v1pb.Memo, error) { +func (s *APIService) CreateMemo(ctx context.Context, request *apipb.CreateMemoRequest) (*apipb.Memo, error) { user, err := s.fetchCurrentUser(ctx) if err != nil { return nil, status.Errorf(codes.Internal, "failed to get user") @@ -79,7 +79,7 @@ func (s *APIV1Service) CreateMemo(ctx context.Context, request *v1pb.CreateMemoR return memoMessage, nil } -func (s *APIV1Service) ListMemos(ctx context.Context, request *v1pb.ListMemosRequest) (*v1pb.ListMemosResponse, error) { +func (s *APIService) ListMemos(ctx context.Context, request *apipb.ListMemosRequest) (*apipb.ListMemosResponse, error) { memoFind := &store.FindMemo{ // Exclude comments by default. ExcludeComments: true, @@ -94,12 +94,12 @@ func (s *APIV1Service) ListMemos(ctx context.Context, request *v1pb.ListMemosReq } memoFind.Access = accessScope - if request.State == v1pb.State_ARCHIVED { + if request.State == apipb.State_ARCHIVED { state := store.Archived memoFind.RowStatus = &state // Archived memos are only visible to their creator. if currentUser == nil { - return &v1pb.ListMemosResponse{}, nil + return &apipb.ListMemosResponse{}, nil } memoFind.CreatorID = ¤tUser.ID } else { @@ -126,7 +126,7 @@ func (s *APIV1Service) ListMemos(ctx context.Context, request *v1pb.ListMemosReq var limit, offset int if request.PageToken != "" { - var pageToken v1pb.PageToken + var pageToken apipb.PageToken if err := unmarshalPageToken(request.PageToken, &pageToken); err != nil { return nil, status.Errorf(codes.InvalidArgument, "invalid page token: %v", err) } @@ -144,7 +144,7 @@ func (s *APIV1Service) ListMemos(ctx context.Context, request *v1pb.ListMemosReq return nil, status.Errorf(codes.Internal, "failed to list memos: %v", err) } - memoMessages := []*v1pb.Memo{} + memoMessages := []*apipb.Memo{} nextPageToken := "" if len(memos) == limitPlusOne { memos = memos[:limit] @@ -155,7 +155,7 @@ func (s *APIV1Service) ListMemos(ctx context.Context, request *v1pb.ListMemosReq } if len(memos) == 0 { - response := &v1pb.ListMemosResponse{ + response := &apipb.ListMemosResponse{ Memos: memoMessages, NextPageToken: nextPageToken, } @@ -226,14 +226,14 @@ func (s *APIV1Service) ListMemos(ctx context.Context, request *v1pb.ListMemosReq memoMessages = append(memoMessages, memoMessage) } - response := &v1pb.ListMemosResponse{ + response := &apipb.ListMemosResponse{ Memos: memoMessages, NextPageToken: nextPageToken, } return response, nil } -func (s *APIV1Service) GetMemo(ctx context.Context, request *v1pb.GetMemoRequest) (*v1pb.Memo, error) { +func (s *APIService) GetMemo(ctx context.Context, request *apipb.GetMemoRequest) (*apipb.Memo, error) { memoUID, err := ExtractMemoUIDFromName(request.Name) if err != nil { return nil, status.Errorf(codes.InvalidArgument, "invalid memo name: %v", err) @@ -281,7 +281,7 @@ func (s *APIV1Service) GetMemo(ctx context.Context, request *v1pb.GetMemoRequest } // UpdateMemo updates an existing memo. -func (s *APIV1Service) UpdateMemo(ctx context.Context, request *v1pb.UpdateMemoRequest) (*v1pb.Memo, error) { +func (s *APIService) UpdateMemo(ctx context.Context, request *apipb.UpdateMemoRequest) (*apipb.Memo, error) { if request.Memo == nil { return nil, status.Errorf(codes.InvalidArgument, "memo is required") } @@ -487,7 +487,7 @@ func (s *APIV1Service) UpdateMemo(ctx context.Context, request *v1pb.UpdateMemoR return memoMessage, nil } -func (s *APIV1Service) DeleteMemo(ctx context.Context, request *v1pb.DeleteMemoRequest) (*emptypb.Empty, error) { +func (s *APIService) DeleteMemo(ctx context.Context, request *apipb.DeleteMemoRequest) (*emptypb.Empty, error) { memoUID, err := ExtractMemoUIDFromName(request.Name) if err != nil { return nil, status.Errorf(codes.InvalidArgument, "invalid memo name: %v", err) @@ -512,7 +512,7 @@ func (s *APIV1Service) DeleteMemo(ctx context.Context, request *v1pb.DeleteMemoR if !access.CanManageMemo(user, memo) { return nil, status.Errorf(codes.PermissionDenied, "permission denied") } - var deletedMemoMessage *v1pb.Memo + var deletedMemoMessage *apipb.Memo // Deletion is a narrow lifecycle capability and may remain available after // the author loses read access to a memo with the SPACE audience. Only // build a content-bearing webhook payload when the actor can still read the @@ -560,7 +560,7 @@ func (s *APIV1Service) DeleteMemo(ctx context.Context, request *v1pb.DeleteMemoR return &emptypb.Empty{}, nil } -func (s *APIV1Service) getContentLengthLimit(ctx context.Context) (int, error) { +func (s *APIService) getContentLengthLimit(ctx context.Context) (int, error) { instanceMemoRelatedSetting, err := s.Store.GetInstanceMemoRelatedSetting(ctx) if err != nil { return 0, status.Errorf(codes.Internal, "failed to get instance memo related setting") diff --git a/server/api/v1/memo_service_comments.go b/server/api/memo_service_comments.go similarity index 91% rename from server/api/v1/memo_service_comments.go rename to server/api/memo_service_comments.go index 05b7223c1..ba1381c95 100644 --- a/server/api/v1/memo_service_comments.go +++ b/server/api/memo_service_comments.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "context" @@ -10,14 +10,14 @@ import ( "google.golang.org/grpc/status" "github.com/usememos/memos/internal/ratelimit" - v1pb "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" storepb "github.com/usememos/memos/proto/gen/store" "github.com/usememos/memos/store" ) // CreateMemoComment creates a comment on an existing memo. -func (s *APIV1Service) CreateMemoComment(ctx context.Context, request *v1pb.CreateMemoCommentRequest) (*v1pb.Memo, error) { - memoUID, err := ExtractMemoUIDFromName(request.Name) +func (s *APIService) CreateMemoComment(ctx context.Context, request *apipb.CreateMemoCommentRequest) (*apipb.Memo, error) { + memoUID, err := ExtractMemoUIDFromName(request.Parent) if err != nil { return nil, status.Errorf(codes.InvalidArgument, "invalid memo name: %v", err) } @@ -114,8 +114,8 @@ func (s *APIV1Service) CreateMemoComment(ctx context.Context, request *v1pb.Crea return memoComment, nil } -func (s *APIV1Service) ListMemoComments(ctx context.Context, request *v1pb.ListMemoCommentsRequest) (*v1pb.ListMemoCommentsResponse, error) { - memoUID, err := ExtractMemoUIDFromName(request.Name) +func (s *APIService) ListMemoComments(ctx context.Context, request *apipb.ListMemoCommentsRequest) (*apipb.ListMemoCommentsResponse, error) { + memoUID, err := ExtractMemoUIDFromName(request.Parent) if err != nil { return nil, status.Errorf(codes.InvalidArgument, "invalid memo name: %v", err) } @@ -136,7 +136,7 @@ func (s *APIV1Service) ListMemoComments(ctx context.Context, request *v1pb.ListM var limit, offset int if request.PageToken != "" { - var pageToken v1pb.PageToken + var pageToken apipb.PageToken if err := unmarshalPageToken(request.PageToken, &pageToken); err != nil { return nil, status.Errorf(codes.InvalidArgument, "invalid page token: %v", err) } @@ -168,8 +168,8 @@ func (s *APIV1Service) ListMemoComments(ctx context.Context, request *v1pb.ListM } if len(memos) == 0 { - response := &v1pb.ListMemoCommentsResponse{ - Memos: []*v1pb.Memo{}, + response := &apipb.ListMemoCommentsResponse{ + Comments: []*apipb.Memo{}, NextPageToken: nextPageToken, } return response, nil @@ -215,7 +215,7 @@ func (s *APIV1Service) ListMemoComments(ctx context.Context, request *v1pb.ListM if err != nil { return nil, status.Errorf(codes.Internal, "failed to list memo creators: %v", err) } - var memosResponse []*v1pb.Memo + var memosResponse []*apipb.Memo for _, m := range memos { reactions := memoReactionsMap[m.ID] attachments := attachmentMap[m.ID] @@ -228,7 +228,7 @@ func (s *APIV1Service) ListMemoComments(ctx context.Context, request *v1pb.ListM slog.Int64("memo_id", int64(m.ID)), slog.String("memo_uid", m.UID), slog.Int64("creator_id", int64(m.CreatorID)), - slog.String("parent_name", request.Name), + slog.String("parent", request.Parent), ) continue } @@ -237,8 +237,8 @@ func (s *APIV1Service) ListMemoComments(ctx context.Context, request *v1pb.ListM memosResponse = append(memosResponse, memoMessage) } - response := &v1pb.ListMemoCommentsResponse{ - Memos: memosResponse, + response := &apipb.ListMemoCommentsResponse{ + Comments: memosResponse, NextPageToken: nextPageToken, } return response, nil diff --git a/server/api/v1/memo_service_converter.go b/server/api/memo_service_converter.go similarity index 80% rename from server/api/v1/memo_service_converter.go rename to server/api/memo_service_converter.go index 0a4da4606..591b6a116 100644 --- a/server/api/v1/memo_service_converter.go +++ b/server/api/memo_service_converter.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "context" @@ -13,7 +13,7 @@ import ( "google.golang.org/protobuf/types/known/timestamppb" "github.com/usememos/memos/core/access" - v1pb "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" storepb "github.com/usememos/memos/proto/gen/store" "github.com/usememos/memos/store" ) @@ -23,7 +23,7 @@ var ( errReactionCreatorNotFound = stderrors.New("reaction creator not found") ) -func (s *APIV1Service) convertMemoFromStore(ctx context.Context, memo *store.Memo, reactions []*store.Reaction, attachments []*store.Attachment, relations []*v1pb.MemoRelation) (*v1pb.Memo, error) { +func (s *APIService) convertMemoFromStore(ctx context.Context, memo *store.Memo, reactions []*store.Reaction, attachments []*store.Attachment, relations []*apipb.MemoRelation) (*apipb.Memo, error) { creatorMap, err := s.listUsersByID(ctx, []int32{memo.CreatorID}) if err != nil { return nil, errors.Wrap(err, "failed to list memo creators") @@ -31,13 +31,13 @@ func (s *APIV1Service) convertMemoFromStore(ctx context.Context, memo *store.Mem return s.convertMemoFromStoreWithCreators(ctx, memo, reactions, attachments, relations, creatorMap) } -func (s *APIV1Service) convertMemoFromStoreWithCreators(ctx context.Context, memo *store.Memo, reactions []*store.Reaction, attachments []*store.Attachment, relations []*v1pb.MemoRelation, creatorMap map[int32]*store.User) (*v1pb.Memo, error) { +func (s *APIService) convertMemoFromStoreWithCreators(ctx context.Context, memo *store.Memo, reactions []*store.Reaction, attachments []*store.Attachment, relations []*apipb.MemoRelation, creatorMap map[int32]*store.User) (*apipb.Memo, error) { name := buildMemoName(memo.UID) creator := creatorMap[memo.CreatorID] if creator == nil { return nil, errMemoCreatorNotFound } - memoMessage := &v1pb.Memo{ + memoMessage := &apipb.Memo{ Name: name, State: convertStateFromStore(memo.RowStatus), Creator: BuildUserName(creator.Username), @@ -84,10 +84,10 @@ func (s *APIV1Service) convertMemoFromStoreWithCreators(ctx context.Context, mem if relations != nil { memoMessage.Relations = relations } else { - memoMessage.Relations = []*v1pb.MemoRelation{} + memoMessage.Relations = []*apipb.MemoRelation{} } - memoMessage.Attachments = []*v1pb.Attachment{} + memoMessage.Attachments = []*apipb.Attachment{} for _, attachment := range attachments { attachmentResponse := convertAttachmentFromStore(attachment) memoMessage.Attachments = append(memoMessage.Attachments, attachmentResponse) @@ -102,7 +102,7 @@ func (s *APIV1Service) convertMemoFromStoreWithCreators(ctx context.Context, mem return memoMessage, nil } -func (s *APIV1Service) projectMemoCollaborationContext(ctx context.Context, memo *store.Memo, message *v1pb.Memo, readContext access.MemoReadContext) error { +func (s *APIService) projectMemoCollaborationContext(ctx context.Context, memo *store.Memo, message *apipb.Memo, readContext access.MemoReadContext) error { if memo.SpaceID == nil { return nil } @@ -137,7 +137,7 @@ func (s *APIV1Service) projectMemoCollaborationContext(ctx context.Context, memo return nil } -func (s *APIV1Service) listUsersByIDWithExisting(ctx context.Context, userIDs []int32, existing map[int32]*store.User) (map[int32]*store.User, error) { +func (s *APIService) listUsersByIDWithExisting(ctx context.Context, userIDs []int32, existing map[int32]*store.User) (map[int32]*store.User, error) { usersByID := make(map[int32]*store.User, len(existing)+len(userIDs)) for userID, user := range existing { if user != nil { @@ -174,9 +174,9 @@ func (s *APIV1Service) listUsersByIDWithExisting(ctx context.Context, userIDs [] return usersByID, nil } -func (s *APIV1Service) convertReactionsFromStoreWithCreators(ctx context.Context, reactions []*store.Reaction, creatorMap map[int32]*store.User, memoName string) ([]*v1pb.Reaction, error) { +func (s *APIService) convertReactionsFromStoreWithCreators(ctx context.Context, reactions []*store.Reaction, creatorMap map[int32]*store.User, memoName string) ([]*apipb.Reaction, error) { if len(reactions) == 0 { - return []*v1pb.Reaction{}, nil + return []*apipb.Reaction{}, nil } creatorIDs := make([]int32, 0, len(reactions)) @@ -188,7 +188,7 @@ func (s *APIV1Service) convertReactionsFromStoreWithCreators(ctx context.Context return nil, err } - reactionMessages := make([]*v1pb.Reaction, 0, len(reactions)) + reactionMessages := make([]*apipb.Reaction, 0, len(reactions)) for _, reaction := range reactions { reactionMessage, err := convertReactionFromStoreWithCreators(reaction, creatorsByID, memoName) if err != nil { @@ -207,14 +207,14 @@ func (s *APIV1Service) convertReactionsFromStoreWithCreators(ctx context.Context return reactionMessages, nil } -func convertReactionFromStoreWithCreators(reaction *store.Reaction, creatorsByID map[int32]*store.User, memoName string) (*v1pb.Reaction, error) { +func convertReactionFromStoreWithCreators(reaction *store.Reaction, creatorsByID map[int32]*store.User, memoName string) (*apipb.Reaction, error) { creator := creatorsByID[reaction.CreatorID] if creator == nil { return nil, errReactionCreatorNotFound } reactionUID := fmt.Sprintf("%d", reaction.ID) - return &v1pb.Reaction{ + return &apipb.Reaction{ Name: fmt.Sprintf("%s/%s%s", memoName, ReactionNamePrefix, reactionUID), Creator: BuildUserName(creator.Username), ReactionType: reaction.ReactionType, @@ -224,9 +224,9 @@ func convertReactionFromStoreWithCreators(reaction *store.Reaction, creatorsByID // batchConvertMemoRelations batch-loads relations for a list of memos and returns // a map from memo ID to its converted relations. This avoids N+1 queries when listing memos. -func (s *APIV1Service) batchConvertMemoRelations(ctx context.Context, memos []*store.Memo, includeSnippets bool) (map[int32][]*v1pb.MemoRelation, error) { +func (s *APIService) batchConvertMemoRelations(ctx context.Context, memos []*store.Memo, includeSnippets bool) (map[int32][]*apipb.MemoRelation, error) { if len(memos) == 0 { - return map[int32][]*v1pb.MemoRelation{}, nil + return map[int32][]*apipb.MemoRelation{}, nil } accessScope, _, err := s.resolveMemoAccessScope(ctx) @@ -301,7 +301,7 @@ func (s *APIV1Service) batchConvertMemoRelations(ctx context.Context, memos []*s } // Build the result map: memo ID → its relations (both directions). - result := make(map[int32][]*v1pb.MemoRelation, len(memos)) + result := make(map[int32][]*apipb.MemoRelation, len(memos)) for _, r := range allRelations { memoUID, ok1 := memoIDToUID[r.MemoID] relatedUID, ok2 := memoIDToUID[r.RelatedMemoID] @@ -309,12 +309,12 @@ func (s *APIV1Service) batchConvertMemoRelations(ctx context.Context, memos []*s continue } - relation := &v1pb.MemoRelation{ - Memo: &v1pb.MemoRelation_Memo{ + relation := &apipb.MemoRelation{ + Memo: &apipb.MemoRelation_MemoRef{ Name: fmt.Sprintf("%s%s", MemoNamePrefix, memoUID), Snippet: memoIDToSnippet[r.MemoID], }, - RelatedMemo: &v1pb.MemoRelation_Memo{ + RelatedMemo: &apipb.MemoRelation_MemoRef{ Name: fmt.Sprintf("%s%s", MemoNamePrefix, relatedUID), Snippet: memoIDToSnippet[r.RelatedMemoID], }, @@ -334,7 +334,7 @@ func (s *APIV1Service) batchConvertMemoRelations(ctx context.Context, memos []*s } // loadMemoRelations loads relations for a single memo and converts them to API format. -func (s *APIV1Service) loadMemoRelations(ctx context.Context, memo *store.Memo) ([]*v1pb.MemoRelation, error) { +func (s *APIService) loadMemoRelations(ctx context.Context, memo *store.Memo) ([]*apipb.MemoRelation, error) { relationMap, err := s.batchConvertMemoRelations(ctx, []*store.Memo{memo}, true) if err != nil { return nil, err @@ -358,11 +358,11 @@ func mergeMemoRelations(groups ...[]*store.MemoRelation) []*store.MemoRelation { return merged } -func convertMemoPropertyFromStore(property *storepb.MemoPayload_Property) *v1pb.Memo_Property { +func convertMemoPropertyFromStore(property *storepb.MemoPayload_Property) *apipb.Memo_Property { if property == nil { return nil } - return &v1pb.Memo_Property{ + return &apipb.Memo_Property{ HasLink: property.HasLink, HasTaskList: property.HasTaskList, HasCode: property.HasCode, @@ -371,18 +371,18 @@ func convertMemoPropertyFromStore(property *storepb.MemoPayload_Property) *v1pb. } } -func convertLocationFromStore(location *storepb.MemoPayload_Location) *v1pb.Location { +func convertLocationFromStore(location *storepb.MemoPayload_Location) *apipb.Location { if location == nil { return nil } - return &v1pb.Location{ + return &apipb.Location{ Placeholder: location.Placeholder, Latitude: location.Latitude, Longitude: location.Longitude, } } -func convertLocationToStore(location *v1pb.Location) *storepb.MemoPayload_Location { +func convertLocationToStore(location *apipb.Location) *storepb.MemoPayload_Location { if location == nil { return nil } @@ -393,38 +393,38 @@ func convertLocationToStore(location *v1pb.Location) *storepb.MemoPayload_Locati } } -func convertVisibilityFromStore(visibility store.Visibility) v1pb.Visibility { +func convertVisibilityFromStore(visibility store.Visibility) apipb.Visibility { switch visibility { case store.Private: - return v1pb.Visibility_PRIVATE + return apipb.Visibility_PRIVATE case store.Protected: - return v1pb.Visibility_PROTECTED + return apipb.Visibility_PROTECTED case store.Public: - return v1pb.Visibility_PUBLIC + return apipb.Visibility_PUBLIC case store.SpaceAudience: - return v1pb.Visibility_SPACE + return apipb.Visibility_SPACE default: - return v1pb.Visibility_VISIBILITY_UNSPECIFIED + return apipb.Visibility_VISIBILITY_UNSPECIFIED } } -func validateCreateMemoVisibility(visibility v1pb.Visibility) (store.Visibility, error) { +func validateCreateMemoVisibility(visibility apipb.Visibility) (store.Visibility, error) { switch visibility { - case v1pb.Visibility_VISIBILITY_UNSPECIFIED, v1pb.Visibility_PRIVATE: + case apipb.Visibility_VISIBILITY_UNSPECIFIED, apipb.Visibility_PRIVATE: return store.Private, nil - case v1pb.Visibility_PROTECTED: + case apipb.Visibility_PROTECTED: return store.Protected, nil - case v1pb.Visibility_PUBLIC: + case apipb.Visibility_PUBLIC: return store.Public, nil - case v1pb.Visibility_SPACE: + case apipb.Visibility_SPACE: return store.SpaceAudience, nil default: return "", status.Errorf(codes.InvalidArgument, "invalid memo visibility") } } -func validateUpdateMemoVisibility(visibility v1pb.Visibility) (store.Visibility, error) { - if visibility == v1pb.Visibility_VISIBILITY_UNSPECIFIED { +func validateUpdateMemoVisibility(visibility apipb.Visibility) (store.Visibility, error) { + if visibility == apipb.Visibility_VISIBILITY_UNSPECIFIED { return "", status.Errorf(codes.InvalidArgument, "visibility must be specified") } return validateCreateMemoVisibility(visibility) diff --git a/server/api/memo_service_filter.go b/server/api/memo_service_filter.go new file mode 100644 index 000000000..778f64ec1 --- /dev/null +++ b/server/api/memo_service_filter.go @@ -0,0 +1 @@ +package api diff --git a/server/api/v1/memo_service_link_metadata.go b/server/api/memo_service_link_metadata.go similarity index 73% rename from server/api/v1/memo_service_link_metadata.go rename to server/api/memo_service_link_metadata.go index a772f4e2b..5a0eff072 100644 --- a/server/api/v1/memo_service_link_metadata.go +++ b/server/api/memo_service_link_metadata.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "context" @@ -9,7 +9,7 @@ import ( "github.com/usememos/memos/internal/linkmeta" "github.com/usememos/memos/internal/ratelimit" - v1pb "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" ) type linkMetadataFetcher interface { @@ -17,7 +17,7 @@ type linkMetadataFetcher interface { } // GetLinkMetadata gets metadata for a link. -func (s *APIV1Service) GetLinkMetadata(ctx context.Context, request *v1pb.GetLinkMetadataRequest) (*v1pb.LinkMetadata, error) { +func (s *APIService) GetLinkMetadata(ctx context.Context, request *apipb.GetLinkMetadataRequest) (*apipb.LinkMetadata, error) { if err := s.throttleLinkMetadata(ctx, 1); err != nil { return nil, err } @@ -26,13 +26,13 @@ func (s *APIV1Service) GetLinkMetadata(ctx context.Context, request *v1pb.GetLin // throttleLinkMetadata bounds outbound fetches per caller. Cached results // still cost, since the point is to bound how often a caller can ask. -func (s *APIV1Service) throttleLinkMetadata(ctx context.Context, urls int) error { +func (s *APIService) throttleLinkMetadata(ctx context.Context, urls int) error { _, key := callerBudget(ctx) return s.throttleAndCharge(ratelimit.ScopeLinkMetadata, key, urls) } // BatchGetLinkMetadata gets metadata for links. -func (s *APIV1Service) BatchGetLinkMetadata(ctx context.Context, request *v1pb.BatchGetLinkMetadataRequest) (*v1pb.BatchGetLinkMetadataResponse, error) { +func (s *APIService) BatchGetLinkMetadata(ctx context.Context, request *apipb.BatchGetLinkMetadataRequest) (*apipb.BatchGetLinkMetadataResponse, error) { if len(request.Urls) == 0 { return nil, status.Errorf(codes.InvalidArgument, "urls are required") } @@ -44,7 +44,7 @@ func (s *APIV1Service) BatchGetLinkMetadata(ctx context.Context, request *v1pb.B } s.chargeBatch(ctx, len(request.Urls)) - linkMetadata := make([]*v1pb.LinkMetadata, 0, len(request.Urls)) + linkMetadata := make([]*apipb.LinkMetadata, 0, len(request.Urls)) for _, url := range request.Urls { metadata, err := s.buildLinkMetadata(ctx, url) if err != nil { @@ -53,12 +53,12 @@ func (s *APIV1Service) BatchGetLinkMetadata(ctx context.Context, request *v1pb.B linkMetadata = append(linkMetadata, metadata) } - return &v1pb.BatchGetLinkMetadataResponse{ + return &apipb.BatchGetLinkMetadataResponse{ LinkMetadata: linkMetadata, }, nil } -func (s *APIV1Service) buildLinkMetadata(ctx context.Context, inputURL string) (*v1pb.LinkMetadata, error) { +func (s *APIService) buildLinkMetadata(ctx context.Context, inputURL string) (*apipb.LinkMetadata, error) { url := strings.TrimSpace(inputURL) if url == "" { return nil, status.Errorf(codes.InvalidArgument, "url is required") @@ -68,7 +68,7 @@ func (s *APIV1Service) buildLinkMetadata(ctx context.Context, inputURL string) ( return nil, status.Errorf(codes.InvalidArgument, "failed to fetch link metadata: %v", err) } - return &v1pb.LinkMetadata{ + return &apipb.LinkMetadata{ Url: inputURL, Title: htmlMeta.Title, Description: htmlMeta.Description, diff --git a/server/api/v1/memo_service_query.go b/server/api/memo_service_query.go similarity index 94% rename from server/api/v1/memo_service_query.go rename to server/api/memo_service_query.go index d9c8e932f..a91f4b30e 100644 --- a/server/api/v1/memo_service_query.go +++ b/server/api/memo_service_query.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "strings" @@ -8,7 +8,7 @@ import ( "github.com/usememos/memos/store" ) -func (*APIV1Service) parseMemoOrderBy(orderBy string, memoFind *store.FindMemo) error { +func (*APIService) parseMemoOrderBy(orderBy string, memoFind *store.FindMemo) error { if strings.TrimSpace(orderBy) == "" { return errors.New("empty order_by") } diff --git a/server/api/v1/memo_service_webhooks.go b/server/api/memo_service_webhooks.go similarity index 86% rename from server/api/v1/memo_service_webhooks.go rename to server/api/memo_service_webhooks.go index 41830a147..73e2e5901 100644 --- a/server/api/v1/memo_service_webhooks.go +++ b/server/api/memo_service_webhooks.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "context" @@ -9,29 +9,29 @@ import ( "github.com/usememos/memos/core/access" "github.com/usememos/memos/internal/webhook" - v1pb "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" storepb "github.com/usememos/memos/proto/gen/store" "github.com/usememos/memos/server/auth" "github.com/usememos/memos/store" ) // DispatchMemoCreatedWebhook dispatches a webhook when a memo is created. -func (s *APIV1Service) DispatchMemoCreatedWebhook(ctx context.Context, memo *v1pb.Memo) error { +func (s *APIService) DispatchMemoCreatedWebhook(ctx context.Context, memo *apipb.Memo) error { return s.dispatchMemoRelatedWebhook(ctx, memo, "memos.memo.created") } // DispatchMemoUpdatedWebhook dispatches webhook when memo is updated. -func (s *APIV1Service) DispatchMemoUpdatedWebhook(ctx context.Context, memo *v1pb.Memo) error { +func (s *APIService) DispatchMemoUpdatedWebhook(ctx context.Context, memo *apipb.Memo) error { return s.dispatchMemoRelatedWebhook(ctx, memo, "memos.memo.updated") } // DispatchMemoDeletedWebhook dispatches webhook when memo is deleted. -func (s *APIV1Service) DispatchMemoDeletedWebhook(ctx context.Context, memo *v1pb.Memo) error { +func (s *APIService) DispatchMemoDeletedWebhook(ctx context.Context, memo *apipb.Memo) error { return s.dispatchMemoRelatedWebhook(ctx, memo, "memos.memo.deleted") } // DispatchMemoCommentCreatedWebhook dispatches webhook to the related memo owner when a comment is created. -func (s *APIV1Service) DispatchMemoCommentCreatedWebhook( +func (s *APIService) DispatchMemoCommentCreatedWebhook( ctx context.Context, comment, relatedMemo *store.Memo, relatedMemoCreatorID int32, @@ -83,7 +83,7 @@ func (s *APIV1Service) DispatchMemoCommentCreatedWebhook( return nil } -func (s *APIV1Service) dispatchMemoRelatedWebhook(ctx context.Context, memo *v1pb.Memo, activityType string) error { +func (s *APIService) dispatchMemoRelatedWebhook(ctx context.Context, memo *apipb.Memo, activityType string) error { creator, err := ResolveUserByName(ctx, s.Store, memo.Creator) if err != nil { return status.Errorf(codes.InvalidArgument, "invalid memo creator") @@ -112,10 +112,10 @@ type memoWebhookPayload struct { // Creator is the resource name of the memo creator. Format: users/{user} Creator string `json:"creator"` // Memo is the memo that triggered the event. - Memo *v1pb.Memo `json:"memo"` + Memo *apipb.Memo `json:"memo"` } -func newMemoWebhookRequest(hook *storepb.WebhooksUserSetting_Webhook, activityType string, memo *v1pb.Memo) *webhook.Request { +func newMemoWebhookRequest(hook *storepb.WebhooksUserSetting_Webhook, activityType string, memo *apipb.Memo) *webhook.Request { return &webhook.Request{ URL: hook.Url, Label: activityType, @@ -129,7 +129,7 @@ func newMemoWebhookRequest(hook *storepb.WebhooksUserSetting_Webhook, activityTy } } -func (s *APIV1Service) getMemoContentSnippet(content string) (string, error) { +func (s *APIService) getMemoContentSnippet(content string) (string, error) { // Use goldmark service for snippet generation snippet, err := s.MarkdownService.GenerateSnippet([]byte(content), 64) if err != nil { diff --git a/server/api/v1/memo_share_service.go b/server/api/memo_share_service.go similarity index 91% rename from server/api/v1/memo_share_service.go rename to server/api/memo_share_service.go index bf3c5ea30..453cd7dbe 100644 --- a/server/api/v1/memo_share_service.go +++ b/server/api/memo_share_service.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "context" @@ -16,13 +16,13 @@ import ( "github.com/usememos/memos/core/access" "github.com/usememos/memos/internal/ratelimit" - v1pb "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" "github.com/usememos/memos/store" ) // CreateMemoShare creates an opaque share link for a memo. // Only the memo's creator may call this. -func (s *APIV1Service) CreateMemoShare(ctx context.Context, request *v1pb.CreateMemoShareRequest) (*v1pb.MemoShare, error) { +func (s *APIService) CreateMemoShare(ctx context.Context, request *apipb.CreateMemoShareRequest) (*apipb.MemoShare, error) { user, err := s.fetchCurrentUser(ctx) if err != nil { return nil, status.Errorf(codes.Internal, "failed to get user") @@ -82,7 +82,7 @@ func (s *APIV1Service) CreateMemoShare(ctx context.Context, request *v1pb.Create // ListMemoShares lists all share links for a memo. // Only the memo's creator may call this. -func (s *APIV1Service) ListMemoShares(ctx context.Context, request *v1pb.ListMemoSharesRequest) (*v1pb.ListMemoSharesResponse, error) { +func (s *APIService) ListMemoShares(ctx context.Context, request *apipb.ListMemoSharesRequest) (*apipb.ListMemoSharesResponse, error) { user, err := s.fetchCurrentUser(ctx) if err != nil { return nil, status.Errorf(codes.Internal, "failed to get user") @@ -114,7 +114,7 @@ func (s *APIV1Service) ListMemoShares(ctx context.Context, request *v1pb.ListMem return nil, status.Errorf(codes.Internal, "failed to list memo shares") } - response := &v1pb.ListMemoSharesResponse{} + response := &apipb.ListMemoSharesResponse{} for _, ms := range shares { response.MemoShares = append(response.MemoShares, convertMemoShareFromStore(ms, memo.UID)) } @@ -123,7 +123,7 @@ func (s *APIV1Service) ListMemoShares(ctx context.Context, request *v1pb.ListMem // DeleteMemoShare revokes a share link. // Only the memo's creator may call this. -func (s *APIV1Service) DeleteMemoShare(ctx context.Context, request *v1pb.DeleteMemoShareRequest) (*emptypb.Empty, error) { +func (s *APIService) DeleteMemoShare(ctx context.Context, request *apipb.DeleteMemoShareRequest) (*emptypb.Empty, error) { user, err := s.fetchCurrentUser(ctx) if err != nil { return nil, status.Errorf(codes.Internal, "failed to get user") @@ -169,7 +169,7 @@ func (s *APIV1Service) DeleteMemoShare(ctx context.Context, request *v1pb.Delete // GetSharedMemo resolves a share token to its memo. No authentication required. // Returns NOT_FOUND for invalid or expired tokens (no information leakage). -func (s *APIV1Service) GetSharedMemo(ctx context.Context, request *v1pb.GetSharedMemoRequest) (*v1pb.Memo, error) { +func (s *APIService) GetSharedMemo(ctx context.Context, request *apipb.GetSharedMemoRequest) (*apipb.Memo, error) { ms, err := s.getActiveMemoShare(ctx, request.ShareToken) if err != nil { return nil, err @@ -218,7 +218,7 @@ func isMemoShareExpired(ms *store.MemoShare) bool { return ms.ExpiresTs != nil && time.Now().Unix() > *ms.ExpiresTs } -func (s *APIV1Service) getActiveMemoShare(ctx context.Context, shareID string) (*store.MemoShare, error) { +func (s *APIService) getActiveMemoShare(ctx context.Context, shareID string) (*store.MemoShare, error) { ms, err := s.Store.GetMemoShare(ctx, &store.FindMemoShare{UID: &shareID}) if err != nil { return nil, status.Errorf(codes.Internal, "failed to get memo share") @@ -231,9 +231,9 @@ func (s *APIV1Service) getActiveMemoShare(ctx context.Context, shareID string) ( // convertMemoShareFromStore converts a store MemoShare to the proto MemoShare message. // name format: memos/{memoUID}/shares/{shareToken}. -func convertMemoShareFromStore(ms *store.MemoShare, memoUID string) *v1pb.MemoShare { +func convertMemoShareFromStore(ms *store.MemoShare, memoUID string) *apipb.MemoShare { name := fmt.Sprintf("%s%s/%s%s", MemoNamePrefix, memoUID, MemoShareNamePrefix, ms.UID) - pb := &v1pb.MemoShare{ + pb := &apipb.MemoShare{ Name: name, CreateTime: timestamppb.New(time.Unix(ms.CreatedTs, 0)), } diff --git a/server/api/v1/memo_update_helpers.go b/server/api/memo_update_helpers.go similarity index 84% rename from server/api/v1/memo_update_helpers.go rename to server/api/memo_update_helpers.go index 456a8d022..c34bc4ebc 100644 --- a/server/api/v1/memo_update_helpers.go +++ b/server/api/memo_update_helpers.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "context" @@ -6,11 +6,11 @@ import ( "github.com/pkg/errors" - v1pb "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" "github.com/usememos/memos/store" ) -func (s *APIV1Service) buildUpdatedMemoState(ctx context.Context, memoID int32) (*store.Memo, *store.Memo, *v1pb.Memo, error) { +func (s *APIService) buildUpdatedMemoState(ctx context.Context, memoID int32) (*store.Memo, *store.Memo, *apipb.Memo, error) { memo, err := s.Store.GetMemo(ctx, &store.FindMemo{ID: &memoID}) if err != nil { return nil, nil, nil, errors.Wrap(err, "failed to get memo") @@ -51,9 +51,9 @@ func (s *APIV1Service) buildUpdatedMemoState(ctx context.Context, memoID int32) return memo, commentContext, memoMessage, nil } -func (s *APIV1Service) dispatchMemoUpdatedSideEffects( +func (s *APIService) dispatchMemoUpdatedSideEffects( ctx context.Context, - memoMessage *v1pb.Memo, + memoMessage *apipb.Memo, ) { if err := s.DispatchMemoUpdatedWebhook(ctx, memoMessage); err != nil { slog.Warn("Failed to dispatch memo updated webhook", slog.Any("err", err)) diff --git a/server/api/v1/memo_view_icon.go b/server/api/memo_view_icon.go similarity index 65% rename from server/api/v1/memo_view_icon.go rename to server/api/memo_view_icon.go index bdbee2726..7b4f1051a 100644 --- a/server/api/v1/memo_view_icon.go +++ b/server/api/memo_view_icon.go @@ -1,32 +1,32 @@ -package v1 +package api import ( - v1pb "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" storepb "github.com/usememos/memos/proto/gen/store" ) -func convertMemoViewIconFromStore(icon *storepb.MemoViewsUserSetting_MemoView_Icon) *v1pb.MemoView_Icon { +func convertMemoViewIconFromStore(icon *storepb.MemoViewsUserSetting_MemoView_Icon) *apipb.MemoView_Icon { if icon == nil { return nil } switch value := icon.Value.(type) { case *storepb.MemoViewsUserSetting_MemoView_Icon_Emoji: - return &v1pb.MemoView_Icon{Value: &v1pb.MemoView_Icon_Emoji{Emoji: value.Emoji}} + return &apipb.MemoView_Icon{Value: &apipb.MemoView_Icon_Emoji{Emoji: value.Emoji}} case *storepb.MemoViewsUserSetting_MemoView_Icon_Lucide: - return &v1pb.MemoView_Icon{Value: &v1pb.MemoView_Icon_Lucide{Lucide: value.Lucide}} + return &apipb.MemoView_Icon{Value: &apipb.MemoView_Icon_Lucide{Lucide: value.Lucide}} default: return nil } } -func convertMemoViewIconToStore(icon *v1pb.MemoView_Icon) *storepb.MemoViewsUserSetting_MemoView_Icon { +func convertMemoViewIconToStore(icon *apipb.MemoView_Icon) *storepb.MemoViewsUserSetting_MemoView_Icon { if icon == nil { return nil } switch value := icon.Value.(type) { - case *v1pb.MemoView_Icon_Emoji: + case *apipb.MemoView_Icon_Emoji: return &storepb.MemoViewsUserSetting_MemoView_Icon{Value: &storepb.MemoViewsUserSetting_MemoView_Icon_Emoji{Emoji: value.Emoji}} - case *v1pb.MemoView_Icon_Lucide: + case *apipb.MemoView_Icon_Lucide: return &storepb.MemoViewsUserSetting_MemoView_Icon{Value: &storepb.MemoViewsUserSetting_MemoView_Icon_Lucide{Lucide: value.Lucide}} default: // Preserve an empty icon so validation rejects it instead of treating it as a reset. diff --git a/server/api/v1/notification_email.go b/server/api/notification_email.go similarity index 73% rename from server/api/v1/notification_email.go rename to server/api/notification_email.go index 9e705eeae..221158c55 100644 --- a/server/api/v1/notification_email.go +++ b/server/api/notification_email.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "context" @@ -8,7 +8,7 @@ import ( "github.com/usememos/memos/store" ) -func (s *APIV1Service) createInboxWithEmailNotification(ctx context.Context, inbox *store.Inbox) (*store.Inbox, error) { +func (s *APIService) createInboxWithEmailNotification(ctx context.Context, inbox *store.Inbox) (*store.Inbox, error) { createdInbox, err := s.Store.CreateInbox(ctx, inbox) if err != nil { return nil, err @@ -17,7 +17,7 @@ func (s *APIV1Service) createInboxWithEmailNotification(ctx context.Context, inb return createdInbox, nil } -func (s *APIV1Service) dispatchInboxEmailNotificationBestEffort(ctx context.Context, inbox *store.Inbox) { +func (s *APIService) dispatchInboxEmailNotificationBestEffort(ctx context.Context, inbox *store.Inbox) { dispatcher := notification.NewEmailDispatcher(s.Profile, s.Store, s.NotificationEmailSender) if err := dispatcher.DispatchInboxEmail(ctx, inbox); err != nil { slog.Warn("Failed to dispatch inbox email notification", diff --git a/server/api/v1/ratelimit.go b/server/api/ratelimit.go similarity index 92% rename from server/api/v1/ratelimit.go rename to server/api/ratelimit.go index 0ecfb24cc..e39f8e249 100644 --- a/server/api/v1/ratelimit.go +++ b/server/api/ratelimit.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "context" @@ -25,8 +25,8 @@ const ( // errorInfoDomain is the google.rpc.ErrorInfo domain for every reason this // service emits. AIP-193 asks for a stable, globally unique namespace, not a // host: this is the service name the API already uses in every resource - // type ("memos.api.v1/Memo"), so reasons and resources share one name. - errorInfoDomain = "memos.api.v1" + // type ("memos.api/Memo"), so reasons and resources share one name. + errorInfoDomain = "memos.api" // reasonRateLimited marks a refusal that recovers on its own after the // advertised delay. Metering will use QUOTA_EXCEEDED for refusals that do not. reasonRateLimited = "RATE_LIMITED" @@ -138,7 +138,7 @@ func accountKey(username string) string { } // charge records cost units against scope and key. -func (s *APIV1Service) charge(scope ratelimit.Scope, key string, cost int) { +func (s *APIService) charge(scope ratelimit.Scope, key string, cost int) { if s.RateLimiter == nil || key == "" { return } @@ -147,7 +147,7 @@ func (s *APIV1Service) charge(scope ratelimit.Scope, key string, cost int) { // throttleAndCharge admits and records in one atomic step, for activities // where every attempt counts. -func (s *APIV1Service) throttleAndCharge(scope ratelimit.Scope, key string, cost int) error { +func (s *APIService) throttleAndCharge(scope ratelimit.Scope, key string, cost int) error { if s.RateLimiter == nil || key == "" { return nil } @@ -162,7 +162,7 @@ func (s *APIV1Service) throttleAndCharge(scope ratelimit.Scope, key string, cost // chargeBatch adds the extra cost of a batch request to the caller's catch-all // budget. The authorizer already counted the request once, so a batch of n // items costs n in total. -func (s *APIV1Service) chargeBatch(ctx context.Context, items int) { +func (s *APIService) chargeBatch(ctx context.Context, items int) { if items <= 1 { return } @@ -172,7 +172,7 @@ func (s *APIV1Service) chargeBatch(ctx context.Context, items int) { // requireChallenge verifies the challenge token on the request when a // challenge is configured. With no challenge configured it is a no-op. -func (s *APIV1Service) requireChallenge(ctx context.Context, scope ratelimit.Scope) error { +func (s *APIService) requireChallenge(ctx context.Context, scope ratelimit.Scope) error { if s.Challenge == nil { return nil } @@ -193,7 +193,7 @@ func (s *APIV1Service) requireChallenge(ctx context.Context, scope ratelimit.Sco } // refund gives back units consumed for an attempt that turned out not to count. -func (s *APIV1Service) refund(scope ratelimit.Scope, key string, cost int) { +func (s *APIService) refund(scope ratelimit.Scope, key string, cost int) { if s.RateLimiter == nil || key == "" { return } @@ -204,7 +204,7 @@ func (s *APIV1Service) refund(scope ratelimit.Scope, key string, cost int) { // check, so concurrent attempts cannot share one remaining unit, and gives // the units back when the attempt succeeds. Only failures end up counted. type signInAttempt struct { - service *APIV1Service + service *APIService clientIP string username string reserved []ratelimit.Scope @@ -212,7 +212,7 @@ type signInAttempt struct { // reserveSignIn consumes the sign-in budgets for an attempt. It returns the // rate-limit error when either budget is spent; a refusal charges nothing. -func (s *APIV1Service) reserveSignIn(clientIP, username string) (*signInAttempt, error) { +func (s *APIService) reserveSignIn(clientIP, username string) (*signInAttempt, error) { attempt := &signInAttempt{service: s, clientIP: clientIP, username: accountKey(username)} if err := s.throttleAndCharge(ratelimit.ScopeSignInIP, clientIP, 1); err != nil { return nil, err diff --git a/server/api/v1/ratelimit_test.go b/server/api/ratelimit_test.go similarity index 99% rename from server/api/v1/ratelimit_test.go rename to server/api/ratelimit_test.go index 691fe3f3d..a3ee94e00 100644 --- a/server/api/v1/ratelimit_test.go +++ b/server/api/ratelimit_test.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "strings" diff --git a/server/api/v1/reaction_service.go b/server/api/reaction_service.go similarity index 87% rename from server/api/v1/reaction_service.go rename to server/api/reaction_service.go index 6298e02c9..f915192dc 100644 --- a/server/api/v1/reaction_service.go +++ b/server/api/reaction_service.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "context" @@ -11,13 +11,13 @@ import ( "github.com/usememos/memos/core/access" "github.com/usememos/memos/internal/ratelimit" - v1pb "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" "github.com/usememos/memos/store" ) -func (s *APIV1Service) ListMemoReactions(ctx context.Context, request *v1pb.ListMemoReactionsRequest) (*v1pb.ListMemoReactionsResponse, error) { +func (s *APIService) ListMemoReactions(ctx context.Context, request *apipb.ListMemoReactionsRequest) (*apipb.ListMemoReactionsResponse, error) { // Extract memo UID and check visibility. - memoUID, err := ExtractMemoUIDFromName(request.Name) + memoUID, err := ExtractMemoUIDFromName(request.Parent) if err != nil { return nil, status.Errorf(codes.InvalidArgument, "invalid memo name: %v", err) } @@ -40,8 +40,8 @@ func (s *APIV1Service) ListMemoReactions(ctx context.Context, request *v1pb.List return nil, status.Errorf(codes.Internal, "failed to list reactions") } - response := &v1pb.ListMemoReactionsResponse{ - Reactions: []*v1pb.Reaction{}, + response := &apipb.ListMemoReactionsResponse{ + Reactions: []*apipb.Reaction{}, } response.Reactions, err = s.convertReactionsFromStoreWithCreators(ctx, reactions, nil, buildMemoName(memo.UID)) if err != nil { @@ -50,7 +50,7 @@ func (s *APIV1Service) ListMemoReactions(ctx context.Context, request *v1pb.List return response, nil } -func (s *APIV1Service) UpsertMemoReaction(ctx context.Context, request *v1pb.UpsertMemoReactionRequest) (*v1pb.Reaction, error) { +func (s *APIService) UpsertMemoReaction(ctx context.Context, request *apipb.UpsertMemoReactionRequest) (*apipb.Reaction, error) { user, err := s.fetchCurrentUser(ctx) if err != nil { return nil, status.Errorf(codes.Internal, "failed to get current user") @@ -66,7 +66,7 @@ func (s *APIV1Service) UpsertMemoReaction(ctx context.Context, request *v1pb.Ups } // Extract memo UID and check visibility before allowing reaction. - memoUID, err := ExtractMemoUIDFromName(request.Name) + memoUID, err := ExtractMemoUIDFromName(request.Parent) if err != nil { return nil, status.Errorf(codes.InvalidArgument, "invalid memo name: %v", err) } @@ -102,7 +102,7 @@ func (s *APIV1Service) UpsertMemoReaction(ctx context.Context, request *v1pb.Ups return reactionMessage, nil } -func (s *APIV1Service) DeleteMemoReaction(ctx context.Context, request *v1pb.DeleteMemoReactionRequest) (*emptypb.Empty, error) { +func (s *APIService) DeleteMemoReaction(ctx context.Context, request *apipb.DeleteMemoReactionRequest) (*emptypb.Empty, error) { user, err := s.fetchCurrentUser(ctx) if err != nil { return nil, status.Errorf(codes.Internal, "failed to get current user: %v", err) @@ -167,7 +167,7 @@ func mapReactionMutationError(err error, operation string) error { } } -func (s *APIV1Service) convertReactionFromStore(ctx context.Context, reaction *store.Reaction, memoName string) (*v1pb.Reaction, error) { +func (s *APIService) convertReactionFromStore(ctx context.Context, reaction *store.Reaction, memoName string) (*apipb.Reaction, error) { creatorsByID, err := s.listUsersByIDWithExisting(ctx, []int32{reaction.CreatorID}, nil) if err != nil { return nil, status.Errorf(codes.Internal, "failed to get reaction creator") diff --git a/server/api/v1/reaction_service_policy_test.go b/server/api/reaction_service_policy_test.go similarity index 99% rename from server/api/v1/reaction_service_policy_test.go rename to server/api/reaction_service_policy_test.go index 39589c441..3b971c85a 100644 --- a/server/api/v1/reaction_service_policy_test.go +++ b/server/api/reaction_service_policy_test.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "errors" diff --git a/server/api/v1/request_body_limit_test.go b/server/api/request_body_limit_test.go similarity index 75% rename from server/api/v1/request_body_limit_test.go rename to server/api/request_body_limit_test.go index baaf61eba..3509f96fe 100644 --- a/server/api/v1/request_body_limit_test.go +++ b/server/api/request_body_limit_test.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "testing" @@ -12,13 +12,13 @@ import ( func TestRequestBodyLimitPerProcedure(t *testing.T) { require.EqualValues(t, uploadRequestLimit, requestBodyLimit(attachmentUploadProcedure)) require.EqualValues(t, uploadRequestLimit, requestBodyLimit(importMemosProcedure)) - require.EqualValues(t, MaxAPIRequestBytes, requestBodyLimit("/memos.api.v1.AttachmentService/CreateAttachment")) - require.EqualValues(t, MaxAPIRequestBytes, requestBodyLimit("/memos.api.v1.AIService/Transcribe")) + require.EqualValues(t, MaxAPIRequestBytes, requestBodyLimit("/memos.api.AttachmentService/CreateAttachment")) + require.EqualValues(t, MaxAPIRequestBytes, requestBodyLimit("/memos.api.AIService/Transcribe")) for _, procedure := range []string{ - "/memos.api.v1.AuthService/SignIn", - "/memos.api.v1.UserService/CreateUser", - "/memos.api.v1.MemoService/CreateMemo", - "/memos.api.v1.MemoService/ListMemos", + "/memos.api.AuthService/SignIn", + "/memos.api.UserService/CreateUser", + "/memos.api.MemoService/CreateMemo", + "/memos.api.MemoService/ListMemos", } { require.EqualValues(t, maxGeneralRequestBytes, requestBodyLimit(procedure), procedure) } diff --git a/server/api/v1/resource_name.go b/server/api/resource_name.go similarity index 99% rename from server/api/v1/resource_name.go rename to server/api/resource_name.go index 6176ed5ad..21dce301e 100644 --- a/server/api/v1/resource_name.go +++ b/server/api/resource_name.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "fmt" diff --git a/server/api/v1/resource_name_test.go b/server/api/resource_name_test.go similarity index 99% rename from server/api/v1/resource_name_test.go rename to server/api/resource_name_test.go index 8bc33690a..a186197d7 100644 --- a/server/api/v1/resource_name_test.go +++ b/server/api/resource_name_test.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "strings" diff --git a/server/api/v1/space_icon_test.go b/server/api/space_icon_test.go similarity index 59% rename from server/api/v1/space_icon_test.go rename to server/api/space_icon_test.go index be72ad559..9eec9a6c4 100644 --- a/server/api/v1/space_icon_test.go +++ b/server/api/space_icon_test.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "context" @@ -10,7 +10,7 @@ import ( "google.golang.org/protobuf/proto" "google.golang.org/protobuf/types/known/fieldmaskpb" - v1pb "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" "github.com/usememos/memos/store" ) @@ -20,26 +20,26 @@ func TestSpaceIconLifecycle(t *testing.T) { owner := createSpaceTestUser(ctx, t, service, "icon-owner", store.RoleUser) member := createSpaceTestUser(ctx, t, service, "icon-member", store.RoleUser) ownerCtx := userCtx(ctx, owner.ID) - emoji := &v1pb.Space_Icon{Value: &v1pb.Space_Icon_Emoji{Emoji: "🌱"}} - space, err := service.CreateSpace(ownerCtx, &v1pb.CreateSpaceRequest{ - SpaceId: "icon-space", Space: &v1pb.Space{Title: "Garden", Icon: emoji}, + emoji := &apipb.Space_Icon{Value: &apipb.Space_Icon_Emoji{Emoji: "🌱"}} + space, err := service.CreateSpace(ownerCtx, &apipb.CreateSpaceRequest{ + SpaceId: "icon-space", Space: &apipb.Space{Title: "Garden", Icon: emoji}, }) require.NoError(t, err) require.True(t, proto.Equal(emoji, space.Icon)) - invitation := inviteSpaceTestUser(ctx, t, service, owner, member, space, v1pb.SpaceMember_USER) + invitation := inviteSpaceTestUser(ctx, t, service, owner, member, space, apipb.SpaceMember_USER) require.True(t, proto.Equal(emoji, invitation.Space.Icon), "invitation metadata includes the icon") - _, err = service.AcceptSpaceInvitation(userCtx(ctx, member.ID), &v1pb.AcceptSpaceInvitationRequest{Name: invitation.Name}) + _, err = service.AcceptSpaceInvitation(userCtx(ctx, member.ID), &apipb.AcceptSpaceInvitationRequest{Name: invitation.Name}) require.NoError(t, err) - space, err = service.UpdateSpace(ownerCtx, &v1pb.UpdateSpaceRequest{ - Space: &v1pb.Space{Name: space.Name, Title: "Renamed"}, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"title"}}, + space, err = service.UpdateSpace(ownerCtx, &apipb.UpdateSpaceRequest{ + Space: &apipb.Space{Name: space.Name, Title: "Renamed"}, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"title"}}, }) require.NoError(t, err) require.True(t, proto.Equal(emoji, space.Icon), "unmasked icon remains unchanged") - lucide := &v1pb.Space_Icon{Value: &v1pb.Space_Icon_Lucide{Lucide: "leaf"}} - update := &v1pb.UpdateSpaceRequest{ - Space: &v1pb.Space{Name: space.Name, Icon: lucide}, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"icon"}}, + lucide := &apipb.Space_Icon{Value: &apipb.Space_Icon_Lucide{Lucide: "leaf"}} + update := &apipb.UpdateSpaceRequest{ + Space: &apipb.Space{Name: space.Name, Icon: lucide}, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"icon"}}, } _, err = service.UpdateSpace(userCtx(ctx, member.ID), update) require.Equal(t, codes.PermissionDenied, status.Code(err)) @@ -47,18 +47,18 @@ func TestSpaceIconLifecycle(t *testing.T) { require.NoError(t, err) require.True(t, proto.Equal(lucide, space.Icon)) require.Equal(t, "Renamed", space.Title) - fetched, err := service.GetSpace(ownerCtx, &v1pb.GetSpaceRequest{Name: space.Name}) + fetched, err := service.GetSpace(ownerCtx, &apipb.GetSpaceRequest{Name: space.Name}) require.NoError(t, err) require.True(t, proto.Equal(lucide, fetched.Icon)) - listed, err := service.ListSpaces(ownerCtx, &v1pb.ListSpacesRequest{}) + listed, err := service.ListSpaces(ownerCtx, &apipb.ListSpacesRequest{}) require.NoError(t, err) require.Len(t, listed.Spaces, 1) require.True(t, proto.Equal(lucide, listed.Spaces[0].Icon)) - update.Space.Icon = &v1pb.Space_Icon{Value: &v1pb.Space_Icon_Emoji{Emoji: "not an emoji"}} + update.Space.Icon = &apipb.Space_Icon{Value: &apipb.Space_Icon_Emoji{Emoji: "not an emoji"}} _, err = service.UpdateSpace(ownerCtx, update) require.Equal(t, codes.InvalidArgument, status.Code(err)) - fetched, err = service.GetSpace(ownerCtx, &v1pb.GetSpaceRequest{Name: space.Name}) + fetched, err = service.GetSpace(ownerCtx, &apipb.GetSpaceRequest{Name: space.Name}) require.NoError(t, err) require.True(t, proto.Equal(lucide, fetched.Icon), "invalid updates do not change the stored icon") @@ -66,7 +66,7 @@ func TestSpaceIconLifecycle(t *testing.T) { space, err = service.UpdateSpace(ownerCtx, update) require.NoError(t, err) require.Nil(t, space.Icon) - fetched, err = service.GetSpace(ownerCtx, &v1pb.GetSpaceRequest{Name: space.Name}) + fetched, err = service.GetSpace(ownerCtx, &apipb.GetSpaceRequest{Name: space.Name}) require.NoError(t, err) require.Nil(t, fetched.Icon) } @@ -75,15 +75,15 @@ func TestCreateSpaceRejectsInvalidIcon(t *testing.T) { ctx := context.Background() service := newIntegrationService(t) owner := createSpaceTestUser(ctx, t, service, "invalid-icon-owner", store.RoleUser) - for _, icon := range []*v1pb.Space_Icon{ + for _, icon := range []*apipb.Space_Icon{ {}, - {Value: &v1pb.Space_Icon_Emoji{Emoji: "🌱🌱"}}, - {Value: &v1pb.Space_Icon_Lucide{Lucide: ""}}, + {Value: &apipb.Space_Icon_Emoji{Emoji: "🌱🌱"}}, + {Value: &apipb.Space_Icon_Lucide{Lucide: ""}}, } { - _, err := service.CreateSpace(userCtx(ctx, owner.ID), &v1pb.CreateSpaceRequest{Space: &v1pb.Space{Title: "Invalid", Icon: icon}}) + _, err := service.CreateSpace(userCtx(ctx, owner.ID), &apipb.CreateSpaceRequest{Space: &apipb.Space{Title: "Invalid", Icon: icon}}) require.Equal(t, codes.InvalidArgument, status.Code(err)) } - spaces, err := service.ListSpaces(userCtx(ctx, owner.ID), &v1pb.ListSpacesRequest{}) + spaces, err := service.ListSpaces(userCtx(ctx, owner.ID), &apipb.ListSpacesRequest{}) require.NoError(t, err) require.Empty(t, spaces.Spaces) } diff --git a/server/api/v1/space_service.go b/server/api/space_service.go similarity index 88% rename from server/api/v1/space_service.go rename to server/api/space_service.go index c012997e1..333aa2675 100644 --- a/server/api/v1/space_service.go +++ b/server/api/space_service.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "context" @@ -11,12 +11,12 @@ import ( "google.golang.org/protobuf/proto" "google.golang.org/protobuf/types/known/emptypb" - v1pb "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" storepb "github.com/usememos/memos/proto/gen/store" "github.com/usememos/memos/store" ) -func (s *APIV1Service) requireCurrentSpaceUser(ctx context.Context) (*store.User, error) { +func (s *APIService) requireCurrentSpaceUser(ctx context.Context) (*store.User, error) { user, err := s.fetchCurrentUser(ctx) if err != nil { return nil, status.Errorf(codes.Internal, "failed to get current user: %v", err) @@ -27,7 +27,7 @@ func (s *APIV1Service) requireCurrentSpaceUser(ctx context.Context) (*store.User return user, nil } -func (s *APIV1Service) resolveMemberSpace(ctx context.Context, name string, currentUser *store.User) (*store.Space, *store.SpaceMember, error) { +func (s *APIService) resolveMemberSpace(ctx context.Context, name string, currentUser *store.User) (*store.Space, *store.SpaceMember, error) { uid, err := ExtractSpaceUIDFromName(name) if err != nil { return nil, nil, status.Errorf(codes.InvalidArgument, "invalid space name: %v", err) @@ -84,7 +84,7 @@ func mapSpaceMutationError(err error, operation string) error { } // CreateSpace creates a space with the caller as its first administrator. -func (s *APIV1Service) CreateSpace(ctx context.Context, request *v1pb.CreateSpaceRequest) (*v1pb.Space, error) { +func (s *APIService) CreateSpace(ctx context.Context, request *apipb.CreateSpaceRequest) (*apipb.Space, error) { currentUser, err := s.requireCurrentSpaceUser(ctx) if err != nil { return nil, err @@ -118,7 +118,7 @@ func (s *APIV1Service) CreateSpace(ctx context.Context, request *v1pb.CreateSpac } // ListSpaces lists only spaces with a membership for the caller. -func (s *APIV1Service) ListSpaces(ctx context.Context, request *v1pb.ListSpacesRequest) (*v1pb.ListSpacesResponse, error) { +func (s *APIService) ListSpaces(ctx context.Context, request *apipb.ListSpacesRequest) (*apipb.ListSpacesResponse, error) { currentUser, err := s.requireCurrentSpaceUser(ctx) if err != nil { return nil, err @@ -145,7 +145,7 @@ func (s *APIV1Service) ListSpaces(ctx context.Context, request *v1pb.ListSpacesR return nil, status.Errorf(codes.Internal, "failed to create next page token: %v", err) } } - response := &v1pb.ListSpacesResponse{Spaces: make([]*v1pb.Space, 0, len(spaces)), NextPageToken: nextPageToken} + response := &apipb.ListSpacesResponse{Spaces: make([]*apipb.Space, 0, len(spaces)), NextPageToken: nextPageToken} for _, space := range spaces { response.Spaces = append(response.Spaces, convertSpaceFromStore(space)) } @@ -156,7 +156,7 @@ func listSpacePage(pageSize int32, pageToken string) (int, int, error) { if pageToken == "" { return normalizePageSize(pageSize), 0, nil } - var token v1pb.PageToken + var token apipb.PageToken if err := unmarshalPageToken(pageToken, &token); err != nil { return 0, 0, status.Errorf(codes.InvalidArgument, "invalid page token: %v", err) } @@ -164,7 +164,7 @@ func listSpacePage(pageSize int32, pageToken string) (int, int, error) { } // GetSpace gets a space visible to the caller through membership. -func (s *APIV1Service) GetSpace(ctx context.Context, request *v1pb.GetSpaceRequest) (*v1pb.Space, error) { +func (s *APIService) GetSpace(ctx context.Context, request *apipb.GetSpaceRequest) (*apipb.Space, error) { currentUser, err := s.requireCurrentSpaceUser(ctx) if err != nil { return nil, err @@ -177,7 +177,7 @@ func (s *APIV1Service) GetSpace(ctx context.Context, request *v1pb.GetSpaceReque } // UpdateSpace updates Space metadata. -func (s *APIV1Service) UpdateSpace(ctx context.Context, request *v1pb.UpdateSpaceRequest) (*v1pb.Space, error) { +func (s *APIService) UpdateSpace(ctx context.Context, request *apipb.UpdateSpaceRequest) (*apipb.Space, error) { currentUser, err := s.requireCurrentSpaceUser(ctx) if err != nil { return nil, err @@ -235,7 +235,7 @@ func (s *APIV1Service) UpdateSpace(ctx context.Context, request *v1pb.UpdateSpac // DeleteSpace permanently deletes the Space and every memo directly placed // in it. The result deliberately exposes no memo inventory to the administrator. -func (s *APIV1Service) DeleteSpace(ctx context.Context, request *v1pb.DeleteSpaceRequest) (*emptypb.Empty, error) { +func (s *APIService) DeleteSpace(ctx context.Context, request *apipb.DeleteSpaceRequest) (*emptypb.Empty, error) { currentUser, err := s.requireCurrentSpaceUser(ctx) if err != nil { return nil, err @@ -260,7 +260,7 @@ func (s *APIV1Service) DeleteSpace(ctx context.Context, request *v1pb.DeleteSpac // CreateSpaceInvitation creates a pending invitation without granting any // Space access to the invitee. -func (s *APIV1Service) CreateSpaceInvitation(ctx context.Context, request *v1pb.CreateSpaceInvitationRequest) (*v1pb.SpaceInvitation, error) { +func (s *APIService) CreateSpaceInvitation(ctx context.Context, request *apipb.CreateSpaceInvitationRequest) (*apipb.SpaceInvitation, error) { currentUser, err := s.requireCurrentSpaceUser(ctx) if err != nil { return nil, err @@ -312,7 +312,7 @@ func (s *APIV1Service) CreateSpaceInvitation(ctx context.Context, request *v1pb. // ListSpaceInvitations lists pending invitations after requiring an active // Space administrator. -func (s *APIV1Service) ListSpaceInvitations(ctx context.Context, request *v1pb.ListSpaceInvitationsRequest) (*v1pb.ListSpaceInvitationsResponse, error) { +func (s *APIService) ListSpaceInvitations(ctx context.Context, request *apipb.ListSpaceInvitationsRequest) (*apipb.ListSpaceInvitationsResponse, error) { currentUser, err := s.requireCurrentSpaceUser(ctx) if err != nil { return nil, err @@ -346,8 +346,8 @@ func (s *APIV1Service) ListSpaceInvitations(ctx context.Context, request *v1pb.L return nil, status.Errorf(codes.Internal, "failed to create next page token: %v", err) } } - response := &v1pb.ListSpaceInvitationsResponse{ - SpaceInvitations: make([]*v1pb.SpaceInvitation, 0, len(invitations)), + response := &apipb.ListSpaceInvitationsResponse{ + SpaceInvitations: make([]*apipb.SpaceInvitation, 0, len(invitations)), NextPageToken: nextPageToken, } if len(invitations) == 0 { @@ -367,7 +367,7 @@ func (s *APIV1Service) ListSpaceInvitations(ctx context.Context, request *v1pb.L } for _, invitation := range invitations { user := usersByID[invitation.UserID] - if user == nil || convertSpaceMemberRoleFromStore(invitation.Role) == v1pb.SpaceMember_ROLE_UNSPECIFIED { + if user == nil || convertSpaceMemberRoleFromStore(invitation.Role) == apipb.SpaceMember_ROLE_UNSPECIFIED { continue } response.SpaceInvitations = append(response.SpaceInvitations, convertSpaceInvitationFromStore(space, user, invitation)) @@ -377,7 +377,7 @@ func (s *APIV1Service) ListSpaceInvitations(ctx context.Context, request *v1pb.L // ListUserSpaceInvitations lists the authenticated user's received pending // invitations. A user cannot enumerate another user's invitations. -func (s *APIV1Service) ListUserSpaceInvitations(ctx context.Context, request *v1pb.ListUserSpaceInvitationsRequest) (*v1pb.ListUserSpaceInvitationsResponse, error) { +func (s *APIService) ListUserSpaceInvitations(ctx context.Context, request *apipb.ListUserSpaceInvitationsRequest) (*apipb.ListUserSpaceInvitationsResponse, error) { currentUser, err := s.requireCurrentSpaceUser(ctx) if err != nil { return nil, err @@ -411,8 +411,8 @@ func (s *APIV1Service) ListUserSpaceInvitations(ctx context.Context, request *v1 return nil, status.Errorf(codes.Internal, "failed to create next page token: %v", err) } } - response := &v1pb.ListUserSpaceInvitationsResponse{ - SpaceInvitations: make([]*v1pb.SpaceInvitation, 0, len(invitations)), + response := &apipb.ListUserSpaceInvitationsResponse{ + SpaceInvitations: make([]*apipb.SpaceInvitation, 0, len(invitations)), NextPageToken: nextPageToken, } if len(invitations) == 0 { @@ -432,7 +432,7 @@ func (s *APIV1Service) ListUserSpaceInvitations(ctx context.Context, request *v1 } for _, invitation := range invitations { space := spacesByID[invitation.SpaceID] - if space == nil || convertSpaceMemberRoleFromStore(invitation.Role) == v1pb.SpaceMember_ROLE_UNSPECIFIED { + if space == nil || convertSpaceMemberRoleFromStore(invitation.Role) == apipb.SpaceMember_ROLE_UNSPECIFIED { continue } response.SpaceInvitations = append(response.SpaceInvitations, convertSpaceInvitationFromStore(space, currentUser, invitation)) @@ -442,7 +442,7 @@ func (s *APIV1Service) ListUserSpaceInvitations(ctx context.Context, request *v1 // resolveSpaceInvitationResource resolves an invitation and authorizes either // its invitee or an active administrator of its Space. -func (s *APIV1Service) resolveSpaceInvitationResource(ctx context.Context, name string, currentUser *store.User) (*store.Space, *store.User, *store.SpaceMember, *store.SpaceInvitation, error) { +func (s *APIService) resolveSpaceInvitationResource(ctx context.Context, name string, currentUser *store.User) (*store.Space, *store.User, *store.SpaceMember, *store.SpaceInvitation, error) { spaceUID, username, err := ExtractSpaceInvitationTokensFromName(name) if err != nil { return nil, nil, nil, nil, status.Errorf(codes.InvalidArgument, "invalid space invitation name: %v", err) @@ -478,7 +478,7 @@ func (s *APIV1Service) resolveSpaceInvitationResource(ctx context.Context, name if err != nil { return nil, nil, nil, nil, status.Errorf(codes.Internal, "failed to get space invitation: %v", err) } - if invitation == nil || convertSpaceMemberRoleFromStore(invitation.Role) == v1pb.SpaceMember_ROLE_UNSPECIFIED { + if invitation == nil || convertSpaceMemberRoleFromStore(invitation.Role) == apipb.SpaceMember_ROLE_UNSPECIFIED { return nil, nil, nil, nil, status.Error(codes.NotFound, "space invitation not found") } return space, targetUser, callerMembership, invitation, nil @@ -486,7 +486,7 @@ func (s *APIV1Service) resolveSpaceInvitationResource(ctx context.Context, name // GetSpaceInvitation gets a pending invitation for its invitee or a Space // administrator. -func (s *APIV1Service) GetSpaceInvitation(ctx context.Context, request *v1pb.GetSpaceInvitationRequest) (*v1pb.SpaceInvitation, error) { +func (s *APIService) GetSpaceInvitation(ctx context.Context, request *apipb.GetSpaceInvitationRequest) (*apipb.SpaceInvitation, error) { currentUser, err := s.requireCurrentSpaceUser(ctx) if err != nil { return nil, err @@ -500,7 +500,7 @@ func (s *APIV1Service) GetSpaceInvitation(ctx context.Context, request *v1pb.Get // DeleteSpaceInvitation revokes a pending invitation. Only an active Space // administrator can revoke it. -func (s *APIV1Service) DeleteSpaceInvitation(ctx context.Context, request *v1pb.DeleteSpaceInvitationRequest) (*emptypb.Empty, error) { +func (s *APIService) DeleteSpaceInvitation(ctx context.Context, request *apipb.DeleteSpaceInvitationRequest) (*emptypb.Empty, error) { currentUser, err := s.requireCurrentSpaceUser(ctx) if err != nil { return nil, err @@ -525,7 +525,7 @@ func (s *APIV1Service) DeleteSpaceInvitation(ctx context.Context, request *v1pb. // AcceptSpaceInvitation activates the invited user's membership with the role // selected by the administrator who created the invitation. -func (s *APIV1Service) AcceptSpaceInvitation(ctx context.Context, request *v1pb.AcceptSpaceInvitationRequest) (*v1pb.SpaceMember, error) { +func (s *APIService) AcceptSpaceInvitation(ctx context.Context, request *apipb.AcceptSpaceInvitationRequest) (*apipb.SpaceMember, error) { currentUser, err := s.requireCurrentSpaceUser(ctx) if err != nil { return nil, err @@ -548,7 +548,7 @@ func (s *APIV1Service) AcceptSpaceInvitation(ctx context.Context, request *v1pb. // DeclineSpaceInvitation deletes the authenticated invitee's pending // invitation without ever creating a membership. -func (s *APIV1Service) DeclineSpaceInvitation(ctx context.Context, request *v1pb.DeclineSpaceInvitationRequest) (*emptypb.Empty, error) { +func (s *APIService) DeclineSpaceInvitation(ctx context.Context, request *apipb.DeclineSpaceInvitationRequest) (*emptypb.Empty, error) { currentUser, err := s.requireCurrentSpaceUser(ctx) if err != nil { return nil, err @@ -570,7 +570,7 @@ func (s *APIV1Service) DeclineSpaceInvitation(ctx context.Context, request *v1pb // ListSpaceMembers lists memberships after authorizing the caller's own // membership before applying pagination. -func (s *APIV1Service) ListSpaceMembers(ctx context.Context, request *v1pb.ListSpaceMembersRequest) (*v1pb.ListSpaceMembersResponse, error) { +func (s *APIService) ListSpaceMembers(ctx context.Context, request *apipb.ListSpaceMembersRequest) (*apipb.ListSpaceMembersResponse, error) { currentUser, err := s.requireCurrentSpaceUser(ctx) if err != nil { return nil, err @@ -601,7 +601,7 @@ func (s *APIV1Service) ListSpaceMembers(ctx context.Context, request *v1pb.ListS return nil, status.Errorf(codes.Internal, "failed to create next page token: %v", err) } } - response := &v1pb.ListSpaceMembersResponse{SpaceMembers: make([]*v1pb.SpaceMember, 0, len(members)), NextPageToken: nextPageToken} + response := &apipb.ListSpaceMembersResponse{SpaceMembers: make([]*apipb.SpaceMember, 0, len(members)), NextPageToken: nextPageToken} if len(members) == 0 { return response, nil } @@ -620,7 +620,7 @@ func (s *APIV1Service) ListSpaceMembers(ctx context.Context, request *v1pb.ListS } for _, member := range members { user := usersByID[member.UserID] - if user == nil || user.RowStatus != store.Normal || convertSpaceMemberRoleFromStore(member.Role) == v1pb.SpaceMember_ROLE_UNSPECIFIED { + if user == nil || user.RowStatus != store.Normal || convertSpaceMemberRoleFromStore(member.Role) == apipb.SpaceMember_ROLE_UNSPECIFIED { // Malformed/dangling memberships are never exposed as active access. continue } @@ -629,7 +629,7 @@ func (s *APIV1Service) ListSpaceMembers(ctx context.Context, request *v1pb.ListS return response, nil } -func (s *APIV1Service) resolveSpaceMemberResource(ctx context.Context, name string, currentUser *store.User) (*store.Space, *store.User, *store.SpaceMember, *store.SpaceMember, error) { +func (s *APIService) resolveSpaceMemberResource(ctx context.Context, name string, currentUser *store.User) (*store.Space, *store.User, *store.SpaceMember, *store.SpaceMember, error) { spaceUID, username, err := ExtractSpaceMemberTokensFromName(name) if err != nil { return nil, nil, nil, nil, status.Errorf(codes.InvalidArgument, "invalid space member name: %v", err) @@ -663,7 +663,7 @@ func (s *APIV1Service) resolveSpaceMemberResource(ctx context.Context, name stri } // GetSpaceMember gets one membership visible to another member of the space. -func (s *APIV1Service) GetSpaceMember(ctx context.Context, request *v1pb.GetSpaceMemberRequest) (*v1pb.SpaceMember, error) { +func (s *APIService) GetSpaceMember(ctx context.Context, request *apipb.GetSpaceMemberRequest) (*apipb.SpaceMember, error) { currentUser, err := s.requireCurrentSpaceUser(ctx) if err != nil { return nil, err @@ -676,7 +676,7 @@ func (s *APIV1Service) GetSpaceMember(ctx context.Context, request *v1pb.GetSpac } // UpdateSpaceMember changes a member's role in a Space. -func (s *APIV1Service) UpdateSpaceMember(ctx context.Context, request *v1pb.UpdateSpaceMemberRequest) (*v1pb.SpaceMember, error) { +func (s *APIService) UpdateSpaceMember(ctx context.Context, request *apipb.UpdateSpaceMemberRequest) (*apipb.SpaceMember, error) { currentUser, err := s.requireCurrentSpaceUser(ctx) if err != nil { return nil, err @@ -738,7 +738,7 @@ func (s *APIV1Service) UpdateSpaceMember(ctx context.Context, request *v1pb.Upda } // DeleteSpaceMember removes a membership or lets a member leave a space. -func (s *APIV1Service) DeleteSpaceMember(ctx context.Context, request *v1pb.DeleteSpaceMemberRequest) (*emptypb.Empty, error) { +func (s *APIService) DeleteSpaceMember(ctx context.Context, request *apipb.DeleteSpaceMemberRequest) (*emptypb.Empty, error) { currentUser, err := s.requireCurrentSpaceUser(ctx) if err != nil { return nil, err diff --git a/server/api/v1/space_service_converters.go b/server/api/space_service_converters.go similarity index 71% rename from server/api/v1/space_service_converters.go rename to server/api/space_service_converters.go index 3964f0f4c..fabda0ce0 100644 --- a/server/api/v1/space_service_converters.go +++ b/server/api/space_service_converters.go @@ -1,7 +1,7 @@ -package v1 +package api import ( - v1pb "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" storepb "github.com/usememos/memos/proto/gen/store" "github.com/usememos/memos/store" ) @@ -18,7 +18,7 @@ func buildSpaceInvitationName(spaceUID, username string) string { return buildSpaceName(spaceUID) + "/" + SpaceInvitationNamePrefix + username } -func convertSpaceFromStore(space *store.Space) *v1pb.Space { +func convertSpaceFromStore(space *store.Space) *apipb.Space { converted := convertSpaceMetadataFromStore(space) if converted == nil { return nil @@ -28,11 +28,11 @@ func convertSpaceFromStore(space *store.Space) *v1pb.Space { return converted } -func convertSpaceMetadataFromStore(space *store.Space) *v1pb.Space { +func convertSpaceMetadataFromStore(space *store.Space) *apipb.Space { if space == nil { return nil } - return &v1pb.Space{ + return &apipb.Space{ Name: buildSpaceName(space.UID), Title: space.Title, Description: space.Description, @@ -40,28 +40,28 @@ func convertSpaceMetadataFromStore(space *store.Space) *v1pb.Space { } } -func convertSpaceIconFromStore(icon *storepb.SpacePayload_Icon) *v1pb.Space_Icon { +func convertSpaceIconFromStore(icon *storepb.SpacePayload_Icon) *apipb.Space_Icon { if icon == nil { return nil } switch value := icon.Value.(type) { case *storepb.SpacePayload_Icon_Emoji: - return &v1pb.Space_Icon{Value: &v1pb.Space_Icon_Emoji{Emoji: value.Emoji}} + return &apipb.Space_Icon{Value: &apipb.Space_Icon_Emoji{Emoji: value.Emoji}} case *storepb.SpacePayload_Icon_Lucide: - return &v1pb.Space_Icon{Value: &v1pb.Space_Icon_Lucide{Lucide: value.Lucide}} + return &apipb.Space_Icon{Value: &apipb.Space_Icon_Lucide{Lucide: value.Lucide}} default: return nil } } -func convertSpaceIconToStore(icon *v1pb.Space_Icon) *storepb.SpacePayload_Icon { +func convertSpaceIconToStore(icon *apipb.Space_Icon) *storepb.SpacePayload_Icon { if icon == nil { return nil } switch value := icon.Value.(type) { - case *v1pb.Space_Icon_Emoji: + case *apipb.Space_Icon_Emoji: return &storepb.SpacePayload_Icon{Value: &storepb.SpacePayload_Icon_Emoji{Emoji: value.Emoji}} - case *v1pb.Space_Icon_Lucide: + case *apipb.Space_Icon_Lucide: return &storepb.SpacePayload_Icon{Value: &storepb.SpacePayload_Icon_Lucide{Lucide: value.Lucide}} default: // Preserve an empty icon so validation rejects it instead of treating it as a reset. @@ -69,44 +69,44 @@ func convertSpaceIconToStore(icon *v1pb.Space_Icon) *storepb.SpacePayload_Icon { } } -func convertSpaceMemberRoleFromStore(role store.SpaceMemberRole) v1pb.SpaceMember_Role { +func convertSpaceMemberRoleFromStore(role store.SpaceMemberRole) apipb.SpaceMember_Role { switch role { case store.SpaceMemberRoleAdmin: - return v1pb.SpaceMember_ADMIN + return apipb.SpaceMember_ADMIN case store.SpaceMemberRoleUser: - return v1pb.SpaceMember_USER + return apipb.SpaceMember_USER default: - return v1pb.SpaceMember_ROLE_UNSPECIFIED + return apipb.SpaceMember_ROLE_UNSPECIFIED } } -func convertSpaceMemberRoleToStore(role v1pb.SpaceMember_Role) (store.SpaceMemberRole, bool) { +func convertSpaceMemberRoleToStore(role apipb.SpaceMember_Role) (store.SpaceMemberRole, bool) { switch role { - case v1pb.SpaceMember_ADMIN: + case apipb.SpaceMember_ADMIN: return store.SpaceMemberRoleAdmin, true - case v1pb.SpaceMember_USER: + case apipb.SpaceMember_USER: return store.SpaceMemberRoleUser, true default: return "", false } } -func convertSpaceMemberFromStore(space *store.Space, user *store.User, member *store.SpaceMember) *v1pb.SpaceMember { +func convertSpaceMemberFromStore(space *store.Space, user *store.User, member *store.SpaceMember) *apipb.SpaceMember { if space == nil || user == nil || member == nil { return nil } - return &v1pb.SpaceMember{ + return &apipb.SpaceMember{ Name: buildSpaceMemberName(space.UID, user.Username), User: BuildUserName(user.Username), Role: convertSpaceMemberRoleFromStore(member.Role), } } -func convertSpaceInvitationFromStore(space *store.Space, user *store.User, invitation *store.SpaceInvitation) *v1pb.SpaceInvitation { +func convertSpaceInvitationFromStore(space *store.Space, user *store.User, invitation *store.SpaceInvitation) *apipb.SpaceInvitation { if space == nil || user == nil || invitation == nil { return nil } - return &v1pb.SpaceInvitation{ + return &apipb.SpaceInvitation{ Name: buildSpaceInvitationName(space.UID, user.Username), Invitee: BuildUserName(user.Username), Role: convertSpaceMemberRoleFromStore(invitation.Role), diff --git a/server/api/v1/space_service_notifications.go b/server/api/space_service_notifications.go similarity index 79% rename from server/api/v1/space_service_notifications.go rename to server/api/space_service_notifications.go index 9dfff08e5..3f17f6397 100644 --- a/server/api/v1/space_service_notifications.go +++ b/server/api/space_service_notifications.go @@ -1,10 +1,10 @@ -package v1 +package api import ( "context" "log/slog" - v1pb "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" storepb "github.com/usememos/memos/proto/gen/store" "github.com/usememos/memos/store" ) @@ -12,7 +12,7 @@ import ( // createSpaceInvitationNotification records the invitation in the invitee's // inbox. The invitation itself is already persisted, so a failure here only // loses the notification and is logged instead of failing the request. -func (s *APIV1Service) createSpaceInvitationNotification(ctx context.Context, space *store.Space, inviter *store.User, invitee *store.User) { +func (s *APIService) createSpaceInvitationNotification(ctx context.Context, space *store.Space, inviter *store.User, invitee *store.User) { if space == nil || inviter == nil || invitee == nil { return } @@ -36,7 +36,7 @@ func (s *APIV1Service) createSpaceInvitationNotification(ctx context.Context, sp // archiveSpaceInvitationNotifications marks the receiver's notifications for // the space as handled once the invitation has been accepted. -func (s *APIV1Service) archiveSpaceInvitationNotifications(ctx context.Context, receiverID, spaceID int32) { +func (s *APIService) archiveSpaceInvitationNotifications(ctx context.Context, receiverID, spaceID int32) { s.forEachSpaceInvitationNotification(ctx, receiverID, spaceID, func(inbox *store.Inbox) error { if inbox.Status == store.ARCHIVED { return nil @@ -49,13 +49,13 @@ func (s *APIV1Service) archiveSpaceInvitationNotifications(ctx context.Context, // deleteSpaceInvitationNotifications removes the receiver's notifications for // the space once the invitation has been declined or revoked. A declined or // revoked offer leaves nothing the receiver can act on. -func (s *APIV1Service) deleteSpaceInvitationNotifications(ctx context.Context, receiverID, spaceID int32) { +func (s *APIService) deleteSpaceInvitationNotifications(ctx context.Context, receiverID, spaceID int32) { s.forEachSpaceInvitationNotification(ctx, receiverID, spaceID, func(inbox *store.Inbox) error { return s.Store.DeleteInbox(ctx, &store.DeleteInbox{ID: inbox.ID}) }) } -func (s *APIV1Service) forEachSpaceInvitationNotification(ctx context.Context, receiverID, spaceID int32, apply func(*store.Inbox) error) { +func (s *APIService) forEachSpaceInvitationNotification(ctx context.Context, receiverID, spaceID int32, apply func(*store.Inbox) error) { messageType := storepb.InboxMessage_SPACE_INVITATION inboxes, err := s.Store.ListInboxes(ctx, &store.FindInbox{ReceiverID: &receiverID, MessageType: &messageType}) if err != nil { @@ -88,21 +88,21 @@ type spaceInvitationNotificationContext struct { memberBySpaceID map[int32]store.SpaceMemberRole } -func (c *spaceInvitationNotificationContext) resolve(spaceID int32) (*store.Space, store.SpaceMemberRole, v1pb.UserNotification_SpaceInvitationPayload_State) { +func (c *spaceInvitationNotificationContext) resolve(spaceID int32) (*store.Space, store.SpaceMemberRole, apipb.UserNotification_SpaceInvitationPayload_InvitationState) { if c == nil { - return nil, "", v1pb.UserNotification_SpaceInvitationPayload_STATE_UNSPECIFIED + return nil, "", apipb.UserNotification_SpaceInvitationPayload_STATE_UNSPECIFIED } space := c.spacesByID[spaceID] if space == nil { - return nil, "", v1pb.UserNotification_SpaceInvitationPayload_STATE_UNSPECIFIED + return nil, "", apipb.UserNotification_SpaceInvitationPayload_STATE_UNSPECIFIED } if role, ok := c.pendingBySpaceID[spaceID]; ok { - return space, role, v1pb.UserNotification_SpaceInvitationPayload_PENDING + return space, role, apipb.UserNotification_SpaceInvitationPayload_PENDING } if role, ok := c.memberBySpaceID[spaceID]; ok { - return space, role, v1pb.UserNotification_SpaceInvitationPayload_ACCEPTED + return space, role, apipb.UserNotification_SpaceInvitationPayload_ACCEPTED } - return nil, "", v1pb.UserNotification_SpaceInvitationPayload_STATE_UNSPECIFIED + return nil, "", apipb.UserNotification_SpaceInvitationPayload_STATE_UNSPECIFIED } func collectInboxSpaceIDs(inboxes []*store.Inbox) []int32 { @@ -125,7 +125,7 @@ func collectInboxSpaceIDs(inboxes []*store.Inbox) []int32 { return spaceIDs } -func (s *APIV1Service) loadSpaceInvitationNotificationContext(ctx context.Context, viewer *store.User, inboxes []*store.Inbox) (*spaceInvitationNotificationContext, error) { +func (s *APIService) loadSpaceInvitationNotificationContext(ctx context.Context, viewer *store.User, inboxes []*store.Inbox) (*spaceInvitationNotificationContext, error) { result := &spaceInvitationNotificationContext{ spacesByID: map[int32]*store.Space{}, pendingBySpaceID: map[int32]store.SpaceMemberRole{}, @@ -163,19 +163,19 @@ func (s *APIV1Service) loadSpaceInvitationNotificationContext(ctx context.Contex // convertSpaceInvitationNotificationPayload returns nil when the viewer no // longer holds a pending or accepted invitation for the space, so the // notification fails closed without leaking Space metadata. -func convertSpaceInvitationNotificationPayload(inbox *store.Inbox, viewer *store.User, spaceContext *spaceInvitationNotificationContext) *v1pb.UserNotification_SpaceInvitationPayload { +func convertSpaceInvitationNotificationPayload(inbox *store.Inbox, viewer *store.User, spaceContext *spaceInvitationNotificationContext) *apipb.UserNotification_SpaceInvitationPayload { if inbox == nil || inbox.Message == nil || viewer == nil { return nil } space, role, state := spaceContext.resolve(inbox.Message.GetSpaceInvitation().GetSpaceId()) - if space == nil || state == v1pb.UserNotification_SpaceInvitationPayload_STATE_UNSPECIFIED { + if space == nil || state == apipb.UserNotification_SpaceInvitationPayload_STATE_UNSPECIFIED { return nil } convertedRole := convertSpaceMemberRoleFromStore(role) - if convertedRole == v1pb.SpaceMember_ROLE_UNSPECIFIED { + if convertedRole == apipb.SpaceMember_ROLE_UNSPECIFIED { return nil } - return &v1pb.UserNotification_SpaceInvitationPayload{ + return &apipb.UserNotification_SpaceInvitationPayload{ SpaceInvitation: buildSpaceInvitationName(space.UID, viewer.Username), Space: convertSpaceMetadataFromStore(space), Role: convertedRole, diff --git a/server/api/v1/space_service_test.go b/server/api/space_service_test.go similarity index 67% rename from server/api/v1/space_service_test.go rename to server/api/space_service_test.go index efc89fe92..a5a05b66e 100644 --- a/server/api/v1/space_service_test.go +++ b/server/api/space_service_test.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "context" @@ -16,12 +16,12 @@ import ( "google.golang.org/grpc/status" "google.golang.org/protobuf/types/known/fieldmaskpb" - v1pb "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" storepb "github.com/usememos/memos/proto/gen/store" "github.com/usememos/memos/store" ) -func createSpaceTestUser(ctx context.Context, t *testing.T, service *APIV1Service, username string, role store.Role) *store.User { +func createSpaceTestUser(ctx context.Context, t *testing.T, service *APIService, username string, role store.Role) *store.User { t.Helper() user, err := service.Store.CreateUser(ctx, &store.User{ Username: username, @@ -32,11 +32,11 @@ func createSpaceTestUser(ctx context.Context, t *testing.T, service *APIV1Servic return user } -func inviteSpaceTestUser(ctx context.Context, t *testing.T, service *APIV1Service, inviter, invitee *store.User, space *v1pb.Space, role v1pb.SpaceMember_Role) *v1pb.SpaceInvitation { +func inviteSpaceTestUser(ctx context.Context, t *testing.T, service *APIService, inviter, invitee *store.User, space *apipb.Space, role apipb.SpaceMember_Role) *apipb.SpaceInvitation { t.Helper() - invitation, err := service.CreateSpaceInvitation(userCtx(ctx, inviter.ID), &v1pb.CreateSpaceInvitationRequest{ + invitation, err := service.CreateSpaceInvitation(userCtx(ctx, inviter.ID), &apipb.CreateSpaceInvitationRequest{ Parent: space.Name, - SpaceInvitation: &v1pb.SpaceInvitation{ + SpaceInvitation: &apipb.SpaceInvitation{ Invitee: BuildUserName(invitee.Username), Role: role, }, @@ -45,10 +45,10 @@ func inviteSpaceTestUser(ctx context.Context, t *testing.T, service *APIV1Servic return invitation } -func inviteAndAcceptSpaceTestUser(ctx context.Context, t *testing.T, service *APIV1Service, inviter, invitee *store.User, space *v1pb.Space, role v1pb.SpaceMember_Role) *v1pb.SpaceMember { +func inviteAndAcceptSpaceTestUser(ctx context.Context, t *testing.T, service *APIService, inviter, invitee *store.User, space *apipb.Space, role apipb.SpaceMember_Role) *apipb.SpaceMember { t.Helper() invitation := inviteSpaceTestUser(ctx, t, service, inviter, invitee, space, role) - membership, err := service.AcceptSpaceInvitation(userCtx(ctx, invitee.ID), &v1pb.AcceptSpaceInvitationRequest{Name: invitation.Name}) + membership, err := service.AcceptSpaceInvitation(userCtx(ctx, invitee.ID), &apipb.AcceptSpaceInvitationRequest{Name: invitation.Name}) require.NoError(t, err) return membership } @@ -59,9 +59,9 @@ func TestCreateSpaceGeneratesUUIDV4WhenSpaceUIDIsEmpty(t *testing.T) { owner := createSpaceTestUser(ctx, t, service, "space-id-owner", store.RoleUser) for _, spaceUID := range []string{"", " \t\n"} { - space, err := service.CreateSpace(userCtx(ctx, owner.ID), &v1pb.CreateSpaceRequest{ + space, err := service.CreateSpace(userCtx(ctx, owner.ID), &apipb.CreateSpaceRequest{ SpaceId: spaceUID, - Space: &v1pb.Space{Title: "Same title"}, + Space: &apipb.Space{Title: "Same title"}, }) require.NoError(t, err) @@ -81,99 +81,99 @@ func TestSpaceServiceMembershipVisibilityAndGovernance(t *testing.T) { member := createSpaceTestUser(ctx, t, service, "space-member", store.RoleUser) applicationAdmin := createSpaceTestUser(ctx, t, service, "application-admin", store.RoleAdmin) - space, err := service.CreateSpace(userCtx(ctx, owner.ID), &v1pb.CreateSpaceRequest{ + space, err := service.CreateSpace(userCtx(ctx, owner.ID), &apipb.CreateSpaceRequest{ SpaceId: "team-notes", - Space: &v1pb.Space{Title: " Team notes ", Description: " Shared work "}, + Space: &apipb.Space{Title: " Team notes ", Description: " Shared work "}, }) require.NoError(t, err) require.Equal(t, "spaces/team-notes", space.Name) require.Equal(t, "Team notes", space.Title) - require.Equal(t, v1pb.SpaceMember_ADMIN, space.CurrentUserRole) + require.Equal(t, apipb.SpaceMember_ADMIN, space.CurrentUserRole) require.Equal(t, int32(1), space.MemberCount) - _, err = service.CreateSpace(userCtx(ctx, owner.ID), &v1pb.CreateSpaceRequest{ + _, err = service.CreateSpace(userCtx(ctx, owner.ID), &apipb.CreateSpaceRequest{ SpaceId: "team-notes", - Space: &v1pb.Space{Title: "Duplicate"}, + Space: &apipb.Space{Title: "Duplicate"}, }) require.Equal(t, codes.AlreadyExists, status.Code(err)) - members, err := service.ListSpaceMembers(userCtx(ctx, owner.ID), &v1pb.ListSpaceMembersRequest{Parent: space.Name}) + members, err := service.ListSpaceMembers(userCtx(ctx, owner.ID), &apipb.ListSpaceMembersRequest{Parent: space.Name}) require.NoError(t, err) require.Len(t, members.SpaceMembers, 1) - require.Equal(t, v1pb.SpaceMember_ADMIN, members.SpaceMembers[0].Role) + require.Equal(t, apipb.SpaceMember_ADMIN, members.SpaceMembers[0].Role) - _, err = service.GetSpace(userCtx(ctx, applicationAdmin.ID), &v1pb.GetSpaceRequest{Name: space.Name}) + _, err = service.GetSpace(userCtx(ctx, applicationAdmin.ID), &apipb.GetSpaceRequest{Name: space.Name}) require.Equal(t, codes.NotFound, status.Code(err), "application ADMIN must not bypass space membership") - adminSpaces, err := service.ListSpaces(userCtx(ctx, applicationAdmin.ID), &v1pb.ListSpacesRequest{}) + adminSpaces, err := service.ListSpaces(userCtx(ctx, applicationAdmin.ID), &apipb.ListSpacesRequest{}) require.NoError(t, err) require.Empty(t, adminSpaces.Spaces) - invitation, err := service.CreateSpaceInvitation(userCtx(ctx, owner.ID), &v1pb.CreateSpaceInvitationRequest{ + invitation, err := service.CreateSpaceInvitation(userCtx(ctx, owner.ID), &apipb.CreateSpaceInvitationRequest{ Parent: space.Name, - SpaceInvitation: &v1pb.SpaceInvitation{Invitee: BuildUserName(member.Username), Role: v1pb.SpaceMember_USER}, + SpaceInvitation: &apipb.SpaceInvitation{Invitee: BuildUserName(member.Username), Role: apipb.SpaceMember_USER}, }) require.NoError(t, err) require.Equal(t, "spaces/team-notes/invitations/space-member", invitation.Name) require.Equal(t, space.Name, invitation.Space.Name, "the invitation must identify the Space without granting membership access") require.Equal(t, space.Title, invitation.Space.Title) require.Equal(t, space.Description, invitation.Space.Description) - require.Equal(t, v1pb.SpaceMember_ROLE_UNSPECIFIED, invitation.Space.CurrentUserRole) + require.Equal(t, apipb.SpaceMember_ROLE_UNSPECIFIED, invitation.Space.CurrentUserRole) require.Zero(t, invitation.Space.MemberCount) - _, err = service.GetSpace(userCtx(ctx, member.ID), &v1pb.GetSpaceRequest{Name: space.Name}) + _, err = service.GetSpace(userCtx(ctx, member.ID), &apipb.GetSpaceRequest{Name: space.Name}) require.Equal(t, codes.NotFound, status.Code(err), "a pending invitation must not grant Space access") - invitedUserSpaces, err := service.ListSpaces(userCtx(ctx, member.ID), &v1pb.ListSpacesRequest{}) + invitedUserSpaces, err := service.ListSpaces(userCtx(ctx, member.ID), &apipb.ListSpacesRequest{}) require.NoError(t, err) require.Empty(t, invitedUserSpaces.Spaces) - members, err = service.ListSpaceMembers(userCtx(ctx, owner.ID), &v1pb.ListSpaceMembersRequest{Parent: space.Name}) + members, err = service.ListSpaceMembers(userCtx(ctx, owner.ID), &apipb.ListSpaceMembersRequest{Parent: space.Name}) require.NoError(t, err) require.Len(t, members.SpaceMembers, 1, "an invitation must not appear as an active membership") - spaceInvitations, err := service.ListSpaceInvitations(userCtx(ctx, owner.ID), &v1pb.ListSpaceInvitationsRequest{Parent: space.Name}) + spaceInvitations, err := service.ListSpaceInvitations(userCtx(ctx, owner.ID), &apipb.ListSpaceInvitationsRequest{Parent: space.Name}) require.NoError(t, err) - require.Equal(t, []*v1pb.SpaceInvitation{invitation}, spaceInvitations.SpaceInvitations) - userInvitations, err := service.ListUserSpaceInvitations(userCtx(ctx, member.ID), &v1pb.ListUserSpaceInvitationsRequest{Parent: BuildUserName(member.Username)}) + require.Equal(t, []*apipb.SpaceInvitation{invitation}, spaceInvitations.SpaceInvitations) + userInvitations, err := service.ListUserSpaceInvitations(userCtx(ctx, member.ID), &apipb.ListUserSpaceInvitationsRequest{Parent: BuildUserName(member.Username)}) require.NoError(t, err) - require.Equal(t, []*v1pb.SpaceInvitation{invitation}, userInvitations.SpaceInvitations) + require.Equal(t, []*apipb.SpaceInvitation{invitation}, userInvitations.SpaceInvitations) - _, err = service.CreateSpaceInvitation(userCtx(ctx, owner.ID), &v1pb.CreateSpaceInvitationRequest{ + _, err = service.CreateSpaceInvitation(userCtx(ctx, owner.ID), &apipb.CreateSpaceInvitationRequest{ Parent: space.Name, - SpaceInvitation: &v1pb.SpaceInvitation{Invitee: BuildUserName(member.Username), Role: v1pb.SpaceMember_USER}, + SpaceInvitation: &apipb.SpaceInvitation{Invitee: BuildUserName(member.Username), Role: apipb.SpaceMember_USER}, }) require.Equal(t, codes.AlreadyExists, status.Code(err)) - _, err = service.AcceptSpaceInvitation(userCtx(ctx, owner.ID), &v1pb.AcceptSpaceInvitationRequest{Name: invitation.Name}) + _, err = service.AcceptSpaceInvitation(userCtx(ctx, owner.ID), &apipb.AcceptSpaceInvitationRequest{Name: invitation.Name}) require.Equal(t, codes.PermissionDenied, status.Code(err), "an administrator cannot accept for the invitee") - createdMember, err := service.AcceptSpaceInvitation(userCtx(ctx, member.ID), &v1pb.AcceptSpaceInvitationRequest{Name: invitation.Name}) + createdMember, err := service.AcceptSpaceInvitation(userCtx(ctx, member.ID), &apipb.AcceptSpaceInvitationRequest{Name: invitation.Name}) require.NoError(t, err) require.Equal(t, "spaces/team-notes/members/space-member", createdMember.Name) - require.Equal(t, v1pb.SpaceMember_USER, createdMember.Role) - _, err = service.GetSpaceInvitation(userCtx(ctx, owner.ID), &v1pb.GetSpaceInvitationRequest{Name: invitation.Name}) + require.Equal(t, apipb.SpaceMember_USER, createdMember.Role) + _, err = service.GetSpaceInvitation(userCtx(ctx, owner.ID), &apipb.GetSpaceInvitationRequest{Name: invitation.Name}) require.Equal(t, codes.NotFound, status.Code(err)) - memberSpace, err := service.GetSpace(userCtx(ctx, member.ID), &v1pb.GetSpaceRequest{Name: space.Name}) + memberSpace, err := service.GetSpace(userCtx(ctx, member.ID), &apipb.GetSpaceRequest{Name: space.Name}) require.NoError(t, err) - require.Equal(t, v1pb.SpaceMember_USER, memberSpace.CurrentUserRole) + require.Equal(t, apipb.SpaceMember_USER, memberSpace.CurrentUserRole) require.Equal(t, int32(2), memberSpace.MemberCount) - memberSpaces, err := service.ListSpaces(userCtx(ctx, member.ID), &v1pb.ListSpacesRequest{}) + memberSpaces, err := service.ListSpaces(userCtx(ctx, member.ID), &apipb.ListSpacesRequest{}) require.NoError(t, err) require.Len(t, memberSpaces.Spaces, 1) - require.Equal(t, v1pb.SpaceMember_USER, memberSpaces.Spaces[0].CurrentUserRole) + require.Equal(t, apipb.SpaceMember_USER, memberSpaces.Spaces[0].CurrentUserRole) require.Equal(t, int32(2), memberSpaces.Spaces[0].MemberCount) - updatedSpace, err := service.UpdateSpace(userCtx(ctx, owner.ID), &v1pb.UpdateSpaceRequest{ - Space: &v1pb.Space{Name: space.Name, Title: "Updated team notes"}, + updatedSpace, err := service.UpdateSpace(userCtx(ctx, owner.ID), &apipb.UpdateSpaceRequest{ + Space: &apipb.Space{Name: space.Name, Title: "Updated team notes"}, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"title"}}, }) require.NoError(t, err) - require.Equal(t, v1pb.SpaceMember_ADMIN, updatedSpace.CurrentUserRole) + require.Equal(t, apipb.SpaceMember_ADMIN, updatedSpace.CurrentUserRole) require.Equal(t, int32(2), updatedSpace.MemberCount) - _, err = service.UpdateSpace(userCtx(ctx, member.ID), &v1pb.UpdateSpaceRequest{ - Space: &v1pb.Space{Name: space.Name, Title: "not allowed"}, + _, err = service.UpdateSpace(userCtx(ctx, member.ID), &apipb.UpdateSpaceRequest{ + Space: &apipb.Space{Name: space.Name, Title: "not allowed"}, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"title"}}, }) require.Equal(t, codes.PermissionDenied, status.Code(err)) - _, err = service.UpdateSpaceMember(userCtx(ctx, owner.ID), &v1pb.UpdateSpaceMemberRequest{ - SpaceMember: &v1pb.SpaceMember{Name: "spaces/team-notes/members/space-owner", Role: v1pb.SpaceMember_USER}, + _, err = service.UpdateSpaceMember(userCtx(ctx, owner.ID), &apipb.UpdateSpaceMemberRequest{ + SpaceMember: &apipb.SpaceMember{Name: "spaces/team-notes/members/space-owner", Role: apipb.SpaceMember_USER}, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"role"}}, }) require.Equal(t, codes.FailedPrecondition, status.Code(err), "the last active ADMIN cannot be demoted") @@ -187,61 +187,61 @@ func TestSpaceInvitationDeclineRevokeAndSelectedRole(t *testing.T) { secondInvitee := createSpaceTestUser(ctx, t, service, "invitation-second", store.RoleUser) archivedInvitee := createSpaceTestUser(ctx, t, service, "invitation-archived", store.RoleUser) pendingThenArchived := createSpaceTestUser(ctx, t, service, "invitation-pending-archived", store.RoleUser) - space, err := service.CreateSpace(userCtx(ctx, owner.ID), &v1pb.CreateSpaceRequest{ + space, err := service.CreateSpace(userCtx(ctx, owner.ID), &apipb.CreateSpaceRequest{ SpaceId: "invitation-lifecycle", - Space: &v1pb.Space{Title: "Invitation lifecycle"}, + Space: &apipb.Space{Title: "Invitation lifecycle"}, }) require.NoError(t, err) - invitation := inviteSpaceTestUser(ctx, t, service, owner, invitee, space, v1pb.SpaceMember_ADMIN) - got, err := service.GetSpaceInvitation(userCtx(ctx, invitee.ID), &v1pb.GetSpaceInvitationRequest{Name: invitation.Name}) + invitation := inviteSpaceTestUser(ctx, t, service, owner, invitee, space, apipb.SpaceMember_ADMIN) + got, err := service.GetSpaceInvitation(userCtx(ctx, invitee.ID), &apipb.GetSpaceInvitationRequest{Name: invitation.Name}) require.NoError(t, err) - require.Equal(t, v1pb.SpaceMember_ADMIN, got.Role) - _, err = service.DeleteSpaceInvitation(userCtx(ctx, invitee.ID), &v1pb.DeleteSpaceInvitationRequest{Name: invitation.Name}) + require.Equal(t, apipb.SpaceMember_ADMIN, got.Role) + _, err = service.DeleteSpaceInvitation(userCtx(ctx, invitee.ID), &apipb.DeleteSpaceInvitationRequest{Name: invitation.Name}) require.Equal(t, codes.PermissionDenied, status.Code(err), "the invitee cannot revoke an invitation") - _, err = service.DeleteSpaceInvitation(userCtx(ctx, owner.ID), &v1pb.DeleteSpaceInvitationRequest{Name: invitation.Name}) + _, err = service.DeleteSpaceInvitation(userCtx(ctx, owner.ID), &apipb.DeleteSpaceInvitationRequest{Name: invitation.Name}) require.NoError(t, err) - _, err = service.AcceptSpaceInvitation(userCtx(ctx, invitee.ID), &v1pb.AcceptSpaceInvitationRequest{Name: invitation.Name}) + _, err = service.AcceptSpaceInvitation(userCtx(ctx, invitee.ID), &apipb.AcceptSpaceInvitationRequest{Name: invitation.Name}) require.Equal(t, codes.NotFound, status.Code(err), "a revoked invitation cannot be accepted") - invitation = inviteSpaceTestUser(ctx, t, service, owner, invitee, space, v1pb.SpaceMember_ADMIN) - _, err = service.DeclineSpaceInvitation(userCtx(ctx, invitee.ID), &v1pb.DeclineSpaceInvitationRequest{Name: invitation.Name}) + invitation = inviteSpaceTestUser(ctx, t, service, owner, invitee, space, apipb.SpaceMember_ADMIN) + _, err = service.DeclineSpaceInvitation(userCtx(ctx, invitee.ID), &apipb.DeclineSpaceInvitationRequest{Name: invitation.Name}) require.NoError(t, err) - _, err = service.GetSpaceInvitation(userCtx(ctx, owner.ID), &v1pb.GetSpaceInvitationRequest{Name: invitation.Name}) + _, err = service.GetSpaceInvitation(userCtx(ctx, owner.ID), &apipb.GetSpaceInvitationRequest{Name: invitation.Name}) require.Equal(t, codes.NotFound, status.Code(err)) - invitation = inviteSpaceTestUser(ctx, t, service, owner, invitee, space, v1pb.SpaceMember_ADMIN) - membership, err := service.AcceptSpaceInvitation(userCtx(ctx, invitee.ID), &v1pb.AcceptSpaceInvitationRequest{Name: invitation.Name}) + invitation = inviteSpaceTestUser(ctx, t, service, owner, invitee, space, apipb.SpaceMember_ADMIN) + membership, err := service.AcceptSpaceInvitation(userCtx(ctx, invitee.ID), &apipb.AcceptSpaceInvitationRequest{Name: invitation.Name}) require.NoError(t, err) - require.Equal(t, v1pb.SpaceMember_ADMIN, membership.Role, "accept must preserve the role selected at invite time") + require.Equal(t, apipb.SpaceMember_ADMIN, membership.Role, "accept must preserve the role selected at invite time") - secondInvitation := inviteSpaceTestUser(ctx, t, service, owner, secondInvitee, space, v1pb.SpaceMember_USER) - listed, err := service.ListSpaceInvitations(userCtx(ctx, invitee.ID), &v1pb.ListSpaceInvitationsRequest{Parent: space.Name}) + secondInvitation := inviteSpaceTestUser(ctx, t, service, owner, secondInvitee, space, apipb.SpaceMember_USER) + listed, err := service.ListSpaceInvitations(userCtx(ctx, invitee.ID), &apipb.ListSpaceInvitationsRequest{Parent: space.Name}) require.NoError(t, err, "any active Space administrator may manage invitations") - require.Equal(t, []*v1pb.SpaceInvitation{secondInvitation}, listed.SpaceInvitations) - _, err = service.AcceptSpaceInvitation(userCtx(ctx, invitee.ID), &v1pb.AcceptSpaceInvitationRequest{Name: secondInvitation.Name}) + require.Equal(t, []*apipb.SpaceInvitation{secondInvitation}, listed.SpaceInvitations) + _, err = service.AcceptSpaceInvitation(userCtx(ctx, invitee.ID), &apipb.AcceptSpaceInvitationRequest{Name: secondInvitation.Name}) require.Equal(t, codes.PermissionDenied, status.Code(err), "an administrator cannot accept for another user") - _, err = service.DeleteSpaceInvitation(userCtx(ctx, invitee.ID), &v1pb.DeleteSpaceInvitationRequest{Name: secondInvitation.Name}) + _, err = service.DeleteSpaceInvitation(userCtx(ctx, invitee.ID), &apipb.DeleteSpaceInvitationRequest{Name: secondInvitation.Name}) require.NoError(t, err) - pendingArchivedInvitation := inviteSpaceTestUser(ctx, t, service, owner, pendingThenArchived, space, v1pb.SpaceMember_USER) + pendingArchivedInvitation := inviteSpaceTestUser(ctx, t, service, owner, pendingThenArchived, space, apipb.SpaceMember_USER) archived := store.Archived _, err = service.Store.UpdateUser(ctx, &store.UpdateUser{ID: pendingThenArchived.ID, RowStatus: &archived}) require.NoError(t, err, "a pending invitation is not an active membership and must not prevent archival") - listed, err = service.ListSpaceInvitations(userCtx(ctx, owner.ID), &v1pb.ListSpaceInvitationsRequest{Parent: space.Name}) + listed, err = service.ListSpaceInvitations(userCtx(ctx, owner.ID), &apipb.ListSpaceInvitationsRequest{Parent: space.Name}) require.NoError(t, err) - require.Equal(t, []*v1pb.SpaceInvitation{pendingArchivedInvitation}, listed.SpaceInvitations, "administrators must retain a way to revoke invitations for archived users") - _, err = service.AcceptSpaceInvitation(userCtx(ctx, pendingThenArchived.ID), &v1pb.AcceptSpaceInvitationRequest{Name: pendingArchivedInvitation.Name}) + require.Equal(t, []*apipb.SpaceInvitation{pendingArchivedInvitation}, listed.SpaceInvitations, "administrators must retain a way to revoke invitations for archived users") + _, err = service.AcceptSpaceInvitation(userCtx(ctx, pendingThenArchived.ID), &apipb.AcceptSpaceInvitationRequest{Name: pendingArchivedInvitation.Name}) require.Equal(t, codes.Unauthenticated, status.Code(err), "an archived user cannot accept an invitation") - _, err = service.DeleteSpaceInvitation(userCtx(ctx, owner.ID), &v1pb.DeleteSpaceInvitationRequest{Name: pendingArchivedInvitation.Name}) + _, err = service.DeleteSpaceInvitation(userCtx(ctx, owner.ID), &apipb.DeleteSpaceInvitationRequest{Name: pendingArchivedInvitation.Name}) require.NoError(t, err) _, err = service.Store.UpdateUser(ctx, &store.UpdateUser{ID: archivedInvitee.ID, RowStatus: &archived}) require.NoError(t, err) - _, err = service.CreateSpaceInvitation(userCtx(ctx, owner.ID), &v1pb.CreateSpaceInvitationRequest{ + _, err = service.CreateSpaceInvitation(userCtx(ctx, owner.ID), &apipb.CreateSpaceInvitationRequest{ Parent: space.Name, - SpaceInvitation: &v1pb.SpaceInvitation{Invitee: BuildUserName(archivedInvitee.Username), Role: v1pb.SpaceMember_USER}, + SpaceInvitation: &apipb.SpaceInvitation{Invitee: BuildUserName(archivedInvitee.Username), Role: apipb.SpaceMember_USER}, }) require.Equal(t, codes.FailedPrecondition, status.Code(err), "only NORMAL users can be invited") } @@ -253,9 +253,9 @@ func TestSpaceServiceHardDeleteLifecycle(t *testing.T) { target := createSpaceTestUser(ctx, t, service, "delete-target", store.RoleUser) applicationAdmin := createSpaceTestUser(ctx, t, service, "delete-application-admin", store.RoleAdmin) - space, err := service.CreateSpace(userCtx(ctx, owner.ID), &v1pb.CreateSpaceRequest{ + space, err := service.CreateSpace(userCtx(ctx, owner.ID), &apipb.CreateSpaceRequest{ SpaceId: "delete-space", - Space: &v1pb.Space{Title: "Delete me"}, + Space: &apipb.Space{Title: "Delete me"}, }) require.NoError(t, err) spaceUID, err := ExtractSpaceUIDFromName(space.Name) @@ -283,25 +283,25 @@ func TestSpaceServiceHardDeleteLifecycle(t *testing.T) { Payload: &storepb.AttachmentPayload{}, }) require.NoError(t, err) - inviteAndAcceptSpaceTestUser(ctx, t, service, owner, target, space, v1pb.SpaceMember_USER) + inviteAndAcceptSpaceTestUser(ctx, t, service, owner, target, space, apipb.SpaceMember_USER) - _, err = service.UpdateSpace(userCtx(ctx, owner.ID), &v1pb.UpdateSpaceRequest{ - Space: &v1pb.Space{Name: space.Name}, + _, err = service.UpdateSpace(userCtx(ctx, owner.ID), &apipb.UpdateSpaceRequest{ + Space: &apipb.Space{Name: space.Name}, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"state"}}, }) require.Equal(t, codes.InvalidArgument, status.Code(err), "Space has no archive or restore state") - _, err = service.DeleteSpace(userCtx(ctx, target.ID), &v1pb.DeleteSpaceRequest{Name: space.Name}) + _, err = service.DeleteSpace(userCtx(ctx, target.ID), &apipb.DeleteSpaceRequest{Name: space.Name}) require.Equal(t, codes.PermissionDenied, status.Code(err)) - _, err = service.DeleteSpace(userCtx(ctx, applicationAdmin.ID), &v1pb.DeleteSpaceRequest{Name: space.Name}) + _, err = service.DeleteSpace(userCtx(ctx, applicationAdmin.ID), &apipb.DeleteSpaceRequest{Name: space.Name}) require.Equal(t, codes.NotFound, status.Code(err), "application ADMIN must not bypass Space membership") - _, err = service.DeleteSpace(userCtx(ctx, owner.ID), &v1pb.DeleteSpaceRequest{Name: space.Name}) + _, err = service.DeleteSpace(userCtx(ctx, owner.ID), &apipb.DeleteSpaceRequest{Name: space.Name}) require.NoError(t, err) require.NoFileExists(t, attachmentPath) - _, err = service.GetSpace(userCtx(ctx, owner.ID), &v1pb.GetSpaceRequest{Name: space.Name}) + _, err = service.GetSpace(userCtx(ctx, owner.ID), &apipb.GetSpaceRequest{Name: space.Name}) require.Equal(t, codes.NotFound, status.Code(err)) - spaces, err := service.ListSpaces(userCtx(ctx, owner.ID), &v1pb.ListSpacesRequest{}) + spaces, err := service.ListSpaces(userCtx(ctx, owner.ID), &apipb.ListSpacesRequest{}) require.NoError(t, err) require.Empty(t, spaces.Spaces) } @@ -312,24 +312,24 @@ func TestSpaceServiceHidesMembershipForInactiveUser(t *testing.T) { owner := createSpaceTestUser(ctx, t, service, "inactive-member-owner", store.RoleUser) member := createSpaceTestUser(ctx, t, service, "inactive-member", store.RoleUser) - space, err := service.CreateSpace(userCtx(ctx, owner.ID), &v1pb.CreateSpaceRequest{ + space, err := service.CreateSpace(userCtx(ctx, owner.ID), &apipb.CreateSpaceRequest{ SpaceId: "inactive-member-space", - Space: &v1pb.Space{Title: "Inactive member space"}, + Space: &apipb.Space{Title: "Inactive member space"}, }) require.NoError(t, err) - inviteAndAcceptSpaceTestUser(ctx, t, service, owner, member, space, v1pb.SpaceMember_USER) + inviteAndAcceptSpaceTestUser(ctx, t, service, owner, member, space, apipb.SpaceMember_USER) // The normal archive path rejects users with memberships. Simulate an // inconsistent row to verify that membership reads still fail closed. _, err = service.Store.GetDriver().GetDB().ExecContext(ctx, "UPDATE user SET row_status = 'ARCHIVED' WHERE id = ?", member.ID) require.NoError(t, err) - members, err := service.ListSpaceMembers(userCtx(ctx, owner.ID), &v1pb.ListSpaceMembersRequest{Parent: space.Name}) + members, err := service.ListSpaceMembers(userCtx(ctx, owner.ID), &apipb.ListSpaceMembersRequest{Parent: space.Name}) require.NoError(t, err) require.Len(t, members.SpaceMembers, 1) require.Equal(t, BuildUserName(owner.Username), members.SpaceMembers[0].User) - _, err = service.GetSpaceMember(userCtx(ctx, owner.ID), &v1pb.GetSpaceMemberRequest{ + _, err = service.GetSpaceMember(userCtx(ctx, owner.ID), &apipb.GetSpaceMemberRequest{ Name: buildSpaceMemberName("inactive-member-space", member.Username), }) require.Equal(t, codes.NotFound, status.Code(err)) @@ -341,18 +341,18 @@ func TestUpdateSpaceMemberAcceptsGatewayInferredIdentityMask(t *testing.T) { owner := createSpaceTestUser(ctx, t, service, "gateway-owner", store.RoleUser) member := createSpaceTestUser(ctx, t, service, "gateway-member", store.RoleUser) - space, err := service.CreateSpace(userCtx(ctx, owner.ID), &v1pb.CreateSpaceRequest{ + space, err := service.CreateSpace(userCtx(ctx, owner.ID), &apipb.CreateSpaceRequest{ SpaceId: "gateway-space", - Space: &v1pb.Space{Title: "Gateway Space"}, + Space: &apipb.Space{Title: "Gateway Space"}, }) require.NoError(t, err) - createdMember := inviteAndAcceptSpaceTestUser(ctx, t, service, owner, member, space, v1pb.SpaceMember_USER) + createdMember := inviteAndAcceptSpaceTestUser(ctx, t, service, owner, member, space, apipb.SpaceMember_USER) mux := runtime.NewServeMux() - require.NoError(t, v1pb.RegisterSpaceServiceHandlerServer(ctx, mux, service)) + require.NoError(t, apipb.RegisterSpaceServiceHandlerServer(ctx, mux, service)) patchMember := func(body string) *httptest.ResponseRecorder { t.Helper() - request := httptest.NewRequest(http.MethodPatch, "/api/v1/"+createdMember.Name, strings.NewReader(body)) + request := httptest.NewRequest(http.MethodPatch, "/api/"+createdMember.Name, strings.NewReader(body)) request.Header.Set("Content-Type", "application/json") request = request.WithContext(userCtx(request.Context(), owner.ID)) response := httptest.NewRecorder() @@ -386,15 +386,15 @@ func TestCreateSpaceInvitationClassifiesTargetUserErrors(t *testing.T) { service := newIntegrationService(t) owner := createSpaceTestUser(ctx, t, service, "lookup-owner", store.RoleUser) target := createSpaceTestUser(ctx, t, service, "lookup-target", store.RoleUser) - space, err := service.CreateSpace(userCtx(ctx, owner.ID), &v1pb.CreateSpaceRequest{ + space, err := service.CreateSpace(userCtx(ctx, owner.ID), &apipb.CreateSpaceRequest{ SpaceId: "lookup-space", - Space: &v1pb.Space{Title: "Lookup Space"}, + Space: &apipb.Space{Title: "Lookup Space"}, }) require.NoError(t, err) - _, err = service.CreateSpaceInvitation(userCtx(ctx, owner.ID), &v1pb.CreateSpaceInvitationRequest{ + _, err = service.CreateSpaceInvitation(userCtx(ctx, owner.ID), &apipb.CreateSpaceInvitationRequest{ Parent: space.Name, - SpaceInvitation: &v1pb.SpaceInvitation{Invitee: "invalid-user-name", Role: v1pb.SpaceMember_USER}, + SpaceInvitation: &apipb.SpaceInvitation{Invitee: "invalid-user-name", Role: apipb.SpaceMember_USER}, }) require.Equal(t, codes.InvalidArgument, status.Code(err)) @@ -403,20 +403,20 @@ func TestCreateSpaceInvitationClassifiesTargetUserErrors(t *testing.T) { // require the target lookup failure to remain a server error. _, err = service.Store.GetDriver().GetDB().ExecContext(ctx, "UPDATE user SET created_ts = ? WHERE id = ?", "not-an-integer", target.ID) require.NoError(t, err) - _, err = service.CreateSpaceInvitation(userCtx(ctx, owner.ID), &v1pb.CreateSpaceInvitationRequest{ + _, err = service.CreateSpaceInvitation(userCtx(ctx, owner.ID), &apipb.CreateSpaceInvitationRequest{ Parent: space.Name, - SpaceInvitation: &v1pb.SpaceInvitation{Invitee: BuildUserName(target.Username), Role: v1pb.SpaceMember_USER}, + SpaceInvitation: &apipb.SpaceInvitation{Invitee: BuildUserName(target.Username), Role: apipb.SpaceMember_USER}, }) require.Equal(t, codes.Internal, status.Code(err)) } -func listSpaceInvitationNotifications(ctx context.Context, t *testing.T, service *APIV1Service, user *store.User) []*v1pb.UserNotification { +func listSpaceInvitationNotifications(ctx context.Context, t *testing.T, service *APIService, user *store.User) []*apipb.UserNotification { t.Helper() - response, err := service.ListUserNotifications(userCtx(ctx, user.ID), &v1pb.ListUserNotificationsRequest{Parent: BuildUserName(user.Username)}) + response, err := service.ListUserNotifications(userCtx(ctx, user.ID), &apipb.ListUserNotificationsRequest{Parent: BuildUserName(user.Username)}) require.NoError(t, err) - notifications := []*v1pb.UserNotification{} + notifications := []*apipb.UserNotification{} for _, notification := range response.Notifications { - if notification.Type == v1pb.UserNotification_SPACE_INVITATION { + if notification.Type == apipb.UserNotification_SPACE_INVITATION { notifications = append(notifications, notification) } } @@ -428,74 +428,74 @@ func TestSpaceInvitationNotificationLifecycle(t *testing.T) { service := newIntegrationService(t) owner := createSpaceTestUser(ctx, t, service, "notification-owner", store.RoleUser) invitee := createSpaceTestUser(ctx, t, service, "notification-invitee", store.RoleUser) - space, err := service.CreateSpace(userCtx(ctx, owner.ID), &v1pb.CreateSpaceRequest{ + space, err := service.CreateSpace(userCtx(ctx, owner.ID), &apipb.CreateSpaceRequest{ SpaceId: "notification-lifecycle", - Space: &v1pb.Space{Title: "Notification lifecycle", Description: "Inbox coverage"}, + Space: &apipb.Space{Title: "Notification lifecycle", Description: "Inbox coverage"}, }) require.NoError(t, err) - invitation := inviteSpaceTestUser(ctx, t, service, owner, invitee, space, v1pb.SpaceMember_USER) + invitation := inviteSpaceTestUser(ctx, t, service, owner, invitee, space, apipb.SpaceMember_USER) notifications := listSpaceInvitationNotifications(ctx, t, service, invitee) require.Len(t, notifications, 1, "inviting a user must notify their inbox") notification := notifications[0] - require.Equal(t, v1pb.UserNotification_UNREAD, notification.Status) + require.Equal(t, apipb.UserNotification_UNREAD, notification.Status) require.Equal(t, BuildUserName(owner.Username), notification.Sender) payload := notification.GetSpaceInvitation() require.NotNil(t, payload) require.Equal(t, invitation.Name, payload.SpaceInvitation) - require.Equal(t, v1pb.UserNotification_SpaceInvitationPayload_PENDING, payload.State) - require.Equal(t, v1pb.SpaceMember_USER, payload.Role) + require.Equal(t, apipb.UserNotification_SpaceInvitationPayload_PENDING, payload.State) + require.Equal(t, apipb.SpaceMember_USER, payload.Role) require.Equal(t, space.Name, payload.Space.GetName()) require.Equal(t, "Notification lifecycle", payload.Space.GetTitle()) require.Equal(t, "Inbox coverage", payload.Space.GetDescription()) - require.Equal(t, v1pb.SpaceMember_ROLE_UNSPECIFIED, payload.Space.GetCurrentUserRole(), "an invitation carries a metadata-only Space summary") + require.Equal(t, apipb.SpaceMember_ROLE_UNSPECIFIED, payload.Space.GetCurrentUserRole(), "an invitation carries a metadata-only Space summary") require.Empty(t, listSpaceInvitationNotifications(ctx, t, service, owner), "the inviter receives no notification") - _, err = service.DeclineSpaceInvitation(userCtx(ctx, invitee.ID), &v1pb.DeclineSpaceInvitationRequest{Name: invitation.Name}) + _, err = service.DeclineSpaceInvitation(userCtx(ctx, invitee.ID), &apipb.DeclineSpaceInvitationRequest{Name: invitation.Name}) require.NoError(t, err) require.Empty(t, listSpaceInvitationNotifications(ctx, t, service, invitee), "declining removes the notification") - invitation = inviteSpaceTestUser(ctx, t, service, owner, invitee, space, v1pb.SpaceMember_ADMIN) + invitation = inviteSpaceTestUser(ctx, t, service, owner, invitee, space, apipb.SpaceMember_ADMIN) require.Len(t, listSpaceInvitationNotifications(ctx, t, service, invitee), 1, "a later invitation notifies again") - _, err = service.DeleteSpaceInvitation(userCtx(ctx, owner.ID), &v1pb.DeleteSpaceInvitationRequest{Name: invitation.Name}) + _, err = service.DeleteSpaceInvitation(userCtx(ctx, owner.ID), &apipb.DeleteSpaceInvitationRequest{Name: invitation.Name}) require.NoError(t, err) require.Empty(t, listSpaceInvitationNotifications(ctx, t, service, invitee), "revoking removes the notification") - invitation = inviteSpaceTestUser(ctx, t, service, owner, invitee, space, v1pb.SpaceMember_ADMIN) + invitation = inviteSpaceTestUser(ctx, t, service, owner, invitee, space, apipb.SpaceMember_ADMIN) notifications = listSpaceInvitationNotifications(ctx, t, service, invitee) require.Len(t, notifications, 1) pending := notifications[0] - archived, err := service.UpdateUserNotification(userCtx(ctx, invitee.ID), &v1pb.UpdateUserNotificationRequest{ - Notification: &v1pb.UserNotification{Name: pending.Name, Status: v1pb.UserNotification_ARCHIVED}, + archived, err := service.UpdateUserNotification(userCtx(ctx, invitee.ID), &apipb.UpdateUserNotificationRequest{ + Notification: &apipb.UserNotification{Name: pending.Name, Status: apipb.UserNotification_ARCHIVED}, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"status"}}, }) require.NoError(t, err, "the invitee may archive a pending invitation notification without acting on it") - require.Equal(t, v1pb.UserNotification_SpaceInvitationPayload_PENDING, archived.GetSpaceInvitation().GetState()) + require.Equal(t, apipb.UserNotification_SpaceInvitationPayload_PENDING, archived.GetSpaceInvitation().GetState()) - _, err = service.AcceptSpaceInvitation(userCtx(ctx, invitee.ID), &v1pb.AcceptSpaceInvitationRequest{Name: invitation.Name}) + _, err = service.AcceptSpaceInvitation(userCtx(ctx, invitee.ID), &apipb.AcceptSpaceInvitationRequest{Name: invitation.Name}) require.NoError(t, err) notifications = listSpaceInvitationNotifications(ctx, t, service, invitee) require.Len(t, notifications, 1, "accepting keeps the notification as history") accepted := notifications[0] - require.Equal(t, v1pb.UserNotification_ARCHIVED, accepted.Status, "accepting resolves the notification") - require.Equal(t, v1pb.UserNotification_SpaceInvitationPayload_ACCEPTED, accepted.GetSpaceInvitation().GetState()) - require.Equal(t, v1pb.SpaceMember_ADMIN, accepted.GetSpaceInvitation().GetRole(), "the accepted state reflects the granted role") + require.Equal(t, apipb.UserNotification_ARCHIVED, accepted.Status, "accepting resolves the notification") + require.Equal(t, apipb.UserNotification_SpaceInvitationPayload_ACCEPTED, accepted.GetSpaceInvitation().GetState()) + require.Equal(t, apipb.SpaceMember_ADMIN, accepted.GetSpaceInvitation().GetRole(), "the accepted state reflects the granted role") - _, err = service.DeleteSpaceMember(userCtx(ctx, invitee.ID), &v1pb.DeleteSpaceMemberRequest{Name: buildSpaceMemberName("notification-lifecycle", invitee.Username)}) + _, err = service.DeleteSpaceMember(userCtx(ctx, invitee.ID), &apipb.DeleteSpaceMemberRequest{Name: buildSpaceMemberName("notification-lifecycle", invitee.Username)}) require.NoError(t, err) require.Empty(t, listSpaceInvitationNotifications(ctx, t, service, invitee), "leaving the Space hides the accepted notification") - _, err = service.UpdateUserNotification(userCtx(ctx, invitee.ID), &v1pb.UpdateUserNotificationRequest{ - Notification: &v1pb.UserNotification{Name: accepted.Name, Status: v1pb.UserNotification_UNREAD}, + _, err = service.UpdateUserNotification(userCtx(ctx, invitee.ID), &apipb.UpdateUserNotificationRequest{ + Notification: &apipb.UserNotification{Name: accepted.Name, Status: apipb.UserNotification_UNREAD}, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"status"}}, }) require.Equal(t, codes.NotFound, status.Code(err), "a hidden notification cannot be updated") - invitation = inviteSpaceTestUser(ctx, t, service, owner, invitee, space, v1pb.SpaceMember_USER) - _, err = service.AcceptSpaceInvitation(userCtx(ctx, invitee.ID), &v1pb.AcceptSpaceInvitationRequest{Name: invitation.Name}) + invitation = inviteSpaceTestUser(ctx, t, service, owner, invitee, space, apipb.SpaceMember_USER) + _, err = service.AcceptSpaceInvitation(userCtx(ctx, invitee.ID), &apipb.AcceptSpaceInvitationRequest{Name: invitation.Name}) require.NoError(t, err) require.Len(t, listSpaceInvitationNotifications(ctx, t, service, invitee), 2, "re-joining reveals every accepted notification for the Space") - _, err = service.DeleteSpace(userCtx(ctx, owner.ID), &v1pb.DeleteSpaceRequest{Name: space.Name}) + _, err = service.DeleteSpace(userCtx(ctx, owner.ID), &apipb.DeleteSpaceRequest{Name: space.Name}) require.NoError(t, err) require.Empty(t, listSpaceInvitationNotifications(ctx, t, service, invitee), "deleting the Space hides its notifications") } diff --git a/server/api/v1/sse_handler.go b/server/api/sse_handler.go similarity index 98% rename from server/api/v1/sse_handler.go rename to server/api/sse_handler.go index 274f2827c..80125014d 100644 --- a/server/api/v1/sse_handler.go +++ b/server/api/sse_handler.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "io" @@ -26,7 +26,7 @@ type sseRouteRegistrar interface { // RegisterSSERoutes registers the SSE endpoint on the given Echo router. func RegisterSSERoutes(router sseRouteRegistrar, hub *SSEHub, storeInstance *store.Store, secret string) { authenticator := auth.NewAuthenticator(storeInstance, secret) - router.GET("/api/v1/sse", func(c *echo.Context) error { + router.GET("/api/sse", func(c *echo.Context) error { return handleSSE(c, hub, authenticator) }) } diff --git a/server/api/v1/sse_hub.go b/server/api/sse_hub.go similarity index 99% rename from server/api/v1/sse_hub.go rename to server/api/sse_hub.go index e624dbc0d..772d3901b 100644 --- a/server/api/v1/sse_hub.go +++ b/server/api/sse_hub.go @@ -1,4 +1,4 @@ -package v1 +package api import "sync" diff --git a/server/api/v1/sse_hub_test.go b/server/api/sse_hub_test.go similarity index 99% rename from server/api/v1/sse_hub_test.go rename to server/api/sse_hub_test.go index 06f01ebf6..a95c27e64 100644 --- a/server/api/v1/sse_hub_test.go +++ b/server/api/sse_hub_test.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "sync" diff --git a/server/api/v1/sse_service_test.go b/server/api/sse_service_test.go similarity index 72% rename from server/api/v1/sse_service_test.go rename to server/api/sse_service_test.go index 638718018..fe53635e2 100644 --- a/server/api/v1/sse_service_test.go +++ b/server/api/sse_service_test.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "context" @@ -15,22 +15,22 @@ import ( "google.golang.org/protobuf/types/known/fieldmaskpb" "github.com/usememos/memos/internal/profile" - v1pb "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" storepb "github.com/usememos/memos/proto/gen/store" "github.com/usememos/memos/server/auth" "github.com/usememos/memos/store" teststore "github.com/usememos/memos/store/test" ) -// newIntegrationService builds a minimal APIV1Service backed by an in-memory +// newIntegrationService builds a minimal APIService backed by an in-memory // SQLite database. The store is closed automatically via t.Cleanup. -func newIntegrationService(t *testing.T) *APIV1Service { +func newIntegrationService(t *testing.T) *APIService { t.Helper() ctx := context.Background() st := teststore.NewTestingStore(ctx, t) t.Cleanup(func() { st.Close() }) p := &profile.Profile{Demo: true, Data: t.TempDir(), Driver: "sqlite", DSN: ":memory:"} - return NewAPIV1Service("test-secret", p, st) + return NewAPIService("test-secret", p, st) } // userCtx returns a context that authenticates as the given user. @@ -76,16 +76,16 @@ func TestAttachmentMutationsPublishMemoChangedOnlyWhenBound(t *testing.T) { svc := newIntegrationService(t) owner := createSpaceTestUser(ctx, t, svc, "sse-attachment-owner", store.RoleUser) ownerCtx := userCtx(ctx, owner.ID) - memo, err := svc.CreateMemo(ownerCtx, &v1pb.CreateMemoRequest{ - Memo: &v1pb.Memo{Content: "attachment event memo", Visibility: v1pb.Visibility_PRIVATE}, + memo, err := svc.CreateMemo(ownerCtx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{Content: "attachment event memo", Visibility: apipb.Visibility_PRIVATE}, }) require.NoError(t, err) client := svc.SSEHub.Subscribe() defer svc.SSEHub.Unsubscribe(client) - createAttachment := func(filename string, memoName *string) *v1pb.Attachment { + createAttachment := func(filename string, memoName *string) *apipb.Attachment { t.Helper() - attachment, err := svc.CreateAttachment(ownerCtx, &v1pb.CreateAttachmentRequest{Attachment: &v1pb.Attachment{ + attachment, err := svc.CreateAttachment(ownerCtx, &apipb.CreateAttachmentRequest{Attachment: &apipb.Attachment{ Filename: filename, Type: "text/plain", Content: []byte(filename), @@ -97,32 +97,32 @@ func TestAttachmentMutationsPublishMemoChangedOnlyWhenBound(t *testing.T) { unbound := createAttachment("sse-unbound.txt", nil) requireNoMemoChanged(t, client.events) - _, err = svc.UpdateAttachment(ownerCtx, &v1pb.UpdateAttachmentRequest{ - Attachment: &v1pb.Attachment{Name: unbound.Name, Filename: "sse-unbound-renamed.txt"}, + _, err = svc.UpdateAttachment(ownerCtx, &apipb.UpdateAttachmentRequest{ + Attachment: &apipb.Attachment{Name: unbound.Name, Filename: "sse-unbound-renamed.txt"}, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"filename"}}, }) require.NoError(t, err) requireNoMemoChanged(t, client.events) - _, err = svc.DeleteAttachment(ownerCtx, &v1pb.DeleteAttachmentRequest{Name: unbound.Name}) + _, err = svc.DeleteAttachment(ownerCtx, &apipb.DeleteAttachmentRequest{Name: unbound.Name}) require.NoError(t, err) requireNoMemoChanged(t, client.events) bound := createAttachment("sse-bound.txt", &memo.Name) requireMemoChanged(t, client.events) - _, err = svc.UpdateAttachment(ownerCtx, &v1pb.UpdateAttachmentRequest{ - Attachment: &v1pb.Attachment{Name: bound.Name, Filename: "sse-bound-renamed.txt"}, + _, err = svc.UpdateAttachment(ownerCtx, &apipb.UpdateAttachmentRequest{ + Attachment: &apipb.Attachment{Name: bound.Name, Filename: "sse-bound-renamed.txt"}, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"filename"}}, }) require.NoError(t, err) requireMemoChanged(t, client.events) - _, err = svc.DeleteAttachment(ownerCtx, &v1pb.DeleteAttachmentRequest{Name: bound.Name}) + _, err = svc.DeleteAttachment(ownerCtx, &apipb.DeleteAttachmentRequest{Name: bound.Name}) require.NoError(t, err) requireMemoChanged(t, client.events) firstUnbound := createAttachment("sse-batch-unbound-first.txt", nil) secondUnbound := createAttachment("sse-batch-unbound-second.txt", nil) requireNoMemoChanged(t, client.events) - _, err = svc.BatchDeleteAttachments(ownerCtx, &v1pb.BatchDeleteAttachmentsRequest{ + _, err = svc.BatchDeleteAttachments(ownerCtx, &apipb.BatchDeleteAttachmentsRequest{ Names: []string{firstUnbound.Name, secondUnbound.Name}, }) require.NoError(t, err) @@ -131,7 +131,7 @@ func TestAttachmentMutationsPublishMemoChangedOnlyWhenBound(t *testing.T) { mixedUnbound := createAttachment("sse-batch-mixed-unbound.txt", nil) mixedBound := createAttachment("sse-batch-mixed-bound.txt", &memo.Name) requireMemoChanged(t, client.events) - _, err = svc.BatchDeleteAttachments(ownerCtx, &v1pb.BatchDeleteAttachmentsRequest{ + _, err = svc.BatchDeleteAttachments(ownerCtx, &apipb.BatchDeleteAttachmentsRequest{ Names: []string{mixedUnbound.Name, mixedBound.Name}, }) require.NoError(t, err) @@ -143,19 +143,19 @@ func TestUpdateAttachmentPublishesAfterCommittedAccessChange(t *testing.T) { svc := newIntegrationService(t) owner := createSpaceTestUser(ctx, t, svc, "sse-attachment-access-owner", store.RoleUser) ownerCtx := userCtx(ctx, owner.ID) - space, err := svc.CreateSpace(ownerCtx, &v1pb.CreateSpaceRequest{ + space, err := svc.CreateSpace(ownerCtx, &apipb.CreateSpaceRequest{ SpaceId: "sse-attachment-access-space", - Space: &v1pb.Space{Title: "Attachment access space"}, + Space: &apipb.Space{Title: "Attachment access space"}, }) require.NoError(t, err) spaceName := space.Name - memo, err := svc.CreateMemo(ownerCtx, &v1pb.CreateMemoRequest{Memo: &v1pb.Memo{ + memo, err := svc.CreateMemo(ownerCtx, &apipb.CreateMemoRequest{Memo: &apipb.Memo{ Content: "attachment access changed during update", - Visibility: v1pb.Visibility_SPACE, + Visibility: apipb.Visibility_SPACE, Space: &spaceName, }}) require.NoError(t, err) - attachment, err := svc.CreateAttachment(ownerCtx, &v1pb.CreateAttachmentRequest{Attachment: &v1pb.Attachment{ + attachment, err := svc.CreateAttachment(ownerCtx, &apipb.CreateAttachmentRequest{Attachment: &apipb.Attachment{ Filename: "before.txt", Type: "text/plain", Content: []byte("attachment"), @@ -183,8 +183,8 @@ func TestUpdateAttachmentPublishesAfterCommittedAccessChange(t *testing.T) { client := svc.SSEHub.Subscribe() defer svc.SSEHub.Unsubscribe(client) - updated, err := svc.UpdateAttachment(ownerCtx, &v1pb.UpdateAttachmentRequest{ - Attachment: &v1pb.Attachment{Name: attachment.Name, Filename: "after.txt"}, + updated, err := svc.UpdateAttachment(ownerCtx, &apipb.UpdateAttachmentRequest{ + Attachment: &apipb.Attachment{Name: attachment.Name, Filename: "after.txt"}, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"filename"}}, }) require.NoError(t, err) @@ -192,7 +192,7 @@ func TestUpdateAttachmentPublishesAfterCommittedAccessChange(t *testing.T) { requireMemoChanged(t, client.events) requireNoMemoChanged(t, client.events) - _, err = svc.GetAttachment(ownerCtx, &v1pb.GetAttachmentRequest{Name: attachment.Name}) + _, err = svc.GetAttachment(ownerCtx, &apipb.GetAttachmentRequest{Name: attachment.Name}) require.Equal(t, codes.PermissionDenied, status.Code(err), "the authorized read would fail after the committed membership change") } @@ -201,11 +201,11 @@ func TestDeleteAttachmentPublishesBeforeStorageCleanupFailure(t *testing.T) { svc := newIntegrationService(t) owner := createSpaceTestUser(ctx, t, svc, "sse-attachment-cleanup-owner", store.RoleUser) ownerCtx := userCtx(ctx, owner.ID) - memo, err := svc.CreateMemo(ownerCtx, &v1pb.CreateMemoRequest{ - Memo: &v1pb.Memo{Content: "attachment cleanup failure", Visibility: v1pb.Visibility_PRIVATE}, + memo, err := svc.CreateMemo(ownerCtx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{Content: "attachment cleanup failure", Visibility: apipb.Visibility_PRIVATE}, }) require.NoError(t, err) - attachment, err := svc.CreateAttachment(ownerCtx, &v1pb.CreateAttachmentRequest{Attachment: &v1pb.Attachment{ + attachment, err := svc.CreateAttachment(ownerCtx, &apipb.CreateAttachmentRequest{Attachment: &apipb.Attachment{ Filename: "cleanup.txt", Type: "text/plain", Content: []byte("attachment"), @@ -215,7 +215,7 @@ func TestDeleteAttachmentPublishesBeforeStorageCleanupFailure(t *testing.T) { client := svc.SSEHub.Subscribe() defer svc.SSEHub.Unsubscribe(client) - _, err = svc.DeleteAttachment(store.WithDeleteAttachmentStorageFailpoint(ownerCtx), &v1pb.DeleteAttachmentRequest{Name: attachment.Name}) + _, err = svc.DeleteAttachment(store.WithDeleteAttachmentStorageFailpoint(ownerCtx), &apipb.DeleteAttachmentRequest{Name: attachment.Name}) require.Equal(t, codes.Internal, status.Code(err)) require.ErrorContains(t, err, "attachments were deleted but storage cleanup failed") requireMemoChanged(t, client.events) @@ -237,44 +237,44 @@ func TestSpaceMutationsPublishSpaceChanged(t *testing.T) { client := svc.SSEHub.Subscribe() defer svc.SSEHub.Unsubscribe(client) - space, err := svc.CreateSpace(ownerCtx, &v1pb.CreateSpaceRequest{ + space, err := svc.CreateSpace(ownerCtx, &apipb.CreateSpaceRequest{ SpaceId: "sse-space", - Space: &v1pb.Space{Title: "SSE Space"}, + Space: &apipb.Space{Title: "SSE Space"}, }) require.NoError(t, err) requireSpaceChanged(t, client.events) space.Title = "Renamed SSE Space" - _, err = svc.UpdateSpace(ownerCtx, &v1pb.UpdateSpaceRequest{ + _, err = svc.UpdateSpace(ownerCtx, &apipb.UpdateSpaceRequest{ Space: space, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"title"}}, }) require.NoError(t, err) requireSpaceChanged(t, client.events) - invitation, err := svc.CreateSpaceInvitation(ownerCtx, &v1pb.CreateSpaceInvitationRequest{ + invitation, err := svc.CreateSpaceInvitation(ownerCtx, &apipb.CreateSpaceInvitationRequest{ Parent: space.Name, - SpaceInvitation: &v1pb.SpaceInvitation{Invitee: BuildUserName(member.Username), Role: v1pb.SpaceMember_USER}, + SpaceInvitation: &apipb.SpaceInvitation{Invitee: BuildUserName(member.Username), Role: apipb.SpaceMember_USER}, }) require.NoError(t, err) requireSpaceChanged(t, client.events) - membership, err := svc.AcceptSpaceInvitation(userCtx(ctx, member.ID), &v1pb.AcceptSpaceInvitationRequest{Name: invitation.Name}) + membership, err := svc.AcceptSpaceInvitation(userCtx(ctx, member.ID), &apipb.AcceptSpaceInvitationRequest{Name: invitation.Name}) require.NoError(t, err) requireSpaceChanged(t, client.events) - membership.Role = v1pb.SpaceMember_ADMIN - _, err = svc.UpdateSpaceMember(ownerCtx, &v1pb.UpdateSpaceMemberRequest{ + membership.Role = apipb.SpaceMember_ADMIN + _, err = svc.UpdateSpaceMember(ownerCtx, &apipb.UpdateSpaceMemberRequest{ SpaceMember: membership, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"role"}}, }) require.NoError(t, err) requireSpaceChanged(t, client.events) - _, err = svc.DeleteSpaceMember(ownerCtx, &v1pb.DeleteSpaceMemberRequest{Name: membership.Name}) + _, err = svc.DeleteSpaceMember(ownerCtx, &apipb.DeleteSpaceMemberRequest{Name: membership.Name}) require.NoError(t, err) requireSpaceChanged(t, client.events) - _, err = svc.DeleteSpace(ownerCtx, &v1pb.DeleteSpaceRequest{Name: space.Name}) + _, err = svc.DeleteSpace(ownerCtx, &apipb.DeleteSpaceRequest{Name: space.Name}) require.NoError(t, err) requireSpaceChanged(t, client.events) } @@ -287,8 +287,8 @@ func TestUpdateMemoSSEBroadcastsToAllSubscribers(t *testing.T) { }) require.NoError(t, err) ownerCtx := userCtx(ctx, owner.ID) - memo, err := svc.CreateMemo(ownerCtx, &v1pb.CreateMemoRequest{ - Memo: &v1pb.Memo{Content: "public before update", Visibility: v1pb.Visibility_PUBLIC}, + memo, err := svc.CreateMemo(ownerCtx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{Content: "public before update", Visibility: apipb.Visibility_PUBLIC}, }) require.NoError(t, err) @@ -297,16 +297,16 @@ func TestUpdateMemoSSEBroadcastsToAllSubscribers(t *testing.T) { otherClient := svc.SSEHub.Subscribe() defer svc.SSEHub.Unsubscribe(otherClient) - _, err = svc.UpdateMemo(ownerCtx, &v1pb.UpdateMemoRequest{ - Memo: &v1pb.Memo{Name: memo.Name, Visibility: v1pb.Visibility_PRIVATE}, + _, err = svc.UpdateMemo(ownerCtx, &apipb.UpdateMemoRequest{ + Memo: &apipb.Memo{Name: memo.Name, Visibility: apipb.Visibility_PRIVATE}, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"visibility"}}, }) require.NoError(t, err) requireMemoChanged(t, ownerClient.events) requireMemoChanged(t, otherClient.events) - _, err = svc.UpdateMemo(ownerCtx, &v1pb.UpdateMemoRequest{ - Memo: &v1pb.Memo{Name: memo.Name, Content: "private after update"}, + _, err = svc.UpdateMemo(ownerCtx, &apipb.UpdateMemoRequest{ + Memo: &apipb.Memo{Name: memo.Name, Content: "private after update"}, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"content"}}, }) require.NoError(t, err) @@ -322,23 +322,23 @@ func TestMoveSpaceAudienceMemoSSEBroadcastsWithoutAudienceCalculation(t *testing targetMember := createSpaceTestUser(ctx, t, svc, "move-target-member", store.RoleUser) ownerCtx := userCtx(ctx, owner.ID) - source, err := svc.CreateSpace(ownerCtx, &v1pb.CreateSpaceRequest{ + source, err := svc.CreateSpace(ownerCtx, &apipb.CreateSpaceRequest{ SpaceId: "move-source-space", - Space: &v1pb.Space{Title: "Source"}, + Space: &apipb.Space{Title: "Source"}, }) require.NoError(t, err) - target, err := svc.CreateSpace(ownerCtx, &v1pb.CreateSpaceRequest{ + target, err := svc.CreateSpace(ownerCtx, &apipb.CreateSpaceRequest{ SpaceId: "move-target-space", - Space: &v1pb.Space{Title: "Target"}, + Space: &apipb.Space{Title: "Target"}, }) require.NoError(t, err) - inviteAndAcceptSpaceTestUser(ctx, t, svc, owner, sourceMember, source, v1pb.SpaceMember_USER) - inviteAndAcceptSpaceTestUser(ctx, t, svc, owner, targetMember, target, v1pb.SpaceMember_USER) + inviteAndAcceptSpaceTestUser(ctx, t, svc, owner, sourceMember, source, apipb.SpaceMember_USER) + inviteAndAcceptSpaceTestUser(ctx, t, svc, owner, targetMember, target, apipb.SpaceMember_USER) sourceName := source.Name - memo, err := svc.CreateMemo(ownerCtx, &v1pb.CreateMemoRequest{Memo: &v1pb.Memo{ + memo, err := svc.CreateMemo(ownerCtx, &apipb.CreateMemoRequest{Memo: &apipb.Memo{ Content: "move between spaces", - Visibility: v1pb.Visibility_SPACE, + Visibility: apipb.Visibility_SPACE, Space: &sourceName, }}) require.NoError(t, err) @@ -350,10 +350,10 @@ func TestMoveSpaceAudienceMemoSSEBroadcastsWithoutAudienceCalculation(t *testing defer svc.SSEHub.Unsubscribe(outsiderClient) targetName := target.Name - _, err = svc.UpdateMemo(ownerCtx, &v1pb.UpdateMemoRequest{ - Memo: &v1pb.Memo{ + _, err = svc.UpdateMemo(ownerCtx, &apipb.UpdateMemoRequest{ + Memo: &apipb.Memo{ Name: memo.Name, - Visibility: v1pb.Visibility_SPACE, + Visibility: apipb.Visibility_SPACE, Space: &targetName, }, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"space", "visibility"}}, @@ -363,8 +363,8 @@ func TestMoveSpaceAudienceMemoSSEBroadcastsWithoutAudienceCalculation(t *testing requireMemoChanged(t, targetClient.events) requireMemoChanged(t, outsiderClient.events) - _, err = svc.UpdateMemo(ownerCtx, &v1pb.UpdateMemoRequest{ - Memo: &v1pb.Memo{Name: memo.Name, Content: "target only now"}, + _, err = svc.UpdateMemo(ownerCtx, &apipb.UpdateMemoRequest{ + Memo: &apipb.Memo{Name: memo.Name, Content: "target only now"}, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"content"}}, }) require.NoError(t, err) @@ -393,8 +393,8 @@ func TestCreateMemoComment_NoDuplicateSSEBroadcast(t *testing.T) { commenterCtx := userCtx(ctx, commenter.ID) // Create a public memo so the commenter can react. - parent, err := svc.CreateMemo(authorCtx, &v1pb.CreateMemoRequest{ - Memo: &v1pb.Memo{Content: "parent memo", Visibility: v1pb.Visibility_PUBLIC}, + parent, err := svc.CreateMemo(authorCtx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{Content: "parent memo", Visibility: apipb.Visibility_PUBLIC}, }) require.NoError(t, err) @@ -404,9 +404,9 @@ func TestCreateMemoComment_NoDuplicateSSEBroadcast(t *testing.T) { defer svc.SSEHub.Unsubscribe(client) // Comment creation is one mutation and emits one invalidation event. - _, err = svc.CreateMemoComment(commenterCtx, &v1pb.CreateMemoCommentRequest{ - Name: parent.Name, - Comment: &v1pb.Memo{Content: "a comment", Visibility: v1pb.Visibility_PUBLIC}, + _, err = svc.CreateMemoComment(commenterCtx, &apipb.CreateMemoCommentRequest{ + Parent: parent.Name, + Comment: &apipb.Memo{Content: "a comment", Visibility: apipb.Visibility_PUBLIC}, }) require.NoError(t, err) @@ -430,8 +430,8 @@ func TestCreateMemoComment_SSEBroadcastContainsNoSubject(t *testing.T) { }) require.NoError(t, err) - parent, err := svc.CreateMemo(userCtx(ctx, author.ID), &v1pb.CreateMemoRequest{ - Memo: &v1pb.Memo{Content: "public context", Visibility: v1pb.Visibility_PUBLIC}, + parent, err := svc.CreateMemo(userCtx(ctx, author.ID), &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{Content: "public context", Visibility: apipb.Visibility_PUBLIC}, }) require.NoError(t, err) authorClient := svc.SSEHub.Subscribe() @@ -439,11 +439,11 @@ func TestCreateMemoComment_SSEBroadcastContainsNoSubject(t *testing.T) { commenterClient := svc.SSEHub.Subscribe() defer svc.SSEHub.Unsubscribe(commenterClient) - _, err = svc.CreateMemoComment(userCtx(ctx, commenter.ID), &v1pb.CreateMemoCommentRequest{ - Name: parent.Name, - Comment: &v1pb.Memo{ + _, err = svc.CreateMemoComment(userCtx(ctx, commenter.ID), &apipb.CreateMemoCommentRequest{ + Parent: parent.Name, + Comment: &apipb.Memo{ Content: "private reply", - Visibility: v1pb.Visibility_PRIVATE, + Visibility: apipb.Visibility_PRIVATE, }, }) require.NoError(t, err) @@ -461,8 +461,8 @@ func TestCreateMemoWithAttachment_NoDuplicateUpdatedSSEBroadcast(t *testing.T) { require.NoError(t, err) uctx := userCtx(ctx, user.ID) - attachment, err := svc.CreateAttachment(uctx, &v1pb.CreateAttachmentRequest{ - Attachment: &v1pb.Attachment{ + attachment, err := svc.CreateAttachment(uctx, &apipb.CreateAttachmentRequest{ + Attachment: &apipb.Attachment{ Filename: "test.txt", Size: 5, Type: "text/plain", @@ -474,11 +474,11 @@ func TestCreateMemoWithAttachment_NoDuplicateUpdatedSSEBroadcast(t *testing.T) { client := svc.SSEHub.Subscribe() defer svc.SSEHub.Unsubscribe(client) - _, err = svc.CreateMemo(uctx, &v1pb.CreateMemoRequest{ - Memo: &v1pb.Memo{ + _, err = svc.CreateMemo(uctx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{ Content: "memo with initial attachment", - Visibility: v1pb.Visibility_PUBLIC, - Attachments: []*v1pb.Attachment{ + Visibility: apipb.Visibility_PUBLIC, + Attachments: []*apipb.Attachment{ {Name: attachment.Name}, }, }, @@ -501,17 +501,17 @@ func TestUpsertMemoReactionPublishesMemoChanged(t *testing.T) { require.NoError(t, err) uctx := userCtx(ctx, user.ID) - memo, err := svc.CreateMemo(uctx, &v1pb.CreateMemoRequest{ - Memo: &v1pb.Memo{Content: "reacted memo", Visibility: v1pb.Visibility_PUBLIC}, + memo, err := svc.CreateMemo(uctx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{Content: "reacted memo", Visibility: apipb.Visibility_PUBLIC}, }) require.NoError(t, err) client := svc.SSEHub.Subscribe() defer svc.SSEHub.Unsubscribe(client) - _, err = svc.UpsertMemoReaction(uctx, &v1pb.UpsertMemoReactionRequest{ - Name: memo.Name, - Reaction: &v1pb.Reaction{ + _, err = svc.UpsertMemoReaction(uctx, &apipb.UpsertMemoReactionRequest{ + Parent: memo.Name, + Reaction: &apipb.Reaction{ ReactionType: "👍", }, }) @@ -531,14 +531,14 @@ func TestDeleteMemoReactionPublishesMemoChanged(t *testing.T) { require.NoError(t, err) uctx := userCtx(ctx, user.ID) - memo, err := svc.CreateMemo(uctx, &v1pb.CreateMemoRequest{ - Memo: &v1pb.Memo{Content: "reacted memo", Visibility: v1pb.Visibility_PUBLIC}, + memo, err := svc.CreateMemo(uctx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{Content: "reacted memo", Visibility: apipb.Visibility_PUBLIC}, }) require.NoError(t, err) - reaction, err := svc.UpsertMemoReaction(uctx, &v1pb.UpsertMemoReactionRequest{ - Name: memo.Name, - Reaction: &v1pb.Reaction{ + reaction, err := svc.UpsertMemoReaction(uctx, &apipb.UpsertMemoReactionRequest{ + Parent: memo.Name, + Reaction: &apipb.Reaction{ ReactionType: "❤️", }, }) @@ -547,7 +547,7 @@ func TestDeleteMemoReactionPublishesMemoChanged(t *testing.T) { client := svc.SSEHub.Subscribe() defer svc.SSEHub.Unsubscribe(client) - _, err = svc.DeleteMemoReaction(uctx, &v1pb.DeleteMemoReactionRequest{ + _, err = svc.DeleteMemoReaction(uctx, &apipb.DeleteMemoReactionRequest{ Name: reaction.Name, }) require.NoError(t, err) @@ -572,24 +572,24 @@ func TestDeleteMemo_DeletesCommentSubtreeOnly(t *testing.T) { }) require.NoError(t, err) - root, err := svc.CreateMemo(userCtx(ctx, rootAuthor.ID), &v1pb.CreateMemoRequest{ - Memo: &v1pb.Memo{Content: "context memo", Visibility: v1pb.Visibility_PUBLIC}, + root, err := svc.CreateMemo(userCtx(ctx, rootAuthor.ID), &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{Content: "context memo", Visibility: apipb.Visibility_PUBLIC}, }) require.NoError(t, err) - comment, err := svc.CreateMemoComment(userCtx(ctx, commentAuthor.ID), &v1pb.CreateMemoCommentRequest{ - Name: root.Name, - Comment: &v1pb.Memo{Content: "branch", Visibility: v1pb.Visibility_PUBLIC}, + comment, err := svc.CreateMemoComment(userCtx(ctx, commentAuthor.ID), &apipb.CreateMemoCommentRequest{ + Parent: root.Name, + Comment: &apipb.Memo{Content: "branch", Visibility: apipb.Visibility_PUBLIC}, }) require.NoError(t, err) - reply, err := svc.CreateMemoComment(userCtx(ctx, replyAuthor.ID), &v1pb.CreateMemoCommentRequest{ - Name: comment.Name, - Comment: &v1pb.Memo{Content: "nested reply"}, + reply, err := svc.CreateMemoComment(userCtx(ctx, replyAuthor.ID), &apipb.CreateMemoCommentRequest{ + Parent: comment.Name, + Comment: &apipb.Memo{Content: "nested reply"}, }) require.NoError(t, err) replyClient := svc.SSEHub.Subscribe() defer svc.SSEHub.Unsubscribe(replyClient) - _, err = svc.DeleteMemo(userCtx(ctx, commentAuthor.ID), &v1pb.DeleteMemoRequest{Name: comment.Name}) + _, err = svc.DeleteMemo(userCtx(ctx, commentAuthor.ID), &apipb.DeleteMemoRequest{Name: comment.Name}) require.NoError(t, err) requireMemoChanged(t, replyClient.events) @@ -618,8 +618,8 @@ func TestDeleteMemoCleansAttachmentStorage(t *testing.T) { }) require.NoError(t, err) ownerCtx := userCtx(ctx, owner.ID) - memo, err := svc.CreateMemo(ownerCtx, &v1pb.CreateMemoRequest{ - Memo: &v1pb.Memo{Content: "attachment cleanup", Visibility: v1pb.Visibility_PRIVATE}, + memo, err := svc.CreateMemo(ownerCtx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{Content: "attachment cleanup", Visibility: apipb.Visibility_PRIVATE}, }) require.NoError(t, err) memoUID, err := ExtractMemoUIDFromName(memo.Name) @@ -644,7 +644,7 @@ func TestDeleteMemoCleansAttachmentStorage(t *testing.T) { client := svc.SSEHub.Subscribe() defer svc.SSEHub.Unsubscribe(client) - _, err = svc.DeleteMemo(ownerCtx, &v1pb.DeleteMemoRequest{Name: memo.Name}) + _, err = svc.DeleteMemo(ownerCtx, &apipb.DeleteMemoRequest{Name: memo.Name}) require.NoError(t, err, "committed deletion must not be reported as a failure") requireMemoChanged(t, client.events) @@ -668,13 +668,13 @@ func TestSetMemoAttachmentsPublishesMemoChanged(t *testing.T) { require.NoError(t, err) uctx := userCtx(ctx, user.ID) - memo, err := svc.CreateMemo(uctx, &v1pb.CreateMemoRequest{ - Memo: &v1pb.Memo{Content: "memo with attachments", Visibility: v1pb.Visibility_PUBLIC}, + memo, err := svc.CreateMemo(uctx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{Content: "memo with attachments", Visibility: apipb.Visibility_PUBLIC}, }) require.NoError(t, err) - attachment, err := svc.CreateAttachment(uctx, &v1pb.CreateAttachmentRequest{ - Attachment: &v1pb.Attachment{ + attachment, err := svc.CreateAttachment(uctx, &apipb.CreateAttachmentRequest{ + Attachment: &apipb.Attachment{ Filename: "test.txt", Size: 5, Type: "text/plain", @@ -686,9 +686,9 @@ func TestSetMemoAttachmentsPublishesMemoChanged(t *testing.T) { client := svc.SSEHub.Subscribe() defer svc.SSEHub.Unsubscribe(client) - _, err = svc.SetMemoAttachments(uctx, &v1pb.SetMemoAttachmentsRequest{ + _, err = svc.SetMemoAttachments(uctx, &apipb.SetMemoAttachmentsRequest{ Name: memo.Name, - Attachments: []*v1pb.Attachment{ + Attachments: []*apipb.Attachment{ {Name: attachment.Name}, }, }) @@ -708,24 +708,24 @@ func TestSetMemoRelationsPublishesMemoChanged(t *testing.T) { require.NoError(t, err) uctx := userCtx(ctx, user.ID) - memo1, err := svc.CreateMemo(uctx, &v1pb.CreateMemoRequest{ - Memo: &v1pb.Memo{Content: "memo one", Visibility: v1pb.Visibility_PUBLIC}, + memo1, err := svc.CreateMemo(uctx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{Content: "memo one", Visibility: apipb.Visibility_PUBLIC}, }) require.NoError(t, err) - memo2, err := svc.CreateMemo(uctx, &v1pb.CreateMemoRequest{ - Memo: &v1pb.Memo{Content: "memo two", Visibility: v1pb.Visibility_PUBLIC}, + memo2, err := svc.CreateMemo(uctx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{Content: "memo two", Visibility: apipb.Visibility_PUBLIC}, }) require.NoError(t, err) client := svc.SSEHub.Subscribe() defer svc.SSEHub.Unsubscribe(client) - _, err = svc.SetMemoRelations(uctx, &v1pb.SetMemoRelationsRequest{ + _, err = svc.SetMemoRelations(uctx, &apipb.SetMemoRelationsRequest{ Name: memo1.Name, - Relations: []*v1pb.MemoRelation{ + Relations: []*apipb.MemoRelation{ { - RelatedMemo: &v1pb.MemoRelation_Memo{Name: memo2.Name}, - Type: v1pb.MemoRelation_REFERENCE, + RelatedMemo: &apipb.MemoRelation_MemoRef{Name: memo2.Name}, + Type: apipb.MemoRelation_REFERENCE, }, }, }) diff --git a/server/api/v1/sso_username.go b/server/api/sso_username.go similarity index 98% rename from server/api/v1/sso_username.go rename to server/api/sso_username.go index fbd4c15bf..c966a31fe 100644 --- a/server/api/v1/sso_username.go +++ b/server/api/sso_username.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "github.com/pkg/errors" diff --git a/server/api/v1/sso_username_test.go b/server/api/sso_username_test.go similarity index 97% rename from server/api/v1/sso_username_test.go rename to server/api/sso_username_test.go index c576a28f9..5b663dcff 100644 --- a/server/api/v1/sso_username_test.go +++ b/server/api/sso_username_test.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "testing" diff --git a/server/api/v1/test/ai_service_test.go b/server/api/test/ai_service_test.go similarity index 84% rename from server/api/v1/test/ai_service_test.go rename to server/api/test/ai_service_test.go index 18beb5811..dc2a0d88f 100644 --- a/server/api/v1/test/ai_service_test.go +++ b/server/api/test/ai_service_test.go @@ -9,7 +9,7 @@ import ( "github.com/stretchr/testify/require" - v1pb "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" storepb "github.com/usememos/memos/proto/gen/store" ) @@ -20,9 +20,9 @@ func TestTranscribe(t *testing.T) { ts := NewTestService(t) defer ts.Cleanup() - _, err := ts.Service.Transcribe(ctx, &v1pb.TranscribeRequest{ - Audio: &v1pb.TranscriptionAudio{ - Source: &v1pb.TranscriptionAudio_Content{Content: []byte("RIFF")}, + _, err := ts.Service.Transcribe(ctx, &apipb.TranscribeRequest{ + Audio: &apipb.TranscriptionAudio{ + Source: &apipb.TranscriptionAudio_Content{Content: []byte("RIFF")}, Filename: "voice.wav", ContentType: "audio/wav", }, @@ -83,9 +83,9 @@ func TestTranscribe(t *testing.T) { }) require.NoError(t, err) - resp, err := ts.Service.Transcribe(userCtx, &v1pb.TranscribeRequest{ - Audio: &v1pb.TranscriptionAudio{ - Source: &v1pb.TranscriptionAudio_Content{Content: []byte("RIFF")}, + resp, err := ts.Service.Transcribe(userCtx, &apipb.TranscribeRequest{ + Audio: &apipb.TranscriptionAudio{ + Source: &apipb.TranscriptionAudio_Content{Content: []byte("RIFF")}, Filename: "voice.wav", ContentType: "audio/wav", }, @@ -126,9 +126,9 @@ func TestTranscribe(t *testing.T) { }) require.NoError(t, err) - _, err = ts.Service.Transcribe(userCtx, &v1pb.TranscribeRequest{ - Audio: &v1pb.TranscriptionAudio{ - Source: &v1pb.TranscriptionAudio_Content{Content: []byte("RIFF")}, + _, err = ts.Service.Transcribe(userCtx, &apipb.TranscribeRequest{ + Audio: &apipb.TranscriptionAudio{ + Source: &apipb.TranscriptionAudio_Content{Content: []byte("RIFF")}, Filename: "voice.wav", ContentType: "audio/wav", }, @@ -183,9 +183,9 @@ func TestTranscribe(t *testing.T) { }) require.NoError(t, err) - resp, err := ts.Service.Transcribe(userCtx, &v1pb.TranscribeRequest{ - Audio: &v1pb.TranscriptionAudio{ - Source: &v1pb.TranscriptionAudio_Content{Content: []byte("mp3 bytes")}, + resp, err := ts.Service.Transcribe(userCtx, &apipb.TranscribeRequest{ + Audio: &apipb.TranscriptionAudio{ + Source: &apipb.TranscriptionAudio_Content{Content: []byte("mp3 bytes")}, Filename: "voice.mp3", ContentType: "audio/mp3", }, @@ -233,9 +233,9 @@ func TestTranscribe(t *testing.T) { }) require.NoError(t, err) - resp, err := ts.Service.Transcribe(userCtx, &v1pb.TranscribeRequest{ - Audio: &v1pb.TranscriptionAudio{ - Source: &v1pb.TranscriptionAudio_Content{Content: []byte("RIFF")}, + resp, err := ts.Service.Transcribe(userCtx, &apipb.TranscribeRequest{ + Audio: &apipb.TranscriptionAudio{ + Source: &apipb.TranscriptionAudio_Content{Content: []byte("RIFF")}, Filename: "voice.wav", ContentType: "audio/wav", }, @@ -252,9 +252,9 @@ func TestTranscribe(t *testing.T) { require.NoError(t, err) userCtx := ts.CreateUserContext(ctx, user.ID) - _, err = ts.Service.Transcribe(userCtx, &v1pb.TranscribeRequest{ - Audio: &v1pb.TranscriptionAudio{ - Source: &v1pb.TranscriptionAudio_Content{Content: []byte("not audio")}, + _, err = ts.Service.Transcribe(userCtx, &apipb.TranscribeRequest{ + Audio: &apipb.TranscriptionAudio{ + Source: &apipb.TranscriptionAudio_Content{Content: []byte("not audio")}, Filename: "notes.txt", ContentType: "text/plain", }, @@ -271,9 +271,9 @@ func TestTranscribe(t *testing.T) { require.NoError(t, err) userCtx := ts.CreateUserContext(ctx, user.ID) - _, err = ts.Service.Transcribe(userCtx, &v1pb.TranscribeRequest{ - Audio: &v1pb.TranscriptionAudio{ - Source: &v1pb.TranscriptionAudio_Content{Content: []byte("RIFF")}, + _, err = ts.Service.Transcribe(userCtx, &apipb.TranscribeRequest{ + Audio: &apipb.TranscriptionAudio{ + Source: &apipb.TranscriptionAudio_Content{Content: []byte("RIFF")}, Filename: "voice.wav", ContentType: "audio/wav", }, diff --git a/server/api/v1/test/attachment_service_s3_test.go b/server/api/test/attachment_service_s3_test.go similarity index 86% rename from server/api/v1/test/attachment_service_s3_test.go rename to server/api/test/attachment_service_s3_test.go index 109481670..e96f98187 100644 --- a/server/api/v1/test/attachment_service_s3_test.go +++ b/server/api/test/attachment_service_s3_test.go @@ -8,10 +8,10 @@ import ( "github.com/stretchr/testify/require" "github.com/usememos/memos/internal/testutil/fakes3" - v1pb "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" storepb "github.com/usememos/memos/proto/gen/store" "github.com/usememos/memos/provider/storage/s3" - apiv1 "github.com/usememos/memos/server/api/v1" + "github.com/usememos/memos/server/api" "github.com/usememos/memos/store" ) @@ -32,18 +32,18 @@ func TestUploadAttachmentS3(t *testing.T) { storage := fakeStorage("upload-s3", "Uploads", fake.Config("uploads")) upsertS3StorageSetting(ctx, t, ts, storage.Id, storage) chunk := bytes.Repeat([]byte("x"), 2<<20) - initial, err := ts.Service.UploadAttachment(ctx, &v1pb.UploadAttachmentRequest{Upload: &v1pb.UploadAttachmentRequest_Spec{Spec: &v1pb.UploadAttachmentSpec{ - Attachment: &v1pb.Attachment{Filename: "large.bin", Type: "application/octet-stream"}, TotalSize: int64(3 * len(chunk)), + initial, err := ts.Service.UploadAttachment(ctx, &apipb.UploadAttachmentRequest{Upload: &apipb.UploadAttachmentRequest_Spec{Spec: &apipb.UploadAttachmentSpec{ + Attachment: &apipb.Attachment{Filename: "large.bin", Type: "application/octet-stream"}, TotalSize: int64(3 * len(chunk)), }}}) require.NoError(t, err) - var result *v1pb.UploadAttachmentResponse + var result *apipb.UploadAttachmentResponse for i := range 3 { - result, err = ts.Service.UploadAttachment(ctx, &v1pb.UploadAttachmentRequest{ - Upload: &v1pb.UploadAttachmentRequest_UploadId{UploadId: initial.UploadId}, WriteOffset: int64(i * len(chunk)), Data: chunk, FinishWrite: i == 2, + result, err = ts.Service.UploadAttachment(ctx, &apipb.UploadAttachmentRequest{ + Upload: &apipb.UploadAttachmentRequest_UploadId{UploadId: initial.UploadId}, WriteOffset: int64(i * len(chunk)), Data: chunk, FinishWrite: i == 2, }) require.NoError(t, err) } - uid, err := apiv1.ExtractAttachmentUIDFromName(result.Attachment.Name) + uid, err := api.ExtractAttachmentUIDFromName(result.Attachment.Name) require.NoError(t, err) row, err := ts.Store.GetAttachment(ctx, &store.FindAttachment{UID: &uid}) require.NoError(t, err) @@ -68,8 +68,8 @@ func runS3AttachmentLifecycleAcrossStorageChange(t *testing.T, objectStore *fake upsertS3StorageSetting(ctx, t, ts, oldStorage.Id, oldStorage) firstContent := []byte("first attachment in old storage") - first, err := ts.Service.CreateAttachment(userCtx, &v1pb.CreateAttachmentRequest{ - Attachment: &v1pb.Attachment{ + first, err := ts.Service.CreateAttachment(userCtx, &apipb.CreateAttachmentRequest{ + Attachment: &apipb.Attachment{ Filename: "first.txt", Type: "text/plain", Content: firstContent, @@ -77,7 +77,7 @@ func runS3AttachmentLifecycleAcrossStorageChange(t *testing.T, objectStore *fake }) require.NoError(t, err) - firstUID, err := apiv1.ExtractAttachmentUIDFromName(first.Name) + firstUID, err := api.ExtractAttachmentUIDFromName(first.Name) require.NoError(t, err) storedFirst, err := ts.Store.GetAttachment(ctx, &store.FindAttachment{UID: &firstUID}) require.NoError(t, err) @@ -95,7 +95,7 @@ func runS3AttachmentLifecycleAcrossStorageChange(t *testing.T, objectStore *fake firstDownloaded, err := ts.Service.GetAttachmentBlob(ctx, storedFirst) require.NoError(t, err) require.Equal(t, firstContent, firstDownloaded) - firstMetadata, err := ts.Service.GetAttachment(userCtx, &v1pb.GetAttachmentRequest{Name: first.Name}) + firstMetadata, err := ts.Service.GetAttachment(userCtx, &apipb.GetAttachmentRequest{Name: first.Name}) require.NoError(t, err) require.Equal(t, first.Name, firstMetadata.Name) require.Empty(t, firstMetadata.ExternalLink) @@ -104,15 +104,15 @@ func runS3AttachmentLifecycleAcrossStorageChange(t *testing.T, objectStore *fake upsertS3StorageSetting(ctx, t, ts, newStorage.Id, oldStorage, newStorage) secondContent := []byte("second attachment in new storage") - second, err := ts.Service.CreateAttachment(userCtx, &v1pb.CreateAttachmentRequest{ - Attachment: &v1pb.Attachment{ + second, err := ts.Service.CreateAttachment(userCtx, &apipb.CreateAttachmentRequest{ + Attachment: &apipb.Attachment{ Filename: "second.txt", Type: "text/plain", Content: secondContent, }, }) require.NoError(t, err) - secondUID, err := apiv1.ExtractAttachmentUIDFromName(second.Name) + secondUID, err := api.ExtractAttachmentUIDFromName(second.Name) require.NoError(t, err) storedSecond, err := ts.Store.GetAttachment(ctx, &store.FindAttachment{UID: &secondUID}) require.NoError(t, err) @@ -131,7 +131,7 @@ func runS3AttachmentLifecycleAcrossStorageChange(t *testing.T, objectStore *fake require.NoError(t, err) require.Equal(t, secondContent, secondDownloaded) - _, err = ts.Service.DeleteAttachment(userCtx, &v1pb.DeleteAttachmentRequest{Name: first.Name}) + _, err = ts.Service.DeleteAttachment(userCtx, &apipb.DeleteAttachmentRequest{Name: first.Name}) require.NoError(t, err) _, err = objectStore.GetObject("attachments-old", oldKey) require.Error(t, err, "deleting an attachment must delete its S3 object") @@ -224,7 +224,7 @@ func TestGetLegacyS3AttachmentBlob(t *testing.T) { require.NoError(t, err) require.Equal(t, content, downloaded) - _, err = ts.Service.DeleteAttachment(userCtx, &v1pb.DeleteAttachmentRequest{Name: apiv1.AttachmentNamePrefix + legacyAttachment.UID}) + _, err = ts.Service.DeleteAttachment(userCtx, &apipb.DeleteAttachmentRequest{Name: api.AttachmentNamePrefix + legacyAttachment.UID}) require.NoError(t, err) _, err = fake.GetObject(currentConfig.Bucket, key) require.Error(t, err, "deleting a legacy attachment must use the current matching storage configuration") @@ -278,11 +278,11 @@ func TestS3ObjectKeysStayUniqueWithoutUUIDTemplate(t *testing.T) { require.NoError(t, err) userCtx := ts.CreateUserContext(ctx, user.ID) content := []byte("content of user " + username) - created, err := ts.Service.CreateAttachment(userCtx, &v1pb.CreateAttachmentRequest{Attachment: &v1pb.Attachment{ + created, err := ts.Service.CreateAttachment(userCtx, &apipb.CreateAttachmentRequest{Attachment: &apipb.Attachment{ Filename: "notes.txt", Type: "text/plain", Content: content, }}) require.NoError(t, err) - uid, err := apiv1.ExtractAttachmentUIDFromName(created.Name) + uid, err := api.ExtractAttachmentUIDFromName(created.Name) require.NoError(t, err) row, err := ts.Store.GetAttachment(ctx, &store.FindAttachment{UID: &uid}) require.NoError(t, err) diff --git a/server/api/v1/test/attachment_service_test.go b/server/api/test/attachment_service_test.go similarity index 74% rename from server/api/v1/test/attachment_service_test.go rename to server/api/test/attachment_service_test.go index f97254a37..0c49feced 100644 --- a/server/api/v1/test/attachment_service_test.go +++ b/server/api/test/attachment_service_test.go @@ -14,9 +14,9 @@ import ( "google.golang.org/protobuf/types/known/fieldmaskpb" "github.com/usememos/memos/internal/testutil" - v1pb "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" storepb "github.com/usememos/memos/proto/gen/store" - apiv1 "github.com/usememos/memos/server/api/v1" + "github.com/usememos/memos/server/api" "github.com/usememos/memos/store" ) @@ -31,23 +31,23 @@ func TestCreateAttachment(t *testing.T) { // Test case 1: Create attachment with empty type but known extension t.Run("EmptyType_KnownExtension", func(t *testing.T) { - attachment, err := ts.Service.CreateAttachment(userCtx, &v1pb.CreateAttachmentRequest{ - Attachment: &v1pb.Attachment{ + attachment, err := ts.Service.CreateAttachment(userCtx, &apipb.CreateAttachmentRequest{ + Attachment: &apipb.Attachment{ Filename: "test.png", Content: []byte("fake png content"), }, }) require.NoError(t, err) require.Equal(t, "image/png", attachment.Type) - require.Equal(t, apiv1.BuildUserName(user.Username), attachment.Creator) + require.Equal(t, api.BuildUserName(user.Username), attachment.Creator) }) // Test case 2: Create attachment with empty type and unknown extension, but detectable content t.Run("EmptyType_UnknownExtension_ContentSniffing", func(t *testing.T) { // PNG magic header: 89 50 4E 47 0D 0A 1A 0A pngContent := []byte{0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A} - attachment, err := ts.Service.CreateAttachment(userCtx, &v1pb.CreateAttachmentRequest{ - Attachment: &v1pb.Attachment{ + attachment, err := ts.Service.CreateAttachment(userCtx, &apipb.CreateAttachmentRequest{ + Attachment: &apipb.Attachment{ Filename: "test.unknown", Content: pngContent, }, @@ -59,8 +59,8 @@ func TestCreateAttachment(t *testing.T) { // Test case 3: Empty type, unknown extension, random content -> fallback to application/octet-stream t.Run("EmptyType_Fallback", func(t *testing.T) { randomContent := []byte{0x00, 0x01, 0x02, 0x03} - attachment, err := ts.Service.CreateAttachment(userCtx, &v1pb.CreateAttachmentRequest{ - Attachment: &v1pb.Attachment{ + attachment, err := ts.Service.CreateAttachment(userCtx, &apipb.CreateAttachmentRequest{ + Attachment: &apipb.Attachment{ Filename: "test.data", Content: randomContent, }, @@ -70,8 +70,8 @@ func TestCreateAttachment(t *testing.T) { }) t.Run("Type_WithParameters_NormalizedBeforeValidation", func(t *testing.T) { - attachment, err := ts.Service.CreateAttachment(userCtx, &v1pb.CreateAttachmentRequest{ - Attachment: &v1pb.Attachment{ + attachment, err := ts.Service.CreateAttachment(userCtx, &apipb.CreateAttachmentRequest{ + Attachment: &apipb.Attachment{ Filename: "voice-note.webm", Type: "audio/webm;codecs=opus", Content: []byte("fake webm content"), @@ -82,8 +82,8 @@ func TestCreateAttachment(t *testing.T) { }) t.Run("Type_InvalidFormat_Rejected", func(t *testing.T) { - _, err := ts.Service.CreateAttachment(userCtx, &v1pb.CreateAttachmentRequest{ - Attachment: &v1pb.Attachment{ + _, err := ts.Service.CreateAttachment(userCtx, &apipb.CreateAttachmentRequest{ + Attachment: &apipb.Attachment{ Filename: "broken.webm", Type: `audio/webm;codecs="unterminated`, Content: []byte("fake webm content"), @@ -105,8 +105,8 @@ func TestCreateAttachment(t *testing.T) { }) require.NoError(t, err) - first, err := ts.Service.CreateAttachment(userCtx, &v1pb.CreateAttachmentRequest{ - Attachment: &v1pb.Attachment{ + first, err := ts.Service.CreateAttachment(userCtx, &apipb.CreateAttachmentRequest{ + Attachment: &apipb.Attachment{ Filename: "screenshot.png", Type: "image/png", Content: []byte("first-image"), @@ -114,8 +114,8 @@ func TestCreateAttachment(t *testing.T) { }) require.NoError(t, err) - second, err := ts.Service.CreateAttachment(userCtx, &v1pb.CreateAttachmentRequest{ - Attachment: &v1pb.Attachment{ + second, err := ts.Service.CreateAttachment(userCtx, &apipb.CreateAttachmentRequest{ + Attachment: &apipb.Attachment{ Filename: "screenshot.png", Type: "image/png", Content: []byte("second-image"), @@ -123,9 +123,9 @@ func TestCreateAttachment(t *testing.T) { }) require.NoError(t, err) - firstUID, err := apiv1.ExtractAttachmentUIDFromName(first.Name) + firstUID, err := api.ExtractAttachmentUIDFromName(first.Name) require.NoError(t, err) - secondUID, err := apiv1.ExtractAttachmentUIDFromName(second.Name) + secondUID, err := api.ExtractAttachmentUIDFromName(second.Name) require.NoError(t, err) firstStoreAttachment, err := ts.Store.GetAttachment(ctx, &store.FindAttachment{UID: &firstUID}) @@ -166,9 +166,9 @@ func TestCreateAttachmentCleansSavedBlobWhenStoreCreateFails(t *testing.T) { require.NoError(t, err) const attachmentID = "attachment-create-failure" - _, err = ts.Service.CreateAttachment(userCtx, &v1pb.CreateAttachmentRequest{ + _, err = ts.Service.CreateAttachment(userCtx, &apipb.CreateAttachmentRequest{ AttachmentId: attachmentID, - Attachment: &v1pb.Attachment{ + Attachment: &apipb.Attachment{ Filename: "kept.txt", Type: "text/plain", Content: []byte("kept"), @@ -178,9 +178,9 @@ func TestCreateAttachmentCleansSavedBlobWhenStoreCreateFails(t *testing.T) { keptPath := filepath.Join(ts.Profile.Data, "assets", "kept.txt") require.FileExists(t, keptPath) - _, err = ts.Service.CreateAttachment(userCtx, &v1pb.CreateAttachmentRequest{ + _, err = ts.Service.CreateAttachment(userCtx, &apipb.CreateAttachmentRequest{ AttachmentId: attachmentID, - Attachment: &v1pb.Attachment{ + Attachment: &apipb.Attachment{ Filename: "orphan.txt", Type: "text/plain", Content: []byte("must be removed"), @@ -194,12 +194,12 @@ func TestCreateAttachmentCleansSavedBlobWhenStoreCreateFails(t *testing.T) { require.NoError(t, err) require.Equal(t, []byte("kept"), kept) - memo, err := ts.Service.CreateMemo(userCtx, &v1pb.CreateMemoRequest{Memo: &v1pb.Memo{Content: "attachment compensation policy"}}) + memo, err := ts.Service.CreateMemo(userCtx, &apipb.CreateMemoRequest{Memo: &apipb.Memo{Content: "attachment compensation policy"}}) require.NoError(t, err) policyRejectionPath := filepath.Join(ts.Profile.Data, "assets", "policy-rejected.txt") - _, err = ts.Service.CreateAttachment(store.WithCreateAttachmentPolicyFailpoint(userCtx), &v1pb.CreateAttachmentRequest{ + _, err = ts.Service.CreateAttachment(store.WithCreateAttachmentPolicyFailpoint(userCtx), &apipb.CreateAttachmentRequest{ AttachmentId: "attachment-policy-rejection", - Attachment: &v1pb.Attachment{ + Attachment: &apipb.Attachment{ Filename: "policy-rejected.txt", Type: "text/plain", Content: []byte("must be removed"), @@ -215,9 +215,9 @@ func TestCreateAttachmentCleansSavedBlobWhenStoreCreateFails(t *testing.T) { require.Nil(t, persistedPolicyRejection) postCommitPath := filepath.Join(ts.Profile.Data, "assets", "post-commit.txt") - _, err = ts.Service.CreateAttachment(store.WithCreateAttachmentPostCommitFailpoint(userCtx), &v1pb.CreateAttachmentRequest{ + _, err = ts.Service.CreateAttachment(store.WithCreateAttachmentPostCommitFailpoint(userCtx), &apipb.CreateAttachmentRequest{ AttachmentId: "attachment-post-commit", - Attachment: &v1pb.Attachment{ + Attachment: &apipb.Attachment{ Filename: "post-commit.txt", Type: "text/plain", Content: []byte("must be preserved"), @@ -235,9 +235,9 @@ func TestCreateAttachmentCleansSavedBlobWhenStoreCreateFails(t *testing.T) { cleanupFailurePath := filepath.Join(ts.Profile.Data, "assets", "cleanup-failure.txt") t.Cleanup(func() { _ = os.Remove(cleanupFailurePath) }) cleanupFailureCtx := store.WithDeleteAttachmentStorageFailpoint(store.WithCreateAttachmentPolicyFailpoint(userCtx)) - _, err = ts.Service.CreateAttachment(cleanupFailureCtx, &v1pb.CreateAttachmentRequest{ + _, err = ts.Service.CreateAttachment(cleanupFailureCtx, &apipb.CreateAttachmentRequest{ AttachmentId: "attachment-cleanup-failure", - Attachment: &v1pb.Attachment{ + Attachment: &apipb.Attachment{ Filename: "cleanup-failure.txt", Type: "text/plain", Content: []byte("cleanup failure"), @@ -256,36 +256,36 @@ func TestAttachmentMetadataFollowsMemoVisibility(t *testing.T) { owner, err := ts.CreateRegularUser(ctx, "metadata-owner") require.NoError(t, err) ownerCtx := ts.CreateUserContext(ctx, owner.ID) - attachment, err := ts.Service.CreateAttachment(ownerCtx, &v1pb.CreateAttachmentRequest{Attachment: &v1pb.Attachment{ + attachment, err := ts.Service.CreateAttachment(ownerCtx, &apipb.CreateAttachmentRequest{Attachment: &apipb.Attachment{ Filename: "metadata.png", Type: "image/png", Content: []byte("metadata image"), }}) require.NoError(t, err) - memo, err := ts.Service.CreateMemo(ownerCtx, &v1pb.CreateMemoRequest{Memo: &v1pb.Memo{ + memo, err := ts.Service.CreateMemo(ownerCtx, &apipb.CreateMemoRequest{Memo: &apipb.Memo{ Content: "public metadata", - Visibility: v1pb.Visibility_PUBLIC, - Attachments: []*v1pb.Attachment{{Name: attachment.Name}}, + Visibility: apipb.Visibility_PUBLIC, + Attachments: []*apipb.Attachment{{Name: attachment.Name}}, }}) require.NoError(t, err) - _, err = ts.Service.GetAttachment(ctx, &v1pb.GetAttachmentRequest{Name: attachment.Name}) + _, err = ts.Service.GetAttachment(ctx, &apipb.GetAttachmentRequest{Name: attachment.Name}) require.NoError(t, err) - listed, err := ts.Service.ListMemoAttachments(ctx, &v1pb.ListMemoAttachmentsRequest{Name: memo.Name}) + listed, err := ts.Service.ListMemoAttachments(ctx, &apipb.ListMemoAttachmentsRequest{Parent: memo.Name}) require.NoError(t, err) require.Len(t, listed.Attachments, 1) protected := store.Protected memoID := memoIDFromName(ctx, t, ts, memo.Name) require.NoError(t, ts.Store.UpdateMemo(ctx, &store.UpdateMemo{ID: memoID, Visibility: &protected})) - _, err = ts.Service.GetAttachment(ctx, &v1pb.GetAttachmentRequest{Name: attachment.Name}) + _, err = ts.Service.GetAttachment(ctx, &apipb.GetAttachmentRequest{Name: attachment.Name}) require.Equal(t, codes.Unauthenticated, status.Code(err)) - _, err = ts.Service.ListMemoAttachments(ctx, &v1pb.ListMemoAttachmentsRequest{Name: memo.Name}) + _, err = ts.Service.ListMemoAttachments(ctx, &apipb.ListMemoAttachmentsRequest{Parent: memo.Name}) require.Equal(t, codes.Unauthenticated, status.Code(err)) archived := store.Archived require.NoError(t, ts.Store.UpdateMemo(ctx, &store.UpdateMemo{ID: memoID, RowStatus: &archived})) - _, err = ts.Service.GetAttachment(ctx, &v1pb.GetAttachmentRequest{Name: attachment.Name}) + _, err = ts.Service.GetAttachment(ctx, &apipb.GetAttachmentRequest{Name: attachment.Name}) require.Equal(t, codes.NotFound, status.Code(err)) } @@ -300,15 +300,15 @@ func TestCreateAttachmentMemoPermission(t *testing.T) { require.NoError(t, err) ownerCtx := ts.CreateUserContext(ctx, owner.ID) - memo, err := ts.Service.CreateMemo(ownerCtx, &v1pb.CreateMemoRequest{ - Memo: &v1pb.Memo{ + memo, err := ts.Service.CreateMemo(ownerCtx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{ Content: "memo with direct attachment", }, }) require.NoError(t, err) - attachment, err := ts.Service.CreateAttachment(ownerCtx, &v1pb.CreateAttachmentRequest{ - Attachment: &v1pb.Attachment{ + attachment, err := ts.Service.CreateAttachment(ownerCtx, &apipb.CreateAttachmentRequest{ + Attachment: &apipb.Attachment{ Filename: "owner.txt", Type: "text/plain", Content: []byte("owner"), @@ -316,7 +316,7 @@ func TestCreateAttachmentMemoPermission(t *testing.T) { }, }) require.NoError(t, err) - attachmentUID, err := apiv1.ExtractAttachmentUIDFromName(attachment.Name) + attachmentUID, err := api.ExtractAttachmentUIDFromName(attachment.Name) require.NoError(t, err) stored, err := ts.Store.GetAttachment(ctx, &store.FindAttachment{UID: &attachmentUID}) require.NoError(t, err) @@ -335,15 +335,15 @@ func TestCreateAttachmentMemoPermission(t *testing.T) { require.NoError(t, err) adminCtx := ts.CreateUserContext(ctx, admin.ID) - memo, err := ts.Service.CreateMemo(ownerCtx, &v1pb.CreateMemoRequest{ - Memo: &v1pb.Memo{ + memo, err := ts.Service.CreateMemo(ownerCtx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{ Content: "memo with admin attachment", }, }) require.NoError(t, err) - created, err := ts.Service.CreateAttachment(adminCtx, &v1pb.CreateAttachmentRequest{ - Attachment: &v1pb.Attachment{ + created, err := ts.Service.CreateAttachment(adminCtx, &apipb.CreateAttachmentRequest{ + Attachment: &apipb.Attachment{ Filename: "admin.txt", Type: "text/plain", Content: []byte("admin"), @@ -358,14 +358,14 @@ func TestCreateAttachmentMemoPermission(t *testing.T) { // Removal deletes the attachment, so the memo author cannot remove a // file the administrator owns; the administrator can. - _, err = ts.Service.SetMemoAttachments(ownerCtx, &v1pb.SetMemoAttachmentsRequest{ + _, err = ts.Service.SetMemoAttachments(ownerCtx, &apipb.SetMemoAttachmentsRequest{ Name: memo.Name, - Attachments: []*v1pb.Attachment{}, + Attachments: []*apipb.Attachment{}, }) require.Equal(t, codes.PermissionDenied, status.Code(err)) - _, err = ts.Service.SetMemoAttachments(adminCtx, &v1pb.SetMemoAttachmentsRequest{ + _, err = ts.Service.SetMemoAttachments(adminCtx, &apipb.SetMemoAttachmentsRequest{ Name: memo.Name, - Attachments: []*v1pb.Attachment{}, + Attachments: []*apipb.Attachment{}, }) require.NoError(t, err) attachments, err = ts.Store.ListAttachments(ctx, &store.FindAttachment{CreatorID: &admin.ID}) @@ -384,15 +384,15 @@ func TestCreateAttachmentMemoPermission(t *testing.T) { require.NoError(t, err) otherCtx := ts.CreateUserContext(ctx, other.ID) - memo, err := ts.Service.CreateMemo(ownerCtx, &v1pb.CreateMemoRequest{ - Memo: &v1pb.Memo{ + memo, err := ts.Service.CreateMemo(ownerCtx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{ Content: "memo with blocked attachment", }, }) require.NoError(t, err) - _, err = ts.Service.CreateAttachment(otherCtx, &v1pb.CreateAttachmentRequest{ - Attachment: &v1pb.Attachment{ + _, err = ts.Service.CreateAttachment(otherCtx, &apipb.CreateAttachmentRequest{ + Attachment: &apipb.Attachment{ Filename: "blocked.txt", Type: "text/plain", Content: []byte("blocked"), @@ -434,11 +434,11 @@ func TestLinkedAttachmentMutationsRevalidateMemoSpaceMembership(t *testing.T) { UID: "attachment-lifecycle-comment", CreatorID: member.ID, Content: "comment", Visibility: store.SpaceAudience, SpaceID: &space.ID, }, root.ID, member.ID) require.NoError(t, err) - memoName := apiv1.MemoNamePrefix + comment.UID + memoName := api.MemoNamePrefix + comment.UID - createLinked := func(filename string) *v1pb.Attachment { + createLinked := func(filename string) *apipb.Attachment { t.Helper() - attachment, createErr := ts.Service.CreateAttachment(memberCtx, &v1pb.CreateAttachmentRequest{Attachment: &v1pb.Attachment{ + attachment, createErr := ts.Service.CreateAttachment(memberCtx, &apipb.CreateAttachmentRequest{Attachment: &apipb.Attachment{ Filename: filename, Type: "text/plain", Content: []byte(filename), @@ -451,29 +451,29 @@ func TestLinkedAttachmentMutationsRevalidateMemoSpaceMembership(t *testing.T) { deleteTarget := createLinked("delete-after-revoke.txt") batchTarget := createLinked("batch-after-revoke.txt") - _, err = ts.Service.UpdateAttachment(memberCtx, &v1pb.UpdateAttachmentRequest{ - Attachment: &v1pb.Attachment{Name: updateTarget.Name, Filename: "updated-before-revoke.txt"}, + _, err = ts.Service.UpdateAttachment(memberCtx, &apipb.UpdateAttachmentRequest{ + Attachment: &apipb.Attachment{Name: updateTarget.Name, Filename: "updated-before-revoke.txt"}, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"filename"}}, }) require.NoError(t, err) require.NoError(t, ts.Store.DeleteSpaceMember(ctx, &store.DeleteSpaceMember{SpaceID: space.ID, UserID: member.ID}, owner.ID)) - _, err = ts.Service.CreateAttachment(memberCtx, &v1pb.CreateAttachmentRequest{Attachment: &v1pb.Attachment{ + _, err = ts.Service.CreateAttachment(memberCtx, &apipb.CreateAttachmentRequest{Attachment: &apipb.Attachment{ Filename: "create-after-revoke.txt", Type: "text/plain", Content: []byte("blocked"), Memo: &memoName, }}) require.Equal(t, codes.PermissionDenied, status.Code(err)) - _, err = ts.Service.UpdateAttachment(memberCtx, &v1pb.UpdateAttachmentRequest{ - Attachment: &v1pb.Attachment{Name: updateTarget.Name, Filename: "must-not-rename.txt"}, + _, err = ts.Service.UpdateAttachment(memberCtx, &apipb.UpdateAttachmentRequest{ + Attachment: &apipb.Attachment{Name: updateTarget.Name, Filename: "must-not-rename.txt"}, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"filename"}}, }) require.Equal(t, codes.PermissionDenied, status.Code(err)) - _, err = ts.Service.DeleteAttachment(memberCtx, &v1pb.DeleteAttachmentRequest{Name: deleteTarget.Name}) + _, err = ts.Service.DeleteAttachment(memberCtx, &apipb.DeleteAttachmentRequest{Name: deleteTarget.Name}) require.Equal(t, codes.PermissionDenied, status.Code(err)) - _, err = ts.Service.BatchDeleteAttachments(memberCtx, &v1pb.BatchDeleteAttachmentsRequest{Names: []string{batchTarget.Name}}) + _, err = ts.Service.BatchDeleteAttachments(memberCtx, &apipb.BatchDeleteAttachmentsRequest{Names: []string{batchTarget.Name}}) require.Equal(t, codes.PermissionDenied, status.Code(err)) - for _, attachment := range []*v1pb.Attachment{updateTarget, deleteTarget, batchTarget} { - uid, extractErr := apiv1.ExtractAttachmentUIDFromName(attachment.Name) + for _, attachment := range []*apipb.Attachment{updateTarget, deleteTarget, batchTarget} { + uid, extractErr := api.ExtractAttachmentUIDFromName(attachment.Name) require.NoError(t, extractErr) stored, getErr := ts.Store.GetAttachment(ctx, &store.FindAttachment{UID: &uid}) require.NoError(t, getErr) @@ -481,7 +481,7 @@ func TestLinkedAttachmentMutationsRevalidateMemoSpaceMembership(t *testing.T) { require.NotNil(t, stored.MemoID) require.Equal(t, comment.ID, *stored.MemoID) } - updateUID, err := apiv1.ExtractAttachmentUIDFromName(updateTarget.Name) + updateUID, err := api.ExtractAttachmentUIDFromName(updateTarget.Name) require.NoError(t, err) storedUpdate, err := ts.Store.GetAttachment(ctx, &store.FindAttachment{UID: &updateUID}) require.NoError(t, err) @@ -491,8 +491,8 @@ func TestLinkedAttachmentMutationsRevalidateMemoSpaceMembership(t *testing.T) { SpaceID: space.ID, UserID: member.ID, Role: store.SpaceMemberRoleUser, }, owner.ID) require.NoError(t, err) - _, err = ts.Service.UpdateAttachment(memberCtx, &v1pb.UpdateAttachmentRequest{ - Attachment: &v1pb.Attachment{Name: updateTarget.Name, Filename: "renamed-after-rejoin.txt"}, + _, err = ts.Service.UpdateAttachment(memberCtx, &apipb.UpdateAttachmentRequest{ + Attachment: &apipb.Attachment{Name: updateTarget.Name, Filename: "renamed-after-rejoin.txt"}, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"filename"}}, }) require.NoError(t, err) @@ -548,7 +548,7 @@ func TestListAttachmentsSpaceFilter(t *testing.T) { createAttachment("attachment-api-space-a-shared-file", &sharedMemo.ID) createAttachment("attachment-api-space-b-file", &spaceBMemo.ID) - attachmentFilenames := func(response *v1pb.ListAttachmentsResponse) []string { + attachmentFilenames := func(response *apipb.ListAttachmentsResponse) []string { t.Helper() filenames := make([]string, 0, len(response.Attachments)) for _, attachment := range response.Attachments { @@ -557,57 +557,57 @@ func TestListAttachmentsSpaceFilter(t *testing.T) { return filenames } ownerCtx := ts.CreateUserContext(ctx, owner.ID) - allResponse, err := ts.Service.ListAttachments(ownerCtx, &v1pb.ListAttachmentsRequest{PageSize: 100}) + allResponse, err := ts.Service.ListAttachments(ownerCtx, &apipb.ListAttachmentsRequest{PageSize: 100}) require.NoError(t, err) require.Len(t, allResponse.Attachments, 5, "omitting the filter includes every readable attachment and the owner's unused uploads") - spaceResponse, err := ts.Service.ListAttachments(ownerCtx, &v1pb.ListAttachmentsRequest{ + spaceResponse, err := ts.Service.ListAttachments(ownerCtx, &apipb.ListAttachmentsRequest{ PageSize: 100, Filter: `space == "spaces/` + spaceA.UID + `"`, }) require.NoError(t, err) require.ElementsMatch(t, []string{"attachment-api-space-a-file.txt", "attachment-api-space-a-shared-file.txt"}, attachmentFilenames(spaceResponse)) - unassignedResponse, err := ts.Service.ListAttachments(ownerCtx, &v1pb.ListAttachmentsRequest{ + unassignedResponse, err := ts.Service.ListAttachments(ownerCtx, &apipb.ListAttachmentsRequest{ PageSize: 100, Filter: `space == null`, }) require.NoError(t, err) require.ElementsMatch(t, []string{"attachment-api-unlinked.txt", "attachment-api-unassigned-file.txt"}, attachmentFilenames(unassignedResponse)) - unusedInMemos, err := ts.Service.ListAttachments(ownerCtx, &v1pb.ListAttachmentsRequest{ + unusedInMemos, err := ts.Service.ListAttachments(ownerCtx, &apipb.ListAttachmentsRequest{ PageSize: 100, Filter: "memo_id == null && space == null", }) require.NoError(t, err) require.Equal(t, []string{"attachment-api-unlinked.txt"}, attachmentFilenames(unusedInMemos)) - unusedInSpace, err := ts.Service.ListAttachments(ownerCtx, &v1pb.ListAttachmentsRequest{ + unusedInSpace, err := ts.Service.ListAttachments(ownerCtx, &apipb.ListAttachmentsRequest{ PageSize: 100, Filter: `memo_id == null && space == "spaces/` + spaceA.UID + `"`, }) require.NoError(t, err) require.Empty(t, unusedInSpace.Attachments) - memberResponse, err := ts.Service.ListAttachments(ts.CreateUserContext(ctx, member.ID), &v1pb.ListAttachmentsRequest{ + memberResponse, err := ts.Service.ListAttachments(ts.CreateUserContext(ctx, member.ID), &apipb.ListAttachmentsRequest{ PageSize: 100, Filter: `space == "spaces/` + spaceA.UID + `"`, }) require.NoError(t, err) require.Equal(t, []string{"attachment-api-space-a-shared-file.txt"}, attachmentFilenames(memberResponse)) - creatorResponse, err := ts.Service.ListAttachments(ts.CreateUserContext(ctx, member.ID), &v1pb.ListAttachmentsRequest{ + creatorResponse, err := ts.Service.ListAttachments(ts.CreateUserContext(ctx, member.ID), &apipb.ListAttachmentsRequest{ PageSize: 100, Filter: `creator == "users/` + owner.Username + `"`, }) require.NoError(t, err) require.ElementsMatch(t, []string{"attachment-api-space-a-shared-file.txt", "attachment-api-space-b-file.txt"}, attachmentFilenames(creatorResponse)) - _, err = ts.Service.ListAttachments(ts.CreateUserContext(ctx, outsider.ID), &v1pb.ListAttachmentsRequest{ + _, err = ts.Service.ListAttachments(ts.CreateUserContext(ctx, outsider.ID), &apipb.ListAttachmentsRequest{ Filter: `space == "spaces/` + spaceA.UID + `"`, }) require.Equal(t, codes.NotFound, status.Code(err)) - _, err = ts.Service.ListAttachments(ownerCtx, &v1pb.ListAttachmentsRequest{ + _, err = ts.Service.ListAttachments(ownerCtx, &apipb.ListAttachmentsRequest{ Filter: `space != null`, }) require.Equal(t, codes.InvalidArgument, status.Code(err)) @@ -632,21 +632,21 @@ func TestAttachmentCreatorIsUploader(t *testing.T) { require.NoError(t, err) authorCtx := ts.CreateUserContext(ctx, memoAuthor.ID) - listed, err := ts.Service.ListAttachments(authorCtx, &v1pb.ListAttachmentsRequest{ + listed, err := ts.Service.ListAttachments(authorCtx, &apipb.ListAttachmentsRequest{ Filter: `creator == "users/` + memoAuthor.Username + `"`, }) require.NoError(t, err) require.Len(t, listed.Attachments, 1) - require.Equal(t, apiv1.BuildUserName(uploader.Username), listed.Attachments[0].Creator) + require.Equal(t, api.BuildUserName(uploader.Username), listed.Attachments[0].Creator) - got, err := ts.Service.GetAttachment(authorCtx, &v1pb.GetAttachmentRequest{Name: listed.Attachments[0].Name}) + got, err := ts.Service.GetAttachment(authorCtx, &apipb.GetAttachmentRequest{Name: listed.Attachments[0].Name}) require.NoError(t, err) - require.Equal(t, apiv1.BuildUserName(uploader.Username), got.Creator) + require.Equal(t, api.BuildUserName(uploader.Username), got.Creator) } func memoIDFromName(ctx context.Context, t *testing.T, ts *TestService, name string) int32 { t.Helper() - memoUID, err := apiv1.ExtractMemoUIDFromName(name) + memoUID, err := api.ExtractMemoUIDFromName(name) require.NoError(t, err) memo, err := ts.Store.GetMemo(ctx, &store.FindMemo{UID: &memoUID}) require.NoError(t, err) @@ -664,28 +664,28 @@ func TestCreateAttachmentMotionMedia(t *testing.T) { userCtx := ts.CreateUserContext(ctx, user.ID) t.Run("Apple live photo metadata roundtrip", func(t *testing.T) { - attachment, err := ts.Service.CreateAttachment(userCtx, &v1pb.CreateAttachmentRequest{ - Attachment: &v1pb.Attachment{ + attachment, err := ts.Service.CreateAttachment(userCtx, &apipb.CreateAttachmentRequest{ + Attachment: &apipb.Attachment{ Filename: "live.heic", Type: "image/heic", Content: []byte("fake-heic-still"), - MotionMedia: &v1pb.MotionMedia{ - Family: v1pb.MotionMediaFamily_APPLE_LIVE_PHOTO, - Role: v1pb.MotionMediaRole_STILL, + MotionMedia: &apipb.MotionMedia{ + Family: apipb.MotionMediaFamily_APPLE_LIVE_PHOTO, + Role: apipb.MotionMediaRole_STILL, GroupId: "apple-group-1", }, }, }) require.NoError(t, err) require.NotNil(t, attachment.MotionMedia) - require.Equal(t, v1pb.MotionMediaFamily_APPLE_LIVE_PHOTO, attachment.MotionMedia.Family) - require.Equal(t, v1pb.MotionMediaRole_STILL, attachment.MotionMedia.Role) + require.Equal(t, apipb.MotionMediaFamily_APPLE_LIVE_PHOTO, attachment.MotionMedia.Family) + require.Equal(t, apipb.MotionMediaRole_STILL, attachment.MotionMedia.Role) require.Equal(t, "apple-group-1", attachment.MotionMedia.GroupId) }) t.Run("Android motion photo detection", func(t *testing.T) { - attachment, err := ts.Service.CreateAttachment(userCtx, &v1pb.CreateAttachmentRequest{ - Attachment: &v1pb.Attachment{ + attachment, err := ts.Service.CreateAttachment(userCtx, &apipb.CreateAttachmentRequest{ + Attachment: &apipb.Attachment{ Filename: "motion.jpg", Type: "image/jpeg", Content: testutil.BuildMotionPhotoJPEG(), @@ -693,8 +693,8 @@ func TestCreateAttachmentMotionMedia(t *testing.T) { }) require.NoError(t, err) require.NotNil(t, attachment.MotionMedia) - require.Equal(t, v1pb.MotionMediaFamily_ANDROID_MOTION_PHOTO, attachment.MotionMedia.Family) - require.Equal(t, v1pb.MotionMediaRole_CONTAINER, attachment.MotionMedia.Role) + require.Equal(t, apipb.MotionMediaFamily_ANDROID_MOTION_PHOTO, attachment.MotionMedia.Family) + require.Equal(t, apipb.MotionMediaRole_CONTAINER, attachment.MotionMedia.Role) require.True(t, attachment.MotionMedia.HasEmbeddedVideo) }) } @@ -708,15 +708,15 @@ func TestCreateAttachmentMediaMetadata(t *testing.T) { require.NoError(t, err) userCtx := ts.CreateUserContext(ctx, user.ID) - photoMetadata := &v1pb.MediaMetadata{ + photoMetadata := &apipb.MediaMetadata{ Width: proto.Int32(20), Height: proto.Int32(10), - Details: &v1pb.MediaMetadata_Photo{Photo: &v1pb.PhotoMetadata{ - CaptureTime: &v1pb.MediaCaptureTime{ + Details: &apipb.MediaMetadata_Photo{Photo: &apipb.PhotoMetadata{ + CaptureTime: &apipb.MediaCaptureTime{ LocalDateTime: "2026-08-10T14:32:18.123", UtcOffset: proto.String("+08:00"), }, - Location: &v1pb.MediaLocation{ + Location: &apipb.MediaLocation{ Latitude: proto.Float64(1.3521), Longitude: proto.Float64(103.8198), AltitudeMeters: proto.Float64(18.4), @@ -732,8 +732,8 @@ func TestCreateAttachmentMediaMetadata(t *testing.T) { }}, } - photo, err := ts.Service.CreateAttachment(userCtx, &v1pb.CreateAttachmentRequest{ - Attachment: &v1pb.Attachment{ + photo, err := ts.Service.CreateAttachment(userCtx, &apipb.CreateAttachmentRequest{ + Attachment: &apipb.Attachment{ Filename: "photo.jpg", Type: "image/jpeg", Content: testutil.BuildJPEG(20, 10), @@ -743,7 +743,7 @@ func TestCreateAttachmentMediaMetadata(t *testing.T) { require.NoError(t, err) require.True(t, proto.Equal(photoMetadata, photo.MediaMetadata)) - photoUID, err := apiv1.ExtractAttachmentUIDFromName(photo.Name) + photoUID, err := api.ExtractAttachmentUIDFromName(photo.Name) require.NoError(t, err) storedPhoto, err := ts.Store.GetAttachment(ctx, &store.FindAttachment{UID: &photoUID}) require.NoError(t, err) @@ -751,13 +751,13 @@ func TestCreateAttachmentMediaMetadata(t *testing.T) { require.Equal(t, "Apple", storedPhoto.Payload.GetMediaMetadata().GetPhoto().GetCameraMake()) require.Equal(t, int32(6), storedPhoto.Payload.GetMediaMetadata().GetPhoto().GetSourceExifOrientation()) - gotPhoto, err := ts.Service.GetAttachment(userCtx, &v1pb.GetAttachmentRequest{Name: photo.Name}) + gotPhoto, err := ts.Service.GetAttachment(userCtx, &apipb.GetAttachmentRequest{Name: photo.Name}) require.NoError(t, err) require.True(t, proto.Equal(photoMetadata, gotPhoto.MediaMetadata)) - listed, err := ts.Service.ListAttachments(userCtx, &v1pb.ListAttachmentsRequest{PageSize: 100}) + listed, err := ts.Service.ListAttachments(userCtx, &apipb.ListAttachmentsRequest{PageSize: 100}) require.NoError(t, err) - var listedPhoto *v1pb.Attachment + var listedPhoto *apipb.Attachment for _, attachment := range listed.Attachments { if attachment.Name == photo.Name { listedPhoto = attachment @@ -767,24 +767,24 @@ func TestCreateAttachmentMediaMetadata(t *testing.T) { require.NotNil(t, listedPhoto) require.True(t, proto.Equal(photoMetadata, listedPhoto.MediaMetadata)) - memo, err := ts.Service.CreateMemo(userCtx, &v1pb.CreateMemoRequest{Memo: &v1pb.Memo{ + memo, err := ts.Service.CreateMemo(userCtx, &apipb.CreateMemoRequest{Memo: &apipb.Memo{ Content: "memo with metadata", - Visibility: v1pb.Visibility_PRIVATE, - Attachments: []*v1pb.Attachment{{Name: photo.Name}}, + Visibility: apipb.Visibility_PRIVATE, + Attachments: []*apipb.Attachment{{Name: photo.Name}}, }}) require.NoError(t, err) require.Len(t, memo.Attachments, 1) require.True(t, proto.Equal(photoMetadata, memo.Attachments[0].MediaMetadata)) - video, err := ts.Service.CreateAttachment(userCtx, &v1pb.CreateAttachmentRequest{ - Attachment: &v1pb.Attachment{ + video, err := ts.Service.CreateAttachment(userCtx, &apipb.CreateAttachmentRequest{ + Attachment: &apipb.Attachment{ Filename: "clip.mp4", Type: "video/mp4", Content: []byte("fake-video"), - MediaMetadata: &v1pb.MediaMetadata{ + MediaMetadata: &apipb.MediaMetadata{ Width: proto.Int32(1920), Height: proto.Int32(1080), - Details: &v1pb.MediaMetadata_Video{Video: &v1pb.VideoMetadata{ + Details: &apipb.MediaMetadata_Video{Video: &apipb.VideoMetadata{ DurationSeconds: proto.Float64(12.5), }}, }, @@ -793,12 +793,12 @@ func TestCreateAttachmentMediaMetadata(t *testing.T) { require.NoError(t, err) require.Equal(t, 12.5, video.MediaMetadata.GetVideo().GetDurationSeconds()) - withoutMetadata, err := ts.Service.CreateAttachment(userCtx, &v1pb.CreateAttachmentRequest{ - Attachment: &v1pb.Attachment{Filename: "plain.png", Type: "image/png", Content: []byte("fake-png")}, + withoutMetadata, err := ts.Service.CreateAttachment(userCtx, &apipb.CreateAttachmentRequest{ + Attachment: &apipb.Attachment{Filename: "plain.png", Type: "image/png", Content: []byte("fake-png")}, }) require.NoError(t, err) require.Nil(t, withoutMetadata.MediaMetadata) - plainUID, err := apiv1.ExtractAttachmentUIDFromName(withoutMetadata.Name) + plainUID, err := api.ExtractAttachmentUIDFromName(withoutMetadata.Name) require.NoError(t, err) storedPlain, err := ts.Store.GetAttachment(ctx, &store.FindAttachment{UID: &plainUID}) require.NoError(t, err) @@ -814,23 +814,23 @@ func TestBatchDeleteAttachments(t *testing.T) { require.NoError(t, err) userCtx := ts.CreateUserContext(ctx, user.ID) - first, err := ts.Service.CreateAttachment(userCtx, &v1pb.CreateAttachmentRequest{ - Attachment: &v1pb.Attachment{Filename: "one.txt", Type: "text/plain", Content: []byte("one")}, + first, err := ts.Service.CreateAttachment(userCtx, &apipb.CreateAttachmentRequest{ + Attachment: &apipb.Attachment{Filename: "one.txt", Type: "text/plain", Content: []byte("one")}, }) require.NoError(t, err) - second, err := ts.Service.CreateAttachment(userCtx, &v1pb.CreateAttachmentRequest{ - Attachment: &v1pb.Attachment{Filename: "two.txt", Type: "text/plain", Content: []byte("two")}, + second, err := ts.Service.CreateAttachment(userCtx, &apipb.CreateAttachmentRequest{ + Attachment: &apipb.Attachment{Filename: "two.txt", Type: "text/plain", Content: []byte("two")}, }) require.NoError(t, err) - _, err = ts.Service.BatchDeleteAttachments(userCtx, &v1pb.BatchDeleteAttachmentsRequest{ + _, err = ts.Service.BatchDeleteAttachments(userCtx, &apipb.BatchDeleteAttachmentsRequest{ Names: []string{first.Name, second.Name}, }) require.NoError(t, err) - firstUID, err := apiv1.ExtractAttachmentUIDFromName(first.Name) + firstUID, err := api.ExtractAttachmentUIDFromName(first.Name) require.NoError(t, err) - secondUID, err := apiv1.ExtractAttachmentUIDFromName(second.Name) + secondUID, err := api.ExtractAttachmentUIDFromName(second.Name) require.NoError(t, err) storedFirst, err := ts.Store.GetAttachment(ctx, &store.FindAttachment{UID: &firstUID}) require.NoError(t, err) @@ -840,17 +840,17 @@ func TestBatchDeleteAttachments(t *testing.T) { require.Nil(t, storedSecond) t.Run("deduplicates duplicate names", func(t *testing.T) { - third, err := ts.Service.CreateAttachment(userCtx, &v1pb.CreateAttachmentRequest{ - Attachment: &v1pb.Attachment{Filename: "three.txt", Type: "text/plain", Content: []byte("three")}, + third, err := ts.Service.CreateAttachment(userCtx, &apipb.CreateAttachmentRequest{ + Attachment: &apipb.Attachment{Filename: "three.txt", Type: "text/plain", Content: []byte("three")}, }) require.NoError(t, err) - _, err = ts.Service.BatchDeleteAttachments(userCtx, &v1pb.BatchDeleteAttachmentsRequest{ + _, err = ts.Service.BatchDeleteAttachments(userCtx, &apipb.BatchDeleteAttachmentsRequest{ Names: []string{third.Name, third.Name}, }) require.NoError(t, err) - thirdUID, err := apiv1.ExtractAttachmentUIDFromName(third.Name) + thirdUID, err := api.ExtractAttachmentUIDFromName(third.Name) require.NoError(t, err) storedThird, err := ts.Store.GetAttachment(ctx, &store.FindAttachment{UID: &thirdUID}) require.NoError(t, err) @@ -858,8 +858,8 @@ func TestBatchDeleteAttachments(t *testing.T) { }) t.Run("rejects unauthorized deletes", func(t *testing.T) { - ownerAttachment, err := ts.Service.CreateAttachment(userCtx, &v1pb.CreateAttachmentRequest{ - Attachment: &v1pb.Attachment{Filename: "private.txt", Type: "text/plain", Content: []byte("private")}, + ownerAttachment, err := ts.Service.CreateAttachment(userCtx, &apipb.CreateAttachmentRequest{ + Attachment: &apipb.Attachment{Filename: "private.txt", Type: "text/plain", Content: []byte("private")}, }) require.NoError(t, err) @@ -867,7 +867,7 @@ func TestBatchDeleteAttachments(t *testing.T) { require.NoError(t, err) otherCtx := ts.CreateUserContext(ctx, otherUser.ID) - _, err = ts.Service.BatchDeleteAttachments(otherCtx, &v1pb.BatchDeleteAttachmentsRequest{ + _, err = ts.Service.BatchDeleteAttachments(otherCtx, &apipb.BatchDeleteAttachmentsRequest{ Names: []string{ownerAttachment.Name}, }) require.Error(t, err) @@ -883,9 +883,9 @@ func TestBatchDeleteAttachmentsReportsPostCommitStorageCleanupFailure(t *testing require.NoError(t, err) userCtx := ts.CreateUserContext(ctx, user.ID) - attachments := make([]*v1pb.Attachment, 0, 2) + attachments := make([]*apipb.Attachment, 0, 2) for _, filename := range []string{"retry-one.png", "retry-two.png"} { - attachment, err := ts.Service.CreateAttachment(userCtx, &v1pb.CreateAttachmentRequest{Attachment: &v1pb.Attachment{ + attachment, err := ts.Service.CreateAttachment(userCtx, &apipb.CreateAttachmentRequest{Attachment: &apipb.Attachment{ Filename: filename, Type: "image/png", Content: []byte(filename), @@ -893,15 +893,15 @@ func TestBatchDeleteAttachmentsReportsPostCommitStorageCleanupFailure(t *testing require.NoError(t, err) attachments = append(attachments, attachment) } - memo, err := ts.Service.CreateMemo(userCtx, &v1pb.CreateMemoRequest{Memo: &v1pb.Memo{ + memo, err := ts.Service.CreateMemo(userCtx, &apipb.CreateMemoRequest{Memo: &apipb.Memo{ Content: "batch deletion retry", - Attachments: []*v1pb.Attachment{{Name: attachments[0].Name}, {Name: attachments[1].Name}}, + Attachments: []*apipb.Attachment{{Name: attachments[0].Name}, {Name: attachments[1].Name}}, }}) require.NoError(t, err) localPaths := make([]string, 0, len(attachments)) for index, attachment := range attachments { - uid, err := apiv1.ExtractAttachmentUIDFromName(attachment.Name) + uid, err := api.ExtractAttachmentUIDFromName(attachment.Name) require.NoError(t, err) stored, err := ts.Store.GetAttachment(ctx, &store.FindAttachment{UID: &uid}) require.NoError(t, err) @@ -918,18 +918,18 @@ func TestBatchDeleteAttachmentsReportsPostCommitStorageCleanupFailure(t *testing } names := []string{attachments[0].Name, attachments[1].Name} - _, err = ts.Service.BatchDeleteAttachments(store.WithDeleteAttachmentStorageFailpoint(userCtx), &v1pb.BatchDeleteAttachmentsRequest{Names: names}) + _, err = ts.Service.BatchDeleteAttachments(store.WithDeleteAttachmentStorageFailpoint(userCtx), &apipb.BatchDeleteAttachmentsRequest{Names: names}) require.Equal(t, codes.Internal, status.Code(err)) require.ErrorContains(t, err, "attachments were deleted but storage cleanup failed") require.ErrorContains(t, err, store.ErrDeleteAttachmentStorageFailpoint.Error()) for _, attachment := range attachments { - uid, err := apiv1.ExtractAttachmentUIDFromName(attachment.Name) + uid, err := api.ExtractAttachmentUIDFromName(attachment.Name) require.NoError(t, err) stored, err := ts.Store.GetAttachment(ctx, &store.FindAttachment{UID: &uid}) require.NoError(t, err) require.Nil(t, stored) } - listed, err := ts.Service.ListMemoAttachments(userCtx, &v1pb.ListMemoAttachmentsRequest{Name: memo.Name}) + listed, err := ts.Service.ListMemoAttachments(userCtx, &apipb.ListMemoAttachmentsRequest{Parent: memo.Name}) require.NoError(t, err) require.Empty(t, listed.Attachments) for _, path := range localPaths { @@ -946,32 +946,32 @@ func TestDeleteMotionMediaGroupRequiresWholeGroup(t *testing.T) { require.NoError(t, err) userCtx := ts.CreateUserContext(ctx, user.ID) - still, err := ts.Service.CreateAttachment(userCtx, &v1pb.CreateAttachmentRequest{Attachment: &v1pb.Attachment{ + still, err := ts.Service.CreateAttachment(userCtx, &apipb.CreateAttachmentRequest{Attachment: &apipb.Attachment{ Filename: "live.jpg", Type: "image/jpeg", Content: []byte("still"), - MotionMedia: &v1pb.MotionMedia{ - Family: v1pb.MotionMediaFamily_APPLE_LIVE_PHOTO, - Role: v1pb.MotionMediaRole_STILL, + MotionMedia: &apipb.MotionMedia{ + Family: apipb.MotionMediaFamily_APPLE_LIVE_PHOTO, + Role: apipb.MotionMediaRole_STILL, GroupId: "delete-live-group", }, }}) require.NoError(t, err) - video, err := ts.Service.CreateAttachment(userCtx, &v1pb.CreateAttachmentRequest{Attachment: &v1pb.Attachment{ + video, err := ts.Service.CreateAttachment(userCtx, &apipb.CreateAttachmentRequest{Attachment: &apipb.Attachment{ Filename: "live.mov", Type: "video/quicktime", Content: []byte("video"), - MotionMedia: &v1pb.MotionMedia{ - Family: v1pb.MotionMediaFamily_APPLE_LIVE_PHOTO, - Role: v1pb.MotionMediaRole_VIDEO, + MotionMedia: &apipb.MotionMedia{ + Family: apipb.MotionMediaFamily_APPLE_LIVE_PHOTO, + Role: apipb.MotionMediaRole_VIDEO, GroupId: "delete-live-group", }, }}) require.NoError(t, err) - _, err = ts.Service.DeleteAttachment(userCtx, &v1pb.DeleteAttachmentRequest{Name: still.Name}) + _, err = ts.Service.DeleteAttachment(userCtx, &apipb.DeleteAttachmentRequest{Name: still.Name}) require.Equal(t, codes.FailedPrecondition, status.Code(err)) - _, err = ts.Service.BatchDeleteAttachments(userCtx, &v1pb.BatchDeleteAttachmentsRequest{Names: []string{still.Name, video.Name}}) + _, err = ts.Service.BatchDeleteAttachments(userCtx, &apipb.BatchDeleteAttachmentsRequest{Names: []string{still.Name, video.Name}}) require.NoError(t, err) } @@ -1018,7 +1018,7 @@ func TestDeleteMotionMediaGroupChecksBeyondDefaultAttachmentPage(t *testing.T) { updatedTs := still.UpdatedTs + 1000 require.NoError(t, ts.Store.UpdateAttachment(ctx, &store.UpdateAttachment{ID: video.ID, UpdatedTs: &updatedTs})) - _, err = ts.Service.DeleteAttachment(userCtx, &v1pb.DeleteAttachmentRequest{Name: "attachments/" + video.UID}) + _, err = ts.Service.DeleteAttachment(userCtx, &apipb.DeleteAttachmentRequest{Name: "attachments/" + video.UID}) require.Equal(t, codes.FailedPrecondition, status.Code(err)) } @@ -1028,6 +1028,6 @@ func TestListAttachmentsRejectsNegativePageToken(t *testing.T) { ctx := context.Background() user, err := ts.CreateRegularUser(ctx, "pager") require.NoError(t, err) - _, err = ts.Service.ListAttachments(ts.CreateUserContext(ctx, user.ID), &v1pb.ListAttachmentsRequest{PageToken: "-5"}) + _, err = ts.Service.ListAttachments(ts.CreateUserContext(ctx, user.ID), &apipb.ListAttachmentsRequest{PageToken: "-5"}) require.Equal(t, codes.InvalidArgument, status.Code(err)) } diff --git a/server/api/v1/test/auth_service_sso_username_test.go b/server/api/test/auth_service_sso_username_test.go similarity index 95% rename from server/api/v1/test/auth_service_sso_username_test.go rename to server/api/test/auth_service_sso_username_test.go index a16e7f5a8..b98e6358d 100644 --- a/server/api/v1/test/auth_service_sso_username_test.go +++ b/server/api/test/auth_service_sso_username_test.go @@ -11,9 +11,9 @@ import ( "google.golang.org/grpc/codes" "google.golang.org/grpc/status" - v1pb "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" storepb "github.com/usememos/memos/proto/gen/store" - apiv1 "github.com/usememos/memos/server/api/v1" + "github.com/usememos/memos/server/api" "github.com/usememos/memos/store" ) @@ -224,7 +224,7 @@ func TestConcurrentSSOFirstSignInConvergesOnOneUser(t *testing.T) { const signInCount = 8 start := make(chan struct{}) - results := make(chan *v1pb.SignInResponse, signInCount) + results := make(chan *apipb.SignInResponse, signInCount) errs := make(chan error, signInCount) var waitGroup sync.WaitGroup for range signInCount { @@ -341,13 +341,13 @@ func TestSSOSignInAllowsLinkedUserWhenRegistrationDisabled(t *testing.T) { require.Len(t, users, 1) } -func signInWithTestingSSO(ctx context.Context, ts *TestService, idpName, code string) (*v1pb.SignInResponse, error) { - return ts.Service.SignIn(apiv1.WithHeaderCarrier(ctx), &v1pb.SignInRequest{ - Credentials: &v1pb.SignInRequest_SsoCredentials{ - SsoCredentials: &v1pb.SignInRequest_SSOCredentials{ - IdpName: idpName, - Code: code, - RedirectUri: "http://localhost:8080/auth/callback", +func signInWithTestingSSO(ctx context.Context, ts *TestService, idpName, code string) (*apipb.SignInResponse, error) { + return ts.Service.SignIn(api.WithHeaderCarrier(ctx), &apipb.SignInRequest{ + Credentials: &apipb.SignInRequest_SsoCredentials_{ + SsoCredentials: &apipb.SignInRequest_SsoCredentials{ + IdentityProvider: idpName, + Code: code, + RedirectUri: "http://localhost:8080/auth/callback", }, }, }) diff --git a/server/api/v1/test/auth_service_test.go b/server/api/test/auth_service_test.go similarity index 72% rename from server/api/v1/test/auth_service_test.go rename to server/api/test/auth_service_test.go index 995cafbda..a6e703fae 100644 --- a/server/api/v1/test/auth_service_test.go +++ b/server/api/test/auth_service_test.go @@ -13,9 +13,9 @@ import ( "google.golang.org/grpc/codes" "google.golang.org/grpc/status" - v1pb "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" storepb "github.com/usememos/memos/proto/gen/store" - apiv1 "github.com/usememos/memos/server/api/v1" + "github.com/usememos/memos/server/api" "github.com/usememos/memos/store" ) @@ -40,18 +40,18 @@ func TestCreateLinkedIdentityBindsCurrentUser(t *testing.T) { beforeUsers, err := ts.Store.ListUsers(ctx, &store.FindUser{}) require.NoError(t, err) - authCtx := ts.CreateUserContext(apiv1.WithHeaderCarrier(ctx), currentUser.ID) - response, err := ts.Service.CreateLinkedIdentity(authCtx, &v1pb.CreateLinkedIdentityRequest{ - Parent: apiv1.BuildUserName(currentUser.Username), - IdpName: idpName, - Code: "bind-code", - RedirectUri: "http://localhost:8080/auth/callback", + authCtx := ts.CreateUserContext(api.WithHeaderCarrier(ctx), currentUser.ID) + response, err := ts.Service.CreateLinkedIdentity(authCtx, &apipb.CreateLinkedIdentityRequest{ + Parent: api.BuildUserName(currentUser.Username), + IdentityProvider: idpName, + Code: "bind-code", + RedirectUri: "http://localhost:8080/auth/callback", }) require.NoError(t, err) require.NotNil(t, response) - require.Equal(t, apiv1.BuildUserName(currentUser.Username)+"/linkedIdentities/google-bind", response.Name) - require.Equal(t, apiv1.IdentityProviderNamePrefix+"google-bind", response.IdpName) - require.Equal(t, "google-sub-1", response.ExternUid) + require.Equal(t, api.BuildUserName(currentUser.Username)+"/linkedIdentities/google-bind", response.Name) + require.Equal(t, api.IdentityProviderNamePrefix+"google-bind", response.IdentityProvider) + require.Equal(t, "google-sub-1", response.ExternalUid) afterUsers, err := ts.Store.ListUsers(ctx, &store.FindUser{}) require.NoError(t, err) @@ -95,12 +95,12 @@ func TestCreateLinkedIdentityRejectsBindingIdentityLinkedToAnotherUser(t *testin }) require.NoError(t, err) - authCtx := ts.CreateUserContext(apiv1.WithHeaderCarrier(ctx), binder.ID) - _, err = ts.Service.CreateLinkedIdentity(authCtx, &v1pb.CreateLinkedIdentityRequest{ - Parent: apiv1.BuildUserName(binder.Username), - IdpName: idpName, - Code: "conflict-code", - RedirectUri: "http://localhost:8080/auth/callback", + authCtx := ts.CreateUserContext(api.WithHeaderCarrier(ctx), binder.ID) + _, err = ts.Service.CreateLinkedIdentity(authCtx, &apipb.CreateLinkedIdentityRequest{ + Parent: api.BuildUserName(binder.Username), + IdentityProvider: idpName, + Code: "conflict-code", + RedirectUri: "http://localhost:8080/auth/callback", }) require.Error(t, err) require.Equal(t, codes.AlreadyExists, status.Code(err)) @@ -124,31 +124,31 @@ func TestListAndDeleteLinkedIdentities(t *testing.T) { require.NoError(t, err) authCtx := ts.CreateUserContext(ctx, currentUser.ID) - listResp, err := ts.Service.ListLinkedIdentities(authCtx, &v1pb.ListLinkedIdentitiesRequest{ - Parent: apiv1.BuildUserName(currentUser.Username), + listResp, err := ts.Service.ListLinkedIdentities(authCtx, &apipb.ListLinkedIdentitiesRequest{ + Parent: api.BuildUserName(currentUser.Username), }) require.NoError(t, err) require.Len(t, listResp.LinkedIdentities, 1) - linkedIdentityName := apiv1.BuildUserName(currentUser.Username) + "/linkedIdentities/google" + linkedIdentityName := api.BuildUserName(currentUser.Username) + "/linkedIdentities/google" require.Equal(t, linkedIdentityName, listResp.LinkedIdentities[0].Name) - require.Equal(t, apiv1.IdentityProviderNamePrefix+"google", listResp.LinkedIdentities[0].IdpName) - require.Equal(t, "alice@gmail.com", listResp.LinkedIdentities[0].ExternUid) + require.Equal(t, api.IdentityProviderNamePrefix+"google", listResp.LinkedIdentities[0].IdentityProvider) + require.Equal(t, "alice@gmail.com", listResp.LinkedIdentities[0].ExternalUid) - got, err := ts.Service.GetLinkedIdentity(authCtx, &v1pb.GetLinkedIdentityRequest{ + got, err := ts.Service.GetLinkedIdentity(authCtx, &apipb.GetLinkedIdentityRequest{ Name: linkedIdentityName, }) require.NoError(t, err) require.Equal(t, linkedIdentityName, got.Name) - require.Equal(t, apiv1.IdentityProviderNamePrefix+"google", got.IdpName) - require.Equal(t, "alice@gmail.com", got.ExternUid) + require.Equal(t, api.IdentityProviderNamePrefix+"google", got.IdentityProvider) + require.Equal(t, "alice@gmail.com", got.ExternalUid) - _, err = ts.Service.DeleteLinkedIdentity(authCtx, &v1pb.DeleteLinkedIdentityRequest{ + _, err = ts.Service.DeleteLinkedIdentity(authCtx, &apipb.DeleteLinkedIdentityRequest{ Name: linkedIdentityName, }) require.NoError(t, err) - listResp, err = ts.Service.ListLinkedIdentities(authCtx, &v1pb.ListLinkedIdentitiesRequest{ - Parent: apiv1.BuildUserName(currentUser.Username), + listResp, err = ts.Service.ListLinkedIdentities(authCtx, &apipb.ListLinkedIdentitiesRequest{ + Parent: api.BuildUserName(currentUser.Username), }) require.NoError(t, err) require.Empty(t, listResp.LinkedIdentities) @@ -164,8 +164,8 @@ func TestListLinkedIdentitiesRequiresAuthentication(t *testing.T) { user, err := ts.CreateRegularUser(ctx, "linked-identity-auth") require.NoError(t, err) - _, err = ts.Service.ListLinkedIdentities(ctx, &v1pb.ListLinkedIdentitiesRequest{ - Parent: apiv1.BuildUserName(user.Username), + _, err = ts.Service.ListLinkedIdentities(ctx, &apipb.ListLinkedIdentitiesRequest{ + Parent: api.BuildUserName(user.Username), }) require.Error(t, err) require.Equal(t, codes.Unauthenticated, status.Code(err)) @@ -196,13 +196,13 @@ func TestCreateLinkedIdentityRejectsSecondIdentityForSameProvider(t *testing.T) defer mockIDP.Close() idpName := createTestingOAuthIdentityProvider(ctx, t, ts, mockIDP.URL, "google-provider") - authCtx := ts.CreateUserContext(apiv1.WithHeaderCarrier(ctx), currentUser.ID) + authCtx := ts.CreateUserContext(api.WithHeaderCarrier(ctx), currentUser.ID) - _, err = ts.Service.CreateLinkedIdentity(authCtx, &v1pb.CreateLinkedIdentityRequest{ - Parent: apiv1.BuildUserName(currentUser.Username), - IdpName: idpName, - Code: "second-code", - RedirectUri: "http://localhost:8080/auth/callback", + _, err = ts.Service.CreateLinkedIdentity(authCtx, &apipb.CreateLinkedIdentityRequest{ + Parent: api.BuildUserName(currentUser.Username), + IdentityProvider: idpName, + Code: "second-code", + RedirectUri: "http://localhost:8080/auth/callback", }) require.Error(t, err) require.Equal(t, codes.AlreadyExists, status.Code(err)) @@ -233,7 +233,7 @@ func createTestingOAuthIdentityProvider(ctx context.Context, t *testing.T, ts *T }, }) require.NoError(t, err) - return apiv1.IdentityProviderNamePrefix + idp.Uid + return api.IdentityProviderNamePrefix + idp.Uid } func newMockOAuthServer(t *testing.T, code, accessToken string, userInfo map[string]any) *httptest.Server { diff --git a/server/api/v1/test/auth_test.go b/server/api/test/auth_test.go similarity index 100% rename from server/api/v1/test/auth_test.go rename to server/api/test/auth_test.go diff --git a/server/api/v1/test/authz_test.go b/server/api/test/authz_test.go similarity index 82% rename from server/api/v1/test/authz_test.go rename to server/api/test/authz_test.go index feb029f71..fd1a8aa4b 100644 --- a/server/api/v1/test/authz_test.go +++ b/server/api/test/authz_test.go @@ -9,7 +9,7 @@ import ( "github.com/usememos/memos/internal/random" storepb "github.com/usememos/memos/proto/gen/store" - apiv1 "github.com/usememos/memos/server/api/v1" + "github.com/usememos/memos/server/api" "github.com/usememos/memos/server/auth" ) @@ -22,15 +22,15 @@ func TestAuthorizerPrivateInstanceRegistration(t *testing.T) { defer ts.Cleanup() require.NoError(t, ts.SetInstanceAccessMode(ctx, storepb.InstanceAccessMode_INSTANCE_ACCESS_MODE_PRIVATE)) - authorizer := apiv1.NewAuthorizer(ts.Store, ts.Secret) + authorizer := api.NewAuthorizer(ts.Store, ts.Secret) const ( - createUser = "/memos.api.v1.UserService/CreateUser" - signIn = "/memos.api.v1.AuthService/SignIn" - listMemos = "/memos.api.v1.MemoService/ListMemos" - listReactions = "/memos.api.v1.MemoService/ListMemoReactions" - listRelations = "/memos.api.v1.MemoService/ListMemoRelations" - getSharedMemo = "/memos.api.v1.MemoService/GetSharedMemo" + createUser = "/memos.api.UserService/CreateUser" + signIn = "/memos.api.AuthService/SignIn" + listMemos = "/memos.api.MemoService/ListMemos" + listReactions = "/memos.api.MemoService/ListMemoReactions" + listRelations = "/memos.api.MemoService/ListMemoRelations" + getSharedMemo = "/memos.api.MemoService/GetSharedMemo" ) // Anonymous request with no Authorization header resolves to no identity. @@ -40,9 +40,9 @@ func TestAuthorizerPrivateInstanceRegistration(t *testing.T) { require.NoError(t, authorizer.CheckAccess(ctx, createUser, nil)) require.NoError(t, authorizer.CheckAccess(ctx, signIn, nil)) require.NoError(t, authorizer.CheckAccess(ctx, getSharedMemo, nil)) - require.ErrorIs(t, authorizer.CheckAccess(ctx, listMemos, nil), apiv1.ErrUnauthenticated) - require.ErrorIs(t, authorizer.CheckAccess(ctx, listReactions, nil), apiv1.ErrUnauthenticated) - require.ErrorIs(t, authorizer.CheckAccess(ctx, listRelations, nil), apiv1.ErrUnauthenticated) + require.ErrorIs(t, authorizer.CheckAccess(ctx, listMemos, nil), api.ErrUnauthenticated) + require.ErrorIs(t, authorizer.CheckAccess(ctx, listReactions, nil), api.ErrUnauthenticated) + require.ErrorIs(t, authorizer.CheckAccess(ctx, listRelations, nil), api.ErrUnauthenticated) // Policy reads are fresh: changing to PUBLIC immediately opens browsing. require.NoError(t, ts.SetInstanceAccessMode(ctx, storepb.InstanceAccessMode_INSTANCE_ACCESS_MODE_PUBLIC)) @@ -79,7 +79,7 @@ func TestAuthorizerAccessTokenAlwaysWorksOnPrivateInstance(t *testing.T) { })) require.NoError(t, ts.SetInstanceAccessMode(ctx, storepb.InstanceAccessMode_INSTANCE_ACCESS_MODE_PRIVATE)) - authorizer := apiv1.NewAuthorizer(ts.Store, ts.Secret) + authorizer := api.NewAuthorizer(ts.Store, ts.Secret) result := authorizer.Authenticate(ctx, "Bearer "+token) require.NotNil(t, result) @@ -87,5 +87,5 @@ func TestAuthorizerAccessTokenAlwaysWorksOnPrivateInstance(t *testing.T) { require.Equal(t, user.ID, result.User.ID) // An authenticated caller passes access control even for a gated method. - require.NoError(t, authorizer.CheckAccess(ctx, "/memos.api.v1.MemoService/ListMemos", result)) + require.NoError(t, authorizer.CheckAccess(ctx, "/memos.api.MemoService/ListMemos", result)) } diff --git a/server/api/v1/test/configuration_provisioning_test.go b/server/api/test/configuration_provisioning_test.go similarity index 70% rename from server/api/v1/test/configuration_provisioning_test.go rename to server/api/test/configuration_provisioning_test.go index ba9112565..0619e7241 100644 --- a/server/api/v1/test/configuration_provisioning_test.go +++ b/server/api/test/configuration_provisioning_test.go @@ -13,7 +13,7 @@ import ( "google.golang.org/protobuf/proto" "google.golang.org/protobuf/types/known/fieldmaskpb" - v1pb "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" storepb "github.com/usememos/memos/proto/gen/store" ) @@ -39,38 +39,38 @@ func TestDeploymentConfiguredResourcesRejectMutations(t *testing.T) { }) require.NoError(t, ts.Store.LoadDeploymentConfigurationDir(ctx, dir)) - providers, err := ts.Service.ListIdentityProviders(ctx, &v1pb.ListIdentityProvidersRequest{}) + providers, err := ts.Service.ListIdentityProviders(ctx, &apipb.ListIdentityProvidersRequest{}) require.NoError(t, err) require.Len(t, providers.IdentityProviders, 1) require.Equal(t, "Primary SSO", providers.IdentityProviders[0].Title) - setting, err := ts.Service.GetInstanceSetting(ctx, &v1pb.GetInstanceSettingRequest{Name: "instance/settings/GENERAL"}) + setting, err := ts.Service.GetInstanceSetting(ctx, &apipb.GetInstanceSettingRequest{Name: "instance/settings/GENERAL"}) require.NoError(t, err) require.Equal(t, int32(1), setting.GetGeneralSetting().WeekStartDayOffset) - storageSetting, err := ts.Service.GetInstanceSetting(adminCtx, &v1pb.GetInstanceSettingRequest{Name: "instance/settings/STORAGE"}) + storageSetting, err := ts.Service.GetInstanceSetting(adminCtx, &apipb.GetInstanceSettingRequest{Name: "instance/settings/STORAGE"}) require.NoError(t, err) require.Equal(t, int64(30), storageSetting.GetStorageSetting().UploadSizeLimitMb) require.Equal(t, "assets/{timestamp}_{uuid}_{filename}", storageSetting.GetStorageSetting().FilepathTemplate) - _, err = ts.Service.CreateIdentityProvider(adminCtx, &v1pb.CreateIdentityProviderRequest{ + _, err = ts.Service.CreateIdentityProvider(adminCtx, &apipb.CreateIdentityProviderRequest{ IdentityProviderId: "primary-sso", IdentityProvider: testAPIIdentityProvider("Replacement"), }) require.Equal(t, codes.FailedPrecondition, status.Code(err)) - _, err = ts.Service.UpdateIdentityProvider(adminCtx, &v1pb.UpdateIdentityProviderRequest{ - IdentityProvider: &v1pb.IdentityProvider{Name: "identity-providers/primary-sso", Title: "Changed"}, + _, err = ts.Service.UpdateIdentityProvider(adminCtx, &apipb.UpdateIdentityProviderRequest{ + IdentityProvider: &apipb.IdentityProvider{Name: "identity-providers/primary-sso", Title: "Changed"}, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"title"}}, }) require.Equal(t, codes.FailedPrecondition, status.Code(err)) - _, err = ts.Service.DeleteIdentityProvider(adminCtx, &v1pb.DeleteIdentityProviderRequest{Name: "identity-providers/primary-sso"}) + _, err = ts.Service.DeleteIdentityProvider(adminCtx, &apipb.DeleteIdentityProviderRequest{Name: "identity-providers/primary-sso"}) require.Equal(t, codes.FailedPrecondition, status.Code(err)) - _, err = ts.Service.UpdateInstanceSetting(adminCtx, &v1pb.UpdateInstanceSettingRequest{ - Setting: &v1pb.InstanceSetting{ + _, err = ts.Service.UpdateInstanceSetting(adminCtx, &apipb.UpdateInstanceSettingRequest{ + InstanceSetting: &apipb.InstanceSetting{ Name: "instance/settings/GENERAL", - Value: &v1pb.InstanceSetting_GeneralSetting_{GeneralSetting: &v1pb.InstanceSetting_GeneralSetting{}}, + Value: &apipb.InstanceSetting_GeneralSetting_{GeneralSetting: &apipb.InstanceSetting_GeneralSetting{}}, }, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"general_setting"}}, }) @@ -87,9 +87,9 @@ func TestAuthenticationMutationAPIRejectsLockout(t *testing.T) { require.NoError(t, err) adminCtx := ts.CreateUserContext(ctx, admin.ID) - _, err = ts.Service.UpdateInstanceSetting(adminCtx, &v1pb.UpdateInstanceSettingRequest{Setting: &v1pb.InstanceSetting{ + _, err = ts.Service.UpdateInstanceSetting(adminCtx, &apipb.UpdateInstanceSettingRequest{InstanceSetting: &apipb.InstanceSetting{ Name: "instance/settings/GENERAL", - Value: &v1pb.InstanceSetting_GeneralSetting_{GeneralSetting: &v1pb.InstanceSetting_GeneralSetting{ + Value: &apipb.InstanceSetting_GeneralSetting_{GeneralSetting: &apipb.InstanceSetting_GeneralSetting{ DisallowPasswordAuth: true, }}, }}) @@ -102,20 +102,20 @@ func TestAuthenticationMutationAPIRejectsLockout(t *testing.T) { admin, err := ts.CreateHostUser(ctx, "admin") require.NoError(t, err) adminCtx := ts.CreateUserContext(ctx, admin.ID) - created, err := ts.Service.CreateIdentityProvider(adminCtx, &v1pb.CreateIdentityProviderRequest{ + created, err := ts.Service.CreateIdentityProvider(adminCtx, &apipb.CreateIdentityProviderRequest{ IdentityProviderId: "primary-sso", IdentityProvider: testAPIIdentityProvider("Primary"), }) require.NoError(t, err) - _, err = ts.Service.UpdateInstanceSetting(adminCtx, &v1pb.UpdateInstanceSettingRequest{Setting: &v1pb.InstanceSetting{ + _, err = ts.Service.UpdateInstanceSetting(adminCtx, &apipb.UpdateInstanceSettingRequest{InstanceSetting: &apipb.InstanceSetting{ Name: "instance/settings/GENERAL", - Value: &v1pb.InstanceSetting_GeneralSetting_{GeneralSetting: &v1pb.InstanceSetting_GeneralSetting{ + Value: &apipb.InstanceSetting_GeneralSetting_{GeneralSetting: &apipb.InstanceSetting_GeneralSetting{ DisallowPasswordAuth: true, }}, }}) require.NoError(t, err) - _, err = ts.Service.DeleteIdentityProvider(adminCtx, &v1pb.DeleteIdentityProviderRequest{Name: created.Name}) + _, err = ts.Service.DeleteIdentityProvider(adminCtx, &apipb.DeleteIdentityProviderRequest{Name: created.Name}) require.Equal(t, codes.FailedPrecondition, status.Code(err)) }) } @@ -137,18 +137,18 @@ func testStoreIdentityProvider(uid string) *storepb.IdentityProvider { } } -func testAPIIdentityProvider(title string) *v1pb.IdentityProvider { - return &v1pb.IdentityProvider{ +func testAPIIdentityProvider(title string) *apipb.IdentityProvider { + return &apipb.IdentityProvider{ Title: title, - Type: v1pb.IdentityProvider_OAUTH2, - Config: &v1pb.IdentityProviderConfig{Config: &v1pb.IdentityProviderConfig_Oauth2Config{Oauth2Config: &v1pb.OAuth2Config{ + Type: apipb.IdentityProvider_OAUTH2, + Config: &apipb.IdentityProviderConfig{Config: &apipb.IdentityProviderConfig_Oauth2Config{Oauth2Config: &apipb.OAuth2Config{ ClientId: "client-id", ClientSecret: "client-secret", AuthUrl: "https://example.com/authorize", TokenUrl: "https://example.com/token", UserInfoUrl: "https://example.com/userinfo", Scopes: []string{"openid", "profile"}, - FieldMapping: &v1pb.FieldMapping{Identifier: "sub"}, + FieldMapping: &apipb.FieldMapping{Identifier: "sub"}, }}}, } } diff --git a/server/api/v1/test/idp_service_test.go b/server/api/test/idp_service_test.go similarity index 75% rename from server/api/v1/test/idp_service_test.go rename to server/api/test/idp_service_test.go index 7b08851a7..8fdd42b5e 100644 --- a/server/api/v1/test/idp_service_test.go +++ b/server/api/test/idp_service_test.go @@ -7,8 +7,8 @@ import ( "github.com/stretchr/testify/require" "google.golang.org/protobuf/types/known/fieldmaskpb" - v1pb "github.com/usememos/memos/proto/gen/api/v1" - apiv1 "github.com/usememos/memos/server/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" + "github.com/usememos/memos/server/api" "github.com/usememos/memos/store" ) @@ -27,21 +27,21 @@ func TestCreateIdentityProvider(t *testing.T) { ctx := ts.CreateUserContext(ctx, hostUser.ID) // Create OAuth2 identity provider - req := &v1pb.CreateIdentityProviderRequest{ - IdentityProvider: &v1pb.IdentityProvider{ + req := &apipb.CreateIdentityProviderRequest{ + IdentityProvider: &apipb.IdentityProvider{ Title: "Test OAuth2 Provider", IdentifierFilter: "", - Type: v1pb.IdentityProvider_OAUTH2, - Config: &v1pb.IdentityProviderConfig{ - Config: &v1pb.IdentityProviderConfig_Oauth2Config{ - Oauth2Config: &v1pb.OAuth2Config{ + Type: apipb.IdentityProvider_OAUTH2, + Config: &apipb.IdentityProviderConfig{ + Config: &apipb.IdentityProviderConfig_Oauth2Config{ + Oauth2Config: &apipb.OAuth2Config{ ClientId: "test-client-id", ClientSecret: "test-client-secret", AuthUrl: "https://example.com/oauth/authorize", TokenUrl: "https://example.com/oauth/token", UserInfoUrl: "https://example.com/oauth/userinfo", Scopes: []string{"openid", "profile", "email"}, - FieldMapping: &v1pb.FieldMapping{ + FieldMapping: &apipb.FieldMapping{ Identifier: "id", DisplayName: "name", Email: "email", @@ -57,7 +57,7 @@ func TestCreateIdentityProvider(t *testing.T) { require.NoError(t, err) require.NotNil(t, resp) require.Equal(t, "Test OAuth2 Provider", resp.Title) - require.Equal(t, v1pb.IdentityProvider_OAUTH2, resp.Type) + require.Equal(t, apipb.IdentityProvider_OAUTH2, resp.Type) require.Contains(t, resp.Name, "identity-providers/") require.NotNil(t, resp.Config.GetOauth2Config()) require.Equal(t, "test-client-id", resp.Config.GetOauth2Config().ClientId) @@ -74,10 +74,10 @@ func TestCreateIdentityProvider(t *testing.T) { // Set user context ctx := ts.CreateUserContext(ctx, regularUser.ID) - req := &v1pb.CreateIdentityProviderRequest{ - IdentityProvider: &v1pb.IdentityProvider{ + req := &apipb.CreateIdentityProviderRequest{ + IdentityProvider: &apipb.IdentityProvider{ Title: "Test Provider", - Type: v1pb.IdentityProvider_OAUTH2, + Type: apipb.IdentityProvider_OAUTH2, }, } @@ -90,10 +90,10 @@ func TestCreateIdentityProvider(t *testing.T) { ts := NewTestService(t) defer ts.Cleanup() - req := &v1pb.CreateIdentityProviderRequest{ - IdentityProvider: &v1pb.IdentityProvider{ + req := &apipb.CreateIdentityProviderRequest{ + IdentityProvider: &apipb.IdentityProvider{ Title: "Test Provider", - Type: v1pb.IdentityProvider_OAUTH2, + Type: apipb.IdentityProvider_OAUTH2, }, } @@ -110,7 +110,7 @@ func TestListIdentityProviders(t *testing.T) { ts := NewTestService(t) defer ts.Cleanup() - req := &v1pb.ListIdentityProvidersRequest{} + req := &apipb.ListIdentityProvidersRequest{} resp, err := ts.Service.ListIdentityProviders(ctx, req) require.NoError(t, err) require.NotNil(t, resp) @@ -129,18 +129,18 @@ func TestListIdentityProviders(t *testing.T) { userCtx := ts.CreateUserContext(ctx, hostUser.ID) // Create a couple of identity providers - createReq1 := &v1pb.CreateIdentityProviderRequest{ - IdentityProvider: &v1pb.IdentityProvider{ + createReq1 := &apipb.CreateIdentityProviderRequest{ + IdentityProvider: &apipb.IdentityProvider{ Title: "Provider 1", - Type: v1pb.IdentityProvider_OAUTH2, - Config: &v1pb.IdentityProviderConfig{ - Config: &v1pb.IdentityProviderConfig_Oauth2Config{ - Oauth2Config: &v1pb.OAuth2Config{ + Type: apipb.IdentityProvider_OAUTH2, + Config: &apipb.IdentityProviderConfig{ + Config: &apipb.IdentityProviderConfig_Oauth2Config{ + Oauth2Config: &apipb.OAuth2Config{ ClientId: "client1", AuthUrl: "https://example1.com/auth", TokenUrl: "https://example1.com/token", UserInfoUrl: "https://example1.com/user", - FieldMapping: &v1pb.FieldMapping{ + FieldMapping: &apipb.FieldMapping{ Identifier: "id", }, }, @@ -149,18 +149,18 @@ func TestListIdentityProviders(t *testing.T) { }, } - createReq2 := &v1pb.CreateIdentityProviderRequest{ - IdentityProvider: &v1pb.IdentityProvider{ + createReq2 := &apipb.CreateIdentityProviderRequest{ + IdentityProvider: &apipb.IdentityProvider{ Title: "Provider 2", - Type: v1pb.IdentityProvider_OAUTH2, - Config: &v1pb.IdentityProviderConfig{ - Config: &v1pb.IdentityProviderConfig_Oauth2Config{ - Oauth2Config: &v1pb.OAuth2Config{ + Type: apipb.IdentityProvider_OAUTH2, + Config: &apipb.IdentityProviderConfig{ + Config: &apipb.IdentityProviderConfig_Oauth2Config{ + Oauth2Config: &apipb.OAuth2Config{ ClientId: "client2", AuthUrl: "https://example2.com/auth", TokenUrl: "https://example2.com/token", UserInfoUrl: "https://example2.com/user", - FieldMapping: &v1pb.FieldMapping{ + FieldMapping: &apipb.FieldMapping{ Identifier: "id", }, }, @@ -175,7 +175,7 @@ func TestListIdentityProviders(t *testing.T) { require.NoError(t, err) // List providers - listReq := &v1pb.ListIdentityProvidersRequest{} + listReq := &apipb.ListIdentityProvidersRequest{} resp, err := ts.Service.ListIdentityProviders(ctx, listReq) require.NoError(t, err) require.NotNil(t, resp) @@ -203,20 +203,20 @@ func TestGetIdentityProvider(t *testing.T) { userCtx := ts.CreateUserContext(ctx, hostUser.ID) // Create identity provider - createReq := &v1pb.CreateIdentityProviderRequest{ - IdentityProvider: &v1pb.IdentityProvider{ + createReq := &apipb.CreateIdentityProviderRequest{ + IdentityProvider: &apipb.IdentityProvider{ Title: "Test Provider", - Type: v1pb.IdentityProvider_OAUTH2, - Config: &v1pb.IdentityProviderConfig{ - Config: &v1pb.IdentityProviderConfig_Oauth2Config{ - Oauth2Config: &v1pb.OAuth2Config{ + Type: apipb.IdentityProvider_OAUTH2, + Config: &apipb.IdentityProviderConfig{ + Config: &apipb.IdentityProviderConfig_Oauth2Config{ + Oauth2Config: &apipb.OAuth2Config{ ClientId: "test-client", ClientSecret: "test-secret", AuthUrl: "https://example.com/auth", TokenUrl: "https://example.com/token", UserInfoUrl: "https://example.com/user", Scopes: []string{"openid", "profile"}, - FieldMapping: &v1pb.FieldMapping{ + FieldMapping: &apipb.FieldMapping{ Identifier: "id", DisplayName: "name", Email: "email", @@ -231,7 +231,7 @@ func TestGetIdentityProvider(t *testing.T) { require.NoError(t, err) // Get identity provider - getReq := &v1pb.GetIdentityProviderRequest{ + getReq := &apipb.GetIdentityProviderRequest{ Name: created.Name, } @@ -241,7 +241,7 @@ func TestGetIdentityProvider(t *testing.T) { require.NotNil(t, resp) require.Equal(t, created.Name, resp.Name) require.Equal(t, "Test Provider", resp.Title) - require.Equal(t, v1pb.IdentityProvider_OAUTH2, resp.Type) + require.Equal(t, apipb.IdentityProvider_OAUTH2, resp.Type) require.NotNil(t, resp.Config.GetOauth2Config()) require.Equal(t, "test-client", resp.Config.GetOauth2Config().ClientId) require.Empty(t, resp.Config.GetOauth2Config().ClientSecret, @@ -260,7 +260,7 @@ func TestGetIdentityProvider(t *testing.T) { ts := NewTestService(t) defer ts.Cleanup() - req := &v1pb.GetIdentityProviderRequest{ + req := &apipb.GetIdentityProviderRequest{ Name: "identity-providers/999", } @@ -273,7 +273,7 @@ func TestGetIdentityProvider(t *testing.T) { ts := NewTestService(t) defer ts.Cleanup() - req := &v1pb.GetIdentityProviderRequest{ + req := &apipb.GetIdentityProviderRequest{ Name: "invalid-name", } @@ -298,19 +298,19 @@ func TestUpdateIdentityProvider(t *testing.T) { userCtx := ts.CreateUserContext(ctx, hostUser.ID) // Create identity provider - createReq := &v1pb.CreateIdentityProviderRequest{ - IdentityProvider: &v1pb.IdentityProvider{ + createReq := &apipb.CreateIdentityProviderRequest{ + IdentityProvider: &apipb.IdentityProvider{ Title: "Original Provider", IdentifierFilter: "", - Type: v1pb.IdentityProvider_OAUTH2, - Config: &v1pb.IdentityProviderConfig{ - Config: &v1pb.IdentityProviderConfig_Oauth2Config{ - Oauth2Config: &v1pb.OAuth2Config{ + Type: apipb.IdentityProvider_OAUTH2, + Config: &apipb.IdentityProviderConfig{ + Config: &apipb.IdentityProviderConfig_Oauth2Config{ + Oauth2Config: &apipb.OAuth2Config{ ClientId: "original-client", AuthUrl: "https://original.com/auth", TokenUrl: "https://original.com/token", UserInfoUrl: "https://original.com/user", - FieldMapping: &v1pb.FieldMapping{ + FieldMapping: &apipb.FieldMapping{ Identifier: "id", }, }, @@ -323,22 +323,22 @@ func TestUpdateIdentityProvider(t *testing.T) { require.NoError(t, err) // Update identity provider - updateReq := &v1pb.UpdateIdentityProviderRequest{ - IdentityProvider: &v1pb.IdentityProvider{ + updateReq := &apipb.UpdateIdentityProviderRequest{ + IdentityProvider: &apipb.IdentityProvider{ Name: created.Name, Title: "Updated Provider", IdentifierFilter: "test@example.com", - Type: v1pb.IdentityProvider_OAUTH2, - Config: &v1pb.IdentityProviderConfig{ - Config: &v1pb.IdentityProviderConfig_Oauth2Config{ - Oauth2Config: &v1pb.OAuth2Config{ + Type: apipb.IdentityProvider_OAUTH2, + Config: &apipb.IdentityProviderConfig{ + Config: &apipb.IdentityProviderConfig_Oauth2Config{ + Oauth2Config: &apipb.OAuth2Config{ ClientId: "updated-client", ClientSecret: "updated-secret", AuthUrl: "https://updated.com/auth", TokenUrl: "https://updated.com/token", UserInfoUrl: "https://updated.com/user", Scopes: []string{"openid", "profile", "email"}, - FieldMapping: &v1pb.FieldMapping{ + FieldMapping: &apipb.FieldMapping{ Identifier: "sub", DisplayName: "given_name", Email: "email", @@ -370,19 +370,19 @@ func TestUpdateIdentityProvider(t *testing.T) { userCtx := ts.CreateUserContext(ctx, hostUser.ID) // Create IDP with a real secret. - created, err := ts.Service.CreateIdentityProvider(userCtx, &v1pb.CreateIdentityProviderRequest{ - IdentityProvider: &v1pb.IdentityProvider{ + created, err := ts.Service.CreateIdentityProvider(userCtx, &apipb.CreateIdentityProviderRequest{ + IdentityProvider: &apipb.IdentityProvider{ Title: "Preserve Secret Test", - Type: v1pb.IdentityProvider_OAUTH2, - Config: &v1pb.IdentityProviderConfig{ - Config: &v1pb.IdentityProviderConfig_Oauth2Config{ - Oauth2Config: &v1pb.OAuth2Config{ + Type: apipb.IdentityProvider_OAUTH2, + Config: &apipb.IdentityProviderConfig{ + Config: &apipb.IdentityProviderConfig_Oauth2Config{ + Oauth2Config: &apipb.OAuth2Config{ ClientId: "cid", ClientSecret: "original-secret", AuthUrl: "https://ex.com/auth", TokenUrl: "https://ex.com/token", UserInfoUrl: "https://ex.com/user", - FieldMapping: &v1pb.FieldMapping{Identifier: "id"}, + FieldMapping: &apipb.FieldMapping{Identifier: "id"}, }, }, }, @@ -391,20 +391,20 @@ func TestUpdateIdentityProvider(t *testing.T) { require.NoError(t, err) // Update with empty ClientSecret (simulating UI that doesn't resend the secret). - _, err = ts.Service.UpdateIdentityProvider(userCtx, &v1pb.UpdateIdentityProviderRequest{ - IdentityProvider: &v1pb.IdentityProvider{ + _, err = ts.Service.UpdateIdentityProvider(userCtx, &apipb.UpdateIdentityProviderRequest{ + IdentityProvider: &apipb.IdentityProvider{ Name: created.Name, Title: "Updated Title", - Type: v1pb.IdentityProvider_OAUTH2, - Config: &v1pb.IdentityProviderConfig{ - Config: &v1pb.IdentityProviderConfig_Oauth2Config{ - Oauth2Config: &v1pb.OAuth2Config{ + Type: apipb.IdentityProvider_OAUTH2, + Config: &apipb.IdentityProviderConfig{ + Config: &apipb.IdentityProviderConfig_Oauth2Config{ + Oauth2Config: &apipb.OAuth2Config{ ClientId: "cid", ClientSecret: "", // empty = preserve existing AuthUrl: "https://ex.com/auth", TokenUrl: "https://ex.com/token", UserInfoUrl: "https://ex.com/user", - FieldMapping: &v1pb.FieldMapping{Identifier: "id"}, + FieldMapping: &apipb.FieldMapping{Identifier: "id"}, }, }, }, @@ -414,7 +414,7 @@ func TestUpdateIdentityProvider(t *testing.T) { require.NoError(t, err) // Verify the stored secret was preserved by reading from store directly. - uid, _ := apiv1.ExtractIdentityProviderUIDFromName(created.Name) + uid, _ := api.ExtractIdentityProviderUIDFromName(created.Name) stored, err := ts.Store.GetIdentityProvider(ctx, &store.FindIdentityProvider{UID: &uid}) require.NoError(t, err) require.Equal(t, "original-secret", stored.Config.GetOauth2Config().ClientSecret, @@ -433,8 +433,8 @@ func TestUpdateIdentityProvider(t *testing.T) { // Set user context userCtx := ts.CreateUserContext(ctx, hostUser.ID) - req := &v1pb.UpdateIdentityProviderRequest{ - IdentityProvider: &v1pb.IdentityProvider{ + req := &apipb.UpdateIdentityProviderRequest{ + IdentityProvider: &apipb.IdentityProvider{ Name: "identity-providers/1", Title: "Updated Provider", }, @@ -456,8 +456,8 @@ func TestUpdateIdentityProvider(t *testing.T) { // Set user context userCtx := ts.CreateUserContext(ctx, hostUser.ID) - req := &v1pb.UpdateIdentityProviderRequest{ - IdentityProvider: &v1pb.IdentityProvider{ + req := &apipb.UpdateIdentityProviderRequest{ + IdentityProvider: &apipb.IdentityProvider{ Name: "invalid-name", Title: "Updated Provider", }, @@ -487,18 +487,18 @@ func TestDeleteIdentityProvider(t *testing.T) { userCtx := ts.CreateUserContext(ctx, hostUser.ID) // Create identity provider - createReq := &v1pb.CreateIdentityProviderRequest{ - IdentityProvider: &v1pb.IdentityProvider{ + createReq := &apipb.CreateIdentityProviderRequest{ + IdentityProvider: &apipb.IdentityProvider{ Title: "Provider to Delete", - Type: v1pb.IdentityProvider_OAUTH2, - Config: &v1pb.IdentityProviderConfig{ - Config: &v1pb.IdentityProviderConfig_Oauth2Config{ - Oauth2Config: &v1pb.OAuth2Config{ + Type: apipb.IdentityProvider_OAUTH2, + Config: &apipb.IdentityProviderConfig{ + Config: &apipb.IdentityProviderConfig_Oauth2Config{ + Oauth2Config: &apipb.OAuth2Config{ ClientId: "client-to-delete", AuthUrl: "https://example.com/auth", TokenUrl: "https://example.com/token", UserInfoUrl: "https://example.com/user", - FieldMapping: &v1pb.FieldMapping{ + FieldMapping: &apipb.FieldMapping{ Identifier: "id", }, }, @@ -511,7 +511,7 @@ func TestDeleteIdentityProvider(t *testing.T) { require.NoError(t, err) // Delete identity provider - deleteReq := &v1pb.DeleteIdentityProviderRequest{ + deleteReq := &apipb.DeleteIdentityProviderRequest{ Name: created.Name, } @@ -519,7 +519,7 @@ func TestDeleteIdentityProvider(t *testing.T) { require.NoError(t, err) // Verify deletion - getReq := &v1pb.GetIdentityProviderRequest{ + getReq := &apipb.GetIdentityProviderRequest{ Name: created.Name, } @@ -539,7 +539,7 @@ func TestDeleteIdentityProvider(t *testing.T) { // Set user context userCtx := ts.CreateUserContext(ctx, hostUser.ID) - req := &v1pb.DeleteIdentityProviderRequest{ + req := &apipb.DeleteIdentityProviderRequest{ Name: "invalid-name", } @@ -559,7 +559,7 @@ func TestDeleteIdentityProvider(t *testing.T) { // Set user context userCtx := ts.CreateUserContext(ctx, hostUser.ID) - req := &v1pb.DeleteIdentityProviderRequest{ + req := &apipb.DeleteIdentityProviderRequest{ Name: "identity-providers/999", } @@ -583,10 +583,10 @@ func TestIdentityProviderPermissions(t *testing.T) { // Set user context userCtx := ts.CreateUserContext(ctx, regularUser.ID) - req := &v1pb.CreateIdentityProviderRequest{ - IdentityProvider: &v1pb.IdentityProvider{ + req := &apipb.CreateIdentityProviderRequest{ + IdentityProvider: &apipb.IdentityProvider{ Title: "Test Provider", - Type: v1pb.IdentityProvider_OAUTH2, + Type: apipb.IdentityProvider_OAUTH2, }, } @@ -599,10 +599,10 @@ func TestIdentityProviderPermissions(t *testing.T) { ts := NewTestService(t) defer ts.Cleanup() - req := &v1pb.CreateIdentityProviderRequest{ - IdentityProvider: &v1pb.IdentityProvider{ + req := &apipb.CreateIdentityProviderRequest{ + IdentityProvider: &apipb.IdentityProvider{ Title: "Test Provider", - Type: v1pb.IdentityProvider_OAUTH2, + Type: apipb.IdentityProvider_OAUTH2, }, } diff --git a/server/api/v1/test/instance_admin_cache_test.go b/server/api/test/instance_admin_cache_test.go similarity index 80% rename from server/api/v1/test/instance_admin_cache_test.go rename to server/api/test/instance_admin_cache_test.go index 5fa217160..9960dcbc7 100644 --- a/server/api/v1/test/instance_admin_cache_test.go +++ b/server/api/test/instance_admin_cache_test.go @@ -6,7 +6,7 @@ import ( "github.com/stretchr/testify/require" - v1pb "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" ) func TestInstanceAdminRetrieval(t *testing.T) { @@ -18,7 +18,7 @@ func TestInstanceAdminRetrieval(t *testing.T) { defer ts.Cleanup() // Verify instance is not initialized initially - profile1, err := ts.Service.GetInstanceProfile(ctx, &v1pb.GetInstanceProfileRequest{}) + profile1, err := ts.Service.GetInstanceProfile(ctx, &apipb.GetInstanceProfileRequest{}) require.NoError(t, err) require.Nil(t, profile1.Admin, "Instance should not be initialized before first admin user") @@ -28,7 +28,7 @@ func TestInstanceAdminRetrieval(t *testing.T) { require.NotNil(t, user) // Verify instance is now initialized - profile2, err := ts.Service.GetInstanceProfile(ctx, &v1pb.GetInstanceProfileRequest{}) + profile2, err := ts.Service.GetInstanceProfile(ctx, &apipb.GetInstanceProfileRequest{}) require.NoError(t, err) require.NotNil(t, profile2.Admin, "Instance should be initialized after first admin user is created") require.Equal(t, user.Username, profile2.Admin.Username) @@ -45,7 +45,7 @@ func TestInstanceAdminRetrieval(t *testing.T) { // Multiple calls should return consistent admin user (from cache) for i := 0; i < 5; i++ { - profile, err := ts.Service.GetInstanceProfile(ctx, &v1pb.GetInstanceProfileRequest{}) + profile, err := ts.Service.GetInstanceProfile(ctx, &apipb.GetInstanceProfileRequest{}) require.NoError(t, err) require.NotNil(t, profile.Admin) require.Equal(t, user.Username, profile.Admin.Username) diff --git a/server/api/v1/test/instance_service_test.go b/server/api/test/instance_service_test.go similarity index 73% rename from server/api/v1/test/instance_service_test.go rename to server/api/test/instance_service_test.go index 9f5644871..df7ce6469 100644 --- a/server/api/v1/test/instance_service_test.go +++ b/server/api/test/instance_service_test.go @@ -11,7 +11,7 @@ import ( "google.golang.org/grpc/status" "google.golang.org/protobuf/types/known/fieldmaskpb" - v1pb "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" storepb "github.com/usememos/memos/proto/gen/store" ) @@ -24,7 +24,7 @@ func TestGetInstanceProfile(t *testing.T) { defer ts.Cleanup() // Call GetInstanceProfile directly - req := &v1pb.GetInstanceProfileRequest{} + req := &apipb.GetInstanceProfileRequest{} resp, err := ts.Service.GetInstanceProfile(ctx, req) // Verify response @@ -36,7 +36,7 @@ func TestGetInstanceProfile(t *testing.T) { require.Equal(t, "test-commit", resp.Commit) require.True(t, resp.Demo) require.Equal(t, "http://localhost:8080", resp.InstanceUrl) - require.Equal(t, v1pb.InstanceAccessMode_INSTANCE_ACCESS_MODE_PUBLIC, resp.AccessMode) + require.Equal(t, apipb.InstanceAccessMode_INSTANCE_ACCESS_MODE_PUBLIC, resp.AccessMode) // Instance should not be initialized since no users exist at all. require.Nil(t, resp.Admin) @@ -54,7 +54,7 @@ func TestGetInstanceProfile(t *testing.T) { require.NotNil(t, hostUser) // Call GetInstanceProfile directly - req := &v1pb.GetInstanceProfileRequest{} + req := &apipb.GetInstanceProfileRequest{} resp, err := ts.Service.GetInstanceProfile(ctx, req) // Verify response @@ -85,7 +85,7 @@ func TestGetInstanceProfile(t *testing.T) { require.NoError(t, err) require.NotNil(t, regularUser) - req := &v1pb.GetInstanceProfileRequest{} + req := &apipb.GetInstanceProfileRequest{} resp, err := ts.Service.GetInstanceProfile(ctx, req) require.NoError(t, err) require.NotNil(t, resp) @@ -110,12 +110,12 @@ func TestGetInstanceProfile_Concurrency(t *testing.T) { // Make concurrent requests numGoroutines := 10 - results := make(chan *v1pb.InstanceProfile, numGoroutines) + results := make(chan *apipb.InstanceProfile, numGoroutines) errors := make(chan error, numGoroutines) for i := 0; i < numGoroutines; i++ { go func() { - req := &v1pb.GetInstanceProfileRequest{} + req := &apipb.GetInstanceProfileRequest{} resp, err := ts.Service.GetInstanceProfile(ctx, req) if err != nil { errors <- err @@ -151,7 +151,7 @@ func TestGetInstanceSetting(t *testing.T) { defer ts.Cleanup() // Call GetInstanceSetting for general setting - req := &v1pb.GetInstanceSettingRequest{ + req := &apipb.GetInstanceSettingRequest{ Name: "instance/settings/GENERAL", } resp, err := ts.Service.GetInstanceSetting(ctx, req) @@ -184,7 +184,7 @@ func TestGetInstanceSetting(t *testing.T) { userCtx := ts.CreateUserContext(ctx, hostUser.ID) // Call GetInstanceSetting for storage setting - req := &v1pb.GetInstanceSettingRequest{ + req := &apipb.GetInstanceSettingRequest{ Name: "instance/settings/STORAGE", } resp, err := ts.Service.GetInstanceSetting(userCtx, req) @@ -205,7 +205,7 @@ func TestGetInstanceSetting(t *testing.T) { defer ts.Cleanup() // Call GetInstanceSetting for memo related setting - req := &v1pb.GetInstanceSettingRequest{ + req := &apipb.GetInstanceSettingRequest{ Name: "instance/settings/MEMO_RELATED", } resp, err := ts.Service.GetInstanceSetting(ctx, req) @@ -224,7 +224,7 @@ func TestGetInstanceSetting(t *testing.T) { ts := NewTestService(t) defer ts.Cleanup() - req := &v1pb.GetInstanceSettingRequest{ + req := &apipb.GetInstanceSettingRequest{ Name: "instance/settings/TAGS", } resp, err := ts.Service.GetInstanceSetting(ctx, req) @@ -240,13 +240,13 @@ func TestGetInstanceSetting(t *testing.T) { ts := NewTestService(t) defer ts.Cleanup() - resp, err := ts.Service.GetInstanceSetting(ctx, &v1pb.GetInstanceSettingRequest{ + resp, err := ts.Service.GetInstanceSetting(ctx, &apipb.GetInstanceSettingRequest{ Name: "instance/settings/ACCESS", }) require.NoError(t, err) require.Equal(t, "instance/settings/ACCESS", resp.Name) - require.Equal(t, v1pb.InstanceAccessMode_INSTANCE_ACCESS_MODE_PUBLIC, resp.GetAccessSetting().GetAccessMode()) + require.Equal(t, apipb.InstanceAccessMode_INSTANCE_ACCESS_MODE_PUBLIC, resp.GetAccessSetting().GetAccessMode()) }) t.Run("GetInstanceSetting - notification setting requires admin", func(t *testing.T) { @@ -261,7 +261,7 @@ func TestGetInstanceSetting(t *testing.T) { require.NoError(t, err) userCtx := ts.CreateUserContext(ctx, regularUser.ID) - req := &v1pb.GetInstanceSettingRequest{Name: "instance/settings/NOTIFICATION"} + req := &apipb.GetInstanceSettingRequest{Name: "instance/settings/NOTIFICATION"} // Unauthenticated request must be rejected. _, err = ts.Service.GetInstanceSetting(ctx, req) @@ -295,7 +295,7 @@ func TestGetInstanceSetting(t *testing.T) { require.NoError(t, err) userCtx := ts.CreateUserContext(ctx, regularUser.ID) - req := &v1pb.GetInstanceSettingRequest{Name: "instance/settings/AI"} + req := &apipb.GetInstanceSettingRequest{Name: "instance/settings/AI"} _, err = ts.Service.GetInstanceSetting(ctx, req) require.Error(t, err) @@ -318,7 +318,7 @@ func TestGetInstanceSetting(t *testing.T) { defer ts.Cleanup() // Call GetInstanceSetting with invalid name - req := &v1pb.GetInstanceSettingRequest{ + req := &apipb.GetInstanceSettingRequest{ Name: "invalid/setting/name", } _, err := ts.Service.GetInstanceSetting(ctx, req) @@ -336,7 +336,7 @@ func TestBatchGetInstanceSettings(t *testing.T) { ts := NewTestService(t) defer ts.Cleanup() - resp, err := ts.Service.BatchGetInstanceSettings(ctx, &v1pb.BatchGetInstanceSettingsRequest{ + resp, err := ts.Service.BatchGetInstanceSettings(ctx, &apipb.BatchGetInstanceSettingsRequest{ Names: []string{ "instance/settings/TAGS", "instance/settings/GENERAL", @@ -346,13 +346,13 @@ func TestBatchGetInstanceSettings(t *testing.T) { require.NoError(t, err) require.NotNil(t, resp) - require.Len(t, resp.Settings, 3) - require.Equal(t, "instance/settings/TAGS", resp.Settings[0].Name) - require.NotNil(t, resp.Settings[0].GetTagsSetting()) - require.Equal(t, "instance/settings/GENERAL", resp.Settings[1].Name) - require.NotNil(t, resp.Settings[1].GetGeneralSetting()) - require.Equal(t, "instance/settings/MEMO_RELATED", resp.Settings[2].Name) - require.NotNil(t, resp.Settings[2].GetMemoRelatedSetting()) + require.Len(t, resp.InstanceSettings, 3) + require.Equal(t, "instance/settings/TAGS", resp.InstanceSettings[0].Name) + require.NotNil(t, resp.InstanceSettings[0].GetTagsSetting()) + require.Equal(t, "instance/settings/GENERAL", resp.InstanceSettings[1].Name) + require.NotNil(t, resp.InstanceSettings[1].GetGeneralSetting()) + require.Equal(t, "instance/settings/MEMO_RELATED", resp.InstanceSettings[2].Name) + require.NotNil(t, resp.InstanceSettings[2].GetMemoRelatedSetting()) }) t.Run("BatchGetInstanceSettings - admin-only setting requires admin", func(t *testing.T) { @@ -363,7 +363,7 @@ func TestBatchGetInstanceSettings(t *testing.T) { require.NoError(t, err) userCtx := ts.CreateUserContext(ctx, regularUser.ID) - _, err = ts.Service.BatchGetInstanceSettings(userCtx, &v1pb.BatchGetInstanceSettingsRequest{ + _, err = ts.Service.BatchGetInstanceSettings(userCtx, &apipb.BatchGetInstanceSettingsRequest{ Names: []string{"instance/settings/GENERAL", "instance/settings/NOTIFICATION"}, }) require.Error(t, err) @@ -373,19 +373,19 @@ func TestBatchGetInstanceSettings(t *testing.T) { require.NoError(t, err) adminCtx := ts.CreateUserContext(ctx, admin.ID) - resp, err := ts.Service.BatchGetInstanceSettings(adminCtx, &v1pb.BatchGetInstanceSettingsRequest{ + resp, err := ts.Service.BatchGetInstanceSettings(adminCtx, &apipb.BatchGetInstanceSettingsRequest{ Names: []string{"instance/settings/GENERAL", "instance/settings/NOTIFICATION"}, }) require.NoError(t, err) - require.Len(t, resp.Settings, 2) - require.NotNil(t, resp.Settings[1].GetNotificationSetting()) + require.Len(t, resp.InstanceSettings, 2) + require.NotNil(t, resp.InstanceSettings[1].GetNotificationSetting()) }) t.Run("BatchGetInstanceSettings - invalid setting name", func(t *testing.T) { ts := NewTestService(t) defer ts.Cleanup() - _, err := ts.Service.BatchGetInstanceSettings(ctx, &v1pb.BatchGetInstanceSettingsRequest{ + _, err := ts.Service.BatchGetInstanceSettings(ctx, &apipb.BatchGetInstanceSettingsRequest{ Names: []string{"instance/settings/GENERAL", "invalid/setting/name"}, }) @@ -407,7 +407,7 @@ func TestTestInstanceEmailSettingAuthorization(t *testing.T) { require.NoError(t, err) userCtx := ts.CreateUserContext(ctx, regularUser.ID) - req := &v1pb.TestInstanceEmailSettingRequest{} + req := &apipb.TestInstanceEmailSettingRequest{} _, err = ts.Service.TestInstanceEmailSetting(ctx, req) require.Error(t, err) @@ -449,8 +449,8 @@ func TestTestInstanceEmailSettingRequiresPasswordWhenSMTPIdentityChanges(t *test }) require.NoError(t, err) - _, err = ts.Service.TestInstanceEmailSetting(adminCtx, &v1pb.TestInstanceEmailSettingRequest{ - Email: &v1pb.InstanceSetting_NotificationSetting_EmailSetting{ + _, err = ts.Service.TestInstanceEmailSetting(adminCtx, &apipb.TestInstanceEmailSettingRequest{ + Email: &apipb.InstanceSetting_NotificationSetting_EmailSetting{ Enabled: true, SmtpHost: "attacker.example.com", SmtpPort: 587, @@ -475,33 +475,33 @@ func TestUpdateInstanceSetting(t *testing.T) { admin, err := ts.CreateHostUser(ctx, "memo-setting-admin") require.NoError(t, err) adminCtx := ts.CreateUserContext(ctx, admin.ID) - settingForLimit := func(limit int32) *v1pb.InstanceSetting { - return &v1pb.InstanceSetting{ + settingForLimit := func(limit int32) *apipb.InstanceSetting { + return &apipb.InstanceSetting{ Name: "instance/settings/MEMO_RELATED", - Value: &v1pb.InstanceSetting_MemoRelatedSetting_{ - MemoRelatedSetting: &v1pb.InstanceSetting_MemoRelatedSetting{ + Value: &apipb.InstanceSetting_MemoRelatedSetting_{ + MemoRelatedSetting: &apipb.InstanceSetting_MemoRelatedSetting{ ContentLengthLimit: limit, }, }, } } - updated, err := ts.Service.UpdateInstanceSetting(adminCtx, &v1pb.UpdateInstanceSettingRequest{Setting: settingForLimit(0)}) + updated, err := ts.Service.UpdateInstanceSetting(adminCtx, &apipb.UpdateInstanceSettingRequest{InstanceSetting: settingForLimit(0)}) require.NoError(t, err) require.Equal(t, int32(8192), updated.GetMemoRelatedSetting().GetContentLengthLimit()) - got, err := ts.Service.GetInstanceSetting(ctx, &v1pb.GetInstanceSettingRequest{Name: "instance/settings/MEMO_RELATED"}) + got, err := ts.Service.GetInstanceSetting(ctx, &apipb.GetInstanceSettingRequest{Name: "instance/settings/MEMO_RELATED"}) require.NoError(t, err) require.Equal(t, int32(8192), got.GetMemoRelatedSetting().GetContentLengthLimit()) - _, err = ts.Service.UpdateInstanceSetting(adminCtx, &v1pb.UpdateInstanceSettingRequest{Setting: settingForLimit(8191)}) + _, err = ts.Service.UpdateInstanceSetting(adminCtx, &apipb.UpdateInstanceSettingRequest{InstanceSetting: settingForLimit(8191)}) require.Equal(t, codes.InvalidArgument, status.Code(err)) for _, limit := range []int32{8192, 16384} { - updated, err := ts.Service.UpdateInstanceSetting(adminCtx, &v1pb.UpdateInstanceSettingRequest{Setting: settingForLimit(limit)}) + updated, err := ts.Service.UpdateInstanceSetting(adminCtx, &apipb.UpdateInstanceSettingRequest{InstanceSetting: settingForLimit(limit)}) require.NoError(t, err, "limit %d", limit) require.Equal(t, limit, updated.GetMemoRelatedSetting().GetContentLengthLimit()) - got, err := ts.Service.GetInstanceSetting(ctx, &v1pb.GetInstanceSettingRequest{Name: "instance/settings/MEMO_RELATED"}) + got, err := ts.Service.GetInstanceSetting(ctx, &apipb.GetInstanceSettingRequest{Name: "instance/settings/MEMO_RELATED"}) require.NoError(t, err, "limit %d", limit) require.Equal(t, limit, got.GetMemoRelatedSetting().GetContentLengthLimit()) } @@ -515,39 +515,39 @@ func TestUpdateInstanceSetting(t *testing.T) { require.NoError(t, err) adminCtx := ts.CreateUserContext(ctx, admin.ID) - resp, err := ts.Service.UpdateInstanceSetting(adminCtx, &v1pb.UpdateInstanceSettingRequest{ - Setting: &v1pb.InstanceSetting{ + resp, err := ts.Service.UpdateInstanceSetting(adminCtx, &apipb.UpdateInstanceSettingRequest{ + InstanceSetting: &apipb.InstanceSetting{ Name: "instance/settings/ACCESS", - Value: &v1pb.InstanceSetting_AccessSetting_{ - AccessSetting: &v1pb.InstanceSetting_AccessSetting{ - AccessMode: v1pb.InstanceAccessMode_INSTANCE_ACCESS_MODE_PRIVATE, + Value: &apipb.InstanceSetting_AccessSetting_{ + AccessSetting: &apipb.InstanceSetting_AccessSetting{ + AccessMode: apipb.InstanceAccessMode_INSTANCE_ACCESS_MODE_PRIVATE, }, }, }, }) require.NoError(t, err) - require.Equal(t, v1pb.InstanceAccessMode_INSTANCE_ACCESS_MODE_PRIVATE, resp.GetAccessSetting().GetAccessMode()) + require.Equal(t, apipb.InstanceAccessMode_INSTANCE_ACCESS_MODE_PRIVATE, resp.GetAccessSetting().GetAccessMode()) - profile, err := ts.Service.GetInstanceProfile(ctx, &v1pb.GetInstanceProfileRequest{}) + profile, err := ts.Service.GetInstanceProfile(ctx, &apipb.GetInstanceProfileRequest{}) require.NoError(t, err) - require.Equal(t, v1pb.InstanceAccessMode_INSTANCE_ACCESS_MODE_PRIVATE, profile.AccessMode) + require.Equal(t, apipb.InstanceAccessMode_INSTANCE_ACCESS_MODE_PRIVATE, profile.AccessMode) - _, err = ts.Service.UpdateInstanceSetting(adminCtx, &v1pb.UpdateInstanceSettingRequest{ - Setting: &v1pb.InstanceSetting{ + _, err = ts.Service.UpdateInstanceSetting(adminCtx, &apipb.UpdateInstanceSettingRequest{ + InstanceSetting: &apipb.InstanceSetting{ Name: "instance/settings/ACCESS", - Value: &v1pb.InstanceSetting_AccessSetting_{ - AccessSetting: &v1pb.InstanceSetting_AccessSetting{}, + Value: &apipb.InstanceSetting_AccessSetting_{ + AccessSetting: &apipb.InstanceSetting_AccessSetting{}, }, }, }) require.Error(t, err) require.Contains(t, err.Error(), "access_mode must be PRIVATE or PUBLIC") - _, err = ts.Service.UpdateInstanceSetting(adminCtx, &v1pb.UpdateInstanceSettingRequest{ - Setting: &v1pb.InstanceSetting{ + _, err = ts.Service.UpdateInstanceSetting(adminCtx, &apipb.UpdateInstanceSettingRequest{ + InstanceSetting: &apipb.InstanceSetting{ Name: "instance/settings/ACCESS", - Value: &v1pb.InstanceSetting_GeneralSetting_{ - GeneralSetting: &v1pb.InstanceSetting_GeneralSetting{}, + Value: &apipb.InstanceSetting_GeneralSetting_{ + GeneralSetting: &apipb.InstanceSetting_GeneralSetting{}, }, }, }) @@ -563,15 +563,15 @@ func TestUpdateInstanceSetting(t *testing.T) { require.NoError(t, err) userCtx := ts.CreateUserContext(ctx, regularUser.ID) - setting := &v1pb.InstanceSetting{ + setting := &apipb.InstanceSetting{ Name: "instance/settings/AI", - Value: &v1pb.InstanceSetting_AiSetting{ - AiSetting: &v1pb.InstanceSetting_AISetting{ - Providers: []*v1pb.InstanceSetting_AIProviderConfig{ + Value: &apipb.InstanceSetting_AiSetting{ + AiSetting: &apipb.InstanceSetting_AISetting{ + Providers: []*apipb.InstanceSetting_AIProviderConfig{ { Id: "openai-main", Title: "OpenAI", - Type: v1pb.InstanceSetting_OPENAI, + Type: apipb.InstanceSetting_OPENAI, ApiKey: "sk-test", }, }, @@ -579,11 +579,11 @@ func TestUpdateInstanceSetting(t *testing.T) { }, } - _, err = ts.Service.UpdateInstanceSetting(ctx, &v1pb.UpdateInstanceSettingRequest{Setting: setting}) + _, err = ts.Service.UpdateInstanceSetting(ctx, &apipb.UpdateInstanceSettingRequest{InstanceSetting: setting}) require.Error(t, err) require.Contains(t, err.Error(), "not authenticated") - _, err = ts.Service.UpdateInstanceSetting(userCtx, &v1pb.UpdateInstanceSettingRequest{Setting: setting}) + _, err = ts.Service.UpdateInstanceSetting(userCtx, &apipb.UpdateInstanceSettingRequest{InstanceSetting: setting}) require.Error(t, err) require.Contains(t, err.Error(), "permission denied") }) @@ -595,12 +595,12 @@ func TestUpdateInstanceSetting(t *testing.T) { hostUser, err := ts.CreateHostUser(ctx, "admin") require.NoError(t, err) - resp, err := ts.Service.UpdateInstanceSetting(ts.CreateUserContext(ctx, hostUser.ID), &v1pb.UpdateInstanceSettingRequest{ - Setting: &v1pb.InstanceSetting{ + resp, err := ts.Service.UpdateInstanceSetting(ts.CreateUserContext(ctx, hostUser.ID), &apipb.UpdateInstanceSettingRequest{ + InstanceSetting: &apipb.InstanceSetting{ Name: "instance/settings/TAGS", - Value: &v1pb.InstanceSetting_TagsSetting_{ - TagsSetting: &v1pb.InstanceSetting_TagsSetting{ - Tags: map[string]*v1pb.InstanceSetting_TagMetadata{ + Value: &apipb.InstanceSetting_TagsSetting_{ + TagsSetting: &apipb.InstanceSetting_TagsSetting{ + Tags: map[string]*apipb.InstanceSetting_TagMetadata{ "bug": { BackgroundColor: &colorpb.Color{ Red: 0.9, @@ -626,12 +626,12 @@ func TestUpdateInstanceSetting(t *testing.T) { hostUser, err := ts.CreateHostUser(ctx, "admin") require.NoError(t, err) - _, err = ts.Service.UpdateInstanceSetting(ts.CreateUserContext(ctx, hostUser.ID), &v1pb.UpdateInstanceSettingRequest{ - Setting: &v1pb.InstanceSetting{ + _, err = ts.Service.UpdateInstanceSetting(ts.CreateUserContext(ctx, hostUser.ID), &apipb.UpdateInstanceSettingRequest{ + InstanceSetting: &apipb.InstanceSetting{ Name: "instance/settings/TAGS", - Value: &v1pb.InstanceSetting_TagsSetting_{ - TagsSetting: &v1pb.InstanceSetting_TagsSetting{ - Tags: map[string]*v1pb.InstanceSetting_TagMetadata{ + Value: &apipb.InstanceSetting_TagsSetting_{ + TagsSetting: &apipb.InstanceSetting_TagsSetting{ + Tags: map[string]*apipb.InstanceSetting_TagMetadata{ "bug": { BackgroundColor: &colorpb.Color{ Red: 1.2, @@ -655,12 +655,12 @@ func TestUpdateInstanceSetting(t *testing.T) { hostUser, err := ts.CreateHostUser(ctx, "admin") require.NoError(t, err) - resp, err := ts.Service.UpdateInstanceSetting(ts.CreateUserContext(ctx, hostUser.ID), &v1pb.UpdateInstanceSettingRequest{ - Setting: &v1pb.InstanceSetting{ + resp, err := ts.Service.UpdateInstanceSetting(ts.CreateUserContext(ctx, hostUser.ID), &apipb.UpdateInstanceSettingRequest{ + InstanceSetting: &apipb.InstanceSetting{ Name: "instance/settings/TAGS", - Value: &v1pb.InstanceSetting_TagsSetting_{ - TagsSetting: &v1pb.InstanceSetting_TagsSetting{ - Tags: map[string]*v1pb.InstanceSetting_TagMetadata{ + Value: &apipb.InstanceSetting_TagsSetting_{ + TagsSetting: &apipb.InstanceSetting_TagsSetting{ + Tags: map[string]*apipb.InstanceSetting_TagMetadata{ "spoiler": { BlurContent: true, }, @@ -685,12 +685,12 @@ func TestUpdateInstanceSetting(t *testing.T) { adminCtx := ts.CreateUserContext(ctx, hostUser.ID) // Save notification setting with a password. - resp, err := ts.Service.UpdateInstanceSetting(adminCtx, &v1pb.UpdateInstanceSettingRequest{ - Setting: &v1pb.InstanceSetting{ + resp, err := ts.Service.UpdateInstanceSetting(adminCtx, &apipb.UpdateInstanceSettingRequest{ + InstanceSetting: &apipb.InstanceSetting{ Name: "instance/settings/NOTIFICATION", - Value: &v1pb.InstanceSetting_NotificationSetting_{ - NotificationSetting: &v1pb.InstanceSetting_NotificationSetting{ - Email: &v1pb.InstanceSetting_NotificationSetting_EmailSetting{ + Value: &apipb.InstanceSetting_NotificationSetting_{ + NotificationSetting: &apipb.InstanceSetting_NotificationSetting{ + Email: &apipb.InstanceSetting_NotificationSetting_EmailSetting{ Enabled: true, SmtpHost: "smtp.example.com", SmtpPort: 587, @@ -722,11 +722,11 @@ func TestUpdateInstanceSetting(t *testing.T) { require.NoError(t, err) adminCtx := ts.CreateUserContext(ctx, hostUser.ID) - notificationSetting := &v1pb.InstanceSetting{ + notificationSetting := &apipb.InstanceSetting{ Name: "instance/settings/NOTIFICATION", - Value: &v1pb.InstanceSetting_NotificationSetting_{ - NotificationSetting: &v1pb.InstanceSetting_NotificationSetting{ - Email: &v1pb.InstanceSetting_NotificationSetting_EmailSetting{ + Value: &apipb.InstanceSetting_NotificationSetting_{ + NotificationSetting: &apipb.InstanceSetting_NotificationSetting{ + Email: &apipb.InstanceSetting_NotificationSetting_EmailSetting{ Enabled: true, SmtpHost: "smtp.example.com", SmtpPort: 587, @@ -739,16 +739,16 @@ func TestUpdateInstanceSetting(t *testing.T) { } // First save with a real password. - _, err = ts.Service.UpdateInstanceSetting(adminCtx, &v1pb.UpdateInstanceSettingRequest{ - Setting: notificationSetting, + _, err = ts.Service.UpdateInstanceSetting(adminCtx, &apipb.UpdateInstanceSettingRequest{ + InstanceSetting: notificationSetting, }) require.NoError(t, err) // Second update with an empty password (simulating a UI that doesn't re-send the secret). notificationSetting.GetNotificationSetting().GetEmail().SmtpPassword = "" notificationSetting.GetNotificationSetting().GetEmail().FromName = "Updated Bot" - _, err = ts.Service.UpdateInstanceSetting(adminCtx, &v1pb.UpdateInstanceSettingRequest{ - Setting: notificationSetting, + _, err = ts.Service.UpdateInstanceSetting(adminCtx, &apipb.UpdateInstanceSettingRequest{ + InstanceSetting: notificationSetting, }) require.NoError(t, err) @@ -768,11 +768,11 @@ func TestUpdateInstanceSetting(t *testing.T) { require.NoError(t, err) adminCtx := ts.CreateUserContext(ctx, hostUser.ID) - notificationSetting := &v1pb.InstanceSetting{ + notificationSetting := &apipb.InstanceSetting{ Name: "instance/settings/NOTIFICATION", - Value: &v1pb.InstanceSetting_NotificationSetting_{ - NotificationSetting: &v1pb.InstanceSetting_NotificationSetting{ - Email: &v1pb.InstanceSetting_NotificationSetting_EmailSetting{ + Value: &apipb.InstanceSetting_NotificationSetting_{ + NotificationSetting: &apipb.InstanceSetting_NotificationSetting{ + Email: &apipb.InstanceSetting_NotificationSetting_EmailSetting{ Enabled: true, SmtpHost: "smtp.example.com", SmtpPort: 587, @@ -785,15 +785,15 @@ func TestUpdateInstanceSetting(t *testing.T) { }, } - _, err = ts.Service.UpdateInstanceSetting(adminCtx, &v1pb.UpdateInstanceSettingRequest{ - Setting: notificationSetting, + _, err = ts.Service.UpdateInstanceSetting(adminCtx, &apipb.UpdateInstanceSettingRequest{ + InstanceSetting: notificationSetting, }) require.NoError(t, err) notificationSetting.GetNotificationSetting().GetEmail().SmtpPassword = "" notificationSetting.GetNotificationSetting().GetEmail().SmtpHost = "smtp2.example.com" - _, err = ts.Service.UpdateInstanceSetting(adminCtx, &v1pb.UpdateInstanceSettingRequest{ - Setting: notificationSetting, + _, err = ts.Service.UpdateInstanceSetting(adminCtx, &apipb.UpdateInstanceSettingRequest{ + InstanceSetting: notificationSetting, }) require.Error(t, err) require.Contains(t, err.Error(), "smtp password is required") @@ -808,12 +808,12 @@ func TestUpdateInstanceSetting(t *testing.T) { adminCtx := ts.CreateUserContext(ctx, hostUser.ID) // Save storage setting with a real secret. - _, err = ts.Service.UpdateInstanceSetting(adminCtx, &v1pb.UpdateInstanceSettingRequest{ - Setting: &v1pb.InstanceSetting{ + _, err = ts.Service.UpdateInstanceSetting(adminCtx, &apipb.UpdateInstanceSettingRequest{ + InstanceSetting: &apipb.InstanceSetting{ Name: "instance/settings/STORAGE", - Value: &v1pb.InstanceSetting_StorageSetting_{ - StorageSetting: &v1pb.InstanceSetting_StorageSetting{ - S3Config: &v1pb.InstanceSetting_StorageSetting_S3Config{ + Value: &apipb.InstanceSetting_StorageSetting_{ + StorageSetting: &apipb.InstanceSetting_StorageSetting{ + S3Config: &apipb.InstanceSetting_StorageSetting_S3Config{ AccessKeyId: "AKID", AccessKeySecret: "super-secret", Endpoint: "s3.example.com", @@ -828,7 +828,7 @@ func TestUpdateInstanceSetting(t *testing.T) { require.NoError(t, err) // Read back: secret must not be returned. - resp, err := ts.Service.GetInstanceSetting(adminCtx, &v1pb.GetInstanceSettingRequest{ + resp, err := ts.Service.GetInstanceSetting(adminCtx, &apipb.GetInstanceSettingRequest{ Name: "instance/settings/STORAGE", }) require.NoError(t, err) @@ -836,7 +836,7 @@ func TestUpdateInstanceSetting(t *testing.T) { "AccessKeySecret must never be returned in responses") require.True(t, resp.GetStorageSetting().GetS3Config().GetInsecureSkipTlsVerify(), "insecure_skip_tls_verify must round-trip through the API") - var defaultStorage *v1pb.InstanceSetting_Storage + var defaultStorage *apipb.InstanceSetting_Storage for _, configuredStorage := range resp.GetStorageSetting().GetStorages() { if configuredStorage.GetId() == resp.GetStorageSetting().GetDefaultStorageId() { defaultStorage = configuredStorage @@ -847,12 +847,12 @@ func TestUpdateInstanceSetting(t *testing.T) { "AccessKeySecret must be write-only in named storage responses") // Update with empty secret; original must be preserved in the store. - _, err = ts.Service.UpdateInstanceSetting(adminCtx, &v1pb.UpdateInstanceSettingRequest{ - Setting: &v1pb.InstanceSetting{ + _, err = ts.Service.UpdateInstanceSetting(adminCtx, &apipb.UpdateInstanceSettingRequest{ + InstanceSetting: &apipb.InstanceSetting{ Name: "instance/settings/STORAGE", - Value: &v1pb.InstanceSetting_StorageSetting_{ - StorageSetting: &v1pb.InstanceSetting_StorageSetting{ - S3Config: &v1pb.InstanceSetting_StorageSetting_S3Config{ + Value: &apipb.InstanceSetting_StorageSetting_{ + StorageSetting: &apipb.InstanceSetting_StorageSetting{ + S3Config: &apipb.InstanceSetting_StorageSetting_S3Config{ AccessKeyId: "AKID", AccessKeySecret: "", // omitted / not changed Endpoint: "s3-v2.example.com", @@ -894,16 +894,16 @@ func TestUpdateInstanceSetting(t *testing.T) { require.NoError(t, err) adminCtx := ts.CreateUserContext(ctx, hostUser.ID) - _, err = ts.Service.UpdateInstanceSetting(adminCtx, &v1pb.UpdateInstanceSettingRequest{ - Setting: &v1pb.InstanceSetting{ + _, err = ts.Service.UpdateInstanceSetting(adminCtx, &apipb.UpdateInstanceSettingRequest{ + InstanceSetting: &apipb.InstanceSetting{ Name: "instance/settings/AI", - Value: &v1pb.InstanceSetting_AiSetting{ - AiSetting: &v1pb.InstanceSetting_AISetting{ - Providers: []*v1pb.InstanceSetting_AIProviderConfig{ + Value: &apipb.InstanceSetting_AiSetting{ + AiSetting: &apipb.InstanceSetting_AISetting{ + Providers: []*apipb.InstanceSetting_AIProviderConfig{ { Id: "openai-main", Title: "OpenAI", - Type: v1pb.InstanceSetting_OPENAI, + Type: apipb.InstanceSetting_OPENAI, ApiKey: "sk-original", }, }, @@ -913,7 +913,7 @@ func TestUpdateInstanceSetting(t *testing.T) { }) require.NoError(t, err) - resp, err := ts.Service.GetInstanceSetting(adminCtx, &v1pb.GetInstanceSettingRequest{ + resp, err := ts.Service.GetInstanceSetting(adminCtx, &apipb.GetInstanceSettingRequest{ Name: "instance/settings/AI", }) require.NoError(t, err) @@ -924,16 +924,16 @@ func TestUpdateInstanceSetting(t *testing.T) { require.Equal(t, "sk-o...inal", provider.GetApiKeyHint()) require.Equal(t, "https://api.openai.com/v1", provider.GetEndpoint()) - _, err = ts.Service.UpdateInstanceSetting(adminCtx, &v1pb.UpdateInstanceSettingRequest{ - Setting: &v1pb.InstanceSetting{ + _, err = ts.Service.UpdateInstanceSetting(adminCtx, &apipb.UpdateInstanceSettingRequest{ + InstanceSetting: &apipb.InstanceSetting{ Name: "instance/settings/AI", - Value: &v1pb.InstanceSetting_AiSetting{ - AiSetting: &v1pb.InstanceSetting_AISetting{ - Providers: []*v1pb.InstanceSetting_AIProviderConfig{ + Value: &apipb.InstanceSetting_AiSetting{ + AiSetting: &apipb.InstanceSetting_AISetting{ + Providers: []*apipb.InstanceSetting_AIProviderConfig{ { Id: "openai-main", Title: "OpenAI primary", - Type: v1pb.InstanceSetting_OPENAI, + Type: apipb.InstanceSetting_OPENAI, ApiKey: "", }, }, @@ -959,20 +959,20 @@ func TestUpdateInstanceSetting(t *testing.T) { require.NoError(t, err) adminCtx := ts.CreateUserContext(ctx, hostUser.ID) - _, err = ts.Service.UpdateInstanceSetting(adminCtx, &v1pb.UpdateInstanceSettingRequest{ - Setting: &v1pb.InstanceSetting{ + _, err = ts.Service.UpdateInstanceSetting(adminCtx, &apipb.UpdateInstanceSettingRequest{ + InstanceSetting: &apipb.InstanceSetting{ Name: "instance/settings/AI", - Value: &v1pb.InstanceSetting_AiSetting{ - AiSetting: &v1pb.InstanceSetting_AISetting{ - Providers: []*v1pb.InstanceSetting_AIProviderConfig{ + Value: &apipb.InstanceSetting_AiSetting{ + AiSetting: &apipb.InstanceSetting_AISetting{ + Providers: []*apipb.InstanceSetting_AIProviderConfig{ { Id: "openai-main", Title: "OpenAI", - Type: v1pb.InstanceSetting_OPENAI, + Type: apipb.InstanceSetting_OPENAI, ApiKey: "sk-test", }, }, - Transcription: &v1pb.InstanceSetting_TranscriptionConfig{ + Transcription: &apipb.InstanceSetting_TranscriptionConfig{ ProviderId: "does-not-exist", }, }, @@ -991,15 +991,15 @@ func TestUpdateInstanceSetting(t *testing.T) { require.NoError(t, err) adminCtx := ts.CreateUserContext(ctx, hostUser.ID) - base := &v1pb.InstanceSetting{ + base := &apipb.InstanceSetting{ Name: "instance/settings/AI", - Value: &v1pb.InstanceSetting_AiSetting{ - AiSetting: &v1pb.InstanceSetting_AISetting{ - Providers: []*v1pb.InstanceSetting_AIProviderConfig{ + Value: &apipb.InstanceSetting_AiSetting{ + AiSetting: &apipb.InstanceSetting_AISetting{ + Providers: []*apipb.InstanceSetting_AIProviderConfig{ { Id: "openai-main", Title: "OpenAI", - Type: v1pb.InstanceSetting_OPENAI, + Type: apipb.InstanceSetting_OPENAI, ApiKey: "sk-test", }, }, @@ -1008,29 +1008,29 @@ func TestUpdateInstanceSetting(t *testing.T) { } oversizedModel := strings.Repeat("a", 257) - base.GetAiSetting().Transcription = &v1pb.InstanceSetting_TranscriptionConfig{ + base.GetAiSetting().Transcription = &apipb.InstanceSetting_TranscriptionConfig{ ProviderId: "openai-main", Model: oversizedModel, } - _, err = ts.Service.UpdateInstanceSetting(adminCtx, &v1pb.UpdateInstanceSettingRequest{Setting: base}) + _, err = ts.Service.UpdateInstanceSetting(adminCtx, &apipb.UpdateInstanceSettingRequest{InstanceSetting: base}) require.Error(t, err) require.Contains(t, err.Error(), "transcription model") oversizedLanguage := strings.Repeat("a", 33) - base.GetAiSetting().Transcription = &v1pb.InstanceSetting_TranscriptionConfig{ + base.GetAiSetting().Transcription = &apipb.InstanceSetting_TranscriptionConfig{ ProviderId: "openai-main", Language: oversizedLanguage, } - _, err = ts.Service.UpdateInstanceSetting(adminCtx, &v1pb.UpdateInstanceSettingRequest{Setting: base}) + _, err = ts.Service.UpdateInstanceSetting(adminCtx, &apipb.UpdateInstanceSettingRequest{InstanceSetting: base}) require.Error(t, err) require.Contains(t, err.Error(), "transcription language") oversizedPrompt := strings.Repeat("a", 4097) - base.GetAiSetting().Transcription = &v1pb.InstanceSetting_TranscriptionConfig{ + base.GetAiSetting().Transcription = &apipb.InstanceSetting_TranscriptionConfig{ ProviderId: "openai-main", Prompt: oversizedPrompt, } - _, err = ts.Service.UpdateInstanceSetting(adminCtx, &v1pb.UpdateInstanceSettingRequest{Setting: base}) + _, err = ts.Service.UpdateInstanceSetting(adminCtx, &apipb.UpdateInstanceSettingRequest{InstanceSetting: base}) require.Error(t, err) require.Contains(t, err.Error(), "transcription prompt") }) @@ -1043,20 +1043,20 @@ func TestUpdateInstanceSetting(t *testing.T) { require.NoError(t, err) adminCtx := ts.CreateUserContext(ctx, hostUser.ID) - _, err = ts.Service.UpdateInstanceSetting(adminCtx, &v1pb.UpdateInstanceSettingRequest{ - Setting: &v1pb.InstanceSetting{ + _, err = ts.Service.UpdateInstanceSetting(adminCtx, &apipb.UpdateInstanceSettingRequest{ + InstanceSetting: &apipb.InstanceSetting{ Name: "instance/settings/AI", - Value: &v1pb.InstanceSetting_AiSetting{ - AiSetting: &v1pb.InstanceSetting_AISetting{ - Providers: []*v1pb.InstanceSetting_AIProviderConfig{ + Value: &apipb.InstanceSetting_AiSetting{ + AiSetting: &apipb.InstanceSetting_AISetting{ + Providers: []*apipb.InstanceSetting_AIProviderConfig{ { Id: "openai-main", Title: "OpenAI", - Type: v1pb.InstanceSetting_OPENAI, + Type: apipb.InstanceSetting_OPENAI, ApiKey: "sk-test", }, }, - Transcription: &v1pb.InstanceSetting_TranscriptionConfig{ + Transcription: &apipb.InstanceSetting_TranscriptionConfig{ ProviderId: "openai-main", Model: "whisper-1", Language: "en", @@ -1068,16 +1068,16 @@ func TestUpdateInstanceSetting(t *testing.T) { }) require.NoError(t, err) - _, err = ts.Service.UpdateInstanceSetting(adminCtx, &v1pb.UpdateInstanceSettingRequest{ - Setting: &v1pb.InstanceSetting{ + _, err = ts.Service.UpdateInstanceSetting(adminCtx, &apipb.UpdateInstanceSettingRequest{ + InstanceSetting: &apipb.InstanceSetting{ Name: "instance/settings/AI", - Value: &v1pb.InstanceSetting_AiSetting{ - AiSetting: &v1pb.InstanceSetting_AISetting{ - Providers: []*v1pb.InstanceSetting_AIProviderConfig{ + Value: &apipb.InstanceSetting_AiSetting{ + AiSetting: &apipb.InstanceSetting_AISetting{ + Providers: []*apipb.InstanceSetting_AIProviderConfig{ { Id: "openai-main", Title: "OpenAI", - Type: v1pb.InstanceSetting_OPENAI, + Type: apipb.InstanceSetting_OPENAI, ApiKey: "", }, }, diff --git a/server/api/v1/test/instance_stats_test.go b/server/api/test/instance_stats_test.go similarity index 82% rename from server/api/v1/test/instance_stats_test.go rename to server/api/test/instance_stats_test.go index 071486bf4..ba55dd2e1 100644 --- a/server/api/v1/test/instance_stats_test.go +++ b/server/api/test/instance_stats_test.go @@ -8,7 +8,7 @@ import ( "google.golang.org/grpc/codes" "google.golang.org/grpc/status" - v1pb "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" ) func TestGetInstanceStats_HappyPath(t *testing.T) { @@ -20,7 +20,7 @@ func TestGetInstanceStats_HappyPath(t *testing.T) { require.NoError(t, err) adminCtx := ts.CreateUserContext(ctx, admin.ID) - resp, err := ts.Service.GetInstanceStats(adminCtx, &v1pb.GetInstanceStatsRequest{}) + resp, err := ts.Service.GetInstanceStats(adminCtx, &apipb.GetInstanceStatsRequest{}) require.NoError(t, err) require.NotNil(t, resp) @@ -45,7 +45,7 @@ func TestGetInstanceStats_NonAdminDenied(t *testing.T) { require.NoError(t, err) regularCtx := ts.CreateUserContext(ctx, regular.ID) - _, err = ts.Service.GetInstanceStats(regularCtx, &v1pb.GetInstanceStatsRequest{}) + _, err = ts.Service.GetInstanceStats(regularCtx, &apipb.GetInstanceStatsRequest{}) require.Error(t, err) st, ok := status.FromError(err) require.True(t, ok) @@ -61,10 +61,10 @@ func TestGetInstanceStats_Cache(t *testing.T) { require.NoError(t, err) adminCtx := ts.CreateUserContext(ctx, admin.ID) - first, err := ts.Service.GetInstanceStats(adminCtx, &v1pb.GetInstanceStatsRequest{}) + first, err := ts.Service.GetInstanceStats(adminCtx, &apipb.GetInstanceStatsRequest{}) require.NoError(t, err) - second, err := ts.Service.GetInstanceStats(adminCtx, &v1pb.GetInstanceStatsRequest{}) + second, err := ts.Service.GetInstanceStats(adminCtx, &apipb.GetInstanceStatsRequest{}) require.NoError(t, err) // Cache hit: same pointer (the cache returns the stored *InstanceStats directly). diff --git a/server/api/v1/test/memo_attachment_markdown_test.go b/server/api/test/memo_attachment_markdown_test.go similarity index 75% rename from server/api/v1/test/memo_attachment_markdown_test.go rename to server/api/test/memo_attachment_markdown_test.go index 254a94e77..b1e15812c 100644 --- a/server/api/v1/test/memo_attachment_markdown_test.go +++ b/server/api/test/memo_attachment_markdown_test.go @@ -14,8 +14,8 @@ import ( "google.golang.org/grpc/status" "google.golang.org/protobuf/types/known/fieldmaskpb" - v1pb "github.com/usememos/memos/proto/gen/api/v1" - api "github.com/usememos/memos/server/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" + "github.com/usememos/memos/server/api" "github.com/usememos/memos/store" ) @@ -33,13 +33,13 @@ func TestMemoManagedAttachmentImages(t *testing.T) { firstUID := strings.TrimPrefix(first.Name, "attachments/") secondUID := strings.TrimPrefix(second.Name, "attachments/") - memo, err := ts.Service.CreateMemo(userCtx, &v1pb.CreateMemoRequest{Memo: &v1pb.Memo{ + memo, err := ts.Service.CreateMemo(userCtx, &apipb.CreateMemoRequest{Memo: &apipb.Memo{ Content: fmt.Sprintf("![first](/file/attachments/%s)\n![second](/file/attachments/%s/second.png)", firstUID, secondUID), - Attachments: []*v1pb.Attachment{ + Attachments: []*apipb.Attachment{ {Name: first.Name}, {Name: second.Name}, }, - Visibility: v1pb.Visibility_PRIVATE, + Visibility: apipb.Visibility_PRIVATE, }}) require.NoError(t, err) require.Len(t, memo.Attachments, 2) @@ -52,11 +52,11 @@ func TestMemoManagedAttachmentImages(t *testing.T) { require.NoError(t, err) userCtx := ts.CreateUserContext(ctx, user.ID) - _, err = ts.Service.CreateMemo(userCtx, &v1pb.CreateMemoRequest{ + _, err = ts.Service.CreateMemo(userCtx, &apipb.CreateMemoRequest{ MemoId: "managed-missing-memo", - Memo: &v1pb.Memo{ + Memo: &apipb.Memo{ Content: "![missing](http://localhost:8080/file/attachments/missing-image)", - Visibility: v1pb.Visibility_PRIVATE, + Visibility: apipb.Visibility_PRIVATE, }, }) require.Equal(t, codes.FailedPrecondition, status.Code(err)) @@ -72,7 +72,7 @@ func TestMemoManagedAttachmentImages(t *testing.T) { user, err := ts.CreateRegularUser(ctx, "managed-mime") require.NoError(t, err) userCtx := ts.CreateUserContext(ctx, user.ID) - textAttachment, err := ts.Service.CreateAttachment(userCtx, &v1pb.CreateAttachmentRequest{Attachment: &v1pb.Attachment{ + textAttachment, err := ts.Service.CreateAttachment(userCtx, &apipb.CreateAttachmentRequest{Attachment: &apipb.Attachment{ Filename: "not-image.txt", Type: "text/plain", Content: []byte("not an image"), @@ -80,9 +80,9 @@ func TestMemoManagedAttachmentImages(t *testing.T) { require.NoError(t, err) uid := strings.TrimPrefix(textAttachment.Name, "attachments/") - _, err = ts.Service.CreateMemo(userCtx, &v1pb.CreateMemoRequest{Memo: &v1pb.Memo{ + _, err = ts.Service.CreateMemo(userCtx, &apipb.CreateMemoRequest{Memo: &apipb.Memo{ Content: fmt.Sprintf("![wrong type](/file/attachments/%s)", uid), - Attachments: []*v1pb.Attachment{{Name: textAttachment.Name}}, + Attachments: []*apipb.Attachment{{Name: textAttachment.Name}}, }}) require.Equal(t, codes.InvalidArgument, status.Code(err)) }) @@ -96,9 +96,9 @@ func TestMemoManagedAttachmentImages(t *testing.T) { image := createTestImageAttachment(userCtx, t, ts, "query.png") uid := strings.TrimPrefix(image.Name, "attachments/") - _, err = ts.Service.CreateMemo(userCtx, &v1pb.CreateMemoRequest{Memo: &v1pb.Memo{ + _, err = ts.Service.CreateMemo(userCtx, &apipb.CreateMemoRequest{Memo: &apipb.Memo{ Content: fmt.Sprintf("![query](/file/attachments/%s?share_token=secret)", uid), - Attachments: []*v1pb.Attachment{{Name: image.Name}}, + Attachments: []*apipb.Attachment{{Name: image.Name}}, }}) require.Equal(t, codes.InvalidArgument, status.Code(err)) }) @@ -112,9 +112,9 @@ func TestMemoManagedAttachmentImages(t *testing.T) { image := createTestImageAttachment(userCtx, t, ts, "network-path.png") uid := strings.TrimPrefix(image.Name, "attachments/") - _, err = ts.Service.CreateMemo(userCtx, &v1pb.CreateMemoRequest{Memo: &v1pb.Memo{ + _, err = ts.Service.CreateMemo(userCtx, &apipb.CreateMemoRequest{Memo: &apipb.Memo{ Content: fmt.Sprintf("![network path](//localhost:8080/file/attachments/%s)", uid), - Attachments: []*v1pb.Attachment{{Name: image.Name}}, + Attachments: []*apipb.Attachment{{Name: image.Name}}, }}) require.Equal(t, codes.InvalidArgument, status.Code(err)) }) @@ -126,7 +126,7 @@ func TestMemoManagedAttachmentImages(t *testing.T) { require.NoError(t, err) userCtx := ts.CreateUserContext(ctx, user.ID) - memo, err := ts.Service.CreateMemo(userCtx, &v1pb.CreateMemoRequest{Memo: &v1pb.Memo{ + memo, err := ts.Service.CreateMemo(userCtx, &apipb.CreateMemoRequest{Memo: &apipb.Memo{ Content: "![external](//cdn.example.com/file/attachments/external-image)", }}) require.NoError(t, err) @@ -144,12 +144,12 @@ func TestMemoManagedAttachmentImages(t *testing.T) { uid := strings.TrimPrefix(image.Name, "attachments/") content := fmt.Sprintf("![absolute](http://localhost:80/file/attachments/%s)", uid) - _, err = ts.Service.CreateMemo(userCtx, &v1pb.CreateMemoRequest{Memo: &v1pb.Memo{Content: content}}) + _, err = ts.Service.CreateMemo(userCtx, &apipb.CreateMemoRequest{Memo: &apipb.Memo{Content: content}}) require.Equal(t, codes.FailedPrecondition, status.Code(err)) - memo, err := ts.Service.CreateMemo(userCtx, &v1pb.CreateMemoRequest{Memo: &v1pb.Memo{ + memo, err := ts.Service.CreateMemo(userCtx, &apipb.CreateMemoRequest{Memo: &apipb.Memo{ Content: content, - Attachments: []*v1pb.Attachment{{Name: image.Name}}, + Attachments: []*apipb.Attachment{{Name: image.Name}}, }}) require.NoError(t, err) require.Len(t, memo.Attachments, 1) @@ -161,7 +161,7 @@ func TestMemoManagedAttachmentImages(t *testing.T) { user, err := ts.CreateRegularUser(ctx, "managed-many-attachments") require.NoError(t, err) userCtx := ts.CreateUserContext(ctx, user.ID) - memo, err := ts.Service.CreateMemo(userCtx, &v1pb.CreateMemoRequest{Memo: &v1pb.Memo{Content: "many attachments"}}) + memo, err := ts.Service.CreateMemo(userCtx, &apipb.CreateMemoRequest{Memo: &apipb.Memo{Content: "many attachments"}}) require.NoError(t, err) memoID := memoIDFromName(ctx, t, ts, memo.Name) @@ -178,8 +178,8 @@ func TestMemoManagedAttachmentImages(t *testing.T) { require.NoError(t, ts.Store.UpdateAttachment(ctx, &store.UpdateAttachment{ID: attachment.ID, UpdatedTs: &updatedTs})) } - updated, err := ts.Service.UpdateMemo(userCtx, &v1pb.UpdateMemoRequest{ - Memo: &v1pb.Memo{ + updated, err := ts.Service.UpdateMemo(userCtx, &apipb.UpdateMemoRequest{ + Memo: &apipb.Memo{ Name: memo.Name, Content: fmt.Sprintf("![oldest](/file/attachments/%s)", referenced.UID), }, @@ -197,15 +197,15 @@ func TestMemoManagedAttachmentImages(t *testing.T) { userCtx := ts.CreateUserContext(ctx, user.ID) image := createTestImageAttachment(userCtx, t, ts, "kept.png") uid := strings.TrimPrefix(image.Name, "attachments/") - memo, err := ts.Service.CreateMemo(userCtx, &v1pb.CreateMemoRequest{Memo: &v1pb.Memo{ + memo, err := ts.Service.CreateMemo(userCtx, &apipb.CreateMemoRequest{Memo: &apipb.Memo{ Content: fmt.Sprintf("![kept](/file/attachments/%s)", uid), - Attachments: []*v1pb.Attachment{{Name: image.Name}}, + Attachments: []*apipb.Attachment{{Name: image.Name}}, }}) require.NoError(t, err) - _, err = ts.Service.SetMemoAttachments(userCtx, &v1pb.SetMemoAttachmentsRequest{Name: memo.Name}) + _, err = ts.Service.SetMemoAttachments(userCtx, &apipb.SetMemoAttachmentsRequest{Name: memo.Name}) require.Equal(t, codes.FailedPrecondition, status.Code(err)) - attachments, listErr := ts.Service.ListMemoAttachments(userCtx, &v1pb.ListMemoAttachmentsRequest{Name: memo.Name}) + attachments, listErr := ts.Service.ListMemoAttachments(userCtx, &apipb.ListMemoAttachmentsRequest{Parent: memo.Name}) require.NoError(t, listErr) require.Len(t, attachments.Attachments, 1) }) @@ -218,14 +218,14 @@ func TestMemoManagedAttachmentImages(t *testing.T) { userCtx := ts.CreateUserContext(ctx, user.ID) image := createTestImageAttachment(userCtx, t, ts, "removed.png") uid := strings.TrimPrefix(image.Name, "attachments/") - memo, err := ts.Service.CreateMemo(userCtx, &v1pb.CreateMemoRequest{Memo: &v1pb.Memo{ + memo, err := ts.Service.CreateMemo(userCtx, &apipb.CreateMemoRequest{Memo: &apipb.Memo{ Content: fmt.Sprintf("![removed](/file/attachments/%s)", uid), - Attachments: []*v1pb.Attachment{{Name: image.Name}}, + Attachments: []*apipb.Attachment{{Name: image.Name}}, }}) require.NoError(t, err) - updated, err := ts.Service.UpdateMemo(userCtx, &v1pb.UpdateMemoRequest{ - Memo: &v1pb.Memo{Name: memo.Name, Content: "image removed", Attachments: []*v1pb.Attachment{}}, + updated, err := ts.Service.UpdateMemo(userCtx, &apipb.UpdateMemoRequest{ + Memo: &apipb.Memo{Name: memo.Name, Content: "image removed", Attachments: []*apipb.Attachment{}}, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"attachments", "content"}}, }) require.NoError(t, err) @@ -244,9 +244,9 @@ func TestMemoManagedAttachmentImages(t *testing.T) { userCtx := ts.CreateUserContext(ctx, user.ID) image := createTestImageAttachment(userCtx, t, ts, "retry.png") uid := strings.TrimPrefix(image.Name, "attachments/") - memo, err := ts.Service.CreateMemo(userCtx, &v1pb.CreateMemoRequest{Memo: &v1pb.Memo{ + memo, err := ts.Service.CreateMemo(userCtx, &apipb.CreateMemoRequest{Memo: &apipb.Memo{ Content: "attachment will be removed", - Attachments: []*v1pb.Attachment{{Name: image.Name}}, + Attachments: []*apipb.Attachment{{Name: image.Name}}, }}) require.NoError(t, err) storedImage, err := ts.Store.GetAttachment(ctx, &store.FindAttachment{UID: &uid}) @@ -260,14 +260,14 @@ func TestMemoManagedAttachmentImages(t *testing.T) { "LOCAL", localReference, storedImage.ID, ) require.NoError(t, err) - _, err = ts.Service.UpdateMemo(store.WithDeleteAttachmentStorageFailpoint(userCtx), &v1pb.UpdateMemoRequest{ - Memo: &v1pb.Memo{Name: memo.Name, Content: "attachment removed", Attachments: []*v1pb.Attachment{}}, + _, err = ts.Service.UpdateMemo(store.WithDeleteAttachmentStorageFailpoint(userCtx), &apipb.UpdateMemoRequest{ + Memo: &apipb.Memo{Name: memo.Name, Content: "attachment removed", Attachments: []*apipb.Attachment{}}, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"content", "attachments"}}, }) require.Equal(t, codes.Internal, status.Code(err)) require.ErrorContains(t, err, "memo was updated but attachment storage cleanup failed") require.ErrorContains(t, err, store.ErrDeleteAttachmentStorageFailpoint.Error()) - storedMemo, getErr := ts.Service.GetMemo(userCtx, &v1pb.GetMemoRequest{Name: memo.Name}) + storedMemo, getErr := ts.Service.GetMemo(userCtx, &apipb.GetMemoRequest{Name: memo.Name}) require.NoError(t, getErr) require.Equal(t, "attachment removed", storedMemo.Content) storedImage, getErr = ts.Store.GetAttachment(ctx, &store.FindAttachment{UID: &uid}) @@ -283,15 +283,15 @@ func TestMemoManagedAttachmentImages(t *testing.T) { user, err := ts.CreateRegularUser(ctx, "managed-update-failure") require.NoError(t, err) userCtx := ts.CreateUserContext(ctx, user.ID) - memo, err := ts.Service.CreateMemo(userCtx, &v1pb.CreateMemoRequest{Memo: &v1pb.Memo{Content: "original"}}) + memo, err := ts.Service.CreateMemo(userCtx, &apipb.CreateMemoRequest{Memo: &apipb.Memo{Content: "original"}}) require.NoError(t, err) - _, err = ts.Service.UpdateMemo(userCtx, &v1pb.UpdateMemoRequest{ - Memo: &v1pb.Memo{Name: memo.Name, Content: "![missing](/file/attachments/missing-update-image)"}, + _, err = ts.Service.UpdateMemo(userCtx, &apipb.UpdateMemoRequest{ + Memo: &apipb.Memo{Name: memo.Name, Content: "![missing](/file/attachments/missing-update-image)"}, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"content"}}, }) require.Equal(t, codes.FailedPrecondition, status.Code(err)) - stored, getErr := ts.Service.GetMemo(userCtx, &v1pb.GetMemoRequest{Name: memo.Name}) + stored, getErr := ts.Service.GetMemo(userCtx, &apipb.GetMemoRequest{Name: memo.Name}) require.NoError(t, getErr) require.Equal(t, "original", stored.Content) }) @@ -304,15 +304,15 @@ func TestMemoManagedAttachmentImages(t *testing.T) { userCtx := ts.CreateUserContext(ctx, user.ID) image := createTestImageAttachment(userCtx, t, ts, "referenced.png") uid := strings.TrimPrefix(image.Name, "attachments/") - _, err = ts.Service.CreateMemo(userCtx, &v1pb.CreateMemoRequest{Memo: &v1pb.Memo{ + _, err = ts.Service.CreateMemo(userCtx, &apipb.CreateMemoRequest{Memo: &apipb.Memo{ Content: fmt.Sprintf("![referenced](/file/attachments/%s)", uid), - Attachments: []*v1pb.Attachment{{Name: image.Name}}, + Attachments: []*apipb.Attachment{{Name: image.Name}}, }}) require.NoError(t, err) - _, err = ts.Service.DeleteAttachment(userCtx, &v1pb.DeleteAttachmentRequest{Name: image.Name}) + _, err = ts.Service.DeleteAttachment(userCtx, &apipb.DeleteAttachmentRequest{Name: image.Name}) require.Equal(t, codes.FailedPrecondition, status.Code(err)) - _, err = ts.Service.BatchDeleteAttachments(userCtx, &v1pb.BatchDeleteAttachmentsRequest{Names: []string{image.Name}}) + _, err = ts.Service.BatchDeleteAttachments(userCtx, &apipb.BatchDeleteAttachmentsRequest{Names: []string{image.Name}}) require.Equal(t, codes.FailedPrecondition, status.Code(err)) stored, getErr := ts.Store.GetAttachment(ctx, &store.FindAttachment{UID: &uid}) require.NoError(t, getErr) @@ -328,14 +328,14 @@ func TestMemoAttachmentBindingDoesNotReparent(t *testing.T) { require.NoError(t, err) userCtx := ts.CreateUserContext(ctx, user.ID) image := createTestImageAttachment(userCtx, t, ts, "bound.png") - first, err := ts.Service.CreateMemo(userCtx, &v1pb.CreateMemoRequest{Memo: &v1pb.Memo{Attachments: []*v1pb.Attachment{{Name: image.Name}}}}) + first, err := ts.Service.CreateMemo(userCtx, &apipb.CreateMemoRequest{Memo: &apipb.Memo{Attachments: []*apipb.Attachment{{Name: image.Name}}}}) require.NoError(t, err) - second, err := ts.Service.CreateMemo(userCtx, &v1pb.CreateMemoRequest{Memo: &v1pb.Memo{Content: "second"}}) + second, err := ts.Service.CreateMemo(userCtx, &apipb.CreateMemoRequest{Memo: &apipb.Memo{Content: "second"}}) require.NoError(t, err) - _, err = ts.Service.SetMemoAttachments(userCtx, &v1pb.SetMemoAttachmentsRequest{ + _, err = ts.Service.SetMemoAttachments(userCtx, &apipb.SetMemoAttachmentsRequest{ Name: second.Name, - Attachments: []*v1pb.Attachment{{Name: image.Name}}, + Attachments: []*apipb.Attachment{{Name: image.Name}}, }) require.Equal(t, codes.FailedPrecondition, status.Code(err)) uid, err := api.ExtractAttachmentUIDFromName(image.Name) @@ -359,11 +359,11 @@ func TestCreateMemoDoesNotBindAnotherUsersAttachmentOrCreatePartialMemo(t *testi otherCtx := ts.CreateUserContext(ctx, other.ID) image := createTestImageAttachment(ownerCtx, t, ts, "foreign.png") - _, err = ts.Service.CreateMemo(otherCtx, &v1pb.CreateMemoRequest{ + _, err = ts.Service.CreateMemo(otherCtx, &apipb.CreateMemoRequest{ MemoId: "no-partial-foreign-memo", - Memo: &v1pb.Memo{ + Memo: &apipb.Memo{ Content: "foreign attachment", - Attachments: []*v1pb.Attachment{{Name: image.Name}}, + Attachments: []*apipb.Attachment{{Name: image.Name}}, }, }) require.Equal(t, codes.NotFound, status.Code(err)) @@ -378,9 +378,9 @@ func TestCreateMemoDoesNotBindAnotherUsersAttachmentOrCreatePartialMemo(t *testi require.Nil(t, attachment.MemoID) } -func createTestImageAttachment(ctx context.Context, t *testing.T, ts *TestService, filename string) *v1pb.Attachment { +func createTestImageAttachment(ctx context.Context, t *testing.T, ts *TestService, filename string) *apipb.Attachment { t.Helper() - attachment, err := ts.Service.CreateAttachment(ctx, &v1pb.CreateAttachmentRequest{Attachment: &v1pb.Attachment{ + attachment, err := ts.Service.CreateAttachment(ctx, &apipb.CreateAttachmentRequest{Attachment: &apipb.Attachment{ Filename: filename, Type: "image/png", Content: []byte("test image"), diff --git a/server/api/v1/test/memo_attachment_service_test.go b/server/api/test/memo_attachment_service_test.go similarity index 72% rename from server/api/v1/test/memo_attachment_service_test.go rename to server/api/test/memo_attachment_service_test.go index f7043eaf7..462a7cfba 100644 --- a/server/api/v1/test/memo_attachment_service_test.go +++ b/server/api/test/memo_attachment_service_test.go @@ -9,7 +9,7 @@ import ( "google.golang.org/grpc/codes" "google.golang.org/grpc/status" - apiv1 "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" "github.com/usememos/memos/store" ) @@ -26,18 +26,18 @@ func TestSetMemoAttachments(t *testing.T) { userCtx := ts.CreateUserContext(ctx, user.ID) // Create memo - memo, err := ts.Service.CreateMemo(userCtx, &apiv1.CreateMemoRequest{ - Memo: &apiv1.Memo{ + memo, err := ts.Service.CreateMemo(userCtx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{ Content: "Test memo", - Visibility: apiv1.Visibility_PRIVATE, + Visibility: apipb.Visibility_PRIVATE, }, }) require.NoError(t, err) require.NotNil(t, memo) // Create attachment - attachment, err := ts.Service.CreateAttachment(userCtx, &apiv1.CreateAttachmentRequest{ - Attachment: &apiv1.Attachment{ + attachment, err := ts.Service.CreateAttachment(userCtx, &apipb.CreateAttachmentRequest{ + Attachment: &apipb.Attachment{ Filename: "test.txt", Size: 5, Type: "text/plain", @@ -48,9 +48,9 @@ func TestSetMemoAttachments(t *testing.T) { require.NotNil(t, attachment) // Set memo attachments - should succeed - _, err = ts.Service.SetMemoAttachments(userCtx, &apiv1.SetMemoAttachmentsRequest{ + _, err = ts.Service.SetMemoAttachments(userCtx, &apipb.SetMemoAttachmentsRequest{ Name: memo.Name, - Attachments: []*apiv1.Attachment{ + Attachments: []*apipb.Attachment{ {Name: attachment.Name}, }, }) @@ -72,19 +72,19 @@ func TestSetMemoAttachments(t *testing.T) { hostCtx := ts.CreateUserContext(ctx, hostUser.ID) // Create memo by regular user - memo, err := ts.Service.CreateMemo(regularUserCtx, &apiv1.CreateMemoRequest{ - Memo: &apiv1.Memo{ + memo, err := ts.Service.CreateMemo(regularUserCtx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{ Content: "Test memo", - Visibility: apiv1.Visibility_PRIVATE, + Visibility: apipb.Visibility_PRIVATE, }, }) require.NoError(t, err) require.NotNil(t, memo) // Application ADMIN is the superuser and manages any memo's attachments. - _, err = ts.Service.SetMemoAttachments(hostCtx, &apiv1.SetMemoAttachmentsRequest{ + _, err = ts.Service.SetMemoAttachments(hostCtx, &apipb.SetMemoAttachmentsRequest{ Name: memo.Name, - Attachments: []*apiv1.Attachment{}, + Attachments: []*apipb.Attachment{}, }) require.NoError(t, err) }) @@ -104,19 +104,19 @@ func TestSetMemoAttachments(t *testing.T) { user2Ctx := ts.CreateUserContext(ctx, user2.ID) // Create memo by user1 - memo, err := ts.Service.CreateMemo(user1Ctx, &apiv1.CreateMemoRequest{ - Memo: &apiv1.Memo{ + memo, err := ts.Service.CreateMemo(user1Ctx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{ Content: "Test memo", - Visibility: apiv1.Visibility_PRIVATE, + Visibility: apipb.Visibility_PRIVATE, }, }) require.NoError(t, err) require.NotNil(t, memo) // User2 tries to modify attachments - should fail - _, err = ts.Service.SetMemoAttachments(user2Ctx, &apiv1.SetMemoAttachmentsRequest{ + _, err = ts.Service.SetMemoAttachments(user2Ctx, &apipb.SetMemoAttachmentsRequest{ Name: memo.Name, - Attachments: []*apiv1.Attachment{}, + Attachments: []*apipb.Attachment{}, }) require.Error(t, err) require.Contains(t, err.Error(), "permission denied") @@ -132,19 +132,19 @@ func TestSetMemoAttachments(t *testing.T) { userCtx := ts.CreateUserContext(ctx, user.ID) // Create memo - memo, err := ts.Service.CreateMemo(userCtx, &apiv1.CreateMemoRequest{ - Memo: &apiv1.Memo{ + memo, err := ts.Service.CreateMemo(userCtx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{ Content: "Test memo", - Visibility: apiv1.Visibility_PRIVATE, + Visibility: apipb.Visibility_PRIVATE, }, }) require.NoError(t, err) require.NotNil(t, memo) // Unauthenticated user tries to modify attachments - should fail - _, err = ts.Service.SetMemoAttachments(ctx, &apiv1.SetMemoAttachmentsRequest{ + _, err = ts.Service.SetMemoAttachments(ctx, &apipb.SetMemoAttachmentsRequest{ Name: memo.Name, - Attachments: []*apiv1.Attachment{}, + Attachments: []*apipb.Attachment{}, }) require.Error(t, err) require.Contains(t, err.Error(), "not authenticated") @@ -160,9 +160,9 @@ func TestSetMemoAttachments(t *testing.T) { userCtx := ts.CreateUserContext(ctx, user.ID) // Try to set attachments on non-existent memo - should fail - _, err = ts.Service.SetMemoAttachments(userCtx, &apiv1.SetMemoAttachmentsRequest{ + _, err = ts.Service.SetMemoAttachments(userCtx, &apipb.SetMemoAttachmentsRequest{ Name: "memos/nonexistent-uid-12345", - Attachments: []*apiv1.Attachment{}, + Attachments: []*apipb.Attachment{}, }) require.Error(t, err) require.Contains(t, err.Error(), "not found") @@ -176,38 +176,38 @@ func TestSetMemoAttachments(t *testing.T) { require.NoError(t, err) userCtx := ts.CreateUserContext(ctx, user.ID) - still, err := ts.Service.CreateAttachment(userCtx, &apiv1.CreateAttachmentRequest{ - Attachment: &apiv1.Attachment{ + still, err := ts.Service.CreateAttachment(userCtx, &apipb.CreateAttachmentRequest{ + Attachment: &apipb.Attachment{ Filename: "live.heic", Type: "image/heic", Content: []byte("still"), - MotionMedia: &apiv1.MotionMedia{ - Family: apiv1.MotionMediaFamily_APPLE_LIVE_PHOTO, - Role: apiv1.MotionMediaRole_STILL, + MotionMedia: &apipb.MotionMedia{ + Family: apipb.MotionMediaFamily_APPLE_LIVE_PHOTO, + Role: apipb.MotionMediaRole_STILL, GroupId: "memo-live-group", }, }, }) require.NoError(t, err) - video, err := ts.Service.CreateAttachment(userCtx, &apiv1.CreateAttachmentRequest{ - Attachment: &apiv1.Attachment{ + video, err := ts.Service.CreateAttachment(userCtx, &apipb.CreateAttachmentRequest{ + Attachment: &apipb.Attachment{ Filename: "live.mov", Type: "video/quicktime", Content: []byte("video"), - MotionMedia: &apiv1.MotionMedia{ - Family: apiv1.MotionMediaFamily_APPLE_LIVE_PHOTO, - Role: apiv1.MotionMediaRole_VIDEO, + MotionMedia: &apipb.MotionMedia{ + Family: apipb.MotionMediaFamily_APPLE_LIVE_PHOTO, + Role: apipb.MotionMediaRole_VIDEO, GroupId: "memo-live-group", }, }, }) require.NoError(t, err) - memo, err := ts.Service.CreateMemo(userCtx, &apiv1.CreateMemoRequest{ - Memo: &apiv1.Memo{ + memo, err := ts.Service.CreateMemo(userCtx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{ Content: "memo with live photo", - Visibility: apiv1.Visibility_PRIVATE, - Attachments: []*apiv1.Attachment{ + Visibility: apipb.Visibility_PRIVATE, + Attachments: []*apipb.Attachment{ {Name: still.Name}, {Name: video.Name}, }, @@ -215,15 +215,15 @@ func TestSetMemoAttachments(t *testing.T) { }) require.NoError(t, err) - _, err = ts.Service.SetMemoAttachments(userCtx, &apiv1.SetMemoAttachmentsRequest{ + _, err = ts.Service.SetMemoAttachments(userCtx, &apipb.SetMemoAttachmentsRequest{ Name: memo.Name, - Attachments: []*apiv1.Attachment{ + Attachments: []*apipb.Attachment{ {Name: still.Name}, }, }) require.NoError(t, err) - response, err := ts.Service.ListMemoAttachments(userCtx, &apiv1.ListMemoAttachmentsRequest{Name: memo.Name}) + response, err := ts.Service.ListMemoAttachments(userCtx, &apipb.ListMemoAttachmentsRequest{Parent: memo.Name}) require.NoError(t, err) require.Len(t, response.Attachments, 0) for _, attachmentName := range []string{still.Name, video.Name} { @@ -241,33 +241,33 @@ func TestSetMemoAttachments(t *testing.T) { user, err := ts.CreateRegularUser(ctx, "partial_motion_group_user") require.NoError(t, err) userCtx := ts.CreateUserContext(ctx, user.ID) - still, err := ts.Service.CreateAttachment(userCtx, &apiv1.CreateAttachmentRequest{Attachment: &apiv1.Attachment{ + still, err := ts.Service.CreateAttachment(userCtx, &apipb.CreateAttachmentRequest{Attachment: &apipb.Attachment{ Filename: "partial.heic", Type: "image/heic", Content: []byte("still"), - MotionMedia: &apiv1.MotionMedia{ - Family: apiv1.MotionMediaFamily_APPLE_LIVE_PHOTO, - Role: apiv1.MotionMediaRole_STILL, + MotionMedia: &apipb.MotionMedia{ + Family: apipb.MotionMediaFamily_APPLE_LIVE_PHOTO, + Role: apipb.MotionMediaRole_STILL, GroupId: "partial-motion-group", }, }}) require.NoError(t, err) - video, err := ts.Service.CreateAttachment(userCtx, &apiv1.CreateAttachmentRequest{Attachment: &apiv1.Attachment{ + video, err := ts.Service.CreateAttachment(userCtx, &apipb.CreateAttachmentRequest{Attachment: &apipb.Attachment{ Filename: "partial.mov", Type: "video/quicktime", Content: []byte("video"), - MotionMedia: &apiv1.MotionMedia{ - Family: apiv1.MotionMediaFamily_APPLE_LIVE_PHOTO, - Role: apiv1.MotionMediaRole_VIDEO, + MotionMedia: &apipb.MotionMedia{ + Family: apipb.MotionMediaFamily_APPLE_LIVE_PHOTO, + Role: apipb.MotionMediaRole_VIDEO, GroupId: "partial-motion-group", }, }}) require.NoError(t, err) - memo, err := ts.Service.CreateMemo(userCtx, &apiv1.CreateMemoRequest{Memo: &apiv1.Memo{ + memo, err := ts.Service.CreateMemo(userCtx, &apipb.CreateMemoRequest{Memo: &apipb.Memo{ Content: "memo with one motion-group member", - Visibility: apiv1.Visibility_PRIVATE, - Attachments: []*apiv1.Attachment{{Name: still.Name}}, + Visibility: apipb.Visibility_PRIVATE, + Attachments: []*apipb.Attachment{{Name: still.Name}}, }}) require.NoError(t, err) memoUID := strings.TrimPrefix(memo.Name, "memos/") @@ -277,7 +277,7 @@ func TestSetMemoAttachments(t *testing.T) { initialUpdatedTs := int64(1) require.NoError(t, ts.Store.UpdateMemo(ctx, &store.UpdateMemo{ID: storedMemo.ID, UpdatedTs: &initialUpdatedTs})) - _, err = ts.Service.SetMemoAttachments(userCtx, &apiv1.SetMemoAttachmentsRequest{Name: memo.Name}) + _, err = ts.Service.SetMemoAttachments(userCtx, &apipb.SetMemoAttachmentsRequest{Name: memo.Name}) require.Equal(t, codes.FailedPrecondition, status.Code(err)) stillUID := strings.TrimPrefix(still.Name, "attachments/") @@ -307,8 +307,8 @@ func TestSetMemoAttachments(t *testing.T) { victimCtx := ts.CreateUserContext(ctx, victim.ID) attackerCtx := ts.CreateUserContext(ctx, attacker.ID) - victimAttachment, err := ts.Service.CreateAttachment(victimCtx, &apiv1.CreateAttachmentRequest{ - Attachment: &apiv1.Attachment{ + victimAttachment, err := ts.Service.CreateAttachment(victimCtx, &apipb.CreateAttachmentRequest{ + Attachment: &apipb.Attachment{ Filename: "secret.txt", Size: 6, Type: "text/plain", @@ -317,40 +317,40 @@ func TestSetMemoAttachments(t *testing.T) { }) require.NoError(t, err) - victimMemo, err := ts.Service.CreateMemo(victimCtx, &apiv1.CreateMemoRequest{ - Memo: &apiv1.Memo{ + victimMemo, err := ts.Service.CreateMemo(victimCtx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{ Content: "victim protected memo", - Visibility: apiv1.Visibility_PROTECTED, - Attachments: []*apiv1.Attachment{ + Visibility: apipb.Visibility_PROTECTED, + Attachments: []*apipb.Attachment{ {Name: victimAttachment.Name}, }, }, }) require.NoError(t, err) - attackerMemo, err := ts.Service.CreateMemo(attackerCtx, &apiv1.CreateMemoRequest{ - Memo: &apiv1.Memo{ + attackerMemo, err := ts.Service.CreateMemo(attackerCtx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{ Content: "attacker public memo", - Visibility: apiv1.Visibility_PUBLIC, + Visibility: apipb.Visibility_PUBLIC, }, }) require.NoError(t, err) - _, err = ts.Service.SetMemoAttachments(attackerCtx, &apiv1.SetMemoAttachmentsRequest{ + _, err = ts.Service.SetMemoAttachments(attackerCtx, &apipb.SetMemoAttachmentsRequest{ Name: attackerMemo.Name, - Attachments: []*apiv1.Attachment{ + Attachments: []*apipb.Attachment{ {Name: victimAttachment.Name}, }, }) require.Error(t, err) require.Equal(t, codes.NotFound, status.Code(err)) - victimAttachments, err := ts.Service.ListMemoAttachments(victimCtx, &apiv1.ListMemoAttachmentsRequest{Name: victimMemo.Name}) + victimAttachments, err := ts.Service.ListMemoAttachments(victimCtx, &apipb.ListMemoAttachmentsRequest{Parent: victimMemo.Name}) require.NoError(t, err) require.Len(t, victimAttachments.Attachments, 1) require.Equal(t, victimAttachment.Name, victimAttachments.Attachments[0].Name) - attackerAttachments, err := ts.Service.ListMemoAttachments(attackerCtx, &apiv1.ListMemoAttachmentsRequest{Name: attackerMemo.Name}) + attackerAttachments, err := ts.Service.ListMemoAttachments(attackerCtx, &apipb.ListMemoAttachmentsRequest{Parent: attackerMemo.Name}) require.NoError(t, err) require.Empty(t, attackerAttachments.Attachments) }) @@ -366,8 +366,8 @@ func TestSetMemoAttachments(t *testing.T) { victimCtx := ts.CreateUserContext(ctx, victim.ID) attackerCtx := ts.CreateUserContext(ctx, attacker.ID) - victimAttachment, err := ts.Service.CreateAttachment(victimCtx, &apiv1.CreateAttachmentRequest{ - Attachment: &apiv1.Attachment{ + victimAttachment, err := ts.Service.CreateAttachment(victimCtx, &apipb.CreateAttachmentRequest{ + Attachment: &apipb.Attachment{ Filename: "kept.txt", Size: 4, Type: "text/plain", @@ -376,10 +376,10 @@ func TestSetMemoAttachments(t *testing.T) { }) require.NoError(t, err) - attackerMemo, err := ts.Service.CreateMemo(attackerCtx, &apiv1.CreateMemoRequest{ - Memo: &apiv1.Memo{ + attackerMemo, err := ts.Service.CreateMemo(attackerCtx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{ Content: "contaminated memo", - Visibility: apiv1.Visibility_PUBLIC, + Visibility: apipb.Visibility_PUBLIC, }, }) require.NoError(t, err) @@ -400,9 +400,9 @@ func TestSetMemoAttachments(t *testing.T) { }) require.NoError(t, err) - _, err = ts.Service.SetMemoAttachments(attackerCtx, &apiv1.SetMemoAttachmentsRequest{ + _, err = ts.Service.SetMemoAttachments(attackerCtx, &apipb.SetMemoAttachmentsRequest{ Name: attackerMemo.Name, - Attachments: []*apiv1.Attachment{}, + Attachments: []*apipb.Attachment{}, }) require.Error(t, err) require.Contains(t, err.Error(), "cannot remove another user's attachment") diff --git a/server/api/v1/test/memo_export_test.go b/server/api/test/memo_export_test.go similarity index 80% rename from server/api/v1/test/memo_export_test.go rename to server/api/test/memo_export_test.go index 350270323..65f4b19c7 100644 --- a/server/api/v1/test/memo_export_test.go +++ b/server/api/test/memo_export_test.go @@ -19,9 +19,9 @@ import ( "github.com/usememos/memos/core/memoexport" "github.com/usememos/memos/internal/ratelimit" - v1pb "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" storepb "github.com/usememos/memos/proto/gen/store" - apiv1 "github.com/usememos/memos/server/api/v1" + "github.com/usememos/memos/server/api" "github.com/usememos/memos/store" ) @@ -30,8 +30,8 @@ type archiveFixture struct { user *store.User userCtx context.Context photo []byte - parent *v1pb.Memo - archived *v1pb.Memo + parent *apipb.Memo + archived *apipb.Memo allMemoUIDs []string } @@ -45,69 +45,69 @@ func buildArchiveFixture(t *testing.T, ts *TestService, username string) *archiv require.NoError(t, err) photo := []byte{0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A, 1, 2, 3, 4} - attachment, err := ts.Service.CreateAttachment(userCtx, &v1pb.CreateAttachmentRequest{ + attachment, err := ts.Service.CreateAttachment(userCtx, &apipb.CreateAttachmentRequest{ AttachmentId: "photo0001", - Attachment: &v1pb.Attachment{Filename: "white board.png", Type: "image/png", Content: photo}, + Attachment: &apipb.Attachment{Filename: "white board.png", Type: "image/png", Content: photo}, }) require.NoError(t, err) - referenced, err := ts.Service.CreateMemo(userCtx, &v1pb.CreateMemoRequest{ + referenced, err := ts.Service.CreateMemo(userCtx, &apipb.CreateMemoRequest{ MemoId: "referenced1", - Memo: &v1pb.Memo{ + Memo: &apipb.Memo{ Content: "Referenced memo #work", - Visibility: v1pb.Visibility_PUBLIC, + Visibility: apipb.Visibility_PUBLIC, CreateTime: timestamppb.New(mustTime(t, "2026-03-01T09:00:00Z")), UpdateTime: timestamppb.New(mustTime(t, "2026-03-01T09:30:00Z")), }, }) require.NoError(t, err) - parent, err := ts.Service.CreateMemo(userCtx, &v1pb.CreateMemoRequest{ + parent, err := ts.Service.CreateMemo(userCtx, &apipb.CreateMemoRequest{ MemoId: "parent00001", - Memo: &v1pb.Memo{ + Memo: &apipb.Memo{ Content: "# Whiteboard\n\nSee the photo. No trailing newline", - Visibility: v1pb.Visibility_PRIVATE, + Visibility: apipb.Visibility_PRIVATE, Pinned: true, CreateTime: timestamppb.New(mustTime(t, "2026-03-02T14:05:11Z")), UpdateTime: timestamppb.New(mustTime(t, "2026-03-02T14:20:47Z")), - Location: &v1pb.Location{Placeholder: "Office", Latitude: 52.52, Longitude: 13.405}, - Attachments: []*v1pb.Attachment{{Name: attachment.Name}}, - Relations: []*v1pb.MemoRelation{{Type: v1pb.MemoRelation_REFERENCE, RelatedMemo: &v1pb.MemoRelation_Memo{Name: referenced.Name}}}, + Location: &apipb.Location{Placeholder: "Office", Latitude: 52.52, Longitude: 13.405}, + Attachments: []*apipb.Attachment{{Name: attachment.Name}}, + Relations: []*apipb.MemoRelation{{Type: apipb.MemoRelation_REFERENCE, RelatedMemo: &apipb.MemoRelation_MemoRef{Name: referenced.Name}}}, }, }) require.NoError(t, err) // Creation ignores pinned; pin the memo the way the client does. - parent, err = ts.Service.UpdateMemo(userCtx, &v1pb.UpdateMemoRequest{ - Memo: &v1pb.Memo{Name: parent.Name, Pinned: true, UpdateTime: timestamppb.New(mustTime(t, "2026-03-02T14:20:47Z"))}, + parent, err = ts.Service.UpdateMemo(userCtx, &apipb.UpdateMemoRequest{ + Memo: &apipb.Memo{Name: parent.Name, Pinned: true, UpdateTime: timestamppb.New(mustTime(t, "2026-03-02T14:20:47Z"))}, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"pinned", "update_time"}}, }) require.NoError(t, err) - _, err = ts.Service.CreateMemoComment(userCtx, &v1pb.CreateMemoCommentRequest{ - Name: parent.Name, + _, err = ts.Service.CreateMemoComment(userCtx, &apipb.CreateMemoCommentRequest{ + Parent: parent.Name, CommentId: "comment0001", - Comment: &v1pb.Memo{ + Comment: &apipb.Memo{ Content: "A comment", - Visibility: v1pb.Visibility_PRIVATE, + Visibility: apipb.Visibility_PRIVATE, CreateTime: timestamppb.New(mustTime(t, "2026-02-28T08:00:00Z")), }, }) require.NoError(t, err) spaceName := "spaces/" + space.UID - _, err = ts.Service.CreateMemo(userCtx, &v1pb.CreateMemoRequest{ + _, err = ts.Service.CreateMemo(userCtx, &apipb.CreateMemoRequest{ MemoId: "spacememo01", - Memo: &v1pb.Memo{Content: "Shared with the team", Visibility: v1pb.Visibility_SPACE, Space: &spaceName}, + Memo: &apipb.Memo{Content: "Shared with the team", Visibility: apipb.Visibility_SPACE, Space: &spaceName}, }) require.NoError(t, err) - archived, err := ts.Service.CreateMemo(userCtx, &v1pb.CreateMemoRequest{ + archived, err := ts.Service.CreateMemo(userCtx, &apipb.CreateMemoRequest{ MemoId: "archived001", - Memo: &v1pb.Memo{Content: "Old note", Visibility: v1pb.Visibility_PROTECTED}, + Memo: &apipb.Memo{Content: "Old note", Visibility: apipb.Visibility_PROTECTED}, }) require.NoError(t, err) - archived, err = ts.Service.UpdateMemo(userCtx, &v1pb.UpdateMemoRequest{ - Memo: &v1pb.Memo{Name: archived.Name, State: v1pb.State_ARCHIVED}, + archived, err = ts.Service.UpdateMemo(userCtx, &apipb.UpdateMemoRequest{ + Memo: &apipb.Memo{Name: archived.Name, State: apipb.State_ARCHIVED}, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"state"}}, }) require.NoError(t, err) @@ -160,8 +160,8 @@ func TestWriteMemoExport(t *testing.T) { // Another user's memo must never appear, even when it comments on ours. other, err := ts.CreateRegularUser(context.Background(), "someone-else") require.NoError(t, err) - _, err = ts.Service.CreateMemo(ts.CreateUserContext(context.Background(), other.ID), &v1pb.CreateMemoRequest{ - Memo: &v1pb.Memo{Content: "not yours", Visibility: v1pb.Visibility_PUBLIC}, + _, err = ts.Service.CreateMemo(ts.CreateUserContext(context.Background(), other.ID), &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{Content: "not yours", Visibility: apipb.Visibility_PUBLIC}, }) require.NoError(t, err) @@ -236,7 +236,7 @@ func TestImportMemoExportIntoAnotherAccount(t *testing.T) { require.NoError(t, err) importerCtx := ts.CreateUserContext(ctx, importer.ID) - report, err := ts.Service.ImportMemoExport(importerCtx, importer, archive, v1pb.ImportMemosRequest_SKIP) + report, err := ts.Service.ImportMemoExport(importerCtx, importer, archive, apipb.ImportMemosRequest_SKIP) require.NoError(t, err) require.Equal(t, int32(5), report.Created) require.Zero(t, report.Updated) @@ -315,21 +315,21 @@ func TestPlanMemoImport(t *testing.T) { ctx := context.Background() // Delete one memo so its UID is free, and let another account take one. - _, err := ts.Service.DeleteMemo(fixture.userCtx, &v1pb.DeleteMemoRequest{Name: fixture.archived.Name}) + _, err := ts.Service.DeleteMemo(fixture.userCtx, &apipb.DeleteMemoRequest{Name: fixture.archived.Name}) require.NoError(t, err) other, err := ts.CreateRegularUser(ctx, "other") require.NoError(t, err) otherCtx := ts.CreateUserContext(ctx, other.ID) stranger, err := ts.CreateRegularUser(ctx, "stranger") require.NoError(t, err) - _, err = ts.Service.CreateMemo(ts.CreateUserContext(ctx, stranger.ID), &v1pb.CreateMemoRequest{ - MemoId: "archived001", Memo: &v1pb.Memo{Content: "took the uid", Visibility: v1pb.Visibility_PRIVATE}, + _, err = ts.Service.CreateMemo(ts.CreateUserContext(ctx, stranger.ID), &apipb.CreateMemoRequest{ + MemoId: "archived001", Memo: &apipb.Memo{Content: "took the uid", Visibility: apipb.Visibility_PRIVATE}, }) require.NoError(t, err) plan, err := ts.Service.PlanMemoImport(fixture.userCtx, fixture.user, archive) require.NoError(t, err) - require.Equal(t, int32(5), plan.Memos) + require.Equal(t, int32(5), plan.MemoCount) require.Equal(t, int32(4), plan.Existing) require.Equal(t, int32(1), plan.Renamed) require.Zero(t, plan.New) @@ -355,7 +355,7 @@ func TestImportMemoExportConflictPolicies(t *testing.T) { } t.Run("skip is idempotent", func(t *testing.T) { - report, err := ts.Service.ImportMemoExport(fixture.userCtx, fixture.user, openArchive(), v1pb.ImportMemosRequest_SKIP) + report, err := ts.Service.ImportMemoExport(fixture.userCtx, fixture.user, openArchive(), apipb.ImportMemosRequest_SKIP) require.NoError(t, err) require.Equal(t, int32(5), report.Skipped) require.Zero(t, report.Created+report.Updated+report.Failed) @@ -364,13 +364,13 @@ func TestImportMemoExportConflictPolicies(t *testing.T) { t.Run("replace updates in place", func(t *testing.T) { // Change the memo on the instance, then bring the archive back. - _, err := ts.Service.UpdateMemo(fixture.userCtx, &v1pb.UpdateMemoRequest{ - Memo: &v1pb.Memo{Name: fixture.parent.Name, Content: "edited after export", Pinned: false}, + _, err := ts.Service.UpdateMemo(fixture.userCtx, &apipb.UpdateMemoRequest{ + Memo: &apipb.Memo{Name: fixture.parent.Name, Content: "edited after export", Pinned: false}, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"content", "pinned"}}, }) require.NoError(t, err) - report, err := ts.Service.ImportMemoExport(fixture.userCtx, fixture.user, openArchive(), v1pb.ImportMemosRequest_REPLACE) + report, err := ts.Service.ImportMemoExport(fixture.userCtx, fixture.user, openArchive(), apipb.ImportMemosRequest_REPLACE) require.NoError(t, err) require.Equal(t, int32(5), report.Updated, "%v", report.Failures) require.Zero(t, report.Failed) @@ -389,7 +389,7 @@ func TestImportMemoExportConflictPolicies(t *testing.T) { }) t.Run("duplicate creates copies", func(t *testing.T) { - report, err := ts.Service.ImportMemoExport(fixture.userCtx, fixture.user, openArchive(), v1pb.ImportMemosRequest_DUPLICATE) + report, err := ts.Service.ImportMemoExport(fixture.userCtx, fixture.user, openArchive(), apipb.ImportMemosRequest_DUPLICATE) require.NoError(t, err) require.Equal(t, int32(5), report.Created, "%v", report.Failures) require.Zero(t, report.Failed) @@ -410,7 +410,7 @@ func TestImportMemoExportConflictPolicies(t *testing.T) { } func userName(user *store.User) string { - return apiv1.BuildUserName(user.Username) + return api.BuildUserName(user.Username) } func TestExportMemos(t *testing.T) { @@ -419,7 +419,7 @@ func TestExportMemos(t *testing.T) { fixture := buildArchiveFixture(t, ts, "owner") ctx := context.Background() - body, err := ts.Service.ExportMemos(fixture.userCtx, &v1pb.ExportMemosRequest{Name: userName(fixture.user)}) + body, err := ts.Service.ExportMemos(fixture.userCtx, &apipb.ExportMemosRequest{Name: userName(fixture.user)}) require.NoError(t, err) require.Equal(t, "application/vnd.usememos.export+zip", body.ContentType) exported := readArchive(t, body.Data) @@ -428,9 +428,9 @@ func TestExportMemos(t *testing.T) { other, err := ts.CreateRegularUser(ctx, "other") require.NoError(t, err) - _, err = ts.Service.ExportMemos(ts.CreateUserContext(ctx, other.ID), &v1pb.ExportMemosRequest{Name: userName(fixture.user)}) + _, err = ts.Service.ExportMemos(ts.CreateUserContext(ctx, other.ID), &apipb.ExportMemosRequest{Name: userName(fixture.user)}) require.Equal(t, codes.PermissionDenied, status.Code(err)) - _, err = ts.Service.ExportMemos(ctx, &v1pb.ExportMemosRequest{Name: userName(fixture.user)}) + _, err = ts.Service.ExportMemos(ctx, &apipb.ExportMemosRequest{Name: userName(fixture.user)}) require.Equal(t, codes.Unauthenticated, status.Code(err)) } @@ -443,11 +443,11 @@ func TestImportMemosExportFormats(t *testing.T) { user, err := ts.CreateRegularUser(context.Background(), "importer") require.NoError(t, err) ctx := ts.CreateUserContext(context.Background(), user.ID) - data, err := os.ReadFile(filepath.Join("..", "..", "..", "..", "core", "memoexport", "testdata", "1.0", filename)) + data, err := os.ReadFile(filepath.Join("..", "..", "..", "core", "memoexport", "testdata", "1.0", filename)) require.NoError(t, err) - response, err := ts.Service.ImportMemos(ctx, &v1pb.ImportMemosRequest{ + response, err := ts.Service.ImportMemos(ctx, &apipb.ImportMemosRequest{ Name: userName(user), - Upload: &v1pb.ImportMemosRequest_Spec{Spec: &v1pb.ImportMemosSpec{TotalSize: int64(len(data))}}, + Upload: &apipb.ImportMemosRequest_Spec{Spec: &apipb.ImportMemosSpec{TotalSize: int64(len(data))}}, Data: data, FinishWrite: true, }) @@ -477,14 +477,14 @@ func TestImportMemos(t *testing.T) { fixture := buildArchiveFixture(t, ts, "owner") exported := exportArchiveBytes(t, ts, fixture.user) name := userName(fixture.user) - importMemos := func(ctx context.Context, request *v1pb.ImportMemosRequest) (*v1pb.ImportMemosResponse, error) { + importMemos := func(ctx context.Context, request *apipb.ImportMemosRequest) (*apipb.ImportMemosResponse, error) { request.Name = name return ts.Service.ImportMemos(ctx, request) } t.Run("one call stages, plans, then imports on a second finish", func(t *testing.T) { - response, err := importMemos(fixture.userCtx, &v1pb.ImportMemosRequest{ - Upload: &v1pb.ImportMemosRequest_Spec{Spec: &v1pb.ImportMemosSpec{TotalSize: int64(len(exported))}}, + response, err := importMemos(fixture.userCtx, &apipb.ImportMemosRequest{ + Upload: &apipb.ImportMemosRequest_Spec{Spec: &apipb.ImportMemosSpec{TotalSize: int64(len(exported))}}, Data: exported, FinishWrite: true, ValidateOnly: true, @@ -495,16 +495,16 @@ func TestImportMemos(t *testing.T) { plan := response.GetPlan() require.NotNil(t, plan, "a validate-only finish returns the plan") require.Equal(t, "owner", plan.Exporter) - require.Equal(t, int32(5), plan.Memos) - require.Equal(t, int32(1), plan.Attachments) + require.Equal(t, int32(5), plan.MemoCount) + require.Equal(t, int32(1), plan.AttachmentCount) require.Equal(t, int32(5), plan.Existing) require.NotNil(t, plan.ExportTime) - response, err = importMemos(fixture.userCtx, &v1pb.ImportMemosRequest{ - Upload: &v1pb.ImportMemosRequest_UploadId{UploadId: response.UploadId}, + response, err = importMemos(fixture.userCtx, &apipb.ImportMemosRequest{ + Upload: &apipb.ImportMemosRequest_UploadId{UploadId: response.UploadId}, WriteOffset: int64(len(exported)), FinishWrite: true, - ConflictPolicy: v1pb.ImportMemosRequest_SKIP, + ConflictPolicy: apipb.ImportMemosRequest_SKIP, }) require.NoError(t, err) report := response.GetReport() @@ -512,8 +512,8 @@ func TestImportMemos(t *testing.T) { require.Equal(t, int32(5), report.Skipped) // A later call for an imported upload returns the same report. - again, err := importMemos(fixture.userCtx, &v1pb.ImportMemosRequest{ - Upload: &v1pb.ImportMemosRequest_UploadId{UploadId: response.UploadId}, + again, err := importMemos(fixture.userCtx, &apipb.ImportMemosRequest{ + Upload: &apipb.ImportMemosRequest_UploadId{UploadId: response.UploadId}, WriteOffset: int64(len(exported)), FinishWrite: true, }) @@ -526,17 +526,17 @@ func TestImportMemos(t *testing.T) { require.NoError(t, err) importerCtx := ts.CreateUserContext(context.Background(), importer.ID) half := len(exported) / 2 - first, err := ts.Service.ImportMemos(importerCtx, &v1pb.ImportMemosRequest{ + first, err := ts.Service.ImportMemos(importerCtx, &apipb.ImportMemosRequest{ Name: userName(importer), - Upload: &v1pb.ImportMemosRequest_Spec{Spec: &v1pb.ImportMemosSpec{TotalSize: int64(len(exported))}}, + Upload: &apipb.ImportMemosRequest_Spec{Spec: &apipb.ImportMemosSpec{TotalSize: int64(len(exported))}}, Data: exported[:half], }) require.NoError(t, err) require.Nil(t, first.Result) require.Equal(t, int64(half), first.CommittedSize) - second, err := ts.Service.ImportMemos(importerCtx, &v1pb.ImportMemosRequest{ + second, err := ts.Service.ImportMemos(importerCtx, &apipb.ImportMemosRequest{ Name: userName(importer), - Upload: &v1pb.ImportMemosRequest_UploadId{UploadId: first.UploadId}, + Upload: &apipb.ImportMemosRequest_UploadId{UploadId: first.UploadId}, WriteOffset: int64(half), Data: exported[half:], FinishWrite: true, @@ -547,8 +547,8 @@ func TestImportMemos(t *testing.T) { t.Run("rejects a file that is not an archive", func(t *testing.T) { garbage := []byte("not a zip") - _, err := importMemos(fixture.userCtx, &v1pb.ImportMemosRequest{ - Upload: &v1pb.ImportMemosRequest_Spec{Spec: &v1pb.ImportMemosSpec{TotalSize: int64(len(garbage))}}, + _, err := importMemos(fixture.userCtx, &apipb.ImportMemosRequest{ + Upload: &apipb.ImportMemosRequest_Spec{Spec: &apipb.ImportMemosSpec{TotalSize: int64(len(garbage))}}, Data: garbage, FinishWrite: true, }) @@ -557,15 +557,15 @@ func TestImportMemos(t *testing.T) { }) t.Run("refuses another account's upload id", func(t *testing.T) { - response, err := importMemos(fixture.userCtx, &v1pb.ImportMemosRequest{ - Upload: &v1pb.ImportMemosRequest_Spec{Spec: &v1pb.ImportMemosSpec{TotalSize: int64(len(exported))}}, + response, err := importMemos(fixture.userCtx, &apipb.ImportMemosRequest{ + Upload: &apipb.ImportMemosRequest_Spec{Spec: &apipb.ImportMemosSpec{TotalSize: int64(len(exported))}}, }) require.NoError(t, err) other, err := ts.CreateRegularUser(context.Background(), "intruder") require.NoError(t, err) - _, err = ts.Service.ImportMemos(ts.CreateUserContext(context.Background(), other.ID), &v1pb.ImportMemosRequest{ + _, err = ts.Service.ImportMemos(ts.CreateUserContext(context.Background(), other.ID), &apipb.ImportMemosRequest{ Name: userName(other), - Upload: &v1pb.ImportMemosRequest_UploadId{UploadId: response.UploadId}, + Upload: &apipb.ImportMemosRequest_UploadId{UploadId: response.UploadId}, }) require.Equal(t, codes.NotFound, status.Code(err)) }) @@ -621,9 +621,9 @@ func TestImportMemosFailureKeepsPreexistingAttachment(t *testing.T) { userCtx := ts.CreateUserContext(ctx, user.ID) existingContent := []byte("bytes the user already uploaded") - existing, err := ts.Service.CreateAttachment(userCtx, &v1pb.CreateAttachmentRequest{ + existing, err := ts.Service.CreateAttachment(userCtx, &apipb.CreateAttachmentRequest{ AttachmentId: "keepme0001", - Attachment: &v1pb.Attachment{Filename: "keep.bin", Type: "application/octet-stream", Content: existingContent}, + Attachment: &apipb.Attachment{Filename: "keep.bin", Type: "application/octet-stream", Content: existingContent}, }) require.NoError(t, err) @@ -634,9 +634,9 @@ func TestImportMemosFailureKeepsPreexistingAttachment(t *testing.T) { {"keepme0001", "keep.bin", existingContent}, {"toolarge01", "big.bin", bytes.Repeat([]byte("x"), 2<<20)}, }) - response, err := ts.Service.ImportMemos(userCtx, &v1pb.ImportMemosRequest{ + response, err := ts.Service.ImportMemos(userCtx, &apipb.ImportMemosRequest{ Name: userName(user), - Upload: &v1pb.ImportMemosRequest_Spec{Spec: &v1pb.ImportMemosSpec{TotalSize: int64(len(archive))}}, + Upload: &apipb.ImportMemosRequest_Spec{Spec: &apipb.ImportMemosSpec{TotalSize: int64(len(archive))}}, Data: archive, FinishWrite: true, }) @@ -646,7 +646,7 @@ func TestImportMemosFailureKeepsPreexistingAttachment(t *testing.T) { require.Equal(t, int32(1), report.Failed) require.Zero(t, report.Created) - kept, err := ts.Service.GetAttachment(userCtx, &v1pb.GetAttachmentRequest{Name: existing.Name}) + kept, err := ts.Service.GetAttachment(userCtx, &apipb.GetAttachmentRequest{Name: existing.Name}) require.NoError(t, err, "the pre-existing attachment survives the failed import") require.Equal(t, existing.Name, kept.Name) } @@ -671,9 +671,9 @@ func TestImportMemosChargesWriteAndUploadBudgets(t *testing.T) { uid, filename string content []byte }{{"newfile001", "new.bin", []byte("fresh bytes")}}) - response, err := ts.Service.ImportMemos(userCtx, &v1pb.ImportMemosRequest{ + response, err := ts.Service.ImportMemos(userCtx, &apipb.ImportMemosRequest{ Name: userName(user), - Upload: &v1pb.ImportMemosRequest_Spec{Spec: &v1pb.ImportMemosSpec{TotalSize: int64(len(archive))}}, + Upload: &apipb.ImportMemosRequest_Spec{Spec: &apipb.ImportMemosSpec{TotalSize: int64(len(archive))}}, Data: archive, FinishWrite: true, }) diff --git a/server/api/v1/test/memo_move_test.go b/server/api/test/memo_move_test.go similarity index 67% rename from server/api/v1/test/memo_move_test.go rename to server/api/test/memo_move_test.go index 1349b65a0..aafa59826 100644 --- a/server/api/v1/test/memo_move_test.go +++ b/server/api/test/memo_move_test.go @@ -9,7 +9,7 @@ import ( "google.golang.org/grpc/status" "google.golang.org/protobuf/types/known/fieldmaskpb" - apiv1 "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" "github.com/usememos/memos/store" ) @@ -38,31 +38,31 @@ func TestMoveMemoPreservesIndependentConversation(t *testing.T) { require.NoError(t, err) } sourceName, targetName := "spaces/"+source.UID, "spaces/"+target.UID - reference, err := ts.Service.CreateMemo(authorCtx, &apiv1.CreateMemoRequest{Memo: &apiv1.Memo{ - Content: "source reference", Space: &sourceName, Visibility: apiv1.Visibility_SPACE, + reference, err := ts.Service.CreateMemo(authorCtx, &apipb.CreateMemoRequest{Memo: &apipb.Memo{ + Content: "source reference", Space: &sourceName, Visibility: apipb.Visibility_SPACE, }}) require.NoError(t, err) - attachment, err := ts.Service.CreateAttachment(authorCtx, &apiv1.CreateAttachmentRequest{ - Attachment: &apiv1.Attachment{Filename: "proposal.txt", Type: "text/plain", Content: []byte("proposal attachment")}, + attachment, err := ts.Service.CreateAttachment(authorCtx, &apipb.CreateAttachmentRequest{ + Attachment: &apipb.Attachment{Filename: "proposal.txt", Type: "text/plain", Content: []byte("proposal attachment")}, }) require.NoError(t, err) - original, err := ts.Service.CreateMemo(authorCtx, &apiv1.CreateMemoRequest{Memo: &apiv1.Memo{ - Content: "original memo", Space: &sourceName, Visibility: apiv1.Visibility_SPACE, - Attachments: []*apiv1.Attachment{attachment}, - Relations: []*apiv1.MemoRelation{{Type: apiv1.MemoRelation_REFERENCE, RelatedMemo: &apiv1.MemoRelation_Memo{Name: reference.Name}}}, + original, err := ts.Service.CreateMemo(authorCtx, &apipb.CreateMemoRequest{Memo: &apipb.Memo{ + Content: "original memo", Space: &sourceName, Visibility: apipb.Visibility_SPACE, + Attachments: []*apipb.Attachment{attachment}, + Relations: []*apipb.MemoRelation{{Type: apipb.MemoRelation_REFERENCE, RelatedMemo: &apipb.MemoRelation_MemoRef{Name: reference.Name}}}, }}) require.NoError(t, err) - comment, err := ts.Service.CreateMemoComment(commenterCtx, &apiv1.CreateMemoCommentRequest{ - Name: original.Name, Comment: &apiv1.Memo{Content: "source comment", Space: &sourceName, Visibility: apiv1.Visibility_SPACE}, + comment, err := ts.Service.CreateMemoComment(commenterCtx, &apipb.CreateMemoCommentRequest{ + Parent: original.Name, Comment: &apipb.Memo{Content: "source comment", Space: &sourceName, Visibility: apipb.Visibility_SPACE}, }) require.NoError(t, err) - reaction, err := ts.Service.UpsertMemoReaction(commenterCtx, &apiv1.UpsertMemoReactionRequest{ - Name: original.Name, Reaction: &apiv1.Reaction{ReactionType: "👍"}, + reaction, err := ts.Service.UpsertMemoReaction(commenterCtx, &apipb.UpsertMemoReactionRequest{ + Parent: original.Name, Reaction: &apipb.Reaction{ReactionType: "👍"}, }) require.NoError(t, err) - moved, err := ts.Service.UpdateMemo(authorCtx, &apiv1.UpdateMemoRequest{ - Memo: &apiv1.Memo{Name: original.Name, Space: &targetName, Visibility: apiv1.Visibility_SPACE}, + moved, err := ts.Service.UpdateMemo(authorCtx, &apipb.UpdateMemoRequest{ + Memo: &apipb.Memo{Name: original.Name, Space: &targetName, Visibility: apipb.Visibility_SPACE}, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"space", "visibility"}}, }) require.NoError(t, err) @@ -77,9 +77,9 @@ func TestMoveMemoPreservesIndependentConversation(t *testing.T) { require.Len(t, moved.Reactions, 1) require.Equal(t, reaction.Name, moved.Reactions[0].Name) - _, err = ts.Service.GetMemo(commenterCtx, &apiv1.GetMemoRequest{Name: original.Name}) + _, err = ts.Service.GetMemo(commenterCtx, &apipb.GetMemoRequest{Name: original.Name}) require.Equal(t, codes.PermissionDenied, status.Code(err)) - readableComment, err := ts.Service.GetMemo(commenterCtx, &apiv1.GetMemoRequest{Name: comment.Name}) + readableComment, err := ts.Service.GetMemo(commenterCtx, &apipb.GetMemoRequest{Name: comment.Name}) require.NoError(t, err) require.Equal(t, original.Name, readableComment.GetParent(), "parent identity survives lost parent access") require.Equal(t, sourceName, readableComment.GetSpace()) @@ -88,25 +88,25 @@ func TestMoveMemoPreservesIndependentConversation(t *testing.T) { require.Empty(t, readableComment.Relations, "the inaccessible parent must not appear in relation previews") for _, viewer := range []context.Context{authorCtx, readerCtx} { - comments, err := ts.Service.ListMemoComments(viewer, &apiv1.ListMemoCommentsRequest{Name: original.Name}) + comments, err := ts.Service.ListMemoComments(viewer, &apipb.ListMemoCommentsRequest{Parent: original.Name}) require.NoError(t, err) if viewer == authorCtx { - require.Len(t, comments.Memos, 1) + require.Len(t, comments.Comments, 1) } else { - require.Empty(t, comments.Memos) + require.Empty(t, comments.Comments) } } - destinationMemo, err := ts.Service.GetMemo(readerCtx, &apiv1.GetMemoRequest{Name: original.Name}) + destinationMemo, err := ts.Service.GetMemo(readerCtx, &apipb.GetMemoRequest{Name: original.Name}) require.NoError(t, err) require.Empty(t, destinationMemo.Relations) require.Len(t, destinationMemo.Reactions, 1, "existing reactions are visible to new readers") - _, err = ts.Service.GetMemo(readerCtx, &apiv1.GetMemoRequest{Name: comment.Name}) + _, err = ts.Service.GetMemo(readerCtx, &apipb.GetMemoRequest{Name: comment.Name}) require.Equal(t, codes.PermissionDenied, status.Code(err)) - _, err = ts.Service.DeleteMemoReaction(readerCtx, &apiv1.DeleteMemoReactionRequest{Name: reaction.Name}) + _, err = ts.Service.DeleteMemoReaction(readerCtx, &apipb.DeleteMemoReactionRequest{Name: reaction.Name}) require.Equal(t, codes.PermissionDenied, status.Code(err)) - _, err = ts.Service.DeleteMemoReaction(commenterCtx, &apiv1.DeleteMemoReactionRequest{Name: reaction.Name}) + _, err = ts.Service.DeleteMemoReaction(commenterCtx, &apipb.DeleteMemoReactionRequest{Name: reaction.Name}) require.NoError(t, err, "the creator can withdraw a reaction without parent access") - reactions, err := ts.Service.ListMemoReactions(readerCtx, &apiv1.ListMemoReactionsRequest{Name: original.Name}) + reactions, err := ts.Service.ListMemoReactions(readerCtx, &apipb.ListMemoReactionsRequest{Parent: original.Name}) require.NoError(t, err) require.Empty(t, reactions.Reactions) } diff --git a/server/api/v1/test/memo_relation_service_test.go b/server/api/test/memo_relation_service_test.go similarity index 63% rename from server/api/v1/test/memo_relation_service_test.go rename to server/api/test/memo_relation_service_test.go index 07ef14d7b..0b8764c39 100644 --- a/server/api/v1/test/memo_relation_service_test.go +++ b/server/api/test/memo_relation_service_test.go @@ -9,7 +9,7 @@ import ( "google.golang.org/grpc/status" "google.golang.org/protobuf/types/known/fieldmaskpb" - apiv1 "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" ) func TestSetMemoRelations(t *testing.T) { @@ -25,34 +25,34 @@ func TestSetMemoRelations(t *testing.T) { userCtx := ts.CreateUserContext(ctx, user.ID) // Create memo1 - memo1, err := ts.Service.CreateMemo(userCtx, &apiv1.CreateMemoRequest{ - Memo: &apiv1.Memo{ + memo1, err := ts.Service.CreateMemo(userCtx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{ Content: "Test memo 1", - Visibility: apiv1.Visibility_PRIVATE, + Visibility: apipb.Visibility_PRIVATE, }, }) require.NoError(t, err) require.NotNil(t, memo1) // Create memo2 - memo2, err := ts.Service.CreateMemo(userCtx, &apiv1.CreateMemoRequest{ - Memo: &apiv1.Memo{ + memo2, err := ts.Service.CreateMemo(userCtx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{ Content: "Test memo 2", - Visibility: apiv1.Visibility_PRIVATE, + Visibility: apipb.Visibility_PRIVATE, }, }) require.NoError(t, err) require.NotNil(t, memo2) // Set memo relations - should succeed - _, err = ts.Service.SetMemoRelations(userCtx, &apiv1.SetMemoRelationsRequest{ + _, err = ts.Service.SetMemoRelations(userCtx, &apipb.SetMemoRelationsRequest{ Name: memo1.Name, - Relations: []*apiv1.MemoRelation{ + Relations: []*apipb.MemoRelation{ { - RelatedMemo: &apiv1.MemoRelation_Memo{ + RelatedMemo: &apipb.MemoRelation_MemoRef{ Name: memo2.Name, }, - Type: apiv1.MemoRelation_REFERENCE, + Type: apipb.MemoRelation_REFERENCE, }, }, }) @@ -74,19 +74,19 @@ func TestSetMemoRelations(t *testing.T) { hostCtx := ts.CreateUserContext(ctx, hostUser.ID) // Create memo by regular user - memo, err := ts.Service.CreateMemo(regularUserCtx, &apiv1.CreateMemoRequest{ - Memo: &apiv1.Memo{ + memo, err := ts.Service.CreateMemo(regularUserCtx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{ Content: "Test memo", - Visibility: apiv1.Visibility_PRIVATE, + Visibility: apipb.Visibility_PRIVATE, }, }) require.NoError(t, err) require.NotNil(t, memo) // Application ADMIN is the superuser and manages any memo's relations. - _, err = ts.Service.SetMemoRelations(hostCtx, &apiv1.SetMemoRelationsRequest{ + _, err = ts.Service.SetMemoRelations(hostCtx, &apipb.SetMemoRelationsRequest{ Name: memo.Name, - Relations: []*apiv1.MemoRelation{}, + Relations: []*apipb.MemoRelation{}, }) require.NoError(t, err) }) @@ -106,19 +106,19 @@ func TestSetMemoRelations(t *testing.T) { user2Ctx := ts.CreateUserContext(ctx, user2.ID) // Create memo by user1 - memo, err := ts.Service.CreateMemo(user1Ctx, &apiv1.CreateMemoRequest{ - Memo: &apiv1.Memo{ + memo, err := ts.Service.CreateMemo(user1Ctx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{ Content: "Test memo", - Visibility: apiv1.Visibility_PRIVATE, + Visibility: apipb.Visibility_PRIVATE, }, }) require.NoError(t, err) require.NotNil(t, memo) // User2 tries to modify relations - should fail - _, err = ts.Service.SetMemoRelations(user2Ctx, &apiv1.SetMemoRelationsRequest{ + _, err = ts.Service.SetMemoRelations(user2Ctx, &apipb.SetMemoRelationsRequest{ Name: memo.Name, - Relations: []*apiv1.MemoRelation{}, + Relations: []*apipb.MemoRelation{}, }) require.Error(t, err) require.Contains(t, err.Error(), "permission denied") @@ -134,19 +134,19 @@ func TestSetMemoRelations(t *testing.T) { userCtx := ts.CreateUserContext(ctx, user.ID) // Create memo - memo, err := ts.Service.CreateMemo(userCtx, &apiv1.CreateMemoRequest{ - Memo: &apiv1.Memo{ + memo, err := ts.Service.CreateMemo(userCtx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{ Content: "Test memo", - Visibility: apiv1.Visibility_PRIVATE, + Visibility: apipb.Visibility_PRIVATE, }, }) require.NoError(t, err) require.NotNil(t, memo) // Unauthenticated user tries to modify relations - should fail - _, err = ts.Service.SetMemoRelations(ctx, &apiv1.SetMemoRelationsRequest{ + _, err = ts.Service.SetMemoRelations(ctx, &apipb.SetMemoRelationsRequest{ Name: memo.Name, - Relations: []*apiv1.MemoRelation{}, + Relations: []*apipb.MemoRelation{}, }) require.Error(t, err) require.Contains(t, err.Error(), "not authenticated") @@ -162,9 +162,9 @@ func TestSetMemoRelations(t *testing.T) { userCtx := ts.CreateUserContext(ctx, user.ID) // Try to set relations on non-existent memo - should fail - _, err = ts.Service.SetMemoRelations(userCtx, &apiv1.SetMemoRelationsRequest{ + _, err = ts.Service.SetMemoRelations(userCtx, &apipb.SetMemoRelationsRequest{ Name: "memos/nonexistent-uid-12345", - Relations: []*apiv1.MemoRelation{}, + Relations: []*apipb.MemoRelation{}, }) require.Error(t, err) require.Contains(t, err.Error(), "not found") @@ -179,33 +179,33 @@ func TestUpdateMemoValidatesAllRelationsBeforeMutation(t *testing.T) { require.NoError(t, err) userCtx := ts.CreateUserContext(ctx, user.ID) - target, err := ts.Service.CreateMemo(userCtx, &apiv1.CreateMemoRequest{Memo: &apiv1.Memo{Content: "target"}}) + target, err := ts.Service.CreateMemo(userCtx, &apipb.CreateMemoRequest{Memo: &apipb.Memo{Content: "target"}}) require.NoError(t, err) - replacement, err := ts.Service.CreateMemo(userCtx, &apiv1.CreateMemoRequest{Memo: &apiv1.Memo{Content: "replacement"}}) + replacement, err := ts.Service.CreateMemo(userCtx, &apipb.CreateMemoRequest{Memo: &apipb.Memo{Content: "replacement"}}) require.NoError(t, err) - source, err := ts.Service.CreateMemo(userCtx, &apiv1.CreateMemoRequest{Memo: &apiv1.Memo{ + source, err := ts.Service.CreateMemo(userCtx, &apipb.CreateMemoRequest{Memo: &apipb.Memo{ Content: "original", - Relations: []*apiv1.MemoRelation{{ - RelatedMemo: &apiv1.MemoRelation_Memo{Name: target.Name}, - Type: apiv1.MemoRelation_REFERENCE, + Relations: []*apipb.MemoRelation{{ + RelatedMemo: &apipb.MemoRelation_MemoRef{Name: target.Name}, + Type: apipb.MemoRelation_REFERENCE, }}, }}) require.NoError(t, err) - _, err = ts.Service.UpdateMemo(userCtx, &apiv1.UpdateMemoRequest{ - Memo: &apiv1.Memo{ + _, err = ts.Service.UpdateMemo(userCtx, &apipb.UpdateMemoRequest{ + Memo: &apipb.Memo{ Name: source.Name, Content: "must roll back", - Relations: []*apiv1.MemoRelation{ - {RelatedMemo: &apiv1.MemoRelation_Memo{Name: replacement.Name}, Type: apiv1.MemoRelation_REFERENCE}, - {RelatedMemo: &apiv1.MemoRelation_Memo{Name: "invalid-name"}, Type: apiv1.MemoRelation_REFERENCE}, + Relations: []*apipb.MemoRelation{ + {RelatedMemo: &apipb.MemoRelation_MemoRef{Name: replacement.Name}, Type: apipb.MemoRelation_REFERENCE}, + {RelatedMemo: &apipb.MemoRelation_MemoRef{Name: "invalid-name"}, Type: apipb.MemoRelation_REFERENCE}, }, }, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"content", "relations"}}, }) require.Equal(t, codes.InvalidArgument, status.Code(err)) - stored, err := ts.Service.GetMemo(userCtx, &apiv1.GetMemoRequest{Name: source.Name}) + stored, err := ts.Service.GetMemo(userCtx, &apipb.GetMemoRequest{Name: source.Name}) require.NoError(t, err) require.Equal(t, "original", stored.Content) require.Len(t, stored.Relations, 1) @@ -220,34 +220,34 @@ func TestSetMemoRelationsRejectsNonReferenceTypes(t *testing.T) { user, err := ts.CreateRegularUser(ctx, "relation-type-owner") require.NoError(t, err) userCtx := ts.CreateUserContext(ctx, user.ID) - source, err := ts.Service.CreateMemo(userCtx, &apiv1.CreateMemoRequest{ - Memo: &apiv1.Memo{Content: "source", Visibility: apiv1.Visibility_PRIVATE}, + source, err := ts.Service.CreateMemo(userCtx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{Content: "source", Visibility: apipb.Visibility_PRIVATE}, }) require.NoError(t, err) - target, err := ts.Service.CreateMemo(userCtx, &apiv1.CreateMemoRequest{ - Memo: &apiv1.Memo{Content: "target", Visibility: apiv1.Visibility_PRIVATE}, + target, err := ts.Service.CreateMemo(userCtx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{Content: "target", Visibility: apipb.Visibility_PRIVATE}, }) require.NoError(t, err) for _, test := range []struct { name string - relationType apiv1.MemoRelation_Type + relationType apipb.MemoRelation_Type }{ - {name: "unspecified", relationType: apiv1.MemoRelation_TYPE_UNSPECIFIED}, - {name: "comment", relationType: apiv1.MemoRelation_COMMENT}, - {name: "unknown", relationType: apiv1.MemoRelation_Type(999)}, + {name: "unspecified", relationType: apipb.MemoRelation_TYPE_UNSPECIFIED}, + {name: "comment", relationType: apipb.MemoRelation_COMMENT}, + {name: "unknown", relationType: apipb.MemoRelation_Type(999)}, } { t.Run(test.name, func(t *testing.T) { - _, err := ts.Service.SetMemoRelations(userCtx, &apiv1.SetMemoRelationsRequest{ + _, err := ts.Service.SetMemoRelations(userCtx, &apipb.SetMemoRelationsRequest{ Name: source.Name, - Relations: []*apiv1.MemoRelation{{ - RelatedMemo: &apiv1.MemoRelation_Memo{Name: target.Name}, + Relations: []*apipb.MemoRelation{{ + RelatedMemo: &apipb.MemoRelation_MemoRef{Name: target.Name}, Type: test.relationType, }}, }) require.Equal(t, codes.InvalidArgument, status.Code(err)) - stored, err := ts.Service.GetMemo(userCtx, &apiv1.GetMemoRequest{Name: source.Name}) + stored, err := ts.Service.GetMemo(userCtx, &apipb.GetMemoRequest{Name: source.Name}) require.NoError(t, err) require.Empty(t, stored.Relations) }) diff --git a/server/api/v1/test/memo_service_benchmark_test.go b/server/api/test/memo_service_benchmark_test.go similarity index 90% rename from server/api/v1/test/memo_service_benchmark_test.go rename to server/api/test/memo_service_benchmark_test.go index ab8eb16cf..035b6906c 100644 --- a/server/api/v1/test/memo_service_benchmark_test.go +++ b/server/api/test/memo_service_benchmark_test.go @@ -8,8 +8,8 @@ import ( "github.com/usememos/memos/internal/profile" "github.com/usememos/memos/internal/version" - v1pb "github.com/usememos/memos/proto/gen/api/v1" - apiv1 "github.com/usememos/memos/server/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" + "github.com/usememos/memos/server/api" "github.com/usememos/memos/server/auth" "github.com/usememos/memos/store" "github.com/usememos/memos/store/db" @@ -100,8 +100,8 @@ func getBenchmarkProfile(dataDir string) *profile.Profile { } } -func newServiceWithProfile(testProfile *profile.Profile, testStore *store.Store) *apiv1.APIV1Service { - service := apiv1.NewAPIV1Service("bench-secret", testProfile, testStore) +func newServiceWithProfile(testProfile *profile.Profile, testStore *store.Store) *api.APIService { + service := api.NewAPIService("bench-secret", testProfile, testStore) return service } @@ -183,10 +183,10 @@ func benchmarkMemoContent(i int) string { return fmt.Sprintf("# Bench Memo %06d\n\nThis is benchmark memo %06d with enough content to exercise snippet generation.\n\n- task one\n- task two\n", i, i) } -func getListMemosPageToken(ctx context.Context, service *apiv1.APIV1Service, page int, pageSize int32) (string, error) { +func getListMemosPageToken(ctx context.Context, service *api.APIService, page int, pageSize int32) (string, error) { pageToken := "" for range page - 1 { - resp, err := service.ListMemos(ctx, &v1pb.ListMemosRequest{ + resp, err := service.ListMemos(ctx, &apipb.ListMemosRequest{ PageSize: pageSize, PageToken: pageToken, }) @@ -205,7 +205,7 @@ func BenchmarkListMemos(b *testing.B) { bench := newBenchmarkService(b) b.Run("authenticated_first_page", func(b *testing.B) { - req := &v1pb.ListMemosRequest{PageSize: benchmarkPageSize} + req := &apipb.ListMemosRequest{PageSize: benchmarkPageSize} b.ReportAllocs() b.ResetTimer() for i := 0; i < b.N; i++ { @@ -220,7 +220,7 @@ func BenchmarkListMemos(b *testing.B) { }) b.Run("authenticated_page_ten", func(b *testing.B) { - req := &v1pb.ListMemosRequest{PageSize: benchmarkPageSize, PageToken: bench.pageTenToken} + req := &apipb.ListMemosRequest{PageSize: benchmarkPageSize, PageToken: bench.pageTenToken} b.ReportAllocs() b.ResetTimer() for i := 0; i < b.N; i++ { @@ -235,7 +235,7 @@ func BenchmarkListMemos(b *testing.B) { }) b.Run("public_first_page", func(b *testing.B) { - req := &v1pb.ListMemosRequest{PageSize: benchmarkPageSize} + req := &apipb.ListMemosRequest{PageSize: benchmarkPageSize} b.ReportAllocs() b.ResetTimer() for i := 0; i < b.N; i++ { @@ -256,8 +256,8 @@ func BenchmarkListMemoCommentsPreview(b *testing.B) { b.Fatal("expected seeded memo with comments") } - req := &v1pb.ListMemoCommentsRequest{ - Name: bench.commentParentName, + req := &apipb.ListMemoCommentsRequest{ + Parent: bench.commentParentName, PageSize: 3, } @@ -268,7 +268,7 @@ func BenchmarkListMemoCommentsPreview(b *testing.B) { if err != nil { b.Fatalf("ListMemoComments failed: %v", err) } - if len(resp.Memos) == 0 { + if len(resp.Comments) == 0 { b.Fatal("expected comments in benchmark response") } } diff --git a/server/api/v1/test/memo_service_test.go b/server/api/test/memo_service_test.go similarity index 65% rename from server/api/v1/test/memo_service_test.go rename to server/api/test/memo_service_test.go index 35d191e07..cd66a6c25 100644 --- a/server/api/v1/test/memo_service_test.go +++ b/server/api/test/memo_service_test.go @@ -13,7 +13,7 @@ import ( "google.golang.org/protobuf/types/known/fieldmaskpb" "google.golang.org/protobuf/types/known/timestamppb" - apiv1 "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" storepb "github.com/usememos/memos/proto/gen/store" "github.com/usememos/memos/store" ) @@ -26,28 +26,28 @@ func TestAnonymousMemoAccessFollowsInstanceAccessSetting(t *testing.T) { owner, err := ts.CreateRegularUser(ctx, "access-mode-owner") require.NoError(t, err) ownerCtx := ts.CreateUserContext(ctx, owner.ID) - memo, err := ts.Service.CreateMemo(ownerCtx, &apiv1.CreateMemoRequest{Memo: &apiv1.Memo{ + memo, err := ts.Service.CreateMemo(ownerCtx, &apipb.CreateMemoRequest{Memo: &apipb.Memo{ Content: "public memo", - Visibility: apiv1.Visibility_PUBLIC, + Visibility: apipb.Visibility_PUBLIC, }}) require.NoError(t, err) - _, err = ts.Service.GetMemo(ctx, &apiv1.GetMemoRequest{Name: memo.Name}) + _, err = ts.Service.GetMemo(ctx, &apipb.GetMemoRequest{Name: memo.Name}) require.NoError(t, err) - _, err = ts.Service.ListMemos(ctx, &apiv1.ListMemosRequest{}) + _, err = ts.Service.ListMemos(ctx, &apipb.ListMemosRequest{}) require.NoError(t, err) require.NoError(t, ts.SetInstanceAccessMode(ctx, storepb.InstanceAccessMode_INSTANCE_ACCESS_MODE_PRIVATE)) - _, err = ts.Service.GetMemo(ctx, &apiv1.GetMemoRequest{Name: memo.Name}) + _, err = ts.Service.GetMemo(ctx, &apipb.GetMemoRequest{Name: memo.Name}) require.Equal(t, codes.Unauthenticated, status.Code(err)) - _, err = ts.Service.ListMemos(ctx, &apiv1.ListMemosRequest{}) + _, err = ts.Service.ListMemos(ctx, &apipb.ListMemosRequest{}) require.Equal(t, codes.Unauthenticated, status.Code(err)) - _, err = ts.Service.GetMemo(ownerCtx, &apiv1.GetMemoRequest{Name: memo.Name}) + _, err = ts.Service.GetMemo(ownerCtx, &apipb.GetMemoRequest{Name: memo.Name}) require.NoError(t, err) require.NoError(t, ts.SetInstanceAccessMode(ctx, storepb.InstanceAccessMode_INSTANCE_ACCESS_MODE_PUBLIC)) - _, err = ts.Service.GetMemo(ctx, &apiv1.GetMemoRequest{Name: memo.Name}) + _, err = ts.Service.GetMemo(ctx, &apipb.GetMemoRequest{Name: memo.Name}) require.NoError(t, err) } @@ -68,84 +68,84 @@ func TestInstanceAdminIsSuperuserForNamedMemoOperations(t *testing.T) { space, err := ts.Store.CreateSpace(ctx, &store.Space{UID: "superuser-space", Title: "Superuser"}, owner.ID) require.NoError(t, err) - private, err := ts.Service.CreateMemo(ownerCtx, &apiv1.CreateMemoRequest{Memo: &apiv1.Memo{ + private, err := ts.Service.CreateMemo(ownerCtx, &apipb.CreateMemoRequest{Memo: &apipb.Memo{ Content: "private memo", - Visibility: apiv1.Visibility_PRIVATE, + Visibility: apipb.Visibility_PRIVATE, }}) require.NoError(t, err) - spaceMemo, err := ts.Service.CreateMemo(ownerCtx, &apiv1.CreateMemoRequest{Memo: &apiv1.Memo{ + spaceMemo, err := ts.Service.CreateMemo(ownerCtx, &apipb.CreateMemoRequest{Memo: &apipb.Memo{ Content: "members only", - Visibility: apiv1.Visibility_SPACE, + Visibility: apipb.Visibility_SPACE, Space: ptr("spaces/" + space.UID), }}) require.NoError(t, err) // Point reads bypass audience and membership for the administrator only. - _, err = ts.Service.GetMemo(otherCtx, &apiv1.GetMemoRequest{Name: private.Name}) + _, err = ts.Service.GetMemo(otherCtx, &apipb.GetMemoRequest{Name: private.Name}) require.Equal(t, codes.PermissionDenied, status.Code(err)) - got, err := ts.Service.GetMemo(adminCtx, &apiv1.GetMemoRequest{Name: private.Name}) + got, err := ts.Service.GetMemo(adminCtx, &apipb.GetMemoRequest{Name: private.Name}) require.NoError(t, err) require.Equal(t, "private memo", got.Content) - got, err = ts.Service.GetMemo(adminCtx, &apiv1.GetMemoRequest{Name: spaceMemo.Name}) + got, err = ts.Service.GetMemo(adminCtx, &apipb.GetMemoRequest{Name: spaceMemo.Name}) require.NoError(t, err, "a SPACE memo is readable by name without membership") require.Equal(t, "spaces/"+space.UID, got.GetSpace()) // Collections keep the audience predicate. - feed, err := ts.Service.ListMemos(adminCtx, &apiv1.ListMemosRequest{PageSize: 50}) + feed, err := ts.Service.ListMemos(adminCtx, &apipb.ListMemosRequest{PageSize: 50}) require.NoError(t, err) for _, candidate := range feed.Memos { require.NotEqual(t, private.Name, candidate.Name, "another user's PRIVATE memo must not surface in the administrator's feed") require.NotEqual(t, spaceMemo.Name, candidate.Name, "a SPACE memo must not surface without membership") } - _, err = ts.Service.ListMemos(adminCtx, &apiv1.ListMemosRequest{Filter: `space == "spaces/` + space.UID + `"`}) + _, err = ts.Service.ListMemos(adminCtx, &apipb.ListMemosRequest{Filter: `space == "spaces/` + space.UID + `"`}) require.Equal(t, codes.NotFound, status.Code(err), "the Space feed stays membership-only") // Named mutations: content, audience, placement, comments, and deletion. - _, err = ts.Service.UpdateMemo(otherCtx, &apiv1.UpdateMemoRequest{ - Memo: &apiv1.Memo{Name: private.Name, Content: "hijacked"}, + _, err = ts.Service.UpdateMemo(otherCtx, &apipb.UpdateMemoRequest{ + Memo: &apipb.Memo{Name: private.Name, Content: "hijacked"}, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"content"}}, }) require.Equal(t, codes.PermissionDenied, status.Code(err)) - updated, err := ts.Service.UpdateMemo(adminCtx, &apiv1.UpdateMemoRequest{ - Memo: &apiv1.Memo{Name: private.Name, Content: "edited by admin"}, + updated, err := ts.Service.UpdateMemo(adminCtx, &apipb.UpdateMemoRequest{ + Memo: &apipb.Memo{Name: private.Name, Content: "edited by admin"}, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"content"}}, }) require.NoError(t, err) require.Equal(t, "edited by admin", updated.Content) require.Equal(t, "users/"+owner.Username, updated.Creator, "authorship is unchanged") - _, err = ts.Service.UpdateMemo(adminCtx, &apiv1.UpdateMemoRequest{ - Memo: &apiv1.Memo{Name: spaceMemo.Name, Content: "edited without membership"}, + _, err = ts.Service.UpdateMemo(adminCtx, &apipb.UpdateMemoRequest{ + Memo: &apipb.Memo{Name: spaceMemo.Name, Content: "edited without membership"}, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"content"}}, }) require.NoError(t, err) - _, err = ts.Service.UpdateMemo(adminCtx, &apiv1.UpdateMemoRequest{ - Memo: &apiv1.Memo{Name: private.Name, Visibility: apiv1.Visibility_SPACE, Space: ptr("spaces/" + space.UID)}, + _, err = ts.Service.UpdateMemo(adminCtx, &apipb.UpdateMemoRequest{ + Memo: &apipb.Memo{Name: private.Name, Visibility: apipb.Visibility_SPACE, Space: ptr("spaces/" + space.UID)}, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"visibility", "space"}}, }) require.NoError(t, err, "an administrator places memos in a Space they are not a member of") - _, err = ts.Service.UpdateMemo(adminCtx, &apiv1.UpdateMemoRequest{ - Memo: &apiv1.Memo{Name: private.Name, Space: ptr("spaces/does-not-exist")}, + _, err = ts.Service.UpdateMemo(adminCtx, &apipb.UpdateMemoRequest{ + Memo: &apipb.Memo{Name: private.Name, Space: ptr("spaces/does-not-exist")}, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"space"}}, }) require.Equal(t, codes.NotFound, status.Code(err), "structural validity still applies") - _, err = ts.Service.CreateMemoComment(adminCtx, &apiv1.CreateMemoCommentRequest{ - Name: spaceMemo.Name, - Comment: &apiv1.Memo{Content: "admin comment"}, + _, err = ts.Service.CreateMemoComment(adminCtx, &apipb.CreateMemoCommentRequest{ + Parent: spaceMemo.Name, + Comment: &apipb.Memo{Content: "admin comment"}, }) require.NoError(t, err, "participation does not require membership") - _, err = ts.Service.DeleteMemo(otherCtx, &apiv1.DeleteMemoRequest{Name: private.Name}) + _, err = ts.Service.DeleteMemo(otherCtx, &apipb.DeleteMemoRequest{Name: private.Name}) require.Equal(t, codes.PermissionDenied, status.Code(err)) - _, err = ts.Service.DeleteMemo(adminCtx, &apiv1.DeleteMemoRequest{Name: private.Name}) + _, err = ts.Service.DeleteMemo(adminCtx, &apipb.DeleteMemoRequest{Name: private.Name}) require.NoError(t, err) - _, err = ts.Service.GetMemo(ownerCtx, &apiv1.GetMemoRequest{Name: private.Name}) + _, err = ts.Service.GetMemo(ownerCtx, &apipb.GetMemoRequest{Name: private.Name}) require.Equal(t, codes.NotFound, status.Code(err)) // An archived administrator holds no privilege. archived := store.Archived _, err = ts.Store.UpdateUser(ctx, &store.UpdateUser{ID: admin.ID, RowStatus: &archived}) require.NoError(t, err) - _, err = ts.Service.GetMemo(adminCtx, &apiv1.GetMemoRequest{Name: spaceMemo.Name}) + _, err = ts.Service.GetMemo(adminCtx, &apipb.GetMemoRequest{Name: spaceMemo.Name}) require.Error(t, err) } @@ -160,21 +160,21 @@ func TestMemoReadAllowsArchivedCreatorAccordingToAudience(t *testing.T) { require.NoError(t, err) creatorCtx := ts.CreateUserContext(ctx, creator.ID) viewerCtx := ts.CreateUserContext(ctx, viewer.ID) - publicMemo, err := ts.Service.CreateMemo(creatorCtx, &apiv1.CreateMemoRequest{Memo: &apiv1.Memo{ - Content: "public memo by archived creator", Visibility: apiv1.Visibility_PUBLIC, + publicMemo, err := ts.Service.CreateMemo(creatorCtx, &apipb.CreateMemoRequest{Memo: &apipb.Memo{ + Content: "public memo by archived creator", Visibility: apipb.Visibility_PUBLIC, }}) require.NoError(t, err) - protectedMemo, err := ts.Service.CreateMemo(creatorCtx, &apiv1.CreateMemoRequest{Memo: &apiv1.Memo{ - Content: "protected memo by archived creator", Visibility: apiv1.Visibility_PROTECTED, + protectedMemo, err := ts.Service.CreateMemo(creatorCtx, &apipb.CreateMemoRequest{Memo: &apipb.Memo{ + Content: "protected memo by archived creator", Visibility: apipb.Visibility_PROTECTED, }}) require.NoError(t, err) archived := store.Archived _, err = ts.Store.UpdateUser(ctx, &store.UpdateUser{ID: creator.ID, RowStatus: &archived}) require.NoError(t, err) - _, err = ts.Service.GetMemo(ctx, &apiv1.GetMemoRequest{Name: publicMemo.Name}) + _, err = ts.Service.GetMemo(ctx, &apipb.GetMemoRequest{Name: publicMemo.Name}) require.NoError(t, err, "creator archive must not narrow a PUBLIC memo") - _, err = ts.Service.GetMemo(viewerCtx, &apiv1.GetMemoRequest{Name: protectedMemo.Name}) + _, err = ts.Service.GetMemo(viewerCtx, &apipb.GetMemoRequest{Name: protectedMemo.Name}) require.NoError(t, err, "creator archive must not narrow a PROTECTED memo") } @@ -186,8 +186,8 @@ func TestDanglingPlacementDoesNotOverrideNonSpaceAudience(t *testing.T) { creator, err := ts.CreateRegularUser(ctx, "dangling-placement-creator") require.NoError(t, err) creatorCtx := ts.CreateUserContext(ctx, creator.ID) - memo, err := ts.Service.CreateMemo(creatorCtx, &apiv1.CreateMemoRequest{Memo: &apiv1.Memo{ - Content: "public memo with corrupt placement", Visibility: apiv1.Visibility_PUBLIC, + memo, err := ts.Service.CreateMemo(creatorCtx, &apipb.CreateMemoRequest{Memo: &apipb.Memo{ + Content: "public memo with corrupt placement", Visibility: apipb.Visibility_PUBLIC, }}) require.NoError(t, err) memoID := parseMemoIDFromNameForTest(t, ts, memo.Name) @@ -195,18 +195,18 @@ func TestDanglingPlacementDoesNotOverrideNonSpaceAudience(t *testing.T) { fmt.Sprintf("UPDATE memo SET space_id = 2147483000 WHERE id = %d", memoID)) require.NoError(t, err) - got, err := ts.Service.GetMemo(ctx, &apiv1.GetMemoRequest{Name: memo.Name}) + got, err := ts.Service.GetMemo(ctx, &apipb.GetMemoRequest{Name: memo.Name}) require.NoError(t, err) require.Nil(t, got.Space, "an invalid placement must be omitted") - listed, err := ts.Service.ListMemos(ctx, &apiv1.ListMemosRequest{}) + listed, err := ts.Service.ListMemos(ctx, &apipb.ListMemosRequest{}) require.NoError(t, err) require.Len(t, listed.Memos, 1) require.Equal(t, memo.Name, listed.Memos[0].Name) require.Nil(t, listed.Memos[0].Space) - _, err = ts.Service.CreateMemoComment(creatorCtx, &apiv1.CreateMemoCommentRequest{ - Name: memo.Name, Comment: &apiv1.Memo{Content: "must not participate", Visibility: apiv1.Visibility_PUBLIC}, + _, err = ts.Service.CreateMemoComment(creatorCtx, &apipb.CreateMemoCommentRequest{ + Parent: memo.Name, Comment: &apipb.Memo{Content: "must not participate", Visibility: apipb.Visibility_PUBLIC}, }) require.Equal(t, codes.FailedPrecondition, status.Code(err), "placement-dependent participation must fail closed") } @@ -219,24 +219,24 @@ func TestMemoReadFailsClosedForMissingCreatorBeforePaginationAndChildren(t *test creator, err := ts.CreateRegularUser(ctx, "missing-memo-creator") require.NoError(t, err) creatorCtx := ts.CreateUserContext(ctx, creator.ID) - first, err := ts.Service.CreateMemo(creatorCtx, &apiv1.CreateMemoRequest{Memo: &apiv1.Memo{ - Content: "first valid", Visibility: apiv1.Visibility_PUBLIC, + first, err := ts.Service.CreateMemo(creatorCtx, &apipb.CreateMemoRequest{Memo: &apipb.Memo{ + Content: "first valid", Visibility: apipb.Visibility_PUBLIC, }}) require.NoError(t, err) - second, err := ts.Service.CreateMemo(creatorCtx, &apiv1.CreateMemoRequest{Memo: &apiv1.Memo{ - Content: "second valid", Visibility: apiv1.Visibility_PUBLIC, + second, err := ts.Service.CreateMemo(creatorCtx, &apipb.CreateMemoRequest{Memo: &apipb.Memo{ + Content: "second valid", Visibility: apipb.Visibility_PUBLIC, }}) require.NoError(t, err) - corrupt, err := ts.Service.CreateMemo(creatorCtx, &apiv1.CreateMemoRequest{Memo: &apiv1.Memo{ - Content: "dangling creator", Visibility: apiv1.Visibility_PUBLIC, + corrupt, err := ts.Service.CreateMemo(creatorCtx, &apipb.CreateMemoRequest{Memo: &apipb.Memo{ + Content: "dangling creator", Visibility: apipb.Visibility_PUBLIC, }}) require.NoError(t, err) - _, err = ts.Service.UpsertMemoReaction(creatorCtx, &apiv1.UpsertMemoReactionRequest{ - Name: corrupt.Name, Reaction: &apiv1.Reaction{ReactionType: "eyes"}, + _, err = ts.Service.UpsertMemoReaction(creatorCtx, &apipb.UpsertMemoReactionRequest{ + Parent: corrupt.Name, Reaction: &apipb.Reaction{ReactionType: "eyes"}, }) require.NoError(t, err) - _, err = ts.Service.CreateMemoComment(creatorCtx, &apiv1.CreateMemoCommentRequest{ - Name: corrupt.Name, Comment: &apiv1.Memo{Content: "existing comment", Visibility: apiv1.Visibility_PUBLIC}, + _, err = ts.Service.CreateMemoComment(creatorCtx, &apipb.CreateMemoCommentRequest{ + Parent: corrupt.Name, Comment: &apipb.Memo{Content: "existing comment", Visibility: apipb.Visibility_PUBLIC}, }) require.NoError(t, err) corruptID := parseMemoIDFromNameForTest(t, ts, corrupt.Name) @@ -248,20 +248,20 @@ func TestMemoReadFailsClosedForMissingCreatorBeforePaginationAndChildren(t *test fmt.Sprintf("UPDATE memo SET creator_id = 2147483000 WHERE id = %d", corruptID)) require.NoError(t, err) - _, err = ts.Service.GetMemo(ctx, &apiv1.GetMemoRequest{Name: corrupt.Name}) + _, err = ts.Service.GetMemo(ctx, &apipb.GetMemoRequest{Name: corrupt.Name}) require.Equal(t, codes.NotFound, status.Code(err)) - _, err = ts.Service.ListMemoReactions(ctx, &apiv1.ListMemoReactionsRequest{Name: corrupt.Name}) + _, err = ts.Service.ListMemoReactions(ctx, &apipb.ListMemoReactionsRequest{Parent: corrupt.Name}) require.Equal(t, codes.NotFound, status.Code(err)) - _, err = ts.Service.ListMemoAttachments(ctx, &apiv1.ListMemoAttachmentsRequest{Name: corrupt.Name}) + _, err = ts.Service.ListMemoAttachments(ctx, &apipb.ListMemoAttachmentsRequest{Parent: corrupt.Name}) require.Equal(t, codes.NotFound, status.Code(err)) - _, err = ts.Service.ListMemoComments(ctx, &apiv1.ListMemoCommentsRequest{Name: corrupt.Name}) + _, err = ts.Service.ListMemoComments(ctx, &apipb.ListMemoCommentsRequest{Parent: corrupt.Name}) require.Equal(t, codes.NotFound, status.Code(err)) - _, err = ts.Service.CreateMemoComment(creatorCtx, &apiv1.CreateMemoCommentRequest{ - Name: corrupt.Name, Comment: &apiv1.Memo{Content: "must not be created", Visibility: apiv1.Visibility_PUBLIC}, + _, err = ts.Service.CreateMemoComment(creatorCtx, &apipb.CreateMemoCommentRequest{ + Parent: corrupt.Name, Comment: &apipb.Memo{Content: "must not be created", Visibility: apipb.Visibility_PUBLIC}, }) require.Equal(t, codes.NotFound, status.Code(err)) - listed, err := ts.Service.ListMemos(ctx, &apiv1.ListMemosRequest{PageSize: 2}) + listed, err := ts.Service.ListMemos(ctx, &apipb.ListMemosRequest{PageSize: 2}) require.NoError(t, err) require.Len(t, listed.Memos, 2) require.ElementsMatch(t, []string{first.Name, second.Name}, []string{listed.Memos[0].Name, listed.Memos[1].Name}, @@ -278,10 +278,10 @@ func TestCreateMemoAcceptsUUID(t *testing.T) { userCtx := ts.CreateUserContext(ctx, user.ID) const memoID = "21ec98aa-9a8f-458c-a2a3-c7dc69b6f591" - memo, err := ts.Service.CreateMemo(userCtx, &apiv1.CreateMemoRequest{ - Memo: &apiv1.Memo{ + memo, err := ts.Service.CreateMemo(userCtx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{ Content: "Created with a UUID", - Visibility: apiv1.Visibility_PRIVATE, + Visibility: apipb.Visibility_PRIVATE, }, MemoId: memoID, }) @@ -298,17 +298,17 @@ func TestCreateAndUpdateMemoRebuildsTagPayload(t *testing.T) { require.NoError(t, err) userCtx := ts.CreateUserContext(ctx, user.ID) - memo, err := ts.Service.CreateMemo(userCtx, &apiv1.CreateMemoRequest{ - Memo: &apiv1.Memo{ + memo, err := ts.Service.CreateMemo(userCtx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{ Content: "#book/fiction #Work #work #A\u200dB https://example.com/#hidden", - Visibility: apiv1.Visibility_PRIVATE, + Visibility: apipb.Visibility_PRIVATE, }, }) require.NoError(t, err) require.Equal(t, []string{"book", "book/fiction", "Work", "work", "AB"}, memo.Tags) - memo, err = ts.Service.UpdateMemo(userCtx, &apiv1.UpdateMemoRequest{ - Memo: &apiv1.Memo{ + memo, err = ts.Service.UpdateMemo(userCtx, &apipb.UpdateMemoRequest{ + Memo: &apipb.Memo{ Name: memo.Name, Content: "#next #A\u200dB", }, @@ -317,7 +317,7 @@ func TestCreateAndUpdateMemoRebuildsTagPayload(t *testing.T) { require.NoError(t, err) require.Equal(t, []string{"next", "AB"}, memo.Tags) - stored, err := ts.Service.GetMemo(userCtx, &apiv1.GetMemoRequest{Name: memo.Name}) + stored, err := ts.Service.GetMemo(userCtx, &apipb.GetMemoRequest{Name: memo.Name}) require.NoError(t, err) require.Equal(t, []string{"next", "AB"}, stored.Tags) } @@ -345,8 +345,8 @@ func TestListMemos(t *testing.T) { userTwoCtx := ts.CreateUserContext(ctx, userTwo.ID) // Create attachmentOne by userOne - attachmentOne, err := ts.Service.CreateAttachment(userOneCtx, &apiv1.CreateAttachmentRequest{ - Attachment: &apiv1.Attachment{ + attachmentOne, err := ts.Service.CreateAttachment(userOneCtx, &apipb.CreateAttachmentRequest{ + Attachment: &apipb.Attachment{ Name: "", Filename: "hello.txt", Size: 5, @@ -361,8 +361,8 @@ func TestListMemos(t *testing.T) { require.NotNil(t, attachmentOne) // Create attachmentTwo by userOne - attachmentTwo, err := ts.Service.CreateAttachment(userOneCtx, &apiv1.CreateAttachmentRequest{ - Attachment: &apiv1.Attachment{ + attachmentTwo, err := ts.Service.CreateAttachment(userOneCtx, &apipb.CreateAttachmentRequest{ + Attachment: &apipb.Attachment{ Name: "", Filename: "world.txt", Size: 5, @@ -377,15 +377,15 @@ func TestListMemos(t *testing.T) { require.NotNil(t, attachmentTwo) // Create memoOne with two attachments by userOne - memoOne, err := ts.Service.CreateMemo(userOneCtx, &apiv1.CreateMemoRequest{ - Memo: &apiv1.Memo{ + memoOne, err := ts.Service.CreateMemo(userOneCtx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{ Content: "Hellooo, any words after this sentence won't be in the snippet. This is the next sentence. And I also have two attachments.", - Visibility: apiv1.Visibility_PROTECTED, - Attachments: []*apiv1.Attachment{ - &apiv1.Attachment{ + Visibility: apipb.Visibility_PROTECTED, + Attachments: []*apipb.Attachment{ + &apipb.Attachment{ Name: attachmentOne.Name, }, - &apiv1.Attachment{ + &apipb.Attachment{ Name: attachmentTwo.Name, }, }, @@ -396,16 +396,16 @@ func TestListMemos(t *testing.T) { require.NotNil(t, memoOne) // Create memoTwo by userTwo referencing memoOne - memoTwo, err := ts.Service.CreateMemo(userTwoCtx, &apiv1.CreateMemoRequest{ - Memo: &apiv1.Memo{ + memoTwo, err := ts.Service.CreateMemo(userTwoCtx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{ Content: "This is a memo reminding you to check the attachment attached to memoOne. I have referenced the memo below.⬇️", - Visibility: apiv1.Visibility_PROTECTED, - Relations: []*apiv1.MemoRelation{ - &apiv1.MemoRelation{ - RelatedMemo: &apiv1.MemoRelation_Memo{ + Visibility: apipb.Visibility_PROTECTED, + Relations: []*apipb.MemoRelation{ + &apipb.MemoRelation{ + RelatedMemo: &apipb.MemoRelation_MemoRef{ Name: memoOne.Name, }, - Type: apiv1.MemoRelation_REFERENCE, + Type: apipb.MemoRelation_REFERENCE, }, }, }, @@ -415,10 +415,10 @@ func TestListMemos(t *testing.T) { require.NotNil(t, memoTwo) // Create memoThree by userOne - memoThree, err := ts.Service.CreateMemo(userOneCtx, &apiv1.CreateMemoRequest{ - Memo: &apiv1.Memo{ + memoThree, err := ts.Service.CreateMemo(userOneCtx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{ Content: "This is a very popular memo. I have 2 reactions!", - Visibility: apiv1.Visibility_PROTECTED, + Visibility: apipb.Visibility_PROTECTED, }, }) @@ -426,9 +426,9 @@ func TestListMemos(t *testing.T) { require.NotNil(t, memoThree) // Create reaction from userOne on memoThree - reactionOne, err := ts.Service.UpsertMemoReaction(userOneCtx, &apiv1.UpsertMemoReactionRequest{ - Name: memoThree.Name, - Reaction: &apiv1.Reaction{ + reactionOne, err := ts.Service.UpsertMemoReaction(userOneCtx, &apipb.UpsertMemoReactionRequest{ + Parent: memoThree.Name, + Reaction: &apipb.Reaction{ ReactionType: "❤️", }, }) @@ -437,9 +437,9 @@ func TestListMemos(t *testing.T) { require.NotNil(t, reactionOne) // Create reaction from userTwo on memoThree - reactionTwo, err := ts.Service.UpsertMemoReaction(userTwoCtx, &apiv1.UpsertMemoReactionRequest{ - Name: memoThree.Name, - Reaction: &apiv1.Reaction{ + reactionTwo, err := ts.Service.UpsertMemoReaction(userTwoCtx, &apipb.UpsertMemoReactionRequest{ + Parent: memoThree.Name, + Reaction: &apipb.Reaction{ ReactionType: "👍", }, }) @@ -447,7 +447,7 @@ func TestListMemos(t *testing.T) { require.NoError(t, err) require.NotNil(t, reactionTwo) - memos, err := ts.Service.ListMemos(userOneCtx, &apiv1.ListMemosRequest{PageSize: 10}) + memos, err := ts.Service.ListMemos(userOneCtx, &apipb.ListMemosRequest{PageSize: 10}) require.NoError(t, err) require.NotNil(t, memos) @@ -456,14 +456,14 @@ func TestListMemos(t *testing.T) { // /////////////// // VERIFY MEMO ONE // /////////////// - memoOneResIdx := slices.IndexFunc(memos.Memos, func(m *apiv1.Memo) bool { return m.GetName() == memoOne.GetName() }) + memoOneResIdx := slices.IndexFunc(memos.Memos, func(m *apipb.Memo) bool { return m.GetName() == memoOne.GetName() }) require.NotEqual(t, memoOneResIdx, -1) memoOneRes := memos.Memos[memoOneResIdx] require.NotNil(t, memoOneRes) require.Equal(t, fmt.Sprintf("users/%s", userOne.Username), memoOneRes.GetCreator()) - require.Equal(t, apiv1.Visibility_PROTECTED, memoOneRes.GetVisibility()) + require.Equal(t, apipb.Visibility_PROTECTED, memoOneRes.GetVisibility()) require.Equal(t, memoOne.Content, memoOneRes.GetContent()) require.Equal(t, memoOne.Content[:64]+"...", memoOneRes.GetSnippet(), "memoOne's content is snipped past the 64 char limit") require.Len(t, memoOneRes.Attachments, 2) @@ -472,7 +472,7 @@ func TestListMemos(t *testing.T) { // verify memoOne's attachments // attachment one - attachmentOneResIdx := slices.IndexFunc(memoOneRes.Attachments, func(a *apiv1.Attachment) bool { return a.GetName() == attachmentOne.GetName() }) + attachmentOneResIdx := slices.IndexFunc(memoOneRes.Attachments, func(a *apipb.Attachment) bool { return a.GetName() == attachmentOne.GetName() }) require.NotEqual(t, attachmentOneResIdx, -1) attachmentOneRes := memoOneRes.Attachments[attachmentOneResIdx] @@ -482,7 +482,7 @@ func TestListMemos(t *testing.T) { require.Equal(t, attachmentOne.GetContent(), attachmentOneRes.GetContent()) // attachment two - attachmentTwoResIdx := slices.IndexFunc(memoOneRes.Attachments, func(a *apiv1.Attachment) bool { return a.GetName() == attachmentTwo.GetName() }) + attachmentTwoResIdx := slices.IndexFunc(memoOneRes.Attachments, func(a *apipb.Attachment) bool { return a.GetName() == attachmentTwo.GetName() }) require.NotEqual(t, attachmentTwoResIdx, -1) attachmentTwoRes := memoOneRes.Attachments[attachmentTwoResIdx] @@ -494,9 +494,9 @@ func TestListMemos(t *testing.T) { // verify memoOne's relations require.Len(t, memoOneRes.Relations, 1) - memoOneExpectedRelation := &apiv1.MemoRelation{ - Memo: &apiv1.MemoRelation_Memo{Name: memoTwo.GetName()}, - RelatedMemo: &apiv1.MemoRelation_Memo{Name: memoOne.GetName()}, + memoOneExpectedRelation := &apipb.MemoRelation{ + Memo: &apipb.MemoRelation_MemoRef{Name: memoTwo.GetName()}, + RelatedMemo: &apipb.MemoRelation_MemoRef{Name: memoOne.GetName()}, } require.Equal(t, memoOneExpectedRelation.Memo.GetName(), memoOneRes.Relations[0].Memo.GetName()) require.Equal(t, memoOneExpectedRelation.RelatedMemo.GetName(), memoOneRes.Relations[0].RelatedMemo.GetName()) @@ -504,14 +504,14 @@ func TestListMemos(t *testing.T) { // /////////////// // VERIFY MEMO TWO // /////////////// - memoTwoResIdx := slices.IndexFunc(memos.Memos, func(m *apiv1.Memo) bool { return m.GetName() == memoTwo.GetName() }) + memoTwoResIdx := slices.IndexFunc(memos.Memos, func(m *apipb.Memo) bool { return m.GetName() == memoTwo.GetName() }) require.NotEqual(t, memoTwoResIdx, -1) memoTwoRes := memos.Memos[memoTwoResIdx] require.NotNil(t, memoTwoRes) require.Equal(t, fmt.Sprintf("users/%s", userTwo.Username), memoTwoRes.GetCreator()) - require.Equal(t, apiv1.Visibility_PROTECTED, memoTwoRes.GetVisibility()) + require.Equal(t, apipb.Visibility_PROTECTED, memoTwoRes.GetVisibility()) require.Equal(t, memoTwo.Content, memoTwoRes.GetContent()) require.Empty(t, memoTwoRes.Attachments) require.Len(t, memoTwoRes.Relations, 1) @@ -519,9 +519,9 @@ func TestListMemos(t *testing.T) { // verify memoTwo's relations require.Len(t, memoTwoRes.Relations, 1) - memoTwoExpectedRelation := &apiv1.MemoRelation{ - Memo: &apiv1.MemoRelation_Memo{Name: memoTwo.GetName()}, - RelatedMemo: &apiv1.MemoRelation_Memo{Name: memoOne.GetName()}, + memoTwoExpectedRelation := &apipb.MemoRelation{ + Memo: &apipb.MemoRelation_MemoRef{Name: memoTwo.GetName()}, + RelatedMemo: &apipb.MemoRelation_MemoRef{Name: memoOne.GetName()}, } require.Equal(t, memoTwoExpectedRelation.Memo.GetName(), memoTwoRes.Relations[0].Memo.GetName()) require.Equal(t, memoTwoExpectedRelation.RelatedMemo.GetName(), memoTwoRes.Relations[0].RelatedMemo.GetName()) @@ -529,14 +529,14 @@ func TestListMemos(t *testing.T) { // /////////////// // VERIFY MEMO THREE // /////////////// - memoThreeResIdx := slices.IndexFunc(memos.Memos, func(m *apiv1.Memo) bool { return m.GetName() == memoThree.GetName() }) + memoThreeResIdx := slices.IndexFunc(memos.Memos, func(m *apipb.Memo) bool { return m.GetName() == memoThree.GetName() }) require.NotEqual(t, memoThreeResIdx, -1) memoThreeRes := memos.Memos[memoThreeResIdx] require.NotNil(t, memoThreeRes) require.Equal(t, fmt.Sprintf("users/%s", userOne.Username), memoThreeRes.GetCreator()) - require.Equal(t, apiv1.Visibility_PROTECTED, memoThreeRes.GetVisibility()) + require.Equal(t, apipb.Visibility_PROTECTED, memoThreeRes.GetVisibility()) require.Equal(t, memoThree.Content, memoThreeRes.GetContent()) require.Empty(t, memoThreeRes.Attachments) require.Empty(t, memoThreeRes.Relations) @@ -545,7 +545,7 @@ func TestListMemos(t *testing.T) { // verify memoThree's reactions require.Len(t, memoThreeRes.Reactions, 2) // userOne's reaction - userOneReactionIdx := slices.IndexFunc(memoThreeRes.Reactions, func(r *apiv1.Reaction) bool { return r.GetCreator() == fmt.Sprintf("users/%s", userOne.Username) }) + userOneReactionIdx := slices.IndexFunc(memoThreeRes.Reactions, func(r *apipb.Reaction) bool { return r.GetCreator() == fmt.Sprintf("users/%s", userOne.Username) }) require.NotEqual(t, userOneReactionIdx, -1) userOneReaction := memoThreeRes.Reactions[userOneReactionIdx] @@ -553,7 +553,7 @@ func TestListMemos(t *testing.T) { require.Equal(t, "❤️", userOneReaction.ReactionType) // userTwo's reaction - userTwoReactionIdx := slices.IndexFunc(memoThreeRes.Reactions, func(r *apiv1.Reaction) bool { return r.GetCreator() == fmt.Sprintf("users/%s", userTwo.Username) }) + userTwoReactionIdx := slices.IndexFunc(memoThreeRes.Reactions, func(r *apipb.Reaction) bool { return r.GetCreator() == fmt.Sprintf("users/%s", userTwo.Username) }) require.NotEqual(t, userTwoReactionIdx, -1) userTwoReaction := memoThreeRes.Reactions[userTwoReactionIdx] @@ -571,28 +571,28 @@ func TestListMemosTimeOrderBy(t *testing.T) { require.NoError(t, err) userCtx := ts.CreateUserContext(ctx, user.ID) - memoEarlyCreateLateUpdate, err := ts.Service.CreateMemo(userCtx, &apiv1.CreateMemoRequest{ - Memo: &apiv1.Memo{ + memoEarlyCreateLateUpdate, err := ts.Service.CreateMemo(userCtx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{ Content: "early create late update", - Visibility: apiv1.Visibility_PRIVATE, + Visibility: apipb.Visibility_PRIVATE, CreateTime: timestamppb.New(time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC)), UpdateTime: timestamppb.New(time.Date(2020, 1, 3, 0, 0, 0, 0, time.UTC)), }, }) require.NoError(t, err) - memoMiddleCreateEarlyUpdate, err := ts.Service.CreateMemo(userCtx, &apiv1.CreateMemoRequest{ - Memo: &apiv1.Memo{ + memoMiddleCreateEarlyUpdate, err := ts.Service.CreateMemo(userCtx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{ Content: "middle create early update", - Visibility: apiv1.Visibility_PRIVATE, + Visibility: apipb.Visibility_PRIVATE, CreateTime: timestamppb.New(time.Date(2020, 1, 2, 0, 0, 0, 0, time.UTC)), UpdateTime: timestamppb.New(time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC)), }, }) require.NoError(t, err) - memoLateCreateMiddleUpdate, err := ts.Service.CreateMemo(userCtx, &apiv1.CreateMemoRequest{ - Memo: &apiv1.Memo{ + memoLateCreateMiddleUpdate, err := ts.Service.CreateMemo(userCtx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{ Content: "late create middle update", - Visibility: apiv1.Visibility_PRIVATE, + Visibility: apipb.Visibility_PRIVATE, CreateTime: timestamppb.New(time.Date(2020, 1, 3, 0, 0, 0, 0, time.UTC)), UpdateTime: timestamppb.New(time.Date(2020, 1, 2, 0, 0, 0, 0, time.UTC)), }, @@ -653,7 +653,7 @@ func TestListMemosTimeOrderBy(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { - resp, err := ts.Service.ListMemos(userCtx, &apiv1.ListMemosRequest{ + resp, err := ts.Service.ListMemos(userCtx, &apipb.ListMemosRequest{ PageSize: 10, OrderBy: test.orderBy, }) @@ -668,7 +668,7 @@ func TestListMemosTimeOrderBy(t *testing.T) { }) } - _, err = ts.Service.ListMemos(userCtx, &apiv1.ListMemosRequest{ + _, err = ts.Service.ListMemos(userCtx, &apipb.ListMemosRequest{ PageSize: 10, OrderBy: "display_time desc", }) @@ -689,17 +689,17 @@ func TestListMemosSkipsReactionsWithMissingCreators(t *testing.T) { require.NoError(t, err) reactorCtx := ts.CreateUserContext(ctx, reactor.ID) - memo, err := ts.Service.CreateMemo(ownerCtx, &apiv1.CreateMemoRequest{ - Memo: &apiv1.Memo{ + memo, err := ts.Service.CreateMemo(ownerCtx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{ Content: "memo with orphan reaction", - Visibility: apiv1.Visibility_PUBLIC, + Visibility: apipb.Visibility_PUBLIC, }, }) require.NoError(t, err) - _, err = ts.Service.UpsertMemoReaction(reactorCtx, &apiv1.UpsertMemoReactionRequest{ - Name: memo.Name, - Reaction: &apiv1.Reaction{ + _, err = ts.Service.UpsertMemoReaction(reactorCtx, &apipb.UpsertMemoReactionRequest{ + Parent: memo.Name, + Reaction: &apipb.Reaction{ ReactionType: "👍", }, }) @@ -708,7 +708,7 @@ func TestListMemosSkipsReactionsWithMissingCreators(t *testing.T) { _, err = ts.Store.DeleteUser(ctx, &store.DeleteUser{ID: reactor.ID}) require.NoError(t, err) - resp, err := ts.Service.ListMemos(ownerCtx, &apiv1.ListMemosRequest{PageSize: 10}) + resp, err := ts.Service.ListMemos(ownerCtx, &apipb.ListMemosRequest{PageSize: 10}) require.NoError(t, err) require.Len(t, resp.Memos, 1) require.Equal(t, memo.Name, resp.Memos[0].Name) @@ -729,18 +729,18 @@ func TestListMemosSkipsMemosWithMissingCreators(t *testing.T) { require.NoError(t, err) orphanCtx := ts.CreateUserContext(ctx, orphanCreator.ID) - ownerMemo, err := ts.Service.CreateMemo(ownerCtx, &apiv1.CreateMemoRequest{ - Memo: &apiv1.Memo{ + ownerMemo, err := ts.Service.CreateMemo(ownerCtx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{ Content: "owner memo", - Visibility: apiv1.Visibility_PRIVATE, + Visibility: apipb.Visibility_PRIVATE, }, }) require.NoError(t, err) - _, err = ts.Service.CreateMemo(orphanCtx, &apiv1.CreateMemoRequest{ - Memo: &apiv1.Memo{ + _, err = ts.Service.CreateMemo(orphanCtx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{ Content: "orphan memo", - Visibility: apiv1.Visibility_PUBLIC, + Visibility: apipb.Visibility_PUBLIC, }, }) require.NoError(t, err) @@ -748,7 +748,7 @@ func TestListMemosSkipsMemosWithMissingCreators(t *testing.T) { _, err = ts.Store.DeleteUser(ctx, &store.DeleteUser{ID: orphanCreator.ID}) require.NoError(t, err) - resp, err := ts.Service.ListMemos(ownerCtx, &apiv1.ListMemosRequest{PageSize: 10}) + resp, err := ts.Service.ListMemos(ownerCtx, &apipb.ListMemosRequest{PageSize: 10}) require.NoError(t, err) require.Len(t, resp.Memos, 1) require.Equal(t, ownerMemo.Name, resp.Memos[0].Name) @@ -768,19 +768,19 @@ func TestListMemoCommentsSkipsCommentsWithMissingCreators(t *testing.T) { require.NoError(t, err) commenterCtx := ts.CreateUserContext(ctx, commenter.ID) - memo, err := ts.Service.CreateMemo(ownerCtx, &apiv1.CreateMemoRequest{ - Memo: &apiv1.Memo{ + memo, err := ts.Service.CreateMemo(ownerCtx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{ Content: "memo with comment", - Visibility: apiv1.Visibility_PUBLIC, + Visibility: apipb.Visibility_PUBLIC, }, }) require.NoError(t, err) - _, err = ts.Service.CreateMemoComment(commenterCtx, &apiv1.CreateMemoCommentRequest{ - Name: memo.Name, - Comment: &apiv1.Memo{ + _, err = ts.Service.CreateMemoComment(commenterCtx, &apipb.CreateMemoCommentRequest{ + Parent: memo.Name, + Comment: &apipb.Memo{ Content: "comment to orphan", - Visibility: apiv1.Visibility_PUBLIC, + Visibility: apipb.Visibility_PUBLIC, }, }) require.NoError(t, err) @@ -788,9 +788,9 @@ func TestListMemoCommentsSkipsCommentsWithMissingCreators(t *testing.T) { _, err = ts.Store.DeleteUser(ctx, &store.DeleteUser{ID: commenter.ID}) require.NoError(t, err) - resp, err := ts.Service.ListMemoComments(ownerCtx, &apiv1.ListMemoCommentsRequest{Name: memo.Name}) + resp, err := ts.Service.ListMemoComments(ownerCtx, &apipb.ListMemoCommentsRequest{Parent: memo.Name}) require.NoError(t, err) - require.Empty(t, resp.Memos) + require.Empty(t, resp.Comments) } func TestCreateMemoCommentRejectsSelfReference(t *testing.T) { @@ -801,20 +801,20 @@ func TestCreateMemoCommentRejectsSelfReference(t *testing.T) { owner, err := ts.CreateRegularUser(ctx, "comment-self-reference-owner") require.NoError(t, err) ownerCtx := ts.CreateUserContext(ctx, owner.ID) - memo, err := ts.Service.CreateMemo(ownerCtx, &apiv1.CreateMemoRequest{Memo: &apiv1.Memo{ - Content: "comment context", Visibility: apiv1.Visibility_PUBLIC, + memo, err := ts.Service.CreateMemo(ownerCtx, &apipb.CreateMemoRequest{Memo: &apipb.Memo{ + Content: "comment context", Visibility: apipb.Visibility_PUBLIC, }}) require.NoError(t, err) - _, err = ts.Service.CreateMemoComment(ownerCtx, &apiv1.CreateMemoCommentRequest{ - Name: memo.Name, + _, err = ts.Service.CreateMemoComment(ownerCtx, &apipb.CreateMemoCommentRequest{ + Parent: memo.Name, CommentId: memo.Name[len("memos/"):], - Comment: &apiv1.Memo{Content: "self reference", Visibility: apiv1.Visibility_PUBLIC}, + Comment: &apipb.Memo{Content: "self reference", Visibility: apipb.Visibility_PUBLIC}, }) require.Equal(t, codes.InvalidArgument, status.Code(err)) - comments, err := ts.Service.ListMemoComments(ownerCtx, &apiv1.ListMemoCommentsRequest{Name: memo.Name}) + comments, err := ts.Service.ListMemoComments(ownerCtx, &apipb.ListMemoCommentsRequest{Parent: memo.Name}) require.NoError(t, err) - require.Empty(t, comments.Memos) + require.Empty(t, comments.Comments) } func TestUpdateMemoPlacementAndAudienceContract(t *testing.T) { @@ -829,128 +829,128 @@ func TestUpdateMemoPlacementAndAudienceContract(t *testing.T) { sourceAdminCtx := ts.CreateUserContext(ctx, sourceAdmin.ID) authorCtx := ts.CreateUserContext(ctx, author.ID) - source, err := ts.Service.CreateSpace(sourceAdminCtx, &apiv1.CreateSpaceRequest{ + source, err := ts.Service.CreateSpace(sourceAdminCtx, &apipb.CreateSpaceRequest{ SpaceId: "placement-source", - Space: &apiv1.Space{Title: "Placement Source"}, + Space: &apipb.Space{Title: "Placement Source"}, }) require.NoError(t, err) - target, err := ts.Service.CreateSpace(authorCtx, &apiv1.CreateSpaceRequest{ + target, err := ts.Service.CreateSpace(authorCtx, &apipb.CreateSpaceRequest{ SpaceId: "placement-target", - Space: &apiv1.Space{Title: "Placement Target"}, + Space: &apipb.Space{Title: "Placement Target"}, }) require.NoError(t, err) - invitation, err := ts.Service.CreateSpaceInvitation(sourceAdminCtx, &apiv1.CreateSpaceInvitationRequest{ + invitation, err := ts.Service.CreateSpaceInvitation(sourceAdminCtx, &apipb.CreateSpaceInvitationRequest{ Parent: source.Name, - SpaceInvitation: &apiv1.SpaceInvitation{ + SpaceInvitation: &apipb.SpaceInvitation{ Invitee: "users/" + author.Username, - Role: apiv1.SpaceMember_USER, + Role: apipb.SpaceMember_USER, }, }) require.NoError(t, err) - _, err = ts.Service.AcceptSpaceInvitation(authorCtx, &apiv1.AcceptSpaceInvitationRequest{Name: invitation.Name}) + _, err = ts.Service.AcceptSpaceInvitation(authorCtx, &apipb.AcceptSpaceInvitationRequest{Name: invitation.Name}) require.NoError(t, err) - protectedMemo, err := ts.Service.CreateMemo(authorCtx, &apiv1.CreateMemoRequest{Memo: &apiv1.Memo{ - Content: "assign without audience change", Visibility: apiv1.Visibility_PROTECTED, + protectedMemo, err := ts.Service.CreateMemo(authorCtx, &apipb.CreateMemoRequest{Memo: &apipb.Memo{ + Content: "assign without audience change", Visibility: apipb.Visibility_PROTECTED, }}) require.NoError(t, err) sourceName := source.Name - protectedMemo, err = ts.Service.UpdateMemo(authorCtx, &apiv1.UpdateMemoRequest{ - Memo: &apiv1.Memo{Name: protectedMemo.Name, Space: &sourceName}, + protectedMemo, err = ts.Service.UpdateMemo(authorCtx, &apipb.UpdateMemoRequest{ + Memo: &apipb.Memo{Name: protectedMemo.Name, Space: &sourceName}, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"space"}}, }) require.NoError(t, err) require.Equal(t, source.Name, protectedMemo.GetSpace()) - require.Equal(t, apiv1.Visibility_PROTECTED, protectedMemo.Visibility, "assigning must preserve the memo audience") + require.Equal(t, apipb.Visibility_PROTECTED, protectedMemo.Visibility, "assigning must preserve the memo audience") - _, err = ts.Service.UpdateMemo(sourceAdminCtx, &apiv1.UpdateMemoRequest{ - Memo: &apiv1.Memo{Name: protectedMemo.Name}, + _, err = ts.Service.UpdateMemo(sourceAdminCtx, &apipb.UpdateMemoRequest{ + Memo: &apipb.Memo{Name: protectedMemo.Name}, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"space"}}, }) require.Equal(t, codes.PermissionDenied, status.Code(err), "Space administrators cannot change another author's memo placement") - protectedMemo, err = ts.Service.GetMemo(authorCtx, &apiv1.GetMemoRequest{Name: protectedMemo.Name}) + protectedMemo, err = ts.Service.GetMemo(authorCtx, &apipb.GetMemoRequest{Name: protectedMemo.Name}) require.NoError(t, err) require.Equal(t, source.Name, protectedMemo.GetSpace()) - unassigned, err := ts.Service.CreateMemo(authorCtx, &apiv1.CreateMemoRequest{Memo: &apiv1.Memo{ - Content: "unassigned", Visibility: apiv1.Visibility_PRIVATE, + unassigned, err := ts.Service.CreateMemo(authorCtx, &apipb.CreateMemoRequest{Memo: &apipb.Memo{ + Content: "unassigned", Visibility: apipb.Visibility_PRIVATE, }}) require.NoError(t, err) - _, err = ts.Service.UpdateMemo(authorCtx, &apiv1.UpdateMemoRequest{ - Memo: &apiv1.Memo{Name: unassigned.Name, Visibility: apiv1.Visibility_SPACE}, + _, err = ts.Service.UpdateMemo(authorCtx, &apipb.UpdateMemoRequest{ + Memo: &apipb.Memo{Name: unassigned.Name, Visibility: apipb.Visibility_SPACE}, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"visibility"}}, }) require.Equal(t, codes.InvalidArgument, status.Code(err), "SPACE visibility requires an assigned Space") - spaceMembersMemo, err := ts.Service.CreateMemo(authorCtx, &apiv1.CreateMemoRequest{Memo: &apiv1.Memo{ - Content: "members audience", Visibility: apiv1.Visibility_SPACE, Space: &sourceName, + spaceMembersMemo, err := ts.Service.CreateMemo(authorCtx, &apipb.CreateMemoRequest{Memo: &apipb.Memo{ + Content: "members audience", Visibility: apipb.Visibility_SPACE, Space: &sourceName, }}) require.NoError(t, err) targetName := target.Name - _, err = ts.Service.UpdateMemo(authorCtx, &apiv1.UpdateMemoRequest{ - Memo: &apiv1.Memo{Name: spaceMembersMemo.Name, Space: &targetName}, + _, err = ts.Service.UpdateMemo(authorCtx, &apipb.UpdateMemoRequest{ + Memo: &apipb.Memo{Name: spaceMembersMemo.Name, Space: &targetName}, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"space"}}, }) require.Equal(t, codes.InvalidArgument, status.Code(err), "moving SPACE visibility requires an explicit audience confirmation") - _, err = ts.Service.UpdateMemo(authorCtx, &apiv1.UpdateMemoRequest{ - Memo: &apiv1.Memo{Name: spaceMembersMemo.Name}, + _, err = ts.Service.UpdateMemo(authorCtx, &apipb.UpdateMemoRequest{ + Memo: &apipb.Memo{Name: spaceMembersMemo.Name}, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"space"}}, }) require.Equal(t, codes.InvalidArgument, status.Code(err), "unassigning SPACE visibility requires a replacement audience") - spaceMembersMemo, err = ts.Service.UpdateMemo(authorCtx, &apiv1.UpdateMemoRequest{ - Memo: &apiv1.Memo{Name: spaceMembersMemo.Name, Visibility: apiv1.Visibility_PRIVATE}, + spaceMembersMemo, err = ts.Service.UpdateMemo(authorCtx, &apipb.UpdateMemoRequest{ + Memo: &apipb.Memo{Name: spaceMembersMemo.Name, Visibility: apipb.Visibility_PRIVATE}, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"space", "visibility"}}, }) require.NoError(t, err) require.Nil(t, spaceMembersMemo.Space) - require.Equal(t, apiv1.Visibility_PRIVATE, spaceMembersMemo.Visibility) + require.Equal(t, apipb.Visibility_PRIVATE, spaceMembersMemo.Visibility) - moveMemo, err := ts.Service.CreateMemo(authorCtx, &apiv1.CreateMemoRequest{Memo: &apiv1.Memo{ - Content: "move original", Visibility: apiv1.Visibility_PUBLIC, Space: &sourceName, + moveMemo, err := ts.Service.CreateMemo(authorCtx, &apipb.CreateMemoRequest{Memo: &apipb.Memo{ + Content: "move original", Visibility: apipb.Visibility_PUBLIC, Space: &sourceName, }}) require.NoError(t, err) - withdrawMemo, err := ts.Service.CreateMemo(authorCtx, &apiv1.CreateMemoRequest{Memo: &apiv1.Memo{ - Content: "withdraw original", Visibility: apiv1.Visibility_PUBLIC, Space: &sourceName, + withdrawMemo, err := ts.Service.CreateMemo(authorCtx, &apipb.CreateMemoRequest{Memo: &apipb.Memo{ + Content: "withdraw original", Visibility: apipb.Visibility_PUBLIC, Space: &sourceName, }}) require.NoError(t, err) - membersOnlyMemo, err := ts.Service.CreateMemo(authorCtx, &apiv1.CreateMemoRequest{Memo: &apiv1.Memo{ - Content: "members only", Visibility: apiv1.Visibility_SPACE, Space: &sourceName, + membersOnlyMemo, err := ts.Service.CreateMemo(authorCtx, &apipb.CreateMemoRequest{Memo: &apipb.Memo{ + Content: "members only", Visibility: apipb.Visibility_SPACE, Space: &sourceName, }}) require.NoError(t, err) - _, err = ts.Service.DeleteSpaceMember(sourceAdminCtx, &apiv1.DeleteSpaceMemberRequest{ + _, err = ts.Service.DeleteSpaceMember(sourceAdminCtx, &apipb.DeleteSpaceMemberRequest{ Name: source.Name + "/members/" + author.Username, }) require.NoError(t, err) - _, err = ts.Service.GetMemo(authorCtx, &apiv1.GetMemoRequest{Name: membersOnlyMemo.Name}) + _, err = ts.Service.GetMemo(authorCtx, &apipb.GetMemoRequest{Name: membersOnlyMemo.Name}) require.Equal(t, codes.PermissionDenied, status.Code(err), "the author loses SPACE audience read access after leaving the Space") - _, err = ts.Service.UpdateMemo(authorCtx, &apiv1.UpdateMemoRequest{ - Memo: &apiv1.Memo{Name: moveMemo.Name, Space: &targetName, Content: "smuggled content"}, + _, err = ts.Service.UpdateMemo(authorCtx, &apipb.UpdateMemoRequest{ + Memo: &apipb.Memo{Name: moveMemo.Name, Space: &targetName, Content: "smuggled content"}, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"space", "content"}}, }) require.Equal(t, codes.PermissionDenied, status.Code(err), "a removed author cannot smuggle content into a lifecycle move") - unchangedMove, err := ts.Service.GetMemo(authorCtx, &apiv1.GetMemoRequest{Name: moveMemo.Name}) + unchangedMove, err := ts.Service.GetMemo(authorCtx, &apipb.GetMemoRequest{Name: moveMemo.Name}) require.NoError(t, err) require.Equal(t, "move original", unchangedMove.Content) require.Equal(t, source.Name, unchangedMove.GetSpace()) - moved, err := ts.Service.UpdateMemo(authorCtx, &apiv1.UpdateMemoRequest{ - Memo: &apiv1.Memo{Name: moveMemo.Name, Space: &targetName}, + moved, err := ts.Service.UpdateMemo(authorCtx, &apipb.UpdateMemoRequest{ + Memo: &apipb.Memo{Name: moveMemo.Name, Space: &targetName}, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"space"}}, }) require.NoError(t, err) require.Equal(t, target.Name, moved.GetSpace()) require.Equal(t, "move original", moved.Content) - require.Equal(t, apiv1.Visibility_PUBLIC, moved.Visibility) + require.Equal(t, apipb.Visibility_PUBLIC, moved.Visibility) - withdrawn, err := ts.Service.UpdateMemo(authorCtx, &apiv1.UpdateMemoRequest{ - Memo: &apiv1.Memo{Name: withdrawMemo.Name}, + withdrawn, err := ts.Service.UpdateMemo(authorCtx, &apipb.UpdateMemoRequest{ + Memo: &apipb.Memo{Name: withdrawMemo.Name}, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"space"}}, }) require.NoError(t, err) require.Nil(t, withdrawn.Space) require.Equal(t, "withdraw original", withdrawn.Content) - require.Equal(t, apiv1.Visibility_PUBLIC, withdrawn.Visibility) + require.Equal(t, apipb.Visibility_PUBLIC, withdrawn.Visibility) } func TestListMemoCommentsPaginates(t *testing.T) { @@ -963,33 +963,33 @@ func TestListMemoCommentsPaginates(t *testing.T) { require.NoError(t, err) ownerCtx := ts.CreateUserContext(ctx, owner.ID) - memo, err := ts.Service.CreateMemo(ownerCtx, &apiv1.CreateMemoRequest{ - Memo: &apiv1.Memo{ + memo, err := ts.Service.CreateMemo(ownerCtx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{ Content: "memo with paged comments", - Visibility: apiv1.Visibility_PUBLIC, + Visibility: apipb.Visibility_PUBLIC, }, }) require.NoError(t, err) for i := 0; i < 3; i++ { - _, err = ts.Service.CreateMemoComment(ownerCtx, &apiv1.CreateMemoCommentRequest{ - Name: memo.Name, - Comment: &apiv1.Memo{ + _, err = ts.Service.CreateMemoComment(ownerCtx, &apipb.CreateMemoCommentRequest{ + Parent: memo.Name, + Comment: &apipb.Memo{ Content: fmt.Sprintf("comment %d", i), - Visibility: apiv1.Visibility_PUBLIC, + Visibility: apipb.Visibility_PUBLIC, }, }) require.NoError(t, err) } - firstPage, err := ts.Service.ListMemoComments(ownerCtx, &apiv1.ListMemoCommentsRequest{Name: memo.Name, PageSize: 2}) + firstPage, err := ts.Service.ListMemoComments(ownerCtx, &apipb.ListMemoCommentsRequest{Parent: memo.Name, PageSize: 2}) require.NoError(t, err) - require.Len(t, firstPage.Memos, 2) + require.Len(t, firstPage.Comments, 2) require.NotEmpty(t, firstPage.NextPageToken) - secondPage, err := ts.Service.ListMemoComments(ownerCtx, &apiv1.ListMemoCommentsRequest{Name: memo.Name, PageToken: firstPage.NextPageToken}) + secondPage, err := ts.Service.ListMemoComments(ownerCtx, &apipb.ListMemoCommentsRequest{Parent: memo.Name, PageToken: firstPage.NextPageToken}) require.NoError(t, err) - require.Len(t, secondPage.Memos, 1) + require.Len(t, secondPage.Comments, 1) require.Empty(t, secondPage.NextPageToken) } @@ -1001,36 +1001,36 @@ func TestListMemoCommentsFiltersArchivedBeforePagination(t *testing.T) { owner, err := ts.CreateRegularUser(ctx, "comment-archive-page-owner") require.NoError(t, err) ownerCtx := ts.CreateUserContext(ctx, owner.ID) - memo, err := ts.Service.CreateMemo(ownerCtx, &apiv1.CreateMemoRequest{Memo: &apiv1.Memo{ + memo, err := ts.Service.CreateMemo(ownerCtx, &apipb.CreateMemoRequest{Memo: &apipb.Memo{ Content: "memo with archived comments", - Visibility: apiv1.Visibility_PUBLIC, + Visibility: apipb.Visibility_PUBLIC, }}) require.NoError(t, err) - comments := make([]*apiv1.Memo, 0, 5) + comments := make([]*apipb.Memo, 0, 5) for i := 0; i < 5; i++ { - comment, err := ts.Service.CreateMemoComment(ownerCtx, &apiv1.CreateMemoCommentRequest{ - Name: memo.Name, - Comment: &apiv1.Memo{Content: fmt.Sprintf("comment %d", i)}, + comment, err := ts.Service.CreateMemoComment(ownerCtx, &apipb.CreateMemoCommentRequest{ + Parent: memo.Name, + Comment: &apipb.Memo{Content: fmt.Sprintf("comment %d", i)}, }) require.NoError(t, err) comments = append(comments, comment) } for _, comment := range comments[3:] { - _, err := ts.Service.UpdateMemo(ownerCtx, &apiv1.UpdateMemoRequest{ - Memo: &apiv1.Memo{Name: comment.Name, State: apiv1.State_ARCHIVED}, + _, err := ts.Service.UpdateMemo(ownerCtx, &apipb.UpdateMemoRequest{ + Memo: &apipb.Memo{Name: comment.Name, State: apipb.State_ARCHIVED}, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"state"}}, }) require.NoError(t, err) } - firstPage, err := ts.Service.ListMemoComments(ownerCtx, &apiv1.ListMemoCommentsRequest{Name: memo.Name, PageSize: 2}) + firstPage, err := ts.Service.ListMemoComments(ownerCtx, &apipb.ListMemoCommentsRequest{Parent: memo.Name, PageSize: 2}) require.NoError(t, err) - require.Len(t, firstPage.Memos, 2) + require.Len(t, firstPage.Comments, 2) require.NotEmpty(t, firstPage.NextPageToken) - secondPage, err := ts.Service.ListMemoComments(ownerCtx, &apiv1.ListMemoCommentsRequest{Name: memo.Name, PageToken: firstPage.NextPageToken}) + secondPage, err := ts.Service.ListMemoComments(ownerCtx, &apipb.ListMemoCommentsRequest{Parent: memo.Name, PageToken: firstPage.NextPageToken}) require.NoError(t, err) - require.Len(t, secondPage.Memos, 1) + require.Len(t, secondPage.Comments, 1) require.Empty(t, secondPage.NextPageToken) } @@ -1044,40 +1044,40 @@ func TestMemoCommentKeepsIndependentVisibilityAndAllowsAudienceUpdates(t *testin require.NoError(t, err) ownerCtx := ts.CreateUserContext(ctx, owner.ID) - parent, err := ts.Service.CreateMemo(ownerCtx, &apiv1.CreateMemoRequest{ - Memo: &apiv1.Memo{ + parent, err := ts.Service.CreateMemo(ownerCtx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{ Content: "private parent", - Visibility: apiv1.Visibility_PRIVATE, + Visibility: apipb.Visibility_PRIVATE, }, }) require.NoError(t, err) - comment, err := ts.Service.CreateMemoComment(ownerCtx, &apiv1.CreateMemoCommentRequest{ - Name: parent.Name, - Comment: &apiv1.Memo{ + comment, err := ts.Service.CreateMemoComment(ownerCtx, &apipb.CreateMemoCommentRequest{ + Parent: parent.Name, + Comment: &apipb.Memo{ Content: "client requested public comment", - Visibility: apiv1.Visibility_PUBLIC, + Visibility: apipb.Visibility_PUBLIC, }, }) require.NoError(t, err) - require.Equal(t, apiv1.Visibility_PUBLIC, comment.Visibility) + require.Equal(t, apipb.Visibility_PUBLIC, comment.Visibility) - _, err = ts.Service.UpdateMemo(ownerCtx, &apiv1.UpdateMemoRequest{ - Memo: &apiv1.Memo{ + _, err = ts.Service.UpdateMemo(ownerCtx, &apipb.UpdateMemoRequest{ + Memo: &apipb.Memo{ Name: comment.Name, - Visibility: apiv1.Visibility_PROTECTED, + Visibility: apipb.Visibility_PROTECTED, }, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"visibility"}}, }) require.NoError(t, err) - updatedComment, err := ts.Service.GetMemo(ownerCtx, &apiv1.GetMemoRequest{Name: comment.Name}) + updatedComment, err := ts.Service.GetMemo(ownerCtx, &apipb.GetMemoRequest{Name: comment.Name}) require.NoError(t, err) - require.Equal(t, apiv1.Visibility_PROTECTED, updatedComment.Visibility) + require.Equal(t, apipb.Visibility_PROTECTED, updatedComment.Visibility) - unchangedParent, err := ts.Service.GetMemo(ownerCtx, &apiv1.GetMemoRequest{Name: parent.Name}) + unchangedParent, err := ts.Service.GetMemo(ownerCtx, &apipb.GetMemoRequest{Name: parent.Name}) require.NoError(t, err) - require.Equal(t, apiv1.Visibility_PRIVATE, unchangedParent.Visibility) + require.Equal(t, apipb.Visibility_PRIVATE, unchangedParent.Visibility) } func TestCreateMemoCommentDoesNotRevealArchivedPrivateMemo(t *testing.T) { @@ -1091,26 +1091,26 @@ func TestCreateMemoCommentDoesNotRevealArchivedPrivateMemo(t *testing.T) { other, err := ts.CreateRegularUser(ctx, "archived-comment-other") require.NoError(t, err) otherCtx := ts.CreateUserContext(ctx, other.ID) - parent, err := ts.Service.CreateMemo(ownerCtx, &apiv1.CreateMemoRequest{Memo: &apiv1.Memo{ + parent, err := ts.Service.CreateMemo(ownerCtx, &apipb.CreateMemoRequest{Memo: &apipb.Memo{ Content: "archived private parent", - Visibility: apiv1.Visibility_PRIVATE, + Visibility: apipb.Visibility_PRIVATE, }}) require.NoError(t, err) - _, err = ts.Service.UpdateMemo(ownerCtx, &apiv1.UpdateMemoRequest{ - Memo: &apiv1.Memo{Name: parent.Name, State: apiv1.State_ARCHIVED}, + _, err = ts.Service.UpdateMemo(ownerCtx, &apipb.UpdateMemoRequest{ + Memo: &apipb.Memo{Name: parent.Name, State: apipb.State_ARCHIVED}, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"state"}}, }) require.NoError(t, err) - _, err = ts.Service.CreateMemoComment(otherCtx, &apiv1.CreateMemoCommentRequest{ - Name: parent.Name, - Comment: &apiv1.Memo{Content: "should not reveal parent state"}, + _, err = ts.Service.CreateMemoComment(otherCtx, &apipb.CreateMemoCommentRequest{ + Parent: parent.Name, + Comment: &apipb.Memo{Content: "should not reveal parent state"}, }) require.Equal(t, codes.NotFound, status.Code(err)) - _, err = ts.Service.CreateMemoComment(ownerCtx, &apiv1.CreateMemoCommentRequest{ - Name: parent.Name, - Comment: &apiv1.Memo{Content: "owner still cannot comment"}, + _, err = ts.Service.CreateMemoComment(ownerCtx, &apipb.CreateMemoCommentRequest{ + Parent: parent.Name, + Comment: &apipb.Memo{Content: "owner still cannot comment"}, }) require.Equal(t, codes.FailedPrecondition, status.Code(err)) } @@ -1129,46 +1129,46 @@ func TestGetMemoCommentUsesMemoLocalReadAccessAndConcealsContext(t *testing.T) { require.NoError(t, err) otherCtx := ts.CreateUserContext(ctx, other.ID) - parent, err := ts.Service.CreateMemo(ownerCtx, &apiv1.CreateMemoRequest{ - Memo: &apiv1.Memo{ + parent, err := ts.Service.CreateMemo(ownerCtx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{ Content: "private parent for legacy comment", - Visibility: apiv1.Visibility_PRIVATE, + Visibility: apipb.Visibility_PRIVATE, }, }) require.NoError(t, err) - createdComment, err := ts.Service.CreateMemoComment(ownerCtx, &apiv1.CreateMemoCommentRequest{ - Name: parent.Name, - Comment: &apiv1.Memo{ + createdComment, err := ts.Service.CreateMemoComment(ownerCtx, &apipb.CreateMemoCommentRequest{ + Parent: parent.Name, + Comment: &apipb.Memo{ Content: "public comment with private context", - Visibility: apiv1.Visibility_PUBLIC, + Visibility: apipb.Visibility_PUBLIC, }, }) require.NoError(t, err) commentName := createdComment.Name - publicComment, err := ts.Service.GetMemo(ctx, &apiv1.GetMemoRequest{Name: commentName}) + publicComment, err := ts.Service.GetMemo(ctx, &apipb.GetMemoRequest{Name: commentName}) require.NoError(t, err) require.Equal(t, parent.Name, publicComment.GetParent(), "parent identity remains available without granting access") - otherComment, err := ts.Service.GetMemo(otherCtx, &apiv1.GetMemoRequest{Name: commentName}) + otherComment, err := ts.Service.GetMemo(otherCtx, &apipb.GetMemoRequest{Name: commentName}) require.NoError(t, err) require.Equal(t, parent.Name, otherComment.GetParent(), "parent identity is independent of parent readability") - comment, err := ts.Service.GetMemo(ownerCtx, &apiv1.GetMemoRequest{Name: commentName}) + comment, err := ts.Service.GetMemo(ownerCtx, &apipb.GetMemoRequest{Name: commentName}) require.NoError(t, err) require.Equal(t, parent.Name, comment.GetParent()) - _, err = ts.Service.ListMemoComments(ctx, &apiv1.ListMemoCommentsRequest{Name: parent.Name}) + _, err = ts.Service.ListMemoComments(ctx, &apipb.ListMemoCommentsRequest{Parent: parent.Name}) require.Equal(t, codes.Unauthenticated, status.Code(err)) - _, err = ts.Service.ListMemoComments(otherCtx, &apiv1.ListMemoCommentsRequest{Name: parent.Name}) + _, err = ts.Service.ListMemoComments(otherCtx, &apipb.ListMemoCommentsRequest{Parent: parent.Name}) require.Equal(t, codes.PermissionDenied, status.Code(err)) - comments, err := ts.Service.ListMemoComments(ownerCtx, &apiv1.ListMemoCommentsRequest{Name: parent.Name}) + comments, err := ts.Service.ListMemoComments(ownerCtx, &apipb.ListMemoCommentsRequest{Parent: parent.Name}) require.NoError(t, err) - require.Len(t, comments.Memos, 1) - require.Equal(t, commentName, comments.Memos[0].Name) + require.Len(t, comments.Comments, 1) + require.Equal(t, commentName, comments.Comments[0].Name) } func TestAssignedMemoCommentListingUsesMemoLocalReadAccess(t *testing.T) { @@ -1194,40 +1194,40 @@ func TestAssignedMemoCommentListingUsesMemoLocalReadAccess(t *testing.T) { Role: store.SpaceMemberRoleAdmin, }, owner.ID) require.NoError(t, err) - contextMemo, err := ts.Service.CreateMemo(ownerCtx, &apiv1.CreateMemoRequest{Memo: &apiv1.Memo{ + contextMemo, err := ts.Service.CreateMemo(ownerCtx, &apipb.CreateMemoRequest{Memo: &apipb.Memo{ Content: "assigned public comment context", - Visibility: apiv1.Visibility_PUBLIC, + Visibility: apipb.Visibility_PUBLIC, Space: ptr("spaces/" + space.UID), }}) require.NoError(t, err) - comment, err := ts.Service.CreateMemoComment(memberCtx, &apiv1.CreateMemoCommentRequest{ - Name: contextMemo.Name, - Comment: &apiv1.Memo{ + comment, err := ts.Service.CreateMemoComment(memberCtx, &apipb.CreateMemoCommentRequest{ + Parent: contextMemo.Name, + Comment: &apipb.Memo{ Content: "public independently readable comment", - Visibility: apiv1.Visibility_PUBLIC, + Visibility: apipb.Visibility_PUBLIC, }, }) require.NoError(t, err) - comments, err := ts.Service.ListMemoComments(memberCtx, &apiv1.ListMemoCommentsRequest{Name: contextMemo.Name}) + comments, err := ts.Service.ListMemoComments(memberCtx, &apipb.ListMemoCommentsRequest{Parent: contextMemo.Name}) require.NoError(t, err) - require.Len(t, comments.Memos, 1) - require.Equal(t, comment.Name, comments.Memos[0].Name) + require.Len(t, comments.Comments, 1) + require.Equal(t, comment.Name, comments.Comments[0].Name) - comments, err = ts.Service.ListMemoComments(ctx, &apiv1.ListMemoCommentsRequest{Name: contextMemo.Name}) + comments, err = ts.Service.ListMemoComments(ctx, &apipb.ListMemoCommentsRequest{Parent: contextMemo.Name}) require.NoError(t, err) - require.Len(t, comments.Memos, 1, "anonymous access follows the PUBLIC context and comment audiences") - comments, err = ts.Service.ListMemoComments(outsiderCtx, &apiv1.ListMemoCommentsRequest{Name: contextMemo.Name}) + require.Len(t, comments.Comments, 1, "anonymous access follows the PUBLIC context and comment audiences") + comments, err = ts.Service.ListMemoComments(outsiderCtx, &apipb.ListMemoCommentsRequest{Parent: contextMemo.Name}) require.NoError(t, err) - require.Len(t, comments.Memos, 1, "Space placement adds no read gate for a signed-in non-member") - directComment, err := ts.Service.GetMemo(outsiderCtx, &apiv1.GetMemoRequest{Name: comment.Name}) + require.Len(t, comments.Comments, 1, "Space placement adds no read gate for a signed-in non-member") + directComment, err := ts.Service.GetMemo(outsiderCtx, &apipb.GetMemoRequest{Name: comment.Name}) require.NoError(t, err, "the comment memo remains independently readable") require.Equal(t, contextMemo.Name, directComment.GetParent(), "two-endpoint relation projection remains memo-local") require.NoError(t, ts.Store.DeleteSpaceMember(ctx, &store.DeleteSpaceMember{SpaceID: space.ID, UserID: owner.ID}, owner.ID)) - comments, err = ts.Service.ListMemoComments(ownerCtx, &apiv1.ListMemoCommentsRequest{Name: contextMemo.Name}) + comments, err = ts.Service.ListMemoComments(ownerCtx, &apipb.ListMemoCommentsRequest{Parent: contextMemo.Name}) require.NoError(t, err) - require.Len(t, comments.Memos, 1, "the removed author still reads PUBLIC memos through their audience") + require.Len(t, comments.Comments, 1, "the removed author still reads PUBLIC memos through their audience") } func TestMemoCommentDoesNotFollowParentVisibilityChanges(t *testing.T) { @@ -1238,29 +1238,29 @@ func TestMemoCommentDoesNotFollowParentVisibilityChanges(t *testing.T) { owner, err := ts.CreateRegularUser(ctx, "dynamic-comment-owner") require.NoError(t, err) ownerCtx := ts.CreateUserContext(ctx, owner.ID) - parent, err := ts.Service.CreateMemo(ownerCtx, &apiv1.CreateMemoRequest{Memo: &apiv1.Memo{ + parent, err := ts.Service.CreateMemo(ownerCtx, &apipb.CreateMemoRequest{Memo: &apipb.Memo{ Content: "initially private", - Visibility: apiv1.Visibility_PRIVATE, + Visibility: apipb.Visibility_PRIVATE, }}) require.NoError(t, err) - comment, err := ts.Service.CreateMemoComment(ownerCtx, &apiv1.CreateMemoCommentRequest{ - Name: parent.Name, - Comment: &apiv1.Memo{Content: "independently private"}, + comment, err := ts.Service.CreateMemoComment(ownerCtx, &apipb.CreateMemoCommentRequest{ + Parent: parent.Name, + Comment: &apipb.Memo{Content: "independently private"}, }) require.NoError(t, err) - require.Equal(t, apiv1.Visibility_PRIVATE, comment.Visibility) + require.Equal(t, apipb.Visibility_PRIVATE, comment.Visibility) - _, err = ts.Service.UpdateMemo(ownerCtx, &apiv1.UpdateMemoRequest{ - Memo: &apiv1.Memo{Name: parent.Name, Visibility: apiv1.Visibility_PUBLIC}, + _, err = ts.Service.UpdateMemo(ownerCtx, &apipb.UpdateMemoRequest{ + Memo: &apipb.Memo{Name: parent.Name, Visibility: apipb.Visibility_PUBLIC}, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"visibility"}}, }) require.NoError(t, err) - _, err = ts.Service.GetMemo(ctx, &apiv1.GetMemoRequest{Name: comment.Name}) + _, err = ts.Service.GetMemo(ctx, &apipb.GetMemoRequest{Name: comment.Name}) require.Equal(t, codes.Unauthenticated, status.Code(err)) - comments, err := ts.Service.ListMemoComments(ctx, &apiv1.ListMemoCommentsRequest{Name: parent.Name}) + comments, err := ts.Service.ListMemoComments(ctx, &apipb.ListMemoCommentsRequest{Parent: parent.Name}) require.NoError(t, err) - require.Empty(t, comments.Memos, "context visibility must not expand a private comment") + require.Empty(t, comments.Comments, "context visibility must not expand a private comment") } func TestGlobalFeedExcludesCommentsAndDeletesThemWithContext(t *testing.T) { @@ -1271,26 +1271,26 @@ func TestGlobalFeedExcludesCommentsAndDeletesThemWithContext(t *testing.T) { owner, err := ts.CreateRegularUser(ctx, "comment-feed-owner") require.NoError(t, err) ownerCtx := ts.CreateUserContext(ctx, owner.ID) - contextMemo, err := ts.Service.CreateMemo(ownerCtx, &apiv1.CreateMemoRequest{Memo: &apiv1.Memo{ - Content: "context", Visibility: apiv1.Visibility_PUBLIC, + contextMemo, err := ts.Service.CreateMemo(ownerCtx, &apipb.CreateMemoRequest{Memo: &apipb.Memo{ + Content: "context", Visibility: apipb.Visibility_PUBLIC, }}) require.NoError(t, err) - comment, err := ts.Service.CreateMemoComment(ownerCtx, &apiv1.CreateMemoCommentRequest{ - Name: contextMemo.Name, Comment: &apiv1.Memo{Content: "independent comment", Visibility: apiv1.Visibility_PUBLIC}, + comment, err := ts.Service.CreateMemoComment(ownerCtx, &apipb.CreateMemoCommentRequest{ + Parent: contextMemo.Name, Comment: &apipb.Memo{Content: "independent comment", Visibility: apipb.Visibility_PUBLIC}, }) require.NoError(t, err) - feed, err := ts.Service.ListMemos(ownerCtx, &apiv1.ListMemosRequest{PageSize: 20}) + feed, err := ts.Service.ListMemos(ownerCtx, &apipb.ListMemosRequest{PageSize: 20}) require.NoError(t, err) require.Len(t, feed.Memos, 1) require.Equal(t, contextMemo.Name, feed.Memos[0].Name) - _, err = ts.Service.DeleteMemo(ownerCtx, &apiv1.DeleteMemoRequest{Name: contextMemo.Name}) + _, err = ts.Service.DeleteMemo(ownerCtx, &apipb.DeleteMemoRequest{Name: contextMemo.Name}) require.NoError(t, err) - _, err = ts.Service.GetMemo(ownerCtx, &apiv1.GetMemoRequest{Name: comment.Name}) + _, err = ts.Service.GetMemo(ownerCtx, &apipb.GetMemoRequest{Name: comment.Name}) require.Equal(t, codes.NotFound, status.Code(err)) - feed, err = ts.Service.ListMemos(ownerCtx, &apiv1.ListMemosRequest{PageSize: 20}) + feed, err = ts.Service.ListMemos(ownerCtx, &apipb.ListMemosRequest{PageSize: 20}) require.NoError(t, err) require.Empty(t, feed.Memos) } @@ -1315,10 +1315,10 @@ func TestCreateMemoWithCustomTimestamps(t *testing.T) { customUpdateTime := time.Date(2020, 1, 2, 12, 0, 0, 0, time.UTC) // Test 1: Create a memo with custom create_time - memoWithCreateTime, err := ts.Service.CreateMemo(userCtx, &apiv1.CreateMemoRequest{ - Memo: &apiv1.Memo{ + memoWithCreateTime, err := ts.Service.CreateMemo(userCtx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{ Content: "This memo has a custom creation time", - Visibility: apiv1.Visibility_PRIVATE, + Visibility: apipb.Visibility_PRIVATE, CreateTime: timestamppb.New(customCreateTime), }, }) @@ -1327,10 +1327,10 @@ func TestCreateMemoWithCustomTimestamps(t *testing.T) { require.Equal(t, customCreateTime.Unix(), memoWithCreateTime.CreateTime.AsTime().Unix(), "create_time should match the custom timestamp") // Test 2: Create a memo with custom update_time - memoWithUpdateTime, err := ts.Service.CreateMemo(userCtx, &apiv1.CreateMemoRequest{ - Memo: &apiv1.Memo{ + memoWithUpdateTime, err := ts.Service.CreateMemo(userCtx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{ Content: "This memo has a custom update time", - Visibility: apiv1.Visibility_PRIVATE, + Visibility: apipb.Visibility_PRIVATE, UpdateTime: timestamppb.New(customUpdateTime), }, }) @@ -1339,10 +1339,10 @@ func TestCreateMemoWithCustomTimestamps(t *testing.T) { require.Equal(t, customUpdateTime.Unix(), memoWithUpdateTime.UpdateTime.AsTime().Unix(), "update_time should match the custom timestamp") // Test 3: Create a memo with all custom timestamps - memoWithAllTimestamps, err := ts.Service.CreateMemo(userCtx, &apiv1.CreateMemoRequest{ - Memo: &apiv1.Memo{ + memoWithAllTimestamps, err := ts.Service.CreateMemo(userCtx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{ Content: "This memo has all custom timestamps", - Visibility: apiv1.Visibility_PRIVATE, + Visibility: apipb.Visibility_PRIVATE, CreateTime: timestamppb.New(customCreateTime), UpdateTime: timestamppb.New(customUpdateTime), }, @@ -1353,21 +1353,21 @@ func TestCreateMemoWithCustomTimestamps(t *testing.T) { require.Equal(t, customUpdateTime.Unix(), memoWithAllTimestamps.UpdateTime.AsTime().Unix(), "update_time should match the custom timestamp") // Test 4: Create a comment (memo relation) with custom timestamps - parentMemo, err := ts.Service.CreateMemo(userCtx, &apiv1.CreateMemoRequest{ - Memo: &apiv1.Memo{ + parentMemo, err := ts.Service.CreateMemo(userCtx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{ Content: "This is the parent memo", - Visibility: apiv1.Visibility_PRIVATE, + Visibility: apipb.Visibility_PRIVATE, }, }) require.NoError(t, err) require.NotNil(t, parentMemo) customCommentCreateTime := time.Date(2021, 6, 15, 10, 30, 0, 0, time.UTC) - comment, err := ts.Service.CreateMemoComment(userCtx, &apiv1.CreateMemoCommentRequest{ - Name: parentMemo.Name, - Comment: &apiv1.Memo{ + comment, err := ts.Service.CreateMemoComment(userCtx, &apipb.CreateMemoCommentRequest{ + Parent: parentMemo.Name, + Comment: &apipb.Memo{ Content: "This is a comment with custom create time", - Visibility: apiv1.Visibility_PRIVATE, + Visibility: apipb.Visibility_PRIVATE, CreateTime: timestamppb.New(customCommentCreateTime), }, }) @@ -1376,10 +1376,10 @@ func TestCreateMemoWithCustomTimestamps(t *testing.T) { require.Equal(t, customCommentCreateTime.Unix(), comment.CreateTime.AsTime().Unix(), "comment create_time should match the custom timestamp") // Test 5: Verify that memos without custom timestamps still get auto-generated ones - memoWithoutTimestamps, err := ts.Service.CreateMemo(userCtx, &apiv1.CreateMemoRequest{ - Memo: &apiv1.Memo{ + memoWithoutTimestamps, err := ts.Service.CreateMemo(userCtx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{ Content: "This memo has auto-generated timestamps", - Visibility: apiv1.Visibility_PRIVATE, + Visibility: apipb.Visibility_PRIVATE, }, }) require.NoError(t, err) diff --git a/server/api/v1/test/memo_share_service_test.go b/server/api/test/memo_share_service_test.go similarity index 75% rename from server/api/v1/test/memo_share_service_test.go rename to server/api/test/memo_share_service_test.go index 01d5b7c02..803696518 100644 --- a/server/api/v1/test/memo_share_service_test.go +++ b/server/api/test/memo_share_service_test.go @@ -10,7 +10,7 @@ import ( "google.golang.org/grpc/codes" "google.golang.org/grpc/status" - apiv1 "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" "github.com/usememos/memos/store" ) @@ -28,38 +28,38 @@ func TestDeleteMemoShare_VerifiesShareBelongsToMemo(t *testing.T) { userOneCtx := ts.CreateUserContext(ctx, userOne.ID) userTwoCtx := ts.CreateUserContext(ctx, userTwo.ID) - memoOne, err := ts.Service.CreateMemo(userOneCtx, &apiv1.CreateMemoRequest{ - Memo: &apiv1.Memo{ + memoOne, err := ts.Service.CreateMemo(userOneCtx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{ Content: "memo one", - Visibility: apiv1.Visibility_PRIVATE, + Visibility: apipb.Visibility_PRIVATE, }, }) require.NoError(t, err) - memoTwo, err := ts.Service.CreateMemo(userTwoCtx, &apiv1.CreateMemoRequest{ - Memo: &apiv1.Memo{ + memoTwo, err := ts.Service.CreateMemo(userTwoCtx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{ Content: "memo two", - Visibility: apiv1.Visibility_PRIVATE, + Visibility: apipb.Visibility_PRIVATE, }, }) require.NoError(t, err) - share, err := ts.Service.CreateMemoShare(userTwoCtx, &apiv1.CreateMemoShareRequest{ + share, err := ts.Service.CreateMemoShare(userTwoCtx, &apipb.CreateMemoShareRequest{ Parent: memoTwo.Name, - MemoShare: &apiv1.MemoShare{}, + MemoShare: &apipb.MemoShare{}, }) require.NoError(t, err) shareToken := share.Name[strings.LastIndex(share.Name, "/")+1:] forgedName := memoOne.Name + "/shares/" + shareToken - _, err = ts.Service.DeleteMemoShare(userOneCtx, &apiv1.DeleteMemoShareRequest{ + _, err = ts.Service.DeleteMemoShare(userOneCtx, &apipb.DeleteMemoShareRequest{ Name: forgedName, }) require.Error(t, err) require.Equal(t, codes.NotFound, status.Code(err)) - sharedMemo, err := ts.Service.GetSharedMemo(ctx, &apiv1.GetSharedMemoRequest{ + sharedMemo, err := ts.Service.GetSharedMemo(ctx, &apipb.GetSharedMemoRequest{ ShareToken: shareToken, }) require.NoError(t, err) @@ -82,16 +82,16 @@ func TestDeleteMemoShare_RevalidatesSpaceWriteAuthority(t *testing.T) { SpaceID: space.ID, UserID: admin.ID, Role: store.SpaceMemberRoleAdmin, }, owner.ID) require.NoError(t, err) - memo, err := ts.Service.CreateMemo(ownerCtx, &apiv1.CreateMemoRequest{Memo: &apiv1.Memo{ - Content: "assigned share", Visibility: apiv1.Visibility_PUBLIC, Space: ptr("spaces/" + space.UID), + memo, err := ts.Service.CreateMemo(ownerCtx, &apipb.CreateMemoRequest{Memo: &apipb.Memo{ + Content: "assigned share", Visibility: apipb.Visibility_PUBLIC, Space: ptr("spaces/" + space.UID), }}) require.NoError(t, err) - share, err := ts.Service.CreateMemoShare(ownerCtx, &apiv1.CreateMemoShareRequest{Parent: memo.Name, MemoShare: &apiv1.MemoShare{}}) + share, err := ts.Service.CreateMemoShare(ownerCtx, &apipb.CreateMemoShareRequest{Parent: memo.Name, MemoShare: &apipb.MemoShare{}}) require.NoError(t, err) shareToken := share.Name[strings.LastIndex(share.Name, "/")+1:] require.NoError(t, ts.Store.DeleteSpaceMember(ctx, &store.DeleteSpaceMember{SpaceID: space.ID, UserID: owner.ID}, admin.ID)) - _, err = ts.Service.DeleteMemoShare(ownerCtx, &apiv1.DeleteMemoShareRequest{Name: share.Name}) + _, err = ts.Service.DeleteMemoShare(ownerCtx, &apipb.DeleteMemoShareRequest{Name: share.Name}) require.Equal(t, codes.PermissionDenied, status.Code(err)) requireSharePresent(ctx, t, ts, shareToken) @@ -99,7 +99,7 @@ func TestDeleteMemoShare_RevalidatesSpaceWriteAuthority(t *testing.T) { SpaceID: space.ID, UserID: owner.ID, Role: store.SpaceMemberRoleUser, }, admin.ID) require.NoError(t, err) - _, err = ts.Service.DeleteMemoShare(ownerCtx, &apiv1.DeleteMemoShareRequest{Name: share.Name}) + _, err = ts.Service.DeleteMemoShare(ownerCtx, &apipb.DeleteMemoShareRequest{Name: share.Name}) require.NoError(t, err) storedShare, err := ts.Store.GetMemoShare(ctx, &store.FindMemoShare{UID: &shareToken}) require.NoError(t, err) @@ -117,9 +117,9 @@ func TestDeleteMemoShare_OwnerCanRevokeLegacyAdminShare(t *testing.T) { require.NoError(t, err) ownerCtx := ts.CreateUserContext(ctx, owner.ID) - memo, err := ts.Service.CreateMemo(ownerCtx, &apiv1.CreateMemoRequest{Memo: &apiv1.Memo{ + memo, err := ts.Service.CreateMemo(ownerCtx, &apipb.CreateMemoRequest{Memo: &apipb.Memo{ Content: "memo with a legacy admin share", - Visibility: apiv1.Visibility_PRIVATE, + Visibility: apipb.Visibility_PRIVATE, }}) require.NoError(t, err) memoUID := strings.TrimPrefix(memo.Name, "memos/") @@ -135,7 +135,7 @@ func TestDeleteMemoShare_OwnerCanRevokeLegacyAdminShare(t *testing.T) { }) require.NoError(t, err) - _, err = ts.Service.DeleteMemoShare(ownerCtx, &apiv1.DeleteMemoShareRequest{ + _, err = ts.Service.DeleteMemoShare(ownerCtx, &apipb.DeleteMemoShareRequest{ Name: memo.Name + "/shares/" + shareToken, }) require.NoError(t, err) @@ -143,7 +143,7 @@ func TestDeleteMemoShare_OwnerCanRevokeLegacyAdminShare(t *testing.T) { share, err := ts.Store.GetMemoShare(ctx, &store.FindMemoShare{UID: ptr(shareToken)}) require.NoError(t, err) require.Nil(t, share) - _, err = ts.Service.GetSharedMemo(ctx, &apiv1.GetSharedMemoRequest{ShareToken: shareToken}) + _, err = ts.Service.GetSharedMemo(ctx, &apipb.GetSharedMemoRequest{ShareToken: shareToken}) require.Equal(t, codes.NotFound, status.Code(err)) } @@ -157,31 +157,31 @@ func TestGetSharedMemo_IncludesReactions(t *testing.T) { require.NoError(t, err) userCtx := ts.CreateUserContext(ctx, user.ID) - memo, err := ts.Service.CreateMemo(userCtx, &apiv1.CreateMemoRequest{ - Memo: &apiv1.Memo{ + memo, err := ts.Service.CreateMemo(userCtx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{ Content: "memo with reactions", - Visibility: apiv1.Visibility_PRIVATE, + Visibility: apipb.Visibility_PRIVATE, }, }) require.NoError(t, err) - reaction, err := ts.Service.UpsertMemoReaction(userCtx, &apiv1.UpsertMemoReactionRequest{ - Name: memo.Name, - Reaction: &apiv1.Reaction{ + reaction, err := ts.Service.UpsertMemoReaction(userCtx, &apipb.UpsertMemoReactionRequest{ + Parent: memo.Name, + Reaction: &apipb.Reaction{ ReactionType: "👍", }, }) require.NoError(t, err) require.NotNil(t, reaction) - share, err := ts.Service.CreateMemoShare(userCtx, &apiv1.CreateMemoShareRequest{ + share, err := ts.Service.CreateMemoShare(userCtx, &apipb.CreateMemoShareRequest{ Parent: memo.Name, - MemoShare: &apiv1.MemoShare{}, + MemoShare: &apipb.MemoShare{}, }) require.NoError(t, err) shareToken := share.Name[strings.LastIndex(share.Name, "/")+1:] - sharedMemo, err := ts.Service.GetSharedMemo(ctx, &apiv1.GetSharedMemoRequest{ + sharedMemo, err := ts.Service.GetSharedMemo(ctx, &apipb.GetSharedMemoRequest{ ShareToken: shareToken, }) require.NoError(t, err) @@ -200,36 +200,36 @@ func TestCreateMemoShare_SharesOnlyTheCommentMemo(t *testing.T) { require.NoError(t, err) userCtx := ts.CreateUserContext(ctx, user.ID) - parent, err := ts.Service.CreateMemo(userCtx, &apiv1.CreateMemoRequest{ - Memo: &apiv1.Memo{ + parent, err := ts.Service.CreateMemo(userCtx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{ Content: "parent must not be shared", - Visibility: apiv1.Visibility_PRIVATE, + Visibility: apipb.Visibility_PRIVATE, }, }) require.NoError(t, err) - comment, err := ts.Service.CreateMemoComment(userCtx, &apiv1.CreateMemoCommentRequest{ - Name: parent.Name, - Comment: &apiv1.Memo{ + comment, err := ts.Service.CreateMemoComment(userCtx, &apipb.CreateMemoCommentRequest{ + Parent: parent.Name, + Comment: &apipb.Memo{ Content: "only this memo is shared", - Visibility: apiv1.Visibility_PRIVATE, + Visibility: apipb.Visibility_PRIVATE, }, }) require.NoError(t, err) require.NotEmpty(t, comment.Relations) - regularMemo, err := ts.Service.GetMemo(userCtx, &apiv1.GetMemoRequest{Name: comment.Name}) + regularMemo, err := ts.Service.GetMemo(userCtx, &apipb.GetMemoRequest{Name: comment.Name}) require.NoError(t, err) require.NotEmpty(t, regularMemo.GetParent()) require.NotEmpty(t, regularMemo.Relations) - share, err := ts.Service.CreateMemoShare(userCtx, &apiv1.CreateMemoShareRequest{ + share, err := ts.Service.CreateMemoShare(userCtx, &apipb.CreateMemoShareRequest{ Parent: comment.Name, - MemoShare: &apiv1.MemoShare{}, + MemoShare: &apipb.MemoShare{}, }) require.NoError(t, err) shareToken := share.Name[strings.LastIndex(share.Name, "/")+1:] - sharedComment, err := ts.Service.GetSharedMemo(ctx, &apiv1.GetSharedMemoRequest{ShareToken: shareToken}) + sharedComment, err := ts.Service.GetSharedMemo(ctx, &apipb.GetSharedMemoRequest{ShareToken: shareToken}) require.NoError(t, err) require.Equal(t, comment.Name, sharedComment.Name) require.Equal(t, "only this memo is shared", sharedComment.Content) @@ -251,25 +251,25 @@ func TestGetSharedMemo_SkipsReactionsWithMissingCreators(t *testing.T) { require.NoError(t, err) reactorCtx := ts.CreateUserContext(ctx, reactor.ID) - memo, err := ts.Service.CreateMemo(ownerCtx, &apiv1.CreateMemoRequest{ - Memo: &apiv1.Memo{ + memo, err := ts.Service.CreateMemo(ownerCtx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{ Content: "memo with orphan share reaction", - Visibility: apiv1.Visibility_PUBLIC, + Visibility: apipb.Visibility_PUBLIC, }, }) require.NoError(t, err) - _, err = ts.Service.UpsertMemoReaction(reactorCtx, &apiv1.UpsertMemoReactionRequest{ - Name: memo.Name, - Reaction: &apiv1.Reaction{ + _, err = ts.Service.UpsertMemoReaction(reactorCtx, &apipb.UpsertMemoReactionRequest{ + Parent: memo.Name, + Reaction: &apipb.Reaction{ ReactionType: "👍", }, }) require.NoError(t, err) - share, err := ts.Service.CreateMemoShare(ownerCtx, &apiv1.CreateMemoShareRequest{ + share, err := ts.Service.CreateMemoShare(ownerCtx, &apipb.CreateMemoShareRequest{ Parent: memo.Name, - MemoShare: &apiv1.MemoShare{}, + MemoShare: &apipb.MemoShare{}, }) require.NoError(t, err) @@ -277,7 +277,7 @@ func TestGetSharedMemo_SkipsReactionsWithMissingCreators(t *testing.T) { require.NoError(t, err) shareToken := share.Name[strings.LastIndex(share.Name, "/")+1:] - sharedMemo, err := ts.Service.GetSharedMemo(ctx, &apiv1.GetSharedMemoRequest{ + sharedMemo, err := ts.Service.GetSharedMemo(ctx, &apipb.GetSharedMemoRequest{ ShareToken: shareToken, }) require.NoError(t, err) @@ -290,7 +290,7 @@ func TestGetSharedMemo_ReturnsNotFoundForUnknownShare(t *testing.T) { ts := NewTestService(t) defer ts.Cleanup() - _, err := ts.Service.GetSharedMemo(ctx, &apiv1.GetSharedMemoRequest{ + _, err := ts.Service.GetSharedMemo(ctx, &apipb.GetSharedMemoRequest{ ShareToken: "missing-share-token", }) require.Error(t, err) @@ -307,10 +307,10 @@ func TestGetSharedMemo_ReturnsNotFoundForExpiredShare(t *testing.T) { require.NoError(t, err) userCtx := ts.CreateUserContext(ctx, user.ID) - memo, err := ts.Service.CreateMemo(userCtx, &apiv1.CreateMemoRequest{ - Memo: &apiv1.Memo{ + memo, err := ts.Service.CreateMemo(userCtx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{ Content: "memo with expired share", - Visibility: apiv1.Visibility_PRIVATE, + Visibility: apipb.Visibility_PRIVATE, }, }) require.NoError(t, err) @@ -324,7 +324,7 @@ func TestGetSharedMemo_ReturnsNotFoundForExpiredShare(t *testing.T) { }) require.NoError(t, err) - _, err = ts.Service.GetSharedMemo(ctx, &apiv1.GetSharedMemoRequest{ + _, err = ts.Service.GetSharedMemo(ctx, &apipb.GetSharedMemoRequest{ ShareToken: expiredShare.UID, }) require.Error(t, err) @@ -341,17 +341,17 @@ func TestGetSharedMemo_ReturnsNotFoundForArchivedMemo(t *testing.T) { require.NoError(t, err) userCtx := ts.CreateUserContext(ctx, user.ID) - memoResp, err := ts.Service.CreateMemo(userCtx, &apiv1.CreateMemoRequest{ - Memo: &apiv1.Memo{ + memoResp, err := ts.Service.CreateMemo(userCtx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{ Content: "memo that will be archived", - Visibility: apiv1.Visibility_PRIVATE, + Visibility: apipb.Visibility_PRIVATE, }, }) require.NoError(t, err) - share, err := ts.Service.CreateMemoShare(userCtx, &apiv1.CreateMemoShareRequest{ + share, err := ts.Service.CreateMemoShare(userCtx, &apipb.CreateMemoShareRequest{ Parent: memoResp.Name, - MemoShare: &apiv1.MemoShare{}, + MemoShare: &apipb.MemoShare{}, }) require.NoError(t, err) @@ -368,7 +368,7 @@ func TestGetSharedMemo_ReturnsNotFoundForArchivedMemo(t *testing.T) { require.NoError(t, err) shareToken := share.Name[strings.LastIndex(share.Name, "/")+1:] - _, err = ts.Service.GetSharedMemo(ctx, &apiv1.GetSharedMemoRequest{ + _, err = ts.Service.GetSharedMemo(ctx, &apipb.GetSharedMemoRequest{ ShareToken: shareToken, }) require.Error(t, err) diff --git a/server/api/v1/test/memo_timestamp_test.go b/server/api/test/memo_timestamp_test.go similarity index 79% rename from server/api/v1/test/memo_timestamp_test.go rename to server/api/test/memo_timestamp_test.go index 74e5e835a..b267866be 100644 --- a/server/api/v1/test/memo_timestamp_test.go +++ b/server/api/test/memo_timestamp_test.go @@ -11,7 +11,7 @@ import ( "google.golang.org/protobuf/types/known/fieldmaskpb" "google.golang.org/protobuf/types/known/timestamppb" - apiv1 "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" "github.com/usememos/memos/store" ) @@ -30,27 +30,27 @@ func TestUpdateMemoTimestamps(t *testing.T) { for _, tc := range []struct { name string paths []string - patch *apiv1.Memo + patch *apipb.Memo wantCreate int64 wantUpdate int64 autoUpdate bool }{ - {"creation only", []string{"create_time"}, &apiv1.Memo{CreateTime: ×tamppb.Timestamp{Seconds: customCreate}}, customCreate, originalUpdate, false}, - {"modification only", []string{"update_time"}, &apiv1.Memo{UpdateTime: ×tamppb.Timestamp{Seconds: customUpdate}}, originalCreate, customUpdate, false}, - {"both", []string{"create_time", "update_time"}, &apiv1.Memo{CreateTime: ×tamppb.Timestamp{Seconds: customCreate}, UpdateTime: ×tamppb.Timestamp{Seconds: customUpdate}}, customCreate, customUpdate, false}, - {"with content", []string{"content", "create_time", "update_time"}, &apiv1.Memo{Content: "changed", CreateTime: ×tamppb.Timestamp{Seconds: customCreate}, UpdateTime: ×tamppb.Timestamp{Seconds: customUpdate}}, customCreate, customUpdate, false}, - {"automatic modification", []string{"content", "update_time"}, &apiv1.Memo{Content: "changed"}, originalCreate, 0, true}, - {"unmasked timestamps ignored", []string{"content"}, &apiv1.Memo{Content: "changed", CreateTime: ×tamppb.Timestamp{Seconds: customCreate}, UpdateTime: ×tamppb.Timestamp{Seconds: customUpdate}}, originalCreate, originalUpdate, false}, + {"creation only", []string{"create_time"}, &apipb.Memo{CreateTime: ×tamppb.Timestamp{Seconds: customCreate}}, customCreate, originalUpdate, false}, + {"modification only", []string{"update_time"}, &apipb.Memo{UpdateTime: ×tamppb.Timestamp{Seconds: customUpdate}}, originalCreate, customUpdate, false}, + {"both", []string{"create_time", "update_time"}, &apipb.Memo{CreateTime: ×tamppb.Timestamp{Seconds: customCreate}, UpdateTime: ×tamppb.Timestamp{Seconds: customUpdate}}, customCreate, customUpdate, false}, + {"with content", []string{"content", "create_time", "update_time"}, &apipb.Memo{Content: "changed", CreateTime: ×tamppb.Timestamp{Seconds: customCreate}, UpdateTime: ×tamppb.Timestamp{Seconds: customUpdate}}, customCreate, customUpdate, false}, + {"automatic modification", []string{"content", "update_time"}, &apipb.Memo{Content: "changed"}, originalCreate, 0, true}, + {"unmasked timestamps ignored", []string{"content"}, &apipb.Memo{Content: "changed", CreateTime: ×tamppb.Timestamp{Seconds: customCreate}, UpdateTime: ×tamppb.Timestamp{Seconds: customUpdate}}, originalCreate, originalUpdate, false}, } { t.Run(tc.name, func(t *testing.T) { - memo, err := ts.Service.CreateMemo(userCtx, &apiv1.CreateMemoRequest{Memo: &apiv1.Memo{ - Content: "original", Visibility: apiv1.Visibility_PRIVATE, + memo, err := ts.Service.CreateMemo(userCtx, &apipb.CreateMemoRequest{Memo: &apipb.Memo{ + Content: "original", Visibility: apipb.Visibility_PRIVATE, CreateTime: ×tamppb.Timestamp{Seconds: originalCreate}, UpdateTime: ×tamppb.Timestamp{Seconds: originalUpdate}, }}) require.NoError(t, err) tc.patch.Name = memo.Name beforeSec := time.Now().Unix() - updated, err := ts.Service.UpdateMemo(userCtx, &apiv1.UpdateMemoRequest{ + updated, err := ts.Service.UpdateMemo(userCtx, &apipb.UpdateMemoRequest{ Memo: tc.patch, UpdateMask: &fieldmaskpb.FieldMask{Paths: tc.paths}, }) require.NoError(t, err) @@ -62,7 +62,7 @@ func TestUpdateMemoTimestamps(t *testing.T) { require.Equal(t, tc.wantUpdate, updated.UpdateTime.Seconds) } // Verify both API reads and raw stored values, not just the update response. - fetched, err := ts.Service.GetMemo(userCtx, &apiv1.GetMemoRequest{Name: memo.Name}) + fetched, err := ts.Service.GetMemo(userCtx, &apipb.GetMemoRequest{Name: memo.Name}) require.NoError(t, err) require.Equal(t, updated.CreateTime, fetched.CreateTime) require.Equal(t, updated.UpdateTime, fetched.UpdateTime) @@ -87,8 +87,8 @@ func TestUpdateMemoRejectsInvalidTimestamps(t *testing.T) { user, err := ts.CreateRegularUser(ctx, "invalid-timestamp-owner") require.NoError(t, err) userCtx := ts.CreateUserContext(ctx, user.ID) - memo, err := ts.Service.CreateMemo(userCtx, &apiv1.CreateMemoRequest{Memo: &apiv1.Memo{ - Content: "original", Visibility: apiv1.Visibility_PRIVATE, + memo, err := ts.Service.CreateMemo(userCtx, &apipb.CreateMemoRequest{Memo: &apipb.Memo{ + Content: "original", Visibility: apipb.Visibility_PRIVATE, }}) require.NoError(t, err) for _, path := range []string{"create_time", "update_time"} { @@ -102,17 +102,17 @@ func TestUpdateMemoRejectsInvalidTimestamps(t *testing.T) { continue // An omitted update_time explicitly requests the current time. } t.Run(path+"/"+timestamp.String(), func(t *testing.T) { - patch := &apiv1.Memo{Name: memo.Name, Content: "must not persist"} + patch := &apipb.Memo{Name: memo.Name, Content: "must not persist"} if path == "create_time" { patch.CreateTime = timestamp } else { patch.UpdateTime = timestamp } - _, err := ts.Service.UpdateMemo(userCtx, &apiv1.UpdateMemoRequest{ + _, err := ts.Service.UpdateMemo(userCtx, &apipb.UpdateMemoRequest{ Memo: patch, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"content", path}}, }) require.Equal(t, codes.InvalidArgument, status.Code(err)) - fetched, err := ts.Service.GetMemo(userCtx, &apiv1.GetMemoRequest{Name: memo.Name}) + fetched, err := ts.Service.GetMemo(userCtx, &apipb.GetMemoRequest{Name: memo.Name}) require.NoError(t, err) require.Equal(t, memo.Content, fetched.Content) require.Equal(t, memo.CreateTime, fetched.CreateTime) diff --git a/server/api/v1/test/memo_view_icon_test.go b/server/api/test/memo_view_icon_test.go similarity index 67% rename from server/api/v1/test/memo_view_icon_test.go rename to server/api/test/memo_view_icon_test.go index e7d8e8b37..81a6c8143 100644 --- a/server/api/v1/test/memo_view_icon_test.go +++ b/server/api/test/memo_view_icon_test.go @@ -10,7 +10,7 @@ import ( "google.golang.org/protobuf/proto" "google.golang.org/protobuf/types/known/fieldmaskpb" - v1pb "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" ) func TestMemoViewIconLifecycle(t *testing.T) { @@ -23,16 +23,16 @@ func TestMemoViewIconLifecycle(t *testing.T) { require.NoError(t, err) ownerCtx := ts.CreateUserContext(ctx, owner.ID) parent := "users/" + owner.Username - emoji := &v1pb.MemoView_Icon{Value: &v1pb.MemoView_Icon_Emoji{Emoji: "👩🏽‍🌾"}} - request := &v1pb.CreateMemoViewRequest{ + emoji := &apipb.MemoView_Icon{Value: &apipb.MemoView_Icon_Emoji{Emoji: "👩🏽‍🌾"}} + request := &apipb.CreateMemoViewRequest{ Parent: parent, - MemoView: &v1pb.MemoView{Title: "Garden", Filter: "pinned", Icon: emoji}, + MemoView: &apipb.MemoView{Title: "Garden", Filter: "pinned", Icon: emoji}, ValidateOnly: true, } validated, err := ts.Service.CreateMemoView(ownerCtx, request) require.NoError(t, err) require.True(t, proto.Equal(emoji, validated.Icon)) - listed, err := ts.Service.ListMemoViews(ownerCtx, &v1pb.ListMemoViewsRequest{Parent: parent}) + listed, err := ts.Service.ListMemoViews(ownerCtx, &apipb.ListMemoViewsRequest{Parent: parent}) require.NoError(t, err) require.Empty(t, listed.MemoViews) @@ -40,16 +40,16 @@ func TestMemoViewIconLifecycle(t *testing.T) { view, err := ts.Service.CreateMemoView(ownerCtx, request) require.NoError(t, err) require.True(t, proto.Equal(emoji, view.Icon)) - view, err = ts.Service.UpdateMemoView(ownerCtx, &v1pb.UpdateMemoViewRequest{ - MemoView: &v1pb.MemoView{Name: view.Name, Title: "Renamed", Filter: "has_link"}, + view, err = ts.Service.UpdateMemoView(ownerCtx, &apipb.UpdateMemoViewRequest{ + MemoView: &apipb.MemoView{Name: view.Name, Title: "Renamed", Filter: "has_link"}, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"title", "filter"}}, }) require.NoError(t, err) require.True(t, proto.Equal(emoji, view.Icon), "other field updates preserve the icon") - lucide := &v1pb.MemoView_Icon{Value: &v1pb.MemoView_Icon_Lucide{Lucide: "future-icon"}} - update := &v1pb.UpdateMemoViewRequest{ - MemoView: &v1pb.MemoView{Name: view.Name, Icon: lucide}, + lucide := &apipb.MemoView_Icon{Value: &apipb.MemoView_Icon_Lucide{Lucide: "future-icon"}} + update := &apipb.UpdateMemoViewRequest{ + MemoView: &apipb.MemoView{Name: view.Name, Icon: lucide}, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"icon"}}, } _, err = ts.Service.UpdateMemoView(ts.CreateUserContext(ctx, other.ID), update) @@ -59,20 +59,20 @@ func TestMemoViewIconLifecycle(t *testing.T) { require.True(t, proto.Equal(lucide, view.Icon)) require.Equal(t, "Renamed", view.Title) require.Equal(t, "has_link", view.Filter) - fetched, err := ts.Service.GetMemoView(ownerCtx, &v1pb.GetMemoViewRequest{Name: view.Name}) + fetched, err := ts.Service.GetMemoView(ownerCtx, &apipb.GetMemoViewRequest{Name: view.Name}) require.NoError(t, err) require.True(t, proto.Equal(lucide, fetched.Icon)) - listed, err = ts.Service.ListMemoViews(ownerCtx, &v1pb.ListMemoViewsRequest{Parent: parent}) + listed, err = ts.Service.ListMemoViews(ownerCtx, &apipb.ListMemoViewsRequest{Parent: parent}) require.NoError(t, err) require.Len(t, listed.MemoViews, 1) require.True(t, proto.Equal(lucide, listed.MemoViews[0].Icon)) - for _, invalid := range []*v1pb.MemoView_Icon{ + for _, invalid := range []*apipb.MemoView_Icon{ {}, - {Value: &v1pb.MemoView_Icon_Emoji{Emoji: "🌱🌱"}}, - {Value: &v1pb.MemoView_Icon_Emoji{Emoji: ""}}, - {Value: &v1pb.MemoView_Icon_Lucide{Lucide: "BookOpen"}}, - {Value: &v1pb.MemoView_Icon_Lucide{Lucide: ""}}, + {Value: &apipb.MemoView_Icon_Emoji{Emoji: "🌱🌱"}}, + {Value: &apipb.MemoView_Icon_Emoji{Emoji: ""}}, + {Value: &apipb.MemoView_Icon_Lucide{Lucide: "BookOpen"}}, + {Value: &apipb.MemoView_Icon_Lucide{Lucide: ""}}, } { request.MemoView.Icon = invalid request.ValidateOnly = true @@ -85,7 +85,7 @@ func TestMemoViewIconLifecycle(t *testing.T) { _, err = ts.Service.UpdateMemoView(ownerCtx, update) require.Equal(t, codes.InvalidArgument, status.Code(err)) } - fetched, err = ts.Service.GetMemoView(ownerCtx, &v1pb.GetMemoViewRequest{Name: view.Name}) + fetched, err = ts.Service.GetMemoView(ownerCtx, &apipb.GetMemoViewRequest{Name: view.Name}) require.NoError(t, err) require.True(t, proto.Equal(lucide, fetched.Icon), "invalid updates leave storage unchanged") @@ -93,7 +93,7 @@ func TestMemoViewIconLifecycle(t *testing.T) { view, err = ts.Service.UpdateMemoView(ownerCtx, update) require.NoError(t, err) require.Nil(t, view.Icon) - fetched, err = ts.Service.GetMemoView(ownerCtx, &v1pb.GetMemoViewRequest{Name: view.Name}) + fetched, err = ts.Service.GetMemoView(ownerCtx, &apipb.GetMemoViewRequest{Name: view.Name}) require.NoError(t, err) require.Nil(t, fetched.Icon) } diff --git a/server/api/v1/test/memo_view_service_test.go b/server/api/test/memo_view_service_test.go similarity index 87% rename from server/api/v1/test/memo_view_service_test.go rename to server/api/test/memo_view_service_test.go index c288b94bd..084000453 100644 --- a/server/api/v1/test/memo_view_service_test.go +++ b/server/api/test/memo_view_service_test.go @@ -9,7 +9,7 @@ import ( "github.com/stretchr/testify/require" "google.golang.org/protobuf/types/known/fieldmaskpb" - v1pb "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" ) func TestListMemoViews(t *testing.T) { @@ -27,7 +27,7 @@ func TestListMemoViews(t *testing.T) { userCtx := ts.CreateUserContext(ctx, user.ID) // List memoViews (should be empty initially) - req := &v1pb.ListMemoViewsRequest{ + req := &apipb.ListMemoViewsRequest{ Parent: fmt.Sprintf("users/%s", user.Username), } @@ -50,7 +50,7 @@ func TestListMemoViews(t *testing.T) { // Set user1 context but try to list user2's memoViews userCtx := ts.CreateUserContext(ctx, user1.ID) - req := &v1pb.ListMemoViewsRequest{ + req := &apipb.ListMemoViewsRequest{ Parent: fmt.Sprintf("users/%s", user2.Username), } @@ -70,7 +70,7 @@ func TestListMemoViews(t *testing.T) { // Set user context userCtx := ts.CreateUserContext(ctx, user.ID) - req := &v1pb.ListMemoViewsRequest{ + req := &apipb.ListMemoViewsRequest{ Parent: "invalid-parent-format", } @@ -86,7 +86,7 @@ func TestListMemoViews(t *testing.T) { _, err := ts.CreateRegularUser(ctx, "testuser") require.NoError(t, err) - req := &v1pb.ListMemoViewsRequest{ + req := &apipb.ListMemoViewsRequest{ Parent: "users/testuser", } @@ -104,7 +104,7 @@ func TestListMemoViews(t *testing.T) { userCtx := ts.CreateUserContext(ctx, user.ID) - _, err = ts.Service.ListMemoViews(userCtx, &v1pb.ListMemoViewsRequest{ + _, err = ts.Service.ListMemoViews(userCtx, &apipb.ListMemoViewsRequest{ Parent: "users/1", }) require.Error(t, err) @@ -127,9 +127,9 @@ func TestGetMemoView(t *testing.T) { userCtx := ts.CreateUserContext(ctx, user.ID) // First create a memoView - createReq := &v1pb.CreateMemoViewRequest{ + createReq := &apipb.CreateMemoViewRequest{ Parent: fmt.Sprintf("users/%s", user.Username), - MemoView: &v1pb.MemoView{ + MemoView: &apipb.MemoView{ Title: "Test MemoView", Filter: "tag in [\"test\"]", }, @@ -139,7 +139,7 @@ func TestGetMemoView(t *testing.T) { require.NoError(t, err) // Now get the memoView - getReq := &v1pb.GetMemoViewRequest{ + getReq := &apipb.GetMemoViewRequest{ Name: created.Name, } @@ -163,9 +163,9 @@ func TestGetMemoView(t *testing.T) { // Create memoView as user1 user1Ctx := ts.CreateUserContext(ctx, user1.ID) - createReq := &v1pb.CreateMemoViewRequest{ + createReq := &apipb.CreateMemoViewRequest{ Parent: fmt.Sprintf("users/%s", user1.Username), - MemoView: &v1pb.MemoView{ + MemoView: &apipb.MemoView{ Title: "User1 MemoView", Filter: "tag in [\"user1\"]", }, @@ -176,7 +176,7 @@ func TestGetMemoView(t *testing.T) { // Try to get memoView as user2 user2Ctx := ts.CreateUserContext(ctx, user2.ID) - getReq := &v1pb.GetMemoViewRequest{ + getReq := &apipb.GetMemoViewRequest{ Name: created.Name, } @@ -196,7 +196,7 @@ func TestGetMemoView(t *testing.T) { // Set user context userCtx := ts.CreateUserContext(ctx, user.ID) - req := &v1pb.GetMemoViewRequest{ + req := &apipb.GetMemoViewRequest{ Name: "invalid-memo-view-name", } @@ -216,7 +216,7 @@ func TestGetMemoView(t *testing.T) { // Set user context userCtx := ts.CreateUserContext(ctx, user.ID) - req := &v1pb.GetMemoViewRequest{ + req := &apipb.GetMemoViewRequest{ Name: fmt.Sprintf("users/%s", user.Username) + "/views/nonexistent", } @@ -240,9 +240,9 @@ func TestCreateMemoView(t *testing.T) { // Set user context userCtx := ts.CreateUserContext(ctx, user.ID) - req := &v1pb.CreateMemoViewRequest{ + req := &apipb.CreateMemoViewRequest{ Parent: fmt.Sprintf("users/%s", user.Username), - MemoView: &v1pb.MemoView{ + MemoView: &apipb.MemoView{ Title: "My MemoView", Filter: "tag in [\"important\"]", }, @@ -256,7 +256,7 @@ func TestCreateMemoView(t *testing.T) { require.Contains(t, resp.Name, fmt.Sprintf("users/%s/views/", user.Username)) // Verify the memoView was created by listing - listReq := &v1pb.ListMemoViewsRequest{ + listReq := &apipb.ListMemoViewsRequest{ Parent: fmt.Sprintf("users/%s", user.Username), } @@ -279,9 +279,9 @@ func TestCreateMemoView(t *testing.T) { // Set user1 context but try to create memoView for user2 userCtx := ts.CreateUserContext(ctx, user1.ID) - req := &v1pb.CreateMemoViewRequest{ + req := &apipb.CreateMemoViewRequest{ Parent: fmt.Sprintf("users/%s", user2.Username), - MemoView: &v1pb.MemoView{ + MemoView: &apipb.MemoView{ Title: "Forbidden MemoView", Filter: "tag in [\"forbidden\"]", }, @@ -303,9 +303,9 @@ func TestCreateMemoView(t *testing.T) { // Set user context userCtx := ts.CreateUserContext(ctx, user.ID) - req := &v1pb.CreateMemoViewRequest{ + req := &apipb.CreateMemoViewRequest{ Parent: "invalid-parent", - MemoView: &v1pb.MemoView{ + MemoView: &apipb.MemoView{ Title: "Test MemoView", Filter: "tag in [\"test\"]", }, @@ -327,9 +327,9 @@ func TestCreateMemoView(t *testing.T) { // Set user context userCtx := ts.CreateUserContext(ctx, user.ID) - req := &v1pb.CreateMemoViewRequest{ + req := &apipb.CreateMemoViewRequest{ Parent: fmt.Sprintf("users/%s", user.Username), - MemoView: &v1pb.MemoView{ + MemoView: &apipb.MemoView{ Title: "Invalid Filter MemoView", Filter: "invalid||filter))syntax", }, @@ -351,9 +351,9 @@ func TestCreateMemoView(t *testing.T) { // Set user context userCtx := ts.CreateUserContext(ctx, user.ID) - req := &v1pb.CreateMemoViewRequest{ + req := &apipb.CreateMemoViewRequest{ Parent: fmt.Sprintf("users/%s", user.Username), - MemoView: &v1pb.MemoView{ + MemoView: &apipb.MemoView{ Filter: "tag in [\"test\"]", }, } @@ -379,9 +379,9 @@ func TestUpdateMemoView(t *testing.T) { userCtx := ts.CreateUserContext(ctx, user.ID) // Create a memoView first - createReq := &v1pb.CreateMemoViewRequest{ + createReq := &apipb.CreateMemoViewRequest{ Parent: fmt.Sprintf("users/%s", user.Username), - MemoView: &v1pb.MemoView{ + MemoView: &apipb.MemoView{ Title: "Original Title", Filter: "tag in [\"original\"]", }, @@ -391,8 +391,8 @@ func TestUpdateMemoView(t *testing.T) { require.NoError(t, err) // Update the memoView - updateReq := &v1pb.UpdateMemoViewRequest{ - MemoView: &v1pb.MemoView{ + updateReq := &apipb.UpdateMemoViewRequest{ + MemoView: &apipb.MemoView{ Name: created.Name, Title: "Updated Title", Filter: "tag in [\"updated\"]", @@ -422,9 +422,9 @@ func TestUpdateMemoView(t *testing.T) { // Create memoView as user1 user1Ctx := ts.CreateUserContext(ctx, user1.ID) - createReq := &v1pb.CreateMemoViewRequest{ + createReq := &apipb.CreateMemoViewRequest{ Parent: fmt.Sprintf("users/%s", user1.Username), - MemoView: &v1pb.MemoView{ + MemoView: &apipb.MemoView{ Title: "User1 MemoView", Filter: "tag in [\"user1\"]", }, @@ -435,8 +435,8 @@ func TestUpdateMemoView(t *testing.T) { // Try to update memoView as user2 user2Ctx := ts.CreateUserContext(ctx, user2.ID) - updateReq := &v1pb.UpdateMemoViewRequest{ - MemoView: &v1pb.MemoView{ + updateReq := &apipb.UpdateMemoViewRequest{ + MemoView: &apipb.MemoView{ Name: created.Name, Title: "Hacked Title", Filter: "tag in [\"hacked\"]", @@ -460,8 +460,8 @@ func TestUpdateMemoView(t *testing.T) { require.NoError(t, err) userCtx := ts.CreateUserContext(ctx, user.ID) - req := &v1pb.UpdateMemoViewRequest{ - MemoView: &v1pb.MemoView{ + req := &apipb.UpdateMemoViewRequest{ + MemoView: &apipb.MemoView{ Name: fmt.Sprintf("users/%s/views/test", user.Username), Title: "Updated Title", }, @@ -479,16 +479,16 @@ func TestUpdateMemoView(t *testing.T) { user, err := ts.CreateRegularUser(ctx, "testuser") require.NoError(t, err) userCtx := ts.CreateUserContext(ctx, user.ID) - created, err := ts.Service.CreateMemoView(userCtx, &v1pb.CreateMemoViewRequest{ + created, err := ts.Service.CreateMemoView(userCtx, &apipb.CreateMemoViewRequest{ Parent: fmt.Sprintf("users/%s", user.Username), - MemoView: &v1pb.MemoView{ + MemoView: &apipb.MemoView{ Title: "Original Title", Filter: `tag in ["original"]`, }, }) require.NoError(t, err) - _, err = ts.Service.UpdateMemoView(userCtx, &v1pb.UpdateMemoViewRequest{ + _, err = ts.Service.UpdateMemoView(userCtx, &apipb.UpdateMemoViewRequest{ MemoView: created, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"name"}}, }) @@ -500,8 +500,8 @@ func TestUpdateMemoView(t *testing.T) { ts := NewTestService(t) defer ts.Cleanup() - req := &v1pb.UpdateMemoViewRequest{ - MemoView: &v1pb.MemoView{ + req := &apipb.UpdateMemoViewRequest{ + MemoView: &apipb.MemoView{ Name: "invalid-memo-view-name", Title: "Updated Title", }, @@ -527,9 +527,9 @@ func TestUpdateMemoView(t *testing.T) { userCtx := ts.CreateUserContext(ctx, user.ID) // Create a memoView first - createReq := &v1pb.CreateMemoViewRequest{ + createReq := &apipb.CreateMemoViewRequest{ Parent: fmt.Sprintf("users/%s", user.Username), - MemoView: &v1pb.MemoView{ + MemoView: &apipb.MemoView{ Title: "Test MemoView", Filter: "tag in [\"test\"]", }, @@ -539,8 +539,8 @@ func TestUpdateMemoView(t *testing.T) { require.NoError(t, err) // Try to update with invalid filter - updateReq := &v1pb.UpdateMemoViewRequest{ - MemoView: &v1pb.MemoView{ + updateReq := &apipb.UpdateMemoViewRequest{ + MemoView: &apipb.MemoView{ Name: created.Name, Filter: "invalid||filter))syntax", }, @@ -570,9 +570,9 @@ func TestDeleteMemoView(t *testing.T) { userCtx := ts.CreateUserContext(ctx, user.ID) // Create a memoView first - createReq := &v1pb.CreateMemoViewRequest{ + createReq := &apipb.CreateMemoViewRequest{ Parent: fmt.Sprintf("users/%s", user.Username), - MemoView: &v1pb.MemoView{ + MemoView: &apipb.MemoView{ Title: "MemoView to Delete", Filter: "tag in [\"delete\"]", }, @@ -582,7 +582,7 @@ func TestDeleteMemoView(t *testing.T) { require.NoError(t, err) // Delete the memoView - deleteReq := &v1pb.DeleteMemoViewRequest{ + deleteReq := &apipb.DeleteMemoViewRequest{ Name: created.Name, } @@ -590,7 +590,7 @@ func TestDeleteMemoView(t *testing.T) { require.NoError(t, err) // Verify deletion by listing memoViews - listReq := &v1pb.ListMemoViewsRequest{ + listReq := &apipb.ListMemoViewsRequest{ Parent: fmt.Sprintf("users/%s", user.Username), } @@ -599,7 +599,7 @@ func TestDeleteMemoView(t *testing.T) { require.Empty(t, listResp.MemoViews) // Also verify by trying to get the deleted memoView - getReq := &v1pb.GetMemoViewRequest{ + getReq := &apipb.GetMemoViewRequest{ Name: created.Name, } @@ -620,9 +620,9 @@ func TestDeleteMemoView(t *testing.T) { // Create memoView as user1 user1Ctx := ts.CreateUserContext(ctx, user1.ID) - createReq := &v1pb.CreateMemoViewRequest{ + createReq := &apipb.CreateMemoViewRequest{ Parent: fmt.Sprintf("users/%s", user1.Username), - MemoView: &v1pb.MemoView{ + MemoView: &apipb.MemoView{ Title: "User1 MemoView", Filter: "tag in [\"user1\"]", }, @@ -633,7 +633,7 @@ func TestDeleteMemoView(t *testing.T) { // Try to delete memoView as user2 user2Ctx := ts.CreateUserContext(ctx, user2.ID) - deleteReq := &v1pb.DeleteMemoViewRequest{ + deleteReq := &apipb.DeleteMemoViewRequest{ Name: created.Name, } @@ -646,7 +646,7 @@ func TestDeleteMemoView(t *testing.T) { ts := NewTestService(t) defer ts.Cleanup() - req := &v1pb.DeleteMemoViewRequest{ + req := &apipb.DeleteMemoViewRequest{ Name: "invalid-memo-view-name", } @@ -666,7 +666,7 @@ func TestDeleteMemoView(t *testing.T) { // Set user context userCtx := ts.CreateUserContext(ctx, user.ID) - req := &v1pb.DeleteMemoViewRequest{ + req := &apipb.DeleteMemoViewRequest{ Name: fmt.Sprintf("users/%s", user.Username) + "/views/nonexistent", } @@ -703,9 +703,9 @@ func TestMemoViewFiltering(t *testing.T) { } for i, filter := range validFilters { - req := &v1pb.CreateMemoViewRequest{ + req := &apipb.CreateMemoViewRequest{ Parent: fmt.Sprintf("users/%s", user.Username), - MemoView: &v1pb.MemoView{ + MemoView: &apipb.MemoView{ Title: fmt.Sprintf("Valid Filter %d", i), Filter: filter, }, @@ -740,9 +740,9 @@ func TestMemoViewFiltering(t *testing.T) { } for _, filter := range invalidFilters { - req := &v1pb.CreateMemoViewRequest{ + req := &apipb.CreateMemoViewRequest{ Parent: fmt.Sprintf("users/%s", user.Username), - MemoView: &v1pb.MemoView{ + MemoView: &apipb.MemoView{ Title: "Invalid Filter Test", Filter: filter, }, @@ -770,17 +770,17 @@ func TestMemoViewCRUDComplete(t *testing.T) { userCtx := ts.CreateUserContext(ctx, user.ID) // 1. Create multiple memoViews - memoView1Req := &v1pb.CreateMemoViewRequest{ + memoView1Req := &apipb.CreateMemoViewRequest{ Parent: fmt.Sprintf("users/%s", user.Username), - MemoView: &v1pb.MemoView{ + MemoView: &apipb.MemoView{ Title: "Work Notes", Filter: "tag in [\"work\"]", }, } - memoView2Req := &v1pb.CreateMemoViewRequest{ + memoView2Req := &apipb.CreateMemoViewRequest{ Parent: fmt.Sprintf("users/%s", user.Username), - MemoView: &v1pb.MemoView{ + MemoView: &apipb.MemoView{ Title: "Personal Notes", Filter: "tag in [\"personal\"]", }, @@ -795,7 +795,7 @@ func TestMemoViewCRUDComplete(t *testing.T) { require.Equal(t, "Personal Notes", created2.Title) // 2. List memoViews and verify both exist - listReq := &v1pb.ListMemoViewsRequest{ + listReq := &apipb.ListMemoViewsRequest{ Parent: fmt.Sprintf("users/%s", user.Username), } @@ -804,21 +804,21 @@ func TestMemoViewCRUDComplete(t *testing.T) { require.Len(t, listResp.MemoViews, 2) // 3. Get individual memoViews - getReq1 := &v1pb.GetMemoViewRequest{Name: created1.Name} + getReq1 := &apipb.GetMemoViewRequest{Name: created1.Name} getResp1, err := ts.Service.GetMemoView(userCtx, getReq1) require.NoError(t, err) require.Equal(t, created1.Name, getResp1.Name) require.Equal(t, "Work Notes", getResp1.Title) - getReq2 := &v1pb.GetMemoViewRequest{Name: created2.Name} + getReq2 := &apipb.GetMemoViewRequest{Name: created2.Name} getResp2, err := ts.Service.GetMemoView(userCtx, getReq2) require.NoError(t, err) require.Equal(t, created2.Name, getResp2.Name) require.Equal(t, "Personal Notes", getResp2.Title) // 4. Update one memoView - updateReq := &v1pb.UpdateMemoViewRequest{ - MemoView: &v1pb.MemoView{ + updateReq := &apipb.UpdateMemoViewRequest{ + MemoView: &apipb.MemoView{ Name: created1.Name, Title: "Work & Meeting Notes", Filter: "tag in [\"work\"] || tag in [\"meeting\"]", @@ -834,14 +834,14 @@ func TestMemoViewCRUDComplete(t *testing.T) { require.Equal(t, "tag in [\"work\"] || tag in [\"meeting\"]", updated.Filter) // 5. Verify update by getting it again - getUpdatedReq := &v1pb.GetMemoViewRequest{Name: created1.Name} + getUpdatedReq := &apipb.GetMemoViewRequest{Name: created1.Name} getUpdatedResp, err := ts.Service.GetMemoView(userCtx, getUpdatedReq) require.NoError(t, err) require.Equal(t, "Work & Meeting Notes", getUpdatedResp.Title) require.Equal(t, "tag in [\"work\"] || tag in [\"meeting\"]", getUpdatedResp.Filter) // 6. Delete one memoView - deleteReq := &v1pb.DeleteMemoViewRequest{ + deleteReq := &apipb.DeleteMemoViewRequest{ Name: created2.Name, } @@ -855,7 +855,7 @@ func TestMemoViewCRUDComplete(t *testing.T) { require.Equal(t, "Work & Meeting Notes", finalListResp.MemoViews[0].Title) // 8. Verify deleted memoView can't be accessed - getDeletedReq := &v1pb.GetMemoViewRequest{Name: created2.Name} + getDeletedReq := &apipb.GetMemoViewRequest{Name: created2.Name} _, err = ts.Service.GetMemoView(userCtx, getDeletedReq) require.Error(t, err) require.Contains(t, err.Error(), "not found") @@ -873,7 +873,7 @@ func TestMemoViewRegressions(t *testing.T) { require.NoError(t, err) userCtx := ts.CreateUserContext(ctx, user.ID) - req := &v1pb.UpdateMemoViewRequest{ + req := &apipb.UpdateMemoViewRequest{ UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"title"}}, } @@ -890,9 +890,9 @@ func TestMemoViewRegressions(t *testing.T) { require.NoError(t, err) userCtx := ts.CreateUserContext(ctx, user.ID) - created, err := ts.Service.CreateMemoView(userCtx, &v1pb.CreateMemoViewRequest{ + created, err := ts.Service.CreateMemoView(userCtx, &apipb.CreateMemoViewRequest{ Parent: fmt.Sprintf("users/%s", user.Username), - MemoView: &v1pb.MemoView{ + MemoView: &apipb.MemoView{ Title: "Original Title", Filter: `tag in ["work"]`, }, @@ -901,8 +901,8 @@ func TestMemoViewRegressions(t *testing.T) { // The title path is applied before the filter path is validated. A rejected // filter must not leave the new title behind. - _, err = ts.Service.UpdateMemoView(userCtx, &v1pb.UpdateMemoViewRequest{ - MemoView: &v1pb.MemoView{ + _, err = ts.Service.UpdateMemoView(userCtx, &apipb.UpdateMemoViewRequest{ + MemoView: &apipb.MemoView{ Name: created.Name, Title: "Phantom Title", Filter: "this is not (((a valid filter", @@ -912,7 +912,7 @@ func TestMemoViewRegressions(t *testing.T) { require.Error(t, err) require.Contains(t, err.Error(), "invalid filter") - got, err := ts.Service.GetMemoView(userCtx, &v1pb.GetMemoViewRequest{Name: created.Name}) + got, err := ts.Service.GetMemoView(userCtx, &apipb.GetMemoViewRequest{Name: created.Name}) require.NoError(t, err) require.Equal(t, "Original Title", got.Title) require.Equal(t, `tag in ["work"]`, got.Filter) @@ -931,9 +931,9 @@ func TestMemoViewRegressions(t *testing.T) { errs := make([]error, concurrency) for i := range concurrency { wg.Go(func() { - _, errs[i] = ts.Service.CreateMemoView(userCtx, &v1pb.CreateMemoViewRequest{ + _, errs[i] = ts.Service.CreateMemoView(userCtx, &apipb.CreateMemoViewRequest{ Parent: fmt.Sprintf("users/%s", user.Username), - MemoView: &v1pb.MemoView{ + MemoView: &apipb.MemoView{ Title: fmt.Sprintf("View %d", i), Filter: `tag in ["work"]`, }, @@ -945,7 +945,7 @@ func TestMemoViewRegressions(t *testing.T) { require.NoError(t, err) } - resp, err := ts.Service.ListMemoViews(userCtx, &v1pb.ListMemoViewsRequest{ + resp, err := ts.Service.ListMemoViews(userCtx, &apipb.ListMemoViewsRequest{ Parent: fmt.Sprintf("users/%s", user.Username), }) require.NoError(t, err) diff --git a/server/api/v1/test/personal_access_token_test.go b/server/api/test/personal_access_token_test.go similarity index 63% rename from server/api/v1/test/personal_access_token_test.go rename to server/api/test/personal_access_token_test.go index be7bd58cf..081e52b63 100644 --- a/server/api/v1/test/personal_access_token_test.go +++ b/server/api/test/personal_access_token_test.go @@ -8,7 +8,7 @@ import ( "github.com/stretchr/testify/require" - v1pb "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" ) func TestCreatePersonalAccessTokenExpiration(t *testing.T) { @@ -22,30 +22,30 @@ func TestCreatePersonalAccessTokenExpiration(t *testing.T) { parent := "users/" + user.Username t.Run("zero days never expires", func(t *testing.T) { - response, err := ts.Service.CreatePersonalAccessToken(userCtx, &v1pb.CreatePersonalAccessTokenRequest{ + response, err := ts.Service.CreatePersonalAccessToken(userCtx, &apipb.CreatePersonalAccessTokenRequest{ Parent: parent, Description: "non-expiring token", }) require.NoError(t, err) require.True(t, strings.HasPrefix(response.Token, "memos_pat_")) - require.Nil(t, response.PersonalAccessToken.ExpiresAt) + require.Nil(t, response.PersonalAccessToken.ExpireTime) - listed, err := ts.Service.ListPersonalAccessTokens(userCtx, &v1pb.ListPersonalAccessTokensRequest{Parent: parent}) + listed, err := ts.Service.ListPersonalAccessTokens(userCtx, &apipb.ListPersonalAccessTokensRequest{Parent: parent}) require.NoError(t, err) require.Len(t, listed.PersonalAccessTokens, 1) - require.Nil(t, listed.PersonalAccessTokens[0].ExpiresAt) + require.Nil(t, listed.PersonalAccessTokens[0].ExpireTime) }) t.Run("positive days sets expiration", func(t *testing.T) { before := time.Now().Add(29 * 24 * time.Hour) - response, err := ts.Service.CreatePersonalAccessToken(userCtx, &v1pb.CreatePersonalAccessTokenRequest{ + response, err := ts.Service.CreatePersonalAccessToken(userCtx, &apipb.CreatePersonalAccessTokenRequest{ Parent: parent, Description: "expiring token", ExpiresInDays: 30, }) require.NoError(t, err) - require.NotNil(t, response.PersonalAccessToken.ExpiresAt) - require.True(t, response.PersonalAccessToken.ExpiresAt.AsTime().After(before)) - require.True(t, response.PersonalAccessToken.ExpiresAt.AsTime().Before(time.Now().Add(31*24*time.Hour))) + require.NotNil(t, response.PersonalAccessToken.ExpireTime) + require.True(t, response.PersonalAccessToken.ExpireTime.AsTime().After(before)) + require.True(t, response.PersonalAccessToken.ExpireTime.AsTime().Before(time.Now().Add(31*24*time.Hour))) }) } diff --git a/server/api/v1/test/ratelimit_test.go b/server/api/test/ratelimit_test.go similarity index 90% rename from server/api/v1/test/ratelimit_test.go rename to server/api/test/ratelimit_test.go index dcee2813d..6507836ba 100644 --- a/server/api/v1/test/ratelimit_test.go +++ b/server/api/test/ratelimit_test.go @@ -17,8 +17,8 @@ import ( "github.com/usememos/memos/internal/clientip" "github.com/usememos/memos/internal/ratelimit" - apiv1 "github.com/usememos/memos/proto/gen/api/v1" - apiv1server "github.com/usememos/memos/server/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" + "github.com/usememos/memos/server/api" "github.com/usememos/memos/server/auth" "github.com/usememos/memos/store" ) @@ -52,9 +52,9 @@ func requireRateLimited(t *testing.T, err error, scope ratelimit.Scope) { } func passwordSignIn(ctx context.Context, ts *TestService, username, password string) error { - _, err := ts.Service.SignIn(apiv1server.WithHeaderCarrier(ctx), &apiv1.SignInRequest{ - Credentials: &apiv1.SignInRequest_PasswordCredentials_{ - PasswordCredentials: &apiv1.SignInRequest_PasswordCredentials{Username: username, Password: password}, + _, err := ts.Service.SignIn(api.WithHeaderCarrier(ctx), &apipb.SignInRequest{ + Credentials: &apipb.SignInRequest_PasswordCredentials_{ + PasswordCredentials: &apipb.SignInRequest_PasswordCredentials{Username: username, Password: password}, }, }) return err @@ -155,8 +155,8 @@ func TestSignInRateLimits(t *testing.T) { func TestCreateUserRateLimits(t *testing.T) { ctx := withClientIP(context.Background(), "203.0.113.20") signup := func(ts *TestService, ctx context.Context, username string, validateOnly bool) error { - _, err := ts.Service.CreateUser(ctx, &apiv1.CreateUserRequest{ - User: &apiv1.User{Username: username, Password: "password123"}, + _, err := ts.Service.CreateUser(ctx, &apipb.CreateUserRequest{ + User: &apipb.User{Username: username, Password: "password123"}, ValidateOnly: validateOnly, }) return err @@ -240,7 +240,7 @@ func TestChallengeSeam(t *testing.T) { ts.Service.Challenge = challenge request := func(ctx context.Context) error { - _, err := ts.Service.CreateUser(ctx, &apiv1.CreateUserRequest{User: &apiv1.User{Username: "newcomer", Password: "password123"}}) + _, err := ts.Service.CreateUser(ctx, &apipb.CreateUserRequest{User: &apipb.User{Username: "newcomer", Password: "password123"}}) return err } requireChallengeRequired(t, request(ctx)) @@ -248,7 +248,7 @@ func TestChallengeSeam(t *testing.T) { require.NoError(t, request(withChallengeToken(ctx, "good"))) require.Equal(t, []string{"203.0.113.30", "203.0.113.30"}, challenge.seen, "the resolver's address is handed to the verifier") - profile, err := ts.Service.GetInstanceProfile(ctx, &apiv1.GetInstanceProfileRequest{}) + profile, err := ts.Service.GetInstanceProfile(ctx, &apipb.GetInstanceProfileRequest{}) require.NoError(t, err) require.Equal(t, "fake", profile.GetChallenge().GetProvider()) require.Equal(t, "site-key", profile.GetChallenge().GetSiteKey()) @@ -270,14 +270,14 @@ func TestChallengeSeam(t *testing.T) { admin, err := ts.CreateHostUser(ctx, "admin") require.NoError(t, err) ts.Service.Challenge = &fakeChallenge{accept: "good"} - _, err = ts.Service.CreateUser(ts.CreateUserContext(ctx, admin.ID), &apiv1.CreateUserRequest{User: &apiv1.User{Username: "staff", Password: "password123"}}) + _, err = ts.Service.CreateUser(ts.CreateUserContext(ctx, admin.ID), &apipb.CreateUserRequest{User: &apipb.User{Username: "staff", Password: "password123"}}) require.NoError(t, err) }) t.Run("no challenge configured means no profile entry and no requirement", func(t *testing.T) { ts := NewTestService(t) defer ts.Cleanup() - profile, err := ts.Service.GetInstanceProfile(ctx, &apiv1.GetInstanceProfileRequest{}) + profile, err := ts.Service.GetInstanceProfile(ctx, &apipb.GetInstanceProfileRequest{}) require.NoError(t, err) require.Nil(t, profile.GetChallenge()) }) @@ -300,15 +300,15 @@ func TestSignupPolicySeam(t *testing.T) { require.NoError(t, err) ts.Service.SignupPolicy = denyDomainPolicy{domain: "@blocked.example"} - _, err = ts.Service.CreateUser(ctx, &apiv1.CreateUserRequest{User: &apiv1.User{Username: "spammer", Email: "Spam@Blocked.Example", Password: "password123"}}) + _, err = ts.Service.CreateUser(ctx, &apipb.CreateUserRequest{User: &apipb.User{Username: "spammer", Email: "Spam@Blocked.Example", Password: "password123"}}) require.Equal(t, codes.PermissionDenied, status.Code(err)) require.Contains(t, status.Convert(err).Message(), "blocked.example") - _, err = ts.Service.CreateUser(ctx, &apiv1.CreateUserRequest{User: &apiv1.User{Username: "welcome", Email: "hi@allowed.example", Password: "password123"}}) + _, err = ts.Service.CreateUser(ctx, &apipb.CreateUserRequest{User: &apipb.User{Username: "welcome", Email: "hi@allowed.example", Password: "password123"}}) require.NoError(t, err) // The policy is consulted for self-service signups only. - _, err = ts.Service.CreateUser(ts.CreateUserContext(ctx, admin.ID), &apiv1.CreateUserRequest{User: &apiv1.User{Username: "staff", Email: "staff@blocked.example", Password: "password123"}}) + _, err = ts.Service.CreateUser(ts.CreateUserContext(ctx, admin.ID), &apipb.CreateUserRequest{User: &apipb.User{Username: "staff", Email: "staff@blocked.example", Password: "password123"}}) require.NoError(t, err) } @@ -321,7 +321,7 @@ func TestLinkMetadataRateLimit(t *testing.T) { // Three URLs exceed the budget of two, so the batch is refused before any // fetch: these hosts do not exist and would otherwise fail differently. - _, err := ts.Service.BatchGetLinkMetadata(ctx, &apiv1.BatchGetLinkMetadataRequest{Urls: []string{ + _, err := ts.Service.BatchGetLinkMetadata(ctx, &apipb.BatchGetLinkMetadataRequest{Urls: []string{ "http://a.invalid/", "http://b.invalid/", "http://c.invalid/", }}) requireRateLimited(t, err, ratelimit.ScopeLinkMetadata) @@ -333,7 +333,7 @@ func TestLinkMetadataRateLimit(t *testing.T) { require.NoError(t, err) userCtx := ts.CreateUserContext(ctx, user.ID) limiter.Hit(ratelimit.ScopeLinkMetadata, strconv.Itoa(int(user.ID)), 2) - _, err = ts.Service.GetLinkMetadata(userCtx, &apiv1.GetLinkMetadataRequest{Url: "http://a.invalid/"}) + _, err = ts.Service.GetLinkMetadata(userCtx, &apipb.GetLinkMetadataRequest{Url: "http://a.invalid/"}) requireRateLimited(t, err, ratelimit.ScopeLinkMetadata) require.Equal(t, 2, limiter.Allowed(ratelimit.ScopeLinkMetadata, "203.0.113.50", 1).Remaining) } @@ -348,7 +348,7 @@ func TestWriteAndUploadBudgets(t *testing.T) { userCtx := ts.CreateUserContext(ctx, user.ID) createMemo := func(content string) error { - _, err := ts.Service.CreateMemo(userCtx, &apiv1.CreateMemoRequest{Memo: &apiv1.Memo{Content: content, Visibility: apiv1.Visibility_PRIVATE}}) + _, err := ts.Service.CreateMemo(userCtx, &apipb.CreateMemoRequest{Memo: &apipb.Memo{Content: content, Visibility: apipb.Visibility_PRIVATE}}) return err } require.NoError(t, createMemo("one")) @@ -358,7 +358,7 @@ func TestWriteAndUploadBudgets(t *testing.T) { // Another user has their own budget. other, err := ts.CreateRegularUser(ctx, "other") require.NoError(t, err) - _, err = ts.Service.CreateMemo(ts.CreateUserContext(ctx, other.ID), &apiv1.CreateMemoRequest{Memo: &apiv1.Memo{Content: "hi", Visibility: apiv1.Visibility_PRIVATE}}) + _, err = ts.Service.CreateMemo(ts.CreateUserContext(ctx, other.ID), &apipb.CreateMemoRequest{Memo: &apipb.Memo{Content: "hi", Visibility: apipb.Visibility_PRIVATE}}) require.NoError(t, err) } @@ -370,8 +370,8 @@ func TestAuthorizerBudgets(t *testing.T) { policy[ratelimit.ScopeAnonymous] = ratelimit.Rule{Limit: 2, Window: time.Hour} policy[ratelimit.ScopeAuthenticated] = ratelimit.Rule{Limit: 3, Window: time.Hour} limiter := ratelimit.NewMemoryLimiter(policy) - authorizer := apiv1server.NewAuthorizer(ts.Store, ts.Secret).WithRateLimiter(limiter) - const procedure = "/memos.api.v1.MemoService/ListMemos" + authorizer := api.NewAuthorizer(ts.Store, ts.Secret).WithRateLimiter(limiter) + const procedure = "/memos.api.MemoService/ListMemos" // Anonymous callers share a budget per address. require.NoError(t, authorizer.Throttle(ctx, procedure, nil)) @@ -395,7 +395,7 @@ func TestAuthorizerBudgets(t *testing.T) { require.NoError(t, authorizer.Throttle(context.Background(), procedure, nil)) // Without a limiter nothing is bounded. - unlimited := apiv1server.NewAuthorizer(ts.Store, ts.Secret) + unlimited := api.NewAuthorizer(ts.Store, ts.Secret) for range 10 { require.NoError(t, unlimited.Throttle(ctx, procedure, nil)) } @@ -412,7 +412,7 @@ func TestBatchRequestsCostTheirItemCount(t *testing.T) { userCtx := ts.CreateUserContext(ctx, user.ID) before := limiter.Allowed(ratelimit.ScopeAuthenticated, strconv.Itoa(int(user.ID)), 1).Remaining - _, err = ts.Service.BatchGetUsers(userCtx, &apiv1.BatchGetUsersRequest{Usernames: []string{"a", "b", "c", "d"}}) + _, err = ts.Service.BatchGetUsers(userCtx, &apipb.BatchGetUsersRequest{Names: []string{"users/a", "users/b", "users/c", "users/d"}}) require.NoError(t, err) after := limiter.Allowed(ratelimit.ScopeAuthenticated, strconv.Itoa(int(user.ID)), 1).Remaining require.Equal(t, 3, before-after, "the authorizer counts one; the handler adds the other three") diff --git a/server/api/v1/test/reaction_service_test.go b/server/api/test/reaction_service_test.go similarity index 73% rename from server/api/v1/test/reaction_service_test.go rename to server/api/test/reaction_service_test.go index 4ffce27a5..4767c3a55 100644 --- a/server/api/v1/test/reaction_service_test.go +++ b/server/api/test/reaction_service_test.go @@ -9,7 +9,7 @@ import ( "google.golang.org/grpc/codes" "google.golang.org/grpc/status" - apiv1 "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" "github.com/usememos/memos/store" ) @@ -21,18 +21,18 @@ func TestMemoReactionResourceNames(t *testing.T) { user, err := ts.CreateRegularUser(ctx, "reaction-resource-user") require.NoError(t, err) userCtx := ts.CreateUserContext(ctx, user.ID) - memo, err := ts.Service.CreateMemo(userCtx, &apiv1.CreateMemoRequest{ + memo, err := ts.Service.CreateMemo(userCtx, &apipb.CreateMemoRequest{ MemoId: "reaction-resource-memo", - Memo: &apiv1.Memo{ + Memo: &apipb.Memo{ Content: "reaction resource names", - Visibility: apiv1.Visibility_PUBLIC, + Visibility: apipb.Visibility_PUBLIC, }, }) require.NoError(t, err) - reaction, err := ts.Service.UpsertMemoReaction(userCtx, &apiv1.UpsertMemoReactionRequest{ - Name: memo.Name, - Reaction: &apiv1.Reaction{ + reaction, err := ts.Service.UpsertMemoReaction(userCtx, &apipb.UpsertMemoReactionRequest{ + Parent: memo.Name, + Reaction: &apipb.Reaction{ ReactionType: "👍", }, }) @@ -45,12 +45,12 @@ func TestMemoReactionResourceNames(t *testing.T) { require.NotNil(t, storedReaction) require.Equal(t, memoID, storedReaction.MemoID) - listed, err := ts.Service.ListMemoReactions(ctx, &apiv1.ListMemoReactionsRequest{Name: memo.Name}) + listed, err := ts.Service.ListMemoReactions(ctx, &apipb.ListMemoReactionsRequest{Parent: memo.Name}) require.NoError(t, err) require.Len(t, listed.Reactions, 1) require.Equal(t, reaction.Name, listed.Reactions[0].Name) - fetchedMemo, err := ts.Service.GetMemo(ctx, &apiv1.GetMemoRequest{Name: memo.Name}) + fetchedMemo, err := ts.Service.GetMemo(ctx, &apipb.GetMemoRequest{Name: memo.Name}) require.NoError(t, err) require.Len(t, fetchedMemo.Reactions, 1) require.Equal(t, reaction.Name, fetchedMemo.Reactions[0].Name) @@ -63,8 +63,8 @@ func TestUpsertMemoReactionRequiresReaction(t *testing.T) { user, err := ts.CreateRegularUser(ctx, "reaction-required-user") require.NoError(t, err) - _, err = ts.Service.UpsertMemoReaction(ts.CreateUserContext(ctx, user.ID), &apiv1.UpsertMemoReactionRequest{ - Name: "memos/missing", + _, err = ts.Service.UpsertMemoReaction(ts.CreateUserContext(ctx, user.ID), &apipb.UpsertMemoReactionRequest{ + Parent: "memos/missing", }) require.Equal(t, codes.InvalidArgument, status.Code(err)) } @@ -77,29 +77,29 @@ func TestListMemoCommentsIncludesReactionResourceNames(t *testing.T) { user, err := ts.CreateRegularUser(ctx, "comment-reaction-user") require.NoError(t, err) userCtx := ts.CreateUserContext(ctx, user.ID) - parent, err := ts.Service.CreateMemo(userCtx, &apiv1.CreateMemoRequest{ - Memo: &apiv1.Memo{Content: "parent", Visibility: apiv1.Visibility_PUBLIC}, + parent, err := ts.Service.CreateMemo(userCtx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{Content: "parent", Visibility: apipb.Visibility_PUBLIC}, }) require.NoError(t, err) - comment, err := ts.Service.CreateMemoComment(userCtx, &apiv1.CreateMemoCommentRequest{ - Name: parent.Name, - Comment: &apiv1.Memo{Content: "comment", Visibility: apiv1.Visibility_PUBLIC}, + comment, err := ts.Service.CreateMemoComment(userCtx, &apipb.CreateMemoCommentRequest{ + Parent: parent.Name, + Comment: &apipb.Memo{Content: "comment", Visibility: apipb.Visibility_PUBLIC}, }) require.NoError(t, err) - _, err = ts.Service.UpsertMemoReaction(userCtx, &apiv1.UpsertMemoReactionRequest{ - Name: comment.Name, - Reaction: &apiv1.Reaction{ + _, err = ts.Service.UpsertMemoReaction(userCtx, &apipb.UpsertMemoReactionRequest{ + Parent: comment.Name, + Reaction: &apipb.Reaction{ ReactionType: "🔥", }, }) require.NoError(t, err) - comments, err := ts.Service.ListMemoComments(userCtx, &apiv1.ListMemoCommentsRequest{Name: parent.Name}) + comments, err := ts.Service.ListMemoComments(userCtx, &apipb.ListMemoCommentsRequest{Parent: parent.Name}) require.NoError(t, err) - require.Len(t, comments.Memos, 1) - require.Len(t, comments.Memos[0].Reactions, 1) - require.True(t, strings.HasPrefix(comments.Memos[0].Reactions[0].Name, comment.Name+"/reactions/")) + require.Len(t, comments.Comments, 1) + require.Len(t, comments.Comments[0].Reactions, 1) + require.True(t, strings.HasPrefix(comments.Comments[0].Reactions[0].Name, comment.Name+"/reactions/")) } func TestUpsertMemoReactionRevalidatesSpaceParticipation(t *testing.T) { @@ -134,27 +134,27 @@ func TestUpsertMemoReactionRevalidatesSpaceParticipation(t *testing.T) { require.NoError(t, err) memoName := "memos/" + root.UID - memberReaction, err := ts.Service.UpsertMemoReaction(memberCtx, &apiv1.UpsertMemoReactionRequest{ - Name: memoName, - Reaction: &apiv1.Reaction{ReactionType: "👍"}, + memberReaction, err := ts.Service.UpsertMemoReaction(memberCtx, &apipb.UpsertMemoReactionRequest{ + Parent: memoName, + Reaction: &apipb.Reaction{ReactionType: "👍"}, }) require.NoError(t, err) // An application ADMIN is the superuser and participates without membership. - adminReaction, err := ts.Service.UpsertMemoReaction(adminCtx, &apiv1.UpsertMemoReactionRequest{ - Name: memoName, - Reaction: &apiv1.Reaction{ReactionType: "🔥"}, + adminReaction, err := ts.Service.UpsertMemoReaction(adminCtx, &apipb.UpsertMemoReactionRequest{ + Parent: memoName, + Reaction: &apipb.Reaction{ReactionType: "🔥"}, }) require.NoError(t, err) - _, err = ts.Service.DeleteMemoReaction(adminCtx, &apiv1.DeleteMemoReactionRequest{Name: adminReaction.Name}) + _, err = ts.Service.DeleteMemoReaction(adminCtx, &apipb.DeleteMemoReactionRequest{Name: adminReaction.Name}) require.NoError(t, err) require.NoError(t, ts.Store.DeleteSpaceMember(ctx, &store.DeleteSpaceMember{SpaceID: space.ID, UserID: member.ID}, owner.ID)) - _, err = ts.Service.DeleteMemoReaction(memberCtx, &apiv1.DeleteMemoReactionRequest{Name: memberReaction.Name}) + _, err = ts.Service.DeleteMemoReaction(memberCtx, &apipb.DeleteMemoReactionRequest{Name: memberReaction.Name}) require.NoError(t, err, "the creator may withdraw a reaction after leaving") - _, err = ts.Service.UpsertMemoReaction(memberCtx, &apiv1.UpsertMemoReactionRequest{ - Name: memoName, - Reaction: &apiv1.Reaction{ReactionType: "🔥"}, + _, err = ts.Service.UpsertMemoReaction(memberCtx, &apipb.UpsertMemoReactionRequest{ + Parent: memoName, + Reaction: &apipb.Reaction{ReactionType: "🔥"}, }) require.Equal(t, codes.PermissionDenied, status.Code(err)) @@ -165,9 +165,9 @@ func TestUpsertMemoReactionRevalidatesSpaceParticipation(t *testing.T) { }, owner.ID) require.NoError(t, err) - _, err = ts.Service.UpsertMemoReaction(memberCtx, &apiv1.UpsertMemoReactionRequest{ - Name: memoName, - Reaction: &apiv1.Reaction{ReactionType: "🔥"}, + _, err = ts.Service.UpsertMemoReaction(memberCtx, &apipb.UpsertMemoReactionRequest{ + Parent: memoName, + Reaction: &apipb.Reaction{ReactionType: "🔥"}, }) require.NoError(t, err) @@ -199,36 +199,36 @@ func TestAssignedMemoReactionsFollowMemoReadAccess(t *testing.T) { Role: store.SpaceMemberRoleAdmin, }, owner.ID) require.NoError(t, err) - memo, err := ts.Service.CreateMemo(ownerCtx, &apiv1.CreateMemoRequest{Memo: &apiv1.Memo{ + memo, err := ts.Service.CreateMemo(ownerCtx, &apipb.CreateMemoRequest{Memo: &apipb.Memo{ Content: "assigned public memo with reactions", - Visibility: apiv1.Visibility_PUBLIC, + Visibility: apipb.Visibility_PUBLIC, Space: ptr("spaces/" + space.UID), }}) require.NoError(t, err) - _, err = ts.Service.UpsertMemoReaction(ownerCtx, &apiv1.UpsertMemoReactionRequest{ - Name: memo.Name, - Reaction: &apiv1.Reaction{ReactionType: "👍"}, + _, err = ts.Service.UpsertMemoReaction(ownerCtx, &apipb.UpsertMemoReactionRequest{ + Parent: memo.Name, + Reaction: &apipb.Reaction{ReactionType: "👍"}, }) require.NoError(t, err) - listed, err := ts.Service.ListMemoReactions(memberCtx, &apiv1.ListMemoReactionsRequest{Name: memo.Name}) + listed, err := ts.Service.ListMemoReactions(memberCtx, &apipb.ListMemoReactionsRequest{Parent: memo.Name}) require.NoError(t, err) require.Len(t, listed.Reactions, 1) - listed, err = ts.Service.ListMemoReactions(ctx, &apiv1.ListMemoReactionsRequest{Name: memo.Name}) + listed, err = ts.Service.ListMemoReactions(ctx, &apipb.ListMemoReactionsRequest{Parent: memo.Name}) require.NoError(t, err) require.Len(t, listed.Reactions, 1, "anonymous reaction reads follow the PUBLIC memo audience") - listed, err = ts.Service.ListMemoReactions(outsiderCtx, &apiv1.ListMemoReactionsRequest{Name: memo.Name}) + listed, err = ts.Service.ListMemoReactions(outsiderCtx, &apipb.ListMemoReactionsRequest{Parent: memo.Name}) require.NoError(t, err) require.Len(t, listed.Reactions, 1, "Space placement adds no reaction read gate") - got, err := ts.Service.GetMemo(outsiderCtx, &apiv1.GetMemoRequest{Name: memo.Name}) + got, err := ts.Service.GetMemo(outsiderCtx, &apipb.GetMemoRequest{Name: memo.Name}) require.NoError(t, err, "a non-member may still read an assigned PUBLIC memo") require.Empty(t, got.GetSpace()) require.Len(t, got.Reactions, 1, "embedded reactions follow the readable memo") - feed, err := ts.Service.ListMemos(outsiderCtx, &apiv1.ListMemosRequest{PageSize: 20}) + feed, err := ts.Service.ListMemos(outsiderCtx, &apipb.ListMemosRequest{PageSize: 20}) require.NoError(t, err) - var listedMemo *apiv1.Memo + var listedMemo *apipb.Memo for _, candidate := range feed.Memos { if candidate.Name == memo.Name { listedMemo = candidate @@ -239,10 +239,10 @@ func TestAssignedMemoReactionsFollowMemoReadAccess(t *testing.T) { require.Len(t, listedMemo.Reactions, 1) require.NoError(t, ts.Store.DeleteSpaceMember(ctx, &store.DeleteSpaceMember{SpaceID: space.ID, UserID: owner.ID}, owner.ID)) - listed, err = ts.Service.ListMemoReactions(ownerCtx, &apiv1.ListMemoReactionsRequest{Name: memo.Name}) + listed, err = ts.Service.ListMemoReactions(ownerCtx, &apipb.ListMemoReactionsRequest{Parent: memo.Name}) require.NoError(t, err) require.Len(t, listed.Reactions, 1, "the removed author still reads a PUBLIC memo and its reactions") - got, err = ts.Service.GetMemo(ownerCtx, &apiv1.GetMemoRequest{Name: memo.Name}) + got, err = ts.Service.GetMemo(ownerCtx, &apipb.GetMemoRequest{Name: memo.Name}) require.NoError(t, err) require.Equal(t, "spaces/"+space.UID, got.GetSpace(), "the author may still see placement") require.Len(t, got.Reactions, 1) @@ -261,19 +261,19 @@ func TestDeleteMemoReaction(t *testing.T) { userCtx := ts.CreateUserContext(ctx, user.ID) // Create memo - memo, err := ts.Service.CreateMemo(userCtx, &apiv1.CreateMemoRequest{ - Memo: &apiv1.Memo{ + memo, err := ts.Service.CreateMemo(userCtx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{ Content: "Test memo", - Visibility: apiv1.Visibility_PUBLIC, + Visibility: apipb.Visibility_PUBLIC, }, }) require.NoError(t, err) require.NotNil(t, memo) // Create reaction - reaction, err := ts.Service.UpsertMemoReaction(userCtx, &apiv1.UpsertMemoReactionRequest{ - Name: memo.Name, - Reaction: &apiv1.Reaction{ + reaction, err := ts.Service.UpsertMemoReaction(userCtx, &apipb.UpsertMemoReactionRequest{ + Parent: memo.Name, + Reaction: &apipb.Reaction{ ReactionType: "👍", }, }) @@ -282,7 +282,7 @@ func TestDeleteMemoReaction(t *testing.T) { require.Equal(t, "users/user", reaction.Creator) // Delete reaction - should succeed - _, err = ts.Service.DeleteMemoReaction(userCtx, &apiv1.DeleteMemoReactionRequest{ + _, err = ts.Service.DeleteMemoReaction(userCtx, &apipb.DeleteMemoReactionRequest{ Name: reaction.Name, }) require.NoError(t, err) @@ -295,13 +295,13 @@ func TestDeleteMemoReaction(t *testing.T) { user, err := ts.CreateRegularUser(ctx, "concurrent-delete-user") require.NoError(t, err) userCtx := ts.CreateUserContext(ctx, user.ID) - memo, err := ts.Service.CreateMemo(userCtx, &apiv1.CreateMemoRequest{ - Memo: &apiv1.Memo{Content: "concurrent delete", Visibility: apiv1.Visibility_PUBLIC}, + memo, err := ts.Service.CreateMemo(userCtx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{Content: "concurrent delete", Visibility: apipb.Visibility_PUBLIC}, }) require.NoError(t, err) - reaction, err := ts.Service.UpsertMemoReaction(userCtx, &apiv1.UpsertMemoReactionRequest{ - Name: memo.Name, - Reaction: &apiv1.Reaction{ + reaction, err := ts.Service.UpsertMemoReaction(userCtx, &apipb.UpsertMemoReactionRequest{ + Parent: memo.Name, + Reaction: &apipb.Reaction{ ReactionType: "👍", }, }) @@ -316,7 +316,7 @@ func TestDeleteMemoReaction(t *testing.T) { _, err = ts.Store.GetDriver().GetDB().ExecContext(ctx, "DELETE FROM memo WHERE id = ?", memoID) require.NoError(t, err) - _, err = ts.Service.DeleteMemoReaction(userCtx, &apiv1.DeleteMemoReactionRequest{Name: reaction.Name}) + _, err = ts.Service.DeleteMemoReaction(userCtx, &apipb.DeleteMemoReactionRequest{Name: reaction.Name}) require.Equal(t, codes.PermissionDenied, status.Code(err)) remainingReaction, err := ts.Store.GetReaction(ctx, &store.FindReaction{ID: &storedReaction.ID}) require.NoError(t, err) @@ -338,19 +338,19 @@ func TestDeleteMemoReaction(t *testing.T) { hostCtx := ts.CreateUserContext(ctx, hostUser.ID) // Create memo by regular user - memo, err := ts.Service.CreateMemo(regularUserCtx, &apiv1.CreateMemoRequest{ - Memo: &apiv1.Memo{ + memo, err := ts.Service.CreateMemo(regularUserCtx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{ Content: "Test memo", - Visibility: apiv1.Visibility_PUBLIC, + Visibility: apipb.Visibility_PUBLIC, }, }) require.NoError(t, err) require.NotNil(t, memo) // Create reaction by regular user - reaction, err := ts.Service.UpsertMemoReaction(regularUserCtx, &apiv1.UpsertMemoReactionRequest{ - Name: memo.Name, - Reaction: &apiv1.Reaction{ + reaction, err := ts.Service.UpsertMemoReaction(regularUserCtx, &apipb.UpsertMemoReactionRequest{ + Parent: memo.Name, + Reaction: &apipb.Reaction{ ReactionType: "👍", }, }) @@ -358,7 +358,7 @@ func TestDeleteMemoReaction(t *testing.T) { require.NotNil(t, reaction) // Application ADMIN is the superuser and may withdraw any reaction. - _, err = ts.Service.DeleteMemoReaction(hostCtx, &apiv1.DeleteMemoReactionRequest{ + _, err = ts.Service.DeleteMemoReaction(hostCtx, &apipb.DeleteMemoReactionRequest{ Name: reaction.Name, }) require.NoError(t, err) @@ -383,19 +383,19 @@ func TestDeleteMemoReaction(t *testing.T) { user2Ctx := ts.CreateUserContext(ctx, user2.ID) // Create memo by user1 - memo, err := ts.Service.CreateMemo(user1Ctx, &apiv1.CreateMemoRequest{ - Memo: &apiv1.Memo{ + memo, err := ts.Service.CreateMemo(user1Ctx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{ Content: "Test memo", - Visibility: apiv1.Visibility_PUBLIC, + Visibility: apipb.Visibility_PUBLIC, }, }) require.NoError(t, err) require.NotNil(t, memo) // Create reaction by user1 - reaction, err := ts.Service.UpsertMemoReaction(user1Ctx, &apiv1.UpsertMemoReactionRequest{ - Name: memo.Name, - Reaction: &apiv1.Reaction{ + reaction, err := ts.Service.UpsertMemoReaction(user1Ctx, &apipb.UpsertMemoReactionRequest{ + Parent: memo.Name, + Reaction: &apipb.Reaction{ ReactionType: "👍", }, }) @@ -403,7 +403,7 @@ func TestDeleteMemoReaction(t *testing.T) { require.NotNil(t, reaction) // User2 tries to delete reaction - should fail with permission denied - _, err = ts.Service.DeleteMemoReaction(user2Ctx, &apiv1.DeleteMemoReactionRequest{ + _, err = ts.Service.DeleteMemoReaction(user2Ctx, &apipb.DeleteMemoReactionRequest{ Name: reaction.Name, }) require.Error(t, err) @@ -420,19 +420,19 @@ func TestDeleteMemoReaction(t *testing.T) { userCtx := ts.CreateUserContext(ctx, user.ID) // Create memo - memo, err := ts.Service.CreateMemo(userCtx, &apiv1.CreateMemoRequest{ - Memo: &apiv1.Memo{ + memo, err := ts.Service.CreateMemo(userCtx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{ Content: "Test memo", - Visibility: apiv1.Visibility_PUBLIC, + Visibility: apipb.Visibility_PUBLIC, }, }) require.NoError(t, err) require.NotNil(t, memo) // Create reaction - reaction, err := ts.Service.UpsertMemoReaction(userCtx, &apiv1.UpsertMemoReactionRequest{ - Name: memo.Name, - Reaction: &apiv1.Reaction{ + reaction, err := ts.Service.UpsertMemoReaction(userCtx, &apipb.UpsertMemoReactionRequest{ + Parent: memo.Name, + Reaction: &apipb.Reaction{ ReactionType: "👍", }, }) @@ -440,7 +440,7 @@ func TestDeleteMemoReaction(t *testing.T) { require.NotNil(t, reaction) // Unauthenticated user tries to delete reaction - should fail - _, err = ts.Service.DeleteMemoReaction(ctx, &apiv1.DeleteMemoReactionRequest{ + _, err = ts.Service.DeleteMemoReaction(ctx, &apipb.DeleteMemoReactionRequest{ Name: reaction.Name, }) require.Error(t, err) @@ -459,7 +459,7 @@ func TestDeleteMemoReaction(t *testing.T) { // Try to delete non-existent reaction - should fail with permission denied // (not "not found" to avoid information disclosure) // Use new nested resource format: memos/{memo}/reactions/{reaction} - _, err = ts.Service.DeleteMemoReaction(userCtx, &apiv1.DeleteMemoReactionRequest{ + _, err = ts.Service.DeleteMemoReaction(userCtx, &apipb.DeleteMemoReactionRequest{ Name: "memos/nonexistent/reactions/99999", }) require.Error(t, err) @@ -482,17 +482,17 @@ func TestListMemoReactionsSkipsMissingCreators(t *testing.T) { require.NoError(t, err) reactorCtx := ts.CreateUserContext(ctx, reactor.ID) - memo, err := ts.Service.CreateMemo(ownerCtx, &apiv1.CreateMemoRequest{ - Memo: &apiv1.Memo{ + memo, err := ts.Service.CreateMemo(ownerCtx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{ Content: "reaction list memo", - Visibility: apiv1.Visibility_PUBLIC, + Visibility: apipb.Visibility_PUBLIC, }, }) require.NoError(t, err) - _, err = ts.Service.UpsertMemoReaction(reactorCtx, &apiv1.UpsertMemoReactionRequest{ - Name: memo.Name, - Reaction: &apiv1.Reaction{ + _, err = ts.Service.UpsertMemoReaction(reactorCtx, &apipb.UpsertMemoReactionRequest{ + Parent: memo.Name, + Reaction: &apipb.Reaction{ ReactionType: "🔥", }, }) @@ -501,7 +501,7 @@ func TestListMemoReactionsSkipsMissingCreators(t *testing.T) { _, err = ts.Store.DeleteUser(ctx, &store.DeleteUser{ID: reactor.ID}) require.NoError(t, err) - resp, err := ts.Service.ListMemoReactions(ctx, &apiv1.ListMemoReactionsRequest{Name: memo.Name}) + resp, err := ts.Service.ListMemoReactions(ctx, &apipb.ListMemoReactionsRequest{Parent: memo.Name}) require.NoError(t, err) require.Empty(t, resp.Reactions) } diff --git a/server/api/v1/test/sse_handler_test.go b/server/api/test/sse_handler_test.go similarity index 86% rename from server/api/v1/test/sse_handler_test.go rename to server/api/test/sse_handler_test.go index 3f4c2e4fa..3ee91f09f 100644 --- a/server/api/v1/test/sse_handler_test.go +++ b/server/api/test/sse_handler_test.go @@ -12,8 +12,8 @@ import ( "github.com/labstack/echo/v5" "github.com/stretchr/testify/require" - v1pb "github.com/usememos/memos/proto/gen/api/v1" - apiv1 "github.com/usememos/memos/server/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" + "github.com/usememos/memos/server/api" "github.com/usememos/memos/server/auth" ) @@ -35,17 +35,17 @@ func TestSSEHandler_Authentication(t *testing.T) { require.NoError(t, err) e := echo.New() - apiv1.RegisterSSERoutes(e, ts.Service.SSEHub, ts.Store, ts.Secret) + api.RegisterSSERoutes(e, ts.Service.SSEHub, ts.Store, ts.Secret) t.Run("no token returns 401", func(t *testing.T) { - req := httptest.NewRequest(http.MethodGet, "/api/v1/sse", nil) + req := httptest.NewRequest(http.MethodGet, "/api/sse", nil) rec := httptest.NewRecorder() e.ServeHTTP(rec, req) require.Equal(t, http.StatusUnauthorized, rec.Code) }) t.Run("invalid token returns 401", func(t *testing.T) { - req := httptest.NewRequest(http.MethodGet, "/api/v1/sse", nil) + req := httptest.NewRequest(http.MethodGet, "/api/sse", nil) req.Header.Set("Authorization", "Bearer invalid-token") rec := httptest.NewRecorder() e.ServeHTTP(rec, req) @@ -58,7 +58,7 @@ func TestSSEHandler_Authentication(t *testing.T) { // blocking the test indefinitely. reqCtx, cancel := context.WithCancel(context.Background()) defer cancel() - req := httptest.NewRequest(http.MethodGet, "/api/v1/sse", nil).WithContext(reqCtx) + req := httptest.NewRequest(http.MethodGet, "/api/sse", nil).WithContext(reqCtx) req.Header.Set("Authorization", "Bearer "+token) rec := httptest.NewRecorder() done := make(chan struct{}) @@ -74,7 +74,7 @@ func TestSSEHandler_Authentication(t *testing.T) { }) t.Run("token in query param returns 401", func(t *testing.T) { - req := httptest.NewRequest(http.MethodGet, "/api/v1/sse?token="+token, nil) + req := httptest.NewRequest(http.MethodGet, "/api/sse?token="+token, nil) rec := httptest.NewRecorder() e.ServeHTTP(rec, req) require.Equal(t, http.StatusUnauthorized, rec.Code) @@ -86,7 +86,7 @@ func TestSSEHandler_Authentication(t *testing.T) { reqCtx, cancel := context.WithTimeout(ctx, time.Second) defer cancel() - req, err := http.NewRequestWithContext(reqCtx, http.MethodGet, server.URL+"/api/v1/sse", nil) + req, err := http.NewRequestWithContext(reqCtx, http.MethodGet, server.URL+"/api/sse", nil) require.NoError(t, err) req.Header.Set("Authorization", "Bearer "+token) @@ -104,11 +104,11 @@ func TestSSEHandler_Authentication(t *testing.T) { require.NoError(t, err) require.Equal(t, "\n", line) - _, err = ts.Service.CreateMemo(ts.CreateUserContext(ctx, user.ID), &v1pb.CreateMemoRequest{ + _, err = ts.Service.CreateMemo(ts.CreateUserContext(ctx, user.ID), &apipb.CreateMemoRequest{ MemoId: "streamed", - Memo: &v1pb.Memo{ + Memo: &apipb.Memo{ Content: "streamed memo", - Visibility: v1pb.Visibility_PUBLIC, + Visibility: apipb.Visibility_PUBLIC, }, }) require.NoError(t, err) @@ -125,7 +125,7 @@ func TestSSEHandler_Authentication(t *testing.T) { server := httptest.NewTestServer(t, e) client := server.Client() - req, err := http.NewRequestWithContext(ctx, http.MethodGet, server.URL+"/api/v1/sse", nil) + req, err := http.NewRequestWithContext(ctx, http.MethodGet, server.URL+"/api/sse", nil) require.NoError(t, err) req.Header.Set("Authorization", "Bearer "+token) diff --git a/server/api/v1/test/test_helper.go b/server/api/test/test_helper.go similarity index 95% rename from server/api/v1/test/test_helper.go rename to server/api/test/test_helper.go index 346f5e19c..426e263a1 100644 --- a/server/api/v1/test/test_helper.go +++ b/server/api/test/test_helper.go @@ -8,7 +8,7 @@ import ( "github.com/usememos/memos/internal/profile" "github.com/usememos/memos/markdown" storepb "github.com/usememos/memos/proto/gen/store" - apiv1 "github.com/usememos/memos/server/api/v1" + "github.com/usememos/memos/server/api" "github.com/usememos/memos/server/auth" "github.com/usememos/memos/store" teststore "github.com/usememos/memos/store/test" @@ -16,7 +16,7 @@ import ( // TestService holds the test service setup for API v1 services. type TestService struct { - Service *apiv1.APIV1Service + Service *api.APIService Store *store.Store Profile *profile.Profile Secret string @@ -49,18 +49,18 @@ func NewTestService(t *testing.T) *TestService { Data: testStore.GetDataDir(), } - // Create APIV1Service with nil grpcServer since we're testing direct calls + // Create APIService with nil grpcServer since we're testing direct calls secret := "test-secret" markdownService := markdown.NewService( markdown.WithTagExtension(), markdown.WithMentionExtension(), ) - service := &apiv1.APIV1Service{ + service := &api.APIService{ Secret: secret, Profile: testProfile, Store: testStore, MarkdownService: markdownService, - SSEHub: apiv1.NewSSEHub(), + SSEHub: api.NewSSEHub(), } return &TestService{ diff --git a/server/api/v1/test/user_email_visibility_test.go b/server/api/test/user_email_visibility_test.go similarity index 86% rename from server/api/v1/test/user_email_visibility_test.go rename to server/api/test/user_email_visibility_test.go index 40e69f4e5..179f11ed3 100644 --- a/server/api/v1/test/user_email_visibility_test.go +++ b/server/api/test/user_email_visibility_test.go @@ -6,7 +6,7 @@ import ( "github.com/stretchr/testify/require" - apiv1 "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" ) func TestUserEmailVisibility(t *testing.T) { @@ -19,7 +19,7 @@ func TestUserEmailVisibility(t *testing.T) { user, err := ts.CreateRegularUser(ctx, "targetuser") require.NoError(t, err) - got, err := ts.Service.GetUser(ctx, &apiv1.GetUserRequest{ + got, err := ts.Service.GetUser(ctx, &apipb.GetUserRequest{ Name: "users/targetuser", }) require.NoError(t, err) @@ -38,7 +38,7 @@ func TestUserEmailVisibility(t *testing.T) { require.NoError(t, err) viewerCtx := ts.CreateUserContext(ctx, viewer.ID) - got, err := ts.Service.GetUser(viewerCtx, &apiv1.GetUserRequest{ + got, err := ts.Service.GetUser(viewerCtx, &apipb.GetUserRequest{ Name: "users/targetuser", }) require.NoError(t, err) @@ -55,7 +55,7 @@ func TestUserEmailVisibility(t *testing.T) { require.NoError(t, err) userCtx := ts.CreateUserContext(ctx, user.ID) - got, err := ts.Service.GetUser(userCtx, &apiv1.GetUserRequest{ + got, err := ts.Service.GetUser(userCtx, &apipb.GetUserRequest{ Name: "users/selfuser", }) require.NoError(t, err) @@ -73,7 +73,7 @@ func TestUserEmailVisibility(t *testing.T) { require.NoError(t, err) adminCtx := ts.CreateUserContext(ctx, admin.ID) - got, err := ts.Service.GetUser(adminCtx, &apiv1.GetUserRequest{ + got, err := ts.Service.GetUser(adminCtx, &apipb.GetUserRequest{ Name: "users/targetuser", }) require.NoError(t, err) @@ -89,7 +89,7 @@ func TestUserEmailVisibility(t *testing.T) { require.NoError(t, err) userCtx := ts.CreateUserContext(ctx, user.ID) - got, err := ts.Service.GetCurrentUser(userCtx, &apiv1.GetCurrentUserRequest{}) + got, err := ts.Service.GetCurrentUser(userCtx, &apipb.GetCurrentUserRequest{}) require.NoError(t, err) require.NotNil(t, got) require.NotNil(t, got.User) @@ -103,7 +103,7 @@ func TestUserEmailVisibility(t *testing.T) { admin, err := ts.CreateHostUser(ctx, "admin") require.NoError(t, err) - got, err := ts.Service.GetInstanceProfile(ctx, &apiv1.GetInstanceProfileRequest{}) + got, err := ts.Service.GetInstanceProfile(ctx, &apipb.GetInstanceProfileRequest{}) require.NoError(t, err) require.NotNil(t, got) require.NotNil(t, got.Admin) diff --git a/server/api/v1/test/user_notification_test.go b/server/api/test/user_notification_test.go similarity index 75% rename from server/api/v1/test/user_notification_test.go rename to server/api/test/user_notification_test.go index d391b69ba..6bf8d3eca 100644 --- a/server/api/v1/test/user_notification_test.go +++ b/server/api/test/user_notification_test.go @@ -7,10 +7,12 @@ import ( "testing" "github.com/stretchr/testify/require" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" "google.golang.org/protobuf/types/known/fieldmaskpb" "github.com/usememos/memos/internal/email" - apiv1 "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" storepb "github.com/usememos/memos/proto/gen/store" "github.com/usememos/memos/store" ) @@ -28,24 +30,24 @@ func TestListUserNotificationsIncludesMemoCommentPayload(t *testing.T) { require.NoError(t, err) commenterCtx := ts.CreateUserContext(ctx, commenter.ID) - memo, err := ts.Service.CreateMemo(ownerCtx, &apiv1.CreateMemoRequest{ - Memo: &apiv1.Memo{ + memo, err := ts.Service.CreateMemo(ownerCtx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{ Content: "Base memo", - Visibility: apiv1.Visibility_PUBLIC, + Visibility: apipb.Visibility_PUBLIC, }, }) require.NoError(t, err) - comment, err := ts.Service.CreateMemoComment(commenterCtx, &apiv1.CreateMemoCommentRequest{ - Name: memo.Name, - Comment: &apiv1.Memo{ + comment, err := ts.Service.CreateMemoComment(commenterCtx, &apipb.CreateMemoCommentRequest{ + Parent: memo.Name, + Comment: &apipb.Memo{ Content: "Comment content", - Visibility: apiv1.Visibility_PUBLIC, + Visibility: apipb.Visibility_PUBLIC, }, }) require.NoError(t, err) - resp, err := ts.Service.ListUserNotifications(ownerCtx, &apiv1.ListUserNotificationsRequest{ + resp, err := ts.Service.ListUserNotifications(ownerCtx, &apipb.ListUserNotificationsRequest{ Parent: fmt.Sprintf("users/%s", owner.Username), }) require.NoError(t, err) @@ -56,7 +58,7 @@ func TestListUserNotificationsIncludesMemoCommentPayload(t *testing.T) { require.Equal(t, fmt.Sprintf("users/%s", commenter.Username), notification.Sender) require.NotNil(t, notification.SenderUser) require.Equal(t, commenter.Username, notification.SenderUser.Username) - require.Equal(t, apiv1.UserNotification_MEMO_COMMENT, notification.Type) + require.Equal(t, apipb.UserNotification_MEMO_COMMENT, notification.Type) require.NotNil(t, notification.GetMemoComment()) require.Equal(t, comment.Name, notification.GetMemoComment().Memo) require.Equal(t, memo.Name, notification.GetMemoComment().RelatedMemo) @@ -77,19 +79,19 @@ func TestListUserNotificationsStoresMemoCommentPayloadInInbox(t *testing.T) { require.NoError(t, err) commenterCtx := ts.CreateUserContext(ctx, commenter.ID) - memo, err := ts.Service.CreateMemo(ownerCtx, &apiv1.CreateMemoRequest{ - Memo: &apiv1.Memo{ + memo, err := ts.Service.CreateMemo(ownerCtx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{ Content: "Base memo", - Visibility: apiv1.Visibility_PUBLIC, + Visibility: apipb.Visibility_PUBLIC, }, }) require.NoError(t, err) - _, err = ts.Service.CreateMemoComment(commenterCtx, &apiv1.CreateMemoCommentRequest{ - Name: memo.Name, - Comment: &apiv1.Memo{ + _, err = ts.Service.CreateMemoComment(commenterCtx, &apipb.CreateMemoCommentRequest{ + Parent: memo.Name, + Comment: &apipb.Memo{ Content: "Comment content", - Visibility: apiv1.Visibility_PUBLIC, + Visibility: apipb.Visibility_PUBLIC, }, }) require.NoError(t, err) @@ -145,19 +147,19 @@ func TestAssignedPublicMemoCommentNotifiesReadableRemovedAuthor(t *testing.T) { Role: store.SpaceMemberRoleAdmin, }, owner.ID) require.NoError(t, err) - memo, err := ts.Service.CreateMemo(ownerCtx, &apiv1.CreateMemoRequest{Memo: &apiv1.Memo{ + memo, err := ts.Service.CreateMemo(ownerCtx, &apipb.CreateMemoRequest{Memo: &apipb.Memo{ Content: "assigned public memo", - Visibility: apiv1.Visibility_PUBLIC, + Visibility: apipb.Visibility_PUBLIC, Space: ptr("spaces/" + space.UID), }}) require.NoError(t, err) require.NoError(t, ts.Store.DeleteSpaceMember(ctx, &store.DeleteSpaceMember{SpaceID: space.ID, UserID: owner.ID}, owner.ID)) - _, err = ts.Service.CreateMemoComment(commenterCtx, &apiv1.CreateMemoCommentRequest{ - Name: memo.Name, - Comment: &apiv1.Memo{ + _, err = ts.Service.CreateMemoComment(commenterCtx, &apipb.CreateMemoCommentRequest{ + Parent: memo.Name, + Comment: &apipb.Memo{ Content: "public comment visible to removed owner", - Visibility: apiv1.Visibility_PUBLIC, + Visibility: apipb.Visibility_PUBLIC, }, }) require.NoError(t, err) @@ -167,7 +169,7 @@ func TestAssignedPublicMemoCommentNotifiesReadableRemovedAuthor(t *testing.T) { inboxes, err := ts.Store.ListInboxes(ctx, &store.FindInbox{ReceiverID: &owner.ID, MessageType: &messageType}) require.NoError(t, err) require.Len(t, inboxes, 1) - response, err := ts.Service.ListUserNotifications(ownerCtx, &apiv1.ListUserNotificationsRequest{Parent: "users/" + owner.Username}) + response, err := ts.Service.ListUserNotifications(ownerCtx, &apipb.ListUserNotificationsRequest{Parent: "users/" + owner.Username}) require.NoError(t, err) require.Len(t, response.Notifications, 1) @@ -178,11 +180,11 @@ func TestAssignedPublicMemoCommentNotifiesReadableRemovedAuthor(t *testing.T) { }, commenter.ID) require.NoError(t, err) sentMessage = nil - _, err = ts.Service.CreateMemoComment(commenterCtx, &apiv1.CreateMemoCommentRequest{ - Name: memo.Name, - Comment: &apiv1.Memo{ + _, err = ts.Service.CreateMemoComment(commenterCtx, &apipb.CreateMemoCommentRequest{ + Parent: memo.Name, + Comment: &apipb.Memo{ Content: "comment visible while owner is a member", - Visibility: apiv1.Visibility_PUBLIC, + Visibility: apipb.Visibility_PUBLIC, }, }) require.NoError(t, err) @@ -192,7 +194,7 @@ func TestAssignedPublicMemoCommentNotifiesReadableRemovedAuthor(t *testing.T) { require.Len(t, inboxes, 2) require.NoError(t, ts.Store.DeleteSpaceMember(ctx, &store.DeleteSpaceMember{SpaceID: space.ID, UserID: owner.ID}, commenter.ID)) - response, err = ts.Service.ListUserNotifications(ownerCtx, &apiv1.ListUserNotificationsRequest{Parent: "users/" + owner.Username}) + response, err = ts.Service.ListUserNotifications(ownerCtx, &apipb.ListUserNotificationsRequest{Parent: "users/" + owner.Username}) require.NoError(t, err) require.Len(t, response.Notifications, 2, "both PUBLIC endpoints remain readable after membership revocation") } @@ -237,19 +239,19 @@ func TestCreateMemoCommentSendsEmailNotificationWhenEnabled(t *testing.T) { require.NoError(t, err) commenterCtx := ts.CreateUserContext(ctx, commenter.ID) - memo, err := ts.Service.CreateMemo(ownerCtx, &apiv1.CreateMemoRequest{ - Memo: &apiv1.Memo{ + memo, err := ts.Service.CreateMemo(ownerCtx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{ Content: "Base memo for email", - Visibility: apiv1.Visibility_PUBLIC, + Visibility: apipb.Visibility_PUBLIC, }, }) require.NoError(t, err) - comment, err := ts.Service.CreateMemoComment(commenterCtx, &apiv1.CreateMemoCommentRequest{ - Name: memo.Name, - Comment: &apiv1.Memo{ + comment, err := ts.Service.CreateMemoComment(commenterCtx, &apipb.CreateMemoCommentRequest{ + Parent: memo.Name, + Comment: &apipb.Memo{ Content: "Email comment content", - Visibility: apiv1.Visibility_PUBLIC, + Visibility: apipb.Visibility_PUBLIC, }, }) require.NoError(t, err) @@ -304,10 +306,10 @@ func TestCreateMemoMentionSendsEmailNotificationWhenEnabled(t *testing.T) { target, err := ts.CreateRegularUser(ctx, "email-mention-target") require.NoError(t, err) - memo, err := ts.Service.CreateMemo(authorCtx, &apiv1.CreateMemoRequest{ - Memo: &apiv1.Memo{ + memo, err := ts.Service.CreateMemo(authorCtx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{ Content: fmt.Sprintf("Hello @%s from email", target.Username), - Visibility: apiv1.Visibility_PUBLIC, + Visibility: apipb.Visibility_PUBLIC, }, }) require.NoError(t, err) @@ -357,19 +359,19 @@ func TestCreateMemoCommentSkipsEmailNotificationWithoutInstanceURL(t *testing.T) require.NoError(t, err) commenterCtx := ts.CreateUserContext(ctx, commenter.ID) - memo, err := ts.Service.CreateMemo(ownerCtx, &apiv1.CreateMemoRequest{ - Memo: &apiv1.Memo{ + memo, err := ts.Service.CreateMemo(ownerCtx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{ Content: "Base memo without instance URL", - Visibility: apiv1.Visibility_PUBLIC, + Visibility: apipb.Visibility_PUBLIC, }, }) require.NoError(t, err) - _, err = ts.Service.CreateMemoComment(commenterCtx, &apiv1.CreateMemoCommentRequest{ - Name: memo.Name, - Comment: &apiv1.Memo{ + _, err = ts.Service.CreateMemoComment(commenterCtx, &apipb.CreateMemoCommentRequest{ + Parent: memo.Name, + Comment: &apipb.Memo{ Content: "Comment without instance URL", - Visibility: apiv1.Visibility_PUBLIC, + Visibility: apipb.Visibility_PUBLIC, }, }) require.NoError(t, err) @@ -389,29 +391,29 @@ func TestListUserNotificationsOmitsNotificationWhenMemoDeleted(t *testing.T) { require.NoError(t, err) commenterCtx := ts.CreateUserContext(ctx, commenter.ID) - memo, err := ts.Service.CreateMemo(ownerCtx, &apiv1.CreateMemoRequest{ - Memo: &apiv1.Memo{ + memo, err := ts.Service.CreateMemo(ownerCtx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{ Content: "Base memo", - Visibility: apiv1.Visibility_PUBLIC, + Visibility: apipb.Visibility_PUBLIC, }, }) require.NoError(t, err) - _, err = ts.Service.CreateMemoComment(commenterCtx, &apiv1.CreateMemoCommentRequest{ - Name: memo.Name, - Comment: &apiv1.Memo{ + _, err = ts.Service.CreateMemoComment(commenterCtx, &apipb.CreateMemoCommentRequest{ + Parent: memo.Name, + Comment: &apipb.Memo{ Content: "Comment content", - Visibility: apiv1.Visibility_PUBLIC, + Visibility: apipb.Visibility_PUBLIC, }, }) require.NoError(t, err) - _, err = ts.Service.DeleteMemo(ownerCtx, &apiv1.DeleteMemoRequest{ + _, err = ts.Service.DeleteMemo(ownerCtx, &apipb.DeleteMemoRequest{ Name: memo.Name, }) require.NoError(t, err) - resp, err := ts.Service.ListUserNotifications(ownerCtx, &apiv1.ListUserNotificationsRequest{ + resp, err := ts.Service.ListUserNotifications(ownerCtx, &apipb.ListUserNotificationsRequest{ Parent: fmt.Sprintf("users/%s", owner.Username), }) require.NoError(t, err) @@ -431,19 +433,19 @@ func TestListUserNotificationsSkipsNotificationsWithMissingUsers(t *testing.T) { require.NoError(t, err) commenterCtx := ts.CreateUserContext(ctx, commenter.ID) - memo, err := ts.Service.CreateMemo(ownerCtx, &apiv1.CreateMemoRequest{ - Memo: &apiv1.Memo{ + memo, err := ts.Service.CreateMemo(ownerCtx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{ Content: "Base memo", - Visibility: apiv1.Visibility_PUBLIC, + Visibility: apipb.Visibility_PUBLIC, }, }) require.NoError(t, err) - _, err = ts.Service.CreateMemoComment(commenterCtx, &apiv1.CreateMemoCommentRequest{ - Name: memo.Name, - Comment: &apiv1.Memo{ + _, err = ts.Service.CreateMemoComment(commenterCtx, &apipb.CreateMemoCommentRequest{ + Parent: memo.Name, + Comment: &apipb.Memo{ Content: "Comment content", - Visibility: apiv1.Visibility_PUBLIC, + Visibility: apipb.Visibility_PUBLIC, }, }) require.NoError(t, err) @@ -451,13 +453,54 @@ func TestListUserNotificationsSkipsNotificationsWithMissingUsers(t *testing.T) { _, err = ts.Store.DeleteUser(ctx, &store.DeleteUser{ID: commenter.ID}) require.NoError(t, err) - resp, err := ts.Service.ListUserNotifications(ownerCtx, &apiv1.ListUserNotificationsRequest{ + resp, err := ts.Service.ListUserNotifications(ownerCtx, &apipb.ListUserNotificationsRequest{ Parent: fmt.Sprintf("users/%s", owner.Username), }) require.NoError(t, err) require.Empty(t, resp.Notifications) } +func TestUpdateUserNotificationRequiresUpdateMask(t *testing.T) { + ctx := context.Background() + ts := NewTestService(t) + defer ts.Cleanup() + + owner, err := ts.CreateRegularUser(ctx, "notification-owner") + require.NoError(t, err) + ownerCtx := ts.CreateUserContext(ctx, owner.ID) + + commenter, err := ts.CreateRegularUser(ctx, "notification-commenter") + require.NoError(t, err) + commenterCtx := ts.CreateUserContext(ctx, commenter.ID) + + memo, err := ts.Service.CreateMemo(ownerCtx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{Content: "Base memo", Visibility: apipb.Visibility_PUBLIC}, + }) + require.NoError(t, err) + _, err = ts.Service.CreateMemoComment(commenterCtx, &apipb.CreateMemoCommentRequest{ + Parent: memo.Name, + Comment: &apipb.Memo{Content: "Comment content", Visibility: apipb.Visibility_PUBLIC}, + }) + require.NoError(t, err) + + resp, err := ts.Service.ListUserNotifications(ownerCtx, &apipb.ListUserNotificationsRequest{ + Parent: fmt.Sprintf("users/%s", owner.Username), + }) + require.NoError(t, err) + require.Len(t, resp.Notifications, 1) + + for _, mask := range []*fieldmaskpb.FieldMask{nil, {}} { + _, err = ts.Service.UpdateUserNotification(ownerCtx, &apipb.UpdateUserNotificationRequest{ + Notification: &apipb.UserNotification{ + Name: resp.Notifications[0].Name, + Status: apipb.UserNotification_ARCHIVED, + }, + UpdateMask: mask, + }) + require.Equal(t, codes.InvalidArgument, status.Code(err)) + } +} + func TestListUserNotificationsRejectsNumericParent(t *testing.T) { ctx := context.Background() ts := NewTestService(t) @@ -467,7 +510,7 @@ func TestListUserNotificationsRejectsNumericParent(t *testing.T) { require.NoError(t, err) ownerCtx := ts.CreateUserContext(ctx, owner.ID) - _, err = ts.Service.ListUserNotifications(ownerCtx, &apiv1.ListUserNotificationsRequest{ + _, err = ts.Service.ListUserNotifications(ownerCtx, &apipb.ListUserNotificationsRequest{ Parent: "users/1", }) require.Error(t, err) @@ -487,20 +530,20 @@ func TestListUserNotificationsIncludesMemoMentionPayload(t *testing.T) { require.NoError(t, err) targetCtx := ts.CreateUserContext(ctx, target.ID) - memo, err := ts.Service.CreateMemo(authorCtx, &apiv1.CreateMemoRequest{ - Memo: &apiv1.Memo{ + memo, err := ts.Service.CreateMemo(authorCtx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{ Content: fmt.Sprintf("Hello @%s", target.Username), - Visibility: apiv1.Visibility_PUBLIC, + Visibility: apipb.Visibility_PUBLIC, }, }) require.NoError(t, err) - resp, err := ts.Service.ListUserNotifications(targetCtx, &apiv1.ListUserNotificationsRequest{ + resp, err := ts.Service.ListUserNotifications(targetCtx, &apipb.ListUserNotificationsRequest{ Parent: fmt.Sprintf("users/%s", target.Username), }) require.NoError(t, err) require.Len(t, resp.Notifications, 1) - require.Equal(t, apiv1.UserNotification_MEMO_MENTION, resp.Notifications[0].Type) + require.Equal(t, apipb.UserNotification_MEMO_MENTION, resp.Notifications[0].Type) require.NotNil(t, resp.Notifications[0].GetMemoMention()) require.Equal(t, memo.Name, resp.Notifications[0].GetMemoMention().Memo) require.Empty(t, resp.Notifications[0].GetMemoMention().RelatedMemo) @@ -521,29 +564,29 @@ func TestCreateMemoCommentMentionDoesNotDuplicateOwnerNotification(t *testing.T) require.NoError(t, err) commenterCtx := ts.CreateUserContext(ctx, commenter.ID) - memo, err := ts.Service.CreateMemo(ownerCtx, &apiv1.CreateMemoRequest{ - Memo: &apiv1.Memo{ + memo, err := ts.Service.CreateMemo(ownerCtx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{ Content: "Base memo", - Visibility: apiv1.Visibility_PUBLIC, + Visibility: apipb.Visibility_PUBLIC, }, }) require.NoError(t, err) - _, err = ts.Service.CreateMemoComment(commenterCtx, &apiv1.CreateMemoCommentRequest{ - Name: memo.Name, - Comment: &apiv1.Memo{ + _, err = ts.Service.CreateMemoComment(commenterCtx, &apipb.CreateMemoCommentRequest{ + Parent: memo.Name, + Comment: &apipb.Memo{ Content: fmt.Sprintf("Hi @%s", owner.Username), - Visibility: apiv1.Visibility_PUBLIC, + Visibility: apipb.Visibility_PUBLIC, }, }) require.NoError(t, err) - resp, err := ts.Service.ListUserNotifications(ownerCtx, &apiv1.ListUserNotificationsRequest{ + resp, err := ts.Service.ListUserNotifications(ownerCtx, &apipb.ListUserNotificationsRequest{ Parent: fmt.Sprintf("users/%s", owner.Username), }) require.NoError(t, err) require.Len(t, resp.Notifications, 1) - require.Equal(t, apiv1.UserNotification_MEMO_COMMENT, resp.Notifications[0].Type) + require.Equal(t, apipb.UserNotification_MEMO_COMMENT, resp.Notifications[0].Type) } func TestUpdateMemoMentionOnlyNotifiesNewTargets(t *testing.T) { @@ -563,52 +606,52 @@ func TestUpdateMemoMentionOnlyNotifiesNewTargets(t *testing.T) { require.NoError(t, err) secondTargetCtx := ts.CreateUserContext(ctx, secondTarget.ID) - memo, err := ts.Service.CreateMemo(authorCtx, &apiv1.CreateMemoRequest{ - Memo: &apiv1.Memo{ + memo, err := ts.Service.CreateMemo(authorCtx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{ Content: "", - Visibility: apiv1.Visibility_PUBLIC, + Visibility: apipb.Visibility_PUBLIC, }, }) require.NoError(t, err) - updatedMemo, err := ts.Service.UpdateMemo(authorCtx, &apiv1.UpdateMemoRequest{ - Memo: &apiv1.Memo{ + updatedMemo, err := ts.Service.UpdateMemo(authorCtx, &apipb.UpdateMemoRequest{ + Memo: &apipb.Memo{ Name: memo.Name, Content: fmt.Sprintf("Hello @%s", firstTarget.Username), - Visibility: apiv1.Visibility_PUBLIC, + Visibility: apipb.Visibility_PUBLIC, }, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"content"}}, }) require.NoError(t, err) - firstResp, err := ts.Service.ListUserNotifications(firstTargetCtx, &apiv1.ListUserNotificationsRequest{ + firstResp, err := ts.Service.ListUserNotifications(firstTargetCtx, &apipb.ListUserNotificationsRequest{ Parent: fmt.Sprintf("users/%s", firstTarget.Username), }) require.NoError(t, err) require.Len(t, firstResp.Notifications, 1) - require.Equal(t, apiv1.UserNotification_MEMO_MENTION, firstResp.Notifications[0].Type) + require.Equal(t, apipb.UserNotification_MEMO_MENTION, firstResp.Notifications[0].Type) require.Equal(t, updatedMemo.Name, firstResp.Notifications[0].GetMemoMention().Memo) - _, err = ts.Service.UpdateMemo(authorCtx, &apiv1.UpdateMemoRequest{ - Memo: &apiv1.Memo{ + _, err = ts.Service.UpdateMemo(authorCtx, &apipb.UpdateMemoRequest{ + Memo: &apipb.Memo{ Name: memo.Name, Content: fmt.Sprintf("Hello again @%s and @%s", firstTarget.Username, secondTarget.Username), - Visibility: apiv1.Visibility_PUBLIC, + Visibility: apipb.Visibility_PUBLIC, }, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"content"}}, }) require.NoError(t, err) - firstResp, err = ts.Service.ListUserNotifications(firstTargetCtx, &apiv1.ListUserNotificationsRequest{ + firstResp, err = ts.Service.ListUserNotifications(firstTargetCtx, &apipb.ListUserNotificationsRequest{ Parent: fmt.Sprintf("users/%s", firstTarget.Username), }) require.NoError(t, err) require.Len(t, firstResp.Notifications, 1) - secondResp, err := ts.Service.ListUserNotifications(secondTargetCtx, &apiv1.ListUserNotificationsRequest{ + secondResp, err := ts.Service.ListUserNotifications(secondTargetCtx, &apipb.ListUserNotificationsRequest{ Parent: fmt.Sprintf("users/%s", secondTarget.Username), }) require.NoError(t, err) require.Len(t, secondResp.Notifications, 1) - require.Equal(t, apiv1.UserNotification_MEMO_MENTION, secondResp.Notifications[0].Type) + require.Equal(t, apipb.UserNotification_MEMO_MENTION, secondResp.Notifications[0].Type) } diff --git a/server/api/v1/test/user_resource_name_test.go b/server/api/test/user_resource_name_test.go similarity index 73% rename from server/api/v1/test/user_resource_name_test.go rename to server/api/test/user_resource_name_test.go index 7ffa6994c..8bd45488c 100644 --- a/server/api/v1/test/user_resource_name_test.go +++ b/server/api/test/user_resource_name_test.go @@ -7,8 +7,8 @@ import ( "github.com/stretchr/testify/require" "google.golang.org/protobuf/types/known/fieldmaskpb" - apiv1 "github.com/usememos/memos/proto/gen/api/v1" - apiv1server "github.com/usememos/memos/server/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" + "github.com/usememos/memos/server/api" "github.com/usememos/memos/store" ) @@ -22,7 +22,7 @@ func TestUserResourceName(t *testing.T) { user, err := ts.CreateRegularUser(ctx, "testuser") require.NoError(t, err) - got, err := ts.Service.GetUser(ctx, &apiv1.GetUserRequest{ + got, err := ts.Service.GetUser(ctx, &apipb.GetUserRequest{ Name: "users/testuser", }) require.NoError(t, err) @@ -35,8 +35,8 @@ func TestUserResourceName(t *testing.T) { ts := NewTestService(t) defer ts.Cleanup() - created, err := ts.Service.CreateUser(ctx, &apiv1.CreateUserRequest{ - User: &apiv1.User{ + created, err := ts.Service.CreateUser(ctx, &apipb.CreateUserRequest{ + User: &apipb.User{ Username: "newuser", Email: "newuser@example.com", Password: "password123", @@ -55,18 +55,18 @@ func TestUserResourceName(t *testing.T) { require.NoError(t, err) userCtx := ts.CreateUserContext(ctx, user.ID) - currentUser, err := ts.Service.GetCurrentUser(userCtx, &apiv1.GetCurrentUserRequest{}) + currentUser, err := ts.Service.GetCurrentUser(userCtx, &apipb.GetCurrentUserRequest{}) require.NoError(t, err) require.NotNil(t, currentUser.GetUser()) require.Equal(t, "users/Gnammi", currentUser.GetUser().Name) - settings, err := ts.Service.ListUserSettings(userCtx, &apiv1.ListUserSettingsRequest{ + settings, err := ts.Service.ListUserSettings(userCtx, &apipb.ListUserSettingsRequest{ Parent: currentUser.GetUser().Name, }) require.NoError(t, err) require.NotNil(t, settings) - memoViews, err := ts.Service.ListMemoViews(userCtx, &apiv1.ListMemoViewsRequest{ + memoViews, err := ts.Service.ListMemoViews(userCtx, &apipb.ListMemoViewsRequest{ Parent: currentUser.GetUser().Name, }) require.NoError(t, err) @@ -80,8 +80,8 @@ func TestUserResourceName(t *testing.T) { user, err := ts.CreateRegularUser(ctx, "Gnammi") require.NoError(t, err) - resp, err := ts.Service.BatchGetUsers(ctx, &apiv1.BatchGetUsersRequest{ - Usernames: []string{user.Username}, + resp, err := ts.Service.BatchGetUsers(ctx, &apipb.BatchGetUsersRequest{ + Names: []string{"users/" + user.Username}, }) require.NoError(t, err) require.Len(t, resp.Users, 1) @@ -92,8 +92,8 @@ func TestUserResourceName(t *testing.T) { ts := NewTestService(t) defer ts.Cleanup() - created, err := ts.Service.CreateUser(ctx, &apiv1.CreateUserRequest{ - User: &apiv1.User{ + created, err := ts.Service.CreateUser(ctx, &apipb.CreateUserRequest{ + User: &apipb.User{ Username: "123", Email: "123@example.com", Password: "password123", @@ -110,7 +110,7 @@ func TestUserResourceName(t *testing.T) { _, err := ts.CreateRegularUser(ctx, "testuser") require.NoError(t, err) - _, err = ts.Service.GetUser(ctx, &apiv1.GetUserRequest{ + _, err = ts.Service.GetUser(ctx, &apipb.GetUserRequest{ Name: "users/1", }) require.Error(t, err) @@ -124,17 +124,17 @@ func TestUserResourceName(t *testing.T) { legacyUser, err := ts.CreateRegularUser(ctx, "legacy_user") require.NoError(t, err) - got, err := ts.Service.GetUser(ctx, &apiv1.GetUserRequest{ + got, err := ts.Service.GetUser(ctx, &apipb.GetUserRequest{ Name: "users/legacy_user", }) require.NoError(t, err) require.NotNil(t, got) require.Equal(t, "users/legacy_user", got.Name) - authCtx := ts.CreateUserContext(apiv1server.WithHeaderCarrier(ctx), legacyUser.ID) - updated, err := ts.Service.UpdateUser(authCtx, &apiv1.UpdateUserRequest{ - User: &apiv1.User{ - Name: apiv1server.BuildUserName(legacyUser.Username), + authCtx := ts.CreateUserContext(api.WithHeaderCarrier(ctx), legacyUser.ID) + updated, err := ts.Service.UpdateUser(authCtx, &apipb.UpdateUserRequest{ + User: &apipb.User{ + Name: api.BuildUserName(legacyUser.Username), DisplayName: "Legacy User", }, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"display_name"}}, @@ -142,8 +142,8 @@ func TestUserResourceName(t *testing.T) { require.NoError(t, err) require.Equal(t, "Legacy User", updated.DisplayName) - _, err = ts.Service.DeleteUser(authCtx, &apiv1.DeleteUserRequest{ - Name: apiv1server.BuildUserName(legacyUser.Username), + _, err = ts.Service.DeleteUser(authCtx, &apipb.DeleteUserRequest{ + Name: api.BuildUserName(legacyUser.Username), }) require.NoError(t, err) @@ -159,10 +159,10 @@ func TestUserResourceName(t *testing.T) { legacyUser, err := ts.CreateRegularUser(ctx, "alice@example.com") require.NoError(t, err) - authCtx := ts.CreateUserContext(apiv1server.WithHeaderCarrier(ctx), legacyUser.ID) - updated, err := ts.Service.UpdateUser(authCtx, &apiv1.UpdateUserRequest{ - User: &apiv1.User{ - Name: apiv1server.BuildUserName(legacyUser.Username), + authCtx := ts.CreateUserContext(api.WithHeaderCarrier(ctx), legacyUser.ID) + updated, err := ts.Service.UpdateUser(authCtx, &apipb.UpdateUserRequest{ + User: &apipb.User{ + Name: api.BuildUserName(legacyUser.Username), Username: "alice", }, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"username"}}, @@ -184,9 +184,9 @@ func TestUserResourceName(t *testing.T) { legacyUser, err := ts.CreateRegularUser(ctx, "bob@example.com") require.NoError(t, err) - authCtx := ts.CreateUserContext(apiv1server.WithHeaderCarrier(ctx), legacyUser.ID) - _, err = ts.Service.DeleteUser(authCtx, &apiv1.DeleteUserRequest{ - Name: apiv1server.BuildUserName(legacyUser.Username), + authCtx := ts.CreateUserContext(api.WithHeaderCarrier(ctx), legacyUser.ID) + _, err = ts.Service.DeleteUser(authCtx, &apipb.DeleteUserRequest{ + Name: api.BuildUserName(legacyUser.Username), }) require.NoError(t, err) diff --git a/server/api/v1/test/user_search_test.go b/server/api/test/user_search_test.go similarity index 58% rename from server/api/v1/test/user_search_test.go rename to server/api/test/user_search_test.go index 20ae108f6..37aa86696 100644 --- a/server/api/v1/test/user_search_test.go +++ b/server/api/test/user_search_test.go @@ -7,7 +7,7 @@ import ( "github.com/stretchr/testify/require" - apiv1 "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" ) func TestBatchGetUsersReturnsExactUsernamesWithoutAuthentication(t *testing.T) { @@ -20,8 +20,8 @@ func TestBatchGetUsersReturnsExactUsernamesWithoutAuthentication(t *testing.T) { _, err = ts.CreateRegularUser(ctx, "batch-beta") require.NoError(t, err) - resp, err := ts.Service.BatchGetUsers(ctx, &apiv1.BatchGetUsersRequest{ - Usernames: []string{"batch-alpha", "batch-beta", "missing-user", "batch-alpha"}, + resp, err := ts.Service.BatchGetUsers(ctx, &apipb.BatchGetUsersRequest{ + Names: []string{"users/batch-alpha", "users/batch-beta", "users/missing-user", "users/batch-alpha"}, }) require.NoError(t, err) require.Len(t, resp.Users, 2) @@ -44,8 +44,8 @@ func TestBatchGetUsersDoesNotNormalizeUsernames(t *testing.T) { _, err := ts.CreateRegularUser(ctx, "batch-alpha") require.NoError(t, err) - resp, err := ts.Service.BatchGetUsers(ctx, &apiv1.BatchGetUsersRequest{ - Usernames: []string{" batch-alpha "}, + resp, err := ts.Service.BatchGetUsers(ctx, &apipb.BatchGetUsersRequest{ + Names: []string{"users/ batch-alpha "}, }) require.NoError(t, err) require.Empty(t, resp.Users) @@ -58,14 +58,14 @@ func TestBatchGetUsersRejectsTooManyUsernames(t *testing.T) { usernames := make([]string, 0, 101) for i := range 101 { - usernames = append(usernames, fmt.Sprintf("user-%d", i)) + usernames = append(usernames, fmt.Sprintf("users/user-%d", i)) } - _, err := ts.Service.BatchGetUsers(ctx, &apiv1.BatchGetUsersRequest{ - Usernames: usernames, + _, err := ts.Service.BatchGetUsers(ctx, &apipb.BatchGetUsersRequest{ + Names: usernames, }) require.Error(t, err) - require.Contains(t, err.Error(), "too many usernames") + require.Contains(t, err.Error(), "too many names") } func TestBatchGetUsersRejectsTooManyNonEmptyUsernamesBeforeDedupe(t *testing.T) { @@ -75,12 +75,24 @@ func TestBatchGetUsersRejectsTooManyNonEmptyUsernamesBeforeDedupe(t *testing.T) usernames := make([]string, 0, 101) for range 101 { - usernames = append(usernames, "legacy@example.com") + usernames = append(usernames, "users/legacy@example.com") } - _, err := ts.Service.BatchGetUsers(ctx, &apiv1.BatchGetUsersRequest{ - Usernames: usernames, + _, err := ts.Service.BatchGetUsers(ctx, &apipb.BatchGetUsersRequest{ + Names: usernames, }) require.Error(t, err) - require.Contains(t, err.Error(), "too many usernames") + require.Contains(t, err.Error(), "too many names") +} + +func TestBatchGetUsersRejectsBareUsernames(t *testing.T) { + ctx := context.Background() + ts := NewTestService(t) + defer ts.Cleanup() + + _, err := ts.Service.BatchGetUsers(ctx, &apipb.BatchGetUsersRequest{ + Names: []string{"batch-alpha"}, + }) + require.Error(t, err) + require.Contains(t, err.Error(), "invalid user name") } diff --git a/server/api/v1/test/user_service_delete_test.go b/server/api/test/user_service_delete_test.go similarity index 88% rename from server/api/v1/test/user_service_delete_test.go rename to server/api/test/user_service_delete_test.go index 10e880e0d..bf5097f45 100644 --- a/server/api/v1/test/user_service_delete_test.go +++ b/server/api/test/user_service_delete_test.go @@ -13,9 +13,9 @@ import ( "google.golang.org/grpc/status" "google.golang.org/protobuf/types/known/timestamppb" - v1pb "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" storepb "github.com/usememos/memos/proto/gen/store" - apiv1 "github.com/usememos/memos/server/api/v1" + "github.com/usememos/memos/server/api" "github.com/usememos/memos/store" ) @@ -43,10 +43,10 @@ func TestDeleteUserSelfDeleteCleansAccountDataAndAuthCookies(t *testing.T) { }) require.NoError(t, err) - headerCtx := apiv1.WithHeaderCarrier(ctx) + headerCtx := api.WithHeaderCarrier(ctx) authCtx := ts.CreateUserContext(headerCtx, user.ID) - _, err = ts.Service.DeleteUser(authCtx, &v1pb.DeleteUserRequest{ - Name: apiv1.BuildUserName(user.Username), + _, err = ts.Service.DeleteUser(authCtx, &apipb.DeleteUserRequest{ + Name: api.BuildUserName(user.Username), }) require.NoError(t, err) @@ -65,7 +65,7 @@ func TestDeleteUserSelfDeleteCleansAccountDataAndAuthCookies(t *testing.T) { require.NoError(t, err) require.Nil(t, refreshSetting) - carrier := apiv1.GetHeaderCarrier(authCtx) + carrier := api.GetHeaderCarrier(authCtx) require.NotNil(t, carrier) require.Contains(t, strings.ToLower(carrier.Get("Set-Cookie")), "memos_refresh=") } @@ -85,64 +85,64 @@ func TestDeleteUserSelfDeleteRemovesOnlyOwnedMemosAndResources(t *testing.T) { userCtx := ts.CreateUserContext(ctx, user.ID) peerCtx := ts.CreateUserContext(ctx, peer.ID) - ownMemo, err := ts.Service.CreateMemo(userCtx, &v1pb.CreateMemoRequest{ - Memo: &v1pb.Memo{ + ownMemo, err := ts.Service.CreateMemo(userCtx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{ Content: "owner memo", - Visibility: v1pb.Visibility_PUBLIC, + Visibility: apipb.Visibility_PUBLIC, }, }) require.NoError(t, err) - foreignMemo, err := ts.Service.CreateMemo(peerCtx, &v1pb.CreateMemoRequest{ - Memo: &v1pb.Memo{ + foreignMemo, err := ts.Service.CreateMemo(peerCtx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{ Content: "peer memo", - Visibility: v1pb.Visibility_PUBLIC, + Visibility: apipb.Visibility_PUBLIC, }, }) require.NoError(t, err) - peerCommentOnOwnMemo, err := ts.Service.CreateMemoComment(peerCtx, &v1pb.CreateMemoCommentRequest{ - Name: ownMemo.Name, - Comment: &v1pb.Memo{ + peerCommentOnOwnMemo, err := ts.Service.CreateMemoComment(peerCtx, &apipb.CreateMemoCommentRequest{ + Parent: ownMemo.Name, + Comment: &apipb.Memo{ Content: "peer comment on owner memo", - Visibility: v1pb.Visibility_PUBLIC, + Visibility: apipb.Visibility_PUBLIC, }, }) require.NoError(t, err) - peerNestedCommentOnOwnMemo, err := ts.Service.CreateMemoComment(peerCtx, &v1pb.CreateMemoCommentRequest{ - Name: peerCommentOnOwnMemo.Name, - Comment: &v1pb.Memo{ + peerNestedCommentOnOwnMemo, err := ts.Service.CreateMemoComment(peerCtx, &apipb.CreateMemoCommentRequest{ + Parent: peerCommentOnOwnMemo.Name, + Comment: &apipb.Memo{ Content: "peer nested comment on owner memo", - Visibility: v1pb.Visibility_PUBLIC, + Visibility: apipb.Visibility_PUBLIC, }, }) require.NoError(t, err) - userCommentOnForeignMemo, err := ts.Service.CreateMemoComment(userCtx, &v1pb.CreateMemoCommentRequest{ - Name: foreignMemo.Name, - Comment: &v1pb.Memo{ + userCommentOnForeignMemo, err := ts.Service.CreateMemoComment(userCtx, &apipb.CreateMemoCommentRequest{ + Parent: foreignMemo.Name, + Comment: &apipb.Memo{ Content: "owner comment on peer memo", - Visibility: v1pb.Visibility_PUBLIC, + Visibility: apipb.Visibility_PUBLIC, }, }) require.NoError(t, err) - peerReplyToUserComment, err := ts.Service.CreateMemoComment(peerCtx, &v1pb.CreateMemoCommentRequest{ - Name: userCommentOnForeignMemo.Name, - Comment: &v1pb.Memo{ + peerReplyToUserComment, err := ts.Service.CreateMemoComment(peerCtx, &apipb.CreateMemoCommentRequest{ + Parent: userCommentOnForeignMemo.Name, + Comment: &apipb.Memo{ Content: "peer reply to owner comment", - Visibility: v1pb.Visibility_PUBLIC, + Visibility: apipb.Visibility_PUBLIC, }, }) require.NoError(t, err) - ownMemoUID, err := apiv1.ExtractMemoUIDFromName(ownMemo.Name) + ownMemoUID, err := api.ExtractMemoUIDFromName(ownMemo.Name) require.NoError(t, err) ownMemoStore, err := ts.Store.GetMemo(ctx, &store.FindMemo{UID: &ownMemoUID}) require.NoError(t, err) require.NotNil(t, ownMemoStore) - foreignMemoUID, err := apiv1.ExtractMemoUIDFromName(foreignMemo.Name) + foreignMemoUID, err := api.ExtractMemoUIDFromName(foreignMemo.Name) require.NoError(t, err) foreignMemoStore, err := ts.Store.GetMemo(ctx, &store.FindMemo{UID: &foreignMemoUID}) require.NoError(t, err) @@ -247,10 +247,10 @@ func TestDeleteUserSelfDeleteRemovesOnlyOwnedMemosAndResources(t *testing.T) { }) require.NoError(t, err) - headerCtx := apiv1.WithHeaderCarrier(ctx) + headerCtx := api.WithHeaderCarrier(ctx) authCtx := ts.CreateUserContext(headerCtx, user.ID) - _, err = ts.Service.DeleteUser(authCtx, &v1pb.DeleteUserRequest{ - Name: apiv1.BuildUserName(user.Username), + _, err = ts.Service.DeleteUser(authCtx, &apipb.DeleteUserRequest{ + Name: api.BuildUserName(user.Username), }) require.NoError(t, err) @@ -262,7 +262,7 @@ func TestDeleteUserSelfDeleteRemovesOnlyOwnedMemosAndResources(t *testing.T) { ownMemo.Name, userCommentOnForeignMemo.Name, } { - memoUID, extractErr := apiv1.ExtractMemoUIDFromName(memoName) + memoUID, extractErr := api.ExtractMemoUIDFromName(memoName) require.NoError(t, extractErr) memo, getErr := ts.Store.GetMemo(ctx, &store.FindMemo{UID: &memoUID}) require.NoError(t, getErr) @@ -273,7 +273,7 @@ func TestDeleteUserSelfDeleteRemovesOnlyOwnedMemosAndResources(t *testing.T) { peerNestedCommentOnOwnMemo.Name, peerReplyToUserComment.Name, } { - memoUID, extractErr := apiv1.ExtractMemoUIDFromName(memoName) + memoUID, extractErr := api.ExtractMemoUIDFromName(memoName) require.NoError(t, extractErr) memo, getErr := ts.Store.GetMemo(ctx, &store.FindMemo{UID: &memoUID}) require.NoError(t, getErr) @@ -368,14 +368,14 @@ func TestDeleteUserSpaceMembershipGuardIgnoresForce(t *testing.T) { require.NoError(t, err) space, err := ts.Store.CreateSpace(ctx, &store.Space{UID: "membership-delete-" + tc.suffix, Title: "Membership guard"}, user.ID) require.NoError(t, err) - memo, err := ts.Service.CreateMemo(ts.CreateUserContext(ctx, user.ID), &v1pb.CreateMemoRequest{Memo: &v1pb.Memo{ + memo, err := ts.Service.CreateMemo(ts.CreateUserContext(ctx, user.ID), &apipb.CreateMemoRequest{Memo: &apipb.Memo{ Content: "must survive failed account deletion", - Visibility: v1pb.Visibility_PUBLIC, + Visibility: apipb.Visibility_PUBLIC, }}) require.NoError(t, err) - _, err = ts.Service.DeleteUser(ts.CreateUserContext(ctx, user.ID), &v1pb.DeleteUserRequest{ - Name: apiv1.BuildUserName(user.Username), + _, err = ts.Service.DeleteUser(ts.CreateUserContext(ctx, user.ID), &apipb.DeleteUserRequest{ + Name: api.BuildUserName(user.Username), Force: tc.force, }) require.Equal(t, codes.FailedPrecondition, status.Code(err)) @@ -387,7 +387,7 @@ func TestDeleteUserSpaceMembershipGuardIgnoresForce(t *testing.T) { membership, err := ts.Store.GetSpaceMember(ctx, &store.FindSpaceMember{SpaceID: &space.ID, UserID: &user.ID, ViewerUserID: &user.ID}) require.NoError(t, err) require.NotNil(t, membership) - memoUID, err := apiv1.ExtractMemoUIDFromName(memo.Name) + memoUID, err := api.ExtractMemoUIDFromName(memo.Name) require.NoError(t, err) remainingMemo, err := ts.Store.GetMemo(ctx, &store.FindMemo{UID: &memoUID}) require.NoError(t, err) @@ -409,15 +409,15 @@ func TestDeleteUserRollbackPreservesAllResources(t *testing.T) { require.NoError(t, err) userCtx := ts.CreateUserContext(ctx, user.ID) - ownMemo, err := ts.Service.CreateMemo(userCtx, &v1pb.CreateMemoRequest{ - Memo: &v1pb.Memo{ + ownMemo, err := ts.Service.CreateMemo(userCtx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{ Content: "rollback owner memo", - Visibility: v1pb.Visibility_PUBLIC, + Visibility: apipb.Visibility_PUBLIC, }, }) require.NoError(t, err) - ownMemoUID, err := apiv1.ExtractMemoUIDFromName(ownMemo.Name) + ownMemoUID, err := api.ExtractMemoUIDFromName(ownMemo.Name) require.NoError(t, err) ownMemoStore, err := ts.Store.GetMemo(ctx, &store.FindMemo{UID: &ownMemoUID}) require.NoError(t, err) @@ -476,11 +476,11 @@ func TestDeleteUserRollbackPreservesAllResources(t *testing.T) { }) require.NoError(t, err) - headerCtx := apiv1.WithHeaderCarrier(ctx) + headerCtx := api.WithHeaderCarrier(ctx) failCtx := store.WithDeleteUserFailpoint(headerCtx, store.DeleteUserFailpointBeforeCommit) authCtx := ts.CreateUserContext(failCtx, user.ID) - _, err = ts.Service.DeleteUser(authCtx, &v1pb.DeleteUserRequest{ - Name: apiv1.BuildUserName(user.Username), + _, err = ts.Service.DeleteUser(authCtx, &apipb.DeleteUserRequest{ + Name: api.BuildUserName(user.Username), }) require.Error(t, err) require.ErrorContains(t, err, "delete user failpoint before commit") @@ -545,10 +545,10 @@ func TestDeleteUserReportsPostCommitAttachmentStorageCleanupFailure(t *testing.T attachmentPath := filepath.Join(ts.Profile.Data, "cleanup-failure.txt") require.NoError(t, os.WriteFile(attachmentPath, []byte("failure"), 0o600)) - headerCtx := apiv1.WithHeaderCarrier(ctx) + headerCtx := api.WithHeaderCarrier(ctx) authCtx := ts.CreateUserContext(store.WithDeleteAttachmentStorageFailpoint(headerCtx), user.ID) - _, err = ts.Service.DeleteUser(authCtx, &v1pb.DeleteUserRequest{ - Name: apiv1.BuildUserName(user.Username), + _, err = ts.Service.DeleteUser(authCtx, &apipb.DeleteUserRequest{ + Name: api.BuildUserName(user.Username), }) require.Equal(t, codes.Internal, status.Code(err)) require.ErrorContains(t, err, "user was deleted but attachment storage cleanup failed") diff --git a/server/api/v1/test/user_service_email_username_test.go b/server/api/test/user_service_email_username_test.go similarity index 81% rename from server/api/v1/test/user_service_email_username_test.go rename to server/api/test/user_service_email_username_test.go index 258f780a9..bc3f9bbf2 100644 --- a/server/api/v1/test/user_service_email_username_test.go +++ b/server/api/test/user_service_email_username_test.go @@ -8,8 +8,8 @@ import ( "golang.org/x/crypto/bcrypt" "google.golang.org/protobuf/types/known/fieldmaskpb" - apiv1 "github.com/usememos/memos/proto/gen/api/v1" - apiv1server "github.com/usememos/memos/server/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" + "github.com/usememos/memos/server/api" "github.com/usememos/memos/store" ) @@ -22,10 +22,10 @@ func TestUserServiceWithEmailLikeUsername(t *testing.T) { user := createLegacyPasswordUser(ctx, t, ts, "signin@example.com", "password123") - signInCtx := apiv1server.WithHeaderCarrier(ctx) - resp, err := ts.Service.SignIn(signInCtx, &apiv1.SignInRequest{ - Credentials: &apiv1.SignInRequest_PasswordCredentials_{ - PasswordCredentials: &apiv1.SignInRequest_PasswordCredentials{ + signInCtx := api.WithHeaderCarrier(ctx) + resp, err := ts.Service.SignIn(signInCtx, &apipb.SignInRequest{ + Credentials: &apipb.SignInRequest_PasswordCredentials_{ + PasswordCredentials: &apipb.SignInRequest_PasswordCredentials{ Username: user.Username, Password: "password123", }, @@ -43,7 +43,7 @@ func TestUserServiceWithEmailLikeUsername(t *testing.T) { user, err := ts.CreateRegularUser(ctx, "alice@example.com") require.NoError(t, err) - got, err := ts.Service.GetUser(ctx, &apiv1.GetUserRequest{ + got, err := ts.Service.GetUser(ctx, &apipb.GetUserRequest{ Name: "users/alice@example.com", }) require.NoError(t, err) @@ -59,8 +59,8 @@ func TestUserServiceWithEmailLikeUsername(t *testing.T) { user, err := ts.CreateRegularUser(ctx, "batch@example.com") require.NoError(t, err) - resp, err := ts.Service.BatchGetUsers(ctx, &apiv1.BatchGetUsersRequest{ - Usernames: []string{" batch@example.com ", "missing@example.com", "batch@example.com"}, + resp, err := ts.Service.BatchGetUsers(ctx, &apipb.BatchGetUsersRequest{ + Names: []string{"users/ batch@example.com ", "users/missing@example.com", "users/batch@example.com"}, }) require.NoError(t, err) require.Len(t, resp.Users, 1) @@ -75,8 +75,8 @@ func TestUserServiceWithEmailLikeUsername(t *testing.T) { user, err := ts.CreateRegularUser(ctx, "legacy_batch") require.NoError(t, err) - resp, err := ts.Service.BatchGetUsers(ctx, &apiv1.BatchGetUsersRequest{ - Usernames: []string{"legacy_batch"}, + resp, err := ts.Service.BatchGetUsers(ctx, &apipb.BatchGetUsersRequest{ + Names: []string{"users/legacy_batch"}, }) require.NoError(t, err) require.Len(t, resp.Users, 1) @@ -92,12 +92,12 @@ func TestUserServiceWithEmailLikeUsername(t *testing.T) { require.NoError(t, err) userCtx := ts.CreateUserContext(ctx, user.ID) - resp, err := ts.Service.ListUserSettings(userCtx, &apiv1.ListUserSettingsRequest{ + resp, err := ts.Service.ListUserSettings(userCtx, &apipb.ListUserSettingsRequest{ Parent: "users/alice@example.com", }) require.NoError(t, err) require.NotNil(t, resp) - require.NotEmpty(t, resp.Settings) + require.NotEmpty(t, resp.UserSettings) }) t.Run("UpdateUser can change non-username fields for email-like username", func(t *testing.T) { @@ -108,8 +108,8 @@ func TestUserServiceWithEmailLikeUsername(t *testing.T) { require.NoError(t, err) authCtx := ts.CreateUserContext(ctx, user.ID) - updated, err := ts.Service.UpdateUser(authCtx, &apiv1.UpdateUserRequest{ - User: &apiv1.User{ + updated, err := ts.Service.UpdateUser(authCtx, &apipb.UpdateUserRequest{ + User: &apipb.User{ Name: "users/alice@example.com", DisplayName: "Alice Example", }, @@ -128,8 +128,8 @@ func TestUserServiceWithEmailLikeUsername(t *testing.T) { require.NoError(t, err) authCtx := ts.CreateUserContext(ctx, user.ID) - updated, err := ts.Service.UpdateUser(authCtx, &apiv1.UpdateUserRequest{ - User: &apiv1.User{ + updated, err := ts.Service.UpdateUser(authCtx, &apipb.UpdateUserRequest{ + User: &apipb.User{ Name: "users/bob@example.com", Username: "bob", }, @@ -137,7 +137,7 @@ func TestUserServiceWithEmailLikeUsername(t *testing.T) { }) require.NoError(t, err) require.Equal(t, "bob", updated.Username) - require.Equal(t, apiv1server.BuildUserName("bob"), updated.Name) + require.Equal(t, api.BuildUserName("bob"), updated.Name) stored, err := ts.Store.GetUser(ctx, &store.FindUser{ID: &user.ID}) require.NoError(t, err) @@ -155,8 +155,8 @@ func TestUserServiceWithEmailLikeUsername(t *testing.T) { require.NoError(t, err) authCtx := ts.CreateUserContext(ctx, user.ID) - _, err = ts.Service.UpdateUser(authCtx, &apiv1.UpdateUserRequest{ - User: &apiv1.User{ + _, err = ts.Service.UpdateUser(authCtx, &apipb.UpdateUserRequest{ + User: &apipb.User{ Name: "users/rename@example.com", Username: username, }, @@ -183,9 +183,9 @@ func TestUserServiceWithEmailLikeUsername(t *testing.T) { require.NoError(t, err) adminCtx := ts.CreateUserContext(ctx, admin.ID) - _, err = ts.Service.UpdateUser(adminCtx, &apiv1.UpdateUserRequest{ - User: &apiv1.User{ - Name: apiv1server.BuildUserName(user.Username), + _, err = ts.Service.UpdateUser(adminCtx, &apipb.UpdateUserRequest{ + User: &apipb.User{ + Name: api.BuildUserName(user.Username), Username: "admin@example.com", }, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"username"}}, @@ -209,15 +209,15 @@ func TestUserServiceWithEmailLikeUsername(t *testing.T) { require.NoError(t, err) authCtx := ts.CreateUserContext(ctx, admin.ID) - updated, err := ts.Service.UpdateUser(authCtx, &apiv1.UpdateUserRequest{ - User: &apiv1.User{ + updated, err := ts.Service.UpdateUser(authCtx, &apipb.UpdateUserRequest{ + User: &apipb.User{ Name: "users/dave@example.com", - State: apiv1.State_ARCHIVED, + State: apipb.State_ARCHIVED, }, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"state"}}, }) require.NoError(t, err) - require.Equal(t, apiv1.State_ARCHIVED, updated.State) + require.Equal(t, apipb.State_ARCHIVED, updated.State) stored, err := ts.Store.GetUser(ctx, &store.FindUser{ID: &user.ID}) require.NoError(t, err) @@ -232,8 +232,8 @@ func TestUserServiceWithEmailLikeUsername(t *testing.T) { user, err := ts.CreateRegularUser(ctx, "carol@example.com") require.NoError(t, err) - authCtx := ts.CreateUserContext(apiv1server.WithHeaderCarrier(ctx), user.ID) - _, err = ts.Service.DeleteUser(authCtx, &apiv1.DeleteUserRequest{ + authCtx := ts.CreateUserContext(api.WithHeaderCarrier(ctx), user.ID) + _, err = ts.Service.DeleteUser(authCtx, &apipb.DeleteUserRequest{ Name: "users/carol@example.com", }) require.NoError(t, err) diff --git a/server/api/v1/test/user_service_pagination_test.go b/server/api/test/user_service_pagination_test.go similarity index 87% rename from server/api/v1/test/user_service_pagination_test.go rename to server/api/test/user_service_pagination_test.go index 3aedb8086..582ca8e4a 100644 --- a/server/api/v1/test/user_service_pagination_test.go +++ b/server/api/test/user_service_pagination_test.go @@ -7,16 +7,16 @@ import ( "github.com/stretchr/testify/require" - apiv1 "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" ) // drainListUsers walks every page of ListUsers and returns the concatenated users. -func drainListUsers(ctx context.Context, t *testing.T, ts *TestService, pageSize int32) []*apiv1.User { +func drainListUsers(ctx context.Context, t *testing.T, ts *TestService, pageSize int32) []*apipb.User { t.Helper() - var all []*apiv1.User + var all []*apipb.User pageToken := "" for { - resp, err := ts.Service.ListUsers(ctx, &apiv1.ListUsersRequest{ + resp, err := ts.Service.ListUsers(ctx, &apipb.ListUsersRequest{ PageSize: pageSize, PageToken: pageToken, }) @@ -50,7 +50,7 @@ func TestListUsersPagination(t *testing.T) { } // A partial first page must carry a next page token. - first, err := ts.Service.ListUsers(adminCtx, &apiv1.ListUsersRequest{PageSize: 2}) + first, err := ts.Service.ListUsers(adminCtx, &apipb.ListUsersRequest{PageSize: 2}) require.NoError(t, err) require.Len(t, first.Users, 2) require.NotEmpty(t, first.NextPageToken) @@ -82,7 +82,7 @@ func TestListUsersDefaultPageSizeReturnsAllWhenSmall(t *testing.T) { // With no page size or token the default (50) exceeds the 4 users, so a // single page returns everyone and omits the next page token. This is the // path the admin members UI relies on. - resp, err := ts.Service.ListUsers(adminCtx, &apiv1.ListUsersRequest{}) + resp, err := ts.Service.ListUsers(adminCtx, &apipb.ListUsersRequest{}) require.NoError(t, err) require.Len(t, resp.Users, 4) require.Empty(t, resp.NextPageToken) @@ -97,7 +97,7 @@ func TestListUsersInvalidPageToken(t *testing.T) { require.NoError(t, err) adminCtx := ts.CreateUserContext(ctx, admin.ID) - _, err = ts.Service.ListUsers(adminCtx, &apiv1.ListUsersRequest{PageToken: "not-a-valid-token"}) + _, err = ts.Service.ListUsers(adminCtx, &apipb.ListUsersRequest{PageToken: "not-a-valid-token"}) require.Error(t, err) require.Contains(t, err.Error(), "invalid page token") } diff --git a/server/api/v1/test/user_service_password_test.go b/server/api/test/user_service_password_test.go similarity index 92% rename from server/api/v1/test/user_service_password_test.go rename to server/api/test/user_service_password_test.go index 3ac4d7e07..75c6b636c 100644 --- a/server/api/v1/test/user_service_password_test.go +++ b/server/api/test/user_service_password_test.go @@ -12,7 +12,7 @@ import ( "google.golang.org/protobuf/types/known/fieldmaskpb" "google.golang.org/protobuf/types/known/timestamppb" - v1pb "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" storepb "github.com/usememos/memos/proto/gen/store" "github.com/usememos/memos/server/auth" "github.com/usememos/memos/store" @@ -37,8 +37,8 @@ func sessionIDs(ctx context.Context, t *testing.T, ts *TestService, userID int32 } func changePassword(ctx context.Context, ts *TestService, user *store.User, password string) error { - _, err := ts.Service.UpdateUser(ctx, &v1pb.UpdateUserRequest{ - User: &v1pb.User{Name: "users/" + user.Username, Password: password}, + _, err := ts.Service.UpdateUser(ctx, &apipb.UpdateUserRequest{ + User: &apipb.User{Name: "users/" + user.Username, Password: password}, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"password"}}, }) return err @@ -101,8 +101,8 @@ func TestUpdateUserAvatarSizeBoundedServerSide(t *testing.T) { userCtx := ts.CreateUserContext(ctx, user.ID) oversized := "data:image/png;base64," + strings.Repeat("A", 3<<20) - _, err = ts.Service.UpdateUser(userCtx, &v1pb.UpdateUserRequest{ - User: &v1pb.User{Name: "users/" + user.Username, AvatarUrl: oversized}, + _, err = ts.Service.UpdateUser(userCtx, &apipb.UpdateUserRequest{ + User: &apipb.User{Name: "users/" + user.Username, AvatarUrl: oversized}, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"avatar_url"}}, }) require.Equal(t, codes.InvalidArgument, status.Code(err)) diff --git a/server/api/v1/test/user_service_registration_test.go b/server/api/test/user_service_registration_test.go similarity index 80% rename from server/api/v1/test/user_service_registration_test.go rename to server/api/test/user_service_registration_test.go index 307ed9801..fefcf67a1 100644 --- a/server/api/v1/test/user_service_registration_test.go +++ b/server/api/test/user_service_registration_test.go @@ -9,9 +9,9 @@ import ( "github.com/stretchr/testify/require" "google.golang.org/protobuf/types/known/fieldmaskpb" - apiv1 "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" storepb "github.com/usememos/memos/proto/gen/store" - apiv1server "github.com/usememos/memos/server/api/v1" + "github.com/usememos/memos/server/api" "github.com/usememos/memos/store" ) @@ -25,8 +25,8 @@ func TestCreateUserRegistration(t *testing.T) { // User registration is enabled by default, no need to set it explicitly // Create user without authentication - should succeed - _, err := ts.Service.CreateUser(ctx, &apiv1.CreateUserRequest{ - User: &apiv1.User{ + _, err := ts.Service.CreateUser(ctx, &apipb.CreateUserRequest{ + User: &apipb.User{ Username: "newuser", Email: "newuser@example.com", Password: "password123", @@ -55,8 +55,8 @@ func TestCreateUserRegistration(t *testing.T) { require.NoError(t, err) // Try to create user without authentication - should fail - _, err = ts.Service.CreateUser(ctx, &apiv1.CreateUserRequest{ - User: &apiv1.User{ + _, err = ts.Service.CreateUser(ctx, &apipb.CreateUserRequest{ + User: &apipb.User{ Username: "newuser", Email: "newuser@example.com", Password: "password123", @@ -87,8 +87,8 @@ func TestCreateUserRegistration(t *testing.T) { require.NoError(t, err) // Host user can create users even when registration is disabled - should succeed - _, err = ts.Service.CreateUser(hostCtx, &apiv1.CreateUserRequest{ - User: &apiv1.User{ + _, err = ts.Service.CreateUser(hostCtx, &apipb.CreateUserRequest{ + User: &apipb.User{ Username: "newuser", Email: "newuser@example.com", Password: "password123", @@ -118,8 +118,8 @@ func TestCreateUserRegistration(t *testing.T) { require.NoError(t, err) // Regular user tries to create user when registration is disabled - should fail - _, err = ts.Service.CreateUser(regularUserCtx, &apiv1.CreateUserRequest{ - User: &apiv1.User{ + _, err = ts.Service.CreateUser(regularUserCtx, &apipb.CreateUserRequest{ + User: &apipb.User{ Username: "newuser", Email: "newuser@example.com", Password: "password123", @@ -139,18 +139,18 @@ func TestCreateUserRegistration(t *testing.T) { hostCtx := ts.CreateUserContext(ctx, hostUser.ID) // Host user can create user with specific role - should succeed - createdUser, err := ts.Service.CreateUser(hostCtx, &apiv1.CreateUserRequest{ - User: &apiv1.User{ + createdUser, err := ts.Service.CreateUser(hostCtx, &apipb.CreateUserRequest{ + User: &apipb.User{ Username: "newadmin", Email: "newadmin@example.com", Password: "password123", - Role: apiv1.User_ADMIN, + Role: apipb.User_ADMIN, }, }) require.NoError(t, err) require.Equal(t, "users/newadmin", createdUser.Name) require.NotNil(t, createdUser) - require.Equal(t, apiv1.User_ADMIN, createdUser.Role) + require.Equal(t, apipb.User_ADMIN, createdUser.Role) }) t.Run("CreateUser unauthenticated user can only create regular user", func(t *testing.T) { @@ -164,18 +164,18 @@ func TestCreateUserRegistration(t *testing.T) { // User registration is enabled by default // Unauthenticated user tries to create admin user - role should be ignored - createdUser, err := ts.Service.CreateUser(ctx, &apiv1.CreateUserRequest{ - User: &apiv1.User{ + createdUser, err := ts.Service.CreateUser(ctx, &apipb.CreateUserRequest{ + User: &apipb.User{ Username: "wannabeadmin", Email: "wannabeadmin@example.com", Password: "password123", - Role: apiv1.User_ADMIN, // This should be ignored + Role: apipb.User_ADMIN, // This should be ignored }, }) require.NoError(t, err) require.NotNil(t, createdUser) require.Equal(t, "users/wannabeadmin", createdUser.Name) - require.Equal(t, apiv1.User_USER, createdUser.Role, "Unauthenticated users can only create USER role") + require.Equal(t, apipb.User_USER, createdUser.Role, "Unauthenticated users can only create USER role") }) t.Run("CreateUser blocked when password auth disabled for self signup", func(t *testing.T) { @@ -195,8 +195,8 @@ func TestCreateUserRegistration(t *testing.T) { }) require.NoError(t, err) - _, err = ts.Service.CreateUser(ctx, &apiv1.CreateUserRequest{ - User: &apiv1.User{ + _, err = ts.Service.CreateUser(ctx, &apipb.CreateUserRequest{ + User: &apipb.User{ Username: "newuser", Email: "newuser@example.com", Password: "password123", @@ -210,8 +210,8 @@ func TestCreateUserRegistration(t *testing.T) { ts := NewTestService(t) defer ts.Cleanup() - _, err := ts.Service.CreateUser(ctx, &apiv1.CreateUserRequest{ - User: &apiv1.User{ + _, err := ts.Service.CreateUser(ctx, &apipb.CreateUserRequest{ + User: &apipb.User{ Username: "newuser", Email: "newuser@example.com", Password: "", @@ -227,8 +227,8 @@ func TestCreateUserRegistration(t *testing.T) { ts := NewTestService(t) defer ts.Cleanup() - _, err := ts.Service.CreateUser(ctx, &apiv1.CreateUserRequest{ - User: &apiv1.User{ + _, err := ts.Service.CreateUser(ctx, &apipb.CreateUserRequest{ + User: &apipb.User{ Username: username, Email: "newuser@example.com", Password: "password123", @@ -244,8 +244,8 @@ func TestCreateUserRegistration(t *testing.T) { ts := NewTestService(t) defer ts.Cleanup() - _, err := ts.Service.CreateUser(ctx, &apiv1.CreateUserRequest{ - User: &apiv1.User{ + _, err := ts.Service.CreateUser(ctx, &apipb.CreateUserRequest{ + User: &apipb.User{ Username: "alice@example.com", Email: "newuser@example.com", Password: "password123", @@ -260,8 +260,8 @@ func TestCreateUserRegistration(t *testing.T) { ts := NewTestService(t) defer ts.Cleanup() - _, err := ts.Service.CreateUser(ctx, &apiv1.CreateUserRequest{ - User: &apiv1.User{ + _, err := ts.Service.CreateUser(ctx, &apipb.CreateUserRequest{ + User: &apipb.User{ Username: "alice", Email: "alice@example.com", Password: "password123", @@ -280,9 +280,9 @@ func TestCreateUserRegistration(t *testing.T) { require.NoError(t, err) authCtx := ts.CreateUserContext(ctx, user.ID) - _, err = ts.Service.UpdateUser(authCtx, &apiv1.UpdateUserRequest{ - User: &apiv1.User{ - Name: apiv1server.BuildUserName(user.Username), + _, err = ts.Service.UpdateUser(authCtx, &apipb.UpdateUserRequest{ + User: &apipb.User{ + Name: api.BuildUserName(user.Username), Password: "", }, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"password"}}, @@ -299,7 +299,7 @@ func TestCreateUserRegistration(t *testing.T) { require.NoError(t, err) authCtx := ts.CreateUserContext(ctx, user.ID) - _, err = ts.Service.UpdateUser(authCtx, &apiv1.UpdateUserRequest{ + _, err = ts.Service.UpdateUser(authCtx, &apipb.UpdateUserRequest{ UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"display_name"}}, }) require.Error(t, err) @@ -314,8 +314,8 @@ func TestCreateUserRegistration(t *testing.T) { var wg sync.WaitGroup for i := range workers { wg.Go(func() { - _, _ = ts.Service.CreateUser(ctx, &apiv1.CreateUserRequest{ - User: &apiv1.User{ + _, _ = ts.Service.CreateUser(ctx, &apipb.CreateUserRequest{ + User: &apipb.User{ Username: fmt.Sprintf("setup-user-%d", i), Email: "setup-user@example.com", Password: "password123", @@ -343,10 +343,10 @@ func TestCreateUserRegistration(t *testing.T) { user, err := ts.CreateRegularUser(ctx, "state-user") require.NoError(t, err) userCtx := ts.CreateUserContext(ctx, user.ID) - _, err = ts.Service.UpdateUser(userCtx, &apiv1.UpdateUserRequest{ - User: &apiv1.User{ - Name: apiv1server.BuildUserName(user.Username), - State: apiv1.State_ARCHIVED, + _, err = ts.Service.UpdateUser(userCtx, &apipb.UpdateUserRequest{ + User: &apipb.User{ + Name: api.BuildUserName(user.Username), + State: apipb.State_ARCHIVED, }, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"state"}}, }) @@ -356,15 +356,15 @@ func TestCreateUserRegistration(t *testing.T) { admin, err := ts.CreateHostUser(ctx, "state-admin") require.NoError(t, err) adminCtx := ts.CreateUserContext(ctx, admin.ID) - updated, err := ts.Service.UpdateUser(adminCtx, &apiv1.UpdateUserRequest{ - User: &apiv1.User{ - Name: apiv1server.BuildUserName(user.Username), - State: apiv1.State_ARCHIVED, + updated, err := ts.Service.UpdateUser(adminCtx, &apipb.UpdateUserRequest{ + User: &apipb.User{ + Name: api.BuildUserName(user.Username), + State: apipb.State_ARCHIVED, }, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"state"}}, }) require.NoError(t, err) - require.Equal(t, apiv1.State_ARCHIVED, updated.State) + require.Equal(t, apipb.State_ARCHIVED, updated.State) }) t.Run("archived user context is rejected", func(t *testing.T) { @@ -381,20 +381,20 @@ func TestCreateUserRegistration(t *testing.T) { }) require.NoError(t, err) - _, err = ts.Service.GetCurrentUser(userCtx, &apiv1.GetCurrentUserRequest{}) + _, err = ts.Service.GetCurrentUser(userCtx, &apipb.GetCurrentUserRequest{}) require.Error(t, err) - _, err = ts.Service.CreateMemo(userCtx, &apiv1.CreateMemoRequest{ - Memo: &apiv1.Memo{ + _, err = ts.Service.CreateMemo(userCtx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{ Content: "should not be created", }, }) require.Error(t, err) - _, err = ts.Service.UpdateUser(userCtx, &apiv1.UpdateUserRequest{ - User: &apiv1.User{ - Name: apiv1server.BuildUserName(user.Username), - State: apiv1.State_NORMAL, + _, err = ts.Service.UpdateUser(userCtx, &apipb.UpdateUserRequest{ + User: &apipb.User{ + Name: api.BuildUserName(user.Username), + State: apipb.State_NORMAL, }, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"state"}}, }) diff --git a/server/api/v1/test/user_service_stats_test.go b/server/api/test/user_service_stats_test.go similarity index 72% rename from server/api/v1/test/user_service_stats_test.go rename to server/api/test/user_service_stats_test.go index 92c85f704..4ca614683 100644 --- a/server/api/v1/test/user_service_stats_test.go +++ b/server/api/test/user_service_stats_test.go @@ -9,7 +9,7 @@ import ( "google.golang.org/grpc/codes" "google.golang.org/grpc/status" - v1pb "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" storepb "github.com/usememos/memos/proto/gen/store" "github.com/usememos/memos/store" ) @@ -43,7 +43,7 @@ func TestGetUserStats_TagCount(t *testing.T) { // Test GetUserStats userName := fmt.Sprintf("users/%s", user.Username) - response, err := ts.Service.GetUserStats(userCtx, &v1pb.GetUserStatsRequest{ + response, err := ts.Service.GetUserStats(userCtx, &apipb.GetUserStatsRequest{ Name: userName, }) require.NoError(t, err) @@ -52,8 +52,8 @@ func TestGetUserStats_TagCount(t *testing.T) { // A memo contributes at most once to an exact tag count, even if its payload // accidentally contains the same derived membership more than once. - require.Contains(t, response.TagCount, "test") - require.Equal(t, int32(1), response.TagCount["test"], "Tag count should be 1 for a single occurrence") + require.Contains(t, response.TagCounts, "test") + require.Equal(t, int32(1), response.TagCounts["test"], "Tag count should be 1 for a single occurrence") // Create another memo with the same tag memo2, err := ts.Store.CreateMemo(ctx, &store.Memo{ @@ -69,15 +69,15 @@ func TestGetUserStats_TagCount(t *testing.T) { require.NotNil(t, memo2) // Test GetUserStats again - response2, err := ts.Service.GetUserStats(userCtx, &v1pb.GetUserStatsRequest{ + response2, err := ts.Service.GetUserStats(userCtx, &apipb.GetUserStatsRequest{ Name: userName, }) require.NoError(t, err) require.NotNil(t, response2) // Check that the tag count is exactly 2, not 3 - require.Contains(t, response2.TagCount, "test") - require.Equal(t, int32(2), response2.TagCount["test"], "Tag count should be 2 for two occurrences") + require.Contains(t, response2.TagCounts, "test") + require.Equal(t, int32(2), response2.TagCounts["test"], "Tag count should be 2 for two occurrences") // Test with a new unique tag memo3, err := ts.Store.CreateMemo(ctx, &store.Memo{ @@ -93,21 +93,21 @@ func TestGetUserStats_TagCount(t *testing.T) { require.NotNil(t, memo3) // Test GetUserStats for the new tag - response3, err := ts.Service.GetUserStats(userCtx, &v1pb.GetUserStatsRequest{ + response3, err := ts.Service.GetUserStats(userCtx, &apipb.GetUserStatsRequest{ Name: userName, }) require.NoError(t, err) require.NotNil(t, response3) // Check that the unique tag count is exactly 1 - require.Contains(t, response3.TagCount, "unique") - require.Equal(t, int32(1), response3.TagCount["unique"], "New tag count should be 1 for first occurrence") + require.Contains(t, response3.TagCounts, "unique") + require.Equal(t, int32(1), response3.TagCounts["unique"], "New tag count should be 1 for first occurrence") // The original test tag should still be 2 - require.Contains(t, response3.TagCount, "test") - require.Equal(t, int32(2), response3.TagCount["test"], "Original tag count should remain 2") + require.Contains(t, response3.TagCounts, "test") + require.Equal(t, int32(2), response3.TagCounts["test"], "Original tag count should remain 2") - _, err = ts.Service.GetUserStats(userCtx, &v1pb.GetUserStatsRequest{ + _, err = ts.Service.GetUserStats(userCtx, &apipb.GetUserStatsRequest{ Name: "users/1", }) require.Error(t, err) @@ -138,7 +138,7 @@ func TestGetUserStats_TagCountPreservesExactIdentity(t *testing.T) { }) require.NoError(t, err) - response, err := ts.Service.GetUserStats(userCtx, &v1pb.GetUserStatsRequest{ + response, err := ts.Service.GetUserStats(userCtx, &apipb.GetUserStatsRequest{ Name: fmt.Sprintf("users/%s", user.Username), }) require.NoError(t, err) @@ -149,7 +149,7 @@ func TestGetUserStats_TagCountPreservesExactIdentity(t *testing.T) { "work": 1, composedTag: 1, decomposedTag: 1, - }, response.TagCount) + }, response.TagCounts) } func TestGetUserStats_MemoUpdatedTimestamps(t *testing.T) { @@ -183,7 +183,7 @@ func TestGetUserStats_MemoUpdatedTimestamps(t *testing.T) { })) userName := fmt.Sprintf("users/%s", user.Username) - resp, err := ts.Service.GetUserStats(userCtx, &v1pb.GetUserStatsRequest{Name: userName}) + resp, err := ts.Service.GetUserStats(userCtx, &apipb.GetUserStatsRequest{Name: userName}) require.NoError(t, err) require.NotNil(t, resp) @@ -218,12 +218,12 @@ func TestGetUserStats_PinnedMemoUsesCanonicalResourceName(t *testing.T) { pinned := true require.NoError(t, ts.Store.UpdateMemo(ctx, &store.UpdateMemo{ID: memo.ID, Pinned: &pinned})) - resp, err := ts.Service.GetUserStats(userCtx, &v1pb.GetUserStatsRequest{Name: fmt.Sprintf("users/%s", user.Username)}) + resp, err := ts.Service.GetUserStats(userCtx, &apipb.GetUserStatsRequest{Name: fmt.Sprintf("users/%s", user.Username)}) require.NoError(t, err) require.Equal(t, []string{"memos/pinned-stats-memo"}, resp.PinnedMemos) } -func TestListAllUserStats_FilterExcludesPrivateMemos(t *testing.T) { +func TestListUserStats_FilterExcludesPrivateMemos(t *testing.T) { ctx := context.Background() ts := NewTestService(t) @@ -250,19 +250,20 @@ func TestListAllUserStats_FilterExcludesPrivateMemos(t *testing.T) { }) require.NoError(t, err) - unfilteredResp, err := ts.Service.ListAllUserStats(userCtx, &v1pb.ListAllUserStatsRequest{}) + unfilteredResp, err := ts.Service.ListUserStats(userCtx, &apipb.ListUserStatsRequest{Parent: "users/-"}) require.NoError(t, err) - require.Len(t, unfilteredResp.Stats, 1) - require.Equal(t, int32(1), unfilteredResp.Stats[0].TagCount["public"]) - require.Equal(t, int32(1), unfilteredResp.Stats[0].TagCount["private"]) + require.Len(t, unfilteredResp.UserStats, 1) + require.Equal(t, int32(1), unfilteredResp.UserStats[0].TagCounts["public"]) + require.Equal(t, int32(1), unfilteredResp.UserStats[0].TagCounts["private"]) - filteredResp, err := ts.Service.ListAllUserStats(userCtx, &v1pb.ListAllUserStatsRequest{ + filteredResp, err := ts.Service.ListUserStats(userCtx, &apipb.ListUserStatsRequest{ + Parent: "users/-", Filter: `visibility in ["PUBLIC", "PROTECTED"]`, }) require.NoError(t, err) - require.Len(t, filteredResp.Stats, 1) - require.Equal(t, int32(1), filteredResp.Stats[0].TagCount["public"]) - require.NotContains(t, filteredResp.Stats[0].TagCount, "private") + require.Len(t, filteredResp.UserStats, 1) + require.Equal(t, int32(1), filteredResp.UserStats[0].TagCounts["public"]) + require.NotContains(t, filteredResp.UserStats[0].TagCounts, "private") } func TestUserStatsUseMemoLocalAccess(t *testing.T) { @@ -345,24 +346,24 @@ func TestUserStatsUseMemoLocalAccess(t *testing.T) { } for _, test := range tests { t.Run(test.name, func(t *testing.T) { - response, err := ts.Service.GetUserStats(test.requestCtx, &v1pb.GetUserStatsRequest{Name: ownerName}) + response, err := ts.Service.GetUserStats(test.requestCtx, &apipb.GetUserStatsRequest{Name: ownerName}) require.NoError(t, err) require.Equal(t, int32(len(test.wantTags)), response.TotalMemoCount) for _, tag := range test.wantTags { - require.Equal(t, int32(1), response.TagCount[tag], "expected tag %q to be visible", tag) + require.Equal(t, int32(1), response.TagCounts[tag], "expected tag %q to be visible", tag) } for _, tag := range test.denyTags { - require.NotContains(t, response.TagCount, tag) + require.NotContains(t, response.TagCounts, tag) } }) } - memberStats, err := ts.Service.ListAllUserStats(ts.CreateUserContext(ctx, member.ID), &v1pb.ListAllUserStatsRequest{}) + memberStats, err := ts.Service.ListUserStats(ts.CreateUserContext(ctx, member.ID), &apipb.ListUserStatsRequest{Parent: "users/-"}) require.NoError(t, err) - require.Len(t, memberStats.Stats, 1) - require.Equal(t, int32(3), memberStats.Stats[0].TotalMemoCount) - require.Contains(t, memberStats.Stats[0].TagCount, "space") - require.NotContains(t, memberStats.Stats[0].TagCount, "private") + require.Len(t, memberStats.UserStats, 1) + require.Equal(t, int32(3), memberStats.UserStats[0].TotalMemoCount) + require.Contains(t, memberStats.UserStats[0].TagCounts, "space") + require.NotContains(t, memberStats.UserStats[0].TagCounts, "private") } func TestUserStatsSpaceFilter(t *testing.T) { @@ -416,49 +417,52 @@ func TestUserStatsSpaceFilter(t *testing.T) { ownerName := fmt.Sprintf("users/%s", owner.Username) ownerCtx := ts.CreateUserContext(ctx, owner.ID) - ownerSpaceStats, err := ts.Service.GetUserStats(ownerCtx, &v1pb.GetUserStatsRequest{ + ownerSpaceStats, err := ts.Service.GetUserStats(ownerCtx, &apipb.GetUserStatsRequest{ Name: ownerName, Filter: fmt.Sprintf(`space == %q`, spaceAName), }) require.NoError(t, err) require.Equal(t, int32(2), ownerSpaceStats.TotalMemoCount) - require.Contains(t, ownerSpaceStats.TagCount, "a-members") - require.Contains(t, ownerSpaceStats.TagCount, "a-private") - require.NotContains(t, ownerSpaceStats.TagCount, "unassigned") - require.NotContains(t, ownerSpaceStats.TagCount, "b-public") + require.Contains(t, ownerSpaceStats.TagCounts, "a-members") + require.Contains(t, ownerSpaceStats.TagCounts, "a-private") + require.NotContains(t, ownerSpaceStats.TagCounts, "unassigned") + require.NotContains(t, ownerSpaceStats.TagCounts, "b-public") - ownerUnassignedStats, err := ts.Service.GetUserStats(ownerCtx, &v1pb.GetUserStatsRequest{ + ownerUnassignedStats, err := ts.Service.GetUserStats(ownerCtx, &apipb.GetUserStatsRequest{ Name: ownerName, Filter: `space == null`, }) require.NoError(t, err) require.Equal(t, int32(1), ownerUnassignedStats.TotalMemoCount) - require.Contains(t, ownerUnassignedStats.TagCount, "unassigned") + require.Contains(t, ownerUnassignedStats.TagCounts, "unassigned") - memberSpaceStats, err := ts.Service.ListAllUserStats(ts.CreateUserContext(ctx, member.ID), &v1pb.ListAllUserStatsRequest{ + memberSpaceStats, err := ts.Service.ListUserStats(ts.CreateUserContext(ctx, member.ID), &apipb.ListUserStatsRequest{ + Parent: "users/-", Filter: fmt.Sprintf(`space == %q`, spaceAName), }) require.NoError(t, err) - require.Len(t, memberSpaceStats.Stats, 2) + require.Len(t, memberSpaceStats.UserStats, 2) visibleTags := map[string]int32{} - for _, stats := range memberSpaceStats.Stats { - for tag, count := range stats.TagCount { + for _, stats := range memberSpaceStats.UserStats { + for tag, count := range stats.TagCounts { visibleTags[tag] += count } } require.Equal(t, map[string]int32{"a-members": 1, "member-private": 1}, visibleTags) - _, err = ts.Service.ListAllUserStats(ts.CreateUserContext(ctx, outsider.ID), &v1pb.ListAllUserStatsRequest{ + _, err = ts.Service.ListUserStats(ts.CreateUserContext(ctx, outsider.ID), &apipb.ListUserStatsRequest{ + Parent: "users/-", Filter: fmt.Sprintf(`space == %q`, spaceAName), }) require.Equal(t, codes.NotFound, status.Code(err)) - _, err = ts.Service.ListAllUserStats(ctx, &v1pb.ListAllUserStatsRequest{ + _, err = ts.Service.ListUserStats(ctx, &apipb.ListUserStatsRequest{ + Parent: "users/-", Filter: fmt.Sprintf(`space == %q`, spaceAName), }) require.Equal(t, codes.Unauthenticated, status.Code(err)) - _, err = ts.Service.GetUserStats(ownerCtx, &v1pb.GetUserStatsRequest{ + _, err = ts.Service.GetUserStats(ownerCtx, &apipb.GetUserStatsRequest{ Name: ownerName, Filter: `space != null`, }) @@ -474,7 +478,7 @@ func TestGetUserStats_AttachmentStorage(t *testing.T) { other, err := ts.CreateRegularUser(ctx, "storage_other") require.NoError(t, err) ownerCtx := ts.CreateUserContext(ctx, owner.ID) - request := &v1pb.GetUserStatsRequest{Name: "users/" + owner.Username} + request := &apipb.GetUserStatsRequest{Name: "users/" + owner.Username} stats, err := ts.Service.GetUserStats(ownerCtx, request) require.NoError(t, err) @@ -485,7 +489,7 @@ func TestGetUserStats_AttachmentStorage(t *testing.T) { createTestImageAttachment(ts.CreateUserContext(ctx, other.ID), t, ts, "other.png") // Memo filtering must not turn account storage into a partial total. - stats, err = ts.Service.GetUserStats(ownerCtx, &v1pb.GetUserStatsRequest{Name: request.Name, Filter: `content.contains("no matches")`}) + stats, err = ts.Service.GetUserStats(ownerCtx, &apipb.GetUserStatsRequest{Name: request.Name, Filter: `content.contains("no matches")`}) require.NoError(t, err) require.Zero(t, stats.TotalMemoCount) require.NotNil(t, stats.AttachmentStorageBytes) @@ -497,10 +501,43 @@ func TestGetUserStats_AttachmentStorage(t *testing.T) { require.Nil(t, stats.AttachmentStorageBytes, "private storage totals must not appear in public user stats") } - _, err = ts.Service.DeleteAttachment(ownerCtx, &v1pb.DeleteAttachmentRequest{Name: attachment.Name}) + _, err = ts.Service.DeleteAttachment(ownerCtx, &apipb.DeleteAttachmentRequest{Name: attachment.Name}) require.NoError(t, err) stats, err = ts.Service.GetUserStats(ownerCtx, request) require.NoError(t, err) require.NotNil(t, stats.AttachmentStorageBytes) require.Zero(t, *stats.AttachmentStorageBytes) } + +func TestListUserStatsParent(t *testing.T) { + ctx := context.Background() + ts := NewTestService(t) + defer ts.Cleanup() + + alice, err := ts.CreateRegularUser(ctx, "stats-alice") + require.NoError(t, err) + bob, err := ts.CreateRegularUser(ctx, "stats-bob") + require.NoError(t, err) + for _, user := range []*store.User{alice, bob} { + _, err := ts.Service.CreateMemo(ts.CreateUserContext(ctx, user.ID), &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{Content: "public memo", Visibility: apipb.Visibility_PUBLIC}, + }) + require.NoError(t, err) + } + aliceCtx := ts.CreateUserContext(ctx, alice.ID) + + all, err := ts.Service.ListUserStats(aliceCtx, &apipb.ListUserStatsRequest{Parent: "users/-"}) + require.NoError(t, err) + require.Len(t, all.UserStats, 2) + + one, err := ts.Service.ListUserStats(aliceCtx, &apipb.ListUserStatsRequest{Parent: "users/stats-bob"}) + require.NoError(t, err) + require.Len(t, one.UserStats, 1) + require.Equal(t, "users/stats-bob/stats", one.UserStats[0].Name) + + _, err = ts.Service.ListUserStats(aliceCtx, &apipb.ListUserStatsRequest{Parent: "users/missing"}) + require.Equal(t, codes.NotFound, status.Code(err)) + + _, err = ts.Service.ListUserStats(aliceCtx, &apipb.ListUserStatsRequest{}) + require.Equal(t, codes.InvalidArgument, status.Code(err)) +} diff --git a/server/api/v1/test/user_service_unique_email_test.go b/server/api/test/user_service_unique_email_test.go similarity index 85% rename from server/api/v1/test/user_service_unique_email_test.go rename to server/api/test/user_service_unique_email_test.go index 39ee0a5ef..d32ad12b3 100644 --- a/server/api/v1/test/user_service_unique_email_test.go +++ b/server/api/test/user_service_unique_email_test.go @@ -9,7 +9,7 @@ import ( "google.golang.org/grpc/status" "google.golang.org/protobuf/types/known/fieldmaskpb" - apiv1 "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" "github.com/usememos/memos/store" ) @@ -28,8 +28,8 @@ func TestUserServiceUniqueEmail(t *testing.T) { defer ts.Cleanup() adminCtx := newAdminContext(t, ts) - created, err := ts.Service.CreateUser(adminCtx, &apiv1.CreateUserRequest{ - User: &apiv1.User{Username: "bob", Email: " Bob@Example.COM ", Password: "password123"}, + created, err := ts.Service.CreateUser(adminCtx, &apipb.CreateUserRequest{ + User: &apipb.User{Username: "bob", Email: " Bob@Example.COM ", Password: "password123"}, }) require.NoError(t, err) require.Equal(t, "bob@example.com", created.Email) @@ -41,8 +41,8 @@ func TestUserServiceUniqueEmail(t *testing.T) { adminCtx := newAdminContext(t, ts) for _, email := range []string{"not-an-address", "Bob ", "bob@example.com@example.com"} { - _, err := ts.Service.CreateUser(adminCtx, &apiv1.CreateUserRequest{ - User: &apiv1.User{Username: "bob", Email: email, Password: "password123"}, + _, err := ts.Service.CreateUser(adminCtx, &apipb.CreateUserRequest{ + User: &apipb.User{Username: "bob", Email: email, Password: "password123"}, }) require.Equal(t, codes.InvalidArgument, status.Code(err), "email %q", email) } @@ -56,19 +56,19 @@ func TestUserServiceUniqueEmail(t *testing.T) { _, err := ts.CreateRegularUser(ctx, "holder") require.NoError(t, err) - _, err = ts.Service.CreateUser(adminCtx, &apiv1.CreateUserRequest{ - User: &apiv1.User{Username: "claimant", Email: "Holder@Example.com", Password: "password123"}, + _, err = ts.Service.CreateUser(adminCtx, &apipb.CreateUserRequest{ + User: &apipb.User{Username: "claimant", Email: "Holder@Example.com", Password: "password123"}, }) require.Equal(t, codes.AlreadyExists, status.Code(err)) - _, err = ts.Service.CreateUser(adminCtx, &apiv1.CreateUserRequest{ - User: &apiv1.User{Username: "claimant", Email: "holder@example.com", Password: "password123"}, + _, err = ts.Service.CreateUser(adminCtx, &apipb.CreateUserRequest{ + User: &apipb.User{Username: "claimant", Email: "holder@example.com", Password: "password123"}, ValidateOnly: true, }) require.Equal(t, codes.AlreadyExists, status.Code(err), "validate_only gives the same answer") - validated, err := ts.Service.CreateUser(adminCtx, &apiv1.CreateUserRequest{ - User: &apiv1.User{Username: "claimant", Email: "Claimant@Example.com", Password: "password123"}, + validated, err := ts.Service.CreateUser(adminCtx, &apipb.CreateUserRequest{ + User: &apipb.User{Username: "claimant", Email: "Claimant@Example.com", Password: "password123"}, ValidateOnly: true, }) require.NoError(t, err) @@ -79,8 +79,8 @@ func TestUserServiceUniqueEmail(t *testing.T) { ts := NewTestService(t) defer ts.Cleanup() - _, err := ts.Service.CreateUser(ctx, &apiv1.CreateUserRequest{ - User: &apiv1.User{Username: "owner", Email: "owner@example", Password: "password123"}, + _, err := ts.Service.CreateUser(ctx, &apipb.CreateUserRequest{ + User: &apipb.User{Username: "owner", Email: "owner@example", Password: "password123"}, }) require.NoError(t, err, "a dotless domain is allowed") @@ -100,9 +100,9 @@ func TestUserServiceUniqueEmail(t *testing.T) { require.NoError(t, err) moverCtx := ts.CreateUserContext(ctx, mover.ID) - update := func(email string) (*apiv1.User, error) { - return ts.Service.UpdateUser(moverCtx, &apiv1.UpdateUserRequest{ - User: &apiv1.User{Name: "users/mover", Email: email}, + update := func(email string) (*apipb.User, error) { + return ts.Service.UpdateUser(moverCtx, &apipb.UpdateUserRequest{ + User: &apipb.User{Name: "users/mover", Email: email}, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"email"}}, }) } diff --git a/server/api/v1/test/user_setting_test.go b/server/api/test/user_setting_test.go similarity index 67% rename from server/api/v1/test/user_setting_test.go rename to server/api/test/user_setting_test.go index b948311cc..86f889587 100644 --- a/server/api/v1/test/user_setting_test.go +++ b/server/api/test/user_setting_test.go @@ -8,9 +8,9 @@ import ( colorpb "google.golang.org/genproto/googleapis/type/color" "google.golang.org/protobuf/types/known/fieldmaskpb" - apiv1 "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" storepb "github.com/usememos/memos/proto/gen/store" - apiv1server "github.com/usememos/memos/server/api/v1" + "github.com/usememos/memos/server/api" ) func TestListUserSettingsOmitsInternalStoreSettings(t *testing.T) { @@ -50,13 +50,13 @@ func TestListUserSettingsOmitsInternalStoreSettings(t *testing.T) { }) require.NoError(t, err) - resp, err := ts.Service.ListUserSettings(ts.CreateUserContext(ctx, user.ID), &apiv1.ListUserSettingsRequest{ - Parent: apiv1server.BuildUserName(user.Username), + resp, err := ts.Service.ListUserSettings(ts.CreateUserContext(ctx, user.ID), &apipb.ListUserSettingsRequest{ + Parent: api.BuildUserName(user.Username), }) require.NoError(t, err) - require.Len(t, resp.Settings, 1) - require.Equal(t, "users/locale-user/settings/GENERAL", resp.Settings[0].Name) - require.Equal(t, "ja", resp.Settings[0].GetGeneralSetting().Locale) + require.Len(t, resp.UserSettings, 1) + require.Equal(t, "users/locale-user/settings/GENERAL", resp.UserSettings[0].Name) + require.Equal(t, "ja", resp.UserSettings[0].GetGeneralSetting().Locale) } func TestGeneralUserSettingSaveMediaMetadata(t *testing.T) { @@ -69,15 +69,15 @@ func TestGeneralUserSettingSaveMediaMetadata(t *testing.T) { userCtx := ts.CreateUserContext(ctx, user.ID) settingName := "users/media-setting-user/settings/GENERAL" - defaultSetting, err := ts.Service.GetUserSetting(userCtx, &apiv1.GetUserSettingRequest{Name: settingName}) + defaultSetting, err := ts.Service.GetUserSetting(userCtx, &apipb.GetUserSettingRequest{Name: settingName}) require.NoError(t, err) require.False(t, defaultSetting.GetGeneralSetting().GetSaveMediaMetadata()) - updated, err := ts.Service.UpdateUserSetting(userCtx, &apiv1.UpdateUserSettingRequest{ - Setting: &apiv1.UserSetting{ + updated, err := ts.Service.UpdateUserSetting(userCtx, &apipb.UpdateUserSettingRequest{ + UserSetting: &apipb.UserSetting{ Name: settingName, - Value: &apiv1.UserSetting_GeneralSetting_{ - GeneralSetting: &apiv1.UserSetting_GeneralSetting{SaveMediaMetadata: true}, + Value: &apipb.UserSetting_GeneralSetting_{ + GeneralSetting: &apipb.UserSetting_GeneralSetting{SaveMediaMetadata: true}, }, }, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"save_media_metadata"}}, @@ -87,11 +87,11 @@ func TestGeneralUserSettingSaveMediaMetadata(t *testing.T) { require.Equal(t, "en", updated.GetGeneralSetting().GetLocale()) require.Equal(t, "PRIVATE", updated.GetGeneralSetting().GetMemoVisibility()) - updated, err = ts.Service.UpdateUserSetting(userCtx, &apiv1.UpdateUserSettingRequest{ - Setting: &apiv1.UserSetting{ + updated, err = ts.Service.UpdateUserSetting(userCtx, &apipb.UpdateUserSettingRequest{ + UserSetting: &apipb.UserSetting{ Name: settingName, - Value: &apiv1.UserSetting_GeneralSetting_{ - GeneralSetting: &apiv1.UserSetting_GeneralSetting{Locale: "ja"}, + Value: &apipb.UserSetting_GeneralSetting_{ + GeneralSetting: &apipb.UserSetting_GeneralSetting{Locale: "ja"}, }, }, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"locale"}}, @@ -100,11 +100,11 @@ func TestGeneralUserSettingSaveMediaMetadata(t *testing.T) { require.Equal(t, "ja", updated.GetGeneralSetting().GetLocale()) require.True(t, updated.GetGeneralSetting().GetSaveMediaMetadata()) - updated, err = ts.Service.UpdateUserSetting(userCtx, &apiv1.UpdateUserSettingRequest{ - Setting: &apiv1.UserSetting{ + updated, err = ts.Service.UpdateUserSetting(userCtx, &apipb.UpdateUserSettingRequest{ + UserSetting: &apipb.UserSetting{ Name: settingName, - Value: &apiv1.UserSetting_GeneralSetting_{ - GeneralSetting: &apiv1.UserSetting_GeneralSetting{SaveMediaMetadata: false}, + Value: &apipb.UserSetting_GeneralSetting_{ + GeneralSetting: &apipb.UserSetting_GeneralSetting{SaveMediaMetadata: false}, }, }, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"save_media_metadata"}}, @@ -122,11 +122,11 @@ func TestUserTagSettings(t *testing.T) { require.NoError(t, err) userCtx := ts.CreateUserContext(ctx, user.ID) - tagsSetting := &apiv1.UserSetting{ + tagsSetting := &apipb.UserSetting{ Name: "users/tag-user/settings/TAGS", - Value: &apiv1.UserSetting_TagsSetting_{ - TagsSetting: &apiv1.UserSetting_TagsSetting{ - Tags: map[string]*apiv1.UserSetting_TagMetadata{ + Value: &apipb.UserSetting_TagsSetting_{ + TagsSetting: &apipb.UserSetting_TagsSetting{ + Tags: map[string]*apipb.UserSetting_TagMetadata{ "bug": { BackgroundColor: &colorpb.Color{ Red: 0.9, @@ -142,25 +142,25 @@ func TestUserTagSettings(t *testing.T) { }, } - updated, err := ts.Service.UpdateUserSetting(userCtx, &apiv1.UpdateUserSettingRequest{ - Setting: tagsSetting, - UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"tags"}}, + updated, err := ts.Service.UpdateUserSetting(userCtx, &apipb.UpdateUserSettingRequest{ + UserSetting: tagsSetting, + UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"tags"}}, }) require.NoError(t, err) require.Equal(t, "users/tag-user/settings/TAGS", updated.Name) require.Contains(t, updated.GetTagsSetting().GetTags(), "bug") require.True(t, updated.GetTagsSetting().GetTags()["private/.*"].BlurContent) - got, err := ts.Service.GetUserSetting(userCtx, &apiv1.GetUserSettingRequest{Name: "users/tag-user/settings/TAGS"}) + got, err := ts.Service.GetUserSetting(userCtx, &apipb.GetUserSettingRequest{Name: "users/tag-user/settings/TAGS"}) require.NoError(t, err) require.Contains(t, got.GetTagsSetting().GetTags(), "bug") - resp, err := ts.Service.ListUserSettings(userCtx, &apiv1.ListUserSettingsRequest{ - Parent: apiv1server.BuildUserName(user.Username), + resp, err := ts.Service.ListUserSettings(userCtx, &apipb.ListUserSettingsRequest{ + Parent: api.BuildUserName(user.Username), }) require.NoError(t, err) var foundTags bool - for _, setting := range resp.Settings { + for _, setting := range resp.UserSettings { if setting.GetTagsSetting() != nil { foundTags = true require.Equal(t, "users/tag-user/settings/TAGS", setting.Name) @@ -178,12 +178,12 @@ func TestUserTagSettingsRejectInvalidInput(t *testing.T) { require.NoError(t, err) userCtx := ts.CreateUserContext(ctx, user.ID) - _, err = ts.Service.UpdateUserSetting(userCtx, &apiv1.UpdateUserSettingRequest{ - Setting: &apiv1.UserSetting{ + _, err = ts.Service.UpdateUserSetting(userCtx, &apipb.UpdateUserSettingRequest{ + UserSetting: &apipb.UserSetting{ Name: "users/invalid-tag-user/settings/TAGS", - Value: &apiv1.UserSetting_TagsSetting_{ - TagsSetting: &apiv1.UserSetting_TagsSetting{ - Tags: map[string]*apiv1.UserSetting_TagMetadata{ + Value: &apipb.UserSetting_TagsSetting_{ + TagsSetting: &apipb.UserSetting_TagsSetting{ + Tags: map[string]*apipb.UserSetting_TagMetadata{ "(": {}, }, }, @@ -194,12 +194,12 @@ func TestUserTagSettingsRejectInvalidInput(t *testing.T) { require.Error(t, err) require.Contains(t, err.Error(), "invalid") - _, err = ts.Service.UpdateUserSetting(userCtx, &apiv1.UpdateUserSettingRequest{ - Setting: &apiv1.UserSetting{ + _, err = ts.Service.UpdateUserSetting(userCtx, &apipb.UpdateUserSettingRequest{ + UserSetting: &apipb.UserSetting{ Name: "users/invalid-tag-user/settings/TAGS", - Value: &apiv1.UserSetting_TagsSetting_{ - TagsSetting: &apiv1.UserSetting_TagsSetting{ - Tags: map[string]*apiv1.UserSetting_TagMetadata{ + Value: &apipb.UserSetting_TagsSetting_{ + TagsSetting: &apipb.UserSetting_TagsSetting{ + Tags: map[string]*apipb.UserSetting_TagMetadata{ "bug": { BackgroundColor: &colorpb.Color{Red: 1.2}, }, @@ -212,12 +212,12 @@ func TestUserTagSettingsRejectInvalidInput(t *testing.T) { require.Error(t, err) require.Contains(t, err.Error(), "invalid") - _, err = ts.Service.UpdateUserSetting(userCtx, &apiv1.UpdateUserSettingRequest{ - Setting: &apiv1.UserSetting{ + _, err = ts.Service.UpdateUserSetting(userCtx, &apipb.UpdateUserSettingRequest{ + UserSetting: &apipb.UserSetting{ Name: "users/invalid-tag-user/settings/TAGS", - Value: &apiv1.UserSetting_TagsSetting_{ - TagsSetting: &apiv1.UserSetting_TagsSetting{ - Tags: map[string]*apiv1.UserSetting_TagMetadata{ + Value: &apipb.UserSetting_TagsSetting_{ + TagsSetting: &apipb.UserSetting_TagsSetting{ + Tags: map[string]*apipb.UserSetting_TagMetadata{ "bug": {}, }, }, @@ -240,16 +240,16 @@ func TestUserTagSettingsPermissionDeniedForOtherUser(t *testing.T) { require.NoError(t, err) otherCtx := ts.CreateUserContext(ctx, other.ID) - _, err = ts.Service.GetUserSetting(otherCtx, &apiv1.GetUserSettingRequest{Name: "users/tag-owner/settings/TAGS"}) + _, err = ts.Service.GetUserSetting(otherCtx, &apipb.GetUserSettingRequest{Name: "users/tag-owner/settings/TAGS"}) require.Error(t, err) require.Contains(t, err.Error(), "permission denied") - _, err = ts.Service.UpdateUserSetting(otherCtx, &apiv1.UpdateUserSettingRequest{ - Setting: &apiv1.UserSetting{ + _, err = ts.Service.UpdateUserSetting(otherCtx, &apipb.UpdateUserSettingRequest{ + UserSetting: &apipb.UserSetting{ Name: "users/tag-owner/settings/TAGS", - Value: &apiv1.UserSetting_TagsSetting_{ - TagsSetting: &apiv1.UserSetting_TagsSetting{ - Tags: map[string]*apiv1.UserSetting_TagMetadata{"bug": {}}, + Value: &apipb.UserSetting_TagsSetting_{ + TagsSetting: &apipb.UserSetting_TagsSetting{ + Tags: map[string]*apipb.UserSetting_TagMetadata{"bug": {}}, }, }, }, diff --git a/server/api/v1/upload_session.go b/server/api/upload_session.go similarity index 99% rename from server/api/v1/upload_session.go rename to server/api/upload_session.go index 916349990..34e405888 100644 --- a/server/api/v1/upload_session.go +++ b/server/api/upload_session.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "crypto/rand" @@ -258,7 +258,7 @@ func (m *uploadSessions[T]) close() { // CloseUploads stops every upload manager and removes pending upload files. // Call it after draining HTTP requests during server shutdown. -func (s *APIV1Service) CloseUploads() { +func (s *APIService) CloseUploads() { s.attachmentUploads.close() s.memoImports.close() } diff --git a/server/api/v1/user_resource_name.go b/server/api/user_resource_name.go similarity index 99% rename from server/api/v1/user_resource_name.go rename to server/api/user_resource_name.go index 55a406e65..dcbcd5bfc 100644 --- a/server/api/v1/user_resource_name.go +++ b/server/api/user_resource_name.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "context" diff --git a/server/api/v1/user_resource_name_test.go b/server/api/user_resource_name_test.go similarity index 99% rename from server/api/v1/user_resource_name_test.go rename to server/api/user_resource_name_test.go index 28c68c881..69774a4c0 100644 --- a/server/api/v1/user_resource_name_test.go +++ b/server/api/user_resource_name_test.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "strings" diff --git a/server/api/v1/user_service.go b/server/api/user_service.go similarity index 85% rename from server/api/v1/user_service.go rename to server/api/user_service.go index 2f1995875..30edf1ae9 100644 --- a/server/api/v1/user_service.go +++ b/server/api/user_service.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "context" @@ -18,7 +18,7 @@ import ( "github.com/usememos/memos/internal/clientip" "github.com/usememos/memos/internal/ratelimit" - v1pb "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" "github.com/usememos/memos/store" ) @@ -40,7 +40,7 @@ func validatePassword(password string) error { return nil } -func validateUserTagsSetting(setting *v1pb.UserSetting_TagsSetting) error { +func validateUserTagsSetting(setting *apipb.UserSetting_TagsSetting) error { if setting == nil { return errors.New("tags setting is required") } @@ -63,7 +63,7 @@ func validateUserTagsSetting(setting *v1pb.UserSetting_TagsSetting) error { return nil } -func (s *APIV1Service) ListUsers(ctx context.Context, request *v1pb.ListUsersRequest) (*v1pb.ListUsersResponse, error) { +func (s *APIService) ListUsers(ctx context.Context, request *apipb.ListUsersRequest) (*apipb.ListUsersResponse, error) { currentUser, err := s.fetchCurrentUser(ctx) if err != nil { return nil, status.Errorf(codes.Internal, "failed to get user: %v", err) @@ -89,7 +89,7 @@ func (s *APIV1Service) ListUsers(ctx context.Context, request *v1pb.ListUsersReq var limit, offset int if request.PageToken != "" { - var pageToken v1pb.PageToken + var pageToken apipb.PageToken if err := unmarshalPageToken(request.PageToken, &pageToken); err != nil { return nil, status.Errorf(codes.InvalidArgument, "invalid page token: %v", err) } @@ -117,8 +117,8 @@ func (s *APIV1Service) ListUsers(ctx context.Context, request *v1pb.ListUsersReq } } - response := &v1pb.ListUsersResponse{ - Users: make([]*v1pb.User, 0, len(users)), + response := &apipb.ListUsersResponse{ + Users: make([]*apipb.User, 0, len(users)), NextPageToken: nextPageToken, } for _, user := range users { @@ -127,37 +127,51 @@ func (s *APIV1Service) ListUsers(ctx context.Context, request *v1pb.ListUsersReq return response, nil } -func uniqueBatchUsernames(usernames []string) ([]string, int) { - uniqueUsernames := make([]string, 0, len(usernames)) - seen := make(map[string]struct{}, len(usernames)) - nonEmptyCount := 0 - for _, username := range usernames { - if username == "" { +// uniqueBatchUsernames parses user resource names into unique usernames, +// skipping empty entries. +func uniqueBatchUsernames(names []string) ([]string, error) { + uniqueUsernames := make([]string, 0, len(names)) + seen := make(map[string]struct{}, len(names)) + for _, name := range names { + if name == "" { continue } - nonEmptyCount++ + username, err := parseUsernameFromName(name) + if err != nil { + return nil, err + } if _, ok := seen[username]; ok { continue } seen[username] = struct{}{} uniqueUsernames = append(uniqueUsernames, username) } - return uniqueUsernames, nonEmptyCount + return uniqueUsernames, nil } -func (s *APIV1Service) BatchGetUsers(ctx context.Context, request *v1pb.BatchGetUsersRequest) (*v1pb.BatchGetUsersResponse, error) { - if len(request.Usernames) == 0 { - return &v1pb.BatchGetUsersResponse{Users: []*v1pb.User{}}, nil +func (s *APIService) BatchGetUsers(ctx context.Context, request *apipb.BatchGetUsersRequest) (*apipb.BatchGetUsersResponse, error) { + if len(request.Names) == 0 { + return &apipb.BatchGetUsersResponse{Users: []*apipb.User{}}, nil } - uniqueUsernames, nonEmptyUsernameCount := uniqueBatchUsernames(request.Usernames) - if nonEmptyUsernameCount > maxBatchGetUsers { - return nil, status.Errorf(codes.InvalidArgument, "too many usernames (max %d)", maxBatchGetUsers) + nonEmptyNameCount := 0 + for _, name := range request.Names { + if name != "" { + nonEmptyNameCount++ + } + } + if nonEmptyNameCount > maxBatchGetUsers { + return nil, status.Errorf(codes.InvalidArgument, "too many names (max %d)", maxBatchGetUsers) + } + s.chargeBatch(ctx, nonEmptyNameCount) + + uniqueUsernames, err := uniqueBatchUsernames(request.Names) + if err != nil { + return nil, status.Errorf(codes.InvalidArgument, "invalid user name: %v", err) } - s.chargeBatch(ctx, nonEmptyUsernameCount) if len(uniqueUsernames) == 0 { - return &v1pb.BatchGetUsersResponse{Users: []*v1pb.User{}}, nil + return &apipb.BatchGetUsersResponse{Users: []*apipb.User{}}, nil } normal := store.Normal @@ -170,8 +184,8 @@ func (s *APIV1Service) BatchGetUsers(ctx context.Context, request *v1pb.BatchGet } currentUser, _ := s.fetchCurrentUser(ctx) - response := &v1pb.BatchGetUsersResponse{ - Users: make([]*v1pb.User, 0, len(users)), + response := &apipb.BatchGetUsersResponse{ + Users: make([]*apipb.User, 0, len(users)), } for _, user := range users { response.Users = append(response.Users, convertUserFromStore(user, currentUser)) @@ -179,7 +193,7 @@ func (s *APIV1Service) BatchGetUsers(ctx context.Context, request *v1pb.BatchGet return response, nil } -func (s *APIV1Service) GetUser(ctx context.Context, request *v1pb.GetUserRequest) (*v1pb.User, error) { +func (s *APIService) GetUser(ctx context.Context, request *apipb.GetUserRequest) (*apipb.User, error) { user, err := ResolveUserByName(ctx, s.Store, request.Name) if err != nil { return nil, status.Errorf(codes.InvalidArgument, "invalid user name: %s", request.Name) @@ -191,7 +205,7 @@ func (s *APIV1Service) GetUser(ctx context.Context, request *v1pb.GetUserRequest return convertUserFromStore(user, currentUser), nil } -func (s *APIV1Service) CreateUser(ctx context.Context, request *v1pb.CreateUserRequest) (*v1pb.User, error) { +func (s *APIService) CreateUser(ctx context.Context, request *apipb.CreateUserRequest) (*apipb.User, error) { // Get current user (might be nil for unauthenticated requests) currentUser, _ := s.fetchCurrentUser(ctx) @@ -215,7 +229,7 @@ func (s *APIV1Service) CreateUser(ctx context.Context, request *v1pb.CreateUserR roleToAssign := store.RoleUser if currentUser != nil && currentUser.Role == store.RoleAdmin { // Authenticated ADMIN user can create users with any role specified in request - if request.User.Role != v1pb.User_ROLE_UNSPECIFIED { + if request.User.Role != apipb.User_ROLE_UNSPECIFIED { roleToAssign = convertUserRoleToStore(request.User.Role) } } else { @@ -301,7 +315,7 @@ func (s *APIV1Service) CreateUser(ctx context.Context, request *v1pb.CreateUserR return nil, status.Error(codes.AlreadyExists, emailTakenMessage) } } - return &v1pb.User{ + return &apipb.User{ Username: request.User.Username, Email: email, DisplayName: request.User.DisplayName, @@ -328,7 +342,7 @@ func (s *APIV1Service) CreateUser(ctx context.Context, request *v1pb.CreateUserR return convertUserFromStore(user, user), nil } -func (s *APIV1Service) UpdateUser(ctx context.Context, request *v1pb.UpdateUserRequest) (*v1pb.User, error) { +func (s *APIService) UpdateUser(ctx context.Context, request *apipb.UpdateUserRequest) (*apipb.User, error) { if request.User == nil { return nil, status.Errorf(codes.InvalidArgument, "user is required") } @@ -467,7 +481,7 @@ func (s *APIV1Service) UpdateUser(ctx context.Context, request *v1pb.UpdateUserR return convertUserFromStore(updatedUser, currentUser), nil } -func (s *APIV1Service) DeleteUser(ctx context.Context, request *v1pb.DeleteUserRequest) (*emptypb.Empty, error) { +func (s *APIService) DeleteUser(ctx context.Context, request *apipb.DeleteUserRequest) (*emptypb.Empty, error) { user, err := ResolveUserByName(ctx, s.Store, request.Name) if err != nil { return nil, status.Errorf(codes.InvalidArgument, "invalid user name: %v", err) @@ -524,15 +538,15 @@ func convertUserWriteError(err error, context string) error { } } -func getDefaultUserGeneralSetting() *v1pb.UserSetting_GeneralSetting { - return &v1pb.UserSetting_GeneralSetting{ +func getDefaultUserGeneralSetting() *apipb.UserSetting_GeneralSetting { + return &apipb.UserSetting_GeneralSetting{ Locale: "en", MemoVisibility: "PRIVATE", Theme: "", } } -func (s *APIV1Service) resolveUserFromName(ctx context.Context, name string) (*store.User, error) { +func (s *APIService) resolveUserFromName(ctx context.Context, name string) (*store.User, error) { user, err := ResolveUserByName(ctx, s.Store, name) if err != nil { return nil, err @@ -543,7 +557,7 @@ func (s *APIV1Service) resolveUserFromName(ctx context.Context, name string) (*s return user, nil } -func (s *APIV1Service) resolveUserAndSettingKeyFromName(ctx context.Context, name string) (*store.User, string, error) { +func (s *APIService) resolveUserAndSettingKeyFromName(ctx context.Context, name string) (*store.User, string, error) { parts := strings.Split(name, "/") if len(parts) != 4 || parts[0] != "users" || parts[2] != "settings" { return nil, "", errors.Errorf("invalid resource name format: %s", name) @@ -556,7 +570,7 @@ func (s *APIV1Service) resolveUserAndSettingKeyFromName(ctx context.Context, nam return user, parts[3], nil } -func (s *APIV1Service) resolveUserAndWebhookIDFromName(ctx context.Context, name string) (*store.User, string, error) { +func (s *APIService) resolveUserAndWebhookIDFromName(ctx context.Context, name string) (*store.User, string, error) { parts := strings.Split(name, "/") if len(parts) != 4 || parts[0] != "users" || parts[2] != "webhooks" { return nil, "", errors.New("invalid webhook name format") @@ -569,7 +583,7 @@ func (s *APIV1Service) resolveUserAndWebhookIDFromName(ctx context.Context, name return user, parts[3], nil } -func (s *APIV1Service) resolveUserAndLinkedIdentityProviderFromName(ctx context.Context, name string) (*store.User, string, error) { +func (s *APIService) resolveUserAndLinkedIdentityProviderFromName(ctx context.Context, name string) (*store.User, string, error) { parts := strings.Split(name, "/") if len(parts) != 4 || parts[0] != "users" || parts[2] != "linkedIdentities" { return nil, "", errors.Errorf("invalid linked identity name: %s", name) @@ -582,15 +596,15 @@ func (s *APIV1Service) resolveUserAndLinkedIdentityProviderFromName(ctx context. return user, parts[3], nil } -func convertLinkedIdentityFromStore(user *store.User, identity *store.UserIdentity) *v1pb.LinkedIdentity { - return &v1pb.LinkedIdentity{ - Name: fmt.Sprintf("%s/linkedIdentities/%s", BuildUserName(user.Username), identity.Provider), - IdpName: IdentityProviderNamePrefix + identity.Provider, - ExternUid: identity.ExternUID, +func convertLinkedIdentityFromStore(user *store.User, identity *store.UserIdentity) *apipb.LinkedIdentity { + return &apipb.LinkedIdentity{ + Name: fmt.Sprintf("%s/linkedIdentities/%s", BuildUserName(user.Username), identity.Provider), + IdentityProvider: IdentityProviderNamePrefix + identity.Provider, + ExternalUid: identity.ExternUID, } } -func (s *APIV1Service) resolveUserAndNotificationIDFromName(ctx context.Context, name string) (*store.User, int32, error) { +func (s *APIService) resolveUserAndNotificationIDFromName(ctx context.Context, name string) (*store.User, int32, error) { parts := strings.Split(name, "/") if len(parts) != 4 || parts[0] != "users" || parts[2] != "notifications" { return nil, 0, errors.Errorf("invalid notification name: %s", name) diff --git a/server/api/v1/user_service_access_tokens.go b/server/api/user_service_access_tokens.go similarity index 81% rename from server/api/v1/user_service_access_tokens.go rename to server/api/user_service_access_tokens.go index 3cb8735cd..64b2d88b1 100644 --- a/server/api/v1/user_service_access_tokens.go +++ b/server/api/user_service_access_tokens.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "context" @@ -12,12 +12,12 @@ import ( "google.golang.org/protobuf/types/known/timestamppb" "github.com/usememos/memos/internal/random" - v1pb "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" storepb "github.com/usememos/memos/proto/gen/store" "github.com/usememos/memos/server/auth" ) -func (s *APIV1Service) ListPersonalAccessTokens(ctx context.Context, request *v1pb.ListPersonalAccessTokensRequest) (*v1pb.ListPersonalAccessTokensResponse, error) { +func (s *APIService) ListPersonalAccessTokens(ctx context.Context, request *apipb.ListPersonalAccessTokensRequest) (*apipb.ListPersonalAccessTokensResponse, error) { user, err := s.resolveUserFromName(ctx, request.Parent) if err != nil { return nil, status.Errorf(codes.InvalidArgument, "invalid user name: %v", err) @@ -34,18 +34,18 @@ func (s *APIV1Service) ListPersonalAccessTokens(ctx context.Context, request *v1 return nil, status.Errorf(codes.Internal, "failed to get access tokens: %v", err) } - personalAccessTokens := make([]*v1pb.PersonalAccessToken, len(tokens)) + personalAccessTokens := make([]*apipb.PersonalAccessToken, len(tokens)) for i, token := range tokens { - personalAccessTokens[i] = &v1pb.PersonalAccessToken{ + personalAccessTokens[i] = &apipb.PersonalAccessToken{ Name: fmt.Sprintf("%s/personalAccessTokens/%s", BuildUserName(user.Username), token.TokenId), Description: token.Description, - ExpiresAt: token.ExpiresAt, - CreatedAt: token.CreatedAt, - LastUsedAt: token.LastUsedAt, + ExpireTime: token.ExpiresAt, + CreateTime: token.CreatedAt, + LastUseTime: token.LastUsedAt, } } - return &v1pb.ListPersonalAccessTokensResponse{PersonalAccessTokens: personalAccessTokens}, nil + return &apipb.ListPersonalAccessTokensResponse{PersonalAccessTokens: personalAccessTokens}, nil } // CreatePersonalAccessToken creates a new Personal Access Token (PAT) for a user. @@ -68,7 +68,7 @@ func (s *APIV1Service) ListPersonalAccessTokens(ctx context.Context, request *v1 // // Authentication: Required (session cookie or access token) // Authorization: User can only create tokens for themselves. -func (s *APIV1Service) CreatePersonalAccessToken(ctx context.Context, request *v1pb.CreatePersonalAccessTokenRequest) (*v1pb.CreatePersonalAccessTokenResponse, error) { +func (s *APIService) CreatePersonalAccessToken(ctx context.Context, request *apipb.CreatePersonalAccessTokenRequest) (*apipb.CreatePersonalAccessTokenResponse, error) { user, err := s.resolveUserFromName(ctx, request.Parent) if err != nil { return nil, status.Errorf(codes.InvalidArgument, "invalid user name: %v", err) @@ -102,12 +102,12 @@ func (s *APIV1Service) CreatePersonalAccessToken(ctx context.Context, request *v return nil, status.Errorf(codes.Internal, "failed to create access token: %v", err) } - return &v1pb.CreatePersonalAccessTokenResponse{ - PersonalAccessToken: &v1pb.PersonalAccessToken{ + return &apipb.CreatePersonalAccessTokenResponse{ + PersonalAccessToken: &apipb.PersonalAccessToken{ Name: fmt.Sprintf("%s/personalAccessTokens/%s", BuildUserName(user.Username), tokenID), Description: request.Description, - ExpiresAt: expiresAt, - CreatedAt: patRecord.CreatedAt, + ExpireTime: expiresAt, + CreateTime: patRecord.CreatedAt, }, Token: token, // Only returned on creation }, nil @@ -126,7 +126,7 @@ func (s *APIV1Service) CreatePersonalAccessToken(ctx context.Context, request *v // // Authentication: Required (session cookie or access token) // Authorization: User can only delete their own tokens. -func (s *APIV1Service) DeletePersonalAccessToken(ctx context.Context, request *v1pb.DeletePersonalAccessTokenRequest) (*emptypb.Empty, error) { +func (s *APIService) DeletePersonalAccessToken(ctx context.Context, request *apipb.DeletePersonalAccessTokenRequest) (*emptypb.Empty, error) { parts := strings.Split(request.Name, "/") if len(parts) != 4 || parts[0] != "users" || parts[2] != "personalAccessTokens" { return nil, status.Errorf(codes.InvalidArgument, "invalid personal access token name") diff --git a/server/api/v1/user_service_converters.go b/server/api/user_service_converters.go similarity index 75% rename from server/api/v1/user_service_converters.go rename to server/api/user_service_converters.go index f1470ec98..15a162ee0 100644 --- a/server/api/v1/user_service_converters.go +++ b/server/api/user_service_converters.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "fmt" @@ -8,13 +8,13 @@ import ( "github.com/pkg/errors" "google.golang.org/protobuf/types/known/timestamppb" - v1pb "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" storepb "github.com/usememos/memos/proto/gen/store" "github.com/usememos/memos/store" ) -func convertUserFromStore(user *store.User, viewer *store.User) *v1pb.User { - userpb := &v1pb.User{ +func convertUserFromStore(user *store.User, viewer *store.User) *apipb.User { + userpb := &apipb.User{ Name: BuildUserName(user.Username), State: convertStateFromStore(user.RowStatus), CreateTime: timestamppb.New(time.Unix(user.CreatedTs, 0)), @@ -48,20 +48,20 @@ func canViewerAccessUserEmail(viewer, user *store.User) bool { return viewer.Role == store.RoleAdmin || viewer.ID == user.ID } -func convertUserRoleFromStore(role store.Role) v1pb.User_Role { +func convertUserRoleFromStore(role store.Role) apipb.User_Role { switch role { case store.RoleAdmin: - return v1pb.User_ADMIN + return apipb.User_ADMIN case store.RoleUser: - return v1pb.User_USER + return apipb.User_USER default: - return v1pb.User_ROLE_UNSPECIFIED + return apipb.User_ROLE_UNSPECIFIED } } -func convertUserRoleToStore(role v1pb.User_Role) store.Role { +func convertUserRoleToStore(role apipb.User_Role) store.Role { switch role { - case v1pb.User_ADMIN: + case apipb.User_ADMIN: return store.RoleAdmin default: return store.RoleUser @@ -84,11 +84,11 @@ func extractImageInfo(dataURI string) (string, string, error) { // convertSettingKeyToStore converts API setting key to store enum. func convertSettingKeyToStore(key string) (storepb.UserSetting_Key, error) { switch key { - case v1pb.UserSetting_Key_name[int32(v1pb.UserSetting_GENERAL)]: + case apipb.UserSetting_Key_name[int32(apipb.UserSetting_GENERAL)]: return storepb.UserSetting_GENERAL, nil - case v1pb.UserSetting_Key_name[int32(v1pb.UserSetting_WEBHOOKS)]: + case apipb.UserSetting_Key_name[int32(apipb.UserSetting_WEBHOOKS)]: return storepb.UserSetting_WEBHOOKS, nil - case v1pb.UserSetting_Key_name[int32(v1pb.UserSetting_TAGS)]: + case apipb.UserSetting_Key_name[int32(apipb.UserSetting_TAGS)]: return storepb.UserSetting_TAGS, nil default: return storepb.UserSetting_KEY_UNSPECIFIED, errors.Errorf("unknown setting key: %s", key) @@ -99,37 +99,37 @@ func convertSettingKeyToStore(key string) (storepb.UserSetting_Key, error) { func convertSettingKeyFromStore(key storepb.UserSetting_Key) string { switch key { case storepb.UserSetting_GENERAL: - return v1pb.UserSetting_Key_name[int32(v1pb.UserSetting_GENERAL)] + return apipb.UserSetting_Key_name[int32(apipb.UserSetting_GENERAL)] case storepb.UserSetting_MEMO_VIEWS: return "MEMO_VIEWS" // Not defined in API proto case storepb.UserSetting_WEBHOOKS: - return v1pb.UserSetting_Key_name[int32(v1pb.UserSetting_WEBHOOKS)] + return apipb.UserSetting_Key_name[int32(apipb.UserSetting_WEBHOOKS)] case storepb.UserSetting_TAGS: - return v1pb.UserSetting_Key_name[int32(v1pb.UserSetting_TAGS)] + return apipb.UserSetting_Key_name[int32(apipb.UserSetting_TAGS)] default: return "unknown" } } -func convertUserTagsSettingFromStore(setting *storepb.TagsUserSetting) *v1pb.UserSetting_TagsSetting { +func convertUserTagsSettingFromStore(setting *storepb.TagsUserSetting) *apipb.UserSetting_TagsSetting { if setting == nil { - return &v1pb.UserSetting_TagsSetting{Tags: map[string]*v1pb.UserSetting_TagMetadata{}} + return &apipb.UserSetting_TagsSetting{Tags: map[string]*apipb.UserSetting_TagMetadata{}} } - tags := make(map[string]*v1pb.UserSetting_TagMetadata, len(setting.Tags)) + tags := make(map[string]*apipb.UserSetting_TagMetadata, len(setting.Tags)) for tag, metadata := range setting.Tags { if metadata == nil { - tags[tag] = &v1pb.UserSetting_TagMetadata{} + tags[tag] = &apipb.UserSetting_TagMetadata{} continue } - tags[tag] = &v1pb.UserSetting_TagMetadata{ + tags[tag] = &apipb.UserSetting_TagMetadata{ BackgroundColor: metadata.GetBackgroundColor(), BlurContent: metadata.GetBlurContent(), } } - return &v1pb.UserSetting_TagsSetting{Tags: tags} + return &apipb.UserSetting_TagsSetting{Tags: tags} } -func convertUserTagsSettingToStore(setting *v1pb.UserSetting_TagsSetting) *storepb.TagsUserSetting { +func convertUserTagsSettingToStore(setting *apipb.UserSetting_TagsSetting) *storepb.TagsUserSetting { if setting == nil { return &storepb.TagsUserSetting{Tags: map[string]*storepb.UserTagMetadata{}} } @@ -148,28 +148,28 @@ func convertUserTagsSettingToStore(setting *v1pb.UserSetting_TagsSetting) *store } // convertUserSettingFromStore converts store UserSetting to API UserSetting. -func convertUserSettingFromStore(storeSetting *storepb.UserSetting, user *store.User, key storepb.UserSetting_Key) *v1pb.UserSetting { +func convertUserSettingFromStore(storeSetting *storepb.UserSetting, user *store.User, key storepb.UserSetting_Key) *apipb.UserSetting { if storeSetting == nil { // Return default setting if none exists settingKey := convertSettingKeyFromStore(key) - setting := &v1pb.UserSetting{ + setting := &apipb.UserSetting{ Name: fmt.Sprintf("%s/settings/%s", BuildUserName(user.Username), settingKey), } switch key { case storepb.UserSetting_GENERAL: - setting.Value = &v1pb.UserSetting_GeneralSetting_{ + setting.Value = &apipb.UserSetting_GeneralSetting_{ GeneralSetting: getDefaultUserGeneralSetting(), } case storepb.UserSetting_WEBHOOKS: - setting.Value = &v1pb.UserSetting_WebhooksSetting_{ - WebhooksSetting: &v1pb.UserSetting_WebhooksSetting{ - Webhooks: []*v1pb.UserWebhook{}, + setting.Value = &apipb.UserSetting_WebhooksSetting_{ + WebhooksSetting: &apipb.UserSetting_WebhooksSetting{ + Webhooks: []*apipb.UserWebhook{}, }, } case storepb.UserSetting_TAGS: - setting.Value = &v1pb.UserSetting_TagsSetting_{ - TagsSetting: &v1pb.UserSetting_TagsSetting{Tags: map[string]*v1pb.UserSetting_TagMetadata{}}, + setting.Value = &apipb.UserSetting_TagsSetting_{ + TagsSetting: &apipb.UserSetting_TagsSetting{Tags: map[string]*apipb.UserSetting_TagMetadata{}}, } default: return nil @@ -178,15 +178,15 @@ func convertUserSettingFromStore(storeSetting *storepb.UserSetting, user *store. } settingKey := convertSettingKeyFromStore(storeSetting.Key) - setting := &v1pb.UserSetting{ + setting := &apipb.UserSetting{ Name: fmt.Sprintf("%s/settings/%s", BuildUserName(user.Username), settingKey), } switch storeSetting.Key { case storepb.UserSetting_GENERAL: if general := storeSetting.GetGeneral(); general != nil { - setting.Value = &v1pb.UserSetting_GeneralSetting_{ - GeneralSetting: &v1pb.UserSetting_GeneralSetting{ + setting.Value = &apipb.UserSetting_GeneralSetting_{ + GeneralSetting: &apipb.UserSetting_GeneralSetting{ Locale: general.Locale, MemoVisibility: general.MemoVisibility, Theme: general.Theme, @@ -194,17 +194,17 @@ func convertUserSettingFromStore(storeSetting *storepb.UserSetting, user *store. }, } } else { - setting.Value = &v1pb.UserSetting_GeneralSetting_{ + setting.Value = &apipb.UserSetting_GeneralSetting_{ GeneralSetting: getDefaultUserGeneralSetting(), } } case storepb.UserSetting_WEBHOOKS: webhooks := storeSetting.GetWebhooks() - apiWebhooks := make([]*v1pb.UserWebhook, 0) + apiWebhooks := make([]*apipb.UserWebhook, 0) if webhooks != nil { - apiWebhooks = make([]*v1pb.UserWebhook, 0, len(webhooks.Webhooks)) + apiWebhooks = make([]*apipb.UserWebhook, 0, len(webhooks.Webhooks)) for _, webhook := range webhooks.Webhooks { - apiWebhook := &v1pb.UserWebhook{ + apiWebhook := &apipb.UserWebhook{ Name: fmt.Sprintf("%s/webhooks/%s", BuildUserName(user.Username), webhook.Id), Url: webhook.Url, DisplayName: webhook.Title, @@ -213,13 +213,13 @@ func convertUserSettingFromStore(storeSetting *storepb.UserSetting, user *store. apiWebhooks = append(apiWebhooks, apiWebhook) } } - setting.Value = &v1pb.UserSetting_WebhooksSetting_{ - WebhooksSetting: &v1pb.UserSetting_WebhooksSetting{ + setting.Value = &apipb.UserSetting_WebhooksSetting_{ + WebhooksSetting: &apipb.UserSetting_WebhooksSetting{ Webhooks: apiWebhooks, }, } case storepb.UserSetting_TAGS: - setting.Value = &v1pb.UserSetting_TagsSetting_{ + setting.Value = &apipb.UserSetting_TagsSetting_{ TagsSetting: convertUserTagsSettingFromStore(storeSetting.GetTags()), } default: @@ -230,7 +230,7 @@ func convertUserSettingFromStore(storeSetting *storepb.UserSetting, user *store. } // convertUserSettingToStore converts API UserSetting to store UserSetting. -func convertUserSettingToStore(apiSetting *v1pb.UserSetting, userID int32, key storepb.UserSetting_Key) (*storepb.UserSetting, error) { +func convertUserSettingToStore(apiSetting *apipb.UserSetting, userID int32, key storepb.UserSetting_Key) (*storepb.UserSetting, error) { storeSetting := &storepb.UserSetting{ UserId: userID, Key: key, diff --git a/server/api/v1/user_service_filter.go b/server/api/user_service_filter.go similarity index 99% rename from server/api/v1/user_service_filter.go rename to server/api/user_service_filter.go index 1c01ca0d4..de467fc8b 100644 --- a/server/api/v1/user_service_filter.go +++ b/server/api/user_service_filter.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "strings" diff --git a/server/api/v1/user_service_identities.go b/server/api/user_service_identities.go similarity index 84% rename from server/api/v1/user_service_identities.go rename to server/api/user_service_identities.go index 8e53cc087..4a7e88c19 100644 --- a/server/api/v1/user_service_identities.go +++ b/server/api/user_service_identities.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "context" @@ -7,11 +7,11 @@ import ( "google.golang.org/grpc/status" "google.golang.org/protobuf/types/known/emptypb" - v1pb "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" "github.com/usememos/memos/store" ) -func (s *APIV1Service) ListLinkedIdentities(ctx context.Context, request *v1pb.ListLinkedIdentitiesRequest) (*v1pb.ListLinkedIdentitiesResponse, error) { +func (s *APIService) ListLinkedIdentities(ctx context.Context, request *apipb.ListLinkedIdentitiesRequest) (*apipb.ListLinkedIdentitiesResponse, error) { user, err := s.resolveUserFromName(ctx, request.Parent) if err != nil { return nil, status.Errorf(codes.InvalidArgument, "invalid parent: %v", err) @@ -27,8 +27,8 @@ func (s *APIV1Service) ListLinkedIdentities(ctx context.Context, request *v1pb.L return nil, status.Errorf(codes.Internal, "failed to list linked identities: %v", err) } - response := &v1pb.ListLinkedIdentitiesResponse{ - LinkedIdentities: []*v1pb.LinkedIdentity{}, + response := &apipb.ListLinkedIdentitiesResponse{ + LinkedIdentities: []*apipb.LinkedIdentity{}, } for _, identity := range identities { response.LinkedIdentities = append(response.LinkedIdentities, convertLinkedIdentityFromStore(user, identity)) @@ -36,7 +36,7 @@ func (s *APIV1Service) ListLinkedIdentities(ctx context.Context, request *v1pb.L return response, nil } -func (s *APIV1Service) CreateLinkedIdentity(ctx context.Context, request *v1pb.CreateLinkedIdentityRequest) (*v1pb.LinkedIdentity, error) { +func (s *APIService) CreateLinkedIdentity(ctx context.Context, request *apipb.CreateLinkedIdentityRequest) (*apipb.LinkedIdentity, error) { user, err := s.resolveUserFromName(ctx, request.Parent) if err != nil { return nil, status.Errorf(codes.InvalidArgument, "invalid parent: %v", err) @@ -53,7 +53,7 @@ func (s *APIV1Service) CreateLinkedIdentity(ctx context.Context, request *v1pb.C return nil, status.Errorf(codes.PermissionDenied, "permission denied") } - identityProvider, userInfo, err := s.resolveSSOIdentity(ctx, request.IdpName, request.Code, request.RedirectUri, request.CodeVerifier) + identityProvider, userInfo, err := s.resolveSSOIdentity(ctx, request.IdentityProvider, request.Code, request.RedirectUri, request.CodeVerifier) if err != nil { return nil, err } @@ -78,7 +78,7 @@ func (s *APIV1Service) CreateLinkedIdentity(ctx context.Context, request *v1pb.C return convertLinkedIdentityFromStore(user, identity), nil } -func (s *APIV1Service) GetLinkedIdentity(ctx context.Context, request *v1pb.GetLinkedIdentityRequest) (*v1pb.LinkedIdentity, error) { +func (s *APIService) GetLinkedIdentity(ctx context.Context, request *apipb.GetLinkedIdentityRequest) (*apipb.LinkedIdentity, error) { user, provider, err := s.resolveUserAndLinkedIdentityProviderFromName(ctx, request.Name) if err != nil { return nil, status.Errorf(codes.InvalidArgument, "invalid linked identity name: %v", err) @@ -103,7 +103,7 @@ func (s *APIV1Service) GetLinkedIdentity(ctx context.Context, request *v1pb.GetL return convertLinkedIdentityFromStore(user, identity), nil } -func (s *APIV1Service) DeleteLinkedIdentity(ctx context.Context, request *v1pb.DeleteLinkedIdentityRequest) (*emptypb.Empty, error) { +func (s *APIService) DeleteLinkedIdentity(ctx context.Context, request *apipb.DeleteLinkedIdentityRequest) (*emptypb.Empty, error) { user, provider, err := s.resolveUserAndLinkedIdentityProviderFromName(ctx, request.Name) if err != nil { return nil, status.Errorf(codes.InvalidArgument, "invalid linked identity name: %v", err) diff --git a/server/api/v1/user_service_memo_export.go b/server/api/user_service_memo_export.go similarity index 95% rename from server/api/v1/user_service_memo_export.go rename to server/api/user_service_memo_export.go index a7df6f1a8..4c20a354c 100644 --- a/server/api/v1/user_service_memo_export.go +++ b/server/api/user_service_memo_export.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "context" @@ -34,7 +34,7 @@ type memoExportData struct { // WriteMemoExport writes a Memos export file holding every memo the user // created, including comments and archived memos, and the attachments linked // to them. Nothing another user created is included. -func (s *APIV1Service) WriteMemoExport(ctx context.Context, user *store.User, w io.Writer) error { +func (s *APIService) WriteMemoExport(ctx context.Context, user *store.User, w io.Writer) error { if user == nil { return errors.New("user is required") } @@ -69,7 +69,7 @@ func (s *APIV1Service) WriteMemoExport(ctx context.Context, user *store.User, w return writer.Close() } -func (s *APIV1Service) loadMemoExportData(ctx context.Context, user *store.User) (*memoExportData, error) { +func (s *APIService) loadMemoExportData(ctx context.Context, user *store.User) (*memoExportData, error) { memos, err := s.Store.ListMemos(ctx, &store.FindMemo{CreatorID: &user.ID}) if err != nil { return nil, errors.Wrap(err, "failed to list memos") @@ -165,7 +165,7 @@ func (s *APIV1Service) loadMemoExportData(ctx context.Context, user *store.User) return export, nil } -func (s *APIV1Service) buildMemoExportRecord(ctx context.Context, writer *memoexport.Writer, user *store.User, export *memoExportData, memo *store.Memo) (*memoexport.Memo, error) { +func (s *APIService) buildMemoExportRecord(ctx context.Context, writer *memoexport.Writer, user *store.User, export *memoExportData, memo *store.Memo) (*memoexport.Memo, error) { record := &memoexport.Memo{ UID: memo.UID, Creator: user.Username, diff --git a/server/api/v1/user_service_memo_import.go b/server/api/user_service_memo_import.go similarity index 90% rename from server/api/v1/user_service_memo_import.go rename to server/api/user_service_memo_import.go index e8a42f1e8..61e4f3a41 100644 --- a/server/api/v1/user_service_memo_import.go +++ b/server/api/user_service_memo_import.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "bytes" @@ -19,14 +19,14 @@ import ( "github.com/usememos/memos/core/memoexport" "github.com/usememos/memos/core/memopayload" "github.com/usememos/memos/internal/ratelimit" - v1pb "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" storepb "github.com/usememos/memos/proto/gen/store" "github.com/usememos/memos/store" ) // PlanMemoImport classifies every record of an archive against the // instance without writing anything. -func (s *APIV1Service) PlanMemoImport(ctx context.Context, user *store.User, archive *memoexport.File) (*v1pb.MemoImportPlan, error) { +func (s *APIService) PlanMemoImport(ctx context.Context, user *store.User, archive *memoexport.File) (*apipb.ImportMemosPlan, error) { if user == nil || archive == nil { return nil, errors.New("user and archive are required") } @@ -34,10 +34,10 @@ func (s *APIV1Service) PlanMemoImport(ctx context.Context, user *store.User, arc if err != nil { return nil, errors.Wrap(err, "invalid export time") } - plan := &v1pb.MemoImportPlan{ + plan := &apipb.ImportMemosPlan{ ExportTime: timestamppb.New(time.Unix(exportTime, 0)), Generator: archive.Manifest.Generator.Name + " " + archive.Manifest.Generator.Version, - Memos: int32(len(archive.Memos)), + MemoCount: int32(len(archive.Memos)), Warnings: archiveIssues(archive.Warnings), } if archive.Manifest.Scope.User != nil { @@ -46,7 +46,7 @@ func (s *APIV1Service) PlanMemoImport(ctx context.Context, user *store.User, arc for _, record := range archive.Memos { for _, attachment := range record.Attachments { if attachment.Path != "" { - plan.Attachments++ + plan.AttachmentCount++ } } } @@ -68,7 +68,7 @@ func (s *APIV1Service) PlanMemoImport(ctx context.Context, user *store.User, arc } // findMemosByUID loads the instance memos whose UIDs appear in the archive. -func (s *APIV1Service) findMemosByUID(ctx context.Context, archive *memoexport.File, excludeContent bool) (map[string]*store.Memo, error) { +func (s *APIService) findMemosByUID(ctx context.Context, archive *memoexport.File, excludeContent bool) (map[string]*store.Memo, error) { uids := make([]string, 0, len(archive.Memos)) for _, record := range archive.Memos { uids = append(uids, record.UID) @@ -86,10 +86,10 @@ func (s *APIV1Service) findMemosByUID(ctx context.Context, archive *memoexport.F return found, nil } -func archiveIssues(warnings []memoexport.Warning) []*v1pb.MemoImportIssue { - issues := make([]*v1pb.MemoImportIssue, 0, len(warnings)) +func archiveIssues(warnings []memoexport.Warning) []*apipb.ImportMemosIssue { + issues := make([]*apipb.ImportMemosIssue, 0, len(warnings)) for _, warning := range warnings { - issues = append(issues, &v1pb.MemoImportIssue{Memo: warning.UID, Message: warning.Message}) + issues = append(issues, &apipb.ImportMemosIssue{MemoUid: warning.UID, Message: warning.Message}) } return issues } @@ -102,12 +102,12 @@ type writtenMemo struct { } type memoImporter struct { - service *APIV1Service + service *APIService ctx context.Context user *store.User archive *memoexport.File - policy v1pb.ImportMemosRequest_ConflictPolicy - report *v1pb.MemoImportReport + policy apipb.ImportMemosRequest_ConflictPolicy + report *apipb.ImportMemosReport storageSetting *storepb.InstanceStorageSetting contentLengthLimit int @@ -129,12 +129,12 @@ type memoImporter struct { // ImportMemoExport applies an opened archive to the importing user's memos // following the documented import semantics. The user in ctx must be the // same as user. -func (s *APIV1Service) ImportMemoExport(ctx context.Context, user *store.User, archive *memoexport.File, policy v1pb.ImportMemosRequest_ConflictPolicy) (*v1pb.MemoImportReport, error) { +func (s *APIService) ImportMemoExport(ctx context.Context, user *store.User, archive *memoexport.File, policy apipb.ImportMemosRequest_ConflictPolicy) (*apipb.ImportMemosReport, error) { if user == nil || archive == nil { return nil, errors.New("user and archive are required") } - if policy == v1pb.ImportMemosRequest_CONFLICT_POLICY_UNSPECIFIED { - policy = v1pb.ImportMemosRequest_SKIP + if policy == apipb.ImportMemosRequest_CONFLICT_POLICY_UNSPECIFIED { + policy = apipb.ImportMemosRequest_SKIP } storageSetting, err := s.Store.GetInstanceStorageSetting(ctx) if err != nil { @@ -154,7 +154,7 @@ func (s *APIV1Service) ImportMemoExport(ctx context.Context, user *store.User, a user: user, archive: archive, policy: policy, - report: &v1pb.MemoImportReport{Warnings: archiveIssues(archive.Warnings)}, + report: &apipb.ImportMemosReport{Warnings: archiveIssues(archive.Warnings)}, storageSetting: storageSetting, contentLengthLimit: contentLengthLimit, existing: existing, @@ -167,7 +167,7 @@ func (s *APIV1Service) ImportMemoExport(ctx context.Context, user *store.User, a } if err := importer.importMemo(record); err != nil { importer.report.Failed++ - importer.report.Failures = append(importer.report.Failures, &v1pb.MemoImportIssue{Memo: record.UID, Message: err.Error()}) + importer.report.Failures = append(importer.report.Failures, &apipb.ImportMemosIssue{MemoUid: record.UID, Message: err.Error()}) continue } // An imported memo counts against the same write budget as one @@ -189,7 +189,7 @@ func (s *APIV1Service) ImportMemoExport(ctx context.Context, user *store.User, a } func (i *memoImporter) warn(uid, message string) { - i.report.Warnings = append(i.report.Warnings, &v1pb.MemoImportIssue{Memo: uid, Message: message}) + i.report.Warnings = append(i.report.Warnings, &apipb.ImportMemosIssue{MemoUid: uid, Message: message}) } func (i *memoImporter) importMemo(record *memoexport.Memo) error { @@ -204,11 +204,11 @@ func (i *memoImporter) importMemo(record *memoexport.Memo) error { if existing := i.existing[record.UID]; existing != nil { if existing.CreatorID == i.user.ID { switch i.policy { - case v1pb.ImportMemosRequest_SKIP: + case apipb.ImportMemosRequest_SKIP: i.resolved[record.UID] = existing i.report.Skipped++ return nil - case v1pb.ImportMemosRequest_REPLACE: + case apipb.ImportMemosRequest_REPLACE: return i.replaceMemo(record, existing, content) } } @@ -293,9 +293,9 @@ func (i *memoImporter) replaceMemo(record *memoexport.Memo, existing *store.Memo if err != nil { return errors.Wrap(err, "failed to list attachments") } - names := make([]*v1pb.Attachment, 0, len(current)+len(record.Attachments)) + names := make([]*apipb.Attachment, 0, len(current)+len(record.Attachments)) for _, attachment := range current { - names = append(names, &v1pb.Attachment{Name: AttachmentNamePrefix + attachment.UID}) + names = append(names, &apipb.Attachment{Name: AttachmentNamePrefix + attachment.UID}) } added, err := i.importAttachments(record, current) if err != nil { @@ -316,7 +316,7 @@ func (i *memoImporter) replaceMemo(record *memoexport.Memo, existing *store.Memo // bindAttachments prepares the memo's attachment set, resolves the managed // references in its content, and runs write. When any step fails, the // attachments this run created for the memo are removed again. -func (i *memoImporter) bindAttachments(memo *store.Memo, names, added []*v1pb.Attachment, write func(*preparedMemoAttachments, []int32) error) error { +func (i *memoImporter) bindAttachments(memo *store.Memo, names, added []*apipb.Attachment, write func(*preparedMemoAttachments, []int32) error) error { err := func() error { prepared, err := i.service.prepareMemoAttachments(i.ctx, i.user, memo, names) if err != nil { @@ -429,15 +429,15 @@ func (i *memoImporter) resolveMemo(uid string) (*store.Memo, error) { // importAttachments creates the attachments of a record that the memo does // not already hold and returns their names for binding. -func (i *memoImporter) importAttachments(record *memoexport.Memo, current []*store.Attachment) ([]*v1pb.Attachment, error) { +func (i *memoImporter) importAttachments(record *memoexport.Memo, current []*store.Attachment) ([]*apipb.Attachment, error) { bound := make(map[string]struct{}, len(current)) for _, attachment := range current { bound[attachment.UID] = struct{}{} } - toBind := make([]*v1pb.Attachment, 0, len(record.Attachments)) + toBind := make([]*apipb.Attachment, 0, len(record.Attachments)) // created holds only attachments this run stored; a pre-existing // attachment that is merely re-bound is never discarded on failure. - created := make([]*v1pb.Attachment, 0, len(record.Attachments)) + created := make([]*apipb.Attachment, 0, len(record.Attachments)) for index := range record.Attachments { entry := &record.Attachments[index] if _, ok := bound[entry.UID]; ok { @@ -448,7 +448,7 @@ func (i *memoImporter) importAttachments(record *memoexport.Memo, current []*sto i.discardAttachments(created) return nil, errors.Wrapf(err, "attachment %s", entry.UID) } - attachment := &v1pb.Attachment{Name: name} + attachment := &apipb.Attachment{Name: name} toBind = append(toBind, attachment) if stored { created = append(created, attachment) @@ -516,7 +516,7 @@ func (i *memoImporter) storeAttachment(entry *memoexport.Attachment, uid, mimeTy Size: int64(len(data)), } if len(entry.MediaMetadata) > 0 { - metadata := &v1pb.MediaMetadata{} + metadata := &apipb.MediaMetadata{} if err := (protojson.UnmarshalOptions{DiscardUnknown: true}).Unmarshal(entry.MediaMetadata, metadata); err != nil { i.warn("", fmt.Sprintf("attachment %s: media metadata was not understood and was dropped", entry.UID)) } else if stored, err := validateClientMediaMetadata(metadata, mimeType); err != nil { @@ -570,7 +570,7 @@ func (i *memoImporter) storedAttachmentDigest(attachment *store.Attachment) (str // discardAttachments removes attachments this run created for a memo that // then failed, so no orphan uploads are left behind. -func (i *memoImporter) discardAttachments(attachments []*v1pb.Attachment) { +func (i *memoImporter) discardAttachments(attachments []*apipb.Attachment) { for _, attachment := range attachments { uid, err := ExtractAttachmentUIDFromName(attachment.Name) if err != nil { diff --git a/server/api/v1/user_service_memo_transfer.go b/server/api/user_service_memo_transfer.go similarity index 81% rename from server/api/v1/user_service_memo_transfer.go rename to server/api/user_service_memo_transfer.go index 0a986561c..087a61106 100644 --- a/server/api/v1/user_service_memo_transfer.go +++ b/server/api/user_service_memo_transfer.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "bytes" @@ -13,12 +13,12 @@ import ( "github.com/usememos/memos/core/memoexport" "github.com/usememos/memos/internal/ratelimit" - v1pb "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" "github.com/usememos/memos/store" ) const ( - importMemosProcedure = "/memos.api.v1.UserService/ImportMemos" + importMemosProcedure = "/memos.api.UserService/ImportMemos" memoImportTempPrefix = ".memos-rpc-import-" // maxMemoImportBytes caps one staged archive. maxMemoImportBytes = 4 << 30 @@ -27,13 +27,13 @@ const ( // memoImportState is what a staged archive carries besides its bytes: the // report, once the finishing call has imported it. type memoImportState struct { - report *v1pb.MemoImportReport + report *apipb.ImportMemosReport } type memoImports = uploadSessions[memoImportState] // resolveMemoTransferOwner resolves users/{user} and asserts it is the caller. -func (s *APIV1Service) resolveMemoTransferOwner(ctx context.Context, name string) (*store.User, error) { +func (s *APIService) resolveMemoTransferOwner(ctx context.Context, name string) (*store.User, error) { user, err := ResolveUserByName(ctx, s.Store, name) if err != nil { return nil, status.Errorf(codes.InvalidArgument, "invalid user name: %v", err) @@ -48,7 +48,7 @@ func (s *APIV1Service) resolveMemoTransferOwner(ctx context.Context, name string } // ExportMemos writes the caller's Memos export file into the response body. -func (s *APIV1Service) ExportMemos(ctx context.Context, request *v1pb.ExportMemosRequest) (*httpbody.HttpBody, error) { +func (s *APIService) ExportMemos(ctx context.Context, request *apipb.ExportMemosRequest) (*httpbody.HttpBody, error) { user, err := s.resolveMemoTransferOwner(ctx, request.Name) if err != nil { return nil, err @@ -66,7 +66,7 @@ func (s *APIV1Service) ExportMemos(ctx context.Context, request *v1pb.ExportMemo // ImportMemos stages an archive in chunks and, on the finishing call, plans // or imports it. See the proto comment for the protocol. -func (s *APIV1Service) ImportMemos(ctx context.Context, request *v1pb.ImportMemosRequest) (*v1pb.ImportMemosResponse, error) { +func (s *APIService) ImportMemos(ctx context.Context, request *apipb.ImportMemosRequest) (*apipb.ImportMemosResponse, error) { user, err := s.resolveMemoTransferOwner(ctx, request.Name) if err != nil { return nil, err @@ -77,7 +77,7 @@ func (s *APIV1Service) ImportMemos(ctx context.Context, request *v1pb.ImportMemo var id string var upload *uploadSession[memoImportState] switch u := request.Upload.(type) { - case *v1pb.ImportMemosRequest_Spec: + case *apipb.ImportMemosRequest_Spec: if err := s.throttleAndCharge(ratelimit.ScopeArchiveUser, userKey(user.ID), 1); err != nil { return nil, err } @@ -95,7 +95,7 @@ func (s *APIV1Service) ImportMemos(ctx context.Context, request *v1pb.ImportMemo return nil, err } upload.mu.Lock() - case *v1pb.ImportMemosRequest_UploadId: + case *apipb.ImportMemosRequest_UploadId: id = u.UploadId upload, err = s.memoImports.resume(id, user.ID) if err != nil { @@ -111,9 +111,9 @@ func (s *APIV1Service) ImportMemos(ctx context.Context, request *v1pb.ImportMemo if err := upload.write(request.WriteOffset, request.Data, request.FinishWrite); err != nil { return nil, err } - response := &v1pb.ImportMemosResponse{UploadId: id, CommittedSize: upload.committedSize, MaxChunkSize: uploadChunkSize} + response := &apipb.ImportMemosResponse{UploadId: id, CommittedSize: upload.committedSize, MaxChunkSize: uploadChunkSize} if upload.complete { - response.Result = &v1pb.ImportMemosResponse_Report{Report: upload.state.report} + response.Result = &apipb.ImportMemosResponse_Report{Report: upload.state.report} } else if request.FinishWrite { if upload.committedSize != upload.totalSize { return nil, status.Errorf(codes.FailedPrecondition, "upload is incomplete") @@ -129,7 +129,7 @@ func (s *APIV1Service) ImportMemos(ctx context.Context, request *v1pb.ImportMemo // finishMemoImport reads the staged archive and either plans or imports it, // setting the response result. An import completes the session; a plan // leaves it staged. -func (s *APIV1Service) finishMemoImport(ctx context.Context, user *store.User, upload *uploadSession[memoImportState], request *v1pb.ImportMemosRequest, response *v1pb.ImportMemosResponse) error { +func (s *APIService) finishMemoImport(ctx context.Context, user *store.User, upload *uploadSession[memoImportState], request *apipb.ImportMemosRequest, response *apipb.ImportMemosResponse) error { file, err := os.Open(upload.path) if err != nil { return status.Errorf(codes.Internal, "failed to open upload file: %v", err) @@ -150,7 +150,7 @@ func (s *APIV1Service) finishMemoImport(ctx context.Context, user *store.User, u slog.Error("memo import planning failed", slog.Int("user", int(user.ID)), slog.Any("error", err)) return status.Error(codes.Internal, "failed to inspect the archive") } - response.Result = &v1pb.ImportMemosResponse_Plan{Plan: plan} + response.Result = &apipb.ImportMemosResponse_Plan{Plan: plan} return nil } report, err := s.ImportMemoExport(ctx, user, archive, request.ConflictPolicy) @@ -161,6 +161,6 @@ func (s *APIV1Service) finishMemoImport(ctx context.Context, user *store.User, u upload.state.report = report upload.complete = true os.Remove(upload.path) - response.Result = &v1pb.ImportMemosResponse_Report{Report: report} + response.Result = &apipb.ImportMemosResponse_Report{Report: report} return nil } diff --git a/server/api/v1/user_service_memo_views.go b/server/api/user_service_memo_views.go similarity index 87% rename from server/api/v1/user_service_memo_views.go rename to server/api/user_service_memo_views.go index 3c7b98313..b35a8c941 100644 --- a/server/api/v1/user_service_memo_views.go +++ b/server/api/user_service_memo_views.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "context" @@ -13,7 +13,7 @@ import ( "github.com/usememos/memos/filter" "github.com/usememos/memos/internal/random" "github.com/usememos/memos/internal/ratelimit" - v1pb "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" storepb "github.com/usememos/memos/proto/gen/store" "github.com/usememos/memos/server/auth" "github.com/usememos/memos/store" @@ -21,7 +21,7 @@ import ( // Helper function to extract user and memo view ID from a memo view resource name. // Format: users/{user}/views/{view}. -func (s *APIV1Service) extractUserAndMemoViewIDFromName(ctx context.Context, name string) (*store.User, string, error) { +func (s *APIService) extractUserAndMemoViewIDFromName(ctx context.Context, name string) (*store.User, string, error) { parts := strings.Split(name, "/") if len(parts) != 4 || parts[0] != "users" || parts[2] != "views" { return nil, "", errors.Errorf("invalid memo view name format: %s", name) @@ -48,8 +48,8 @@ func constructMemoViewName(username string, memoViewID string) string { return fmt.Sprintf("%s/views/%s", BuildUserName(username), memoViewID) } -func convertMemoViewFromStore(username string, memoView *storepb.MemoViewsUserSetting_MemoView) *v1pb.MemoView { - return &v1pb.MemoView{ +func convertMemoViewFromStore(username string, memoView *storepb.MemoViewsUserSetting_MemoView) *apipb.MemoView { + return &apipb.MemoView{ Name: constructMemoViewName(username, memoView.GetId()), Title: memoView.GetTitle(), Filter: memoView.GetFilter(), @@ -59,7 +59,7 @@ func convertMemoViewFromStore(username string, memoView *storepb.MemoViewsUserSe // requireCallerIs asserts that the caller is user. Personal resources such as // memo views and memo exports are never reachable by another account. -func (s *APIV1Service) requireCallerIs(ctx context.Context, user *store.User) error { +func (s *APIService) requireCallerIs(ctx context.Context, user *store.User) error { currentUser, err := s.fetchCurrentUser(ctx) if err != nil { return status.Errorf(codes.Internal, "failed to get current user: %v", err) @@ -74,7 +74,7 @@ func (s *APIV1Service) requireCallerIs(ctx context.Context, user *store.User) er } // ListMemoViews lists the saved memo views owned by a user. -func (s *APIV1Service) ListMemoViews(ctx context.Context, request *v1pb.ListMemoViewsRequest) (*v1pb.ListMemoViewsResponse, error) { +func (s *APIService) ListMemoViews(ctx context.Context, request *apipb.ListMemoViewsRequest) (*apipb.ListMemoViewsResponse, error) { user, err := ResolveUserByName(ctx, s.Store, request.Parent) if err != nil { return nil, status.Errorf(codes.InvalidArgument, "invalid user name: %v", err) @@ -91,18 +91,18 @@ func (s *APIV1Service) ListMemoViews(ctx context.Context, request *v1pb.ListMemo return nil, status.Errorf(codes.Internal, "failed to get memo views: %v", err) } - memoViews := []*v1pb.MemoView{} + memoViews := []*apipb.MemoView{} for _, memoView := range storeMemoViews { memoViews = append(memoViews, convertMemoViewFromStore(user.Username, memoView)) } - return &v1pb.ListMemoViewsResponse{ + return &apipb.ListMemoViewsResponse{ MemoViews: memoViews, }, nil } // GetMemoView returns a saved memo view by resource name. -func (s *APIV1Service) GetMemoView(ctx context.Context, request *v1pb.GetMemoViewRequest) (*v1pb.MemoView, error) { +func (s *APIService) GetMemoView(ctx context.Context, request *apipb.GetMemoViewRequest) (*apipb.MemoView, error) { user, memoViewID, err := s.extractUserAndMemoViewIDFromName(ctx, request.Name) if err != nil { return nil, status.Errorf(codes.InvalidArgument, "invalid memo view name: %v", err) @@ -125,7 +125,7 @@ func (s *APIV1Service) GetMemoView(ctx context.Context, request *v1pb.GetMemoVie } // CreateMemoView creates a saved memo view for a user. -func (s *APIV1Service) CreateMemoView(ctx context.Context, request *v1pb.CreateMemoViewRequest) (*v1pb.MemoView, error) { +func (s *APIService) CreateMemoView(ctx context.Context, request *apipb.CreateMemoViewRequest) (*apipb.MemoView, error) { user, err := ResolveUserByName(ctx, s.Store, request.Parent) if err != nil { return nil, status.Errorf(codes.InvalidArgument, "invalid user name: %v", err) @@ -167,7 +167,7 @@ func (s *APIV1Service) CreateMemoView(ctx context.Context, request *v1pb.CreateM } // UpdateMemoView updates the selected fields of a saved memo view. -func (s *APIV1Service) UpdateMemoView(ctx context.Context, request *v1pb.UpdateMemoViewRequest) (*v1pb.MemoView, error) { +func (s *APIService) UpdateMemoView(ctx context.Context, request *apipb.UpdateMemoViewRequest) (*apipb.MemoView, error) { user, memoViewID, err := s.extractUserAndMemoViewIDFromName(ctx, request.GetMemoView().GetName()) if err != nil { return nil, status.Errorf(codes.InvalidArgument, "invalid memo view name: %v", err) @@ -218,7 +218,7 @@ func (s *APIV1Service) UpdateMemoView(ctx context.Context, request *v1pb.UpdateM } // DeleteMemoView deletes a saved memo view by resource name. -func (s *APIV1Service) DeleteMemoView(ctx context.Context, request *v1pb.DeleteMemoViewRequest) (*emptypb.Empty, error) { +func (s *APIService) DeleteMemoView(ctx context.Context, request *apipb.DeleteMemoViewRequest) (*emptypb.Empty, error) { user, memoViewID, err := s.extractUserAndMemoViewIDFromName(ctx, request.Name) if err != nil { return nil, status.Errorf(codes.InvalidArgument, "invalid memo view name: %v", err) @@ -238,7 +238,7 @@ func (s *APIV1Service) DeleteMemoView(ctx context.Context, request *v1pb.DeleteM return &emptypb.Empty{}, nil } -func (s *APIV1Service) validateFilter(ctx context.Context, filterStr string) error { +func (s *APIService) validateFilter(ctx context.Context, filterStr string) error { if filterStr == "" { return errors.New("filter cannot be empty") } @@ -255,7 +255,7 @@ func (s *APIV1Service) validateFilter(ctx context.Context, filterStr string) err } // filterDialect maps the configured database driver onto the filter engine dialect. -func (s *APIV1Service) filterDialect() filter.DialectName { +func (s *APIService) filterDialect() filter.DialectName { switch s.Profile.Driver { case "mysql": return filter.DialectMySQL diff --git a/server/api/v1/user_service_notifications.go b/server/api/user_service_notifications.go similarity index 83% rename from server/api/v1/user_service_notifications.go rename to server/api/user_service_notifications.go index c35675993..429b6b1e1 100644 --- a/server/api/v1/user_service_notifications.go +++ b/server/api/user_service_notifications.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "context" @@ -13,12 +13,12 @@ import ( "google.golang.org/protobuf/types/known/timestamppb" "github.com/usememos/memos/core/access" - v1pb "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" storepb "github.com/usememos/memos/proto/gen/store" "github.com/usememos/memos/store" ) -func (s *APIV1Service) ListUserNotifications(ctx context.Context, request *v1pb.ListUserNotificationsRequest) (*v1pb.ListUserNotificationsResponse, error) { +func (s *APIService) ListUserNotifications(ctx context.Context, request *apipb.ListUserNotificationsRequest) (*apipb.ListUserNotificationsResponse, error) { user, err := s.resolveUserFromName(ctx, request.Parent) if err != nil { return nil, status.Errorf(codes.InvalidArgument, "invalid user name: %v", err) @@ -63,7 +63,7 @@ func (s *APIV1Service) ListUserNotifications(ctx context.Context, request *v1pb. return nil, status.Errorf(codes.Internal, "failed to list notification spaces: %v", err) } - notifications := []*v1pb.UserNotification{} + notifications := []*apipb.UserNotification{} for _, inbox := range inboxes { notification, err := s.convertInboxToUserNotificationWithUsersAndMemos(ctx, inbox, currentUser, usersByID, memosByID, spaceContext) if err != nil { @@ -77,23 +77,26 @@ func (s *APIV1Service) ListUserNotifications(ctx context.Context, request *v1pb. } return nil, status.Errorf(codes.Internal, "failed to convert inbox: %v", err) } - if notification == nil || notification.Type == v1pb.UserNotification_TYPE_UNSPECIFIED { + if notification == nil || notification.Type == apipb.UserNotification_TYPE_UNSPECIFIED { continue } notifications = append(notifications, notification) } - return &v1pb.ListUserNotificationsResponse{ + return &apipb.ListUserNotificationsResponse{ Notifications: notifications, }, nil } // UpdateUserNotification updates a notification's status (e.g., marking as read/archived). // Only the notification owner can update their notifications. -func (s *APIV1Service) UpdateUserNotification(ctx context.Context, request *v1pb.UpdateUserNotificationRequest) (*v1pb.UserNotification, error) { +func (s *APIService) UpdateUserNotification(ctx context.Context, request *apipb.UpdateUserNotificationRequest) (*apipb.UserNotification, error) { if request.Notification == nil { return nil, status.Errorf(codes.InvalidArgument, "notification is required") } + if request.UpdateMask == nil || len(request.UpdateMask.Paths) == 0 { + return nil, status.Errorf(codes.InvalidArgument, "update mask is required") + } user, notificationID, err := s.resolveUserAndNotificationIDFromName(ctx, request.Notification.Name) if err != nil { @@ -152,9 +155,9 @@ func (s *APIV1Service) UpdateUserNotification(ctx context.Context, request *v1pb // Convert API status enum to storage enum var inboxStatus store.InboxStatus switch request.Notification.Status { - case v1pb.UserNotification_UNREAD: + case apipb.UserNotification_UNREAD: inboxStatus = store.UNREAD - case v1pb.UserNotification_ARCHIVED: + case apipb.UserNotification_ARCHIVED: inboxStatus = store.ARCHIVED default: return nil, status.Errorf(codes.InvalidArgument, "invalid status") @@ -183,7 +186,7 @@ func (s *APIV1Service) UpdateUserNotification(ctx context.Context, request *v1pb // DeleteUserNotification permanently deletes a notification. // Only the notification owner can delete their notifications. -func (s *APIV1Service) DeleteUserNotification(ctx context.Context, request *v1pb.DeleteUserNotificationRequest) (*emptypb.Empty, error) { +func (s *APIService) DeleteUserNotification(ctx context.Context, request *apipb.DeleteUserNotificationRequest) (*emptypb.Empty, error) { user, notificationID, err := s.resolveUserAndNotificationIDFromName(ctx, request.Name) if err != nil { return nil, status.Errorf(codes.InvalidArgument, "invalid notification name: %v", err) @@ -226,7 +229,7 @@ func (s *APIV1Service) DeleteUserNotification(ctx context.Context, request *v1pb // convertInboxToUserNotification converts a storage-layer inbox to an API notification. // This handles the mapping between the internal inbox representation and the public API. -func (s *APIV1Service) convertInboxToUserNotification(ctx context.Context, inbox *store.Inbox, viewer *store.User) (*v1pb.UserNotification, error) { +func (s *APIService) convertInboxToUserNotification(ctx context.Context, inbox *store.Inbox, viewer *store.User) (*apipb.UserNotification, error) { usersByID, err := s.listUsersByID(ctx, []int32{inbox.ReceiverID, inbox.SenderID}) if err != nil { return nil, status.Errorf(codes.Internal, "failed to list notification users: %v", err) @@ -276,7 +279,7 @@ func collectInboxMemoIDs(inboxes []*store.Inbox) []int32 { return memoIDs } -func (s *APIV1Service) convertInboxToUserNotificationWithUsersAndMemos(ctx context.Context, inbox *store.Inbox, viewer *store.User, usersByID map[int32]*store.User, memosByID map[int32]*store.Memo, spaceContext *spaceInvitationNotificationContext) (*v1pb.UserNotification, error) { +func (s *APIService) convertInboxToUserNotificationWithUsersAndMemos(ctx context.Context, inbox *store.Inbox, viewer *store.User, usersByID map[int32]*store.User, memosByID map[int32]*store.Memo, spaceContext *spaceInvitationNotificationContext) (*apipb.UserNotification, error) { accessible, err := s.canAccessNotification(ctx, viewer, inbox, memosByID, spaceContext) if err != nil { return nil, err @@ -293,7 +296,7 @@ func (s *APIV1Service) convertInboxToUserNotificationWithUsersAndMemos(ctx conte return nil, status.Errorf(codes.NotFound, "notification sender not found") } - notification := &v1pb.UserNotification{ + notification := &apipb.UserNotification{ Name: fmt.Sprintf("%s/notifications/%d", BuildUserName(receiver.Username), inbox.ID), Sender: BuildUserName(sender.Username), SenderUser: convertUserFromStore(sender, viewer), @@ -303,35 +306,35 @@ func (s *APIV1Service) convertInboxToUserNotificationWithUsersAndMemos(ctx conte // Convert status from storage enum to API enum switch inbox.Status { case store.UNREAD: - notification.Status = v1pb.UserNotification_UNREAD + notification.Status = apipb.UserNotification_UNREAD case store.ARCHIVED: - notification.Status = v1pb.UserNotification_ARCHIVED + notification.Status = apipb.UserNotification_ARCHIVED default: - notification.Status = v1pb.UserNotification_STATUS_UNSPECIFIED + notification.Status = apipb.UserNotification_STATUS_UNSPECIFIED } // Extract notification type and payload from the inbox message. if inbox.Message != nil { switch inbox.Message.Type { case storepb.InboxMessage_MEMO_COMMENT: - notification.Type = v1pb.UserNotification_MEMO_COMMENT + notification.Type = apipb.UserNotification_MEMO_COMMENT payload, err := s.convertMemoCommentNotificationPayload(inbox.Message, memosByID) if err != nil { return nil, err } if payload != nil { - notification.Payload = &v1pb.UserNotification_MemoComment{ + notification.Payload = &apipb.UserNotification_MemoComment{ MemoComment: payload, } } case storepb.InboxMessage_MEMO_MENTION: - notification.Type = v1pb.UserNotification_MEMO_MENTION + notification.Type = apipb.UserNotification_MEMO_MENTION payload, err := s.convertMemoMentionNotificationPayload(inbox.Message, memosByID) if err != nil { return nil, err } if payload != nil { - notification.Payload = &v1pb.UserNotification_MemoMention{ + notification.Payload = &apipb.UserNotification_MemoMention{ MemoMention: payload, } } @@ -343,12 +346,12 @@ func (s *APIV1Service) convertInboxToUserNotificationWithUsersAndMemos(ctx conte // in between. Fail closed. return nil, nil } - notification.Type = v1pb.UserNotification_SPACE_INVITATION - notification.Payload = &v1pb.UserNotification_SpaceInvitation{ + notification.Type = apipb.UserNotification_SPACE_INVITATION + notification.Payload = &apipb.UserNotification_SpaceInvitation{ SpaceInvitation: payload, } default: - notification.Type = v1pb.UserNotification_TYPE_UNSPECIFIED + notification.Type = apipb.UserNotification_TYPE_UNSPECIFIED } } @@ -359,7 +362,7 @@ func (s *APIV1Service) convertInboxToUserNotificationWithUsersAndMemos(ctx conte // subject the notification refers to. Memo notifications require read access // to each memo; a space invitation requires the viewer to hold the pending // offer or to have accepted it. -func (s *APIV1Service) canAccessNotification(ctx context.Context, viewer *store.User, inbox *store.Inbox, memosByID map[int32]*store.Memo, spaceContext *spaceInvitationNotificationContext) (bool, error) { +func (s *APIService) canAccessNotification(ctx context.Context, viewer *store.User, inbox *store.Inbox, memosByID map[int32]*store.Memo, spaceContext *spaceInvitationNotificationContext) (bool, error) { if viewer == nil || viewer.RowStatus != store.Normal { return false, nil } @@ -407,13 +410,13 @@ func (s *APIV1Service) canAccessNotification(ctx context.Context, viewer *store. return check(payload.RelatedMemoId) case storepb.InboxMessage_SPACE_INVITATION: space, _, state := spaceContext.resolve(inbox.Message.GetSpaceInvitation().GetSpaceId()) - return space != nil && state != v1pb.UserNotification_SpaceInvitationPayload_STATE_UNSPECIFIED, nil + return space != nil && state != apipb.UserNotification_SpaceInvitationPayload_STATE_UNSPECIFIED, nil default: return true, nil } } -func (s *APIV1Service) memoNotificationSnippet(memo *store.Memo) (string, error) { +func (s *APIService) memoNotificationSnippet(memo *store.Memo) (string, error) { if memo == nil || memo.Content == "" { return "", nil } @@ -425,7 +428,7 @@ func (s *APIV1Service) memoNotificationSnippet(memo *store.Memo) (string, error) return snippet, nil } -func (s *APIV1Service) convertMemoCommentNotificationPayload(message *storepb.InboxMessage, memosByID map[int32]*store.Memo) (*v1pb.UserNotification_MemoCommentPayload, error) { +func (s *APIService) convertMemoCommentNotificationPayload(message *storepb.InboxMessage, memosByID map[int32]*store.Memo) (*apipb.UserNotification_MemoCommentPayload, error) { memoComment := message.GetMemoComment() if message == nil || message.Type != storepb.InboxMessage_MEMO_COMMENT || memoComment == nil { return nil, nil @@ -443,7 +446,7 @@ func (s *APIV1Service) convertMemoCommentNotificationPayload(message *storepb.In return nil, errors.Wrap(err, "failed to get related memo snippet") } - return &v1pb.UserNotification_MemoCommentPayload{ + return &apipb.UserNotification_MemoCommentPayload{ Memo: fmt.Sprintf("%s%s", MemoNamePrefix, commentMemo.UID), RelatedMemo: fmt.Sprintf("%s%s", MemoNamePrefix, relatedMemo.UID), MemoSnippet: memoSnippet, @@ -451,7 +454,7 @@ func (s *APIV1Service) convertMemoCommentNotificationPayload(message *storepb.In }, nil } -func (s *APIV1Service) convertMemoMentionNotificationPayload(message *storepb.InboxMessage, memosByID map[int32]*store.Memo) (*v1pb.UserNotification_MemoMentionPayload, error) { +func (s *APIService) convertMemoMentionNotificationPayload(message *storepb.InboxMessage, memosByID map[int32]*store.Memo) (*apipb.UserNotification_MemoMentionPayload, error) { memoMention := message.GetMemoMention() if message == nil || message.Type != storepb.InboxMessage_MEMO_MENTION || memoMention == nil { return nil, nil @@ -464,7 +467,7 @@ func (s *APIV1Service) convertMemoMentionNotificationPayload(message *storepb.In return nil, errors.Wrap(err, "failed to get mention memo snippet") } - payload := &v1pb.UserNotification_MemoMentionPayload{ + payload := &apipb.UserNotification_MemoMentionPayload{ Memo: fmt.Sprintf("%s%s", MemoNamePrefix, memo.UID), MemoSnippet: memoSnippet, } diff --git a/server/api/v1/user_service_settings.go b/server/api/user_service_settings.go similarity index 83% rename from server/api/v1/user_service_settings.go rename to server/api/user_service_settings.go index fe300e325..7f823095a 100644 --- a/server/api/v1/user_service_settings.go +++ b/server/api/user_service_settings.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "context" @@ -7,12 +7,12 @@ import ( "google.golang.org/grpc/codes" "google.golang.org/grpc/status" - v1pb "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" storepb "github.com/usememos/memos/proto/gen/store" "github.com/usememos/memos/store" ) -func (s *APIV1Service) GetUserSetting(ctx context.Context, request *v1pb.GetUserSettingRequest) (*v1pb.UserSetting, error) { +func (s *APIService) GetUserSetting(ctx context.Context, request *apipb.GetUserSettingRequest) (*apipb.UserSetting, error) { // Parse resource name: users/{user}/settings/{setting} user, settingKey, err := s.resolveUserAndSettingKeyFromName(ctx, request.Name) if err != nil { @@ -50,9 +50,9 @@ func (s *APIV1Service) GetUserSetting(ctx context.Context, request *v1pb.GetUser return convertUserSettingFromStore(userSetting, user, storeKey), nil } -func (s *APIV1Service) UpdateUserSetting(ctx context.Context, request *v1pb.UpdateUserSettingRequest) (*v1pb.UserSetting, error) { +func (s *APIService) UpdateUserSetting(ctx context.Context, request *apipb.UpdateUserSettingRequest) (*apipb.UserSetting, error) { // Parse resource name: users/{user}/settings/{setting} - user, settingKey, err := s.resolveUserAndSettingKeyFromName(ctx, request.Setting.Name) + user, settingKey, err := s.resolveUserAndSettingKeyFromName(ctx, request.UserSetting.Name) if err != nil { return nil, status.Errorf(codes.InvalidArgument, "invalid resource name: %v", err) } @@ -81,7 +81,7 @@ func (s *APIV1Service) UpdateUserSetting(ctx context.Context, request *v1pb.Upda return nil, status.Errorf(codes.InvalidArgument, "invalid setting key: %v", err) } - var updatedSetting *v1pb.UserSetting + var updatedSetting *apipb.UserSetting switch storeKey { case storepb.UserSetting_GENERAL: existingUserSetting, err := s.Store.GetUserSetting(ctx, &store.FindUserSetting{ @@ -96,7 +96,7 @@ func (s *APIV1Service) UpdateUserSetting(ctx context.Context, request *v1pb.Upda // back to defaults when the setting (or its general value) is missing. updatedGeneral := convertUserSettingFromStore(existingUserSetting, user, storeKey).GetGeneralSetting() - incomingGeneral := request.Setting.GetGeneralSetting() + incomingGeneral := request.UserSetting.GetGeneralSetting() if incomingGeneral == nil { return nil, status.Errorf(codes.InvalidArgument, "general setting is required") } @@ -120,9 +120,9 @@ func (s *APIV1Service) UpdateUserSetting(ctx context.Context, request *v1pb.Upda } } - updatedSetting = &v1pb.UserSetting{ - Name: request.Setting.Name, - Value: &v1pb.UserSetting_GeneralSetting_{ + updatedSetting = &apipb.UserSetting{ + Name: request.UserSetting.Name, + Value: &apipb.UserSetting_GeneralSetting_{ GeneralSetting: updatedGeneral, }, } @@ -140,16 +140,16 @@ func (s *APIV1Service) UpdateUserSetting(ctx context.Context, request *v1pb.Upda return nil, status.Errorf(codes.InvalidArgument, "update mask must include tags") } - incomingTags := request.Setting.GetTagsSetting() + incomingTags := request.UserSetting.GetTagsSetting() if incomingTags == nil { return nil, status.Errorf(codes.InvalidArgument, "tags setting is required") } if err := validateUserTagsSetting(incomingTags); err != nil { return nil, status.Errorf(codes.InvalidArgument, "invalid user tags setting: %v", err) } - updatedSetting = &v1pb.UserSetting{ - Name: request.Setting.Name, - Value: &v1pb.UserSetting_TagsSetting_{ + updatedSetting = &apipb.UserSetting{ + Name: request.UserSetting.Name, + Value: &apipb.UserSetting_TagsSetting_{ TagsSetting: incomingTags, }, } @@ -168,10 +168,10 @@ func (s *APIV1Service) UpdateUserSetting(ctx context.Context, request *v1pb.Upda return nil, status.Errorf(codes.Internal, "failed to upsert user setting: %v", err) } - return s.GetUserSetting(ctx, &v1pb.GetUserSettingRequest{Name: request.Setting.Name}) + return s.GetUserSetting(ctx, &apipb.GetUserSettingRequest{Name: request.UserSetting.Name}) } -func (s *APIV1Service) ListUserSettings(ctx context.Context, request *v1pb.ListUserSettingsRequest) (*v1pb.ListUserSettingsResponse, error) { +func (s *APIService) ListUserSettings(ctx context.Context, request *apipb.ListUserSettingsRequest) (*apipb.ListUserSettingsResponse, error) { user, err := s.resolveUserFromName(ctx, request.Parent) if err != nil { return nil, status.Errorf(codes.InvalidArgument, "invalid parent name: %v", err) @@ -198,7 +198,7 @@ func (s *APIV1Service) ListUserSettings(ctx context.Context, request *v1pb.ListU return nil, status.Errorf(codes.Internal, "failed to list user settings: %v", err) } - settings := make([]*v1pb.UserSetting, 0, len(userSettings)) + settings := make([]*apipb.UserSetting, 0, len(userSettings)) for _, storeSetting := range userSettings { apiSetting := convertUserSettingFromStore(storeSetting, user, storeSetting.Key) if apiSetting != nil { @@ -213,22 +213,22 @@ func (s *APIV1Service) ListUserSettings(ctx context.Context, request *v1pb.ListU } } if !hasGeneral { - defaultGeneral := &v1pb.UserSetting{ + defaultGeneral := &apipb.UserSetting{ Name: fmt.Sprintf("%s/settings/%s", BuildUserName(user.Username), convertSettingKeyFromStore(storepb.UserSetting_GENERAL)), - Value: &v1pb.UserSetting_GeneralSetting_{ + Value: &apipb.UserSetting_GeneralSetting_{ GeneralSetting: getDefaultUserGeneralSetting(), }, } - settings = append([]*v1pb.UserSetting{defaultGeneral}, settings...) + settings = append([]*apipb.UserSetting{defaultGeneral}, settings...) } - response := &v1pb.ListUserSettingsResponse{ - Settings: settings, + response := &apipb.ListUserSettingsResponse{ + UserSettings: settings, } return response, nil } -func (s *APIV1Service) authorizeUserResourceAccess(ctx context.Context, userID int32, allowAdmin bool) (*store.User, error) { +func (s *APIService) authorizeUserResourceAccess(ctx context.Context, userID int32, allowAdmin bool) (*store.User, error) { currentUser, err := s.fetchCurrentUser(ctx) if err != nil { return nil, status.Errorf(codes.Internal, "failed to get current user: %v", err) diff --git a/server/api/v1/user_service_stats.go b/server/api/user_service_stats.go similarity index 81% rename from server/api/v1/user_service_stats.go rename to server/api/user_service_stats.go index 35bfc7061..f707941d7 100644 --- a/server/api/v1/user_service_stats.go +++ b/server/api/user_service_stats.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "context" @@ -9,11 +9,11 @@ import ( "google.golang.org/grpc/status" "google.golang.org/protobuf/types/known/timestamppb" - v1pb "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" "github.com/usememos/memos/store" ) -func (s *APIV1Service) listUsersByID(ctx context.Context, userIDs []int32) (map[int32]*store.User, error) { +func (s *APIService) listUsersByID(ctx context.Context, userIDs []int32) (map[int32]*store.User, error) { if len(userIDs) == 0 { return map[int32]*store.User{}, nil } @@ -40,7 +40,7 @@ func (s *APIV1Service) listUsersByID(ctx context.Context, userIDs []int32) (map[ return usersByID, nil } -func (s *APIV1Service) listUsernamesByID(ctx context.Context, userIDs []int32) (map[int32]string, error) { +func (s *APIService) listUsernamesByID(ctx context.Context, userIDs []int32) (map[int32]string, error) { usersByID, err := s.listUsersByID(ctx, userIDs) if err != nil { return nil, err @@ -53,9 +53,23 @@ func (s *APIV1Service) listUsernamesByID(ctx context.Context, userIDs []int32) ( return usernamesByID, nil } -func (s *APIV1Service) ListAllUserStats(ctx context.Context, request *v1pb.ListAllUserStatsRequest) (*v1pb.ListAllUserStatsResponse, error) { +func (s *APIService) ListUserStats(ctx context.Context, request *apipb.ListUserStatsRequest) (*apipb.ListUserStatsResponse, error) { + // users/- lists every user; users/{user} narrows the list to one creator. + var creatorID *int32 + if request.Parent != BuildUserName("-") { + user, err := ResolveUserByName(ctx, s.Store, request.Parent) + if err != nil { + return nil, status.Errorf(codes.InvalidArgument, "invalid parent: %v", err) + } + if user == nil { + return nil, status.Errorf(codes.NotFound, "user not found") + } + creatorID = &user.ID + } + rowStatus := convertStateToStore(request.State) memoFind := &store.FindMemo{ + CreatorID: creatorID, // Exclude comments by default. ExcludeComments: true, ExcludeContent: true, @@ -74,16 +88,16 @@ func (s *APIV1Service) ListAllUserStats(ctx context.Context, request *v1pb.ListA memoFind.Filters = append(memoFind.Filters, request.Filter) } - if request.State == v1pb.State_ARCHIVED { + if request.State == apipb.State_ARCHIVED { // Archived memos are only visible to their creator. - if currentUser == nil { - return &v1pb.ListAllUserStatsResponse{}, nil + if currentUser == nil || (creatorID != nil && *creatorID != currentUser.ID) { + return &apipb.ListUserStatsResponse{}, nil } memoFind.CreatorID = ¤tUser.ID } memoFind.Access = accessScope - userMemoStatMap := make(map[int32]*v1pb.UserStats) + userMemoStatMap := make(map[int32]*apipb.UserStats) pinnedMemoUIDsByUserID := make(map[int32][]string) limit := 1000 offset := 0 @@ -102,13 +116,13 @@ func (s *APIV1Service) ListAllUserStats(ctx context.Context, request *v1pb.ListA for _, memo := range memos { // Initialize user stats if not exists if _, exists := userMemoStatMap[memo.CreatorID]; !exists { - userMemoStatMap[memo.CreatorID] = &v1pb.UserStats{ + userMemoStatMap[memo.CreatorID] = &apipb.UserStats{ Name: "", - TagCount: make(map[string]int32), + TagCounts: make(map[string]int32), MemoCreatedTimestamps: []*timestamppb.Timestamp{}, MemoUpdatedTimestamps: []*timestamppb.Timestamp{}, PinnedMemos: []string{}, - MemoTypeStats: &v1pb.UserStats_MemoTypeStats{ + MemoTypeStats: &apipb.UserStats_MemoTypeStats{ LinkCount: 0, CodeCount: 0, TodoCount: 0, @@ -127,7 +141,7 @@ func (s *APIV1Service) ListAllUserStats(ctx context.Context, request *v1pb.ListA // Count tags and other properties if memo.Payload != nil { - incrementTagCounts(stats.TagCount, memo.Payload.Tags) + incrementTagCounts(stats.TagCounts, memo.Payload.Tags) if memo.Payload.Property != nil { if memo.Payload.Property.HasLink { stats.MemoTypeStats.LinkCount++ @@ -153,7 +167,7 @@ func (s *APIV1Service) ListAllUserStats(ctx context.Context, request *v1pb.ListA offset += limit } - userMemoStats := []*v1pb.UserStats{} + userMemoStats := []*apipb.UserStats{} userIDs := make([]int32, 0, len(userMemoStatMap)) for userID := range userMemoStatMap { userIDs = append(userIDs, userID) @@ -174,13 +188,13 @@ func (s *APIV1Service) ListAllUserStats(ctx context.Context, request *v1pb.ListA userMemoStats = append(userMemoStats, userMemoStat) } - response := &v1pb.ListAllUserStatsResponse{ - Stats: userMemoStats, + response := &apipb.ListUserStatsResponse{ + UserStats: userMemoStats, } return response, nil } -func (s *APIV1Service) GetUserStats(ctx context.Context, request *v1pb.GetUserStatsRequest) (*v1pb.UserStats, error) { +func (s *APIService) GetUserStats(ctx context.Context, request *apipb.GetUserStatsRequest) (*apipb.UserStats, error) { user, err := ResolveUserByName(ctx, s.Store, request.Name) if err != nil { return nil, status.Errorf(codes.InvalidArgument, "invalid user name: %v", err) @@ -268,14 +282,14 @@ func (s *APIV1Service) GetUserStats(ctx context.Context, request *v1pb.GetUserSt offset += limit } - userStats := &v1pb.UserStats{ + userStats := &apipb.UserStats{ Name: fmt.Sprintf("%s/stats", BuildUserName(user.Username)), MemoCreatedTimestamps: createdTimestamps, MemoUpdatedTimestamps: updatedTimestamps, - TagCount: tagCount, + TagCounts: tagCount, PinnedMemos: pinnedMemos, TotalMemoCount: totalMemoCount, - MemoTypeStats: &v1pb.UserStats_MemoTypeStats{ + MemoTypeStats: &apipb.UserStats_MemoTypeStats{ LinkCount: linkCount, CodeCount: codeCount, TodoCount: todoCount, diff --git a/server/api/v1/user_service_webhooks.go b/server/api/user_service_webhooks.go similarity index 89% rename from server/api/v1/user_service_webhooks.go rename to server/api/user_service_webhooks.go index c6510739a..89e1f1184 100644 --- a/server/api/v1/user_service_webhooks.go +++ b/server/api/user_service_webhooks.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "context" @@ -13,12 +13,12 @@ import ( "github.com/usememos/memos/internal/ratelimit" "github.com/usememos/memos/internal/webhook" - v1pb "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" storepb "github.com/usememos/memos/proto/gen/store" "github.com/usememos/memos/store" ) -func (s *APIV1Service) ListUserWebhooks(ctx context.Context, request *v1pb.ListUserWebhooksRequest) (*v1pb.ListUserWebhooksResponse, error) { +func (s *APIService) ListUserWebhooks(ctx context.Context, request *apipb.ListUserWebhooksRequest) (*apipb.ListUserWebhooksResponse, error) { user, err := s.resolveUserFromName(ctx, request.Parent) if err != nil { return nil, status.Errorf(codes.InvalidArgument, "invalid parent: %v", err) @@ -41,17 +41,17 @@ func (s *APIV1Service) ListUserWebhooks(ctx context.Context, request *v1pb.ListU return nil, status.Errorf(codes.Internal, "failed to get user webhooks: %v", err) } - userWebhooks := make([]*v1pb.UserWebhook, 0, len(webhooks)) + userWebhooks := make([]*apipb.UserWebhook, 0, len(webhooks)) for _, webhook := range webhooks { userWebhooks = append(userWebhooks, convertUserWebhookFromUserSetting(webhook, user)) } - return &v1pb.ListUserWebhooksResponse{ + return &apipb.ListUserWebhooksResponse{ Webhooks: userWebhooks, }, nil } -func (s *APIV1Service) CreateUserWebhook(ctx context.Context, request *v1pb.CreateUserWebhookRequest) (*v1pb.UserWebhook, error) { +func (s *APIService) CreateUserWebhook(ctx context.Context, request *apipb.CreateUserWebhookRequest) (*apipb.UserWebhook, error) { user, err := s.resolveUserFromName(ctx, request.Parent) if err != nil { return nil, status.Errorf(codes.InvalidArgument, "invalid parent: %v", err) @@ -107,7 +107,7 @@ func (s *APIV1Service) CreateUserWebhook(ctx context.Context, request *v1pb.Crea return convertUserWebhookFromUserSetting(webhook, user), nil } -func (s *APIV1Service) UpdateUserWebhook(ctx context.Context, request *v1pb.UpdateUserWebhookRequest) (*v1pb.UserWebhook, error) { +func (s *APIService) UpdateUserWebhook(ctx context.Context, request *apipb.UpdateUserWebhookRequest) (*apipb.UserWebhook, error) { if request.Webhook == nil { return nil, status.Errorf(codes.InvalidArgument, "webhook is required") } @@ -206,7 +206,7 @@ func (s *APIV1Service) UpdateUserWebhook(ctx context.Context, request *v1pb.Upda return convertUserWebhookFromUserSetting(updatedWebhook, user), nil } -func (s *APIV1Service) DeleteUserWebhook(ctx context.Context, request *v1pb.DeleteUserWebhookRequest) (*emptypb.Empty, error) { +func (s *APIService) DeleteUserWebhook(ctx context.Context, request *apipb.DeleteUserWebhookRequest) (*emptypb.Empty, error) { user, webhookID, err := s.resolveUserAndWebhookIDFromName(ctx, request.Name) if err != nil { return nil, status.Errorf(codes.InvalidArgument, "invalid webhook name: %v", err) @@ -254,7 +254,7 @@ func (s *APIV1Service) DeleteUserWebhook(ctx context.Context, request *v1pb.Dele // GetUserWebhookSigningSecret reveals the signing secret for a single webhook. // This is the only endpoint that returns the secret value; it is gated to the // webhook owner and the secret is never included in list/create/update responses. -func (s *APIV1Service) GetUserWebhookSigningSecret(ctx context.Context, request *v1pb.GetUserWebhookSigningSecretRequest) (*v1pb.GetUserWebhookSigningSecretResponse, error) { +func (s *APIService) GetUserWebhookSigningSecret(ctx context.Context, request *apipb.GetUserWebhookSigningSecretRequest) (*apipb.GetUserWebhookSigningSecretResponse, error) { user, webhookID, err := s.resolveUserAndWebhookIDFromName(ctx, request.Name) if err != nil { return nil, status.Errorf(codes.InvalidArgument, "invalid webhook name: %v", err) @@ -272,7 +272,7 @@ func (s *APIV1Service) GetUserWebhookSigningSecret(ctx context.Context, request for _, webhook := range webhooks { if webhook.Id == webhookID { - return &v1pb.GetUserWebhookSigningSecretResponse{SigningSecret: webhook.SigningSecret}, nil + return &apipb.GetUserWebhookSigningSecretResponse{SigningSecret: webhook.SigningSecret}, nil } } @@ -288,9 +288,9 @@ func generateUserWebhookID() string { return hex.EncodeToString(b) } -// convertUserWebhookFromUserSetting converts a storepb webhook to a v1pb UserWebhook. -func convertUserWebhookFromUserSetting(webhook *storepb.WebhooksUserSetting_Webhook, user *store.User) *v1pb.UserWebhook { - return &v1pb.UserWebhook{ +// convertUserWebhookFromUserSetting converts a storepb webhook to a apipb UserWebhook. +func convertUserWebhookFromUserSetting(webhook *storepb.WebhooksUserSetting_Webhook, user *store.User) *apipb.UserWebhook { + return &apipb.UserWebhook{ Name: fmt.Sprintf("%s/webhooks/%s", BuildUserName(user.Username), webhook.Id), Url: webhook.Url, DisplayName: webhook.Title, diff --git a/server/api/v1/user_webhook_test.go b/server/api/user_webhook_test.go similarity index 76% rename from server/api/v1/user_webhook_test.go rename to server/api/user_webhook_test.go index 7586b5797..1a5748d36 100644 --- a/server/api/v1/user_webhook_test.go +++ b/server/api/user_webhook_test.go @@ -1,4 +1,4 @@ -package v1 +package api import ( "context" @@ -9,7 +9,7 @@ import ( "google.golang.org/grpc/codes" "google.golang.org/grpc/status" - v1pb "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" storepb "github.com/usememos/memos/proto/gen/store" "github.com/usememos/memos/store" ) @@ -54,37 +54,37 @@ func TestUserWebhookSigningSecretLifecycle(t *testing.T) { hostCtx := userCtx(ctx, host.ID) // Create without supplying a secret -> the server generates one. - created, err := svc.CreateUserWebhook(ownerCtx, &v1pb.CreateUserWebhookRequest{ + created, err := svc.CreateUserWebhook(ownerCtx, &apipb.CreateUserWebhookRequest{ Parent: "users/owner", - Webhook: &v1pb.UserWebhook{DisplayName: "deploy", Url: "https://example.com/postreceive"}, + Webhook: &apipb.UserWebhook{DisplayName: "deploy", Url: "https://example.com/postreceive"}, }) require.NoError(t, err) require.True(t, created.SigningSecretSet, "create must auto-generate a signing secret") require.Empty(t, created.SigningSecret, "create response must never carry the secret value") // The owner can reveal the generated value. - revealed, err := svc.GetUserWebhookSigningSecret(ownerCtx, &v1pb.GetUserWebhookSigningSecretRequest{Name: created.Name}) + revealed, err := svc.GetUserWebhookSigningSecret(ownerCtx, &apipb.GetUserWebhookSigningSecretRequest{Name: created.Name}) require.NoError(t, err) require.True(t, strings.HasPrefix(revealed.SigningSecret, "whsec_"), "revealed secret must be in whsec_ form") // A non-owner, non-admin user cannot reveal it. - _, err = svc.GetUserWebhookSigningSecret(otherCtx, &v1pb.GetUserWebhookSigningSecretRequest{Name: created.Name}) + _, err = svc.GetUserWebhookSigningSecret(otherCtx, &apipb.GetUserWebhookSigningSecretRequest{Name: created.Name}) require.Error(t, err) require.Equal(t, codes.PermissionDenied, status.Code(err), "non-owner must be denied") // Application administration is a control-plane role, not an implicit way // to install an exfiltration endpoint or reveal another user's webhook secret. - _, err = svc.ListUserWebhooks(hostCtx, &v1pb.ListUserWebhooksRequest{Parent: "users/owner"}) + _, err = svc.ListUserWebhooks(hostCtx, &apipb.ListUserWebhooksRequest{Parent: "users/owner"}) require.Equal(t, codes.PermissionDenied, status.Code(err)) - _, err = svc.CreateUserWebhook(hostCtx, &v1pb.CreateUserWebhookRequest{ + _, err = svc.CreateUserWebhook(hostCtx, &apipb.CreateUserWebhookRequest{ Parent: "users/owner", - Webhook: &v1pb.UserWebhook{DisplayName: "admin-installed", Url: "https://example.com/exfiltrate"}, + Webhook: &apipb.UserWebhook{DisplayName: "admin-installed", Url: "https://example.com/exfiltrate"}, }) require.Equal(t, codes.PermissionDenied, status.Code(err)) - _, err = svc.UpdateUserWebhook(hostCtx, &v1pb.UpdateUserWebhookRequest{Webhook: &v1pb.UserWebhook{Name: created.Name}}) + _, err = svc.UpdateUserWebhook(hostCtx, &apipb.UpdateUserWebhookRequest{Webhook: &apipb.UserWebhook{Name: created.Name}}) require.Equal(t, codes.PermissionDenied, status.Code(err)) - _, err = svc.DeleteUserWebhook(hostCtx, &v1pb.DeleteUserWebhookRequest{Name: created.Name}) + _, err = svc.DeleteUserWebhook(hostCtx, &apipb.DeleteUserWebhookRequest{Name: created.Name}) require.Equal(t, codes.PermissionDenied, status.Code(err)) - _, err = svc.GetUserWebhookSigningSecret(hostCtx, &v1pb.GetUserWebhookSigningSecretRequest{Name: created.Name}) + _, err = svc.GetUserWebhookSigningSecret(hostCtx, &apipb.GetUserWebhookSigningSecretRequest{Name: created.Name}) require.Equal(t, codes.PermissionDenied, status.Code(err)) } diff --git a/server/api/v1/acl_config_test.go b/server/api/v1/acl_config_test.go deleted file mode 100644 index 9cd676512..000000000 --- a/server/api/v1/acl_config_test.go +++ /dev/null @@ -1,165 +0,0 @@ -package v1 - -import ( - "testing" - - "github.com/stretchr/testify/assert" -) - -// TestPublicMethodsArePublic verifies that methods in PublicMethods are recognized as public. -func TestPublicMethodsArePublic(t *testing.T) { - publicMethods := []string{ - // Auth Service - "/memos.api.v1.AuthService/SignIn", - "/memos.api.v1.AuthService/RefreshToken", - // Instance Service - "/memos.api.v1.InstanceService/GetInstanceProfile", - "/memos.api.v1.InstanceService/GetInstanceSetting", - "/memos.api.v1.InstanceService/BatchGetInstanceSettings", - // User Service - "/memos.api.v1.UserService/CreateUser", - "/memos.api.v1.UserService/GetUser", - "/memos.api.v1.UserService/BatchGetUsers", - "/memos.api.v1.UserService/GetUserAvatar", - "/memos.api.v1.UserService/GetUserStats", - "/memos.api.v1.UserService/ListAllUserStats", - // Identity Provider Service - "/memos.api.v1.IdentityProviderService/ListIdentityProviders", - // Memo Service - "/memos.api.v1.MemoService/GetMemo", - "/memos.api.v1.MemoService/ListMemos", - "/memos.api.v1.MemoService/ListMemoComments", - "/memos.api.v1.MemoService/ListMemoAttachments", - "/memos.api.v1.MemoService/ListMemoReactions", - "/memos.api.v1.MemoService/ListMemoRelations", - "/memos.api.v1.MemoService/GetLinkMetadata", - "/memos.api.v1.MemoService/BatchGetLinkMetadata", - // Attachment Service metadata follows linked memo visibility. - "/memos.api.v1.AttachmentService/GetAttachment", - } - - for _, method := range publicMethods { - t.Run(method, func(t *testing.T) { - assert.True(t, IsPublicMethod(method), "Expected %s to be public", method) - }) - } -} - -// TestProtectedMethodsRequireAuth verifies that non-public methods are recognized as protected. -func TestProtectedMethodsRequireAuth(t *testing.T) { - protectedMethods := []string{ - "/memos.api.v1.AttachmentService/UploadAttachment", - // Auth Service - logout and get current user require auth - "/memos.api.v1.AuthService/SignOut", - "/memos.api.v1.AuthService/GetCurrentUser", - // Instance Service - admin operations - "/memos.api.v1.InstanceService/UpdateInstanceSetting", - "/memos.api.v1.InstanceService/TestInstanceEmailSetting", - // User Service - modification operations - "/memos.api.v1.UserService/ListUsers", - "/memos.api.v1.UserService/UpdateUser", - "/memos.api.v1.UserService/DeleteUser", - // Memo Service - write operations - "/memos.api.v1.MemoService/CreateMemo", - "/memos.api.v1.MemoService/UpdateMemo", - "/memos.api.v1.MemoService/DeleteMemo", - // Space Service - every operation requires an authenticated member. - "/memos.api.v1.SpaceService/CreateSpace", - "/memos.api.v1.SpaceService/ListSpaces", - "/memos.api.v1.SpaceService/GetSpace", - "/memos.api.v1.SpaceService/UpdateSpace", - "/memos.api.v1.SpaceService/DeleteSpace", - "/memos.api.v1.SpaceService/CreateSpaceInvitation", - "/memos.api.v1.SpaceService/ListSpaceInvitations", - "/memos.api.v1.SpaceService/ListUserSpaceInvitations", - "/memos.api.v1.SpaceService/GetSpaceInvitation", - "/memos.api.v1.SpaceService/DeleteSpaceInvitation", - "/memos.api.v1.SpaceService/AcceptSpaceInvitation", - "/memos.api.v1.SpaceService/DeclineSpaceInvitation", - "/memos.api.v1.SpaceService/ListSpaceMembers", - "/memos.api.v1.SpaceService/GetSpaceMember", - "/memos.api.v1.SpaceService/UpdateSpaceMember", - "/memos.api.v1.SpaceService/DeleteSpaceMember", - // Attachment Service - write operations - "/memos.api.v1.AttachmentService/CreateAttachment", - "/memos.api.v1.AttachmentService/DeleteAttachment", - // User Service - saved memo views - "/memos.api.v1.UserService/CreateMemoView", - "/memos.api.v1.UserService/GetMemoView", - "/memos.api.v1.UserService/ListMemoViews", - "/memos.api.v1.UserService/UpdateMemoView", - "/memos.api.v1.UserService/DeleteMemoView", - } - - for _, method := range protectedMethods { - t.Run(method, func(t *testing.T) { - assert.False(t, IsPublicMethod(method), "Expected %s to require auth", method) - }) - } -} - -// TestUnknownMethodsRequireAuth verifies that unknown methods default to requiring auth. -func TestUnknownMethodsRequireAuth(t *testing.T) { - unknownMethods := []string{ - "/unknown.Service/Method", - "/memos.api.v1.UnknownService/Method", - "", - "invalid", - } - - for _, method := range unknownMethods { - t.Run(method, func(t *testing.T) { - assert.False(t, IsPublicMethod(method), "Unknown method %q should require auth", method) - }) - } -} - -// TestAuthBootstrapMethodsAreSubsetOfPublic verifies every auth-bootstrap method is -// also a public method. A bootstrap method that wasn't public would be rejected before -// the private-instance check runs, breaking sign-in on a private instance. -func TestAuthBootstrapMethodsAreSubsetOfPublic(t *testing.T) { - for method := range AuthBootstrapMethods { - t.Run(method, func(t *testing.T) { - assert.True(t, IsPublicMethod(method), "auth-bootstrap method %s must also be a public method", method) - }) - } -} - -// TestAuthBootstrapClassification verifies which endpoints remain reachable by -// anonymous callers when the instance access mode is PRIVATE. -func TestAuthBootstrapClassification(t *testing.T) { - // Reachable while private: sign-in flow, registration, instance metadata, SSO, share links. - bootstrap := []string{ - "/memos.api.v1.AuthService/SignIn", - "/memos.api.v1.AuthService/RefreshToken", - "/memos.api.v1.UserService/CreateUser", - "/memos.api.v1.InstanceService/GetInstanceProfile", - "/memos.api.v1.InstanceService/GetInstanceSetting", - "/memos.api.v1.InstanceService/BatchGetInstanceSettings", - "/memos.api.v1.IdentityProviderService/ListIdentityProviders", - "/memos.api.v1.MemoService/GetSharedMemo", - } - for _, method := range bootstrap { - t.Run("bootstrap/"+method, func(t *testing.T) { - assert.True(t, IsAuthBootstrapMethod(method), "expected %s to be reachable on a private instance", method) - }) - } - - // Public in PUBLIC mode, but gated in PRIVATE mode: browsing and profiles. - gatedWhilePrivate := []string{ - "/memos.api.v1.MemoService/ListMemos", - "/memos.api.v1.MemoService/GetMemo", - "/memos.api.v1.MemoService/ListMemoComments", - "/memos.api.v1.MemoService/ListMemoAttachments", - "/memos.api.v1.MemoService/ListMemoReactions", - "/memos.api.v1.MemoService/ListMemoRelations", - "/memos.api.v1.AttachmentService/GetAttachment", - "/memos.api.v1.UserService/GetUser", - "/memos.api.v1.UserService/ListAllUserStats", - } - for _, method := range gatedWhilePrivate { - t.Run("gated/"+method, func(t *testing.T) { - assert.False(t, IsAuthBootstrapMethod(method), "expected %s to be gated on a private instance", method) - }) - } -} diff --git a/server/api/v1/memo_service_filter.go b/server/api/v1/memo_service_filter.go deleted file mode 100644 index b7b1f993d..000000000 --- a/server/api/v1/memo_service_filter.go +++ /dev/null @@ -1 +0,0 @@ -package v1 diff --git a/server/auth/token.go b/server/auth/token.go index 4a4cb8345..8b4c47682 100644 --- a/server/auth/token.go +++ b/server/auth/token.go @@ -1,7 +1,7 @@ // Package auth provides authentication and authorization for the Memos server. // // This package is used by: -// - server/api/v1: gRPC and Connect API interceptors +// - server/api: gRPC and Connect API interceptors // - server/fileserver: HTTP file server authentication // // Authentication methods supported: diff --git a/server/cors_test.go b/server/cors_test.go index 7a6c2023c..a13a4851d 100644 --- a/server/cors_test.go +++ b/server/cors_test.go @@ -82,12 +82,12 @@ func TestAllowedCORSOrigin(t *testing.T) { func TestCORSMiddleware(t *testing.T) { e := echo.New() e.Use(newCORSMiddleware(&profile.Profile{InstanceURL: "https://memos.example"})) - e.POST("/api/v1/test", func(c *echo.Context) error { + e.POST("/api/test", func(c *echo.Context) error { return c.NoContent(http.StatusOK) }) t.Run("trusted origin gets credentialed access", func(t *testing.T) { - req := httptest.NewRequest(http.MethodOptions, "/api/v1/test", nil) + req := httptest.NewRequest(http.MethodOptions, "/api/test", nil) req.Header.Set("Origin", "https://memos.example") req.Header.Set("Access-Control-Request-Method", http.MethodPost) rec := httptest.NewRecorder() @@ -106,7 +106,7 @@ func TestCORSMiddleware(t *testing.T) { }) t.Run("arbitrary origin is reflected without credentials", func(t *testing.T) { - req := httptest.NewRequest(http.MethodOptions, "/api/v1/test", nil) + req := httptest.NewRequest(http.MethodOptions, "/api/test", nil) req.Header.Set("Origin", "https://evil.example") req.Header.Set("Access-Control-Request-Method", http.MethodPost) rec := httptest.NewRecorder() @@ -127,7 +127,7 @@ func TestCORSMiddleware(t *testing.T) { }) t.Run("arbitrary origin may send Authorization header", func(t *testing.T) { - req := httptest.NewRequest(http.MethodOptions, "/api/v1/test", nil) + req := httptest.NewRequest(http.MethodOptions, "/api/test", nil) req.Header.Set("Origin", "https://app.third-party.example") req.Header.Set("Access-Control-Request-Method", http.MethodPost) req.Header.Set("Access-Control-Request-Headers", "Authorization") @@ -141,7 +141,7 @@ func TestCORSMiddleware(t *testing.T) { }) t.Run("null origin is not reflected", func(t *testing.T) { - req := httptest.NewRequest(http.MethodOptions, "/api/v1/test", nil) + req := httptest.NewRequest(http.MethodOptions, "/api/test", nil) req.Header.Set("Origin", "null") req.Header.Set("Access-Control-Request-Method", http.MethodPost) rec := httptest.NewRecorder() diff --git a/server/doc.go b/server/doc.go index c673d616c..ad5316308 100644 --- a/server/doc.go +++ b/server/doc.go @@ -1,5 +1,5 @@ // Package server is the HTTP process: it boots the Echo server, mounts every -// transport (server/api/v1, server/fileserver, server/frontend, server/mcp), +// transport (server/api, server/fileserver, server/frontend, server/mcp), // and owns HTTP-only concerns such as auth tokens and process configuration. // // Layering: server may import core, store, provider, markdown, filter, and diff --git a/server/fileserver/fileserver_test.go b/server/fileserver/fileserver_test.go index f960c5eb8..50981abc3 100644 --- a/server/fileserver/fileserver_test.go +++ b/server/fileserver/fileserver_test.go @@ -28,9 +28,9 @@ import ( "github.com/usememos/memos/internal/testutil" "github.com/usememos/memos/internal/testutil/fakes3" "github.com/usememos/memos/markdown" - apiv1 "github.com/usememos/memos/proto/gen/api/v1" + apipb "github.com/usememos/memos/proto/gen/api" storepb "github.com/usememos/memos/proto/gen/store" - apiv1service "github.com/usememos/memos/server/api/v1" + "github.com/usememos/memos/server/api" "github.com/usememos/memos/server/auth" "github.com/usememos/memos/store" "github.com/usememos/memos/store/db" @@ -68,16 +68,16 @@ func TestServeAttachmentFile_S3(t *testing.T) { require.NoError(t, err) creatorCtx := context.WithValue(ctx, auth.UserIDContextKey, creator.ID) content := []byte("content streamed from S3") - attachment, err := svc.CreateAttachment(creatorCtx, &apiv1.CreateAttachmentRequest{Attachment: &apiv1.Attachment{ + attachment, err := svc.CreateAttachment(creatorCtx, &apipb.CreateAttachmentRequest{Attachment: &apipb.Attachment{ Filename: "document.txt", Type: "text/plain", Content: content, }}) require.NoError(t, err) - _, err = svc.CreateMemo(creatorCtx, &apiv1.CreateMemoRequest{Memo: &apiv1.Memo{ + _, err = svc.CreateMemo(creatorCtx, &apipb.CreateMemoRequest{Memo: &apipb.Memo{ Content: "public S3 attachment", - Visibility: apiv1.Visibility_PUBLIC, - Attachments: []*apiv1.Attachment{{Name: attachment.Name}}, + Visibility: apipb.Visibility_PUBLIC, + Attachments: []*apipb.Attachment{{Name: attachment.Name}}, }}) require.NoError(t, err) @@ -116,8 +116,8 @@ func TestServeAttachmentFile_ShareTokenAllowsDirectMemoAttachment(t *testing.T) creatorCtx := context.WithValue(ctx, auth.UserIDContextKey, creator.ID) - attachment, err := svc.CreateAttachment(creatorCtx, &apiv1.CreateAttachmentRequest{ - Attachment: &apiv1.Attachment{ + attachment, err := svc.CreateAttachment(creatorCtx, &apipb.CreateAttachmentRequest{ + Attachment: &apipb.Attachment{ Filename: "memo.txt", Type: "text/plain", Content: []byte("memo attachment"), @@ -125,20 +125,20 @@ func TestServeAttachmentFile_ShareTokenAllowsDirectMemoAttachment(t *testing.T) }) require.NoError(t, err) - parentMemo, err := svc.CreateMemo(creatorCtx, &apiv1.CreateMemoRequest{ - Memo: &apiv1.Memo{ + parentMemo, err := svc.CreateMemo(creatorCtx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{ Content: "shared parent", - Visibility: apiv1.Visibility_PROTECTED, - Attachments: []*apiv1.Attachment{ + Visibility: apipb.Visibility_PROTECTED, + Attachments: []*apipb.Attachment{ {Name: attachment.Name}, }, }, }) require.NoError(t, err) - share, err := svc.CreateMemoShare(creatorCtx, &apiv1.CreateMemoShareRequest{ + share, err := svc.CreateMemoShare(creatorCtx, &apipb.CreateMemoShareRequest{ Parent: parentMemo.Name, - MemoShare: &apiv1.MemoShare{}, + MemoShare: &apipb.MemoShare{}, }) require.NoError(t, err) shareToken := share.Name[strings.LastIndex(share.Name, "/")+1:] @@ -167,16 +167,16 @@ func TestServeAttachmentFile_CanonicalRouteAndVisibilityAwareCache(t *testing.T) }) require.NoError(t, err) creatorCtx := context.WithValue(ctx, auth.UserIDContextKey, creator.ID) - attachment, err := svc.CreateAttachment(creatorCtx, &apiv1.CreateAttachmentRequest{Attachment: &apiv1.Attachment{ + attachment, err := svc.CreateAttachment(creatorCtx, &apipb.CreateAttachmentRequest{Attachment: &apipb.Attachment{ Filename: "canonical.png", Type: "image/png", Content: []byte("canonical image"), }}) require.NoError(t, err) - memo, err := svc.CreateMemo(creatorCtx, &apiv1.CreateMemoRequest{Memo: &apiv1.Memo{ + memo, err := svc.CreateMemo(creatorCtx, &apipb.CreateMemoRequest{Memo: &apipb.Memo{ Content: "canonical route", - Visibility: apiv1.Visibility_PUBLIC, - Attachments: []*apiv1.Attachment{{Name: attachment.Name}}, + Visibility: apipb.Visibility_PUBLIC, + Attachments: []*apipb.Attachment{{Name: attachment.Name}}, }}) require.NoError(t, err) @@ -189,8 +189,8 @@ func TestServeAttachmentFile_CanonicalRouteAndVisibilityAwareCache(t *testing.T) require.Equal(t, "canonical image", rec.Body.String()) require.Equal(t, publicAttachmentCacheControl, rec.Header().Get(echo.HeaderCacheControl)) - _, err = svc.UpdateMemo(creatorCtx, &apiv1.UpdateMemoRequest{ - Memo: &apiv1.Memo{Name: memo.Name, Visibility: apiv1.Visibility_PROTECTED}, + _, err = svc.UpdateMemo(creatorCtx, &apipb.UpdateMemoRequest{ + Memo: &apipb.Memo{Name: memo.Name, Visibility: apipb.Visibility_PROTECTED}, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"visibility"}}, }) require.NoError(t, err) @@ -210,12 +210,12 @@ func TestServeAttachmentFileMemoCreatorLifecycle(t *testing.T) { }) require.NoError(t, err) creatorCtx := context.WithValue(ctx, auth.UserIDContextKey, creator.ID) - attachment, err := svc.CreateAttachment(creatorCtx, &apiv1.CreateAttachmentRequest{Attachment: &apiv1.Attachment{ + attachment, err := svc.CreateAttachment(creatorCtx, &apipb.CreateAttachmentRequest{Attachment: &apipb.Attachment{ Filename: "creator-lifecycle.txt", Type: "text/plain", Content: []byte("creator lifecycle"), }}) require.NoError(t, err) - memo, err := svc.CreateMemo(creatorCtx, &apiv1.CreateMemoRequest{Memo: &apiv1.Memo{ - Content: "public file", Visibility: apiv1.Visibility_PUBLIC, Attachments: []*apiv1.Attachment{{Name: attachment.Name}}, + memo, err := svc.CreateMemo(creatorCtx, &apipb.CreateMemoRequest{Memo: &apipb.Memo{ + Content: "public file", Visibility: apipb.Visibility_PUBLIC, Attachments: []*apipb.Attachment{{Name: attachment.Name}}, }}) require.NoError(t, err) @@ -252,20 +252,20 @@ func TestServeAttachmentFile_CommentUsesOwnVisibility(t *testing.T) { require.NoError(t, err) ownerCtx := context.WithValue(ctx, auth.UserIDContextKey, owner.ID) commenterCtx := context.WithValue(ctx, auth.UserIDContextKey, commenter.ID) - parent, err := svc.CreateMemo(ownerCtx, &apiv1.CreateMemoRequest{Memo: &apiv1.Memo{Content: "parent", Visibility: apiv1.Visibility_PUBLIC}}) + parent, err := svc.CreateMemo(ownerCtx, &apipb.CreateMemoRequest{Memo: &apipb.Memo{Content: "parent", Visibility: apipb.Visibility_PUBLIC}}) require.NoError(t, err) - attachment, err := svc.CreateAttachment(commenterCtx, &apiv1.CreateAttachmentRequest{Attachment: &apiv1.Attachment{ + attachment, err := svc.CreateAttachment(commenterCtx, &apipb.CreateAttachmentRequest{Attachment: &apipb.Attachment{ Filename: "comment.png", Type: "image/png", Content: []byte("comment image"), }}) require.NoError(t, err) - comment, err := svc.CreateMemoComment(commenterCtx, &apiv1.CreateMemoCommentRequest{ - Name: parent.Name, - Comment: &apiv1.Memo{ + comment, err := svc.CreateMemoComment(commenterCtx, &apipb.CreateMemoCommentRequest{ + Parent: parent.Name, + Comment: &apipb.Memo{ Content: "comment", - Visibility: apiv1.Visibility_PUBLIC, - Attachments: []*apiv1.Attachment{{Name: attachment.Name}}, + Visibility: apipb.Visibility_PUBLIC, + Attachments: []*apipb.Attachment{{Name: attachment.Name}}, }, }) require.NoError(t, err) @@ -277,8 +277,8 @@ func TestServeAttachmentFile_CommentUsesOwnVisibility(t *testing.T) { e.ServeHTTP(rec, httptest.NewRequest(http.MethodGet, url, nil)) require.Equal(t, http.StatusOK, rec.Code) - _, err = svc.UpdateMemo(ownerCtx, &apiv1.UpdateMemoRequest{ - Memo: &apiv1.Memo{Name: parent.Name, Visibility: apiv1.Visibility_PRIVATE}, + _, err = svc.UpdateMemo(ownerCtx, &apipb.UpdateMemoRequest{ + Memo: &apipb.Memo{Name: parent.Name, Visibility: apipb.Visibility_PRIVATE}, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"visibility"}}, }) require.NoError(t, err) @@ -287,8 +287,8 @@ func TestServeAttachmentFile_CommentUsesOwnVisibility(t *testing.T) { require.Equal(t, http.StatusOK, rec.Code, "changing the context memo must not change attachment access") require.Equal(t, publicAttachmentCacheControl, rec.Header().Get(echo.HeaderCacheControl)) - _, err = svc.UpdateMemo(commenterCtx, &apiv1.UpdateMemoRequest{ - Memo: &apiv1.Memo{Name: comment.Name, Visibility: apiv1.Visibility_PROTECTED}, + _, err = svc.UpdateMemo(commenterCtx, &apipb.UpdateMemoRequest{ + Memo: &apipb.Memo{Name: comment.Name, Visibility: apipb.Visibility_PROTECTED}, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"visibility"}}, }) require.NoError(t, err) @@ -311,8 +311,8 @@ func TestServeAttachmentFile_LocalStaticFileSupportsRangeRequests(t *testing.T) require.NoError(t, err) creatorCtx := context.WithValue(ctx, auth.UserIDContextKey, creator.ID) - attachment, err := svc.CreateAttachment(creatorCtx, &apiv1.CreateAttachmentRequest{ - Attachment: &apiv1.Attachment{ + attachment, err := svc.CreateAttachment(creatorCtx, &apipb.CreateAttachmentRequest{ + Attachment: &apipb.Attachment{ Filename: "range.txt", Type: "text/plain", Content: []byte("0123456789"), @@ -320,11 +320,11 @@ func TestServeAttachmentFile_LocalStaticFileSupportsRangeRequests(t *testing.T) }) require.NoError(t, err) - _, err = svc.CreateMemo(creatorCtx, &apiv1.CreateMemoRequest{ - Memo: &apiv1.Memo{ + _, err = svc.CreateMemo(creatorCtx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{ Content: "range memo", - Visibility: apiv1.Visibility_PUBLIC, - Attachments: []*apiv1.Attachment{ + Visibility: apipb.Visibility_PUBLIC, + Attachments: []*apipb.Attachment{ {Name: attachment.Name}, }, }, @@ -365,16 +365,16 @@ func TestServeAttachmentFile_ShareTokenRejectsCommentAttachment(t *testing.T) { require.NoError(t, err) commenterCtx := context.WithValue(ctx, auth.UserIDContextKey, commenter.ID) - parentMemo, err := svc.CreateMemo(creatorCtx, &apiv1.CreateMemoRequest{ - Memo: &apiv1.Memo{ + parentMemo, err := svc.CreateMemo(creatorCtx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{ Content: "shared parent", - Visibility: apiv1.Visibility_PROTECTED, + Visibility: apipb.Visibility_PROTECTED, }, }) require.NoError(t, err) - commentAttachment, err := svc.CreateAttachment(commenterCtx, &apiv1.CreateAttachmentRequest{ - Attachment: &apiv1.Attachment{ + commentAttachment, err := svc.CreateAttachment(commenterCtx, &apipb.CreateAttachmentRequest{ + Attachment: &apipb.Attachment{ Filename: "comment.txt", Type: "text/plain", Content: []byte("comment attachment"), @@ -382,21 +382,21 @@ func TestServeAttachmentFile_ShareTokenRejectsCommentAttachment(t *testing.T) { }) require.NoError(t, err) - _, err = svc.CreateMemoComment(commenterCtx, &apiv1.CreateMemoCommentRequest{ - Name: parentMemo.Name, - Comment: &apiv1.Memo{ + _, err = svc.CreateMemoComment(commenterCtx, &apipb.CreateMemoCommentRequest{ + Parent: parentMemo.Name, + Comment: &apipb.Memo{ Content: "comment with attachment", - Visibility: apiv1.Visibility_PROTECTED, - Attachments: []*apiv1.Attachment{ + Visibility: apipb.Visibility_PROTECTED, + Attachments: []*apipb.Attachment{ {Name: commentAttachment.Name}, }, }, }) require.NoError(t, err) - share, err := svc.CreateMemoShare(creatorCtx, &apiv1.CreateMemoShareRequest{ + share, err := svc.CreateMemoShare(creatorCtx, &apipb.CreateMemoShareRequest{ Parent: parentMemo.Name, - MemoShare: &apiv1.MemoShare{}, + MemoShare: &apipb.MemoShare{}, }) require.NoError(t, err) shareToken := share.Name[strings.LastIndex(share.Name, "/")+1:] @@ -424,8 +424,8 @@ func TestServeAttachmentFile_MotionClip(t *testing.T) { require.NoError(t, err) creatorCtx := context.WithValue(ctx, auth.UserIDContextKey, creator.ID) - attachment, err := svc.CreateAttachment(creatorCtx, &apiv1.CreateAttachmentRequest{ - Attachment: &apiv1.Attachment{ + attachment, err := svc.CreateAttachment(creatorCtx, &apipb.CreateAttachmentRequest{ + Attachment: &apipb.Attachment{ Filename: "motion.jpg", Type: "image/jpeg", Content: testutil.BuildMotionPhotoJPEG(), @@ -433,11 +433,11 @@ func TestServeAttachmentFile_MotionClip(t *testing.T) { }) require.NoError(t, err) - _, err = svc.CreateMemo(creatorCtx, &apiv1.CreateMemoRequest{ - Memo: &apiv1.Memo{ + _, err = svc.CreateMemo(creatorCtx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{ Content: "motion memo", - Visibility: apiv1.Visibility_PUBLIC, - Attachments: []*apiv1.Attachment{ + Visibility: apipb.Visibility_PUBLIC, + Attachments: []*apipb.Attachment{ {Name: attachment.Name}, }, }, @@ -470,8 +470,8 @@ func TestServeAttachmentFile_SVGThumbnailServedAsImageWithSecurityHeaders(t *tes creatorCtx := context.WithValue(ctx, auth.UserIDContextKey, creator.ID) svgContent := []byte(`memos`) - attachment, err := svc.CreateAttachment(creatorCtx, &apiv1.CreateAttachmentRequest{ - Attachment: &apiv1.Attachment{ + attachment, err := svc.CreateAttachment(creatorCtx, &apipb.CreateAttachmentRequest{ + Attachment: &apipb.Attachment{ Filename: "preview.svg", Type: "image/svg+xml", Content: svgContent, @@ -479,11 +479,11 @@ func TestServeAttachmentFile_SVGThumbnailServedAsImageWithSecurityHeaders(t *tes }) require.NoError(t, err) - _, err = svc.CreateMemo(creatorCtx, &apiv1.CreateMemoRequest{ - Memo: &apiv1.Memo{ + _, err = svc.CreateMemo(creatorCtx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{ Content: "svg memo", - Visibility: apiv1.Visibility_PUBLIC, - Attachments: []*apiv1.Attachment{ + Visibility: apipb.Visibility_PUBLIC, + Attachments: []*apipb.Attachment{ {Name: attachment.Name}, }, }, @@ -519,8 +519,8 @@ func TestServeAttachmentFile_ThumbnailWithSensitiveMetadataServesOriginal(t *tes creatorCtx := context.WithValue(ctx, auth.UserIDContextKey, creator.ID) imageContent := testPNGWithChunk(t, "cICP", []byte{9, 16, 9, 1}) - attachment, err := svc.CreateAttachment(creatorCtx, &apiv1.CreateAttachmentRequest{ - Attachment: &apiv1.Attachment{ + attachment, err := svc.CreateAttachment(creatorCtx, &apipb.CreateAttachmentRequest{ + Attachment: &apipb.Attachment{ Filename: "hdr.png", Type: "image/png", Content: imageContent, @@ -528,11 +528,11 @@ func TestServeAttachmentFile_ThumbnailWithSensitiveMetadataServesOriginal(t *tes }) require.NoError(t, err) - _, err = svc.CreateMemo(creatorCtx, &apiv1.CreateMemoRequest{ - Memo: &apiv1.Memo{ + _, err = svc.CreateMemo(creatorCtx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{ Content: "hdr memo", - Visibility: apiv1.Visibility_PUBLIC, - Attachments: []*apiv1.Attachment{ + Visibility: apipb.Visibility_PUBLIC, + Attachments: []*apipb.Attachment{ {Name: attachment.Name}, }, }, @@ -614,7 +614,7 @@ func testPNGWithChunk(t *testing.T, chunkType string, chunkData []byte) []byte { return result } -func newShareAttachmentTestServices(ctx context.Context, t *testing.T) (*apiv1service.APIV1Service, *FileServerService, *store.Store, func()) { +func newShareAttachmentTestServices(ctx context.Context, t *testing.T) (*api.APIService, *FileServerService, *store.Store, func()) { t.Helper() testStore := teststore.NewTestingStore(ctx, t) @@ -629,12 +629,12 @@ func newShareAttachmentTestServices(ctx context.Context, t *testing.T) (*apiv1se } secret := "test-secret" markdownService := markdown.NewService(markdown.WithTagExtension()) - apiService := &apiv1service.APIV1Service{ + apiService := &api.APIService{ Secret: secret, Profile: testProfile, Store: testStore, MarkdownService: markdownService, - SSEHub: apiv1service.NewSSEHub(), + SSEHub: api.NewSSEHub(), } fileService := NewFileServerService(testProfile, testStore, secret) @@ -681,8 +681,8 @@ func TestServeAttachmentFile_PrivateInstanceDeniesAnonymous(t *testing.T) { require.NoError(t, err) creatorCtx := context.WithValue(ctx, auth.UserIDContextKey, creator.ID) - attachment, err := svc.CreateAttachment(creatorCtx, &apiv1.CreateAttachmentRequest{ - Attachment: &apiv1.Attachment{ + attachment, err := svc.CreateAttachment(creatorCtx, &apipb.CreateAttachmentRequest{ + Attachment: &apipb.Attachment{ Filename: "public.txt", Type: "text/plain", Content: []byte("public content"), @@ -690,11 +690,11 @@ func TestServeAttachmentFile_PrivateInstanceDeniesAnonymous(t *testing.T) { }) require.NoError(t, err) - _, err = svc.CreateMemo(creatorCtx, &apiv1.CreateMemoRequest{ - Memo: &apiv1.Memo{ + _, err = svc.CreateMemo(creatorCtx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{ Content: "public memo", - Visibility: apiv1.Visibility_PUBLIC, - Attachments: []*apiv1.Attachment{{Name: attachment.Name}}, + Visibility: apipb.Visibility_PUBLIC, + Attachments: []*apipb.Attachment{{Name: attachment.Name}}, }, }) require.NoError(t, err) @@ -806,8 +806,8 @@ func TestServeAttachmentFile_RefreshCookieAuthenticatesOwner(t *testing.T) { require.NoError(t, err) ownerCtx := context.WithValue(ctx, auth.UserIDContextKey, owner.ID) - attachment, err := svc.CreateAttachment(ownerCtx, &apiv1.CreateAttachmentRequest{ - Attachment: &apiv1.Attachment{ + attachment, err := svc.CreateAttachment(ownerCtx, &apipb.CreateAttachmentRequest{ + Attachment: &apipb.Attachment{ Filename: "secret.txt", Type: "text/plain", Content: []byte("secret content"), @@ -815,11 +815,11 @@ func TestServeAttachmentFile_RefreshCookieAuthenticatesOwner(t *testing.T) { }) require.NoError(t, err) - _, err = svc.CreateMemo(ownerCtx, &apiv1.CreateMemoRequest{ - Memo: &apiv1.Memo{ + _, err = svc.CreateMemo(ownerCtx, &apipb.CreateMemoRequest{ + Memo: &apipb.Memo{ Content: "private memo", - Visibility: apiv1.Visibility_PRIVATE, - Attachments: []*apiv1.Attachment{{Name: attachment.Name}}, + Visibility: apipb.Visibility_PRIVATE, + Attachments: []*apipb.Attachment{{Name: attachment.Name}}, }, }) require.NoError(t, err) @@ -887,17 +887,17 @@ func oversizedPNGHeader(width, height uint32) []byte { return buf.Bytes() } -func createPublicImageMemo(ctx context.Context, t *testing.T, svc *apiv1service.APIV1Service, username, filename, mimeType string, content []byte) *apiv1.Attachment { +func createPublicImageMemo(ctx context.Context, t *testing.T, svc *api.APIService, username, filename, mimeType string, content []byte) *apipb.Attachment { t.Helper() creator, err := svc.Store.CreateUser(ctx, &store.User{Username: username, Role: store.RoleUser, Email: username + "@example.com"}) require.NoError(t, err) creatorCtx := context.WithValue(ctx, auth.UserIDContextKey, creator.ID) - attachment, err := svc.CreateAttachment(creatorCtx, &apiv1.CreateAttachmentRequest{Attachment: &apiv1.Attachment{ + attachment, err := svc.CreateAttachment(creatorCtx, &apipb.CreateAttachmentRequest{Attachment: &apipb.Attachment{ Filename: filename, Type: mimeType, Content: content, }}) require.NoError(t, err) - _, err = svc.CreateMemo(creatorCtx, &apiv1.CreateMemoRequest{Memo: &apiv1.Memo{ - Content: "image memo", Visibility: apiv1.Visibility_PUBLIC, Attachments: []*apiv1.Attachment{{Name: attachment.Name}}, + _, err = svc.CreateMemo(creatorCtx, &apipb.CreateMemoRequest{Memo: &apipb.Memo{ + Content: "image memo", Visibility: apipb.Visibility_PUBLIC, Attachments: []*apipb.Attachment{{Name: attachment.Name}}, }}) require.NoError(t, err) return attachment @@ -931,7 +931,7 @@ func TestServeAttachmentFile_ThumbnailRefusesOversizedImage(t *testing.T) { // newSharedProfileTestServices builds the API service, file server, and // store on one profile, as in production, so derived caches written by the // file server live in the directory the store cleans up. -func newSharedProfileTestServices(ctx context.Context, t *testing.T) (*apiv1service.APIV1Service, *FileServerService, func()) { +func newSharedProfileTestServices(ctx context.Context, t *testing.T) (*api.APIService, *FileServerService, func()) { t.Helper() dataDir := t.TempDir() testProfile := &profile.Profile{ @@ -948,12 +948,12 @@ func newSharedProfileTestServices(ctx context.Context, t *testing.T) (*apiv1serv require.NoError(t, testStore.Migrate(ctx)) setInstanceAccessMode(ctx, t, testStore, storepb.InstanceAccessMode_INSTANCE_ACCESS_MODE_PUBLIC) secret := "test-secret" - apiService := &apiv1service.APIV1Service{ + apiService := &api.APIService{ Secret: secret, Profile: testProfile, Store: testStore, MarkdownService: markdown.NewService(markdown.WithTagExtension()), - SSEHub: apiv1service.NewSSEHub(), + SSEHub: api.NewSSEHub(), } return apiService, NewFileServerService(testProfile, testStore, secret), func() { testStore.Close() } } @@ -981,7 +981,7 @@ func TestDeleteAttachmentRemovesCachedThumbnail(t *testing.T) { require.FileExists(t, thumbnailPath) ownerCtx := context.WithValue(ctx, auth.UserIDContextKey, owner.ID) - _, err = svc.DeleteAttachment(ownerCtx, &apiv1.DeleteAttachmentRequest{Name: attachment.Name}) + _, err = svc.DeleteAttachment(ownerCtx, &apipb.DeleteAttachmentRequest{Name: attachment.Name}) require.NoError(t, err) require.NoFileExists(t, thumbnailPath) } diff --git a/server/frontend/frontend.go b/server/frontend/frontend.go index 45a145925..19cca0ae0 100644 --- a/server/frontend/frontend.go +++ b/server/frontend/frontend.go @@ -85,8 +85,8 @@ func shouldSkipFrontendStatic(requestPath string) bool { } return hasPathPrefix(requestPath, "/api") || hasPathPrefix(requestPath, "/file") || - requestPath == "/memos.api.v1" || - strings.HasPrefix(requestPath, "/memos.api.v1.") + requestPath == "/memos.api" || + strings.HasPrefix(requestPath, "/memos.api.") } func setFrontendCacheHeaders(c *echo.Context, requestPath string) { diff --git a/server/mcp/README.md b/server/mcp/README.md index 26878a324..f52196672 100644 --- a/server/mcp/README.md +++ b/server/mcp/README.md @@ -9,7 +9,7 @@ The core design principle: **tool calls execute in-process against the existing REST API.** The package owns no store or service logic of its own. Each tool is derived from an operation in the generated OpenAPI document (`proto/gen/openapi.yaml`, embedded via `proto.OpenAPIYAML()`), and a tool call -is translated into the matching `/api/v1/...` HTTP request and run against the +is translated into the matching `/api/...` HTTP request and run against the same Echo server that serves the public API. This keeps OpenAPI as the single source of truth and reuses the API's authentication and authorization as-is. @@ -246,7 +246,7 @@ own encoding is part of the tool contract: whatever it emits is validated agains the output schema resolved from the same OpenAPI spec. grpc-gateway's stock marshaler emits `null` for unset message fields, which no schema declares as nullable — `RegisterGateway` therefore installs a marshaler that omits them -(`newGatewayMarshaler` in `server/api/v1/v1.go`). That fixes +(`newGatewayMarshaler` in `server/api/api.go`). That fixes [#6139](https://github.com/usememos/memos/issues/6139), where `"motionMedia": null` failed every tool call returning an attachment. @@ -272,7 +272,7 @@ validate an error payload against the tool's success-only output schema: | --- | --- | | `service.go` | Constructs the MCP server, registers tools, builds the streamable HTTP handler, and binds the `/mcp` route. | | `catalog.go` | The curated operation allowlist, tool naming, input/output schema assembly, and method-derived annotations. | -| `adapter.go` | Translates a tool call into an `/api/v1/...` request and runs it in-process against the Echo server. | +| `adapter.go` | Translates a tool call into an `/api/...` request and runs it in-process against the Echo server. | | `openapi.go` | Parses the OpenAPI spec, builds the operation registry, and resolves `$ref` schemas into self-contained JSON Schema. | | `validation.go` | Validates tool-call arguments against the tool's input schema. | | `origin.go` | `Origin`-header check for browser DNS-rebinding safety. | diff --git a/server/mcp/adapter.go b/server/mcp/adapter.go index c19a00b99..e07ad3c47 100644 --- a/server/mcp/adapter.go +++ b/server/mcp/adapter.go @@ -184,7 +184,7 @@ func trimResourceNamePrefix(path, parameterName, value string, resolved map[stri // any id that is not a single bare segment, so every iteration removes one "{" // and the loop always terminates. func resolvedResourceNamePrefix(prefix string, resolved map[string]string) (string, bool) { - const apiPrefix = "/api/v1/" + const apiPrefix = "/api/" prefix, ok := strings.CutPrefix(prefix, apiPrefix) if !ok { return "", false diff --git a/server/mcp/adapter_test.go b/server/mcp/adapter_test.go index 66ca8c7c0..fbf943858 100644 --- a/server/mcp/adapter_test.go +++ b/server/mcp/adapter_test.go @@ -90,7 +90,7 @@ func errorsIsJSONSyntax(err error) bool { func TestBuildAPIRequestMapsPathQueryAndBody(t *testing.T) { operation := &openAPIOperation{ Method: "PATCH", - Path: "/api/v1/memos/{memo}", + Path: "/api/memos/{memo}", Parameters: []openAPIParameter{ {Name: "memo", In: "path", Required: true, Schema: jsonSchema{"type": "string"}}, {Name: "updateMask", In: "query", Schema: jsonSchema{"type": "string"}}, @@ -111,7 +111,7 @@ func TestBuildAPIRequestMapsPathQueryAndBody(t *testing.T) { req, err := buildAPIRequest(context.Background(), operation, arguments, "Bearer pat") require.NoError(t, err) require.Equal(t, "PATCH", req.Method) - require.Equal(t, "/api/v1/memos/abc123", req.URL.Path) + require.Equal(t, "/api/memos/abc123", req.URL.Path) require.Equal(t, "content", req.URL.Query().Get("updateMask")) require.Equal(t, "Bearer pat", req.Header.Get("Authorization")) @@ -121,7 +121,7 @@ func TestBuildAPIRequestMapsPathQueryAndBody(t *testing.T) { } func TestBuildAPIRequestPresentsResolvedClientAddressAsPeer(t *testing.T) { - operation := &openAPIOperation{Method: "GET", Path: "/api/v1/memos"} + operation := &openAPIOperation{Method: "GET", Path: "/api/memos"} req, err := buildAPIRequest(context.Background(), operation, map[string]any{}, "") require.NoError(t, err) @@ -142,7 +142,7 @@ func TestBuildAPIRequestOmitsOptionalOverriddenBody(t *testing.T) { operation := &openAPIOperation{ OperationID: "SpaceService_AcceptSpaceInvitation", Method: "POST", - Path: "/api/v1/spaces/{space}/invitations/{invitation}:accept", + Path: "/api/spaces/{space}/invitations/{invitation}:accept", Parameters: []openAPIParameter{ {Name: "space", In: "path", Required: true}, {Name: "invitation", In: "path", Required: true}, @@ -152,7 +152,7 @@ func TestBuildAPIRequestOmitsOptionalOverriddenBody(t *testing.T) { req, err := buildAPIRequest(context.Background(), operation, map[string]any{"space": "team", "invitation": "sam"}, "") require.NoError(t, err) - require.Equal(t, "/api/v1/spaces/team/invitations/sam:accept", req.URL.Path) + require.Equal(t, "/api/spaces/team/invitations/sam:accept", req.URL.Path) body, err := io.ReadAll(req.Body) require.NoError(t, err) require.JSONEq(t, `{}`, string(body)) @@ -165,12 +165,12 @@ func TestBuildAPIRequestAcceptsResourceNamesForPathParameters(t *testing.T) { value string wantPath string }{ - {name: "canonical memo name", path: "/api/v1/memos/{memo}", value: "memos/abc123", wantPath: "/api/v1/memos/abc123"}, - {name: "bare memo id", path: "/api/v1/memos/{memo}", value: "abc123", wantPath: "/api/v1/memos/abc123"}, - {name: "canonical name on nested route", path: "/api/v1/memos/{memo}/comments", value: "memos/abc123", wantPath: "/api/v1/memos/abc123/comments"}, - {name: "canonical attachment name", path: "/api/v1/attachments/{attachment}", value: "attachments/att42", wantPath: "/api/v1/attachments/att42"}, - {name: "foreign prefix left untouched", path: "/api/v1/memos/{memo}", value: "attachments/att42", wantPath: "/api/v1/memos/attachments%2Fatt42"}, - {name: "multi-segment value left untouched", path: "/api/v1/memos/{memo}", value: "memos/abc/extra", wantPath: "/api/v1/memos/memos%2Fabc%2Fextra"}, + {name: "canonical memo name", path: "/api/memos/{memo}", value: "memos/abc123", wantPath: "/api/memos/abc123"}, + {name: "bare memo id", path: "/api/memos/{memo}", value: "abc123", wantPath: "/api/memos/abc123"}, + {name: "canonical name on nested route", path: "/api/memos/{memo}/comments", value: "memos/abc123", wantPath: "/api/memos/abc123/comments"}, + {name: "canonical attachment name", path: "/api/attachments/{attachment}", value: "attachments/att42", wantPath: "/api/attachments/att42"}, + {name: "foreign prefix left untouched", path: "/api/memos/{memo}", value: "attachments/att42", wantPath: "/api/memos/attachments%2Fatt42"}, + {name: "multi-segment value left untouched", path: "/api/memos/{memo}", value: "memos/abc/extra", wantPath: "/api/memos/memos%2Fabc%2Fextra"}, } for _, test := range tests { t.Run(test.name, func(t *testing.T) { @@ -197,63 +197,63 @@ func TestBuildAPIRequestAcceptsHierarchicalResourceNamesForPathParameters(t *tes }{ { name: "canonical reaction name", - path: "/api/v1/memos/{memo}/reactions/{reaction}", + path: "/api/memos/{memo}/reactions/{reaction}", parameters: []string{"memo", "reaction"}, arguments: map[string]any{ "memo": "memos/abc123", "reaction": "memos/abc123/reactions/reaction456", }, - wantPath: "/api/v1/memos/abc123/reactions/reaction456", + wantPath: "/api/memos/abc123/reactions/reaction456", }, { name: "canonical nested name with bare parent id", - path: "/api/v1/memos/{memo}/reactions/{reaction}", + path: "/api/memos/{memo}/reactions/{reaction}", parameters: []string{"memo", "reaction"}, arguments: map[string]any{ "memo": "abc123", "reaction": "memos/abc123/reactions/reaction456", }, - wantPath: "/api/v1/memos/abc123/reactions/reaction456", + wantPath: "/api/memos/abc123/reactions/reaction456", }, { name: "parameter declaration order does not matter", - path: "/api/v1/users/{user}/views/{view}", + path: "/api/users/{user}/views/{view}", parameters: []string{"view", "user"}, arguments: map[string]any{ "user": "users/user123", "view": "users/user123/views/view456", }, - wantPath: "/api/v1/users/user123/views/view456", + wantPath: "/api/users/user123/views/view456", }, { name: "canonical nested name on action route", - path: "/api/v1/users/{user}/webhooks/{webhook}:getSigningSecret", + path: "/api/users/{user}/webhooks/{webhook}:getSigningSecret", parameters: []string{"user", "webhook"}, arguments: map[string]any{ "user": "users/user123", "webhook": "users/user123/webhooks/webhook456", }, - wantPath: "/api/v1/users/user123/webhooks/webhook456:getSigningSecret", + wantPath: "/api/users/user123/webhooks/webhook456:getSigningSecret", }, { name: "mismatched parent is left untouched", - path: "/api/v1/memos/{memo}/reactions/{reaction}", + path: "/api/memos/{memo}/reactions/{reaction}", parameters: []string{"memo", "reaction"}, arguments: map[string]any{ "memo": "memos/abc123", "reaction": "memos/other/reactions/reaction456", }, - wantPath: "/api/v1/memos/abc123/reactions/memos%2Fother%2Freactions%2Freaction456", + wantPath: "/api/memos/abc123/reactions/memos%2Fother%2Freactions%2Freaction456", }, { name: "extra nested segment is left untouched", - path: "/api/v1/memos/{memo}/reactions/{reaction}", + path: "/api/memos/{memo}/reactions/{reaction}", parameters: []string{"memo", "reaction"}, arguments: map[string]any{ "memo": "memos/abc123", "reaction": "memos/abc123/reactions/reaction456/extra", }, - wantPath: "/api/v1/memos/abc123/reactions/memos%2Fabc123%2Freactions%2Freaction456%2Fextra", + wantPath: "/api/memos/abc123/reactions/memos%2Fabc123%2Freactions%2Freaction456%2Fextra", }, } @@ -288,13 +288,13 @@ func TestBuildAPIRequestAcceptsCanonicalReactionNameForCuratedOperation(t *testi "reaction": "memos/abc123/reactions/reaction456", }, "") require.NoError(t, err) - require.Equal(t, "/api/v1/memos/abc123/reactions/reaction456", req.URL.EscapedPath()) + require.Equal(t, "/api/memos/abc123/reactions/reaction456", req.URL.EscapedPath()) } func TestBuildAPIRequestRequiresPathParameters(t *testing.T) { operation := &openAPIOperation{ Method: "GET", - Path: "/api/v1/memos/{memo}", + Path: "/api/memos/{memo}", Parameters: []openAPIParameter{{Name: "memo", In: "path", Required: true}}, } @@ -305,7 +305,7 @@ func TestBuildAPIRequestRequiresPathParameters(t *testing.T) { func TestBuildAPIRequestRequiresRequestBody(t *testing.T) { operation := &openAPIOperation{ Method: "POST", - Path: "/api/v1/memos", + Path: "/api/memos", RequestBody: &openAPIRequestBody{Required: true}, } @@ -316,7 +316,7 @@ func TestBuildAPIRequestRequiresRequestBody(t *testing.T) { func TestBuildAPIRequestEscapesPathAndStringifiesPrimitiveQueryParameters(t *testing.T) { operation := &openAPIOperation{ Method: "DELETE", - Path: "/api/v1/memos/{memo}", + Path: "/api/memos/{memo}", Parameters: []openAPIParameter{ {Name: "memo", In: "path", Required: true, Schema: jsonSchema{"type": "string"}}, {Name: "force", In: "query", Schema: jsonSchema{"type": "boolean"}}, @@ -330,14 +330,14 @@ func TestBuildAPIRequestEscapesPathAndStringifiesPrimitiveQueryParameters(t *tes "limit": 10, }, "") require.NoError(t, err) - require.Equal(t, "/api/v1/memos/abc%20123", req.URL.EscapedPath()) + require.Equal(t, "/api/memos/abc%20123", req.URL.EscapedPath()) require.Equal(t, "true", req.URL.Query().Get("force")) require.Equal(t, "10", req.URL.Query().Get("limit")) } func TestExecuteOperationReturnsObjectStructuredContent(t *testing.T) { echoServer := echo.New() - echoServer.GET("/api/v1/memos", func(c *echo.Context) error { + echoServer.GET("/api/memos", func(c *echo.Context) error { require.Equal(t, "Bearer token", c.Request().Header.Get("Authorization")) return c.JSON(http.StatusOK, map[string]any{ "memos": []any{map[string]any{"name": "memos/abc123"}}, @@ -346,7 +346,7 @@ func TestExecuteOperationReturnsObjectStructuredContent(t *testing.T) { operation := &openAPIOperation{ Method: "GET", - Path: "/api/v1/memos", + Path: "/api/memos", } adapter := newAPIAdapter(echoServer) @@ -360,13 +360,13 @@ func TestExecuteOperationReturnsObjectStructuredContent(t *testing.T) { func TestExecuteOperationConvertsAPIErrorsToToolErrors(t *testing.T) { echoServer := echo.New() - echoServer.GET("/api/v1/memos/:memo", func(c *echo.Context) error { + echoServer.GET("/api/memos/:memo", func(c *echo.Context) error { return c.JSON(http.StatusNotFound, map[string]any{"message": "missing memo"}) }) operation := &openAPIOperation{ Method: "GET", - Path: "/api/v1/memos/{memo}", + Path: "/api/memos/{memo}", Parameters: []openAPIParameter{{Name: "memo", In: "path", Required: true}}, } adapter := newAPIAdapter(echoServer) diff --git a/server/mcp/catalog_test.go b/server/mcp/catalog_test.go index 473d6b21e..4638c74ca 100644 --- a/server/mcp/catalog_test.go +++ b/server/mcp/catalog_test.go @@ -52,10 +52,10 @@ func TestBuildToolFromOperationIncludesSchemasAndMetadata(t *testing.T) { require.Equal(t, "Memo List Memos", tool.Title) require.Equal(t, "MemoService_ListMemos", operation.OperationID) require.Equal(t, "GET", operation.Method) - require.Equal(t, "/api/v1/memos", operation.Path) + require.Equal(t, "/api/memos", operation.Path) require.Equal(t, "MemoService_ListMemos", tool.Meta["operationId"]) require.Equal(t, "GET", tool.Meta["method"]) - require.Equal(t, "/api/v1/memos", tool.Meta["path"]) + require.Equal(t, "/api/memos", tool.Meta["path"]) require.NotEmpty(t, tool.Description) require.NotNil(t, tool.InputSchema) require.NotNil(t, tool.OutputSchema) @@ -383,7 +383,7 @@ func TestBuildCuratedToolsRejectsDuplicateToolNames(t *testing.T) { OperationID: operationID, Description: operationID, Method: "GET", - Path: "/api/v1/test", + Path: "/api/test", ResponseSchema: okSchema(), } } @@ -457,7 +457,7 @@ func TestBuildToolFromOperationExposesSpaceTools(t *testing.T) { tool, operation := buildToolFromOperation(registry["SpaceService_ListSpaces"]) require.Equal(t, "space_list_spaces", tool.Name) require.Equal(t, "GET", operation.Method) - require.Equal(t, "/api/v1/spaces", operation.Path) + require.Equal(t, "/api/spaces", operation.Path) require.True(t, tool.Annotations.ReadOnlyHint) tool, operation = buildToolFromOperation(registry["SpaceService_CreateSpace"]) diff --git a/server/mcp/service.go b/server/mcp/service.go index a1be93f5d..415780d5c 100644 --- a/server/mcp/service.go +++ b/server/mcp/service.go @@ -14,14 +14,14 @@ import ( "github.com/usememos/memos/internal/profile" memosproto "github.com/usememos/memos/proto" - apiv1 "github.com/usememos/memos/server/api/v1" + "github.com/usememos/memos/server/api" ) // maxMCPRequestBytes caps the /mcp request body. It tracks the API limit because // every tool call is forwarded in-process through the API routes. The SDK // enforces its own 4 MiB default, so the value is passed to the transport as // well; otherwise attachment uploads over MCP fail with 413 before Echo sees them. -const maxMCPRequestBytes int64 = apiv1.MaxAPIRequestBytes +const maxMCPRequestBytes int64 = api.MaxAPIRequestBytes // toolCatalogTTL is the freshness hint advertised on tools/list and // server/discover results. The catalog is fixed at startup, so clients may cache diff --git a/server/mcp/service_test.go b/server/mcp/service_test.go index 648755c69..facc16f50 100644 --- a/server/mcp/service_test.go +++ b/server/mcp/service_test.go @@ -57,7 +57,7 @@ func TestNewMCPServiceRegistersCuratedTools(t *testing.T) { require.NotNil(t, operation) require.Equal(t, "MemoService_ListMemos", operation.OperationID) require.Equal(t, "GET", operation.Method) - require.Equal(t, "/api/v1/memos", operation.Path) + require.Equal(t, "/api/memos", operation.Path) } func TestNewMCPServiceUsesEmbeddedOpenAPISpec(t *testing.T) { @@ -77,7 +77,7 @@ func TestEmbeddedOpenAPISpecMatchesGeneratedFile(t *testing.T) { func TestMCPToolHandlerForwardsArgumentsAndAuthorization(t *testing.T) { echoServer := echo.New() - echoServer.GET("/api/v1/memos", func(c *echo.Context) error { + echoServer.GET("/api/memos", func(c *echo.Context) error { require.Equal(t, "Bearer token", c.Request().Header.Get("Authorization")) require.Equal(t, "7", c.QueryParam("pageSize")) return c.JSON(http.StatusOK, map[string]any{ @@ -88,7 +88,7 @@ func TestMCPToolHandlerForwardsArgumentsAndAuthorization(t *testing.T) { operation := ®isteredOperation{ Operation: &openAPIOperation{ Method: "GET", - Path: "/api/v1/memos", + Path: "/api/memos", Parameters: []openAPIParameter{{Name: "pageSize", In: "query", Schema: jsonSchema{"type": "integer"}}}, }, } @@ -159,7 +159,7 @@ func TestMCPToolCallForwardsClientAddress(t *testing.T) { echoServer.Use(clientip.Middleware(resolver)) seen := "" - echoServer.GET("/api/v1/memos", func(c *echo.Context) error { + echoServer.GET("/api/memos", func(c *echo.Context) error { seen = clientip.FromContext(c.Request().Context()) return c.JSON(http.StatusOK, map[string]any{"memos": []any{}}) }) @@ -214,7 +214,7 @@ func TestMCPToolCallBindsSpaceResourcesFromPath(t *testing.T) { "invitation": "spaces/team/invitations/sam", }, method: http.MethodPost, - path: "/api/v1/spaces/team/invitations/sam:accept", + path: "/api/spaces/team/invitations/sam:accept", body: map[string]any{}, response: map[string]any{"name": "spaces/team/members/sam", "role": "USER"}, structured: map[string]any{"name": "spaces/team/members/sam", "role": "USER"}, @@ -228,7 +228,7 @@ func TestMCPToolCallBindsSpaceResourcesFromPath(t *testing.T) { "body": map[string]any{}, }, method: http.MethodPost, - path: "/api/v1/spaces/team/invitations/sam:decline", + path: "/api/spaces/team/invitations/sam:decline", body: map[string]any{}, response: map[string]any{}, structured: map[string]any{}, @@ -242,7 +242,7 @@ func TestMCPToolCallBindsSpaceResourcesFromPath(t *testing.T) { "body": map[string]any{"role": "ADMIN"}, }, method: http.MethodPatch, - path: "/api/v1/spaces/team/members/sam", + path: "/api/spaces/team/members/sam", body: map[string]any{"role": "ADMIN"}, response: map[string]any{"name": "spaces/team/members/sam", "role": "ADMIN"}, structured: map[string]any{"name": "spaces/team/members/sam", "role": "ADMIN"}, @@ -255,7 +255,7 @@ func TestMCPToolCallBindsSpaceResourcesFromPath(t *testing.T) { "body": map[string]any{"description": "renamed"}, }, method: http.MethodPatch, - path: "/api/v1/spaces/team", + path: "/api/spaces/team", body: map[string]any{"description": "renamed"}, response: map[string]any{"name": "spaces/team", "title": "Team", "description": "renamed"}, structured: map[string]any{"name": "spaces/team", "title": "Team", "description": "renamed"}, @@ -268,7 +268,7 @@ func TestMCPToolCallBindsSpaceResourcesFromPath(t *testing.T) { "body": map[string]any{"invitee": "users/sam", "role": "USER"}, }, method: http.MethodPost, - path: "/api/v1/spaces/team/invitations", + path: "/api/spaces/team/invitations", body: map[string]any{"invitee": "users/sam", "role": "USER"}, response: map[string]any{"name": "spaces/team/invitations/sam"}, structured: map[string]any{"name": "spaces/team/invitations/sam"}, @@ -281,7 +281,7 @@ func TestMCPToolCallBindsSpaceResourcesFromPath(t *testing.T) { "member": "spaces/team/members/sam", }, method: http.MethodDelete, - path: "/api/v1/spaces/team/members/sam", + path: "/api/spaces/team/members/sam", response: map[string]any{}, structured: map[string]any{}, }, @@ -291,7 +291,7 @@ func TestMCPToolCallBindsSpaceResourcesFromPath(t *testing.T) { t.Run(test.name, func(t *testing.T) { echoServer := echo.New() routeHits := 0 - echoServer.Any("/api/v1/spaces/*", func(c *echo.Context) error { + echoServer.Any("/api/spaces/*", func(c *echo.Context) error { routeHits++ require.Equal(t, test.method, c.Request().Method) require.Equal(t, test.path, c.Request().URL.Path) @@ -370,7 +370,7 @@ func TestMCPProtocolListsCuratedToolsOnly(t *testing.T) { func TestMCPToolCallReturnsObjectStructuredContent(t *testing.T) { echoServer := echo.New() - echoServer.GET("/api/v1/memos", func(c *echo.Context) error { + echoServer.GET("/api/memos", func(c *echo.Context) error { return c.JSON(http.StatusOK, map[string]any{ "memos": []any{map[string]any{"name": "memos/abc123"}}, }) @@ -403,7 +403,7 @@ func TestMCPToolCallReturnsObjectStructuredContent(t *testing.T) { func TestMCPToolCallAllowsGatewayToInferMemoUpdateMask(t *testing.T) { echoServer := echo.New() routeHits := 0 - echoServer.PATCH("/api/v1/memos/:memo", func(c *echo.Context) error { + echoServer.PATCH("/api/memos/:memo", func(c *echo.Context) error { routeHits++ require.Equal(t, "abc123", c.Param("memo")) require.Empty(t, c.QueryParam("updateMask")) @@ -468,7 +468,7 @@ func TestMCPToolCallBindsMemoFromPathForBodyStarOperations(t *testing.T) { { name: "set attachments", method: http.MethodPatch, - path: "/api/v1/memos/:memo/attachments", + path: "/api/memos/:memo/attachments", toolName: "memo_set_memo_attachments", body: map[string]any{"attachments": []any{}}, response: map[string]any{}, @@ -476,7 +476,7 @@ func TestMCPToolCallBindsMemoFromPathForBodyStarOperations(t *testing.T) { { name: "set relations", method: http.MethodPatch, - path: "/api/v1/memos/:memo/relations", + path: "/api/memos/:memo/relations", toolName: "memo_set_memo_relations", body: map[string]any{"relations": []any{}}, response: map[string]any{}, @@ -484,7 +484,7 @@ func TestMCPToolCallBindsMemoFromPathForBodyStarOperations(t *testing.T) { { name: "upsert reaction", method: http.MethodPost, - path: "/api/v1/memos/:memo/reactions", + path: "/api/memos/:memo/reactions", toolName: "memo_upsert_memo_reaction", body: map[string]any{ "reaction": map[string]any{ @@ -539,11 +539,11 @@ func TestMCPToolCallBindsMemoFromPathForBodyStarOperations(t *testing.T) { func TestMCPToolCallRejectsInvalidArguments(t *testing.T) { echoServer := echo.New() routeHits := 0 - echoServer.GET("/api/v1/memos", func(c *echo.Context) error { + echoServer.GET("/api/memos", func(c *echo.Context) error { routeHits++ return c.JSON(http.StatusOK, map[string]any{"memos": []any{}}) }) - echoServer.GET("/api/v1/memos/:memo", func(c *echo.Context) error { + echoServer.GET("/api/memos/:memo", func(c *echo.Context) error { routeHits++ return c.JSON(http.StatusOK, map[string]any{"name": c.Param("memo")}) }) @@ -701,7 +701,7 @@ func postMCP(t *testing.T, echoServer *echo.Echo, payload map[string]any) map[st func TestMCPStatelessProtocol2026(t *testing.T) { echoServer := echo.New() var forwardedAuthorization string - echoServer.GET("/api/v1/memos", func(c *echo.Context) error { + echoServer.GET("/api/memos", func(c *echo.Context) error { forwardedAuthorization = c.Request().Header.Get("Authorization") return c.JSON(http.StatusOK, map[string]any{"memos": []any{}}) }) @@ -786,7 +786,7 @@ func TestMCPStatelessRejectsSessionMethods(t *testing.T) { func TestMCPRequestBodyLimitMatchesAPI(t *testing.T) { echoServer := echo.New() var receivedBytes int - echoServer.POST("/api/v1/attachments", func(c *echo.Context) error { + echoServer.POST("/api/attachments", func(c *echo.Context) error { body := map[string]any{} require.NoError(t, json.NewDecoder(c.Request().Body).Decode(&body)) content, ok := body["content"].(string) diff --git a/server/server.go b/server/server.go index 17b30e830..1af60709c 100644 --- a/server/server.go +++ b/server/server.go @@ -17,7 +17,7 @@ import ( "github.com/usememos/memos/internal/clientip" "github.com/usememos/memos/internal/profile" storepb "github.com/usememos/memos/proto/gen/store" - apiv1 "github.com/usememos/memos/server/api/v1" + "github.com/usememos/memos/server/api" "github.com/usememos/memos/server/fileserver" "github.com/usememos/memos/server/frontend" "github.com/usememos/memos/server/mcp" @@ -41,9 +41,9 @@ type Server struct { Profile *profile.Profile Store *store.Store - echoServer *echo.Echo - httpServer *http.Server - apiV1Service *apiv1.APIV1Service + echoServer *echo.Echo + httpServer *http.Server + apiService *api.APIService } func NewServer(ctx context.Context, profile *profile.Profile, store *store.Store) (*Server, error) { @@ -83,8 +83,8 @@ func NewServer(ctx context.Context, profile *profile.Profile, store *store.Store // Serve frontend static files. frontend.NewFrontendService(profile, store).Serve(ctx, echoServer) - apiV1Service := apiv1.NewAPIV1Service(s.Secret, profile, store) - s.apiV1Service = apiV1Service + apiService := api.NewAPIService(s.Secret, profile, store) + s.apiService = apiService // Register HTTP file server routes BEFORE gRPC-Gateway to ensure proper range request handling for Safari. // This uses native HTTP serving (http.ServeContent) instead of gRPC for video/audio files. @@ -92,7 +92,7 @@ func NewServer(ctx context.Context, profile *profile.Profile, store *store.Store fileServerService.RegisterRoutes(echoServer) // Register gRPC gateway as api v1 (includes SSE endpoint on CORS-enabled group). - if err := apiV1Service.RegisterGateway(ctx, echoServer); err != nil { + if err := apiService.RegisterGateway(ctx, echoServer); err != nil { return nil, errors.Wrap(err, "failed to register gRPC gateway") } @@ -149,7 +149,7 @@ func (s *Server) Shutdown(ctx context.Context) { s.closeLongLivedConnections() s.shutdownHTTPServer(ctx) - s.apiV1Service.CloseUploads() + s.apiService.CloseUploads() // Close database connection. if err := s.Store.Close(); err != nil { @@ -161,7 +161,7 @@ func (s *Server) Shutdown(ctx context.Context) { func (s *Server) closeLongLivedConnections() { // Long-lived SSE requests do not finish on their own during http.Server.Shutdown. - s.apiV1Service.SSEHub.Close() + s.apiService.SSEHub.Close() } func (s *Server) shutdownHTTPServer(ctx context.Context) { diff --git a/server/test/ratelimit_test.go b/server/test/ratelimit_test.go index 40a04cd20..27161cd68 100644 --- a/server/test/ratelimit_test.go +++ b/server/test/ratelimit_test.go @@ -47,7 +47,7 @@ func TestStartupRateLimitOnBothTransports(t *testing.T) { // per 15 minutes, so the refusal arrives well within the loop bound. var refused *http.Response for range 40 { - resp := post("/api/v1/auth/signin", nextBody(), nil) + resp := post("/api/auth/signin", nextBody(), nil) if resp.StatusCode == http.StatusTooManyRequests { refused = resp break @@ -80,7 +80,7 @@ func TestStartupRateLimitOnBothTransports(t *testing.T) { require.Contains(t, types, "type.googleapis.com/google.rpc.RetryInfo") // The Connect transport shares the same budget and speaks the same contract. - connectResp := post("/memos.api.v1.AuthService/SignIn", nextBody(), map[string]string{"Connect-Protocol-Version": "1"}) + connectResp := post("/memos.api.AuthService/SignIn", nextBody(), map[string]string{"Connect-Protocol-Version": "1"}) defer connectResp.Body.Close() require.Equal(t, http.StatusTooManyRequests, connectResp.StatusCode) require.NotEmpty(t, connectResp.Header.Get("Retry-After")) @@ -103,7 +103,7 @@ func TestStartupRateLimitOnBothTransports(t *testing.T) { // budget. The test client connects from loopback, which the default // trusted-proxy set includes, so the forged header must name a trusted // address to be walked past and still land on the peer. - forged := post("/api/v1/auth/signin", nextBody(), map[string]string{"X-Forwarded-For": "10.0.0.9"}) + forged := post("/api/auth/signin", nextBody(), map[string]string{"X-Forwarded-For": "10.0.0.9"}) defer forged.Body.Close() require.Equal(t, http.StatusTooManyRequests, forged.StatusCode) } diff --git a/server/test/startup_test.go b/server/test/startup_test.go index a1cdd7d36..18ba4d223 100644 --- a/server/test/startup_test.go +++ b/server/test/startup_test.go @@ -1,6 +1,6 @@ // Package test contains black-box startup smoke tests for the full server. // -// Every other server test constructs apiv1.APIV1Service directly, which skips +// Every other server test constructs api.APIService directly, which skips // server.NewServer entirely. That leaves route registration, gRPC-gateway // wiring, MCP/fileserver/frontend mounting, CORS and the secret bootstrap // covered only by the Docker release script. These tests boot the real server @@ -176,7 +176,7 @@ func (i *instance) do(t *testing.T, method, path, token string, body any) (int, func (i *instance) createAdmin(t *testing.T) { t.Helper() - status, body := i.do(t, http.MethodPost, "/api/v1/users", "", map[string]any{ + status, body := i.do(t, http.MethodPost, "/api/users", "", map[string]any{ "username": testAdminUsername, "password": testAdminPassword, "email": "startup-admin@example.test", @@ -196,7 +196,7 @@ func (i *instance) createAdmin(t *testing.T) { func (i *instance) signIn(t *testing.T) string { t.Helper() - status, body := i.do(t, http.MethodPost, "/api/v1/auth/signin", "", map[string]any{ + status, body := i.do(t, http.MethodPost, "/api/auth/signin", "", map[string]any{ "passwordCredentials": map[string]any{ "username": testAdminUsername, "password": testAdminPassword, @@ -216,7 +216,7 @@ func (i *instance) signIn(t *testing.T) string { func (i *instance) createMemo(t *testing.T, token, memoID, content string) { t.Helper() - status, body := i.do(t, http.MethodPost, "/api/v1/memos?memoId="+memoID, token, map[string]any{ + status, body := i.do(t, http.MethodPost, "/api/memos?memoId="+memoID, token, map[string]any{ "content": content, "visibility": "PRIVATE", }) @@ -235,7 +235,7 @@ func (i *instance) createMemo(t *testing.T, token, memoID, content string) { func (i *instance) requireMemo(t *testing.T, token, memoID, content string) { t.Helper() - status, body := i.do(t, http.MethodGet, "/api/v1/memos/"+memoID, token, nil) + status, body := i.do(t, http.MethodGet, "/api/memos/"+memoID, token, nil) require.Equal(t, http.StatusOK, status, "reading memo %s should succeed: %s", memoID, body) var fetched struct { @@ -276,13 +276,13 @@ func TestStartupServesEveryRegisteredRouter(t *testing.T) { }) t.Run("api gateway", func(t *testing.T) { - status, body := inst.do(t, http.MethodGet, "/api/v1/instance/profile", "", nil) + status, body := inst.do(t, http.MethodGet, "/api/instance/profile", "", nil) require.Equal(t, http.StatusOK, status, "instance profile should be public: %s", body) require.Contains(t, string(body), "version") }) t.Run("api gateway form post fallback", func(t *testing.T) { - req, err := http.NewRequestWithContext(ctx, http.MethodPost, inst.baseURL+"/api/v1/instance/profile", strings.NewReader("")) + req, err := http.NewRequestWithContext(ctx, http.MethodPost, inst.baseURL+"/api/instance/profile", strings.NewReader("")) require.NoError(t, err) req.Header.Set("Content-Type", "application/x-www-form-urlencoded") @@ -360,16 +360,16 @@ func TestStartupPrivateInstance(t *testing.T) { require.Equal(t, storepb.InstanceAccessMode_INSTANCE_ACCESS_MODE_PRIVATE, accessSetting.AccessMode) // Bootstrap methods stay reachable so the sign-in page can render. - status, body := inst.do(t, http.MethodGet, "/api/v1/instance/profile", "", nil) + status, body := inst.do(t, http.MethodGet, "/api/instance/profile", "", nil) require.Equal(t, http.StatusOK, status, "instance profile is an auth bootstrap method: %s", body) // Protected procedures are refused for anonymous callers. - status, _ = inst.do(t, http.MethodGet, "/api/v1/users", "", nil) + status, _ = inst.do(t, http.MethodGet, "/api/users", "", nil) require.Equal(t, http.StatusUnauthorized, status, "anonymous ListUsers should be refused") // ListMemos is public but not a bootstrap method, so the private-instance // policy must refuse anonymous callers. The Connect transport enforces this. - status, _ = inst.do(t, http.MethodPost, "/memos.api.v1.MemoService/ListMemos", "", map[string]any{}) + status, _ = inst.do(t, http.MethodPost, "/memos.api.MemoService/ListMemos", "", map[string]any{}) require.Equal(t, http.StatusUnauthorized, status, "anonymous ListMemos over Connect should be refused on a private instance") @@ -399,7 +399,7 @@ func TestStartupInitializesLegacyAccessOnce(t *testing.T) { require.NoError(t, err) require.Equal(t, storepb.InstanceAccessMode_INSTANCE_ACCESS_MODE_PUBLIC, accessSetting.AccessMode) - status, body := second.do(t, http.MethodGet, "/api/v1/memos", "", nil) + status, body := second.do(t, http.MethodGet, "/api/memos", "", nil) require.Equal(t, http.StatusOK, status, "persisted PUBLIC mode should still allow anonymous access: %s", body) }) @@ -416,7 +416,7 @@ func TestStartupInitializesLegacyAccessOnce(t *testing.T) { require.NoError(t, err) require.Equal(t, storepb.InstanceAccessMode_INSTANCE_ACCESS_MODE_PRIVATE, accessSetting.AccessMode) - status, _ := second.do(t, http.MethodGet, "/api/v1/memos", "", nil) + status, _ := second.do(t, http.MethodGet, "/api/memos", "", nil) require.Equal(t, http.StatusUnauthorized, status, "canonical URL must not reopen a persisted PRIVATE instance") }) } @@ -439,16 +439,16 @@ func TestStartupPrivateInstanceGatewayPolicy(t *testing.T) { token := inst.signIn(t) inst.createMemo(t, token, "startup-private-public", "public on a private instance") status, body := inst.do(t, http.MethodPatch, - "/api/v1/memos/startup-private-public?updateMask=visibility", token, map[string]any{ + "/api/memos/startup-private-public?updateMask=visibility", token, map[string]any{ "visibility": "PUBLIC", }) require.Equal(t, http.StatusOK, status, "should be able to make the memo public: %s", body) - status, _ = inst.do(t, http.MethodGet, "/api/v1/memos", "", nil) + status, _ = inst.do(t, http.MethodGet, "/api/memos", "", nil) require.Equal(t, http.StatusUnauthorized, status, "anonymous ListMemos over REST should be refused on a private instance") - status, _ = inst.do(t, http.MethodGet, "/api/v1/memos/startup-private-public", "", nil) + status, _ = inst.do(t, http.MethodGet, "/api/memos/startup-private-public", "", nil) require.Equal(t, http.StatusUnauthorized, status, "anonymous GetMemo over REST should be refused on a private instance") } @@ -470,7 +470,7 @@ func TestStartupGatewayOmitsNullMessageFields(t *testing.T) { // A 1x1 GIF: small enough to inline, real enough for the type sniffing the // attachment service runs on upload. const onePixelGIF = "R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" - status, body := inst.do(t, http.MethodPost, "/api/v1/attachments", token, map[string]any{ + status, body := inst.do(t, http.MethodPost, "/api/attachments", token, map[string]any{ "filename": "pixel.gif", "type": "image/gif", "content": onePixelGIF, @@ -483,7 +483,7 @@ func TestStartupGatewayOmitsNullMessageFields(t *testing.T) { require.NoError(t, json.Unmarshal(body, &created)) require.NotEmpty(t, created.Name, "the created attachment should carry a name: %s", body) - status, body = inst.do(t, http.MethodGet, "/api/v1/"+created.Name, token, nil) + status, body = inst.do(t, http.MethodGet, "/api/"+created.Name, token, nil) require.Equal(t, http.StatusOK, status, "reading the attachment should succeed: %s", body) fetched := map[string]any{} @@ -504,7 +504,7 @@ func TestStartupDemoMode(t *testing.T) { instanceURL: "http://localhost", }) - status, body := inst.do(t, http.MethodGet, "/api/v1/memos", "", nil) + status, body := inst.do(t, http.MethodGet, "/api/memos", "", nil) require.Equal(t, http.StatusOK, status, "demo instances serve memos anonymously: %s", body) var listed struct { diff --git a/web/src/components/AppSidebar/AppSidebar.tsx b/web/src/components/AppSidebar/AppSidebar.tsx index bededb803..5b409410c 100644 --- a/web/src/components/AppSidebar/AppSidebar.tsx +++ b/web/src/components/AppSidebar/AppSidebar.tsx @@ -41,7 +41,7 @@ import { useNotifications } from "@/hooks/useUserQueries"; import { combineCELFilters } from "@/lib/cel-filter"; import { cn } from "@/lib/utils"; import { collectionNavigationPath, ROUTES } from "@/router/routes"; -import { User_Role, UserNotification_Status } from "@/types/proto/api/v1/user_service_pb"; +import { User_Role, UserNotification_Status } from "@/types/proto/api/user_service_pb"; import { useTranslate } from "@/utils/i18n"; import CommonSidebarContent from "./CommonSidebarContent"; import { getSidebarRouteKind } from "./routes"; diff --git a/web/src/components/AppSidebar/ViewsSection.tsx b/web/src/components/AppSidebar/ViewsSection.tsx index 5a59ea5cf..f365eec77 100644 --- a/web/src/components/AppSidebar/ViewsSection.tsx +++ b/web/src/components/AppSidebar/ViewsSection.tsx @@ -16,7 +16,7 @@ import { handleError } from "@/lib/error"; import { getMemoViewId, isMemoCollectionRoute } from "@/lib/memo-views"; import { cn } from "@/lib/utils"; import { getCollectionHomePath, ROUTES } from "@/router/routes"; -import type { MemoView } from "@/types/proto/api/v1/user_service_pb"; +import type { MemoView } from "@/types/proto/api/user_service_pb"; import { useTranslate } from "@/utils/i18n"; import SidebarRow, { SIDEBAR_ROW_BOX_CLASSES, diff --git a/web/src/components/AttachmentIcon.tsx b/web/src/components/AttachmentIcon.tsx index 43d90c547..31b0f2bac 100644 --- a/web/src/components/AttachmentIcon.tsx +++ b/web/src/components/AttachmentIcon.tsx @@ -11,7 +11,7 @@ import { } from "lucide-react"; import React, { useState } from "react"; import { cn } from "@/lib/utils"; -import { Attachment } from "@/types/proto/api/v1/attachment_service_pb"; +import { Attachment } from "@/types/proto/api/attachment_service_pb"; import { getAttachmentThumbnailUrl, getAttachmentType, getAttachmentUrl } from "@/utils/attachment"; import SquareDiv from "./kit/SquareDiv"; import PreviewImageDialog from "./PreviewImageDialog"; diff --git a/web/src/components/AttachmentLibrary/AttachmentFileRows.tsx b/web/src/components/AttachmentLibrary/AttachmentFileRows.tsx index fd3406a87..824fdfaff 100644 --- a/web/src/components/AttachmentLibrary/AttachmentFileRows.tsx +++ b/web/src/components/AttachmentLibrary/AttachmentFileRows.tsx @@ -3,7 +3,7 @@ import AudioAttachmentItem from "@/components/MemoMetadata/Attachment/AudioAttac import VideoPoster from "@/components/VideoPoster"; import type { AttachmentLibraryListItem } from "@/hooks/useAttachmentLibrary"; import { cn } from "@/lib/utils"; -import type { User } from "@/types/proto/api/v1/user_service_pb"; +import type { User } from "@/types/proto/api/user_service_pb"; import { getAttachmentThumbnailUrl, getAttachmentType, isMotionAttachment } from "@/utils/attachment"; import { AttachmentCreator, AttachmentMetadataLine, AttachmentOpenButton, AttachmentSourceChip } from "./AttachmentLibraryPrimitives"; diff --git a/web/src/components/AttachmentLibrary/AttachmentLibraryPrimitives.tsx b/web/src/components/AttachmentLibrary/AttachmentLibraryPrimitives.tsx index 5cc114dc5..80c928f34 100644 --- a/web/src/components/AttachmentLibrary/AttachmentLibraryPrimitives.tsx +++ b/web/src/components/AttachmentLibrary/AttachmentLibraryPrimitives.tsx @@ -7,7 +7,7 @@ import { Button } from "@/components/ui/button"; import { extractUsernameFromName } from "@/lib/resource-names"; import { cn } from "@/lib/utils"; import { getCreatorHomePath } from "@/router/routes"; -import type { User } from "@/types/proto/api/v1/user_service_pb"; +import type { User } from "@/types/proto/api/user_service_pb"; import { useTranslate } from "@/utils/i18n"; interface AttachmentMetadataLineProps { diff --git a/web/src/components/AttachmentLibrary/AttachmentMediaGrid.tsx b/web/src/components/AttachmentLibrary/AttachmentMediaGrid.tsx index d420f305e..d4cbf5feb 100644 --- a/web/src/components/AttachmentLibrary/AttachmentMediaGrid.tsx +++ b/web/src/components/AttachmentLibrary/AttachmentMediaGrid.tsx @@ -4,7 +4,7 @@ import { Badge } from "@/components/ui/badge"; import VideoPoster from "@/components/VideoPoster"; import type { AttachmentLibraryMediaItem, AttachmentLibraryMonthGroup } from "@/hooks/useAttachmentLibrary"; import { cn } from "@/lib/utils"; -import type { User } from "@/types/proto/api/v1/user_service_pb"; +import type { User } from "@/types/proto/api/user_service_pb"; import { useTranslate } from "@/utils/i18n"; import { formatMediaDuration } from "@/utils/media-metadata"; import { AttachmentCreator, AttachmentMetadataLine, AttachmentOpenButton, AttachmentSourceChip } from "./AttachmentLibraryPrimitives"; diff --git a/web/src/components/AuthPageLayout.tsx b/web/src/components/AuthPageLayout.tsx index 1da36aa13..9fca17452 100644 --- a/web/src/components/AuthPageLayout.tsx +++ b/web/src/components/AuthPageLayout.tsx @@ -2,7 +2,7 @@ import { ArrowRightIcon, CompassIcon } from "lucide-react"; import { Link } from "react-router-dom"; import { useInstance } from "@/contexts/InstanceContext"; import { ROUTES } from "@/router/routes"; -import { InstanceAccessMode } from "@/types/proto/api/v1/instance_service_pb"; +import { InstanceAccessMode } from "@/types/proto/api/instance_service_pb"; import { useTranslate } from "@/utils/i18n"; import AuthFooter from "./AuthFooter"; diff --git a/web/src/components/CalendarView/CalendarView.tsx b/web/src/components/CalendarView/CalendarView.tsx index f5930583a..1c805af9b 100644 --- a/web/src/components/CalendarView/CalendarView.tsx +++ b/web/src/components/CalendarView/CalendarView.tsx @@ -16,7 +16,7 @@ import { formatMonthLabel, getToday, parseLocalDate } from "@/lib/calendar-utils import { combineCELFilters } from "@/lib/cel-filter"; import { isMemoBlurred } from "@/lib/tag"; import { collectionPathForLocation } from "@/router/routes"; -import type { Memo } from "@/types/proto/api/v1/memo_service_pb"; +import type { Memo } from "@/types/proto/api/memo_service_pb"; import { useTranslate } from "@/utils/i18n"; import { PREVIEW_MIN_CELL_WIDTH } from "./CalendarDayCell"; import { CalendarGrid } from "./CalendarGrid"; diff --git a/web/src/components/CalendarView/dayModel.ts b/web/src/components/CalendarView/dayModel.ts index 69948f265..6636549d7 100644 --- a/web/src/components/CalendarView/dayModel.ts +++ b/web/src/components/CalendarView/dayModel.ts @@ -13,7 +13,7 @@ import { SANITIZE_SCHEMA } from "@/components/MemoContent/constants"; import type { MemoTimeBasis } from "@/contexts/ViewContext"; import { getMemoSortTime } from "@/hooks/useMemoSorting"; import { ISO_DATE_FORMAT } from "@/lib/calendar-utils"; -import type { Memo } from "@/types/proto/api/v1/memo_service_pb"; +import type { Memo } from "@/types/proto/api/memo_service_pb"; import { getAttachmentThumbnailUrl, getAttachmentUrl, isImage } from "@/utils/attachment"; import { classifyManagedAttachmentImageURL, extractAttachmentUIDFromName } from "@/utils/managed-attachment"; diff --git a/web/src/components/CalendarView/useMonthMemos.ts b/web/src/components/CalendarView/useMonthMemos.ts index b8ccdfb5f..6da45dfab 100644 --- a/web/src/components/CalendarView/useMonthMemos.ts +++ b/web/src/components/CalendarView/useMonthMemos.ts @@ -5,8 +5,8 @@ import { memoServiceClient } from "@/connect"; import { useView } from "@/contexts/ViewContext"; import { memoKeys } from "@/hooks/useMemoQueries"; import { getLocalMonthTimestampRange, withTimestampRange } from "@/lib/calendar-utils"; -import { State } from "@/types/proto/api/v1/common_pb"; -import { ListMemosRequestSchema, type Memo } from "@/types/proto/api/v1/memo_service_pb"; +import { State } from "@/types/proto/api/common_pb"; +import { ListMemosRequestSchema, type Memo } from "@/types/proto/api/memo_service_pb"; import { type BuildCalendarMonthModelOptions, buildCalendarMonthModel } from "./dayModel"; /** A month usually fits one page; the loop below still drains any that do not. */ diff --git a/web/src/components/ChangeMemberPasswordDialog.tsx b/web/src/components/ChangeMemberPasswordDialog.tsx index c9d9995ff..2094626ac 100644 --- a/web/src/components/ChangeMemberPasswordDialog.tsx +++ b/web/src/components/ChangeMemberPasswordDialog.tsx @@ -6,7 +6,7 @@ import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; import { useUpdateUser } from "@/hooks/useUserQueries"; import { handleError } from "@/lib/error"; -import { User } from "@/types/proto/api/v1/user_service_pb"; +import { User } from "@/types/proto/api/user_service_pb"; import { useTranslate } from "@/utils/i18n"; interface Props { diff --git a/web/src/components/CreateAccessTokenDialog.tsx b/web/src/components/CreateAccessTokenDialog.tsx index a36e96fef..e8acc5909 100644 --- a/web/src/components/CreateAccessTokenDialog.tsx +++ b/web/src/components/CreateAccessTokenDialog.tsx @@ -11,7 +11,7 @@ import { userServiceClient } from "@/connect"; import useCurrentUser from "@/hooks/useCurrentUser"; import useLoading from "@/hooks/useLoading"; import { handleError } from "@/lib/error"; -import { CreatePersonalAccessTokenResponse } from "@/types/proto/api/v1/user_service_pb"; +import { CreatePersonalAccessTokenResponse } from "@/types/proto/api/user_service_pb"; import { useTranslate } from "@/utils/i18n"; interface Props { diff --git a/web/src/components/CreateIdentityProviderDialog.tsx b/web/src/components/CreateIdentityProviderDialog.tsx index 76187d67e..6520676d9 100644 --- a/web/src/components/CreateIdentityProviderDialog.tsx +++ b/web/src/components/CreateIdentityProviderDialog.tsx @@ -19,7 +19,7 @@ import { IdentityProviderSchema, OAuth2Config, OAuth2ConfigSchema, -} from "@/types/proto/api/v1/idp_service_pb"; +} from "@/types/proto/api/idp_service_pb"; import { useTranslate } from "@/utils/i18n"; const DEFAULT_TEMPLATE = "GitHub"; diff --git a/web/src/components/CreateSpaceDialog.tsx b/web/src/components/CreateSpaceDialog.tsx index 0d0037786..609e154a3 100644 --- a/web/src/components/CreateSpaceDialog.tsx +++ b/web/src/components/CreateSpaceDialog.tsx @@ -13,7 +13,7 @@ import useCurrentUser from "@/hooks/useCurrentUser"; import { useCreateSpace } from "@/hooks/useSpaceQueries"; import { handleError } from "@/lib/error"; import { cn } from "@/lib/utils"; -import type { Space, Space_Icon } from "@/types/proto/api/v1/space_service_pb"; +import type { Space, Space_Icon } from "@/types/proto/api/space_service_pb"; import { useTranslate } from "@/utils/i18n"; const SPACE_UID_PATTERN = /^[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,34}[a-zA-Z0-9])?$/; diff --git a/web/src/components/CreateUserDialog.tsx b/web/src/components/CreateUserDialog.tsx index 9cba53fcf..8caf68ac8 100644 --- a/web/src/components/CreateUserDialog.tsx +++ b/web/src/components/CreateUserDialog.tsx @@ -10,7 +10,7 @@ import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group"; import { userServiceClient } from "@/connect"; import useLoading from "@/hooks/useLoading"; import { handleError } from "@/lib/error"; -import { User, User_Role, UserSchema } from "@/types/proto/api/v1/user_service_pb"; +import { User, User_Role, UserSchema } from "@/types/proto/api/user_service_pb"; import { useTranslate } from "@/utils/i18n"; interface Props { diff --git a/web/src/components/IdentityProviderButtons.tsx b/web/src/components/IdentityProviderButtons.tsx index d0e44971e..997337c40 100644 --- a/web/src/components/IdentityProviderButtons.tsx +++ b/web/src/components/IdentityProviderButtons.tsx @@ -3,7 +3,7 @@ import { Button } from "@/components/ui/button"; import { absolutifyLink } from "@/lib/browser"; import { handleError } from "@/lib/error"; import { ROUTES } from "@/router/routes"; -import { IdentityProvider, IdentityProvider_Type } from "@/types/proto/api/v1/idp_service_pb"; +import { IdentityProvider, IdentityProvider_Type } from "@/types/proto/api/idp_service_pb"; import { useTranslate } from "@/utils/i18n"; import { storeOAuthState } from "@/utils/oauth"; diff --git a/web/src/components/Inbox/MemoCommentMessage.tsx b/web/src/components/Inbox/MemoCommentMessage.tsx index 37329c4f2..fe5a1e1e4 100644 --- a/web/src/components/Inbox/MemoCommentMessage.tsx +++ b/web/src/components/Inbox/MemoCommentMessage.tsx @@ -6,7 +6,7 @@ import useNavigateTo from "@/hooks/useNavigateTo"; import { useArchiveNotification, useDeleteNotification } from "@/hooks/useUserQueries"; import { handleError } from "@/lib/error"; import { cn } from "@/lib/utils"; -import { UserNotification, UserNotification_Status } from "@/types/proto/api/v1/user_service_pb"; +import { UserNotification, UserNotification_Status } from "@/types/proto/api/user_service_pb"; import { useTranslate } from "@/utils/i18n"; interface Props { diff --git a/web/src/components/Inbox/MemoMentionMessage.tsx b/web/src/components/Inbox/MemoMentionMessage.tsx index bc0705ce3..da43337f0 100644 --- a/web/src/components/Inbox/MemoMentionMessage.tsx +++ b/web/src/components/Inbox/MemoMentionMessage.tsx @@ -6,7 +6,7 @@ import useNavigateTo from "@/hooks/useNavigateTo"; import { useArchiveNotification, useDeleteNotification } from "@/hooks/useUserQueries"; import { handleError } from "@/lib/error"; import { cn } from "@/lib/utils"; -import { UserNotification, UserNotification_Status } from "@/types/proto/api/v1/user_service_pb"; +import { UserNotification, UserNotification_Status } from "@/types/proto/api/user_service_pb"; import { useTranslate } from "@/utils/i18n"; interface Props { diff --git a/web/src/components/Inbox/SpaceInvitationMessage.tsx b/web/src/components/Inbox/SpaceInvitationMessage.tsx index 65caaa41c..6be0d9721 100644 --- a/web/src/components/Inbox/SpaceInvitationMessage.tsx +++ b/web/src/components/Inbox/SpaceInvitationMessage.tsx @@ -14,9 +14,9 @@ import { extractSpaceUidFromName } from "@/lib/space-display"; import { cn } from "@/lib/utils"; import { UserNotification, - UserNotification_SpaceInvitationPayload_State, + UserNotification_SpaceInvitationPayload_InvitationState, UserNotification_Status, -} from "@/types/proto/api/v1/user_service_pb"; +} from "@/types/proto/api/user_service_pb"; import { useTranslate } from "@/utils/i18n"; interface Props { @@ -79,7 +79,7 @@ function SpaceInvitationMessage({ notification }: Props) { } const isUnread = notification.status === UserNotification_Status.UNREAD; - const isPending = payload.state === UserNotification_SpaceInvitationPayload_State.PENDING; + const isPending = payload.state === UserNotification_SpaceInvitationPayload_InvitationState.PENDING; const isBusy = acceptInvitation.isPending || declineInvitation.isPending; const spaceUid = extractSpaceUidFromName(space.name); const spaceLabel = `${space.title} (${spaceUid})`; diff --git a/web/src/components/MapView/MapCanvas.tsx b/web/src/components/MapView/MapCanvas.tsx index 1c0a2bf2d..7b68eac6f 100644 --- a/web/src/components/MapView/MapCanvas.tsx +++ b/web/src/components/MapView/MapCanvas.tsx @@ -10,7 +10,7 @@ import { BasemapLayer } from "@/components/map/BasemapLayer"; import { createMarkerIcon, MinimalAttributionControl } from "@/components/map/map-utils"; import UserAvatar from "@/components/UserAvatar"; import { cn } from "@/lib/utils"; -import type { Memo } from "@/types/proto/api/v1/memo_service_pb"; +import type { Memo } from "@/types/proto/api/memo_service_pb"; import { type MapPin, type MapPinFace, type MapViewport, revealOffset } from "./model"; interface Props { diff --git a/web/src/components/MapView/MapView.tsx b/web/src/components/MapView/MapView.tsx index ce6074890..c8646ec2c 100644 --- a/web/src/components/MapView/MapView.tsx +++ b/web/src/components/MapView/MapView.tsx @@ -13,7 +13,7 @@ import { useSpaceContext } from "@/contexts/SpaceContext"; import useCurrentUser from "@/hooks/useCurrentUser"; import useMediaQuery from "@/hooks/useMediaQuery"; import { cn } from "@/lib/utils"; -import { LocationSchema } from "@/types/proto/api/v1/memo_service_pb"; +import { LocationSchema } from "@/types/proto/api/memo_service_pb"; import { useTranslate } from "@/utils/i18n"; import { fitMemos, MapCanvas } from "./MapCanvas"; import { locationKey, type MapViewport, pointLabel, readViewport, splitLabel } from "./model"; diff --git a/web/src/components/MapView/model.ts b/web/src/components/MapView/model.ts index 9a33790f0..2b04fea24 100644 --- a/web/src/components/MapView/model.ts +++ b/web/src/components/MapView/model.ts @@ -1,6 +1,6 @@ import type { MemoTimeBasis } from "@/contexts/ViewContext"; import { getMemoSortTime } from "@/hooks/useMemoSorting"; -import type { Location, Memo } from "@/types/proto/api/v1/memo_service_pb"; +import type { Location, Memo } from "@/types/proto/api/memo_service_pb"; export interface MapViewport { lat: number; diff --git a/web/src/components/MapView/useMapMemos.ts b/web/src/components/MapView/useMapMemos.ts index 49f7a5c22..87d0060f0 100644 --- a/web/src/components/MapView/useMapMemos.ts +++ b/web/src/components/MapView/useMapMemos.ts @@ -5,7 +5,7 @@ import { useView } from "@/contexts/ViewContext"; import { useMemoFilters } from "@/hooks/useMemoFilters"; import { useInfiniteMemos } from "@/hooks/useMemoQueries"; import { combineCELFilters } from "@/lib/cel-filter"; -import { State } from "@/types/proto/api/v1/common_pb"; +import { State } from "@/types/proto/api/common_pb"; import { mapMemos } from "./model"; /** What the map can show; the sidebar counts against the same scope. */ diff --git a/web/src/components/MapView/useMapPins.ts b/web/src/components/MapView/useMapPins.ts index 154aa4835..72d4dc9c8 100644 --- a/web/src/components/MapView/useMapPins.ts +++ b/web/src/components/MapView/useMapPins.ts @@ -5,7 +5,7 @@ import { useAuth } from "@/contexts/AuthContext"; import { useUsersByUsernames } from "@/hooks/useUserQueries"; import { extractUsernameFromName } from "@/lib/resource-names"; import { isMemoBlurred } from "@/lib/tag"; -import type { Memo } from "@/types/proto/api/v1/memo_service_pb"; +import type { Memo } from "@/types/proto/api/memo_service_pb"; import { type MapPin, pinFace } from "./model"; /** diff --git a/web/src/components/MemoActionMenu/MemoActionMenu.tsx b/web/src/components/MemoActionMenu/MemoActionMenu.tsx index 5edfda510..035647cf7 100644 --- a/web/src/components/MemoActionMenu/MemoActionMenu.tsx +++ b/web/src/components/MemoActionMenu/MemoActionMenu.tsx @@ -28,7 +28,7 @@ import { DropdownMenuSubTrigger, DropdownMenuTrigger, } from "@/components/ui/dropdown-menu"; -import { State } from "@/types/proto/api/v1/common_pb"; +import { State } from "@/types/proto/api/common_pb"; import { useTranslate } from "@/utils/i18n"; import { createMemoNavigationState } from "../MemoView/navigation"; import { useMemoActionHandlers } from "./hooks"; diff --git a/web/src/components/MemoActionMenu/hooks.ts b/web/src/components/MemoActionMenu/hooks.ts index 30b0ab031..38344a689 100644 --- a/web/src/components/MemoActionMenu/hooks.ts +++ b/web/src/components/MemoActionMenu/hooks.ts @@ -10,8 +10,8 @@ import { userKeys } from "@/hooks/useUserQueries"; import { handleError } from "@/lib/error"; import { extractMemoIdFromName } from "@/lib/resource-names"; import { ROUTES } from "@/router/routes"; -import { State } from "@/types/proto/api/v1/common_pb"; -import type { Memo } from "@/types/proto/api/v1/memo_service_pb"; +import { State } from "@/types/proto/api/common_pb"; +import type { Memo } from "@/types/proto/api/memo_service_pb"; import { useTranslate } from "@/utils/i18n"; import { checkAllTasks, uncheckAllTasks } from "@/utils/markdown-task-actions"; import { isMemoDetailPath } from "../MemoView/navigation"; diff --git a/web/src/components/MemoActionMenu/memoShareImagePreviewModel.ts b/web/src/components/MemoActionMenu/memoShareImagePreviewModel.ts index 73391d9eb..2a998cc6b 100644 --- a/web/src/components/MemoActionMenu/memoShareImagePreviewModel.ts +++ b/web/src/components/MemoActionMenu/memoShareImagePreviewModel.ts @@ -1,7 +1,7 @@ import { timestampDate } from "@bufbuild/protobuf/wkt"; import { separateAttachments } from "@/components/MemoMetadata/Attachment/attachmentHelpers"; -import type { Memo } from "@/types/proto/api/v1/memo_service_pb"; -import type { User } from "@/types/proto/api/v1/user_service_pb"; +import type { Memo } from "@/types/proto/api/memo_service_pb"; +import type { User } from "@/types/proto/api/user_service_pb"; import { filterInlineManagedAttachments } from "@/utils/managed-attachment"; import { type AttachmentVisualItem, buildAttachmentVisualItems, countLogicalAttachmentItems } from "@/utils/media-item"; import { getMemoSharePreviewAvatarUrl } from "./memoShareImage"; diff --git a/web/src/components/MemoActionMenu/types.ts b/web/src/components/MemoActionMenu/types.ts index 78a864da6..f6241956e 100644 --- a/web/src/components/MemoActionMenu/types.ts +++ b/web/src/components/MemoActionMenu/types.ts @@ -1,4 +1,4 @@ -import type { Memo } from "@/types/proto/api/v1/memo_service_pb"; +import type { Memo } from "@/types/proto/api/memo_service_pb"; export interface MemoActionMenuProps { memo: Memo; diff --git a/web/src/components/MemoCommentSection.tsx b/web/src/components/MemoCommentSection.tsx index 5d028763d..401244394 100644 --- a/web/src/components/MemoCommentSection.tsx +++ b/web/src/components/MemoCommentSection.tsx @@ -7,8 +7,8 @@ import { Button } from "@/components/ui/button"; import useCurrentUser from "@/hooks/useCurrentUser"; import { MEMO_COMMENTS_ANCHOR_ID } from "@/lib/memo-comments"; import { extractMemoIdFromName } from "@/lib/resource-names"; -import { State } from "@/types/proto/api/v1/common_pb"; -import type { Memo } from "@/types/proto/api/v1/memo_service_pb"; +import { State } from "@/types/proto/api/common_pb"; +import type { Memo } from "@/types/proto/api/memo_service_pb"; import { useTranslate } from "@/utils/i18n"; interface Props { diff --git a/web/src/components/MemoContent/MemoMarkdownRenderer.tsx b/web/src/components/MemoContent/MemoMarkdownRenderer.tsx index fd83bfa57..6e17a373a 100644 --- a/web/src/components/MemoContent/MemoMarkdownRenderer.tsx +++ b/web/src/components/MemoContent/MemoMarkdownRenderer.tsx @@ -4,7 +4,7 @@ import type { Components } from "react-markdown"; import ReactMarkdown from "react-markdown"; import { buildRehypePlugins, buildRemarkPlugins } from "@/components/MemoContent/pipeline"; import { isMentionElement, isTagElement, isTaskListItemElement } from "@/types/markdown"; -import type { Attachment } from "@/types/proto/api/v1/attachment_service_pb"; +import type { Attachment } from "@/types/proto/api/attachment_service_pb"; import { lazyWithReload } from "@/utils/lazy"; import { resolveManagedAttachmentImageSource } from "@/utils/managed-attachment"; import { CodeBlock } from "./CodeBlock"; diff --git a/web/src/components/MemoContent/MentionResolutionContext.tsx b/web/src/components/MemoContent/MentionResolutionContext.tsx index 123fd9cc2..c18cadcdf 100644 --- a/web/src/components/MemoContent/MentionResolutionContext.tsx +++ b/web/src/components/MemoContent/MentionResolutionContext.tsx @@ -2,7 +2,7 @@ import { useQueries } from "@tanstack/react-query"; import { createContext, type ReactNode, useContext, useMemo } from "react"; import { userDetailQueryOptions, useUsersByUsernames } from "@/hooks/useUserQueries"; import { extractUsernameFromName } from "@/lib/resource-names"; -import type { User } from "@/types/proto/api/v1/user_service_pb"; +import type { User } from "@/types/proto/api/user_service_pb"; import { extractMentionUsernames } from "@/utils/mention-extraction"; interface UserResolutionContextValue { diff --git a/web/src/components/MemoContent/types.ts b/web/src/components/MemoContent/types.ts index 3e7fa0d7b..304596c84 100644 --- a/web/src/components/MemoContent/types.ts +++ b/web/src/components/MemoContent/types.ts @@ -1,5 +1,5 @@ import type React from "react"; -import type { Attachment } from "@/types/proto/api/v1/attachment_service_pb"; +import type { Attachment } from "@/types/proto/api/attachment_service_pb"; export interface MemoContentProps { content: string; diff --git a/web/src/components/MemoDetailSidebar/MemoDetailSidebar.tsx b/web/src/components/MemoDetailSidebar/MemoDetailSidebar.tsx index 0c9ea63b2..a7fdd8d28 100644 --- a/web/src/components/MemoDetailSidebar/MemoDetailSidebar.tsx +++ b/web/src/components/MemoDetailSidebar/MemoDetailSidebar.tsx @@ -25,8 +25,8 @@ import { useOverflowTitle } from "@/hooks"; import useCurrentUser from "@/hooks/useCurrentUser"; import { MEMO_COMMENTS_ANCHOR_ID } from "@/lib/memo-comments"; import { cn } from "@/lib/utils"; -import { State } from "@/types/proto/api/v1/common_pb"; -import { Memo, type MemoRelation, Visibility } from "@/types/proto/api/v1/memo_service_pb"; +import { State } from "@/types/proto/api/common_pb"; +import { Memo, type MemoRelation, Visibility } from "@/types/proto/api/memo_service_pb"; import { useTranslate } from "@/utils/i18n"; import { canManageMemo } from "@/utils/user"; import MemoOutline from "./MemoOutline"; diff --git a/web/src/components/MemoDetailSidebar/MemoSharePanel.tsx b/web/src/components/MemoDetailSidebar/MemoSharePanel.tsx index b276ad696..17de1002a 100644 --- a/web/src/components/MemoDetailSidebar/MemoSharePanel.tsx +++ b/web/src/components/MemoDetailSidebar/MemoSharePanel.tsx @@ -7,7 +7,7 @@ import { Button } from "@/components/ui/button"; import { Dialog, DialogContent, DialogHeader, DialogTitle } from "@/components/ui/dialog"; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"; import { getShareUrl, useCreateMemoShare, useDeleteMemoShare, useMemoShares } from "@/hooks/useMemoShareQueries"; -import type { MemoShare } from "@/types/proto/api/v1/memo_service_pb"; +import type { MemoShare } from "@/types/proto/api/memo_service_pb"; import { useTranslate } from "@/utils/i18n"; type ExpiryOption = "never" | "1d" | "7d" | "30d"; diff --git a/web/src/components/MemoEditor/Toolbar/AudienceMenu.tsx b/web/src/components/MemoEditor/Toolbar/AudienceMenu.tsx index 815090aea..5f805b3b9 100644 --- a/web/src/components/MemoEditor/Toolbar/AudienceMenu.tsx +++ b/web/src/components/MemoEditor/Toolbar/AudienceMenu.tsx @@ -16,7 +16,7 @@ import VisibilityIcon from "@/components/VisibilityIcon"; import useCurrentUser from "@/hooks/useCurrentUser"; import { useSpaces } from "@/hooks/useSpaceQueries"; import { extractSpaceUidFromName, getDuplicateSpaceTitles } from "@/lib/space-display"; -import type { Space_Icon } from "@/types/proto/api/v1/space_service_pb"; +import type { Space_Icon } from "@/types/proto/api/space_service_pb"; import { useTranslate } from "@/utils/i18n"; import { getAssignableVisibilityOptions, getVisibilityOption } from "@/utils/memo"; import type { AudienceMenuProps } from "../types"; diff --git a/web/src/components/MemoEditor/Toolbar/EditorToolbar.tsx b/web/src/components/MemoEditor/Toolbar/EditorToolbar.tsx index c2e0d36d1..9aa9751e8 100644 --- a/web/src/components/MemoEditor/Toolbar/EditorToolbar.tsx +++ b/web/src/components/MemoEditor/Toolbar/EditorToolbar.tsx @@ -3,7 +3,7 @@ import type { FC } from "react"; import { Button } from "@/components/ui/button"; import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip"; import { cn } from "@/lib/utils"; -import { type Location, Visibility } from "@/types/proto/api/v1/memo_service_pb"; +import { type Location, Visibility } from "@/types/proto/api/memo_service_pb"; import { useTranslate } from "@/utils/i18n"; import { primaryModifierGlyph } from "@/utils/platform"; import { validationService } from "../services"; diff --git a/web/src/components/MemoEditor/Toolbar/InsertMenu.tsx b/web/src/components/MemoEditor/Toolbar/InsertMenu.tsx index 93c84c54d..58609bfdb 100644 --- a/web/src/components/MemoEditor/Toolbar/InsertMenu.tsx +++ b/web/src/components/MemoEditor/Toolbar/InsertMenu.tsx @@ -24,7 +24,7 @@ import { DropdownMenuTrigger, } from "@/components/ui/dropdown-menu"; import { useDebouncedEffect } from "@/hooks"; -import type { MemoRelation } from "@/types/proto/api/v1/memo_service_pb"; +import type { MemoRelation } from "@/types/proto/api/memo_service_pb"; import { useTranslate } from "@/utils/i18n"; import { useFileUpload, useLinkMemo, useLocation } from "../hooks"; import { useEditorContext, useEditorSelector } from "../state"; diff --git a/web/src/components/MemoEditor/hooks/useAttachmentTranscription.ts b/web/src/components/MemoEditor/hooks/useAttachmentTranscription.ts index ee7750931..673c62849 100644 --- a/web/src/components/MemoEditor/hooks/useAttachmentTranscription.ts +++ b/web/src/components/MemoEditor/hooks/useAttachmentTranscription.ts @@ -1,7 +1,7 @@ import { ConnectError } from "@connectrpc/connect"; import { useCallback, useEffect, useRef, useState } from "react"; import { toast } from "react-hot-toast"; -import type { Attachment } from "@/types/proto/api/v1/attachment_service_pb"; +import type { Attachment } from "@/types/proto/api/attachment_service_pb"; import { useTranslate } from "@/utils/i18n"; import { transcriptionService } from "../services"; diff --git a/web/src/components/MemoEditor/hooks/useAutoSave.ts b/web/src/components/MemoEditor/hooks/useAutoSave.ts index 87b87759a..1f68e6464 100644 --- a/web/src/components/MemoEditor/hooks/useAutoSave.ts +++ b/web/src/components/MemoEditor/hooks/useAutoSave.ts @@ -1,7 +1,7 @@ import { equals } from "@bufbuild/protobuf"; import { useCallback, useEffect, useRef } from "react"; -import { AttachmentSchema } from "@/types/proto/api/v1/attachment_service_pb"; -import { LocationSchema } from "@/types/proto/api/v1/memo_service_pb"; +import { AttachmentSchema } from "@/types/proto/api/attachment_service_pb"; +import { LocationSchema } from "@/types/proto/api/memo_service_pb"; import { cacheService, type EditorDraft } from "../services"; import { type EditorState, useEditorStore } from "../state"; diff --git a/web/src/components/MemoEditor/hooks/useFileUpload.ts b/web/src/components/MemoEditor/hooks/useFileUpload.ts index 35d71fe3c..2a420598b 100644 --- a/web/src/components/MemoEditor/hooks/useFileUpload.ts +++ b/web/src/components/MemoEditor/hooks/useFileUpload.ts @@ -2,7 +2,7 @@ import { create } from "@bufbuild/protobuf"; import { useRef } from "react"; import { v4 as uuidv4 } from "uuid"; import { useAuth } from "@/contexts/AuthContext"; -import { type MotionMedia, MotionMediaFamily, MotionMediaRole, MotionMediaSchema } from "@/types/proto/api/v1/attachment_service_pb"; +import { type MotionMedia, MotionMediaFamily, MotionMediaRole, MotionMediaSchema } from "@/types/proto/api/attachment_service_pb"; import { mediaMetadataService } from "../services/mediaMetadataService"; import type { LocalFile } from "../types/attachment"; import { useBlobUrls } from "./useBlobUrls"; diff --git a/web/src/components/MemoEditor/hooks/useInlineImageUpload.ts b/web/src/components/MemoEditor/hooks/useInlineImageUpload.ts index 5891edad5..ab1ae5d1c 100644 --- a/web/src/components/MemoEditor/hooks/useInlineImageUpload.ts +++ b/web/src/components/MemoEditor/hooks/useInlineImageUpload.ts @@ -2,7 +2,7 @@ import { uniqBy } from "lodash-es"; import { type RefObject, useCallback, useEffect, useRef, useState } from "react"; import { toast } from "react-hot-toast"; import { v4 as uuidv4 } from "uuid"; -import type { Attachment } from "@/types/proto/api/v1/attachment_service_pb"; +import type { Attachment } from "@/types/proto/api/attachment_service_pb"; import { isImage } from "@/utils/attachment"; import { useTranslate } from "@/utils/i18n"; import { buildManagedAttachmentMarkdown, canInlineAttachment } from "@/utils/managed-attachment"; diff --git a/web/src/components/MemoEditor/hooks/useLinkMemo.ts b/web/src/components/MemoEditor/hooks/useLinkMemo.ts index 134f1dc0d..081a2ad14 100644 --- a/web/src/components/MemoEditor/hooks/useLinkMemo.ts +++ b/web/src/components/MemoEditor/hooks/useLinkMemo.ts @@ -8,10 +8,10 @@ import { buildMemoCreatorFilter } from "@/lib/resource-names"; import { type Memo, type MemoRelation, - MemoRelation_MemoSchema, + MemoRelation_MemoRefSchema, MemoRelation_Type, MemoRelationSchema, -} from "@/types/proto/api/v1/memo_service_pb"; +} from "@/types/proto/api/memo_service_pb"; interface UseLinkMemoParams { isOpen: boolean; @@ -70,7 +70,7 @@ export const useLinkMemo = ({ isOpen, currentMemoName, existingRelations, onAddR const addMemoRelation = (memo: Memo) => { const relation = create(MemoRelationSchema, { type: MemoRelation_Type.REFERENCE, - relatedMemo: create(MemoRelation_MemoSchema, { + relatedMemo: create(MemoRelation_MemoRefSchema, { name: memo.name, snippet: memo.snippet, }), diff --git a/web/src/components/MemoEditor/hooks/useLocation.ts b/web/src/components/MemoEditor/hooks/useLocation.ts index ffed6ada0..b7e47772b 100644 --- a/web/src/components/MemoEditor/hooks/useLocation.ts +++ b/web/src/components/MemoEditor/hooks/useLocation.ts @@ -1,7 +1,7 @@ import { create } from "@bufbuild/protobuf"; import { useCallback, useMemo, useRef, useState } from "react"; import type { MapPoint } from "@/components/map/types"; -import { Location, LocationSchema } from "@/types/proto/api/v1/memo_service_pb"; +import { Location, LocationSchema } from "@/types/proto/api/memo_service_pb"; import { LocationState } from "../types/insertMenu"; export const useLocation = (initialLocation?: Location) => { diff --git a/web/src/components/MemoEditor/hooks/useMemoInit.ts b/web/src/components/MemoEditor/hooks/useMemoInit.ts index 6c185c63e..2df5eebbb 100644 --- a/web/src/components/MemoEditor/hooks/useMemoInit.ts +++ b/web/src/components/MemoEditor/hooks/useMemoInit.ts @@ -1,5 +1,5 @@ import { useEffect, useRef, useState } from "react"; -import type { Location, Memo, Visibility } from "@/types/proto/api/v1/memo_service_pb"; +import type { Location, Memo, Visibility } from "@/types/proto/api/memo_service_pb"; import { cacheService, memoService } from "../services"; import { useEditorContext } from "../state"; import type { EditorController } from "../types/editorController"; diff --git a/web/src/components/MemoEditor/hooks/useMemoSave.ts b/web/src/components/MemoEditor/hooks/useMemoSave.ts index 4919ea33b..9aa3b8ebc 100644 --- a/web/src/components/MemoEditor/hooks/useMemoSave.ts +++ b/web/src/components/MemoEditor/hooks/useMemoSave.ts @@ -6,7 +6,7 @@ import { attachmentKeys } from "@/hooks/useAttachmentQueries"; import { memoKeys } from "@/hooks/useMemoQueries"; import { userKeys } from "@/hooks/useUserQueries"; import { handleError } from "@/lib/error"; -import type { Visibility } from "@/types/proto/api/v1/memo_service_pb"; +import type { Visibility } from "@/types/proto/api/memo_service_pb"; import { useTranslate } from "@/utils/i18n"; import { errorService, memoService, validationService } from "../services"; import { useEditorContext } from "../state"; diff --git a/web/src/components/MemoEditor/index.tsx b/web/src/components/MemoEditor/index.tsx index f4f4e4644..c503c8320 100644 --- a/web/src/components/MemoEditor/index.tsx +++ b/web/src/components/MemoEditor/index.tsx @@ -5,7 +5,7 @@ import { useInstance } from "@/contexts/InstanceContext"; import { useLocalStorage } from "@/hooks"; import useCurrentUser from "@/hooks/useCurrentUser"; import { cn } from "@/lib/utils"; -import { InstanceSetting_Key } from "@/types/proto/api/v1/instance_service_pb"; +import { InstanceSetting_Key } from "@/types/proto/api/instance_service_pb"; import { useTranslate } from "@/utils/i18n"; import { convertVisibilityFromString } from "@/utils/memo"; import { canManageMemo } from "@/utils/user"; diff --git a/web/src/components/MemoEditor/services/cacheService.ts b/web/src/components/MemoEditor/services/cacheService.ts index ba6ca8d85..a152a1f65 100644 --- a/web/src/components/MemoEditor/services/cacheService.ts +++ b/web/src/components/MemoEditor/services/cacheService.ts @@ -1,8 +1,8 @@ import { fromJson, type JsonValue, toJson } from "@bufbuild/protobuf"; -import type { Attachment } from "@/types/proto/api/v1/attachment_service_pb"; -import { AttachmentSchema } from "@/types/proto/api/v1/attachment_service_pb"; +import type { Attachment } from "@/types/proto/api/attachment_service_pb"; +import { AttachmentSchema } from "@/types/proto/api/attachment_service_pb"; -import { type Location, LocationSchema, Visibility } from "@/types/proto/api/v1/memo_service_pb"; +import { type Location, LocationSchema, Visibility } from "@/types/proto/api/memo_service_pb"; export const CACHE_DEBOUNCE_DELAY = 500; diff --git a/web/src/components/MemoEditor/services/mediaMetadataService.ts b/web/src/components/MemoEditor/services/mediaMetadataService.ts index 718905437..dd733a294 100644 --- a/web/src/components/MemoEditor/services/mediaMetadataService.ts +++ b/web/src/components/MemoEditor/services/mediaMetadataService.ts @@ -6,7 +6,7 @@ import { MediaMetadataSchema, PhotoMetadataSchema, VideoMetadataSchema, -} from "@/types/proto/api/v1/attachment_service_pb"; +} from "@/types/proto/api/attachment_service_pb"; import { isImage } from "@/utils/attachment"; const EXTRACTION_TIMEOUT_MS = 5_000; diff --git a/web/src/components/MemoEditor/services/memoService.ts b/web/src/components/MemoEditor/services/memoService.ts index db46ee6f5..7509eea9f 100644 --- a/web/src/components/MemoEditor/services/memoService.ts +++ b/web/src/components/MemoEditor/services/memoService.ts @@ -3,10 +3,10 @@ import { FieldMaskSchema, timestampDate, timestampFromDate } from "@bufbuild/pro import { isEqual } from "lodash-es"; import { getEditorReferenceRelations } from "@/components/MemoMetadata/Relation/relationHelpers"; import { memoServiceClient } from "@/connect"; -import type { Attachment } from "@/types/proto/api/v1/attachment_service_pb"; -import { AttachmentSchema } from "@/types/proto/api/v1/attachment_service_pb"; -import type { Memo } from "@/types/proto/api/v1/memo_service_pb"; -import { MemoSchema } from "@/types/proto/api/v1/memo_service_pb"; +import type { Attachment } from "@/types/proto/api/attachment_service_pb"; +import { AttachmentSchema } from "@/types/proto/api/attachment_service_pb"; +import type { Memo } from "@/types/proto/api/memo_service_pb"; +import { MemoSchema } from "@/types/proto/api/memo_service_pb"; import type { EditorState } from "../state"; import { uploadService } from "./uploadService"; @@ -127,7 +127,7 @@ export const memoService = { const memo = options.parentMemoName ? await memoServiceClient.createMemoComment({ - name: options.parentMemoName, + parent: options.parentMemoName, comment: memoData, }) : await memoServiceClient.createMemo({ memo: memoData }); diff --git a/web/src/components/MemoEditor/services/transcriptionService.ts b/web/src/components/MemoEditor/services/transcriptionService.ts index 853b524cd..3ca260b16 100644 --- a/web/src/components/MemoEditor/services/transcriptionService.ts +++ b/web/src/components/MemoEditor/services/transcriptionService.ts @@ -1,11 +1,11 @@ import { create } from "@bufbuild/protobuf"; import { Code, ConnectError } from "@connectrpc/connect"; import { aiServiceClient } from "@/connect"; -import { TranscribeRequestSchema, TranscriptionAudioSchema } from "@/types/proto/api/v1/ai_service_pb"; -import type { Attachment } from "@/types/proto/api/v1/attachment_service_pb"; +import { TranscribeRequestSchema, TranscriptionAudioSchema } from "@/types/proto/api/ai_service_pb"; +import type { Attachment } from "@/types/proto/api/attachment_service_pb"; import { getAttachmentUrl } from "@/utils/attachment"; -// Mirrors maxTranscriptionAudioSizeBytes in server/api/v1/ai_service.go so an +// Mirrors maxTranscriptionAudioSizeBytes in server/api/ai_service.go so an // oversized attachment is rejected before it is downloaded, with the server's error. const MAX_AUDIO_SIZE = 25 * 1024 * 1024; diff --git a/web/src/components/MemoEditor/services/uploadService.ts b/web/src/components/MemoEditor/services/uploadService.ts index daf6cd284..7b9735d18 100644 --- a/web/src/components/MemoEditor/services/uploadService.ts +++ b/web/src/components/MemoEditor/services/uploadService.ts @@ -1,8 +1,8 @@ import { create } from "@bufbuild/protobuf"; import { Code, ConnectError } from "@connectrpc/connect"; import { attachmentServiceClient } from "@/connect"; -import type { Attachment, UploadAttachmentRequest } from "@/types/proto/api/v1/attachment_service_pb"; -import { AttachmentSchema, MotionMediaSchema, UploadAttachmentSpecSchema } from "@/types/proto/api/v1/attachment_service_pb"; +import type { Attachment, UploadAttachmentRequest } from "@/types/proto/api/attachment_service_pb"; +import { AttachmentSchema, MotionMediaSchema, UploadAttachmentSpecSchema } from "@/types/proto/api/attachment_service_pb"; import type { LocalFile } from "../types/attachment"; const DEFAULT_CHUNK_SIZE = 2 * 1024 * 1024; diff --git a/web/src/components/MemoEditor/state/types.ts b/web/src/components/MemoEditor/state/types.ts index d0b3c0e85..9cc20df2b 100644 --- a/web/src/components/MemoEditor/state/types.ts +++ b/web/src/components/MemoEditor/state/types.ts @@ -1,6 +1,6 @@ -import type { Attachment } from "@/types/proto/api/v1/attachment_service_pb"; -import type { Location, MemoRelation } from "@/types/proto/api/v1/memo_service_pb"; -import { Visibility } from "@/types/proto/api/v1/memo_service_pb"; +import type { Attachment } from "@/types/proto/api/attachment_service_pb"; +import type { Location, MemoRelation } from "@/types/proto/api/memo_service_pb"; +import { Visibility } from "@/types/proto/api/memo_service_pb"; import type { LocalFile } from "../types/attachment"; export type LoadingKey = "saving" | "uploading" | "loading" | "transcribing"; diff --git a/web/src/components/MemoEditor/types/attachment.ts b/web/src/components/MemoEditor/types/attachment.ts index d947ba006..bbc082563 100644 --- a/web/src/components/MemoEditor/types/attachment.ts +++ b/web/src/components/MemoEditor/types/attachment.ts @@ -1,5 +1,5 @@ -import type { Attachment, MediaMetadata, MotionMedia } from "@/types/proto/api/v1/attachment_service_pb"; -import { MotionMediaFamily, MotionMediaRole } from "@/types/proto/api/v1/attachment_service_pb"; +import type { Attachment, MediaMetadata, MotionMedia } from "@/types/proto/api/attachment_service_pb"; +import { MotionMediaFamily, MotionMediaRole } from "@/types/proto/api/attachment_service_pb"; import { getAttachmentThumbnailUrl, getAttachmentType, getAttachmentUrl } from "@/utils/attachment"; import { buildAttachmentVisualItems } from "@/utils/media-item"; diff --git a/web/src/components/MemoEditor/types/components.ts b/web/src/components/MemoEditor/types/components.ts index 514c6d768..be3152735 100644 --- a/web/src/components/MemoEditor/types/components.ts +++ b/web/src/components/MemoEditor/types/components.ts @@ -1,6 +1,6 @@ import type { MemoSuggestion } from "@/lib/memo-suggestions"; -import type { Attachment } from "@/types/proto/api/v1/attachment_service_pb"; -import type { Location, Memo, Visibility } from "@/types/proto/api/v1/memo_service_pb"; +import type { Attachment } from "@/types/proto/api/attachment_service_pb"; +import type { Location, Memo, Visibility } from "@/types/proto/api/memo_service_pb"; import type { EditorFileOrigin } from "../Editor/extensions"; import type { AudioRecorderStatus } from "../hooks/useAudioRecorder"; import type { LocalFile } from "./attachment"; diff --git a/web/src/components/MemoMetadata/Attachment/AttachmentCard.tsx b/web/src/components/MemoMetadata/Attachment/AttachmentCard.tsx index 1ca1ff65f..2c3a8e91f 100644 --- a/web/src/components/MemoMetadata/Attachment/AttachmentCard.tsx +++ b/web/src/components/MemoMetadata/Attachment/AttachmentCard.tsx @@ -1,5 +1,5 @@ import { cn } from "@/lib/utils"; -import type { Attachment } from "@/types/proto/api/v1/attachment_service_pb"; +import type { Attachment } from "@/types/proto/api/attachment_service_pb"; import { getAttachmentThumbnailUrl, getAttachmentType, getAttachmentUrl } from "@/utils/attachment"; interface AttachmentCardProps { diff --git a/web/src/components/MemoMetadata/Attachment/AttachmentListEditor.tsx b/web/src/components/MemoMetadata/Attachment/AttachmentListEditor.tsx index f93e44a3d..87e7eb0a9 100644 --- a/web/src/components/MemoMetadata/Attachment/AttachmentListEditor.tsx +++ b/web/src/components/MemoMetadata/Attachment/AttachmentListEditor.tsx @@ -24,7 +24,7 @@ import MetadataSection, { import PreviewImageDialog from "@/components/PreviewImageDialog"; import { Button } from "@/components/ui/button"; import { cn } from "@/lib/utils"; -import type { Attachment } from "@/types/proto/api/v1/attachment_service_pb"; +import type { Attachment } from "@/types/proto/api/attachment_service_pb"; import { formatFileSize, getFileTypeLabel } from "@/utils/format"; import { useTranslate } from "@/utils/i18n"; import { canInlineAttachment, extractAttachmentUIDFromName } from "@/utils/managed-attachment"; diff --git a/web/src/components/MemoMetadata/Attachment/AttachmentListView.tsx b/web/src/components/MemoMetadata/Attachment/AttachmentListView.tsx index 5a6881055..0741c5c05 100644 --- a/web/src/components/MemoMetadata/Attachment/AttachmentListView.tsx +++ b/web/src/components/MemoMetadata/Attachment/AttachmentListView.tsx @@ -4,7 +4,7 @@ import { useMemo } from "react"; import MotionPhotoPreview from "@/components/MotionPhotoPreview"; import VideoPoster from "@/components/VideoPoster"; import { cn } from "@/lib/utils"; -import type { Attachment } from "@/types/proto/api/v1/attachment_service_pb"; +import type { Attachment } from "@/types/proto/api/attachment_service_pb"; import { getAttachmentUrl } from "@/utils/attachment"; import type { AttachmentVisualItem, PreviewMediaItem } from "@/utils/media-item"; import { buildAttachmentVisualItems } from "@/utils/media-item"; diff --git a/web/src/components/MemoMetadata/Attachment/attachmentHelpers.ts b/web/src/components/MemoMetadata/Attachment/attachmentHelpers.ts index d5bf3c48c..622d5bab4 100644 --- a/web/src/components/MemoMetadata/Attachment/attachmentHelpers.ts +++ b/web/src/components/MemoMetadata/Attachment/attachmentHelpers.ts @@ -1,4 +1,4 @@ -import type { Attachment } from "@/types/proto/api/v1/attachment_service_pb"; +import type { Attachment } from "@/types/proto/api/attachment_service_pb"; import { getAttachmentType } from "@/utils/attachment"; import { formatFileSize, getFileTypeLabel } from "@/utils/format"; diff --git a/web/src/components/MemoMetadata/Location/LocationDisplayEditor.tsx b/web/src/components/MemoMetadata/Location/LocationDisplayEditor.tsx index 150c7e6d2..2556b213d 100644 --- a/web/src/components/MemoMetadata/Location/LocationDisplayEditor.tsx +++ b/web/src/components/MemoMetadata/Location/LocationDisplayEditor.tsx @@ -7,7 +7,7 @@ import { MetadataRowIconSlot, MetadataRowRemoveControl, } from "@/components/MemoMetadata/MetadataSection"; -import type { Location } from "@/types/proto/api/v1/memo_service_pb"; +import type { Location } from "@/types/proto/api/memo_service_pb"; import { getLocationCoordinatesText, getLocationDisplayText } from "./locationHelpers"; interface LocationDisplayEditorProps { diff --git a/web/src/components/MemoMetadata/Location/LocationDisplayView.tsx b/web/src/components/MemoMetadata/Location/LocationDisplayView.tsx index d39c4bf2b..c1c4ba943 100644 --- a/web/src/components/MemoMetadata/Location/LocationDisplayView.tsx +++ b/web/src/components/MemoMetadata/Location/LocationDisplayView.tsx @@ -3,7 +3,7 @@ import { useState } from "react"; import { METADATA_ROW_CLASSES, METADATA_ROW_TEXT_CLASSES, MetadataRowIconSlot } from "@/components/MemoMetadata/MetadataSection"; import { LazyLocationPicker } from "@/components/map/LazyLocationPicker"; import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover"; -import type { Location } from "@/types/proto/api/v1/memo_service_pb"; +import type { Location } from "@/types/proto/api/memo_service_pb"; import { getLocationCoordinatesText, getLocationDisplayText } from "./locationHelpers"; interface LocationDisplayViewProps { diff --git a/web/src/components/MemoMetadata/Location/locationHelpers.ts b/web/src/components/MemoMetadata/Location/locationHelpers.ts index 1a104f1ce..92838d6f0 100644 --- a/web/src/components/MemoMetadata/Location/locationHelpers.ts +++ b/web/src/components/MemoMetadata/Location/locationHelpers.ts @@ -1,4 +1,4 @@ -import type { Location } from "@/types/proto/api/v1/memo_service_pb"; +import type { Location } from "@/types/proto/api/memo_service_pb"; export const getLocationDisplayText = (location: Location): string => { return location.placeholder.trim() || getLocationCoordinatesText(location); diff --git a/web/src/components/MemoMetadata/MemoMetadataRows.tsx b/web/src/components/MemoMetadata/MemoMetadataRows.tsx index 2380e214a..4c1199559 100644 --- a/web/src/components/MemoMetadata/MemoMetadataRows.tsx +++ b/web/src/components/MemoMetadata/MemoMetadataRows.tsx @@ -1,7 +1,7 @@ import { useMemo } from "react"; import { useNearViewport } from "@/hooks/useNearViewport"; -import type { Attachment } from "@/types/proto/api/v1/attachment_service_pb"; -import type { Location, MemoRelation } from "@/types/proto/api/v1/memo_service_pb"; +import type { Attachment } from "@/types/proto/api/attachment_service_pb"; +import type { Location, MemoRelation } from "@/types/proto/api/memo_service_pb"; import { AttachmentRows } from "./Attachment/AttachmentListView"; import LocationDisplayView from "./Location/LocationDisplayView"; import { METADATA_ROW_LIST_CLASSES } from "./MetadataSection"; diff --git a/web/src/components/MemoMetadata/Relation/LinkMemoDialog.tsx b/web/src/components/MemoMetadata/Relation/LinkMemoDialog.tsx index 9fe2cc3ce..a86148a22 100644 --- a/web/src/components/MemoMetadata/Relation/LinkMemoDialog.tsx +++ b/web/src/components/MemoMetadata/Relation/LinkMemoDialog.tsx @@ -5,7 +5,7 @@ import { Dialog, DialogClose, DialogContent, DialogDescription, DialogTitle } fr import { Input } from "@/components/ui/input"; import { VisuallyHidden } from "@/components/ui/visually-hidden"; import { cn } from "@/lib/utils"; -import type { Memo } from "@/types/proto/api/v1/memo_service_pb"; +import type { Memo } from "@/types/proto/api/memo_service_pb"; import { useTranslate } from "@/utils/i18n"; interface LinkMemoDialogProps { diff --git a/web/src/components/MemoMetadata/Relation/RelationListEditor.tsx b/web/src/components/MemoMetadata/Relation/RelationListEditor.tsx index c375b58ba..6d73e94c1 100644 --- a/web/src/components/MemoMetadata/Relation/RelationListEditor.tsx +++ b/web/src/components/MemoMetadata/Relation/RelationListEditor.tsx @@ -1,7 +1,7 @@ import type { FC } from "react"; import { useMemo } from "react"; import MetadataSection, { METADATA_ROW_BOX_CLASSES, MetadataRowRemoveControl } from "@/components/MemoMetadata/MetadataSection"; -import type { MemoRelation } from "@/types/proto/api/v1/memo_service_pb"; +import type { MemoRelation } from "@/types/proto/api/memo_service_pb"; import { useTranslate } from "@/utils/i18n"; import RelationRow from "./RelationRow"; import { getEditorReferenceRelations } from "./relationHelpers"; diff --git a/web/src/components/MemoMetadata/Relation/RelationRow.tsx b/web/src/components/MemoMetadata/Relation/RelationRow.tsx index 02fa41acf..43053bed9 100644 --- a/web/src/components/MemoMetadata/Relation/RelationRow.tsx +++ b/web/src/components/MemoMetadata/Relation/RelationRow.tsx @@ -2,11 +2,11 @@ import { LinkIcon, type LucideIcon } from "lucide-react"; import type { ReactNode } from "react"; import { Link } from "react-router-dom"; import { createMemoNavigationState } from "@/components/MemoView/navigation"; -import type { MemoRelation_Memo } from "@/types/proto/api/v1/memo_service_pb"; +import type { MemoRelation_MemoRef } from "@/types/proto/api/memo_service_pb"; import { METADATA_ROW_CLASSES, METADATA_ROW_LABEL_CLASSES, METADATA_ROW_TEXT_CLASSES, MetadataRowIconSlot } from "../MetadataSection"; interface RelationRowProps { - memo: MemoRelation_Memo; + memo: MemoRelation_MemoRef; parentPage?: string; icon?: LucideIcon; /** diff --git a/web/src/components/MemoMetadata/Relation/RelationRows.tsx b/web/src/components/MemoMetadata/Relation/RelationRows.tsx index abfd33c13..e33eb7afd 100644 --- a/web/src/components/MemoMetadata/Relation/RelationRows.tsx +++ b/web/src/components/MemoMetadata/Relation/RelationRows.tsx @@ -1,6 +1,6 @@ import { LinkIcon, MilestoneIcon } from "lucide-react"; import { useMemo } from "react"; -import type { MemoRelation } from "@/types/proto/api/v1/memo_service_pb"; +import type { MemoRelation } from "@/types/proto/api/memo_service_pb"; import { useTranslate } from "@/utils/i18n"; import { METADATA_ROW_DETAIL_CLASSES } from "../MetadataSection"; import RelationRow from "./RelationRow"; diff --git a/web/src/components/MemoMetadata/Relation/relationHelpers.ts b/web/src/components/MemoMetadata/Relation/relationHelpers.ts index 5d0744dc5..e2913ff8a 100644 --- a/web/src/components/MemoMetadata/Relation/relationHelpers.ts +++ b/web/src/components/MemoMetadata/Relation/relationHelpers.ts @@ -1,5 +1,5 @@ -import type { MemoRelation } from "@/types/proto/api/v1/memo_service_pb"; -import { MemoRelation_Type } from "@/types/proto/api/v1/memo_service_pb"; +import type { MemoRelation } from "@/types/proto/api/memo_service_pb"; +import { MemoRelation_Type } from "@/types/proto/api/memo_service_pb"; export type RelationDirection = "referencing" | "referenced"; diff --git a/web/src/components/MemoMetadata/Relation/useResolvedRelationMemos.ts b/web/src/components/MemoMetadata/Relation/useResolvedRelationMemos.ts index 2f95cbfd9..30ce35b07 100644 --- a/web/src/components/MemoMetadata/Relation/useResolvedRelationMemos.ts +++ b/web/src/components/MemoMetadata/Relation/useResolvedRelationMemos.ts @@ -1,7 +1,7 @@ import { create } from "@bufbuild/protobuf"; import { useQueries, useQueryClient } from "@tanstack/react-query"; import { findMemoInCollectionQueries, memoDetailQueryOptions } from "@/hooks/useMemoQueries"; -import { type MemoRelation_Memo, MemoRelation_MemoSchema } from "@/types/proto/api/v1/memo_service_pb"; +import { type MemoRelation_MemoRef, MemoRelation_MemoRefSchema } from "@/types/proto/api/memo_service_pb"; export const useResolvedRelationMemos = (memoNames: string[], options?: { enabled?: boolean }) => { const client = useQueryClient(); @@ -13,11 +13,11 @@ export const useResolvedRelationMemos = (memoNames: string[], options?: { enable initialData: () => findMemoInCollectionQueries(client, name, true), })), }); - const resolved: Record = {}; + const resolved: Record = {}; queries.forEach((query, index) => { if (query.data === null) resolved[names[index]] = null; else if (query.data) { - resolved[names[index]] = create(MemoRelation_MemoSchema, { name: query.data.name, snippet: query.data.snippet }); + resolved[names[index]] = create(MemoRelation_MemoRefSchema, { name: query.data.name, snippet: query.data.snippet }); } }); return resolved; diff --git a/web/src/components/MemoPanel/MemoPanelList.tsx b/web/src/components/MemoPanel/MemoPanelList.tsx index f2d7a77fc..6cedf3e89 100644 --- a/web/src/components/MemoPanel/MemoPanelList.tsx +++ b/web/src/components/MemoPanel/MemoPanelList.tsx @@ -11,7 +11,7 @@ import { NewMemoProvider } from "@/contexts/NewMemoContext"; import { useSpaceContext } from "@/contexts/SpaceContext"; import { useView } from "@/contexts/ViewContext"; import { cn } from "@/lib/utils"; -import type { Memo } from "@/types/proto/api/v1/memo_service_pb"; +import type { Memo } from "@/types/proto/api/memo_service_pb"; import { useTranslate } from "@/utils/i18n"; // The cards' own bottom margin sets the gap; the row's edge lines up with theirs. diff --git a/web/src/components/MemoPreview/MemoPreview.tsx b/web/src/components/MemoPreview/MemoPreview.tsx index 3f5a5cdae..268770c3f 100644 --- a/web/src/components/MemoPreview/MemoPreview.tsx +++ b/web/src/components/MemoPreview/MemoPreview.tsx @@ -3,9 +3,9 @@ import { FileIcon } from "lucide-react"; import { useMemo } from "react"; import { extractMemoIdFromName } from "@/lib/resource-names"; import { cn } from "@/lib/utils"; -import type { Attachment } from "@/types/proto/api/v1/attachment_service_pb"; -import { MemoSchema } from "@/types/proto/api/v1/memo_service_pb"; -import type { User } from "@/types/proto/api/v1/user_service_pb"; +import type { Attachment } from "@/types/proto/api/attachment_service_pb"; +import { MemoSchema } from "@/types/proto/api/memo_service_pb"; +import type { User } from "@/types/proto/api/user_service_pb"; import { getAttachmentType, isMotionAttachment } from "@/utils/attachment"; import { filterInlineManagedAttachments } from "@/utils/managed-attachment"; import { buildAttachmentVisualItems, countLogicalAttachmentItems } from "@/utils/media-item"; diff --git a/web/src/components/MemoReactionListView/MemoReactionListView.tsx b/web/src/components/MemoReactionListView/MemoReactionListView.tsx index 6e5cf7312..eba4b7f95 100644 --- a/web/src/components/MemoReactionListView/MemoReactionListView.tsx +++ b/web/src/components/MemoReactionListView/MemoReactionListView.tsx @@ -1,7 +1,7 @@ import { memo } from "react"; import useCurrentUser from "@/hooks/useCurrentUser"; -import { State } from "@/types/proto/api/v1/common_pb"; -import type { Memo, Reaction } from "@/types/proto/api/v1/memo_service_pb"; +import { State } from "@/types/proto/api/common_pb"; +import type { Memo, Reaction } from "@/types/proto/api/memo_service_pb"; import { useReactionGroups } from "./hooks"; import ReactionSelector from "./ReactionSelector"; import ReactionView from "./ReactionView"; diff --git a/web/src/components/MemoReactionListView/ReactionSelector.tsx b/web/src/components/MemoReactionListView/ReactionSelector.tsx index fea26e883..8cfe5da1c 100644 --- a/web/src/components/MemoReactionListView/ReactionSelector.tsx +++ b/web/src/components/MemoReactionListView/ReactionSelector.tsx @@ -3,7 +3,7 @@ import { type ReactElement, useState } from "react"; import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover"; import { useInstance } from "@/contexts/InstanceContext"; import { cn } from "@/lib/utils"; -import type { Memo } from "@/types/proto/api/v1/memo_service_pb"; +import type { Memo } from "@/types/proto/api/memo_service_pb"; import { useTranslate } from "@/utils/i18n"; import { useReactionActions } from "./hooks"; import { REACTION_ADD_CLASSES } from "./ReactionView"; diff --git a/web/src/components/MemoReactionListView/ReactionView.tsx b/web/src/components/MemoReactionListView/ReactionView.tsx index fb905d548..3427c8f7a 100644 --- a/web/src/components/MemoReactionListView/ReactionView.tsx +++ b/web/src/components/MemoReactionListView/ReactionView.tsx @@ -2,9 +2,9 @@ import { FOCUS_VISIBLE_OUTLINE_CLASSES } from "@/components/ui/focus"; import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip"; import useCurrentUser from "@/hooks/useCurrentUser"; import { cn } from "@/lib/utils"; -import { State } from "@/types/proto/api/v1/common_pb"; -import type { Memo } from "@/types/proto/api/v1/memo_service_pb"; -import type { User } from "@/types/proto/api/v1/user_service_pb"; +import { State } from "@/types/proto/api/common_pb"; +import type { Memo } from "@/types/proto/api/memo_service_pb"; +import type { User } from "@/types/proto/api/user_service_pb"; import { formatReactionTooltip, useReactionActions } from "./hooks"; /** diff --git a/web/src/components/MemoReactionListView/hooks.ts b/web/src/components/MemoReactionListView/hooks.ts index 811ed4f42..cf9f3a1b8 100644 --- a/web/src/components/MemoReactionListView/hooks.ts +++ b/web/src/components/MemoReactionListView/hooks.ts @@ -4,8 +4,8 @@ import { useResolvedUsersByNames } from "@/components/MemoContent/MentionResolut import { memoServiceClient } from "@/connect"; import useCurrentUser from "@/hooks/useCurrentUser"; import { memoKeys } from "@/hooks/useMemoQueries"; -import type { Memo, Reaction } from "@/types/proto/api/v1/memo_service_pb"; -import type { User } from "@/types/proto/api/v1/user_service_pb"; +import type { Memo, Reaction } from "@/types/proto/api/memo_service_pb"; +import type { User } from "@/types/proto/api/user_service_pb"; export type ReactionGroup = Map; @@ -51,7 +51,7 @@ export const useReactionActions = ({ memo, onComplete }: UseReactionActionsOptio await Promise.all(reactions.map((reaction) => memoServiceClient.deleteMemoReaction({ name: reaction.name }))); } else { await memoServiceClient.upsertMemoReaction({ - name: memo.name, + parent: memo.name, reaction: { reactionType }, }); } diff --git a/web/src/components/MemoView/MemoView.tsx b/web/src/components/MemoView/MemoView.tsx index 0707461e6..3bf18aacb 100644 --- a/web/src/components/MemoView/MemoView.tsx +++ b/web/src/components/MemoView/MemoView.tsx @@ -20,7 +20,7 @@ import { useAuth } from "@/contexts/AuthContext"; import useCurrentUser from "@/hooks/useCurrentUser"; import { isMemoBlurred } from "@/lib/tag"; import { cn } from "@/lib/utils"; -import { State } from "@/types/proto/api/v1/common_pb"; +import { State } from "@/types/proto/api/common_pb"; import { lazyWithReload } from "@/utils/lazy"; import { canManageMemo } from "@/utils/user"; import { MemoBody, MemoCommentListView, MemoHeader } from "./components"; diff --git a/web/src/components/MemoView/MemoViewContext.tsx b/web/src/components/MemoView/MemoViewContext.tsx index 432692f79..a973c7869 100644 --- a/web/src/components/MemoView/MemoViewContext.tsx +++ b/web/src/components/MemoView/MemoViewContext.tsx @@ -2,9 +2,9 @@ import { timestampDate } from "@bufbuild/protobuf/wkt"; import { createContext, useContext } from "react"; import { useLocation } from "react-router-dom"; import { useView } from "@/contexts/ViewContext"; -import type { Memo } from "@/types/proto/api/v1/memo_service_pb"; -import { MemoRelation_Type } from "@/types/proto/api/v1/memo_service_pb"; -import type { User } from "@/types/proto/api/v1/user_service_pb"; +import type { Memo } from "@/types/proto/api/memo_service_pb"; +import { MemoRelation_Type } from "@/types/proto/api/memo_service_pb"; +import type { User } from "@/types/proto/api/user_service_pb"; import type { PreviewMediaItem } from "@/utils/media-item"; import { RELATIVE_TIME_THRESHOLD_MS } from "./constants"; import { isMemoDetailPath } from "./navigation"; diff --git a/web/src/components/MemoView/components/MemoCommentListView.tsx b/web/src/components/MemoView/components/MemoCommentListView.tsx index 53b621dc8..d9ab7d0ce 100644 --- a/web/src/components/MemoView/components/MemoCommentListView.tsx +++ b/web/src/components/MemoView/components/MemoCommentListView.tsx @@ -37,7 +37,7 @@ const MemoCommentListView: React.FC = () => { enabled: isNearViewport && !isInMemoDetailPage && commentAmount > 0, pageSize: 3, }); - const comments = data?.memos ?? []; + const comments = data?.comments ?? []; const displayedComments = comments.slice(0, 3); const { data: commentCreators } = useUsersByNames(displayedComments.map((comment) => comment.creator)); diff --git a/web/src/components/MemoView/components/MemoHeader.tsx b/web/src/components/MemoView/components/MemoHeader.tsx index 7f5773731..a5c4f19ff 100644 --- a/web/src/components/MemoView/components/MemoHeader.tsx +++ b/web/src/components/MemoView/components/MemoHeader.tsx @@ -7,8 +7,8 @@ import { useNewMemo } from "@/contexts/NewMemoContext"; import i18n from "@/i18n"; import { cn } from "@/lib/utils"; import { getCreatorHomePath } from "@/router/routes"; -import { Visibility } from "@/types/proto/api/v1/memo_service_pb"; -import type { User } from "@/types/proto/api/v1/user_service_pb"; +import { Visibility } from "@/types/proto/api/memo_service_pb"; +import type { User } from "@/types/proto/api/user_service_pb"; import { useTranslate } from "@/utils/i18n"; import { getVisibilityOption } from "@/utils/memo"; import MemoActionMenu from "../../MemoActionMenu"; diff --git a/web/src/components/MemoView/types.ts b/web/src/components/MemoView/types.ts index 93a174c62..cb5f387c7 100644 --- a/web/src/components/MemoView/types.ts +++ b/web/src/components/MemoView/types.ts @@ -1,4 +1,4 @@ -import type { Memo } from "@/types/proto/api/v1/memo_service_pb"; +import type { Memo } from "@/types/proto/api/memo_service_pb"; /** How the header names the memo's time: relative to now, or just the clock time for lists that already name the day. */ export type MemoTimeDisplay = "relative" | "time"; diff --git a/web/src/components/MemoViewIcon.tsx b/web/src/components/MemoViewIcon.tsx index 3d1ec3d70..d8a0a074d 100644 --- a/web/src/components/MemoViewIcon.tsx +++ b/web/src/components/MemoViewIcon.tsx @@ -1,6 +1,6 @@ import { ParenthesesIcon } from "lucide-react"; import CustomIcon from "@/components/CustomIcon"; -import type { MemoView_Icon } from "@/types/proto/api/v1/user_service_pb"; +import type { MemoView_Icon } from "@/types/proto/api/user_service_pb"; const MemoViewIcon = ({ icon, className }: { icon?: MemoView_Icon; className?: string }) => ( diff --git a/web/src/components/PagedMemoList/PagedMemoList.tsx b/web/src/components/PagedMemoList/PagedMemoList.tsx index 4c6596d22..8e05d2787 100644 --- a/web/src/components/PagedMemoList/PagedMemoList.tsx +++ b/web/src/components/PagedMemoList/PagedMemoList.tsx @@ -13,8 +13,8 @@ import { hoistMemoToFront } from "@/hooks/useMemoSorting"; import { combineCELFilters } from "@/lib/cel-filter"; import { DEFAULT_LIST_MEMOS_PAGE_SIZE, LOADING_INDICATOR_DELAY_MS } from "@/lib/constants"; import { cn } from "@/lib/utils"; -import { State } from "@/types/proto/api/v1/common_pb"; -import type { Memo } from "@/types/proto/api/v1/memo_service_pb"; +import { State } from "@/types/proto/api/common_pb"; +import type { Memo } from "@/types/proto/api/memo_service_pb"; import { useTranslate } from "@/utils/i18n"; import ColumnGrid, { ColumnGridUntrappedProvider, columnCountForWidth, GRID_GAP } from "../ColumnGrid"; import MemoFilters from "../MemoFilters"; diff --git a/web/src/components/PagedMemoList/memoCardHeight.ts b/web/src/components/PagedMemoList/memoCardHeight.ts index 0afc5dcdf..a8033ebb1 100644 --- a/web/src/components/PagedMemoList/memoCardHeight.ts +++ b/web/src/components/PagedMemoList/memoCardHeight.ts @@ -1,7 +1,7 @@ import { CLAMP_PREVIEW_HEIGHT_PX, CLAMP_TRIGGER_HEIGHT_PX } from "@/components/ClampedSection"; -import type { Attachment } from "@/types/proto/api/v1/attachment_service_pb"; -import type { Memo } from "@/types/proto/api/v1/memo_service_pb"; -import { MemoRelation_Type } from "@/types/proto/api/v1/memo_service_pb"; +import type { Attachment } from "@/types/proto/api/attachment_service_pb"; +import type { Memo } from "@/types/proto/api/memo_service_pb"; +import { MemoRelation_Type } from "@/types/proto/api/memo_service_pb"; import { getAttachmentType, isMotionAttachment } from "@/utils/attachment"; import { filterInlineManagedAttachments } from "@/utils/managed-attachment"; import { buildAttachmentVisualItems } from "@/utils/media-item"; diff --git a/web/src/components/PasswordSignInForm.tsx b/web/src/components/PasswordSignInForm.tsx index 6aefcc9bd..5d458283b 100644 --- a/web/src/components/PasswordSignInForm.tsx +++ b/web/src/components/PasswordSignInForm.tsx @@ -52,7 +52,7 @@ function PasswordSignInForm({ redirectPath }: PasswordSignInFormProps) { ); // Store access token from login response if (response.accessToken) { - setAccessToken(response.accessToken, response.accessTokenExpiresAt ? timestampDate(response.accessTokenExpiresAt) : undefined); + setAccessToken(response.accessToken, response.accessTokenExpireTime ? timestampDate(response.accessTokenExpireTime) : undefined); } await initialize(); navigateTo(redirectPath || ROUTES.HOME, { replace: true }); diff --git a/web/src/components/Settings/AISection.tsx b/web/src/components/Settings/AISection.tsx index 3265cc90b..e1a8221f9 100644 --- a/web/src/components/Settings/AISection.tsx +++ b/web/src/components/Settings/AISection.tsx @@ -22,7 +22,7 @@ import { InstanceSetting_TranscriptionConfig, InstanceSetting_TranscriptionConfigSchema, InstanceSettingSchema, -} from "@/types/proto/api/v1/instance_service_pb"; +} from "@/types/proto/api/instance_service_pb"; import { useTranslate } from "@/utils/i18n"; import SettingGroup from "./SettingGroup"; import { SettingPanel } from "./SettingList"; diff --git a/web/src/components/Settings/AccessTokenSection.tsx b/web/src/components/Settings/AccessTokenSection.tsx index 43bce8665..c6f2a9891 100644 --- a/web/src/components/Settings/AccessTokenSection.tsx +++ b/web/src/components/Settings/AccessTokenSection.tsx @@ -11,7 +11,7 @@ import useCurrentUser from "@/hooks/useCurrentUser"; import { useDialog } from "@/hooks/useDialog"; import { WEB_CLIPPER_URL } from "@/lib/constants"; import { handleError } from "@/lib/error"; -import { CreatePersonalAccessTokenResponse, PersonalAccessToken } from "@/types/proto/api/v1/user_service_pb"; +import { CreatePersonalAccessTokenResponse, PersonalAccessToken } from "@/types/proto/api/user_service_pb"; import { useTranslate } from "@/utils/i18n"; import CreateAccessTokenDialog from "../CreateAccessTokenDialog"; import SettingSection from "./SettingSection"; @@ -20,7 +20,7 @@ const EXPIRING_SOON_MS = 30 * 24 * 60 * 60 * 1000; const ApiUsageExample = () => { const t = useTranslate(); - const example = `curl ${window.location.origin}/api/v1/memos \\\n -H "Authorization: Bearer memos_pat_..."`; + const example = `curl ${window.location.origin}/api/memos \\\n -H "Authorization: Bearer memos_pat_..."`; const handleCopy = () => { copy(example); @@ -61,8 +61,8 @@ const listAccessTokens = async (parent: string) => { const { personalAccessTokens } = await userServiceClient.listPersonalAccessTokens({ parent }); return personalAccessTokens.sort( (a, b) => - ((b.createdAt ? timestampDate(b.createdAt) : undefined)?.getTime() ?? 0) - - ((a.createdAt ? timestampDate(a.createdAt) : undefined)?.getTime() ?? 0), + ((b.createTime ? timestampDate(b.createTime) : undefined)?.getTime() ?? 0) - + ((a.createTime ? timestampDate(a.createTime) : undefined)?.getTime() ?? 0), ); }; @@ -160,8 +160,8 @@ const EmptyState = ({ onCreate }: { onCreate: () => void }) => { const TokenRow = ({ token, onDelete }: { token: PersonalAccessToken; onDelete: (token: PersonalAccessToken) => void }) => { const t = useTranslate(); - const lastUsedAt = token.lastUsedAt ? timestampDate(token.lastUsedAt) : undefined; - const expiresAt = token.expiresAt ? timestampDate(token.expiresAt) : undefined; + const lastUsedAt = token.lastUseTime ? timestampDate(token.lastUseTime) : undefined; + const expiresAt = token.expireTime ? timestampDate(token.expireTime) : undefined; const status = getTokenStatus(lastUsedAt, expiresAt); return ( diff --git a/web/src/components/Settings/InstanceSection.tsx b/web/src/components/Settings/InstanceSection.tsx index c1d9d3a76..d2fd34510 100644 --- a/web/src/components/Settings/InstanceSection.tsx +++ b/web/src/components/Settings/InstanceSection.tsx @@ -8,7 +8,7 @@ import { Switch } from "@/components/ui/switch"; import { identityProviderServiceClient } from "@/connect"; import { useInstance } from "@/contexts/InstanceContext"; import useDialog from "@/hooks/useDialog"; -import { IdentityProvider } from "@/types/proto/api/v1/idp_service_pb"; +import { IdentityProvider } from "@/types/proto/api/idp_service_pb"; import { InstanceAccessMode, InstanceSetting_AccessSetting, @@ -17,7 +17,7 @@ import { InstanceSetting_GeneralSettingSchema, InstanceSetting_Key, InstanceSettingSchema, -} from "@/types/proto/api/v1/instance_service_pb"; +} from "@/types/proto/api/instance_service_pb"; import { useTranslate } from "@/utils/i18n"; import UpdateCustomizedProfileDialog from "../UpdateCustomizedProfileDialog"; import SettingGroup from "./SettingGroup"; diff --git a/web/src/components/Settings/InviteSpaceMemberDialog.tsx b/web/src/components/Settings/InviteSpaceMemberDialog.tsx index f7a0295b4..918e13b01 100644 --- a/web/src/components/Settings/InviteSpaceMemberDialog.tsx +++ b/web/src/components/Settings/InviteSpaceMemberDialog.tsx @@ -12,7 +12,7 @@ import { useCreateSpaceInvitation } from "@/hooks/useSpaceQueries"; import { useUsersByUsernames } from "@/hooks/useUserQueries"; import { handleError } from "@/lib/error"; import { extractSpaceUidFromName } from "@/lib/space-display"; -import { type Space, SpaceInvitationSchema, SpaceMember_Role } from "@/types/proto/api/v1/space_service_pb"; +import { type Space, SpaceInvitationSchema, SpaceMember_Role } from "@/types/proto/api/space_service_pb"; import { useTranslate } from "@/utils/i18n"; const LOOKUP_DELAY_MS = 300; diff --git a/web/src/components/Settings/LinkedIdentitySection.tsx b/web/src/components/Settings/LinkedIdentitySection.tsx index 344ec71af..7c5f21295 100644 --- a/web/src/components/Settings/LinkedIdentitySection.tsx +++ b/web/src/components/Settings/LinkedIdentitySection.tsx @@ -8,8 +8,8 @@ import { identityProviderServiceClient, userServiceClient } from "@/connect"; import useCurrentUser from "@/hooks/useCurrentUser"; import { absolutifyLink } from "@/lib/browser"; import { handleError } from "@/lib/error"; -import { IdentityProvider, IdentityProvider_Type } from "@/types/proto/api/v1/idp_service_pb"; -import { LinkedIdentity } from "@/types/proto/api/v1/user_service_pb"; +import { IdentityProvider, IdentityProvider_Type } from "@/types/proto/api/idp_service_pb"; +import { LinkedIdentity } from "@/types/proto/api/user_service_pb"; import { useTranslate } from "@/utils/i18n"; import { storeOAuthState } from "@/utils/oauth"; import SettingGroup from "./SettingGroup"; @@ -20,7 +20,7 @@ interface LinkedIdentityRow extends Record { providerUid: string; title: string; typeLabel: string; - externUid: string; + externalUid: string; isLinked: boolean; linkedIdentity?: LinkedIdentity; identityProvider: IdentityProvider; @@ -63,8 +63,8 @@ const LinkedIdentitySection = () => { const linkedIdentityByProviderName = useMemo(() => { const mapping = new Map(); for (const linkedIdentity of linkedIdentityList) { - if (!mapping.has(linkedIdentity.idpName)) { - mapping.set(linkedIdentity.idpName, linkedIdentity); + if (!mapping.has(linkedIdentity.identityProvider)) { + mapping.set(linkedIdentity.identityProvider, linkedIdentity); } } return mapping; @@ -79,7 +79,7 @@ const LinkedIdentitySection = () => { providerUid: getSSOProviderUid(identityProvider.name), title: identityProvider.title, typeLabel: getIdentityProviderTypeLabel(identityProvider.type), - externUid: linkedIdentity?.externUid ?? "", + externalUid: linkedIdentity?.externalUid ?? "", isLinked: !!linkedIdentity, linkedIdentity, identityProvider, @@ -163,7 +163,7 @@ const LinkedIdentitySection = () => { ), }, { - key: "externUid", + key: "externalUid", header: t("setting.sso.account"), render: (_, row: LinkedIdentityRow) => (
@@ -171,8 +171,8 @@ const LinkedIdentitySection = () => { {row.isLinked ? t("setting.sso.linked") : t("setting.sso.not-linked")} - {row.isLinked && row.externUid ? ( - + {row.isLinked && row.externalUid ? ( + ) : null}

diff --git a/web/src/components/Settings/MemberSection.tsx b/web/src/components/Settings/MemberSection.tsx index aa18fd940..4b41d90fb 100644 --- a/web/src/components/Settings/MemberSection.tsx +++ b/web/src/components/Settings/MemberSection.tsx @@ -14,8 +14,8 @@ import useCurrentUser from "@/hooks/useCurrentUser"; import { useDialog } from "@/hooks/useDialog"; import { useDeleteUser, useListUsers } from "@/hooks/useUserQueries"; import { handleError } from "@/lib/error"; -import { State } from "@/types/proto/api/v1/common_pb"; -import { User, User_Role } from "@/types/proto/api/v1/user_service_pb"; +import { State } from "@/types/proto/api/common_pb"; +import { User, User_Role } from "@/types/proto/api/user_service_pb"; import { useTranslate } from "@/utils/i18n"; import CreateUserDialog from "../CreateUserDialog"; import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "../ui/dropdown-menu"; diff --git a/web/src/components/Settings/MemoExportSection.tsx b/web/src/components/Settings/MemoExportSection.tsx index f3ba131f5..083ffa2f4 100644 --- a/web/src/components/Settings/MemoExportSection.tsx +++ b/web/src/components/Settings/MemoExportSection.tsx @@ -10,8 +10,8 @@ import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group"; import useCurrentUser from "@/hooks/useCurrentUser"; import { getErrorMessage } from "@/lib/error"; import { exportMemos, importStagedMemos, type StagedMemoImport, stageMemoImport } from "@/lib/memo-export"; -import type { MemoImportIssue, MemoImportReport } from "@/types/proto/api/v1/user_service_pb"; -import { ImportMemosRequest_ConflictPolicy } from "@/types/proto/api/v1/user_service_pb"; +import type { ImportMemosIssue, ImportMemosReport } from "@/types/proto/api/user_service_pb"; +import { ImportMemosRequest_ConflictPolicy } from "@/types/proto/api/user_service_pb"; import { useTranslate } from "@/utils/i18n"; import SettingGroup from "./SettingGroup"; import { SettingList, SettingListItem, StatRow } from "./SettingList"; @@ -41,14 +41,14 @@ const POLICIES = [ type ImportStage = | { kind: "idle" } | { kind: "review"; file: File; staged: StagedMemoImport; policy: ImportMemosRequest_ConflictPolicy } - | { kind: "done"; report: MemoImportReport }; + | { kind: "done"; report: ImportMemosReport }; -const IssueList = ({ issues, tone }: { issues: MemoImportIssue[]; tone: "warning" | "failure" }) => { +const IssueList = ({ issues, tone }: { issues: ImportMemosIssue[]; tone: "warning" | "failure" }) => { if (issues.length === 0) return null; return (

    {issues.map((issue, index) => ( -
  • {issue.memo ? `${issue.memo}: ${issue.message}` : issue.message}
  • +
  • {issue.memoUid ? `${issue.memoUid}: ${issue.message}` : issue.message}
  • ))}
); @@ -153,8 +153,8 @@ const MemoExportSection = () => { stage.staged.plan.exportTime ? dayjs(timestampDate(stage.staged.plan.exportTime)).format("YYYY-MM-DD HH:mm") : "" }`} /> - - + + @@ -190,7 +190,9 @@ const MemoExportSection = () => { {t("common.cancel")} diff --git a/web/src/components/Settings/MemoRelatedSettings.tsx b/web/src/components/Settings/MemoRelatedSettings.tsx index 0060d6e8d..9181ccbe5 100644 --- a/web/src/components/Settings/MemoRelatedSettings.tsx +++ b/web/src/components/Settings/MemoRelatedSettings.tsx @@ -13,7 +13,7 @@ import { InstanceSetting_MemoRelatedSetting, InstanceSetting_MemoRelatedSettingSchema, InstanceSettingSchema, -} from "@/types/proto/api/v1/instance_service_pb"; +} from "@/types/proto/api/instance_service_pb"; import { useTranslate } from "@/utils/i18n"; import SettingGroup from "./SettingGroup"; import { SettingList, SettingListItem, SettingPanel } from "./SettingList"; diff --git a/web/src/components/Settings/NotificationSection.tsx b/web/src/components/Settings/NotificationSection.tsx index 414ccb5af..f2aaf0637 100644 --- a/web/src/components/Settings/NotificationSection.tsx +++ b/web/src/components/Settings/NotificationSection.tsx @@ -19,7 +19,7 @@ import { InstanceSetting_NotificationSettingSchema, InstanceSettingSchema, TestInstanceEmailSettingRequestSchema, -} from "@/types/proto/api/v1/instance_service_pb"; +} from "@/types/proto/api/instance_service_pb"; import { useTranslate } from "@/utils/i18n"; import SettingGroup from "./SettingGroup"; import SettingRow from "./SettingRow"; diff --git a/web/src/components/Settings/PreferencesSection.tsx b/web/src/components/Settings/PreferencesSection.tsx index 8b64a4d98..07028a85a 100644 --- a/web/src/components/Settings/PreferencesSection.tsx +++ b/web/src/components/Settings/PreferencesSection.tsx @@ -4,7 +4,7 @@ import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@ import { Switch } from "@/components/ui/switch"; import { useAuth } from "@/contexts/AuthContext"; import { useUpdateUserGeneralSetting } from "@/hooks/useUserQueries"; -import { UserSetting_GeneralSetting, UserSetting_GeneralSettingSchema } from "@/types/proto/api/v1/user_service_pb"; +import { UserSetting_GeneralSetting, UserSetting_GeneralSettingSchema } from "@/types/proto/api/user_service_pb"; import { loadLocale, useTranslate } from "@/utils/i18n"; import { convertVisibilityFromString, DEFAULT_VISIBILITY_OPTIONS } from "@/utils/memo"; import { loadTheme } from "@/utils/theme"; diff --git a/web/src/components/Settings/SSOSection.tsx b/web/src/components/Settings/SSOSection.tsx index 16d164cc8..5cf725e84 100644 --- a/web/src/components/Settings/SSOSection.tsx +++ b/web/src/components/Settings/SSOSection.tsx @@ -15,7 +15,7 @@ import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigge import { identityProviderServiceClient } from "@/connect"; import { useDialog } from "@/hooks/useDialog"; import { handleError } from "@/lib/error"; -import { IdentityProvider } from "@/types/proto/api/v1/idp_service_pb"; +import { IdentityProvider } from "@/types/proto/api/idp_service_pb"; import { useTranslate } from "@/utils/i18n"; import CreateIdentityProviderDialog from "../CreateIdentityProviderDialog"; import LearnMore from "../LearnMore"; diff --git a/web/src/components/Settings/SpacesSection.tsx b/web/src/components/Settings/SpacesSection.tsx index cc2e1756f..9ac970918 100644 --- a/web/src/components/Settings/SpacesSection.tsx +++ b/web/src/components/Settings/SpacesSection.tsx @@ -47,8 +47,8 @@ import { handleError } from "@/lib/error"; import { extractUsernameFromName } from "@/lib/resource-names"; import { extractSpaceUidFromName } from "@/lib/space-display"; import { ROUTES } from "@/router/routes"; -import { type Space, type SpaceInvitation, type SpaceMember, SpaceMember_Role } from "@/types/proto/api/v1/space_service_pb"; -import type { User } from "@/types/proto/api/v1/user_service_pb"; +import { type Space, type SpaceInvitation, type SpaceMember, SpaceMember_Role } from "@/types/proto/api/space_service_pb"; +import type { User } from "@/types/proto/api/user_service_pb"; import { useTranslate } from "@/utils/i18n"; type DetailTab = "general" | "members"; diff --git a/web/src/components/Settings/StorageSection.tsx b/web/src/components/Settings/StorageSection.tsx index 5fa5d175e..872048a01 100644 --- a/web/src/components/Settings/StorageSection.tsx +++ b/web/src/components/Settings/StorageSection.tsx @@ -22,7 +22,7 @@ import { InstanceSetting_StorageSettingSchema, InstanceSetting_StorageType, InstanceSettingSchema, -} from "@/types/proto/api/v1/instance_service_pb"; +} from "@/types/proto/api/instance_service_pb"; import { useTranslate } from "@/utils/i18n"; import SettingGroup from "./SettingGroup"; import { SettingPanel } from "./SettingList"; diff --git a/web/src/components/Settings/TagsSection.tsx b/web/src/components/Settings/TagsSection.tsx index 5771f4833..f821eccfe 100644 --- a/web/src/components/Settings/TagsSection.tsx +++ b/web/src/components/Settings/TagsSection.tsx @@ -18,7 +18,7 @@ import { UserSetting_TagMetadataSchema, UserSetting_TagsSettingSchema, UserSettingSchema, -} from "@/types/proto/api/v1/user_service_pb"; +} from "@/types/proto/api/user_service_pb"; import { ColorSchema } from "@/types/proto/google/type/color_pb"; import { useTranslate } from "@/utils/i18n"; import SettingGroup from "./SettingGroup"; diff --git a/web/src/components/Settings/WebhookSection.tsx b/web/src/components/Settings/WebhookSection.tsx index af7cbb315..82e7e975d 100644 --- a/web/src/components/Settings/WebhookSection.tsx +++ b/web/src/components/Settings/WebhookSection.tsx @@ -5,7 +5,7 @@ import ConfirmDialog from "@/components/ConfirmDialog"; import { Button } from "@/components/ui/button"; import { userServiceClient } from "@/connect"; import useCurrentUser from "@/hooks/useCurrentUser"; -import { UserWebhook } from "@/types/proto/api/v1/user_service_pb"; +import { UserWebhook } from "@/types/proto/api/user_service_pb"; import { useTranslate } from "@/utils/i18n"; import CreateWebhookDialog from "../CreateWebhookDialog"; import LearnMore from "../LearnMore"; diff --git a/web/src/components/Settings/settingSections.ts b/web/src/components/Settings/settingSections.ts index 5387dce61..897135dbd 100644 --- a/web/src/components/Settings/settingSections.ts +++ b/web/src/components/Settings/settingSections.ts @@ -32,7 +32,7 @@ import SSOSection from "@/components/Settings/SSOSection"; import StorageSection from "@/components/Settings/StorageSection"; import TagsSection from "@/components/Settings/TagsSection"; import WebhookSection from "@/components/Settings/WebhookSection"; -import { InstanceSetting_Key } from "@/types/proto/api/v1/instance_service_pb"; +import { InstanceSetting_Key } from "@/types/proto/api/instance_service_pb"; export type SettingSectionKey = | "my-account" diff --git a/web/src/components/Settings/sso-display.ts b/web/src/components/Settings/sso-display.ts index 86e5d63bd..a378f0b54 100644 --- a/web/src/components/Settings/sso-display.ts +++ b/web/src/components/Settings/sso-display.ts @@ -1,5 +1,5 @@ import { extractIdentityProviderUidFromName } from "@/lib/resource-names"; -import { type FieldMapping, type IdentityProvider, IdentityProvider_Type, type OAuth2Config } from "@/types/proto/api/v1/idp_service_pb"; +import { type FieldMapping, type IdentityProvider, IdentityProvider_Type, type OAuth2Config } from "@/types/proto/api/idp_service_pb"; import type { Translations } from "@/utils/i18n"; type Translate = (key: Translations, params?: Record) => string; diff --git a/web/src/components/Settings/useInstanceSettingUpdater.ts b/web/src/components/Settings/useInstanceSettingUpdater.ts index 6c5777b54..dad108d2a 100644 --- a/web/src/components/Settings/useInstanceSettingUpdater.ts +++ b/web/src/components/Settings/useInstanceSettingUpdater.ts @@ -2,7 +2,7 @@ import { useCallback } from "react"; import { toast } from "react-hot-toast"; import { useInstance } from "@/contexts/InstanceContext"; import { handleError } from "@/lib/error"; -import { InstanceSetting, InstanceSetting_Key } from "@/types/proto/api/v1/instance_service_pb"; +import { InstanceSetting, InstanceSetting_Key } from "@/types/proto/api/instance_service_pb"; import { useTranslate } from "@/utils/i18n"; interface SaveInstanceSettingOptions { diff --git a/web/src/components/SpaceIcon.tsx b/web/src/components/SpaceIcon.tsx index a3b40c154..74fa2656e 100644 --- a/web/src/components/SpaceIcon.tsx +++ b/web/src/components/SpaceIcon.tsx @@ -1,6 +1,6 @@ import CustomIcon from "@/components/CustomIcon"; import { cn } from "@/lib/utils"; -import type { Space_Icon } from "@/types/proto/api/v1/space_service_pb"; +import type { Space_Icon } from "@/types/proto/api/space_service_pb"; // Emoji need an explicit font size as well as a box, unlike SVG icons. const ICON_SIZE = { diff --git a/web/src/components/SpaceIconPicker.tsx b/web/src/components/SpaceIconPicker.tsx index 57b2c8fe8..47e3e271a 100644 --- a/web/src/components/SpaceIconPicker.tsx +++ b/web/src/components/SpaceIconPicker.tsx @@ -1,6 +1,6 @@ import { create } from "@bufbuild/protobuf"; import CustomIconPicker from "@/components/CustomIconPicker"; -import { type Space_Icon, Space_IconSchema } from "@/types/proto/api/v1/space_service_pb"; +import { type Space_Icon, Space_IconSchema } from "@/types/proto/api/space_service_pb"; import { useTranslate } from "@/utils/i18n"; interface Props { diff --git a/web/src/components/SpaceMark.tsx b/web/src/components/SpaceMark.tsx index 0fefc63f5..abd8fbf31 100644 --- a/web/src/components/SpaceMark.tsx +++ b/web/src/components/SpaceMark.tsx @@ -1,6 +1,6 @@ import SpaceIcon from "@/components/SpaceIcon"; import { cn } from "@/lib/utils"; -import type { Space_Icon } from "@/types/proto/api/v1/space_service_pb"; +import type { Space_Icon } from "@/types/proto/api/space_service_pb"; const MARK_SCALE = { xl: { mark: "size-11 rounded-lg", icon: 24, emoji: "text-2xl" }, diff --git a/web/src/components/SpaceRoleBadge.tsx b/web/src/components/SpaceRoleBadge.tsx index feae28088..9b0757a8d 100644 --- a/web/src/components/SpaceRoleBadge.tsx +++ b/web/src/components/SpaceRoleBadge.tsx @@ -1,5 +1,5 @@ import { Badge } from "@/components/ui/badge"; -import { SpaceMember_Role } from "@/types/proto/api/v1/space_service_pb"; +import { SpaceMember_Role } from "@/types/proto/api/space_service_pb"; import { useTranslate } from "@/utils/i18n"; const SpaceRoleBadge = ({ role }: { role: SpaceMember_Role }) => { diff --git a/web/src/components/SpaceSelectItem.tsx b/web/src/components/SpaceSelectItem.tsx index 225960906..92a198d78 100644 --- a/web/src/components/SpaceSelectItem.tsx +++ b/web/src/components/SpaceSelectItem.tsx @@ -1,7 +1,7 @@ import SpaceMark from "@/components/SpaceMark"; import { SelectItem } from "@/components/ui/select"; import { cn } from "@/lib/utils"; -import type { Space_Icon } from "@/types/proto/api/v1/space_service_pb"; +import type { Space_Icon } from "@/types/proto/api/space_service_pb"; interface Props { value: string; diff --git a/web/src/components/UpdateCustomizedProfileDialog.tsx b/web/src/components/UpdateCustomizedProfileDialog.tsx index d3eae2fef..6f2c99553 100644 --- a/web/src/components/UpdateCustomizedProfileDialog.tsx +++ b/web/src/components/UpdateCustomizedProfileDialog.tsx @@ -14,7 +14,7 @@ import { InstanceSetting_GeneralSetting_CustomProfileSchema, InstanceSetting_Key, InstanceSettingSchema, -} from "@/types/proto/api/v1/instance_service_pb"; +} from "@/types/proto/api/instance_service_pb"; import { useTranslate } from "@/utils/i18n"; interface Props { diff --git a/web/src/components/UserMenu.tsx b/web/src/components/UserMenu.tsx index d135044af..6b48ec940 100644 --- a/web/src/components/UserMenu.tsx +++ b/web/src/components/UserMenu.tsx @@ -29,7 +29,7 @@ import { useNotifications, useUpdateUserGeneralSetting } from "@/hooks/useUserQu import { locales } from "@/i18n"; import { cn } from "@/lib/utils"; import { Routes } from "@/router"; -import { UserNotification_Status } from "@/types/proto/api/v1/user_service_pb"; +import { UserNotification_Status } from "@/types/proto/api/user_service_pb"; import { getLocaleDisplayName, getLocaleWithFallback, loadLocale, useTranslate } from "@/utils/i18n"; import { getThemeWithFallback, loadTheme, THEME_OPTIONS } from "@/utils/theme"; diff --git a/web/src/components/VisibilityIcon.tsx b/web/src/components/VisibilityIcon.tsx index aa387ef9a..ecf8aae3d 100644 --- a/web/src/components/VisibilityIcon.tsx +++ b/web/src/components/VisibilityIcon.tsx @@ -1,5 +1,5 @@ import { cn } from "@/lib/utils"; -import type { Visibility } from "@/types/proto/api/v1/memo_service_pb"; +import type { Visibility } from "@/types/proto/api/memo_service_pb"; import { getVisibilityOption } from "@/utils/memo"; interface Props { diff --git a/web/src/connect.ts b/web/src/connect.ts index 2d20e7dc4..8176d4684 100644 --- a/web/src/connect.ts +++ b/web/src/connect.ts @@ -2,14 +2,14 @@ import { timestampDate } from "@bufbuild/protobuf/wkt"; import { Code, ConnectError, createClient, type Interceptor } from "@connectrpc/connect"; import { createConnectTransport } from "@connectrpc/connect-web"; import { getAccessToken, hasStoredToken, isTokenExpired, REQUEST_TOKEN_EXPIRY_BUFFER_MS, setAccessToken } from "./auth-state"; -import { AIService } from "./types/proto/api/v1/ai_service_pb"; -import { AttachmentService } from "./types/proto/api/v1/attachment_service_pb"; -import { AuthService } from "./types/proto/api/v1/auth_service_pb"; -import { IdentityProviderService } from "./types/proto/api/v1/idp_service_pb"; -import { InstanceService } from "./types/proto/api/v1/instance_service_pb"; -import { MemoService } from "./types/proto/api/v1/memo_service_pb"; -import { SpaceService } from "./types/proto/api/v1/space_service_pb"; -import { UserService } from "./types/proto/api/v1/user_service_pb"; +import { AIService } from "./types/proto/api/ai_service_pb"; +import { AttachmentService } from "./types/proto/api/attachment_service_pb"; +import { AuthService } from "./types/proto/api/auth_service_pb"; +import { IdentityProviderService } from "./types/proto/api/idp_service_pb"; +import { InstanceService } from "./types/proto/api/instance_service_pb"; +import { MemoService } from "./types/proto/api/memo_service_pb"; +import { SpaceService } from "./types/proto/api/space_service_pb"; +import { UserService } from "./types/proto/api/user_service_pb"; import { redirectOnAuthFailure } from "./utils/auth-redirect"; interface RequestWithHeader { @@ -78,7 +78,7 @@ async function doRefreshAccessToken(): Promise { throw new ConnectError("Refresh token response missing access token", Code.Internal); } - const expiresAt = response.expiresAt ? timestampDate(response.expiresAt) : undefined; + const expiresAt = response.accessTokenExpireTime ? timestampDate(response.accessTokenExpireTime) : undefined; setAccessToken(response.accessToken, expiresAt); } diff --git a/web/src/contexts/AppSidebarContext.tsx b/web/src/contexts/AppSidebarContext.tsx index 57a6770f6..07565896b 100644 --- a/web/src/contexts/AppSidebarContext.tsx +++ b/web/src/contexts/AppSidebarContext.tsx @@ -1,7 +1,7 @@ import { createContext, type ReactNode, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react"; import { useLocation } from "react-router-dom"; import type { MemoParentStatus } from "@/components/MemoParentPlaceholder"; -import type { Memo } from "@/types/proto/api/v1/memo_service_pb"; +import type { Memo } from "@/types/proto/api/memo_service_pb"; export type AttachmentSection = "all" | "media" | "audio" | "documents" | "unused"; export type InboxFilter = "all" | "unread" | "archived"; diff --git a/web/src/contexts/AuthContext.tsx b/web/src/contexts/AuthContext.tsx index 97392ff60..05696a02e 100644 --- a/web/src/contexts/AuthContext.tsx +++ b/web/src/contexts/AuthContext.tsx @@ -8,7 +8,7 @@ import type { UserSetting_GeneralSetting, UserSetting_TagsSetting, UserSetting_WebhooksSetting, -} from "@/types/proto/api/v1/user_service_pb"; +} from "@/types/proto/api/user_service_pb"; interface AuthState { currentUser: User | undefined; @@ -58,7 +58,7 @@ export function AuthProvider({ children }: { children: ReactNode }) { }); const fetchUserSettings = useCallback(async (userName: string) => { - const { settings } = await userServiceClient.listUserSettings({ parent: userName }); + const { userSettings: settings } = await userServiceClient.listUserSettings({ parent: userName }); const generalSetting = settings.find((s) => s.value.case === "generalSetting"); const webhooksSetting = settings.find((s) => s.value.case === "webhooksSetting"); const tagsSetting = settings.find((s) => s.value.case === "tagsSetting"); diff --git a/web/src/contexts/InstanceContext.tsx b/web/src/contexts/InstanceContext.tsx index bb8b13fbb..e08730d89 100644 --- a/web/src/contexts/InstanceContext.tsx +++ b/web/src/contexts/InstanceContext.tsx @@ -19,7 +19,7 @@ import { InstanceSetting_NotificationSettingSchema, InstanceSetting_StorageSetting, InstanceSetting_StorageSettingSchema, -} from "@/types/proto/api/v1/instance_service_pb"; +} from "@/types/proto/api/instance_service_pb"; import { setManagedAttachmentInstanceUrl } from "@/utils/managed-attachment"; const instanceSettingNamePrefix = "instance/settings/"; @@ -146,10 +146,10 @@ export function InstanceProvider({ children }: { children: ReactNode }) { names: [buildInstanceSettingName(InstanceSetting_Key.GENERAL), buildInstanceSettingName(InstanceSetting_Key.MEMO_RELATED)], }) .then((settingsResponse) => { - for (const setting of settingsResponse.settings) { + for (const setting of settingsResponse.instanceSettings) { fetchedSettingsRef.current.add(setting.name); } - setState((prev) => ({ ...prev, settings: settingsResponse.settings })); + setState((prev) => ({ ...prev, settings: settingsResponse.instanceSettings })); }) .catch((error) => { console.error("Failed to initialize instance settings:", error); @@ -180,10 +180,10 @@ export function InstanceProvider({ children }: { children: ReactNode }) { try { const response = await instanceServiceClient.batchGetInstanceSettings({ names }); - const fetchedNames = new Set(response.settings.map((setting) => setting.name)); + const fetchedNames = new Set(response.instanceSettings.map((setting) => setting.name)); setState((prev) => ({ ...prev, - settings: [...prev.settings.filter((setting) => !fetchedNames.has(setting.name)), ...response.settings], + settings: [...prev.settings.filter((setting) => !fetchedNames.has(setting.name)), ...response.instanceSettings], })); } catch (error) { for (const name of names) { @@ -221,7 +221,7 @@ export function InstanceProvider({ children }: { children: ReactNode }) { const isAccessSetting = setting.value.case === "accessSetting"; const updatedSetting = isAccessSetting ? await updateAccessSetting(setting) - : await instanceServiceClient.updateInstanceSetting({ setting }); + : await instanceServiceClient.updateInstanceSetting({ instanceSetting: setting }); setState((prev) => ({ ...prev, profile: diff --git a/web/src/contexts/SpaceContext.tsx b/web/src/contexts/SpaceContext.tsx index 4035e0e06..7ede8da8b 100644 --- a/web/src/contexts/SpaceContext.tsx +++ b/web/src/contexts/SpaceContext.tsx @@ -14,7 +14,7 @@ import { resolveCollectionRoute, withCollectionCreator, } from "@/router/routes"; -import type { Space } from "@/types/proto/api/v1/space_service_pb"; +import type { Space } from "@/types/proto/api/space_service_pb"; interface SpaceContextValue { spaces: Space[]; diff --git a/web/src/hooks/useAttachmentLibrary.ts b/web/src/hooks/useAttachmentLibrary.ts index 0cdd68554..674675437 100644 --- a/web/src/hooks/useAttachmentLibrary.ts +++ b/web/src/hooks/useAttachmentLibrary.ts @@ -9,7 +9,7 @@ import { } from "@/components/MemoMetadata/Attachment/attachmentHelpers"; import { useInfiniteAttachments } from "@/hooks/useAttachmentQueries"; import { combineCELFilters } from "@/lib/cel-filter"; -import type { Attachment, ListAttachmentsRequest } from "@/types/proto/api/v1/attachment_service_pb"; +import type { Attachment, ListAttachmentsRequest } from "@/types/proto/api/attachment_service_pb"; import { isMotionAttachment } from "@/utils/attachment"; import { useTranslate } from "@/utils/i18n"; import { type AttachmentVisualItem, buildAttachmentVisualItems, countLogicalAttachmentItems } from "@/utils/media-item"; diff --git a/web/src/hooks/useAttachmentQueries.ts b/web/src/hooks/useAttachmentQueries.ts index ac07a5715..66c6acded 100644 --- a/web/src/hooks/useAttachmentQueries.ts +++ b/web/src/hooks/useAttachmentQueries.ts @@ -6,7 +6,7 @@ import { BatchDeleteAttachmentsRequestSchema, type ListAttachmentsRequest, ListAttachmentsRequestSchema, -} from "@/types/proto/api/v1/attachment_service_pb"; +} from "@/types/proto/api/attachment_service_pb"; // Query keys factory export const attachmentKeys = { diff --git a/web/src/hooks/useFilteredMemoStats.ts b/web/src/hooks/useFilteredMemoStats.ts index b31ca9f7a..fe34a6c60 100644 --- a/web/src/hooks/useFilteredMemoStats.ts +++ b/web/src/hooks/useFilteredMemoStats.ts @@ -6,8 +6,8 @@ import { type MemoTimeBasis, useView } from "@/contexts/ViewContext"; import useCurrentUser from "@/hooks/useCurrentUser"; import { useAllUserStats, useUserStats } from "@/hooks/useUserQueries"; import { mergeTagCounts } from "@/lib/tag"; -import { State } from "@/types/proto/api/v1/common_pb"; -import type { UserStats } from "@/types/proto/api/v1/user_service_pb"; +import { State } from "@/types/proto/api/common_pb"; +import type { UserStats } from "@/types/proto/api/user_service_pb"; import type { StatisticsData } from "@/types/statistics"; export interface FilteredMemoStats { @@ -46,7 +46,7 @@ export const useFilteredMemoStats = (options: UseFilteredMemoStatsOptions = {}): // Legacy personal collections use backend per-user stats. const { data: userStats, isLoading: isLoadingUserStats } = useUserStats(userName, { enabled, filter }); // Collection and Archived fetch grouped stats and aggregate them locally. - // ListAllUserStats AND's the request filter with the server's auth filter, so + // ListUserStats AND's the request filter with the server's auth filter, so // private memos are not included unless explicitly visible to the current user. const allUserStatsRequest = context === "collection" ? { state: State.NORMAL, filter } : context === "archived" ? { state: State.ARCHIVED, filter } : {}; @@ -62,7 +62,7 @@ export const useFilteredMemoStats = (options: UseFilteredMemoStatsOptions = {}): if (context === "collection" || context === "archived") { const displayDates: string[] = []; - tagCount = mergeTagCounts(...allUserStats.map((stats) => stats.tagCount)); + tagCount = mergeTagCounts(...allUserStats.map((stats) => stats.tagCounts)); for (const stats of allUserStats) { displayDates.push( ...timestampsForBasis(stats, timeBasis) @@ -83,8 +83,8 @@ export const useFilteredMemoStats = (options: UseFilteredMemoStatsOptions = {}): .map(toDateString), ); } - if (userStats.tagCount) { - tagCount = mergeTagCounts(userStats.tagCount); + if (userStats.tagCounts) { + tagCount = mergeTagCounts(userStats.tagCounts); } } diff --git a/web/src/hooks/useIdentityProviderQueries.ts b/web/src/hooks/useIdentityProviderQueries.ts index 7667cd3d5..cabd48eeb 100644 --- a/web/src/hooks/useIdentityProviderQueries.ts +++ b/web/src/hooks/useIdentityProviderQueries.ts @@ -1,6 +1,6 @@ import { useQuery } from "@tanstack/react-query"; import { identityProviderServiceClient } from "@/connect"; -import { IdentityProvider } from "@/types/proto/api/v1/idp_service_pb"; +import { IdentityProvider } from "@/types/proto/api/idp_service_pb"; // Query keys factory export const identityProviderKeys = { diff --git a/web/src/hooks/useInstanceQueries.ts b/web/src/hooks/useInstanceQueries.ts index 1ff225894..5954523b5 100644 --- a/web/src/hooks/useInstanceQueries.ts +++ b/web/src/hooks/useInstanceQueries.ts @@ -1,6 +1,6 @@ import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"; import { instanceServiceClient } from "@/connect"; -import { InstanceSetting, InstanceSetting_AccessSetting, InstanceSetting_Key } from "@/types/proto/api/v1/instance_service_pb"; +import { InstanceSetting, InstanceSetting_AccessSetting, InstanceSetting_Key } from "@/types/proto/api/instance_service_pb"; // Query keys factory export const instanceKeys = { @@ -61,7 +61,7 @@ export function useInstanceSettings(keys: InstanceSetting_Key[]) { const response = await instanceServiceClient.batchGetInstanceSettings({ names: keys.map(buildInstanceSettingName), }); - return response.settings; + return response.instanceSettings; }, staleTime: 1000 * 60 * 5, // 5 minutes }); @@ -72,7 +72,7 @@ export function useUpdateInstanceSetting() { const queryClient = useQueryClient(); return useMutation({ - mutationFn: async (setting: InstanceSetting) => instanceServiceClient.updateInstanceSetting({ setting }), + mutationFn: async (setting: InstanceSetting) => instanceServiceClient.updateInstanceSetting({ instanceSetting: setting }), onSuccess: async (setting) => { // Update the exact setting cache from the server response. Batch caches // are marked stale without refetching so an active setting query does not diff --git a/web/src/hooks/useLiveMemoRefresh.ts b/web/src/hooks/useLiveMemoRefresh.ts index 55c9a860d..a9a0b164c 100644 --- a/web/src/hooks/useLiveMemoRefresh.ts +++ b/web/src/hooks/useLiveMemoRefresh.ts @@ -399,7 +399,7 @@ async function cancelResponseBody(response: Response): Promise { } function fetchSSEStream(token: string, signal: AbortSignal): Promise { - return fetch("/api/v1/sse", { + return fetch("/api/sse", { headers: { Accept: "text/event-stream", Authorization: `Bearer ${token}`, diff --git a/web/src/hooks/useMemoFilters.ts b/web/src/hooks/useMemoFilters.ts index 7ae99c441..2db37f70c 100644 --- a/web/src/hooks/useMemoFilters.ts +++ b/web/src/hooks/useMemoFilters.ts @@ -7,7 +7,7 @@ import { buildTimestampRangeFilter, getLocalDayTimestampRange, getTimeBasisField import { combineCELFilters } from "@/lib/cel-filter"; import { getMemoViewId } from "@/lib/memo-views"; import { buildMemoCreatorFilter, getVisibilityName } from "@/lib/resource-names"; -import { Visibility } from "@/types/proto/api/v1/memo_service_pb"; +import { Visibility } from "@/types/proto/api/memo_service_pb"; const escapeFilterValue = (value: string): string => JSON.stringify(value); diff --git a/web/src/hooks/useMemoQueries.ts b/web/src/hooks/useMemoQueries.ts index 8f4adbf0d..81d920898 100644 --- a/web/src/hooks/useMemoQueries.ts +++ b/web/src/hooks/useMemoQueries.ts @@ -15,8 +15,8 @@ import { attachmentKeys } from "@/hooks/useAttachmentQueries"; import { userKeys } from "@/hooks/useUserQueries"; import { DEFAULT_LIST_MEMOS_PAGE_SIZE } from "@/lib/constants"; import { shouldRetry } from "@/lib/query-client"; -import type { ListMemosRequest, ListMemosResponse, Memo } from "@/types/proto/api/v1/memo_service_pb"; -import { ListMemoCommentsRequestSchema, ListMemosRequestSchema, MemoSchema } from "@/types/proto/api/v1/memo_service_pb"; +import type { ListMemosRequest, ListMemosResponse, Memo } from "@/types/proto/api/memo_service_pb"; +import { ListMemoCommentsRequestSchema, ListMemosRequestSchema, MemoSchema } from "@/types/proto/api/memo_service_pb"; // Query keys factory for consistent cache management export const memoKeys = { @@ -339,7 +339,7 @@ export function useMemoComments(name: string, options?: { enabled?: boolean; pag queryFn: async () => { const response = await memoServiceClient.listMemoComments( create(ListMemoCommentsRequestSchema, { - name, + parent: name, pageSize: options?.pageSize ?? 0, }), ); @@ -359,7 +359,7 @@ export function useInfiniteMemoComments(name: string, options?: { enabled?: bool queryFn: async ({ pageParam }) => { const response = await memoServiceClient.listMemoComments( create(ListMemoCommentsRequestSchema, { - name, + parent: name, pageSize, pageToken: pageParam || "", }), @@ -368,7 +368,7 @@ export function useInfiniteMemoComments(name: string, options?: { enabled?: bool }, initialPageParam: "", getNextPageParam: (lastPage) => lastPage.nextPageToken || undefined, - select: (data) => data.pages.flatMap((page) => page.memos), + select: (data) => data.pages.flatMap((page) => page.comments), enabled: options?.enabled ?? true, staleTime: 1000 * 60, // 1 minute }); diff --git a/web/src/hooks/useMemoShareQueries.ts b/web/src/hooks/useMemoShareQueries.ts index 9d7f92417..947a28db4 100644 --- a/web/src/hooks/useMemoShareQueries.ts +++ b/web/src/hooks/useMemoShareQueries.ts @@ -2,15 +2,15 @@ import { create } from "@bufbuild/protobuf"; import { timestampFromDate } from "@bufbuild/protobuf/wkt"; import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"; import { memoServiceClient } from "@/connect"; -import type { Attachment } from "@/types/proto/api/v1/attachment_service_pb"; -import type { MemoShare } from "@/types/proto/api/v1/memo_service_pb"; +import type { Attachment } from "@/types/proto/api/attachment_service_pb"; +import type { MemoShare } from "@/types/proto/api/memo_service_pb"; import { CreateMemoShareRequestSchema, DeleteMemoShareRequestSchema, GetSharedMemoRequestSchema, ListMemoSharesRequestSchema, MemoShareSchema, -} from "@/types/proto/api/v1/memo_service_pb"; +} from "@/types/proto/api/memo_service_pb"; // Query keys factory for share-related cache management. export const memoShareKeys = { diff --git a/web/src/hooks/useMemoSorting.ts b/web/src/hooks/useMemoSorting.ts index 52433bffd..29fadcda0 100644 --- a/web/src/hooks/useMemoSorting.ts +++ b/web/src/hooks/useMemoSorting.ts @@ -2,8 +2,8 @@ import { timestampDate } from "@bufbuild/protobuf/wkt"; import dayjs from "dayjs"; import { useMemo } from "react"; import { type MemoTimeBasis, useView } from "@/contexts/ViewContext"; -import { State } from "@/types/proto/api/v1/common_pb"; -import type { Memo } from "@/types/proto/api/v1/memo_service_pb"; +import { State } from "@/types/proto/api/common_pb"; +import type { Memo } from "@/types/proto/api/memo_service_pb"; export interface UseMemoSortingOptions { pinnedFirst?: boolean; diff --git a/web/src/hooks/useSpaceQueries.ts b/web/src/hooks/useSpaceQueries.ts index d97af3fbb..f362d076f 100644 --- a/web/src/hooks/useSpaceQueries.ts +++ b/web/src/hooks/useSpaceQueries.ts @@ -14,7 +14,7 @@ import { type SpaceMember, SpaceMemberSchema, SpaceSchema, -} from "@/types/proto/api/v1/space_service_pb"; +} from "@/types/proto/api/space_service_pb"; const SPACE_LIST_PAGE_SIZE = 1000; const SPACE_LIST_STALE_TIME = 1000 * 60 * 5; diff --git a/web/src/hooks/useUserQueries.ts b/web/src/hooks/useUserQueries.ts index 0be8c5cc3..449ada30d 100644 --- a/web/src/hooks/useUserQueries.ts +++ b/web/src/hooks/useUserQueries.ts @@ -6,8 +6,8 @@ import useCurrentUser from "@/hooks/useCurrentUser"; import { buildUserSettingName, userNamePrefix } from "@/lib/resource-names"; import { mergeTagCounts } from "@/lib/tag"; import { - type ListAllUserStatsRequest, - ListAllUserStatsRequestSchema, + type ListUserStatsRequest, + ListUserStatsRequestSchema, User, UserNotification, UserNotification_Status, @@ -16,11 +16,13 @@ import { UserSetting_Key, UserSettingSchema, UserStats, -} from "@/types/proto/api/v1/user_service_pb"; +} from "@/types/proto/api/user_service_pb"; const BATCH_GET_USERS_LIMIT = 100; const USER_PROFILE_STALE_TIME = 1000 * 60 * 5; -type ListAllUserStatsQuery = Pick; +type ListUserStatsQuery = Pick; +// ListUserStats aggregates across every user through the "users/-" wildcard parent. +const ALL_USERS_PARENT = `${userNamePrefix}-`; // Query keys factory export const userKeys = { @@ -30,7 +32,7 @@ export const userKeys = { stats: () => [...userKeys.all, "stats"] as const, userStats: (name: string, filter?: string) => filter ? ([...userKeys.stats(), name, filter] as const) : ([...userKeys.stats(), name] as const), - allUserStats: (request: Partial) => [...userKeys.stats(), "all", request] as const, + allUserStats: (request: Partial) => [...userKeys.stats(), "all", request] as const, currentUser: () => [...userKeys.all, "current"] as const, memoViews: (parent?: string) => [...userKeys.all, "memoViews", parent] as const, notifications: () => [...userKeys.all, "notifications"] as const, @@ -66,12 +68,14 @@ export function useUserStats(username?: string, options?: { enabled?: boolean; f }); } -export function useAllUserStats(request: Partial = {}, options?: { enabled?: boolean }) { +export function useAllUserStats(request: Partial = {}, options?: { enabled?: boolean }) { return useQuery({ queryKey: userKeys.allUserStats(request), queryFn: async () => { - const { stats } = await userServiceClient.listAllUserStats(create(ListAllUserStatsRequestSchema, request)); - return stats; + const { userStats } = await userServiceClient.listUserStats( + create(ListUserStatsRequestSchema, { ...request, parent: ALL_USERS_PARENT }), + ); + return userStats; }, enabled: options?.enabled ?? true, }); @@ -162,15 +166,15 @@ export function useTagCounts(forCurrentUser = false) { return userServiceClient.getUserStats({ name: currentUser.name }); } else { // Fetch all user stats - const { stats } = await userServiceClient.listAllUserStats({}); + const { userStats } = await userServiceClient.listUserStats({ parent: ALL_USERS_PARENT }); // Aggregate tag counts from all users - return mergeTagCounts(...stats.map((userStats) => userStats.tagCount)); + return mergeTagCounts(...userStats.map((stats) => stats.tagCounts)); } }, select: (data) => { if (forCurrentUser) { - return mergeTagCounts((data as UserStats).tagCount); + return mergeTagCounts((data as UserStats).tagCounts); } return data as Record; }, @@ -218,7 +222,7 @@ export function useUserSettings(parent?: string) { queryKey: [...userKeys.all, "settings", parent], queryFn: async () => { if (!parent) return { settings: [] }; - const { settings } = await userServiceClient.listUserSettings({ parent }); + const { userSettings: settings } = await userServiceClient.listUserSettings({ parent }); return { settings }; }, enabled: !!parent, @@ -232,7 +236,7 @@ export function useUpdateUserSetting() { return useMutation({ mutationFn: async ({ setting, updateMask }: { setting: UserSetting; updateMask: string[] }) => { const updatedSetting = await userServiceClient.updateUserSetting({ - setting, + userSetting: setting, updateMask: create(FieldMaskSchema, { paths: updateMask }), }); return updatedSetting; @@ -280,7 +284,7 @@ export function useUpdateUserGeneralSetting(currentUserName?: string) { }); const updatedSetting = await userServiceClient.updateUserSetting({ - setting: userSetting, + userSetting, updateMask: create(FieldMaskSchema, { paths: updateMask }), }); return updatedSetting; @@ -350,7 +354,9 @@ export function useUsersByUsernames(usernames: string[], options?: { enabled?: b batches.push(missingUsernames.slice(i, i + BATCH_GET_USERS_LIMIT)); } - const responses = await Promise.all(batches.map((batch) => userServiceClient.batchGetUsers({ usernames: batch }))); + const responses = await Promise.all( + batches.map((batch) => userServiceClient.batchGetUsers({ names: batch.map((username) => `${userNamePrefix}${username}`) })), + ); const users = responses.flatMap((response) => response.users); for (const user of users) { usersByUsername.set(user.username, user); diff --git a/web/src/layouts/RootLayout.tsx b/web/src/layouts/RootLayout.tsx index 1cc00d8cb..26b5f2122 100644 --- a/web/src/layouts/RootLayout.tsx +++ b/web/src/layouts/RootLayout.tsx @@ -18,7 +18,7 @@ import useCurrentUser from "@/hooks/useCurrentUser"; import useMediaQuery from "@/hooks/useMediaQuery"; import { cn } from "@/lib/utils"; import { ROUTES, resolveCollectionRoute } from "@/router/routes"; -import { InstanceAccessMode } from "@/types/proto/api/v1/instance_service_pb"; +import { InstanceAccessMode } from "@/types/proto/api/instance_service_pb"; import { buildAuthRoute, shouldGatePrivateInstance } from "@/utils/auth-redirect"; import { useTranslate } from "@/utils/i18n"; diff --git a/web/src/lib/context-suggestions.ts b/web/src/lib/context-suggestions.ts index 5941b1e41..edbd63fb8 100644 --- a/web/src/lib/context-suggestions.ts +++ b/web/src/lib/context-suggestions.ts @@ -1,5 +1,5 @@ import type { MemoFilter } from "@/contexts/MemoFilterContext"; -import type { Visibility } from "@/types/proto/api/v1/memo_service_pb"; +import type { Visibility } from "@/types/proto/api/memo_service_pb"; import { VISIBILITY_OPTIONS } from "@/utils/memo"; import type { MemoSuggestion, SuggestionSource } from "./memo-suggestions"; import { parseSuggestionExpression, readStringList, type SuggestionExpression, type SuggestionToken } from "./suggestion-expression"; diff --git a/web/src/lib/memo-export.ts b/web/src/lib/memo-export.ts index 79d8f2a4f..cfa66eb88 100644 --- a/web/src/lib/memo-export.ts +++ b/web/src/lib/memo-export.ts @@ -2,8 +2,8 @@ import { create } from "@bufbuild/protobuf"; import { Code, ConnectError } from "@connectrpc/connect"; import { userServiceClient } from "@/connect"; import { downloadFileFromUrl } from "@/lib/browser"; -import type { ImportMemosRequest, MemoImportPlan, MemoImportReport } from "@/types/proto/api/v1/user_service_pb"; -import { ImportMemosRequest_ConflictPolicy, ImportMemosSpecSchema } from "@/types/proto/api/v1/user_service_pb"; +import type { ImportMemosPlan, ImportMemosReport, ImportMemosRequest } from "@/types/proto/api/user_service_pb"; +import { ImportMemosRequest_ConflictPolicy, ImportMemosSpecSchema } from "@/types/proto/api/user_service_pb"; const DEFAULT_CHUNK_SIZE = 2 * 1024 * 1024; @@ -20,7 +20,7 @@ export async function exportMemos(userName: string, username: string): Promise { +): Promise { const response = await userServiceClient.importMemos({ name: userName, upload: { case: "uploadId", value: staged.uploadId }, diff --git a/web/src/lib/memo-suggestions.ts b/web/src/lib/memo-suggestions.ts index f2b269348..35e3111b2 100644 --- a/web/src/lib/memo-suggestions.ts +++ b/web/src/lib/memo-suggestions.ts @@ -1,7 +1,7 @@ import { uniqBy } from "lodash-es"; import type { LucideIcon } from "lucide-react"; import type { MemoFilter } from "@/contexts/MemoFilterContext"; -import type { Visibility } from "@/types/proto/api/v1/memo_service_pb"; +import type { Visibility } from "@/types/proto/api/memo_service_pb"; import { getContextSuggestionCandidates } from "./context-suggestions"; import { getTagSuggestionCandidates } from "./tag-suggestions"; diff --git a/web/src/lib/resource-names.ts b/web/src/lib/resource-names.ts index 8be7dfc06..49463162e 100644 --- a/web/src/lib/resource-names.ts +++ b/web/src/lib/resource-names.ts @@ -1,6 +1,6 @@ -import { InstanceSetting_Key } from "@/types/proto/api/v1/instance_service_pb"; -import { Visibility } from "@/types/proto/api/v1/memo_service_pb"; -import { UserSetting_Key } from "@/types/proto/api/v1/user_service_pb"; +import { InstanceSetting_Key } from "@/types/proto/api/instance_service_pb"; +import { Visibility } from "@/types/proto/api/memo_service_pb"; +import { UserSetting_Key } from "@/types/proto/api/user_service_pb"; export const instanceSettingNamePrefix = "instance/settings/"; export const userNamePrefix = "users/"; diff --git a/web/src/lib/tag.ts b/web/src/lib/tag.ts index b90e8f207..3a3685038 100644 --- a/web/src/lib/tag.ts +++ b/web/src/lib/tag.ts @@ -1,4 +1,4 @@ -import type { UserSetting_TagMetadata, UserSetting_TagsSetting } from "@/types/proto/api/v1/user_service_pb"; +import type { UserSetting_TagMetadata, UserSetting_TagsSetting } from "@/types/proto/api/user_service_pb"; // Cache compiled regexes to avoid re-compiling on every tag render. const compiledPatternCache = new Map(); diff --git a/web/src/pages/Archived.tsx b/web/src/pages/Archived.tsx index f0a1cb705..931bb32af 100644 --- a/web/src/pages/Archived.tsx +++ b/web/src/pages/Archived.tsx @@ -4,8 +4,8 @@ import PagedMemoList, { getMemoKey } from "@/components/PagedMemoList"; import { useMemoFilters, useMemoSorting } from "@/hooks"; import useCurrentUser from "@/hooks/useCurrentUser"; import { cn } from "@/lib/utils"; -import { State } from "@/types/proto/api/v1/common_pb"; -import { Memo } from "@/types/proto/api/v1/memo_service_pb"; +import { State } from "@/types/proto/api/common_pb"; +import { Memo } from "@/types/proto/api/memo_service_pb"; import { useTranslate } from "@/utils/i18n"; const Archived = () => { diff --git a/web/src/pages/Attachments.tsx b/web/src/pages/Attachments.tsx index ad2d01d3f..ee80d37be 100644 --- a/web/src/pages/Attachments.tsx +++ b/web/src/pages/Attachments.tsx @@ -25,7 +25,7 @@ import { useUsersByNames } from "@/hooks/useUserQueries"; import i18n from "@/i18n"; import { combineCELFilters } from "@/lib/cel-filter"; import { handleError } from "@/lib/error"; -import { ListAttachmentsRequestSchema } from "@/types/proto/api/v1/attachment_service_pb"; +import { ListAttachmentsRequestSchema } from "@/types/proto/api/attachment_service_pb"; import { useTranslate } from "@/utils/i18n"; const UNUSED_PAGE_SIZE = 1000; diff --git a/web/src/pages/AuthCallback.tsx b/web/src/pages/AuthCallback.tsx index bd04f6f3e..c4351cb83 100644 --- a/web/src/pages/AuthCallback.tsx +++ b/web/src/pages/AuthCallback.tsx @@ -91,7 +91,7 @@ const AuthCallback = () => { } await userServiceClient.createLinkedIdentity({ parent: currentUser.name, - idpName: identityProviderName, + identityProvider: identityProviderName, code, redirectUri, codeVerifier: codeVerifier || "", @@ -101,7 +101,7 @@ const AuthCallback = () => { credentials: { case: "ssoCredentials", value: { - idpName: identityProviderName, + identityProvider: identityProviderName, code, redirectUri, codeVerifier: codeVerifier || "", // Pass PKCE code_verifier for token exchange @@ -110,7 +110,10 @@ const AuthCallback = () => { }); // Store access token from login response if (response.accessToken) { - setAccessToken(response.accessToken, response.accessTokenExpiresAt ? timestampDate(response.accessTokenExpiresAt) : undefined); + setAccessToken( + response.accessToken, + response.accessTokenExpireTime ? timestampDate(response.accessTokenExpireTime) : undefined, + ); } } setState({ diff --git a/web/src/pages/Home.tsx b/web/src/pages/Home.tsx index 6054c370d..ecb15b497 100644 --- a/web/src/pages/Home.tsx +++ b/web/src/pages/Home.tsx @@ -12,8 +12,8 @@ import { useMemoFilters, useMemoSorting } from "@/hooks"; import useCurrentUser from "@/hooks/useCurrentUser"; import { useMemoSuggestions } from "@/hooks/useMemoSuggestions"; import { spaceScopedCacheKey } from "@/lib/resource-names"; -import { State } from "@/types/proto/api/v1/common_pb"; -import { Memo } from "@/types/proto/api/v1/memo_service_pb"; +import { State } from "@/types/proto/api/common_pb"; +import { Memo } from "@/types/proto/api/memo_service_pb"; import { useTranslate } from "@/utils/i18n"; const Home = () => { diff --git a/web/src/pages/Inboxes.tsx b/web/src/pages/Inboxes.tsx index a37c7ab42..8e56a71db 100644 --- a/web/src/pages/Inboxes.tsx +++ b/web/src/pages/Inboxes.tsx @@ -7,7 +7,7 @@ import SpaceInvitationMessage from "@/components/Inbox/SpaceInvitationMessage"; import Placeholder from "@/components/Placeholder"; import { useAppSidebar } from "@/contexts/AppSidebarContext"; import { useNotifications } from "@/hooks/useUserQueries"; -import { UserNotification, UserNotification_Status, UserNotification_Type } from "@/types/proto/api/v1/user_service_pb"; +import { UserNotification, UserNotification_Status, UserNotification_Type } from "@/types/proto/api/user_service_pb"; import { useTranslate } from "@/utils/i18n"; const Inboxes = () => { diff --git a/web/src/pages/MemoDetail.tsx b/web/src/pages/MemoDetail.tsx index b011bfca0..8b9b1f66c 100644 --- a/web/src/pages/MemoDetail.tsx +++ b/web/src/pages/MemoDetail.tsx @@ -17,9 +17,9 @@ import { useSharedMemo, withShareAttachmentLinks } from "@/hooks/useMemoShareQue import { LEGACY_MEMO_COMMENTS_ANCHOR_ID, MEMO_COMMENTS_ANCHOR_ID } from "@/lib/memo-comments"; import { memoNamePrefix } from "@/lib/resource-names"; import { ROUTES } from "@/router/routes"; -import type { Attachment } from "@/types/proto/api/v1/attachment_service_pb"; -import { State } from "@/types/proto/api/v1/common_pb"; -import type { Memo } from "@/types/proto/api/v1/memo_service_pb"; +import type { Attachment } from "@/types/proto/api/attachment_service_pb"; +import { State } from "@/types/proto/api/common_pb"; +import type { Memo } from "@/types/proto/api/memo_service_pb"; import { findMemoAnchorTarget } from "@/utils/markdown-manipulation"; const MemoSidebarRegistration = ({ diff --git a/web/src/pages/MemoViews.tsx b/web/src/pages/MemoViews.tsx index 4f1f8d66e..630ee7601 100644 --- a/web/src/pages/MemoViews.tsx +++ b/web/src/pages/MemoViews.tsx @@ -41,7 +41,7 @@ import { useMemoViews, userKeys } from "@/hooks/useUserQueries"; import { handleError } from "@/lib/error"; import { getMemoViewId } from "@/lib/memo-views"; import { cn } from "@/lib/utils"; -import { MemoView, MemoView_IconSchema, MemoViewSchema } from "@/types/proto/api/v1/user_service_pb"; +import { MemoView, MemoView_IconSchema, MemoViewSchema } from "@/types/proto/api/user_service_pb"; import { useTranslate } from "@/utils/i18n"; const memoViewExamples = [ diff --git a/web/src/pages/Setting.tsx b/web/src/pages/Setting.tsx index ffc6170e9..d27f45644 100644 --- a/web/src/pages/Setting.tsx +++ b/web/src/pages/Setting.tsx @@ -8,7 +8,7 @@ import { } from "@/components/Settings/settingSections"; import { useInstance } from "@/contexts/InstanceContext"; import useCurrentUser from "@/hooks/useCurrentUser"; -import { User_Role } from "@/types/proto/api/v1/user_service_pb"; +import { User_Role } from "@/types/proto/api/user_service_pb"; const Setting = () => { const location = useLocation(); diff --git a/web/src/pages/SignUp.tsx b/web/src/pages/SignUp.tsx index adc111f4f..8c97cb05e 100644 --- a/web/src/pages/SignUp.tsx +++ b/web/src/pages/SignUp.tsx @@ -18,7 +18,7 @@ import useLoading from "@/hooks/useLoading"; import useNavigateTo from "@/hooks/useNavigateTo"; import { ERROR_REASON_CHALLENGE_REQUIRED, handleError, hasErrorReason } from "@/lib/error"; import { ROUTES } from "@/router/routes"; -import { User_Role, UserSchema } from "@/types/proto/api/v1/user_service_pb"; +import { User_Role, UserSchema } from "@/types/proto/api/user_service_pb"; import { AUTH_REDIRECT_PARAM, appendSearchParams, getSafeRedirectPath } from "@/utils/auth-redirect"; import { useTranslate } from "@/utils/i18n"; @@ -78,7 +78,7 @@ const SignUp = () => { ); // Store access token from login response if (response.accessToken) { - setAccessToken(response.accessToken, response.accessTokenExpiresAt ? timestampDate(response.accessTokenExpiresAt) : undefined); + setAccessToken(response.accessToken, response.accessTokenExpireTime ? timestampDate(response.accessTokenExpireTime) : undefined); } // Refresh auth context to load the current user await initAuth(); diff --git a/web/src/types/proto/api/ai_service_pb.ts b/web/src/types/proto/api/ai_service_pb.ts new file mode 100644 index 000000000..6a4764e32 --- /dev/null +++ b/web/src/types/proto/api/ai_service_pb.ts @@ -0,0 +1,130 @@ +// @generated by protoc-gen-es v2.12.1 with parameter "target=ts" +// @generated from file api/ai_service.proto (package memos.api, syntax proto3) +/* eslint-disable */ + +import type { GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv2"; +import { fileDesc, messageDesc, serviceDesc } from "@bufbuild/protobuf/codegenv2"; +import { file_google_api_annotations } from "../google/api/annotations_pb"; +import { file_google_api_client } from "../google/api/client_pb"; +import { file_google_api_field_behavior } from "../google/api/field_behavior_pb"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file api/ai_service.proto. + */ +export const file_api_ai_service: GenFile = /*@__PURE__*/ + fileDesc("ChRhcGkvYWlfc2VydmljZS5wcm90bxIJbWVtb3MuYXBpIkYKEVRyYW5zY3JpYmVSZXF1ZXN0EjEKBWF1ZGlvGAEgASgLMh0ubWVtb3MuYXBpLlRyYW5zY3JpcHRpb25BdWRpb0ID4EECIiIKElRyYW5zY3JpYmVSZXNwb25zZRIMCgR0ZXh0GAEgASgJIncKElRyYW5zY3JpcHRpb25BdWRpbxIWCgdjb250ZW50GAEgASgMQgPgQQRIABINCgN1cmkYAiABKAlIABIVCghmaWxlbmFtZRgDIAEoCUID4EEBEhkKDGNvbnRlbnRfdHlwZRgEIAEoCUID4EEBQggKBnNvdXJjZTJ9CglBSVNlcnZpY2UScAoKVHJhbnNjcmliZRIcLm1lbW9zLmFwaS5UcmFuc2NyaWJlUmVxdWVzdBodLm1lbW9zLmFwaS5UcmFuc2NyaWJlUmVzcG9uc2UiJdpBBWF1ZGlvgtPkkwIXOgEqIhIvYXBpL2FpOnRyYW5zY3JpYmVCjQEKDWNvbS5tZW1vcy5hcGlCDkFpU2VydmljZVByb3RvUAFaJ2dpdGh1Yi5jb20vdXNlbWVtb3MvbWVtb3MvcHJvdG8vZ2VuL2FwaaICA01BWKoCCU1lbW9zLkFwacoCCU1lbW9zXEFwaeICFU1lbW9zXEFwaVxHUEJNZXRhZGF0YeoCCk1lbW9zOjpBcGliBnByb3RvMw", [file_google_api_annotations, file_google_api_client, file_google_api_field_behavior]); + +/** + * Request message for AIService.Transcribe. + * + * @generated from message memos.api.TranscribeRequest + */ +export type TranscribeRequest = Message<"memos.api.TranscribeRequest"> & { + /** + * Required. The audio to transcribe. + * + * @generated from field: memos.api.TranscriptionAudio audio = 1; + */ + audio?: TranscriptionAudio | undefined; +}; + +/** + * Describes the message memos.api.TranscribeRequest. + * Use `create(TranscribeRequestSchema)` to create a new message. + */ +export const TranscribeRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_ai_service, 0); + +/** + * Response message for AIService.Transcribe. + * + * @generated from message memos.api.TranscribeResponse + */ +export type TranscribeResponse = Message<"memos.api.TranscribeResponse"> & { + /** + * The transcribed text. + * + * @generated from field: string text = 1; + */ + text: string; +}; + +/** + * Describes the message memos.api.TranscribeResponse. + * Use `create(TranscribeResponseSchema)` to create a new message. + */ +export const TranscribeResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_ai_service, 1); + +/** + * TranscriptionAudio is the audio input for a transcription. + * + * @generated from message memos.api.TranscriptionAudio + */ +export type TranscriptionAudio = Message<"memos.api.TranscriptionAudio"> & { + /** + * The audio source. Only inline content is supported. + * + * @generated from oneof memos.api.TranscriptionAudio.source + */ + source: { + /** + * Input only. Inline audio bytes, at most 25 MiB. + * + * @generated from field: bytes content = 1; + */ + value: Uint8Array; + case: "content"; + } | { + /** + * URI of the audio content. Reserved for future use; the service rejects requests that set it. + * + * @generated from field: string uri = 2; + */ + value: string; + case: "uri"; + } | { case: undefined; value?: undefined }; + + /** + * Optional. The uploaded filename, at most 255 characters. + * + * @generated from field: string filename = 3; + */ + filename: string; + + /** + * Optional. The MIME type of the audio. If empty, the service detects it from the content. + * + * @generated from field: string content_type = 4; + */ + contentType: string; +}; + +/** + * Describes the message memos.api.TranscriptionAudio. + * Use `create(TranscriptionAudioSchema)` to create a new message. + */ +export const TranscriptionAudioSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_ai_service, 2); + +/** + * AIService runs AI tasks through the AI providers configured on the instance. + * + * @generated from service memos.api.AIService + */ +export const AIService: GenService<{ + /** + * Transcribe transcribes an audio file with the instance's configured + * transcription provider. The caller must be signed in, and requests are rate limited per user. + * + * @generated from rpc memos.api.AIService.Transcribe + */ + transcribe: { + methodKind: "unary"; + input: typeof TranscribeRequestSchema; + output: typeof TranscribeResponseSchema; + }, +}> = /*@__PURE__*/ + serviceDesc(file_api_ai_service, 0); + diff --git a/web/src/types/proto/api/attachment_service_pb.ts b/web/src/types/proto/api/attachment_service_pb.ts new file mode 100644 index 000000000..c396d5c39 --- /dev/null +++ b/web/src/types/proto/api/attachment_service_pb.ts @@ -0,0 +1,884 @@ +// @generated by protoc-gen-es v2.12.1 with parameter "target=ts" +// @generated from file api/attachment_service.proto (package memos.api, syntax proto3) +/* eslint-disable */ + +import type { GenEnum, GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv2"; +import { enumDesc, fileDesc, messageDesc, serviceDesc } from "@bufbuild/protobuf/codegenv2"; +import { file_google_api_annotations } from "../google/api/annotations_pb"; +import { file_google_api_client } from "../google/api/client_pb"; +import { file_google_api_field_behavior } from "../google/api/field_behavior_pb"; +import { file_google_api_resource } from "../google/api/resource_pb"; +import type { EmptySchema, FieldMask, Timestamp } from "@bufbuild/protobuf/wkt"; +import { file_google_protobuf_empty, file_google_protobuf_field_mask, file_google_protobuf_timestamp } from "@bufbuild/protobuf/wkt"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file api/attachment_service.proto. + */ +export const file_api_attachment_service: GenFile = /*@__PURE__*/ + fileDesc("ChxhcGkvYXR0YWNobWVudF9zZXJ2aWNlLnByb3RvEgltZW1vcy5hcGkiyQMKCkF0dGFjaG1lbnQSEQoEbmFtZRgBIAEoCUID4EEIEicKB2NyZWF0b3IYAiABKAlCFuBBA/pBEAoObWVtb3MuYXBpL1VzZXISFQoIZmlsZW5hbWUYAyABKAlCA+BBAhIRCgR0eXBlGAQgASgJQgPgQQISFAoHY29udGVudBgFIAEoDEID4EEEEhoKDWV4dGVybmFsX2xpbmsYBiABKAlCA+BBARIxCgxtb3Rpb25fbWVkaWEYByABKAsyFi5tZW1vcy5hcGkuTW90aW9uTWVkaWFCA+BBARI4Cg5tZWRpYV9tZXRhZGF0YRgIIAEoCzIYLm1lbW9zLmFwaS5NZWRpYU1ldGFkYXRhQgbgQQHgQQUSFgoEbWVtbxgJIAEoCUID4EEBSACIAQESEQoEc2l6ZRgKIAEoA0ID4EEDEjQKC2NyZWF0ZV90aW1lGAsgASgLMhouZ29vZ2xlLnByb3RvYnVmLlRpbWVzdGFtcEID4EEDOkzqQUkKFG1lbW9zLmFwaS9BdHRhY2htZW50EhhhdHRhY2htZW50cy97YXR0YWNobWVudH0qC2F0dGFjaG1lbnRzMgphdHRhY2htZW50QgcKBV9tZW1vInUKFkxpc3RBdHRhY2htZW50c1JlcXVlc3QSFgoJcGFnZV9zaXplGAEgASgFQgPgQQESFwoKcGFnZV90b2tlbhgCIAEoCUID4EEBEhMKBmZpbHRlchgDIAEoCUID4EEBEhUKCG9yZGVyX2J5GAQgASgJQgPgQQEiXgoXTGlzdEF0dGFjaG1lbnRzUmVzcG9uc2USKgoLYXR0YWNobWVudHMYASADKAsyFS5tZW1vcy5hcGkuQXR0YWNobWVudBIXCg9uZXh0X3BhZ2VfdG9rZW4YAiABKAkiQgoUR2V0QXR0YWNobWVudFJlcXVlc3QSKgoEbmFtZRgBIAEoCUIc4EEC+kEWChRtZW1vcy5hcGkvQXR0YWNobWVudCJlChdDcmVhdGVBdHRhY2htZW50UmVxdWVzdBIuCgphdHRhY2htZW50GAEgASgLMhUubWVtb3MuYXBpLkF0dGFjaG1lbnRCA+BBAhIaCg1hdHRhY2htZW50X2lkGAIgASgJQgPgQQEifwoXVXBkYXRlQXR0YWNobWVudFJlcXVlc3QSLgoKYXR0YWNobWVudBgBIAEoCzIVLm1lbW9zLmFwaS5BdHRhY2htZW50QgPgQQISNAoLdXBkYXRlX21hc2sYAiABKAsyGi5nb29nbGUucHJvdG9idWYuRmllbGRNYXNrQgPgQQIiRQoXRGVsZXRlQXR0YWNobWVudFJlcXVlc3QSKgoEbmFtZRgBIAEoCUIc4EEC+kEWChRtZW1vcy5hcGkvQXR0YWNobWVudCIzCh1CYXRjaERlbGV0ZUF0dGFjaG1lbnRzUmVxdWVzdBISCgVuYW1lcxgBIAMoCUID4EECIrIBChdVcGxvYWRBdHRhY2htZW50UmVxdWVzdBIvCgRzcGVjGAEgASgLMh8ubWVtb3MuYXBpLlVwbG9hZEF0dGFjaG1lbnRTcGVjSAASEwoJdXBsb2FkX2lkGAIgASgJSAASGQoMd3JpdGVfb2Zmc2V0GAMgASgDQgPgQQISEQoEZGF0YRgEIAEoDEID4EEBEhkKDGZpbmlzaF93cml0ZRgFIAEoCEID4EEBQggKBnVwbG9hZCKIAQoYVXBsb2FkQXR0YWNobWVudFJlc3BvbnNlEhEKCXVwbG9hZF9pZBgBIAEoCRIWCg5jb21taXR0ZWRfc2l6ZRgCIAEoAxIWCg5tYXhfY2h1bmtfc2l6ZRgDIAEoBRIpCgphdHRhY2htZW50GAQgASgLMhUubWVtb3MuYXBpLkF0dGFjaG1lbnQiewoUVXBsb2FkQXR0YWNobWVudFNwZWMSLgoKYXR0YWNobWVudBgBIAEoCzIVLm1lbW9zLmFwaS5BdHRhY2htZW50QgPgQQISGgoNYXR0YWNobWVudF9pZBgCIAEoCUID4EEBEhcKCnRvdGFsX3NpemUYAyABKANCA+BBASK2AQoLTW90aW9uTWVkaWESLAoGZmFtaWx5GAEgASgOMhwubWVtb3MuYXBpLk1vdGlvbk1lZGlhRmFtaWx5EigKBHJvbGUYAiABKA4yGi5tZW1vcy5hcGkuTW90aW9uTWVkaWFSb2xlEhAKCGdyb3VwX2lkGAMgASgJEiEKGXByZXNlbnRhdGlvbl90aW1lc3RhbXBfdXMYBCABKAMSGgoSaGFzX2VtYmVkZGVkX3ZpZGVvGAUgASgIIq4BCg1NZWRpYU1ldGFkYXRhEhIKBXdpZHRoGAEgASgFSAGIAQESEwoGaGVpZ2h0GAIgASgFSAKIAQESKQoFcGhvdG8YAyABKAsyGC5tZW1vcy5hcGkuUGhvdG9NZXRhZGF0YUgAEikKBXZpZGVvGAQgASgLMhgubWVtb3MuYXBpLlZpZGVvTWV0YWRhdGFIAEIJCgdkZXRhaWxzQggKBl93aWR0aEIJCgdfaGVpZ2h0Ip0DCg1QaG90b01ldGFkYXRhEjEKDGNhcHR1cmVfdGltZRgBIAEoCzIbLm1lbW9zLmFwaS5NZWRpYUNhcHR1cmVUaW1lEioKCGxvY2F0aW9uGAIgASgLMhgubWVtb3MuYXBpLk1lZGlhTG9jYXRpb24SJAoXc291cmNlX2V4aWZfb3JpZW50YXRpb24YAyABKAVIAIgBARITCgtjYW1lcmFfbWFrZRgEIAEoCRIUCgxjYW1lcmFfbW9kZWwYBSABKAkSEgoKbGVuc19tb2RlbBgGIAEoCRIVCghmX251bWJlchgHIAEoAUgBiAEBEiIKFWV4cG9zdXJlX3RpbWVfc2Vjb25kcxgIIAEoAUgCiAEBEhAKA2lzbxgJIAEoBUgDiAEBEhwKD2ZvY2FsX2xlbmd0aF9tbRgKIAEoAUgEiAEBQhoKGF9zb3VyY2VfZXhpZl9vcmllbnRhdGlvbkILCglfZl9udW1iZXJCGAoWX2V4cG9zdXJlX3RpbWVfc2Vjb25kc0IGCgRfaXNvQhIKEF9mb2NhbF9sZW5ndGhfbW0iUwoQTWVkaWFDYXB0dXJlVGltZRIXCg9sb2NhbF9kYXRlX3RpbWUYASABKAkSFwoKdXRjX29mZnNldBgCIAEoCUgAiAEBQg0KC191dGNfb2Zmc2V0IosBCg1NZWRpYUxvY2F0aW9uEhUKCGxhdGl0dWRlGAEgASgBSACIAQESFgoJbG9uZ2l0dWRlGAIgASgBSAGIAQESHAoPYWx0aXR1ZGVfbWV0ZXJzGAMgASgBSAKIAQFCCwoJX2xhdGl0dWRlQgwKCl9sb25naXR1ZGVCEgoQX2FsdGl0dWRlX21ldGVycyJDCg1WaWRlb01ldGFkYXRhEh0KEGR1cmF0aW9uX3NlY29uZHMYASABKAFIAIgBAUITChFfZHVyYXRpb25fc2Vjb25kcypoChFNb3Rpb25NZWRpYUZhbWlseRIjCh9NT1RJT05fTUVESUFfRkFNSUxZX1VOU1BFQ0lGSUVEEAASFAoQQVBQTEVfTElWRV9QSE9UTxABEhgKFEFORFJPSURfTU9USU9OX1BIT1RPEAIqWQoPTW90aW9uTWVkaWFSb2xlEiEKHU1PVElPTl9NRURJQV9ST0xFX1VOU1BFQ0lGSUVEEAASCQoFU1RJTEwQARIJCgVWSURFTxACEg0KCUNPTlRBSU5FUhADMqEHChFBdHRhY2htZW50U2VydmljZRJyCg9MaXN0QXR0YWNobWVudHMSIS5tZW1vcy5hcGkuTGlzdEF0dGFjaG1lbnRzUmVxdWVzdBoiLm1lbW9zLmFwaS5MaXN0QXR0YWNobWVudHNSZXNwb25zZSIYgtPkkwISEhAvYXBpL2F0dGFjaG1lbnRzEnEKDUdldEF0dGFjaG1lbnQSHy5tZW1vcy5hcGkuR2V0QXR0YWNobWVudFJlcXVlc3QaFS5tZW1vcy5hcGkuQXR0YWNobWVudCIo2kEEbmFtZYLT5JMCGxIZL2FwaS97bmFtZT1hdHRhY2htZW50cy8qfRKAAQoQQ3JlYXRlQXR0YWNobWVudBIiLm1lbW9zLmFwaS5DcmVhdGVBdHRhY2htZW50UmVxdWVzdBoVLm1lbW9zLmFwaS5BdHRhY2htZW50IjHaQQphdHRhY2htZW50gtPkkwIeOgphdHRhY2htZW50IhAvYXBpL2F0dGFjaG1lbnRzEqABChBVcGRhdGVBdHRhY2htZW50EiIubWVtb3MuYXBpLlVwZGF0ZUF0dGFjaG1lbnRSZXF1ZXN0GhUubWVtb3MuYXBpLkF0dGFjaG1lbnQiUdpBFmF0dGFjaG1lbnQsdXBkYXRlX21hc2uC0+STAjI6CmF0dGFjaG1lbnQyJC9hcGkve2F0dGFjaG1lbnQubmFtZT1hdHRhY2htZW50cy8qfRJ4ChBEZWxldGVBdHRhY2htZW50EiIubWVtb3MuYXBpLkRlbGV0ZUF0dGFjaG1lbnRSZXF1ZXN0GhYuZ29vZ2xlLnByb3RvYnVmLkVtcHR5IijaQQRuYW1lgtPkkwIbKhkvYXBpL3tuYW1lPWF0dGFjaG1lbnRzLyp9EoMBChZCYXRjaERlbGV0ZUF0dGFjaG1lbnRzEigubWVtb3MuYXBpLkJhdGNoRGVsZXRlQXR0YWNobWVudHNSZXF1ZXN0GhYuZ29vZ2xlLnByb3RvYnVmLkVtcHR5IieC0+STAiE6ASoiHC9hcGkvYXR0YWNobWVudHM6YmF0Y2hEZWxldGUSfwoQVXBsb2FkQXR0YWNobWVudBIiLm1lbW9zLmFwaS5VcGxvYWRBdHRhY2htZW50UmVxdWVzdBojLm1lbW9zLmFwaS5VcGxvYWRBdHRhY2htZW50UmVzcG9uc2UiIoLT5JMCHDoBKiIXL2FwaS9hdHRhY2htZW50czp1cGxvYWRClQEKDWNvbS5tZW1vcy5hcGlCFkF0dGFjaG1lbnRTZXJ2aWNlUHJvdG9QAVonZ2l0aHViLmNvbS91c2VtZW1vcy9tZW1vcy9wcm90by9nZW4vYXBpogIDTUFYqgIJTWVtb3MuQXBpygIJTWVtb3NcQXBp4gIVTWVtb3NcQXBpXEdQQk1ldGFkYXRh6gIKTWVtb3M6OkFwaWIGcHJvdG8z", [file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_empty, file_google_protobuf_field_mask, file_google_protobuf_timestamp]); + +/** + * Attachment is a file uploaded by a user, optionally linked to a memo. + * + * @generated from message memos.api.Attachment + */ +export type Attachment = Message<"memos.api.Attachment"> & { + /** + * Identifier. The resource name of the attachment. + * Format: attachments/{attachment} + * + * @generated from field: string name = 1; + */ + name: string; + + /** + * Output only. The user who uploaded the attachment, which may differ from the creator of the linked memo. + * Format: users/{user} + * + * @generated from field: string creator = 2; + */ + creator: string; + + /** + * Required. The filename of the attachment. + * + * @generated from field: string filename = 3; + */ + filename: string; + + /** + * Required. The MIME type of the attachment. If empty on create, the service detects it from the filename and + * content. + * + * @generated from field: string type = 4; + */ + type: string; + + /** + * Input only. The content of the attachment. + * + * @generated from field: bytes content = 5; + */ + content: Uint8Array; + + /** + * Optional. The external link of the attachment. Set only for externally stored attachments; ignored on create. + * + * @generated from field: string external_link = 6; + */ + externalLink: string; + + /** + * Optional. Motion photo metadata. Clients may only supply Apple Live Photo metadata; the service detects Android + * motion photos in JPEG content. + * + * @generated from field: memos.api.MotionMedia motion_media = 7; + */ + motionMedia?: MotionMedia | undefined; + + /** + * Optional. Normalized media metadata supplied by the client at creation time. Immutable after creation. + * + * @generated from field: memos.api.MediaMetadata media_metadata = 8; + */ + mediaMetadata?: MediaMetadata | undefined; + + /** + * Optional. The memo the attachment is linked to. On create, the caller must be able to manage the memo. + * Format: memos/{memo} + * + * @generated from field: optional string memo = 9; + */ + memo?: string | undefined; + + /** + * Output only. The size of the stored content in bytes. + * + * @generated from field: int64 size = 10; + */ + size: bigint; + + /** + * Output only. The creation time. + * + * @generated from field: google.protobuf.Timestamp create_time = 11; + */ + createTime?: Timestamp | undefined; +}; + +/** + * Describes the message memos.api.Attachment. + * Use `create(AttachmentSchema)` to create a new message. + */ +export const AttachmentSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_attachment_service, 0); + +/** + * Request message for AttachmentService.ListAttachments. + * + * @generated from message memos.api.ListAttachmentsRequest + */ +export type ListAttachmentsRequest = Message<"memos.api.ListAttachmentsRequest"> & { + /** + * Optional. The maximum number of attachments to return. The service may return fewer. + * If unspecified, at most 50 attachments are returned. Values above 1000 are coerced to 1000. + * + * @generated from field: int32 page_size = 1; + */ + pageSize: number; + + /** + * Optional. A page token from a previous call. Provide it to retrieve the next page. + * + * @generated from field: string page_token = 2; + */ + pageToken: string; + + /** + * Optional. A CEL filter over the results. + * Example: `mime_type == "image/png"` or `filename.contains("test")`. + * Supported operators: ==, !=, <, <=, >, >=, : (contains), in. + * Supported fields: creator, filename, mime_type, create_time, memo_id, space. + * `creator` is the linked memo's creator, or the uploader for an unlinked attachment. It supports equality with a + * User resource name. + * `space` is the linked memo's Space resource name, or null when the attachment is unlinked or its memo has no + * space. It supports only a non-negated `==` comparison with a Space resource name or null. + * + * @generated from field: string filter = 3; + */ + filter: string; + + /** + * Optional. The order to sort results by, such as "create_time desc" or "filename asc". The service does not apply + * it yet. + * + * @generated from field: string order_by = 4; + */ + orderBy: string; +}; + +/** + * Describes the message memos.api.ListAttachmentsRequest. + * Use `create(ListAttachmentsRequestSchema)` to create a new message. + */ +export const ListAttachmentsRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_attachment_service, 1); + +/** + * Response message for AttachmentService.ListAttachments. + * + * @generated from message memos.api.ListAttachmentsResponse + */ +export type ListAttachmentsResponse = Message<"memos.api.ListAttachmentsResponse"> & { + /** + * The attachments. + * + * @generated from field: repeated memos.api.Attachment attachments = 1; + */ + attachments: Attachment[]; + + /** + * A token to retrieve the next page. Empty when there are no more pages. + * + * @generated from field: string next_page_token = 2; + */ + nextPageToken: string; +}; + +/** + * Describes the message memos.api.ListAttachmentsResponse. + * Use `create(ListAttachmentsResponseSchema)` to create a new message. + */ +export const ListAttachmentsResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_attachment_service, 2); + +/** + * Request message for AttachmentService.GetAttachment. + * + * @generated from message memos.api.GetAttachmentRequest + */ +export type GetAttachmentRequest = Message<"memos.api.GetAttachmentRequest"> & { + /** + * Required. The name of the attachment to get. + * Format: attachments/{attachment} + * + * @generated from field: string name = 1; + */ + name: string; +}; + +/** + * Describes the message memos.api.GetAttachmentRequest. + * Use `create(GetAttachmentRequestSchema)` to create a new message. + */ +export const GetAttachmentRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_attachment_service, 3); + +/** + * Request message for AttachmentService.CreateAttachment. + * + * @generated from message memos.api.CreateAttachmentRequest + */ +export type CreateAttachmentRequest = Message<"memos.api.CreateAttachmentRequest"> & { + /** + * Required. The attachment to create. + * + * @generated from field: memos.api.Attachment attachment = 1; + */ + attachment?: Attachment | undefined; + + /** + * Optional. The ID to use for the attachment. If empty, a unique ID is generated. + * Format: ^[a-zA-Z0-9]([a-zA-Z0-9-]{0,34}[a-zA-Z0-9])?$ + * + * @generated from field: string attachment_id = 2; + */ + attachmentId: string; +}; + +/** + * Describes the message memos.api.CreateAttachmentRequest. + * Use `create(CreateAttachmentRequestSchema)` to create a new message. + */ +export const CreateAttachmentRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_attachment_service, 4); + +/** + * Request message for AttachmentService.UpdateAttachment. + * + * @generated from message memos.api.UpdateAttachmentRequest + */ +export type UpdateAttachmentRequest = Message<"memos.api.UpdateAttachmentRequest"> & { + /** + * Required. The attachment to update. Its `name` identifies the attachment. + * + * @generated from field: memos.api.Attachment attachment = 1; + */ + attachment?: Attachment | undefined; + + /** + * Required. The fields to update. Only `filename` is supported. + * + * @generated from field: google.protobuf.FieldMask update_mask = 2; + */ + updateMask?: FieldMask | undefined; +}; + +/** + * Describes the message memos.api.UpdateAttachmentRequest. + * Use `create(UpdateAttachmentRequestSchema)` to create a new message. + */ +export const UpdateAttachmentRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_attachment_service, 5); + +/** + * Request message for AttachmentService.DeleteAttachment. + * + * @generated from message memos.api.DeleteAttachmentRequest + */ +export type DeleteAttachmentRequest = Message<"memos.api.DeleteAttachmentRequest"> & { + /** + * Required. The name of the attachment to delete. + * Format: attachments/{attachment} + * + * @generated from field: string name = 1; + */ + name: string; +}; + +/** + * Describes the message memos.api.DeleteAttachmentRequest. + * Use `create(DeleteAttachmentRequestSchema)` to create a new message. + */ +export const DeleteAttachmentRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_attachment_service, 6); + +/** + * Request message for AttachmentService.BatchDeleteAttachments. + * + * @generated from message memos.api.BatchDeleteAttachmentsRequest + */ +export type BatchDeleteAttachmentsRequest = Message<"memos.api.BatchDeleteAttachmentsRequest"> & { + /** + * Required. The names of the attachments to delete, at most 100. Duplicate names are ignored. + * Format: attachments/{attachment} + * + * @generated from field: repeated string names = 1; + */ + names: string[]; +}; + +/** + * Describes the message memos.api.BatchDeleteAttachmentsRequest. + * Use `create(BatchDeleteAttachmentsRequestSchema)` to create a new message. + */ +export const BatchDeleteAttachmentsRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_attachment_service, 7); + +/** + * Request message for AttachmentService.UploadAttachment. + * + * @generated from message memos.api.UploadAttachmentRequest + */ +export type UploadAttachmentRequest = Message<"memos.api.UploadAttachmentRequest"> & { + /** + * Starts a new upload or continues an existing one. Exactly one must be set. + * + * @generated from oneof memos.api.UploadAttachmentRequest.upload + */ + upload: { + /** + * Starts a new upload. The same call may also carry data and finish_write. + * + * @generated from field: memos.api.UploadAttachmentSpec spec = 1; + */ + value: UploadAttachmentSpec; + case: "spec"; + } | { + /** + * Continues the upload identified by a previous response. + * + * @generated from field: string upload_id = 2; + */ + value: string; + case: "uploadId"; + } | { case: undefined; value?: undefined }; + + /** + * Required. Zero-based byte offset at which data is written. Must equal the committed size, except when retrying + * the most recently accepted chunk with identical bytes and offset, which is accepted without writing again. + * + * @generated from field: int64 write_offset = 3; + */ + writeOffset: bigint; + + /** + * Optional. File bytes, at most max_chunk_size long. With no data and finish_write false, the call reports + * progress without writing, and write_offset is ignored. + * + * @generated from field: bytes data = 4; + */ + data: Uint8Array; + + /** + * Optional. Finalize the upload after writing data. The committed size must then equal total_size. Any later call + * for the same upload_id returns the created attachment. + * + * @generated from field: bool finish_write = 5; + */ + finishWrite: boolean; +}; + +/** + * Describes the message memos.api.UploadAttachmentRequest. + * Use `create(UploadAttachmentRequestSchema)` to create a new message. + */ +export const UploadAttachmentRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_attachment_service, 8); + +/** + * Response message for AttachmentService.UploadAttachment. + * + * @generated from message memos.api.UploadAttachmentResponse + */ +export type UploadAttachmentResponse = Message<"memos.api.UploadAttachmentResponse"> & { + /** + * Opaque ID for subsequent calls. This is not a resource name. + * + * @generated from field: string upload_id = 1; + */ + uploadId: string; + + /** + * Number of file bytes committed so far. + * + * @generated from field: int64 committed_size = 2; + */ + committedSize: bigint; + + /** + * Maximum number of data bytes accepted in one call. + * + * @generated from field: int32 max_chunk_size = 3; + */ + maxChunkSize: number; + + /** + * The created attachment. Set once the upload has been finalized. + * + * @generated from field: memos.api.Attachment attachment = 4; + */ + attachment?: Attachment | undefined; +}; + +/** + * Describes the message memos.api.UploadAttachmentResponse. + * Use `create(UploadAttachmentResponseSchema)` to create a new message. + */ +export const UploadAttachmentResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_attachment_service, 9); + +/** + * UploadAttachmentSpec describes the attachment that a new upload creates. + * + * @generated from message memos.api.UploadAttachmentSpec + */ +export type UploadAttachmentSpec = Message<"memos.api.UploadAttachmentSpec"> & { + /** + * Required. Metadata for the attachment to create. content must be empty; file bytes are sent in data. + * + * @generated from field: memos.api.Attachment attachment = 1; + */ + attachment?: Attachment | undefined; + + /** + * Optional. The ID to use for the attachment. If empty, a unique ID is generated. + * Format: ^[a-zA-Z0-9]([a-zA-Z0-9-]{0,34}[a-zA-Z0-9])?$ + * + * @generated from field: string attachment_id = 2; + */ + attachmentId: string; + + /** + * Optional. Total size of the file in bytes before media processing. Zero represents an empty file. + * + * @generated from field: int64 total_size = 3; + */ + totalSize: bigint; +}; + +/** + * Describes the message memos.api.UploadAttachmentSpec. + * Use `create(UploadAttachmentSpecSchema)` to create a new message. + */ +export const UploadAttachmentSpecSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_attachment_service, 10); + +/** + * MotionMedia links the parts of a motion photo. + * + * @generated from message memos.api.MotionMedia + */ +export type MotionMedia = Message<"memos.api.MotionMedia"> & { + /** + * The motion photo format. + * + * @generated from field: memos.api.MotionMediaFamily family = 1; + */ + family: MotionMediaFamily; + + /** + * The part this attachment plays in the motion photo. + * + * @generated from field: memos.api.MotionMediaRole role = 2; + */ + role: MotionMediaRole; + + /** + * Groups the attachments that belong to one motion photo. Required for client-supplied Apple Live Photo metadata; + * for an Android motion photo it is the attachment's own ID. + * + * @generated from field: string group_id = 3; + */ + groupId: string; + + /** + * Presentation timestamp of the still frame within the video, in microseconds. + * + * @generated from field: int64 presentation_timestamp_us = 4; + */ + presentationTimestampUs: bigint; + + /** + * Whether the file embeds the motion video, as in an Android motion photo container. + * + * @generated from field: bool has_embedded_video = 5; + */ + hasEmbeddedVideo: boolean; +}; + +/** + * Describes the message memos.api.MotionMedia. + * Use `create(MotionMediaSchema)` to create a new message. + */ +export const MotionMediaSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_attachment_service, 11); + +/** + * MediaMetadata contains normalized metadata explicitly supplied by a client. + * The service validates and stores this data but does not extract it from the media file. + * + * @generated from message memos.api.MediaMetadata + */ +export type MediaMetadata = Message<"memos.api.MediaMetadata"> & { + /** + * Display-oriented width in pixels. Must be provided with height. + * + * @generated from field: optional int32 width = 1; + */ + width?: number | undefined; + + /** + * Display-oriented height in pixels. Must be provided with width. + * + * @generated from field: optional int32 height = 2; + */ + height?: number | undefined; + + /** + * Type-specific metadata. Must match the attachment's MIME type. + * + * @generated from oneof memos.api.MediaMetadata.details + */ + details: { + /** + * Photo metadata, for image attachments. + * + * @generated from field: memos.api.PhotoMetadata photo = 3; + */ + value: PhotoMetadata; + case: "photo"; + } | { + /** + * Video metadata, for video attachments. + * + * @generated from field: memos.api.VideoMetadata video = 4; + */ + value: VideoMetadata; + case: "video"; + } | { case: undefined; value?: undefined }; +}; + +/** + * Describes the message memos.api.MediaMetadata. + * Use `create(MediaMetadataSchema)` to create a new message. + */ +export const MediaMetadataSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_attachment_service, 12); + +/** + * PhotoMetadata is metadata recorded by the source of a photo. + * + * @generated from message memos.api.PhotoMetadata + */ +export type PhotoMetadata = Message<"memos.api.PhotoMetadata"> & { + /** + * Capture time as recorded by the source media. + * + * @generated from field: memos.api.MediaCaptureTime capture_time = 1; + */ + captureTime?: MediaCaptureTime | undefined; + + /** + * Geographic location recorded by the source media. + * + * @generated from field: memos.api.MediaLocation location = 2; + */ + location?: MediaLocation | undefined; + + /** + * EXIF orientation value from 1 through 8 as recorded by the source file. + * This value is informational and must not be reapplied to the stored attachment; + * width and height already describe its display-oriented dimensions. + * + * @generated from field: optional int32 source_exif_orientation = 3; + */ + sourceExifOrientation?: number | undefined; + + /** + * The camera manufacturer. + * + * @generated from field: string camera_make = 4; + */ + cameraMake: string; + + /** + * The camera model. + * + * @generated from field: string camera_model = 5; + */ + cameraModel: string; + + /** + * The lens model. + * + * @generated from field: string lens_model = 6; + */ + lensModel: string; + + /** + * The aperture f-number. + * + * @generated from field: optional double f_number = 7; + */ + fNumber?: number | undefined; + + /** + * The exposure time in seconds. + * + * @generated from field: optional double exposure_time_seconds = 8; + */ + exposureTimeSeconds?: number | undefined; + + /** + * The ISO sensitivity. + * + * @generated from field: optional int32 iso = 9; + */ + iso?: number | undefined; + + /** + * The focal length in millimeters. + * + * @generated from field: optional double focal_length_mm = 10; + */ + focalLengthMm?: number | undefined; +}; + +/** + * Describes the message memos.api.PhotoMetadata. + * Use `create(PhotoMetadataSchema)` to create a new message. + */ +export const PhotoMetadataSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_attachment_service, 13); + +/** + * MediaCaptureTime is the local time at which media was captured. + * + * @generated from message memos.api.MediaCaptureTime + */ +export type MediaCaptureTime = Message<"memos.api.MediaCaptureTime"> & { + /** + * Local date and time without a time zone, formatted as YYYY-MM-DDTHH:mm:ss[.fraction]. + * + * @generated from field: string local_date_time = 1; + */ + localDateTime: string; + + /** + * UTC offset formatted as Z or +/-HH:MM. + * + * @generated from field: optional string utc_offset = 2; + */ + utcOffset?: string | undefined; +}; + +/** + * Describes the message memos.api.MediaCaptureTime. + * Use `create(MediaCaptureTimeSchema)` to create a new message. + */ +export const MediaCaptureTimeSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_attachment_service, 14); + +/** + * MediaLocation is the geographic location at which media was captured. + * + * @generated from message memos.api.MediaLocation + */ +export type MediaLocation = Message<"memos.api.MediaLocation"> & { + /** + * WGS84 latitude in decimal degrees. Must be provided with longitude. + * + * @generated from field: optional double latitude = 1; + */ + latitude?: number | undefined; + + /** + * WGS84 longitude in decimal degrees. Must be provided with latitude. + * + * @generated from field: optional double longitude = 2; + */ + longitude?: number | undefined; + + /** + * Signed altitude in meters relative to sea level. + * + * @generated from field: optional double altitude_meters = 3; + */ + altitudeMeters?: number | undefined; +}; + +/** + * Describes the message memos.api.MediaLocation. + * Use `create(MediaLocationSchema)` to create a new message. + */ +export const MediaLocationSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_attachment_service, 15); + +/** + * VideoMetadata is metadata recorded by the source of a video. + * + * @generated from message memos.api.VideoMetadata + */ +export type VideoMetadata = Message<"memos.api.VideoMetadata"> & { + /** + * The duration of the video in seconds. + * + * @generated from field: optional double duration_seconds = 1; + */ + durationSeconds?: number | undefined; +}; + +/** + * Describes the message memos.api.VideoMetadata. + * Use `create(VideoMetadataSchema)` to create a new message. + */ +export const VideoMetadataSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_attachment_service, 16); + +/** + * MotionMediaFamily is the format of a motion photo. + * + * @generated from enum memos.api.MotionMediaFamily + */ +export enum MotionMediaFamily { + /** + * @generated from enum value: MOTION_MEDIA_FAMILY_UNSPECIFIED = 0; + */ + MOTION_MEDIA_FAMILY_UNSPECIFIED = 0, + + /** + * An Apple Live Photo: a still image and a video stored as separate attachments. + * + * @generated from enum value: APPLE_LIVE_PHOTO = 1; + */ + APPLE_LIVE_PHOTO = 1, + + /** + * An Android motion photo: a JPEG with an embedded video. + * + * @generated from enum value: ANDROID_MOTION_PHOTO = 2; + */ + ANDROID_MOTION_PHOTO = 2, +} + +/** + * Describes the enum memos.api.MotionMediaFamily. + */ +export const MotionMediaFamilySchema: GenEnum = /*@__PURE__*/ + enumDesc(file_api_attachment_service, 0); + +/** + * MotionMediaRole is the part an attachment plays in a motion photo. + * + * @generated from enum memos.api.MotionMediaRole + */ +export enum MotionMediaRole { + /** + * @generated from enum value: MOTION_MEDIA_ROLE_UNSPECIFIED = 0; + */ + MOTION_MEDIA_ROLE_UNSPECIFIED = 0, + + /** + * The still image of an Apple Live Photo. + * + * @generated from enum value: STILL = 1; + */ + STILL = 1, + + /** + * The video of an Apple Live Photo. + * + * @generated from enum value: VIDEO = 2; + */ + VIDEO = 2, + + /** + * A single file holding both the still image and the video. + * + * @generated from enum value: CONTAINER = 3; + */ + CONTAINER = 3, +} + +/** + * Describes the enum memos.api.MotionMediaRole. + */ +export const MotionMediaRoleSchema: GenEnum = /*@__PURE__*/ + enumDesc(file_api_attachment_service, 1); + +/** + * AttachmentService manages files attached to memos. + * + * @generated from service memos.api.AttachmentService + */ +export const AttachmentService: GenService<{ + /** + * ListAttachments lists attachments linked to memos the caller can read, plus the caller's unlinked uploads. + * + * @generated from rpc memos.api.AttachmentService.ListAttachments + */ + listAttachments: { + methodKind: "unary"; + input: typeof ListAttachmentsRequestSchema; + output: typeof ListAttachmentsResponseSchema; + }, + /** + * GetAttachment gets an attachment by name. An unlinked attachment is visible only to its uploader and admins; + * a linked attachment follows the read access of its memo. + * + * @generated from rpc memos.api.AttachmentService.GetAttachment + */ + getAttachment: { + methodKind: "unary"; + input: typeof GetAttachmentRequestSchema; + output: typeof AttachmentSchema; + }, + /** + * CreateAttachment creates an attachment from inline content. + * + * @generated from rpc memos.api.AttachmentService.CreateAttachment + */ + createAttachment: { + methodKind: "unary"; + input: typeof CreateAttachmentRequestSchema; + output: typeof AttachmentSchema; + }, + /** + * UpdateAttachment updates an attachment. Only `filename` can be updated. The caller must be the uploader or an + * admin. + * + * @generated from rpc memos.api.AttachmentService.UpdateAttachment + */ + updateAttachment: { + methodKind: "unary"; + input: typeof UpdateAttachmentRequestSchema; + output: typeof AttachmentSchema; + }, + /** + * DeleteAttachment deletes an attachment uploaded by the caller. + * + * @generated from rpc memos.api.AttachmentService.DeleteAttachment + */ + deleteAttachment: { + methodKind: "unary"; + input: typeof DeleteAttachmentRequestSchema; + output: typeof EmptySchema; + }, + /** + * BatchDeleteAttachments deletes up to 100 attachments in one atomic request. The caller must be the uploader of + * each attachment or an admin. + * + * @generated from rpc memos.api.AttachmentService.BatchDeleteAttachments + */ + batchDeleteAttachments: { + methodKind: "unary"; + input: typeof BatchDeleteAttachmentsRequestSchema; + output: typeof EmptySchema; + }, + /** + * UploadAttachment uploads a file in bounded chunks. The first call carries the spec and returns an upload_id; + * later calls carry that upload_id. Uploads are bound to the authenticated user, expire after 30 minutes of + * inactivity, and do not survive a server restart. + * + * @generated from rpc memos.api.AttachmentService.UploadAttachment + */ + uploadAttachment: { + methodKind: "unary"; + input: typeof UploadAttachmentRequestSchema; + output: typeof UploadAttachmentResponseSchema; + }, +}> = /*@__PURE__*/ + serviceDesc(file_api_attachment_service, 0); + diff --git a/web/src/types/proto/api/auth_service_pb.ts b/web/src/types/proto/api/auth_service_pb.ts new file mode 100644 index 000000000..418ad65ac --- /dev/null +++ b/web/src/types/proto/api/auth_service_pb.ts @@ -0,0 +1,320 @@ +// @generated by protoc-gen-es v2.12.1 with parameter "target=ts" +// @generated from file api/auth_service.proto (package memos.api, syntax proto3) +/* eslint-disable */ + +import type { GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv2"; +import { fileDesc, messageDesc, serviceDesc } from "@bufbuild/protobuf/codegenv2"; +import type { User } from "./user_service_pb"; +import { file_api_user_service } from "./user_service_pb"; +import { file_google_api_annotations } from "../google/api/annotations_pb"; +import { file_google_api_field_behavior } from "../google/api/field_behavior_pb"; +import { file_google_api_resource } from "../google/api/resource_pb"; +import type { EmptySchema, Timestamp } from "@bufbuild/protobuf/wkt"; +import { file_google_protobuf_empty, file_google_protobuf_timestamp } from "@bufbuild/protobuf/wkt"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file api/auth_service.proto. + */ +export const file_api_auth_service: GenFile = /*@__PURE__*/ + fileDesc("ChZhcGkvYXV0aF9zZXJ2aWNlLnByb3RvEgltZW1vcy5hcGkikQMKDVNpZ25JblJlcXVlc3QSTAoUcGFzc3dvcmRfY3JlZGVudGlhbHMYASABKAsyLC5tZW1vcy5hcGkuU2lnbkluUmVxdWVzdC5QYXNzd29yZENyZWRlbnRpYWxzSAASQgoPc3NvX2NyZWRlbnRpYWxzGAIgASgLMicubWVtb3MuYXBpLlNpZ25JblJlcXVlc3QuU3NvQ3JlZGVudGlhbHNIABpDChNQYXNzd29yZENyZWRlbnRpYWxzEhUKCHVzZXJuYW1lGAEgASgJQgPgQQISFQoIcGFzc3dvcmQYAiABKAlCA+BBAhqZAQoOU3NvQ3JlZGVudGlhbHMSPQoRaWRlbnRpdHlfcHJvdmlkZXIYASABKAlCIuBBAvpBHAoabWVtb3MuYXBpL0lkZW50aXR5UHJvdmlkZXISEQoEY29kZRgCIAEoCUID4EECEhkKDHJlZGlyZWN0X3VyaRgDIAEoCUID4EECEhoKDWNvZGVfdmVyaWZpZXIYBCABKAlCA+BBAUINCgtjcmVkZW50aWFscyKDAQoOU2lnbkluUmVzcG9uc2USHQoEdXNlchgBIAEoCzIPLm1lbW9zLmFwaS5Vc2VyEhQKDGFjY2Vzc190b2tlbhgCIAEoCRI8ChhhY2Nlc3NfdG9rZW5fZXhwaXJlX3RpbWUYAyABKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wIhUKE1JlZnJlc2hUb2tlblJlcXVlc3QiagoUUmVmcmVzaFRva2VuUmVzcG9uc2USFAoMYWNjZXNzX3Rva2VuGAEgASgJEjwKGGFjY2Vzc190b2tlbl9leHBpcmVfdGltZRgCIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXAiFwoVR2V0Q3VycmVudFVzZXJSZXF1ZXN0IjcKFkdldEN1cnJlbnRVc2VyUmVzcG9uc2USHQoEdXNlchgBIAEoCzIPLm1lbW9zLmFwaS5Vc2VyIhAKDlNpZ25PdXRSZXF1ZXN0Mp4DCgtBdXRoU2VydmljZRJaCgZTaWduSW4SGC5tZW1vcy5hcGkuU2lnbkluUmVxdWVzdBoZLm1lbW9zLmFwaS5TaWduSW5SZXNwb25zZSIbgtPkkwIVOgEqIhAvYXBpL2F1dGgvc2lnbmluEm0KDFJlZnJlc2hUb2tlbhIeLm1lbW9zLmFwaS5SZWZyZXNoVG9rZW5SZXF1ZXN0Gh8ubWVtb3MuYXBpLlJlZnJlc2hUb2tlblJlc3BvbnNlIhyC0+STAhY6ASoiES9hcGkvYXV0aC9yZWZyZXNoEmsKDkdldEN1cnJlbnRVc2VyEiAubWVtb3MuYXBpLkdldEN1cnJlbnRVc2VyUmVxdWVzdBohLm1lbW9zLmFwaS5HZXRDdXJyZW50VXNlclJlc3BvbnNlIhSC0+STAg4SDC9hcGkvYXV0aC9tZRJXCgdTaWduT3V0EhkubWVtb3MuYXBpLlNpZ25PdXRSZXF1ZXN0GhYuZ29vZ2xlLnByb3RvYnVmLkVtcHR5IhmC0+STAhMiES9hcGkvYXV0aC9zaWdub3V0Qo8BCg1jb20ubWVtb3MuYXBpQhBBdXRoU2VydmljZVByb3RvUAFaJ2dpdGh1Yi5jb20vdXNlbWVtb3MvbWVtb3MvcHJvdG8vZ2VuL2FwaaICA01BWKoCCU1lbW9zLkFwacoCCU1lbW9zXEFwaeICFU1lbW9zXEFwaVxHUEJNZXRhZGF0YeoCCk1lbW9zOjpBcGliBnByb3RvMw", [file_api_user_service, file_google_api_annotations, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_empty, file_google_protobuf_timestamp]); + +/** + * Request message for AuthService.SignIn. + * + * @generated from message memos.api.SignInRequest + */ +export type SignInRequest = Message<"memos.api.SignInRequest"> & { + /** + * The credentials to authenticate with. Provide exactly one. + * + * @generated from oneof memos.api.SignInRequest.credentials + */ + credentials: { + /** + * Username and password credentials. + * + * @generated from field: memos.api.SignInRequest.PasswordCredentials password_credentials = 1; + */ + value: SignInRequest_PasswordCredentials; + case: "passwordCredentials"; + } | { + /** + * SSO credentials from an OAuth2 authorization code flow. + * + * @generated from field: memos.api.SignInRequest.SsoCredentials sso_credentials = 2; + */ + value: SignInRequest_SsoCredentials; + case: "ssoCredentials"; + } | { case: undefined; value?: undefined }; +}; + +/** + * Describes the message memos.api.SignInRequest. + * Use `create(SignInRequestSchema)` to create a new message. + */ +export const SignInRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_auth_service, 0); + +/** + * PasswordCredentials are a username and password. + * Regular users cannot use them when the instance disallows password sign-in. + * + * @generated from message memos.api.SignInRequest.PasswordCredentials + */ +export type SignInRequest_PasswordCredentials = Message<"memos.api.SignInRequest.PasswordCredentials"> & { + /** + * Required. The username to sign in with. + * + * @generated from field: string username = 1; + */ + username: string; + + /** + * Required. The password to sign in with. + * + * @generated from field: string password = 2; + */ + password: string; +}; + +/** + * Describes the message memos.api.SignInRequest.PasswordCredentials. + * Use `create(SignInRequest_PasswordCredentialsSchema)` to create a new message. + */ +export const SignInRequest_PasswordCredentialsSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_auth_service, 0, 0); + +/** + * SsoCredentials are the result of an OAuth2 authorization code flow with an identity provider. + * A first sign-in creates a local user unless the instance disallows user registration. + * + * @generated from message memos.api.SignInRequest.SsoCredentials + */ +export type SignInRequest_SsoCredentials = Message<"memos.api.SignInRequest.SsoCredentials"> & { + /** + * Required. The resource name of the identity provider. + * Format: identity-providers/{idp} + * + * @generated from field: string identity_provider = 1; + */ + identityProvider: string; + + /** + * Required. The authorization code returned by the identity provider. + * + * @generated from field: string code = 2; + */ + code: string; + + /** + * Required. The redirect URI used in the authorization request. + * + * @generated from field: string redirect_uri = 3; + */ + redirectUri: string; + + /** + * Optional. The PKCE code verifier (RFC 7636). Set it when the authorization request used a code challenge. + * + * @generated from field: string code_verifier = 4; + */ + codeVerifier: string; +}; + +/** + * Describes the message memos.api.SignInRequest.SsoCredentials. + * Use `create(SignInRequest_SsoCredentialsSchema)` to create a new message. + */ +export const SignInRequest_SsoCredentialsSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_auth_service, 0, 1); + +/** + * Response message for AuthService.SignIn. + * + * @generated from message memos.api.SignInResponse + */ +export type SignInResponse = Message<"memos.api.SignInResponse"> & { + /** + * The signed-in user. + * + * @generated from field: memos.api.User user = 1; + */ + user?: User | undefined; + + /** + * The short-lived access token for API requests. + * Keep it in memory only, not in localStorage. + * + * @generated from field: string access_token = 2; + */ + accessToken: string; + + /** + * When the access token expires. + * Call RefreshToken before this time. + * + * @generated from field: google.protobuf.Timestamp access_token_expire_time = 3; + */ + accessTokenExpireTime?: Timestamp | undefined; +}; + +/** + * Describes the message memos.api.SignInResponse. + * Use `create(SignInResponseSchema)` to create a new message. + */ +export const SignInResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_auth_service, 1); + +/** + * Request message for AuthService.RefreshToken. + * It has no fields: the refresh token is read from the HttpOnly cookie. + * + * @generated from message memos.api.RefreshTokenRequest + */ +export type RefreshTokenRequest = Message<"memos.api.RefreshTokenRequest"> & { +}; + +/** + * Describes the message memos.api.RefreshTokenRequest. + * Use `create(RefreshTokenRequestSchema)` to create a new message. + */ +export const RefreshTokenRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_auth_service, 2); + +/** + * Response message for AuthService.RefreshToken. + * + * @generated from message memos.api.RefreshTokenResponse + */ +export type RefreshTokenResponse = Message<"memos.api.RefreshTokenResponse"> & { + /** + * The new short-lived access token. + * + * @generated from field: string access_token = 1; + */ + accessToken: string; + + /** + * When the new access token expires. + * + * @generated from field: google.protobuf.Timestamp access_token_expire_time = 2; + */ + accessTokenExpireTime?: Timestamp | undefined; +}; + +/** + * Describes the message memos.api.RefreshTokenResponse. + * Use `create(RefreshTokenResponseSchema)` to create a new message. + */ +export const RefreshTokenResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_auth_service, 3); + +/** + * Request message for AuthService.GetCurrentUser. + * + * @generated from message memos.api.GetCurrentUserRequest + */ +export type GetCurrentUserRequest = Message<"memos.api.GetCurrentUserRequest"> & { +}; + +/** + * Describes the message memos.api.GetCurrentUserRequest. + * Use `create(GetCurrentUserRequestSchema)` to create a new message. + */ +export const GetCurrentUserRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_auth_service, 4); + +/** + * Response message for AuthService.GetCurrentUser. + * + * @generated from message memos.api.GetCurrentUserResponse + */ +export type GetCurrentUserResponse = Message<"memos.api.GetCurrentUserResponse"> & { + /** + * The authenticated user. + * + * @generated from field: memos.api.User user = 1; + */ + user?: User | undefined; +}; + +/** + * Describes the message memos.api.GetCurrentUserResponse. + * Use `create(GetCurrentUserResponseSchema)` to create a new message. + */ +export const GetCurrentUserResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_auth_service, 5); + +/** + * Request message for AuthService.SignOut. + * + * @generated from message memos.api.SignOutRequest + */ +export type SignOutRequest = Message<"memos.api.SignOutRequest"> & { +}; + +/** + * Describes the message memos.api.SignOutRequest. + * Use `create(SignOutRequestSchema)` to create a new message. + */ +export const SignOutRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_auth_service, 6); + +/** + * AuthService manages sign-in sessions: it issues, refreshes, and revokes the tokens that authenticate API calls. + * + * @generated from service memos.api.AuthService + */ +export const AuthService: GenService<{ + /** + * SignIn authenticates a user with password or SSO credentials. + * On success, returns a short-lived access token and sets a refresh token in an HttpOnly cookie. + * Public. Attempts are rate limited. Archived users cannot sign in. + * + * @generated from rpc memos.api.AuthService.SignIn + */ + signIn: { + methodKind: "unary"; + input: typeof SignInRequestSchema; + output: typeof SignInResponseSchema; + }, + /** + * RefreshToken exchanges the refresh token for a new access token. + * The refresh token is read from the HttpOnly cookie and rotated: the old token is revoked and a new one with a + * fresh 30-day expiry is set in the cookie. + * Public, so it can be called after the access token has expired. + * + * @generated from rpc memos.api.AuthService.RefreshToken + */ + refreshToken: { + methodKind: "unary"; + input: typeof RefreshTokenRequestSchema; + output: typeof RefreshTokenResponseSchema; + }, + /** + * GetCurrentUser returns the authenticated user, similar to OIDC's /userinfo endpoint. + * When the caller is not signed in or the account is no longer active, clears the refresh token cookie and returns + * UNAUTHENTICATED. + * + * @generated from rpc memos.api.AuthService.GetCurrentUser + */ + getCurrentUser: { + methodKind: "unary"; + input: typeof GetCurrentUserRequestSchema; + output: typeof GetCurrentUserResponseSchema; + }, + /** + * SignOut ends the current session. + * Revokes the refresh token from the cookie and clears the cookie. + * + * @generated from rpc memos.api.AuthService.SignOut + */ + signOut: { + methodKind: "unary"; + input: typeof SignOutRequestSchema; + output: typeof EmptySchema; + }, +}> = /*@__PURE__*/ + serviceDesc(file_api_auth_service, 0); + diff --git a/web/src/types/proto/api/common_pb.ts b/web/src/types/proto/api/common_pb.ts new file mode 100644 index 000000000..32e84522f --- /dev/null +++ b/web/src/types/proto/api/common_pb.ts @@ -0,0 +1,107 @@ +// @generated by protoc-gen-es v2.12.1 with parameter "target=ts" +// @generated from file api/common.proto (package memos.api, syntax proto3) +/* eslint-disable */ + +import type { GenEnum, GenFile, GenMessage } from "@bufbuild/protobuf/codegenv2"; +import { enumDesc, fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv2"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file api/common.proto. + */ +export const file_api_common: GenFile = /*@__PURE__*/ + fileDesc("ChBhcGkvY29tbW9uLnByb3RvEgltZW1vcy5hcGkiKgoJUGFnZVRva2VuEg0KBWxpbWl0GAEgASgFEg4KBm9mZnNldBgCIAEoBSo4CgVTdGF0ZRIVChFTVEFURV9VTlNQRUNJRklFRBAAEgoKBk5PUk1BTBABEgwKCEFSQ0hJVkVEEAIqOQoJRGlyZWN0aW9uEhkKFURJUkVDVElPTl9VTlNQRUNJRklFRBAAEgcKA0FTQxABEggKBERFU0MQAkKKAQoNY29tLm1lbW9zLmFwaUILQ29tbW9uUHJvdG9QAVonZ2l0aHViLmNvbS91c2VtZW1vcy9tZW1vcy9wcm90by9nZW4vYXBpogIDTUFYqgIJTWVtb3MuQXBpygIJTWVtb3NcQXBp4gIVTWVtb3NcQXBpXEdQQk1ldGFkYXRh6gIKTWVtb3M6OkFwaWIGcHJvdG8z"); + +/** + * PageToken is the internal content of an opaque page token. The service + * serializes it and encodes it as base64; clients must not parse it. + * + * @generated from message memos.api.PageToken + */ +export type PageToken = Message<"memos.api.PageToken"> & { + /** + * The page size used for the next page. + * + * @generated from field: int32 limit = 1; + */ + limit: number; + + /** + * The number of items to skip before the next page. + * + * @generated from field: int32 offset = 2; + */ + offset: number; +}; + +/** + * Describes the message memos.api.PageToken. + * Use `create(PageTokenSchema)` to create a new message. + */ +export const PageTokenSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_common, 0); + +/** + * State is the lifecycle state of a resource. + * + * @generated from enum memos.api.State + */ +export enum State { + /** + * @generated from enum value: STATE_UNSPECIFIED = 0; + */ + STATE_UNSPECIFIED = 0, + + /** + * The resource is active. + * + * @generated from enum value: NORMAL = 1; + */ + NORMAL = 1, + + /** + * The resource is archived. + * + * @generated from enum value: ARCHIVED = 2; + */ + ARCHIVED = 2, +} + +/** + * Describes the enum memos.api.State. + */ +export const StateSchema: GenEnum = /*@__PURE__*/ + enumDesc(file_api_common, 0); + +/** + * Direction is a sort direction. + * + * @generated from enum memos.api.Direction + */ +export enum Direction { + /** + * @generated from enum value: DIRECTION_UNSPECIFIED = 0; + */ + DIRECTION_UNSPECIFIED = 0, + + /** + * Ascending order. + * + * @generated from enum value: ASC = 1; + */ + ASC = 1, + + /** + * Descending order. + * + * @generated from enum value: DESC = 2; + */ + DESC = 2, +} + +/** + * Describes the enum memos.api.Direction. + */ +export const DirectionSchema: GenEnum = /*@__PURE__*/ + enumDesc(file_api_common, 1); + diff --git a/web/src/types/proto/api/idp_service_pb.ts b/web/src/types/proto/api/idp_service_pb.ts new file mode 100644 index 000000000..f6edf6e10 --- /dev/null +++ b/web/src/types/proto/api/idp_service_pb.ts @@ -0,0 +1,435 @@ +// @generated by protoc-gen-es v2.12.1 with parameter "target=ts" +// @generated from file api/idp_service.proto (package memos.api, syntax proto3) +/* eslint-disable */ + +import type { GenEnum, GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv2"; +import { enumDesc, fileDesc, messageDesc, serviceDesc } from "@bufbuild/protobuf/codegenv2"; +import { file_google_api_annotations } from "../google/api/annotations_pb"; +import { file_google_api_client } from "../google/api/client_pb"; +import { file_google_api_field_behavior } from "../google/api/field_behavior_pb"; +import { file_google_api_resource } from "../google/api/resource_pb"; +import type { EmptySchema, FieldMask } from "@bufbuild/protobuf/wkt"; +import { file_google_protobuf_empty, file_google_protobuf_field_mask } from "@bufbuild/protobuf/wkt"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file api/idp_service.proto. + */ +export const file_api_idp_service: GenFile = /*@__PURE__*/ + fileDesc("ChVhcGkvaWRwX3NlcnZpY2UucHJvdG8SCW1lbW9zLmFwaSLQAgoQSWRlbnRpdHlQcm92aWRlchIRCgRuYW1lGAEgASgJQgPgQQgSMwoEdHlwZRgCIAEoDjIgLm1lbW9zLmFwaS5JZGVudGl0eVByb3ZpZGVyLlR5cGVCA+BBAhISCgV0aXRsZRgDIAEoCUID4EECEh4KEWlkZW50aWZpZXJfZmlsdGVyGAQgASgJQgPgQQESNgoGY29uZmlnGAUgASgLMiEubWVtb3MuYXBpLklkZW50aXR5UHJvdmlkZXJDb25maWdCA+BBAiIoCgRUeXBlEhQKEFRZUEVfVU5TUEVDSUZJRUQQABIKCgZPQVVUSDIQATpe6kFbChptZW1vcy5hcGkvSWRlbnRpdHlQcm92aWRlchIYaWRlbnRpdHktcHJvdmlkZXJzL3tpZHB9KhFpZGVudGl0eVByb3ZpZGVyczIQaWRlbnRpdHlQcm92aWRlciIeChxMaXN0SWRlbnRpdHlQcm92aWRlcnNSZXF1ZXN0IlgKHUxpc3RJZGVudGl0eVByb3ZpZGVyc1Jlc3BvbnNlEjcKEmlkZW50aXR5X3Byb3ZpZGVycxgBIAMoCzIbLm1lbW9zLmFwaS5JZGVudGl0eVByb3ZpZGVyIk4KGkdldElkZW50aXR5UHJvdmlkZXJSZXF1ZXN0EjAKBG5hbWUYASABKAlCIuBBAvpBHAoabWVtb3MuYXBpL0lkZW50aXR5UHJvdmlkZXIifwodQ3JlYXRlSWRlbnRpdHlQcm92aWRlclJlcXVlc3QSOwoRaWRlbnRpdHlfcHJvdmlkZXIYASABKAsyGy5tZW1vcy5hcGkuSWRlbnRpdHlQcm92aWRlckID4EECEiEKFGlkZW50aXR5X3Byb3ZpZGVyX2lkGAIgASgJQgPgQQEikgEKHVVwZGF0ZUlkZW50aXR5UHJvdmlkZXJSZXF1ZXN0EjsKEWlkZW50aXR5X3Byb3ZpZGVyGAEgASgLMhsubWVtb3MuYXBpLklkZW50aXR5UHJvdmlkZXJCA+BBAhI0Cgt1cGRhdGVfbWFzaxgCIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5GaWVsZE1hc2tCA+BBAiJRCh1EZWxldGVJZGVudGl0eVByb3ZpZGVyUmVxdWVzdBIwCgRuYW1lGAEgASgJQiLgQQL6QRwKGm1lbW9zLmFwaS9JZGVudGl0eVByb3ZpZGVyIlQKFklkZW50aXR5UHJvdmlkZXJDb25maWcSMAoNb2F1dGgyX2NvbmZpZxgBIAEoCzIXLm1lbW9zLmFwaS5PQXV0aDJDb25maWdIAEIICgZjb25maWcitAEKDE9BdXRoMkNvbmZpZxIRCgljbGllbnRfaWQYASABKAkSFQoNY2xpZW50X3NlY3JldBgCIAEoCRIQCghhdXRoX3VybBgDIAEoCRIRCgl0b2tlbl91cmwYBCABKAkSFQoNdXNlcl9pbmZvX3VybBgFIAEoCRIOCgZzY29wZXMYBiADKAkSLgoNZmllbGRfbWFwcGluZxgHIAEoCzIXLm1lbW9zLmFwaS5GaWVsZE1hcHBpbmciWwoMRmllbGRNYXBwaW5nEhIKCmlkZW50aWZpZXIYASABKAkSFAoMZGlzcGxheV9uYW1lGAIgASgJEg0KBWVtYWlsGAMgASgJEhIKCmF2YXRhcl91cmwYBCABKAkyvQYKF0lkZW50aXR5UHJvdmlkZXJTZXJ2aWNlEosBChVMaXN0SWRlbnRpdHlQcm92aWRlcnMSJy5tZW1vcy5hcGkuTGlzdElkZW50aXR5UHJvdmlkZXJzUmVxdWVzdBooLm1lbW9zLmFwaS5MaXN0SWRlbnRpdHlQcm92aWRlcnNSZXNwb25zZSIfgtPkkwIZEhcvYXBpL2lkZW50aXR5LXByb3ZpZGVycxKKAQoTR2V0SWRlbnRpdHlQcm92aWRlchIlLm1lbW9zLmFwaS5HZXRJZGVudGl0eVByb3ZpZGVyUmVxdWVzdBobLm1lbW9zLmFwaS5JZGVudGl0eVByb3ZpZGVyIi/aQQRuYW1lgtPkkwIiEiAvYXBpL3tuYW1lPWlkZW50aXR5LXByb3ZpZGVycy8qfRKnAQoWQ3JlYXRlSWRlbnRpdHlQcm92aWRlchIoLm1lbW9zLmFwaS5DcmVhdGVJZGVudGl0eVByb3ZpZGVyUmVxdWVzdBobLm1lbW9zLmFwaS5JZGVudGl0eVByb3ZpZGVyIkbaQRFpZGVudGl0eV9wcm92aWRlcoLT5JMCLDoRaWRlbnRpdHlfcHJvdmlkZXIiFy9hcGkvaWRlbnRpdHktcHJvdmlkZXJzEs4BChZVcGRhdGVJZGVudGl0eVByb3ZpZGVyEigubWVtb3MuYXBpLlVwZGF0ZUlkZW50aXR5UHJvdmlkZXJSZXF1ZXN0GhsubWVtb3MuYXBpLklkZW50aXR5UHJvdmlkZXIibdpBHWlkZW50aXR5X3Byb3ZpZGVyLHVwZGF0ZV9tYXNrgtPkkwJHOhFpZGVudGl0eV9wcm92aWRlcjIyL2FwaS97aWRlbnRpdHlfcHJvdmlkZXIubmFtZT1pZGVudGl0eS1wcm92aWRlcnMvKn0SiwEKFkRlbGV0ZUlkZW50aXR5UHJvdmlkZXISKC5tZW1vcy5hcGkuRGVsZXRlSWRlbnRpdHlQcm92aWRlclJlcXVlc3QaFi5nb29nbGUucHJvdG9idWYuRW1wdHkiL9pBBG5hbWWC0+STAiIqIC9hcGkve25hbWU9aWRlbnRpdHktcHJvdmlkZXJzLyp9Qo4BCg1jb20ubWVtb3MuYXBpQg9JZHBTZXJ2aWNlUHJvdG9QAVonZ2l0aHViLmNvbS91c2VtZW1vcy9tZW1vcy9wcm90by9nZW4vYXBpogIDTUFYqgIJTWVtb3MuQXBpygIJTWVtb3NcQXBp4gIVTWVtb3NcQXBpXEdQQk1ldGFkYXRh6gIKTWVtb3M6OkFwaWIGcHJvdG8z", [file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_empty, file_google_protobuf_field_mask]); + +/** + * IdentityProvider is an external identity provider users can sign in with. + * + * @generated from message memos.api.IdentityProvider + */ +export type IdentityProvider = Message<"memos.api.IdentityProvider"> & { + /** + * Identifier. The resource name of the identity provider. + * Format: identity-providers/{idp} + * + * @generated from field: string name = 1; + */ + name: string; + + /** + * Required. The type of the identity provider. + * + * @generated from field: memos.api.IdentityProvider.Type type = 2; + */ + type: IdentityProvider_Type; + + /** + * Required. The display title of the identity provider. + * + * @generated from field: string title = 3; + */ + title: string; + + /** + * Optional. A regular expression the user identifier must match to sign in. Empty allows every identifier. + * + * @generated from field: string identifier_filter = 4; + */ + identifierFilter: string; + + /** + * Required. The type-specific configuration of the identity provider. + * + * @generated from field: memos.api.IdentityProviderConfig config = 5; + */ + config?: IdentityProviderConfig | undefined; +}; + +/** + * Describes the message memos.api.IdentityProvider. + * Use `create(IdentityProviderSchema)` to create a new message. + */ +export const IdentityProviderSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_idp_service, 0); + +/** + * Type is the protocol of an identity provider. + * + * @generated from enum memos.api.IdentityProvider.Type + */ +export enum IdentityProvider_Type { + /** + * @generated from enum value: TYPE_UNSPECIFIED = 0; + */ + TYPE_UNSPECIFIED = 0, + + /** + * OAuth2 identity provider. + * + * @generated from enum value: OAUTH2 = 1; + */ + OAUTH2 = 1, +} + +/** + * Describes the enum memos.api.IdentityProvider.Type. + */ +export const IdentityProvider_TypeSchema: GenEnum = /*@__PURE__*/ + enumDesc(file_api_idp_service, 0, 0); + +/** + * Request message for IdentityProviderService.ListIdentityProviders. + * + * @generated from message memos.api.ListIdentityProvidersRequest + */ +export type ListIdentityProvidersRequest = Message<"memos.api.ListIdentityProvidersRequest"> & { +}; + +/** + * Describes the message memos.api.ListIdentityProvidersRequest. + * Use `create(ListIdentityProvidersRequestSchema)` to create a new message. + */ +export const ListIdentityProvidersRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_idp_service, 1); + +/** + * Response message for IdentityProviderService.ListIdentityProviders. + * + * @generated from message memos.api.ListIdentityProvidersResponse + */ +export type ListIdentityProvidersResponse = Message<"memos.api.ListIdentityProvidersResponse"> & { + /** + * The identity providers. + * + * @generated from field: repeated memos.api.IdentityProvider identity_providers = 1; + */ + identityProviders: IdentityProvider[]; +}; + +/** + * Describes the message memos.api.ListIdentityProvidersResponse. + * Use `create(ListIdentityProvidersResponseSchema)` to create a new message. + */ +export const ListIdentityProvidersResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_idp_service, 2); + +/** + * Request message for IdentityProviderService.GetIdentityProvider. + * + * @generated from message memos.api.GetIdentityProviderRequest + */ +export type GetIdentityProviderRequest = Message<"memos.api.GetIdentityProviderRequest"> & { + /** + * Required. The resource name of the identity provider to get. + * Format: identity-providers/{idp} + * + * @generated from field: string name = 1; + */ + name: string; +}; + +/** + * Describes the message memos.api.GetIdentityProviderRequest. + * Use `create(GetIdentityProviderRequestSchema)` to create a new message. + */ +export const GetIdentityProviderRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_idp_service, 3); + +/** + * Request message for IdentityProviderService.CreateIdentityProvider. + * + * @generated from message memos.api.CreateIdentityProviderRequest + */ +export type CreateIdentityProviderRequest = Message<"memos.api.CreateIdentityProviderRequest"> & { + /** + * Required. The identity provider to create. + * + * @generated from field: memos.api.IdentityProvider identity_provider = 1; + */ + identityProvider?: IdentityProvider | undefined; + + /** + * Optional. The ID to use for the identity provider, which becomes the final component of the resource name. + * If empty, the server generates one. + * Format: ^[a-zA-Z0-9]([a-zA-Z0-9-]{0,34}[a-zA-Z0-9])?$ + * + * @generated from field: string identity_provider_id = 2; + */ + identityProviderId: string; +}; + +/** + * Describes the message memos.api.CreateIdentityProviderRequest. + * Use `create(CreateIdentityProviderRequestSchema)` to create a new message. + */ +export const CreateIdentityProviderRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_idp_service, 4); + +/** + * Request message for IdentityProviderService.UpdateIdentityProvider. + * + * @generated from message memos.api.UpdateIdentityProviderRequest + */ +export type UpdateIdentityProviderRequest = Message<"memos.api.UpdateIdentityProviderRequest"> & { + /** + * Required. The identity provider to update. Its name identifies the provider. + * + * @generated from field: memos.api.IdentityProvider identity_provider = 1; + */ + identityProvider?: IdentityProvider | undefined; + + /** + * Required. The fields to update. Supported paths: title, identifier_filter, config; other paths are ignored. + * An empty OAuth2 client secret in config keeps the stored secret. + * + * @generated from field: google.protobuf.FieldMask update_mask = 2; + */ + updateMask?: FieldMask | undefined; +}; + +/** + * Describes the message memos.api.UpdateIdentityProviderRequest. + * Use `create(UpdateIdentityProviderRequestSchema)` to create a new message. + */ +export const UpdateIdentityProviderRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_idp_service, 5); + +/** + * Request message for IdentityProviderService.DeleteIdentityProvider. + * + * @generated from message memos.api.DeleteIdentityProviderRequest + */ +export type DeleteIdentityProviderRequest = Message<"memos.api.DeleteIdentityProviderRequest"> & { + /** + * Required. The resource name of the identity provider to delete. + * Format: identity-providers/{idp} + * + * @generated from field: string name = 1; + */ + name: string; +}; + +/** + * Describes the message memos.api.DeleteIdentityProviderRequest. + * Use `create(DeleteIdentityProviderRequestSchema)` to create a new message. + */ +export const DeleteIdentityProviderRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_idp_service, 6); + +/** + * IdentityProviderConfig is the type-specific configuration of an identity provider. + * + * @generated from message memos.api.IdentityProviderConfig + */ +export type IdentityProviderConfig = Message<"memos.api.IdentityProviderConfig"> & { + /** + * The configuration, matching the provider type. + * + * @generated from oneof memos.api.IdentityProviderConfig.config + */ + config: { + /** + * The configuration of an OAuth2 identity provider. + * + * @generated from field: memos.api.OAuth2Config oauth2_config = 1; + */ + value: OAuth2Config; + case: "oauth2Config"; + } | { case: undefined; value?: undefined }; +}; + +/** + * Describes the message memos.api.IdentityProviderConfig. + * Use `create(IdentityProviderConfigSchema)` to create a new message. + */ +export const IdentityProviderConfigSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_idp_service, 7); + +/** + * OAuth2Config is the configuration of an OAuth2 identity provider. + * + * @generated from message memos.api.OAuth2Config + */ +export type OAuth2Config = Message<"memos.api.OAuth2Config"> & { + /** + * The OAuth2 client ID. + * + * @generated from field: string client_id = 1; + */ + clientId: string; + + /** + * The OAuth2 client secret. Write-only: it is never returned in responses. + * + * @generated from field: string client_secret = 2; + */ + clientSecret: string; + + /** + * The authorization endpoint URL. + * + * @generated from field: string auth_url = 3; + */ + authUrl: string; + + /** + * The token endpoint URL, used to exchange the authorization code for an access token. + * + * @generated from field: string token_url = 4; + */ + tokenUrl: string; + + /** + * The user info endpoint URL, used to fetch the claims of the signed-in user. + * + * @generated from field: string user_info_url = 5; + */ + userInfoUrl: string; + + /** + * The scopes to request. + * + * @generated from field: repeated string scopes = 6; + */ + scopes: string[]; + + /** + * How user info claims map to user fields. + * + * @generated from field: memos.api.FieldMapping field_mapping = 7; + */ + fieldMapping?: FieldMapping | undefined; +}; + +/** + * Describes the message memos.api.OAuth2Config. + * Use `create(OAuth2ConfigSchema)` to create a new message. + */ +export const OAuth2ConfigSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_idp_service, 8); + +/** + * FieldMapping maps user info claims of an OAuth2 identity provider to user fields. + * Each field holds the name of a claim. + * + * @generated from message memos.api.FieldMapping + */ +export type FieldMapping = Message<"memos.api.FieldMapping"> & { + /** + * The claim that uniquely identifies the user. Sign-in fails when it is missing or empty. + * + * @generated from field: string identifier = 1; + */ + identifier: string; + + /** + * The claim used as the display name. Falls back to the identifier when unset. + * + * @generated from field: string display_name = 2; + */ + displayName: string; + + /** + * The claim used as the email address. + * + * @generated from field: string email = 3; + */ + email: string; + + /** + * The claim used as the avatar URL. + * + * @generated from field: string avatar_url = 4; + */ + avatarUrl: string; +}; + +/** + * Describes the message memos.api.FieldMapping. + * Use `create(FieldMappingSchema)` to create a new message. + */ +export const FieldMappingSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_idp_service, 9); + +/** + * IdentityProviderService manages the external identity providers users can sign in with. + * + * @generated from service memos.api.IdentityProviderService + */ +export const IdentityProviderService: GenService<{ + /** + * ListIdentityProviders lists identity providers. + * Public, so the sign-in page can show SSO options. Client secrets are never returned. + * + * @generated from rpc memos.api.IdentityProviderService.ListIdentityProviders + */ + listIdentityProviders: { + methodKind: "unary"; + input: typeof ListIdentityProvidersRequestSchema; + output: typeof ListIdentityProvidersResponseSchema; + }, + /** + * GetIdentityProvider gets an identity provider. + * The client secret is never returned. + * + * @generated from rpc memos.api.IdentityProviderService.GetIdentityProvider + */ + getIdentityProvider: { + methodKind: "unary"; + input: typeof GetIdentityProviderRequestSchema; + output: typeof IdentityProviderSchema; + }, + /** + * CreateIdentityProvider creates an identity provider. + * Requires the admin role. Fails with FAILED_PRECONDITION when the ID belongs to a provider configured by the + * deployment. + * + * @generated from rpc memos.api.IdentityProviderService.CreateIdentityProvider + */ + createIdentityProvider: { + methodKind: "unary"; + input: typeof CreateIdentityProviderRequestSchema; + output: typeof IdentityProviderSchema; + }, + /** + * UpdateIdentityProvider updates an identity provider. + * Requires the admin role. Providers configured by the deployment cannot be updated. + * + * @generated from rpc memos.api.IdentityProviderService.UpdateIdentityProvider + */ + updateIdentityProvider: { + methodKind: "unary"; + input: typeof UpdateIdentityProviderRequestSchema; + output: typeof IdentityProviderSchema; + }, + /** + * DeleteIdentityProvider deletes an identity provider. + * Requires the admin role. Providers configured by the deployment cannot be deleted. Fails with + * FAILED_PRECONDITION when password sign-in is disabled for regular users and no other effective provider remains. + * + * @generated from rpc memos.api.IdentityProviderService.DeleteIdentityProvider + */ + deleteIdentityProvider: { + methodKind: "unary"; + input: typeof DeleteIdentityProviderRequestSchema; + output: typeof EmptySchema; + }, +}> = /*@__PURE__*/ + serviceDesc(file_api_idp_service, 0); + diff --git a/web/src/types/proto/api/instance_service_pb.ts b/web/src/types/proto/api/instance_service_pb.ts new file mode 100644 index 000000000..64c17bf7f --- /dev/null +++ b/web/src/types/proto/api/instance_service_pb.ts @@ -0,0 +1,1408 @@ +// @generated by protoc-gen-es v2.12.1 with parameter "target=ts" +// @generated from file api/instance_service.proto (package memos.api, syntax proto3) +/* eslint-disable */ + +import type { GenEnum, GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv2"; +import { enumDesc, fileDesc, messageDesc, serviceDesc } from "@bufbuild/protobuf/codegenv2"; +import type { User } from "./user_service_pb"; +import { file_api_user_service } from "./user_service_pb"; +import { file_google_api_annotations } from "../google/api/annotations_pb"; +import { file_google_api_client } from "../google/api/client_pb"; +import { file_google_api_field_behavior } from "../google/api/field_behavior_pb"; +import { file_google_api_resource } from "../google/api/resource_pb"; +import type { EmptySchema, FieldMask, Timestamp } from "@bufbuild/protobuf/wkt"; +import { file_google_protobuf_empty, file_google_protobuf_field_mask, file_google_protobuf_timestamp } from "@bufbuild/protobuf/wkt"; +import type { Color } from "../google/type/color_pb"; +import { file_google_type_color } from "../google/type/color_pb"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file api/instance_service.proto. + */ +export const file_api_instance_service: GenFile = /*@__PURE__*/ + fileDesc("ChphcGkvaW5zdGFuY2Vfc2VydmljZS5wcm90bxIJbWVtb3MuYXBpIqkCCg9JbnN0YW5jZVByb2ZpbGUSDwoHdmVyc2lvbhgBIAEoCRIOCgZjb21taXQYAiABKAkSDAoEZGVtbxgDIAEoCBIUCgxpbnN0YW5jZV91cmwYBCABKAkSMgoLYWNjZXNzX21vZGUYBSABKA4yHS5tZW1vcy5hcGkuSW5zdGFuY2VBY2Nlc3NNb2RlEhMKC25lZWRzX3NldHVwGAYgASgIEh4KBWFkbWluGAcgASgLMg8ubWVtb3MuYXBpLlVzZXISNwoJY2hhbGxlbmdlGAggASgLMiQubWVtb3MuYXBpLkluc3RhbmNlUHJvZmlsZS5DaGFsbGVuZ2UaLwoJQ2hhbGxlbmdlEhAKCHByb3ZpZGVyGAEgASgJEhAKCHNpdGVfa2V5GAIgASgJIhsKGUdldEluc3RhbmNlUHJvZmlsZVJlcXVlc3QisRoKD0luc3RhbmNlU2V0dGluZxIRCgRuYW1lGAEgASgJQgPgQQgSRAoPZ2VuZXJhbF9zZXR0aW5nGAIgASgLMikubWVtb3MuYXBpLkluc3RhbmNlU2V0dGluZy5HZW5lcmFsU2V0dGluZ0gAEkQKD3N0b3JhZ2Vfc2V0dGluZxgDIAEoCzIpLm1lbW9zLmFwaS5JbnN0YW5jZVNldHRpbmcuU3RvcmFnZVNldHRpbmdIABJNChRtZW1vX3JlbGF0ZWRfc2V0dGluZxgEIAEoCzItLm1lbW9zLmFwaS5JbnN0YW5jZVNldHRpbmcuTWVtb1JlbGF0ZWRTZXR0aW5nSAASPgoMdGFnc19zZXR0aW5nGAUgASgLMiYubWVtb3MuYXBpLkluc3RhbmNlU2V0dGluZy5UYWdzU2V0dGluZ0gAEk4KFG5vdGlmaWNhdGlvbl9zZXR0aW5nGAYgASgLMi4ubWVtb3MuYXBpLkluc3RhbmNlU2V0dGluZy5Ob3RpZmljYXRpb25TZXR0aW5nSAASOgoKYWlfc2V0dGluZxgHIAEoCzIkLm1lbW9zLmFwaS5JbnN0YW5jZVNldHRpbmcuQUlTZXR0aW5nSAASQgoOYWNjZXNzX3NldHRpbmcYCCABKAsyKC5tZW1vcy5hcGkuSW5zdGFuY2VTZXR0aW5nLkFjY2Vzc1NldHRpbmdIABqEAwoOR2VuZXJhbFNldHRpbmcSTwoOY3VzdG9tX3Byb2ZpbGUYASABKAsyNy5tZW1vcy5hcGkuSW5zdGFuY2VTZXR0aW5nLkdlbmVyYWxTZXR0aW5nLkN1c3RvbVByb2ZpbGUSIgoaZGlzYWxsb3dfdXNlcl9yZWdpc3RyYXRpb24YAiABKAgSHgoWZGlzYWxsb3dfcGFzc3dvcmRfYXV0aBgDIAEoCBIgChhkaXNhbGxvd19jaGFuZ2VfdXNlcm5hbWUYBCABKAgSIAoYZGlzYWxsb3dfY2hhbmdlX25pY2tuYW1lGAUgASgIEh0KFXdlZWtfc3RhcnRfZGF5X29mZnNldBgGIAEoBRIYChBhZGRpdGlvbmFsX3N0eWxlGAcgASgJEhkKEWFkZGl0aW9uYWxfc2NyaXB0GAggASgJGkUKDUN1c3RvbVByb2ZpbGUSDQoFdGl0bGUYASABKAkSEwoLZGVzY3JpcHRpb24YAiABKAkSEAoIbG9nb191cmwYAyABKAkarQQKDlN0b3JhZ2VTZXR0aW5nEjQKCHN0b3JhZ2VzGAEgAygLMiIubWVtb3MuYXBpLkluc3RhbmNlU2V0dGluZy5TdG9yYWdlEhoKEmRlZmF1bHRfc3RvcmFnZV9pZBgCIAEoCRIZChFmaWxlcGF0aF90ZW1wbGF0ZRgDIAEoCRIcChR1cGxvYWRfc2l6ZV9saW1pdF9tYhgEIAEoAxJLCgxzdG9yYWdlX3R5cGUYBSABKA4yNS5tZW1vcy5hcGkuSW5zdGFuY2VTZXR0aW5nLlN0b3JhZ2VTZXR0aW5nLlN0b3JhZ2VUeXBlEkUKCXMzX2NvbmZpZxgGIAEoCzIyLm1lbW9zLmFwaS5JbnN0YW5jZVNldHRpbmcuU3RvcmFnZVNldHRpbmcuUzNDb25maWcarQEKCFMzQ29uZmlnEhAKCGVuZHBvaW50GAEgASgJEg4KBnJlZ2lvbhgCIAEoCRIOCgZidWNrZXQYAyABKAkSFQoNYWNjZXNzX2tleV9pZBgEIAEoCRIeChFhY2Nlc3Nfa2V5X3NlY3JldBgFIAEoCUID4EEEEhYKDnVzZV9wYXRoX3N0eWxlGAYgASgIEiAKGGluc2VjdXJlX3NraXBfdGxzX3ZlcmlmeRgHIAEoCCJMCgtTdG9yYWdlVHlwZRIcChhTVE9SQUdFX1RZUEVfVU5TUEVDSUZJRUQQABIMCghEQVRBQkFTRRABEgkKBUxPQ0FMEAISBgoCUzMQAxrVAgoHU3RvcmFnZRIKCgJpZBgBIAEoCRIMCgRuYW1lGAIgASgJEjQKBHR5cGUYAyABKA4yJi5tZW1vcy5hcGkuSW5zdGFuY2VTZXR0aW5nLlN0b3JhZ2VUeXBlEkAKCXMzX2NvbmZpZxgEIAEoCzIrLm1lbW9zLmFwaS5JbnN0YW5jZVNldHRpbmcuU3RvcmFnZS5TM0NvbmZpZ0gAGq0BCghTM0NvbmZpZxIQCghlbmRwb2ludBgBIAEoCRIOCgZyZWdpb24YAiABKAkSDgoGYnVja2V0GAMgASgJEhUKDWFjY2Vzc19rZXlfaWQYBCABKAkSHgoRYWNjZXNzX2tleV9zZWNyZXQYBSABKAlCA+BBBBIWCg51c2VfcGF0aF9zdHlsZRgGIAEoCBIgChhpbnNlY3VyZV9za2lwX3Rsc192ZXJpZnkYByABKAhCCAoGY29uZmlnGmcKEk1lbW9SZWxhdGVkU2V0dGluZxIcChRjb250ZW50X2xlbmd0aF9saW1pdBgBIAEoBRIRCglyZWFjdGlvbnMYAiADKAkSIAoYZW5hYmxlX2RvdWJsZV9jbGlja19lZGl0GAMgASgIGqIBCgtUYWdzU2V0dGluZxI+CgR0YWdzGAEgAygLMjAubWVtb3MuYXBpLkluc3RhbmNlU2V0dGluZy5UYWdzU2V0dGluZy5UYWdzRW50cnkaUwoJVGFnc0VudHJ5EgsKA2tleRgBIAEoCRI1CgV2YWx1ZRgCIAEoCzImLm1lbW9zLmFwaS5JbnN0YW5jZVNldHRpbmcuVGFnTWV0YWRhdGE6AjgBGlEKC1RhZ01ldGFkYXRhEiwKEGJhY2tncm91bmRfY29sb3IYASABKAsyEi5nb29nbGUudHlwZS5Db2xvchIUCgxibHVyX2NvbnRlbnQYAiABKAgatwIKE05vdGlmaWNhdGlvblNldHRpbmcSSgoFZW1haWwYASABKAsyOy5tZW1vcy5hcGkuSW5zdGFuY2VTZXR0aW5nLk5vdGlmaWNhdGlvblNldHRpbmcuRW1haWxTZXR0aW5nGtMBCgxFbWFpbFNldHRpbmcSDwoHZW5hYmxlZBgBIAEoCBIRCglzbXRwX2hvc3QYAiABKAkSEQoJc210cF9wb3J0GAMgASgFEhUKDXNtdHBfdXNlcm5hbWUYBCABKAkSGgoNc210cF9wYXNzd29yZBgFIAEoCUID4EEEEg8KB3VzZV90bHMYBiABKAgSDwoHdXNlX3NzbBgHIAEoCBISCgpmcm9tX2VtYWlsGAggASgJEhEKCWZyb21fbmFtZRgJIAEoCRIQCghyZXBseV90bxgKIAEoCRqSAQoJQUlTZXR0aW5nEj4KCXByb3ZpZGVycxgBIAMoCzIrLm1lbW9zLmFwaS5JbnN0YW5jZVNldHRpbmcuQUlQcm92aWRlckNvbmZpZxJFCg10cmFuc2NyaXB0aW9uGAIgASgLMi4ubWVtb3MuYXBpLkluc3RhbmNlU2V0dGluZy5UcmFuc2NyaXB0aW9uQ29uZmlnGsMBChBBSVByb3ZpZGVyQ29uZmlnEgoKAmlkGAEgASgJEg0KBXRpdGxlGAIgASgJEjcKBHR5cGUYAyABKA4yKS5tZW1vcy5hcGkuSW5zdGFuY2VTZXR0aW5nLkFJUHJvdmlkZXJUeXBlEhAKCGVuZHBvaW50GAQgASgJEhQKB2FwaV9rZXkYBSABKAlCA+BBBBIYCgthcGlfa2V5X3NldBgGIAEoCEID4EEDEhkKDGFwaV9rZXlfaGludBgHIAEoCUID4EEDGlsKE1RyYW5zY3JpcHRpb25Db25maWcSEwoLcHJvdmlkZXJfaWQYASABKAkSDQoFbW9kZWwYAiABKAkSEAoIbGFuZ3VhZ2UYAyABKAkSDgoGcHJvbXB0GAQgASgJGkMKDUFjY2Vzc1NldHRpbmcSMgoLYWNjZXNzX21vZGUYASABKA4yHS5tZW1vcy5hcGkuSW5zdGFuY2VBY2Nlc3NNb2RlInYKA0tleRITCg9LRVlfVU5TUEVDSUZJRUQQABILCgdHRU5FUkFMEAESCwoHU1RPUkFHRRACEhAKDE1FTU9fUkVMQVRFRBADEggKBFRBR1MQBBIQCgxOT1RJRklDQVRJT04QBRIGCgJBSRAGEgoKBkFDQ0VTUxAHIkwKC1N0b3JhZ2VUeXBlEhwKGFNUT1JBR0VfVFlQRV9VTlNQRUNJRklFRBAAEgwKCERBVEFCQVNFEAESCQoFTE9DQUwQAhIGCgJTMxADIkoKDkFJUHJvdmlkZXJUeXBlEiAKHEFJX1BST1ZJREVSX1RZUEVfVU5TUEVDSUZJRUQQABIKCgZPUEVOQUkQARIKCgZHRU1JTkkQAjpe6kFbChltZW1vcy5hcGkvSW5zdGFuY2VTZXR0aW5nEhtpbnN0YW5jZS9zZXR0aW5ncy97c2V0dGluZ30qEGluc3RhbmNlU2V0dGluZ3MyD2luc3RhbmNlU2V0dGluZ0IHCgV2YWx1ZSJMChlHZXRJbnN0YW5jZVNldHRpbmdSZXF1ZXN0Ei8KBG5hbWUYASABKAlCIeBBAvpBGwoZbWVtb3MuYXBpL0luc3RhbmNlU2V0dGluZyJTCh9CYXRjaEdldEluc3RhbmNlU2V0dGluZ3NSZXF1ZXN0EjAKBW5hbWVzGAEgAygJQiHgQQL6QRsKGW1lbW9zLmFwaS9JbnN0YW5jZVNldHRpbmciWQogQmF0Y2hHZXRJbnN0YW5jZVNldHRpbmdzUmVzcG9uc2USNQoRaW5zdGFuY2Vfc2V0dGluZ3MYASADKAsyGi5tZW1vcy5hcGkuSW5zdGFuY2VTZXR0aW5nIo8BChxVcGRhdGVJbnN0YW5jZVNldHRpbmdSZXF1ZXN0EjkKEGluc3RhbmNlX3NldHRpbmcYASABKAsyGi5tZW1vcy5hcGkuSW5zdGFuY2VTZXR0aW5nQgPgQQISNAoLdXBkYXRlX21hc2sYAiABKAsyGi5nb29nbGUucHJvdG9idWYuRmllbGRNYXNrQgPgQQEikAEKH1Rlc3RJbnN0YW5jZUVtYWlsU2V0dGluZ1JlcXVlc3QSTwoFZW1haWwYASABKAsyOy5tZW1vcy5hcGkuSW5zdGFuY2VTZXR0aW5nLk5vdGlmaWNhdGlvblNldHRpbmcuRW1haWxTZXR0aW5nQgPgQQESHAoPcmVjaXBpZW50X2VtYWlsGAIgASgJQgPgQQEizwEKDUluc3RhbmNlU3RhdHMSOAoIZGF0YWJhc2UYASABKAsyJi5tZW1vcy5hcGkuSW5zdGFuY2VTdGF0cy5EYXRhYmFzZVN0YXRzEhsKE2xvY2FsX3N0b3JhZ2VfYnl0ZXMYAiABKAMSMgoOZ2VuZXJhdGVkX3RpbWUYAyABKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wGjMKDURhdGFiYXNlU3RhdHMSDgoGZHJpdmVyGAEgASgJEhIKCnNpemVfYnl0ZXMYAiABKAMiGQoXR2V0SW5zdGFuY2VTdGF0c1JlcXVlc3QqfQoSSW5zdGFuY2VBY2Nlc3NNb2RlEiQKIElOU1RBTkNFX0FDQ0VTU19NT0RFX1VOU1BFQ0lGSUVEEAASIAocSU5TVEFOQ0VfQUNDRVNTX01PREVfUFJJVkFURRABEh8KG0lOU1RBTkNFX0FDQ0VTU19NT0RFX1BVQkxJQxACMocHCg9JbnN0YW5jZVNlcnZpY2USdQoSR2V0SW5zdGFuY2VQcm9maWxlEiQubWVtb3MuYXBpLkdldEluc3RhbmNlUHJvZmlsZVJlcXVlc3QaGi5tZW1vcy5hcGkuSW5zdGFuY2VQcm9maWxlIh2C0+STAhcSFS9hcGkvaW5zdGFuY2UvcHJvZmlsZRKGAQoSR2V0SW5zdGFuY2VTZXR0aW5nEiQubWVtb3MuYXBpLkdldEluc3RhbmNlU2V0dGluZ1JlcXVlc3QaGi5tZW1vcy5hcGkuSW5zdGFuY2VTZXR0aW5nIi7aQQRuYW1lgtPkkwIhEh8vYXBpL3tuYW1lPWluc3RhbmNlL3NldHRpbmdzLyp9Ep8BChhCYXRjaEdldEluc3RhbmNlU2V0dGluZ3MSKi5tZW1vcy5hcGkuQmF0Y2hHZXRJbnN0YW5jZVNldHRpbmdzUmVxdWVzdBorLm1lbW9zLmFwaS5CYXRjaEdldEluc3RhbmNlU2V0dGluZ3NSZXNwb25zZSIqgtPkkwIkOgEqIh8vYXBpL2luc3RhbmNlL3NldHRpbmdzOmJhdGNoR2V0EscBChVVcGRhdGVJbnN0YW5jZVNldHRpbmcSJy5tZW1vcy5hcGkuVXBkYXRlSW5zdGFuY2VTZXR0aW5nUmVxdWVzdBoaLm1lbW9zLmFwaS5JbnN0YW5jZVNldHRpbmciadpBHGluc3RhbmNlX3NldHRpbmcsdXBkYXRlX21hc2uC0+STAkQ6EGluc3RhbmNlX3NldHRpbmcyMC9hcGkve2luc3RhbmNlX3NldHRpbmcubmFtZT1pbnN0YW5jZS9zZXR0aW5ncy8qfRKYAQoYVGVzdEluc3RhbmNlRW1haWxTZXR0aW5nEioubWVtb3MuYXBpLlRlc3RJbnN0YW5jZUVtYWlsU2V0dGluZ1JlcXVlc3QaFi5nb29nbGUucHJvdG9idWYuRW1wdHkiOILT5JMCMjoBKiItL2FwaS9pbnN0YW5jZS9zZXR0aW5ncy9ub3RpZmljYXRpb246dGVzdEVtYWlsEm0KEEdldEluc3RhbmNlU3RhdHMSIi5tZW1vcy5hcGkuR2V0SW5zdGFuY2VTdGF0c1JlcXVlc3QaGC5tZW1vcy5hcGkuSW5zdGFuY2VTdGF0cyIbgtPkkwIVEhMvYXBpL2luc3RhbmNlL3N0YXRzQpMBCg1jb20ubWVtb3MuYXBpQhRJbnN0YW5jZVNlcnZpY2VQcm90b1ABWidnaXRodWIuY29tL3VzZW1lbW9zL21lbW9zL3Byb3RvL2dlbi9hcGmiAgNNQViqAglNZW1vcy5BcGnKAglNZW1vc1xBcGniAhVNZW1vc1xBcGlcR1BCTWV0YWRhdGHqAgpNZW1vczo6QXBpYgZwcm90bzM", [file_api_user_service, file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_empty, file_google_protobuf_field_mask, file_google_protobuf_timestamp, file_google_type_color]); + +/** + * InstanceProfile is the basic information about the instance. + * + * @generated from message memos.api.InstanceProfile + */ +export type InstanceProfile = Message<"memos.api.InstanceProfile"> & { + /** + * The version of the running server. + * + * @generated from field: string version = 1; + */ + version: string; + + /** + * The build commit of the running server. + * + * @generated from field: string commit = 2; + */ + commit: string; + + /** + * Whether the instance runs in demo mode. + * + * @generated from field: bool demo = 3; + */ + demo: boolean; + + /** + * The configured URL of the instance. + * + * @generated from field: string instance_url = 4; + */ + instanceUrl: string; + + /** + * Whether unauthenticated users may access instance content. + * + * @generated from field: memos.api.InstanceAccessMode access_mode = 5; + */ + accessMode: InstanceAccessMode; + + /** + * Whether the instance has no users yet and requires initial setup (creating the first admin account). + * Unlike a null admin, this stays false once any user exists, so an instance that has lost its admins is not + * mistaken for a fresh install. + * + * @generated from field: bool needs_setup = 6; + */ + needsSetup: boolean; + + /** + * The first administrator of the instance, for display purposes. + * May be null on an instance that has lost all admins; use needs_setup to determine whether initial setup is + * required. + * + * @generated from field: memos.api.User admin = 7; + */ + admin?: User | undefined; + + /** + * The proof-of-humanity challenge required on signup and password sign-in. + * Absent when none is configured, which is the case on every self-hosted instance. + * + * @generated from field: memos.api.InstanceProfile.Challenge challenge = 8; + */ + challenge?: InstanceProfile_Challenge | undefined; +}; + +/** + * Describes the message memos.api.InstanceProfile. + * Use `create(InstanceProfileSchema)` to create a new message. + */ +export const InstanceProfileSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_instance_service, 0); + +/** + * Challenge describes a proof-of-humanity challenge widget. + * + * @generated from message memos.api.InstanceProfile.Challenge + */ +export type InstanceProfile_Challenge = Message<"memos.api.InstanceProfile.Challenge"> & { + /** + * The challenge provider, which selects the widget the web app renders. + * + * @generated from field: string provider = 1; + */ + provider: string; + + /** + * The provider's public site key for the widget. + * + * @generated from field: string site_key = 2; + */ + siteKey: string; +}; + +/** + * Describes the message memos.api.InstanceProfile.Challenge. + * Use `create(InstanceProfile_ChallengeSchema)` to create a new message. + */ +export const InstanceProfile_ChallengeSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_instance_service, 0, 0); + +/** + * Request message for InstanceService.GetInstanceProfile. + * + * @generated from message memos.api.GetInstanceProfileRequest + */ +export type GetInstanceProfileRequest = Message<"memos.api.GetInstanceProfileRequest"> & { +}; + +/** + * Describes the message memos.api.GetInstanceProfileRequest. + * Use `create(GetInstanceProfileRequestSchema)` to create a new message. + */ +export const GetInstanceProfileRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_instance_service, 1); + +/** + * InstanceSetting is one group of instance-wide settings, selected by its key. + * + * @generated from message memos.api.InstanceSetting + */ +export type InstanceSetting = Message<"memos.api.InstanceSetting"> & { + /** + * Identifier. The resource name of the instance setting. {setting} is a Key value, such as GENERAL. + * Format: instance/settings/{setting} + * + * @generated from field: string name = 1; + */ + name: string; + + /** + * The setting value. The set field matches the key in name. + * + * @generated from oneof memos.api.InstanceSetting.value + */ + value: { + /** + * The value of the GENERAL setting. + * + * @generated from field: memos.api.InstanceSetting.GeneralSetting general_setting = 2; + */ + value: InstanceSetting_GeneralSetting; + case: "generalSetting"; + } | { + /** + * The value of the STORAGE setting. + * + * @generated from field: memos.api.InstanceSetting.StorageSetting storage_setting = 3; + */ + value: InstanceSetting_StorageSetting; + case: "storageSetting"; + } | { + /** + * The value of the MEMO_RELATED setting. + * + * @generated from field: memos.api.InstanceSetting.MemoRelatedSetting memo_related_setting = 4; + */ + value: InstanceSetting_MemoRelatedSetting; + case: "memoRelatedSetting"; + } | { + /** + * The value of the TAGS setting. + * + * @generated from field: memos.api.InstanceSetting.TagsSetting tags_setting = 5; + */ + value: InstanceSetting_TagsSetting; + case: "tagsSetting"; + } | { + /** + * The value of the NOTIFICATION setting. + * + * @generated from field: memos.api.InstanceSetting.NotificationSetting notification_setting = 6; + */ + value: InstanceSetting_NotificationSetting; + case: "notificationSetting"; + } | { + /** + * The value of the AI setting. + * + * @generated from field: memos.api.InstanceSetting.AISetting ai_setting = 7; + */ + value: InstanceSetting_AISetting; + case: "aiSetting"; + } | { + /** + * The value of the ACCESS setting. + * + * @generated from field: memos.api.InstanceSetting.AccessSetting access_setting = 8; + */ + value: InstanceSetting_AccessSetting; + case: "accessSetting"; + } | { case: undefined; value?: undefined }; +}; + +/** + * Describes the message memos.api.InstanceSetting. + * Use `create(InstanceSettingSchema)` to create a new message. + */ +export const InstanceSettingSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_instance_service, 2); + +/** + * GeneralSetting is the general instance configuration. + * + * @generated from message memos.api.InstanceSetting.GeneralSetting + */ +export type InstanceSetting_GeneralSetting = Message<"memos.api.InstanceSetting.GeneralSetting"> & { + /** + * Branding shown in the web app. + * + * @generated from field: memos.api.InstanceSetting.GeneralSetting.CustomProfile custom_profile = 1; + */ + customProfile?: InstanceSetting_GeneralSetting_CustomProfile | undefined; + + /** + * Whether user self-registration is disabled. + * + * @generated from field: bool disallow_user_registration = 2; + */ + disallowUserRegistration: boolean; + + /** + * Whether password authentication is disabled. + * + * @generated from field: bool disallow_password_auth = 3; + */ + disallowPasswordAuth: boolean; + + /** + * Whether users are prevented from changing their username. + * + * @generated from field: bool disallow_change_username = 4; + */ + disallowChangeUsername: boolean; + + /** + * Whether users are prevented from changing their nickname. + * + * @generated from field: bool disallow_change_nickname = 5; + */ + disallowChangeNickname: boolean; + + /** + * The first day of the week as an offset from Sunday. + * 0: Sunday, 1: Monday, 2: Tuesday, 3: Wednesday, 4: Thursday, 5: Friday, 6: Saturday. + * Default is Sunday. + * + * @generated from field: int32 week_start_day_offset = 6; + */ + weekStartDayOffset: number; + + /** + * Custom CSS injected into the web app. + * + * @generated from field: string additional_style = 7; + */ + additionalStyle: string; + + /** + * Custom JavaScript injected into the web app. + * + * @generated from field: string additional_script = 8; + */ + additionalScript: string; +}; + +/** + * Describes the message memos.api.InstanceSetting.GeneralSetting. + * Use `create(InstanceSetting_GeneralSettingSchema)` to create a new message. + */ +export const InstanceSetting_GeneralSettingSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_instance_service, 2, 0); + +/** + * CustomProfile is the instance branding. + * + * @generated from message memos.api.InstanceSetting.GeneralSetting.CustomProfile + */ +export type InstanceSetting_GeneralSetting_CustomProfile = Message<"memos.api.InstanceSetting.GeneralSetting.CustomProfile"> & { + /** + * The instance title. + * + * @generated from field: string title = 1; + */ + title: string; + + /** + * The instance description. + * + * @generated from field: string description = 2; + */ + description: string; + + /** + * The URL of the instance logo. + * + * @generated from field: string logo_url = 3; + */ + logoUrl: string; +}; + +/** + * Describes the message memos.api.InstanceSetting.GeneralSetting.CustomProfile. + * Use `create(InstanceSetting_GeneralSetting_CustomProfileSchema)` to create a new message. + */ +export const InstanceSetting_GeneralSetting_CustomProfileSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_instance_service, 2, 0, 0); + +/** + * StorageSetting is the attachment storage configuration. + * + * @generated from message memos.api.InstanceSetting.StorageSetting + */ +export type InstanceSetting_StorageSetting = Message<"memos.api.InstanceSetting.StorageSetting"> & { + /** + * Configured storage instances, including inactive instances still referenced by attachments. + * + * @generated from field: repeated memos.api.InstanceSetting.Storage storages = 1; + */ + storages: InstanceSetting_Storage[]; + + /** + * The ID of the storage used for new attachments. + * + * @generated from field: string default_storage_id = 2; + */ + defaultStorageId: string; + + /** + * The template of attachment file paths. + * Default is assets/{timestamp}_{uuid}_{filename}. + * + * @generated from field: string filepath_template = 3; + */ + filepathTemplate: string; + + /** + * The maximum upload size in megabytes. Default is 30. + * + * @generated from field: int64 upload_size_limit_mb = 4; + */ + uploadSizeLimitMb: bigint; + + /** + * Legacy compatibility field. New clients use default_storage_id. + * + * @generated from field: memos.api.InstanceSetting.StorageSetting.StorageType storage_type = 5; + */ + storageType: InstanceSetting_StorageSetting_StorageType; + + /** + * Legacy compatibility field. New clients use storages. + * + * @generated from field: memos.api.InstanceSetting.StorageSetting.S3Config s3_config = 6; + */ + s3Config?: InstanceSetting_StorageSetting_S3Config | undefined; +}; + +/** + * Describes the message memos.api.InstanceSetting.StorageSetting. + * Use `create(InstanceSetting_StorageSettingSchema)` to create a new message. + */ +export const InstanceSetting_StorageSettingSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_instance_service, 2, 1); + +/** + * S3Config is the legacy S3 configuration, retained for compatibility with existing clients. + * Reference: https://developers.cloudflare.com/r2/examples/aws/aws-sdk-go/ + * + * @generated from message memos.api.InstanceSetting.StorageSetting.S3Config + */ +export type InstanceSetting_StorageSetting_S3Config = Message<"memos.api.InstanceSetting.StorageSetting.S3Config"> & { + /** + * The S3 endpoint URL. + * + * @generated from field: string endpoint = 1; + */ + endpoint: string; + + /** + * The S3 region. + * + * @generated from field: string region = 2; + */ + region: string; + + /** + * The S3 bucket. + * + * @generated from field: string bucket = 3; + */ + bucket: string; + + /** + * The S3 access key ID. + * + * @generated from field: string access_key_id = 4; + */ + accessKeyId: string; + + /** + * Input only. The S3 access key secret. Never returned; an empty value keeps the stored secret. + * + * @generated from field: string access_key_secret = 5; + */ + accessKeySecret: string; + + /** + * Whether to use path-style addressing instead of virtual-hosted-style. + * + * @generated from field: bool use_path_style = 6; + */ + usePathStyle: boolean; + + /** + * Whether to skip TLS certificate verification when connecting to the S3 endpoint. + * Only enable this for trusted endpoints that use a self-signed certificate; it removes protection against + * man-in-the-middle attacks. + * + * @generated from field: bool insecure_skip_tls_verify = 7; + */ + insecureSkipTlsVerify: boolean; +}; + +/** + * Describes the message memos.api.InstanceSetting.StorageSetting.S3Config. + * Use `create(InstanceSetting_StorageSetting_S3ConfigSchema)` to create a new message. + */ +export const InstanceSetting_StorageSetting_S3ConfigSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_instance_service, 2, 1, 0); + +/** + * StorageType is the legacy storage type, retained for compatibility with existing clients. + * + * @generated from enum memos.api.InstanceSetting.StorageSetting.StorageType + */ +export enum InstanceSetting_StorageSetting_StorageType { + /** + * @generated from enum value: STORAGE_TYPE_UNSPECIFIED = 0; + */ + STORAGE_TYPE_UNSPECIFIED = 0, + + /** + * Database storage. + * + * @generated from enum value: DATABASE = 1; + */ + DATABASE = 1, + + /** + * Local filesystem storage. + * + * @generated from enum value: LOCAL = 2; + */ + LOCAL = 2, + + /** + * S3 storage. + * + * @generated from enum value: S3 = 3; + */ + S3 = 3, +} + +/** + * Describes the enum memos.api.InstanceSetting.StorageSetting.StorageType. + */ +export const InstanceSetting_StorageSetting_StorageTypeSchema: GenEnum = /*@__PURE__*/ + enumDesc(file_api_instance_service, 2, 1, 0); + +/** + * Storage is a configured attachment storage instance. + * + * @generated from message memos.api.InstanceSetting.Storage + */ +export type InstanceSetting_Storage = Message<"memos.api.InstanceSetting.Storage"> & { + /** + * The stable identifier referenced by attachments. + * + * @generated from field: string id = 1; + */ + id: string; + + /** + * The human-readable storage name. + * + * @generated from field: string name = 2; + */ + name: string; + + /** + * The storage backend. + * + * @generated from field: memos.api.InstanceSetting.StorageType type = 3; + */ + type: InstanceSetting_StorageType; + + /** + * The backend-specific configuration. + * + * @generated from oneof memos.api.InstanceSetting.Storage.config + */ + config: { + /** + * The configuration of an S3 storage. + * + * @generated from field: memos.api.InstanceSetting.Storage.S3Config s3_config = 4; + */ + value: InstanceSetting_Storage_S3Config; + case: "s3Config"; + } | { case: undefined; value?: undefined }; +}; + +/** + * Describes the message memos.api.InstanceSetting.Storage. + * Use `create(InstanceSetting_StorageSchema)` to create a new message. + */ +export const InstanceSetting_StorageSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_instance_service, 2, 2); + +/** + * S3Config is the configuration of an S3-compatible object store. + * Reference: https://developers.cloudflare.com/r2/examples/aws/aws-sdk-go/ + * + * @generated from message memos.api.InstanceSetting.Storage.S3Config + */ +export type InstanceSetting_Storage_S3Config = Message<"memos.api.InstanceSetting.Storage.S3Config"> & { + /** + * The S3 endpoint URL. + * + * @generated from field: string endpoint = 1; + */ + endpoint: string; + + /** + * The S3 region. + * + * @generated from field: string region = 2; + */ + region: string; + + /** + * The S3 bucket. + * + * @generated from field: string bucket = 3; + */ + bucket: string; + + /** + * The S3 access key ID. + * + * @generated from field: string access_key_id = 4; + */ + accessKeyId: string; + + /** + * Input only. The S3 access key secret. Never returned; an empty value keeps the stored secret. + * + * @generated from field: string access_key_secret = 5; + */ + accessKeySecret: string; + + /** + * Whether to use path-style addressing instead of virtual-hosted-style. + * + * @generated from field: bool use_path_style = 6; + */ + usePathStyle: boolean; + + /** + * Whether to skip TLS certificate verification when connecting to the S3 endpoint. + * Only enable this for trusted endpoints that use a self-signed certificate; it removes protection against + * man-in-the-middle attacks. + * + * @generated from field: bool insecure_skip_tls_verify = 7; + */ + insecureSkipTlsVerify: boolean; +}; + +/** + * Describes the message memos.api.InstanceSetting.Storage.S3Config. + * Use `create(InstanceSetting_Storage_S3ConfigSchema)` to create a new message. + */ +export const InstanceSetting_Storage_S3ConfigSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_instance_service, 2, 2, 0); + +/** + * MemoRelatedSetting is the memo-related instance configuration. + * + * @generated from message memos.api.InstanceSetting.MemoRelatedSetting + */ +export type InstanceSetting_MemoRelatedSetting = Message<"memos.api.InstanceSetting.MemoRelatedSetting"> & { + /** + * The maximum memo content length in bytes. Default and minimum is 8192. + * + * @generated from field: int32 content_length_limit = 1; + */ + contentLengthLimit: number; + + /** + * The reactions users can choose from. Defaults to a built-in emoji set when empty. + * + * @generated from field: repeated string reactions = 2; + */ + reactions: string[]; + + /** + * Whether double-clicking a memo opens it for editing. + * + * @generated from field: bool enable_double_click_edit = 3; + */ + enableDoubleClickEdit: boolean; +}; + +/** + * Describes the message memos.api.InstanceSetting.MemoRelatedSetting. + * Use `create(InstanceSetting_MemoRelatedSettingSchema)` to create a new message. + */ +export const InstanceSetting_MemoRelatedSettingSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_instance_service, 2, 3); + +/** + * TagsSetting is the instance-wide tag metadata configuration. + * Active tag metadata is stored in per-user tag settings. This message remains for backward compatibility with + * existing clients and migrations. + * + * @generated from message memos.api.InstanceSetting.TagsSetting + */ +export type InstanceSetting_TagsSetting = Message<"memos.api.InstanceSetting.TagsSetting"> & { + /** + * Map of tag name pattern to tag metadata. + * Each key is treated as an anchored regular expression (^pattern$), so a single entry like "project/.*" matches + * all tags under that prefix. Exact tag names are also valid. + * + * @generated from field: map tags = 1; + */ + tags: { [key: string]: InstanceSetting_TagMetadata }; +}; + +/** + * Describes the message memos.api.InstanceSetting.TagsSetting. + * Use `create(InstanceSetting_TagsSettingSchema)` to create a new message. + */ +export const InstanceSetting_TagsSettingSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_instance_service, 2, 4); + +/** + * TagMetadata is the display metadata for a tag. + * + * @generated from message memos.api.InstanceSetting.TagMetadata + */ +export type InstanceSetting_TagMetadata = Message<"memos.api.InstanceSetting.TagMetadata"> & { + /** + * The background color of the tag label. When unset, the default tag color is used. + * + * @generated from field: google.type.Color background_color = 1; + */ + backgroundColor?: Color | undefined; + + /** + * Whether memos with this tag have their content blurred. + * + * @generated from field: bool blur_content = 2; + */ + blurContent: boolean; +}; + +/** + * Describes the message memos.api.InstanceSetting.TagMetadata. + * Use `create(InstanceSetting_TagMetadataSchema)` to create a new message. + */ +export const InstanceSetting_TagMetadataSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_instance_service, 2, 5); + +/** + * NotificationSetting is the notification transport configuration. + * + * @generated from message memos.api.InstanceSetting.NotificationSetting + */ +export type InstanceSetting_NotificationSetting = Message<"memos.api.InstanceSetting.NotificationSetting"> & { + /** + * The email delivery configuration. + * + * @generated from field: memos.api.InstanceSetting.NotificationSetting.EmailSetting email = 1; + */ + email?: InstanceSetting_NotificationSetting_EmailSetting | undefined; +}; + +/** + * Describes the message memos.api.InstanceSetting.NotificationSetting. + * Use `create(InstanceSetting_NotificationSettingSchema)` to create a new message. + */ +export const InstanceSetting_NotificationSettingSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_instance_service, 2, 6); + +/** + * EmailSetting is the SMTP configuration for notification emails. + * + * @generated from message memos.api.InstanceSetting.NotificationSetting.EmailSetting + */ +export type InstanceSetting_NotificationSetting_EmailSetting = Message<"memos.api.InstanceSetting.NotificationSetting.EmailSetting"> & { + /** + * Whether email notifications are enabled. + * + * @generated from field: bool enabled = 1; + */ + enabled: boolean; + + /** + * The SMTP server host. + * + * @generated from field: string smtp_host = 2; + */ + smtpHost: string; + + /** + * The SMTP server port. + * + * @generated from field: int32 smtp_port = 3; + */ + smtpPort: number; + + /** + * The SMTP username. + * + * @generated from field: string smtp_username = 4; + */ + smtpUsername: string; + + /** + * Input only. The SMTP password. Never returned. An empty value keeps the stored password, unless the host, + * port, username or encryption settings change. + * + * @generated from field: string smtp_password = 5; + */ + smtpPassword: string; + + /** + * Whether to use STARTTLS. + * + * @generated from field: bool use_tls = 6; + */ + useTls: boolean; + + /** + * Whether to use implicit SSL/TLS. + * + * @generated from field: bool use_ssl = 7; + */ + useSsl: boolean; + + /** + * The sender email address. + * + * @generated from field: string from_email = 8; + */ + fromEmail: string; + + /** + * The sender display name. + * + * @generated from field: string from_name = 9; + */ + fromName: string; + + /** + * The Reply-To email address. + * + * @generated from field: string reply_to = 10; + */ + replyTo: string; +}; + +/** + * Describes the message memos.api.InstanceSetting.NotificationSetting.EmailSetting. + * Use `create(InstanceSetting_NotificationSetting_EmailSettingSchema)` to create a new message. + */ +export const InstanceSetting_NotificationSetting_EmailSettingSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_instance_service, 2, 6, 0); + +/** + * AISetting is the AI provider configuration. + * + * @generated from message memos.api.InstanceSetting.AISetting + */ +export type InstanceSetting_AISetting = Message<"memos.api.InstanceSetting.AISetting"> & { + /** + * The AI provider configurations available instance-wide. + * + * @generated from field: repeated memos.api.InstanceSetting.AIProviderConfig providers = 1; + */ + providers: InstanceSetting_AIProviderConfig[]; + + /** + * The speech-to-text feature configuration. + * When unset or transcription.provider_id is empty, transcription is disabled. An update that omits it keeps the + * stored configuration. + * + * @generated from field: memos.api.InstanceSetting.TranscriptionConfig transcription = 2; + */ + transcription?: InstanceSetting_TranscriptionConfig | undefined; +}; + +/** + * Describes the message memos.api.InstanceSetting.AISetting. + * Use `create(InstanceSetting_AISettingSchema)` to create a new message. + */ +export const InstanceSetting_AISettingSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_instance_service, 2, 7); + +/** + * AIProviderConfig is one callable AI provider connection. + * + * @generated from message memos.api.InstanceSetting.AIProviderConfig + */ +export type InstanceSetting_AIProviderConfig = Message<"memos.api.InstanceSetting.AIProviderConfig"> & { + /** + * The provider ID. Generated when empty on update. + * + * @generated from field: string id = 1; + */ + id: string; + + /** + * The provider display title. + * + * @generated from field: string title = 2; + */ + title: string; + + /** + * The provider implementation type. + * + * @generated from field: memos.api.InstanceSetting.AIProviderType type = 3; + */ + type: InstanceSetting_AIProviderType; + + /** + * The provider API endpoint. Defaults to the provider's public endpoint when empty. + * + * @generated from field: string endpoint = 4; + */ + endpoint: string; + + /** + * Input only. The provider API key. Never returned; an empty value keeps the stored key. + * + * @generated from field: string api_key = 5; + */ + apiKey: string; + + /** + * Output only. Whether an API key is stored for this provider. + * + * @generated from field: bool api_key_set = 6; + */ + apiKeySet: boolean; + + /** + * Output only. A masked hint of the stored API key. + * + * @generated from field: string api_key_hint = 7; + */ + apiKeyHint: string; +}; + +/** + * Describes the message memos.api.InstanceSetting.AIProviderConfig. + * Use `create(InstanceSetting_AIProviderConfigSchema)` to create a new message. + */ +export const InstanceSetting_AIProviderConfigSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_instance_service, 2, 8); + +/** + * TranscriptionConfig is the speech-to-text feature configuration. + * + * @generated from message memos.api.InstanceSetting.TranscriptionConfig + */ +export type InstanceSetting_TranscriptionConfig = Message<"memos.api.InstanceSetting.TranscriptionConfig"> & { + /** + * The ID of the provider used for transcription; must reference an entry in AISetting.providers. + * Empty means transcription is disabled. + * + * @generated from field: string provider_id = 1; + */ + providerId: string; + + /** + * The provider-specific model identifier. Hidden from non-admins. + * Empty falls back to the engine default (whisper-1 for OPENAI providers, gemini-2.5-flash for GEMINI providers). + * + * @generated from field: string model = 2; + */ + model: string; + + /** + * The default ISO 639-1 language hint sent to the provider. Hidden from non-admins. + * Empty lets the provider auto-detect. + * + * @generated from field: string language = 3; + */ + language: string; + + /** + * A default spelling and vocabulary hint passed to the provider. Hidden from non-admins. + * + * @generated from field: string prompt = 4; + */ + prompt: string; +}; + +/** + * Describes the message memos.api.InstanceSetting.TranscriptionConfig. + * Use `create(InstanceSetting_TranscriptionConfigSchema)` to create a new message. + */ +export const InstanceSetting_TranscriptionConfigSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_instance_service, 2, 9); + +/** + * AccessSetting is the instance access policy. + * + * @generated from message memos.api.InstanceSetting.AccessSetting + */ +export type InstanceSetting_AccessSetting = Message<"memos.api.InstanceSetting.AccessSetting"> & { + /** + * Whether unauthenticated users may access instance content. Must be PRIVATE or PUBLIC on update. + * + * @generated from field: memos.api.InstanceAccessMode access_mode = 1; + */ + accessMode: InstanceAccessMode; +}; + +/** + * Describes the message memos.api.InstanceSetting.AccessSetting. + * Use `create(InstanceSetting_AccessSettingSchema)` to create a new message. + */ +export const InstanceSetting_AccessSettingSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_instance_service, 2, 10); + +/** + * Key identifies an instance setting. + * + * @generated from enum memos.api.InstanceSetting.Key + */ +export enum InstanceSetting_Key { + /** + * @generated from enum value: KEY_UNSPECIFIED = 0; + */ + KEY_UNSPECIFIED = 0, + + /** + * General settings. + * + * @generated from enum value: GENERAL = 1; + */ + GENERAL = 1, + + /** + * Attachment storage settings. + * + * @generated from enum value: STORAGE = 2; + */ + STORAGE = 2, + + /** + * Memo-related settings. + * + * @generated from enum value: MEMO_RELATED = 3; + */ + MEMO_RELATED = 3, + + /** + * Tag metadata. + * + * @generated from enum value: TAGS = 4; + */ + TAGS = 4, + + /** + * Notification transport settings. + * + * @generated from enum value: NOTIFICATION = 5; + */ + NOTIFICATION = 5, + + /** + * AI provider settings. + * + * @generated from enum value: AI = 6; + */ + AI = 6, + + /** + * Instance access policy settings. + * + * @generated from enum value: ACCESS = 7; + */ + ACCESS = 7, +} + +/** + * Describes the enum memos.api.InstanceSetting.Key. + */ +export const InstanceSetting_KeySchema: GenEnum = /*@__PURE__*/ + enumDesc(file_api_instance_service, 2, 0); + +/** + * StorageType is the backend of a configured storage. + * + * @generated from enum memos.api.InstanceSetting.StorageType + */ +export enum InstanceSetting_StorageType { + /** + * @generated from enum value: STORAGE_TYPE_UNSPECIFIED = 0; + */ + STORAGE_TYPE_UNSPECIFIED = 0, + + /** + * Stores attachment content in the application database. + * + * @generated from enum value: DATABASE = 1; + */ + DATABASE = 1, + + /** + * Stores attachment content on the local filesystem. + * + * @generated from enum value: LOCAL = 2; + */ + LOCAL = 2, + + /** + * Stores attachment content in an S3-compatible object store. + * + * @generated from enum value: S3 = 3; + */ + S3 = 3, +} + +/** + * Describes the enum memos.api.InstanceSetting.StorageType. + */ +export const InstanceSetting_StorageTypeSchema: GenEnum = /*@__PURE__*/ + enumDesc(file_api_instance_service, 2, 1); + +/** + * AIProviderType is the provider implementation type. + * + * @generated from enum memos.api.InstanceSetting.AIProviderType + */ +export enum InstanceSetting_AIProviderType { + /** + * @generated from enum value: AI_PROVIDER_TYPE_UNSPECIFIED = 0; + */ + AI_PROVIDER_TYPE_UNSPECIFIED = 0, + + /** + * OpenAI API. The endpoint defaults to https://api.openai.com/v1. + * + * @generated from enum value: OPENAI = 1; + */ + OPENAI = 1, + + /** + * Google Gemini API. The endpoint defaults to https://generativelanguage.googleapis.com/v1beta. + * + * @generated from enum value: GEMINI = 2; + */ + GEMINI = 2, +} + +/** + * Describes the enum memos.api.InstanceSetting.AIProviderType. + */ +export const InstanceSetting_AIProviderTypeSchema: GenEnum = /*@__PURE__*/ + enumDesc(file_api_instance_service, 2, 2); + +/** + * Request message for InstanceService.GetInstanceSetting. + * + * @generated from message memos.api.GetInstanceSettingRequest + */ +export type GetInstanceSettingRequest = Message<"memos.api.GetInstanceSettingRequest"> & { + /** + * Required. The resource name of the instance setting. + * Format: instance/settings/{setting} + * + * @generated from field: string name = 1; + */ + name: string; +}; + +/** + * Describes the message memos.api.GetInstanceSettingRequest. + * Use `create(GetInstanceSettingRequestSchema)` to create a new message. + */ +export const GetInstanceSettingRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_instance_service, 3); + +/** + * Request message for InstanceService.BatchGetInstanceSettings. + * + * @generated from message memos.api.BatchGetInstanceSettingsRequest + */ +export type BatchGetInstanceSettingsRequest = Message<"memos.api.BatchGetInstanceSettingsRequest"> & { + /** + * Required. The resource names of the instance settings. At most 100. + * Format: instance/settings/{setting} + * + * @generated from field: repeated string names = 1; + */ + names: string[]; +}; + +/** + * Describes the message memos.api.BatchGetInstanceSettingsRequest. + * Use `create(BatchGetInstanceSettingsRequestSchema)` to create a new message. + */ +export const BatchGetInstanceSettingsRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_instance_service, 4); + +/** + * Response message for InstanceService.BatchGetInstanceSettings. + * + * @generated from message memos.api.BatchGetInstanceSettingsResponse + */ +export type BatchGetInstanceSettingsResponse = Message<"memos.api.BatchGetInstanceSettingsResponse"> & { + /** + * The instance settings, in the same order as the requested names. + * + * @generated from field: repeated memos.api.InstanceSetting instance_settings = 1; + */ + instanceSettings: InstanceSetting[]; +}; + +/** + * Describes the message memos.api.BatchGetInstanceSettingsResponse. + * Use `create(BatchGetInstanceSettingsResponseSchema)` to create a new message. + */ +export const BatchGetInstanceSettingsResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_instance_service, 5); + +/** + * Request message for InstanceService.UpdateInstanceSetting. + * + * @generated from message memos.api.UpdateInstanceSettingRequest + */ +export type UpdateInstanceSettingRequest = Message<"memos.api.UpdateInstanceSettingRequest"> & { + /** + * Required. The instance setting, which replaces the stored setting. + * + * @generated from field: memos.api.InstanceSetting instance_setting = 1; + */ + instanceSetting?: InstanceSetting | undefined; + + /** + * Optional. The list of fields to update. Currently ignored; the whole setting is replaced. + * + * @generated from field: google.protobuf.FieldMask update_mask = 2; + */ + updateMask?: FieldMask | undefined; +}; + +/** + * Describes the message memos.api.UpdateInstanceSettingRequest. + * Use `create(UpdateInstanceSettingRequestSchema)` to create a new message. + */ +export const UpdateInstanceSettingRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_instance_service, 6); + +/** + * Request message for InstanceService.TestInstanceEmailSetting. + * + * @generated from message memos.api.TestInstanceEmailSettingRequest + */ +export type TestInstanceEmailSettingRequest = Message<"memos.api.TestInstanceEmailSettingRequest"> & { + /** + * Optional. The SMTP settings to test. If omitted, the stored notification email setting is used. An empty + * password reuses the stored password when the connection settings are unchanged. + * + * @generated from field: memos.api.InstanceSetting.NotificationSetting.EmailSetting email = 1; + */ + email?: InstanceSetting_NotificationSetting_EmailSetting | undefined; + + /** + * Optional. The recipient email address. If omitted, the current user's email address is used. + * + * @generated from field: string recipient_email = 2; + */ + recipientEmail: string; +}; + +/** + * Describes the message memos.api.TestInstanceEmailSettingRequest. + * Use `create(TestInstanceEmailSettingRequestSchema)` to create a new message. + */ +export const TestInstanceEmailSettingRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_instance_service, 7); + +/** + * InstanceStats is a snapshot of the instance's resource usage. + * + * @generated from message memos.api.InstanceStats + */ +export type InstanceStats = Message<"memos.api.InstanceStats"> & { + /** + * The database size statistics. + * + * @generated from field: memos.api.InstanceStats.DatabaseStats database = 1; + */ + database?: InstanceStats_DatabaseStats | undefined; + + /** + * The recursive size of the data directory in bytes. -1 if unavailable. + * + * @generated from field: int64 local_storage_bytes = 2; + */ + localStorageBytes: bigint; + + /** + * The time the snapshot was generated on the server. + * + * @generated from field: google.protobuf.Timestamp generated_time = 3; + */ + generatedTime?: Timestamp | undefined; +}; + +/** + * Describes the message memos.api.InstanceStats. + * Use `create(InstanceStatsSchema)` to create a new message. + */ +export const InstanceStatsSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_instance_service, 8); + +/** + * DatabaseStats is the database size statistics. + * + * @generated from message memos.api.InstanceStats.DatabaseStats + */ +export type InstanceStats_DatabaseStats = Message<"memos.api.InstanceStats.DatabaseStats"> & { + /** + * The database driver: "sqlite", "mysql" or "postgres". + * + * @generated from field: string driver = 1; + */ + driver: string; + + /** + * The database size in bytes. -1 if unavailable. + * + * @generated from field: int64 size_bytes = 2; + */ + sizeBytes: bigint; +}; + +/** + * Describes the message memos.api.InstanceStats.DatabaseStats. + * Use `create(InstanceStats_DatabaseStatsSchema)` to create a new message. + */ +export const InstanceStats_DatabaseStatsSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_instance_service, 8, 0); + +/** + * Request message for InstanceService.GetInstanceStats. + * + * @generated from message memos.api.GetInstanceStatsRequest + */ +export type GetInstanceStatsRequest = Message<"memos.api.GetInstanceStatsRequest"> & { +}; + +/** + * Describes the message memos.api.GetInstanceStatsRequest. + * Use `create(GetInstanceStatsRequestSchema)` to create a new message. + */ +export const GetInstanceStatsRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_instance_service, 9); + +/** + * InstanceAccessMode controls whether unauthenticated users may access instance content. + * + * @generated from enum memos.api.InstanceAccessMode + */ +export enum InstanceAccessMode { + /** + * @generated from enum value: INSTANCE_ACCESS_MODE_UNSPECIFIED = 0; + */ + UNSPECIFIED = 0, + + /** + * Unauthenticated users may only reach the endpoints needed to sign in, register and open share links. + * This is the default. + * + * @generated from enum value: INSTANCE_ACCESS_MODE_PRIVATE = 1; + */ + PRIVATE = 1, + + /** + * Unauthenticated users may read public content. + * + * @generated from enum value: INSTANCE_ACCESS_MODE_PUBLIC = 2; + */ + PUBLIC = 2, +} + +/** + * Describes the enum memos.api.InstanceAccessMode. + */ +export const InstanceAccessModeSchema: GenEnum = /*@__PURE__*/ + enumDesc(file_api_instance_service, 0); + +/** + * InstanceService exposes the instance profile, instance-wide settings and usage statistics. + * + * @generated from service memos.api.InstanceService + */ +export const InstanceService: GenService<{ + /** + * GetInstanceProfile gets the instance profile. Available without authentication, including on a private instance. + * + * @generated from rpc memos.api.InstanceService.GetInstanceProfile + */ + getInstanceProfile: { + methodKind: "unary"; + input: typeof GetInstanceProfileRequestSchema; + output: typeof InstanceProfileSchema; + }, + /** + * GetInstanceSetting gets an instance setting. Available without authentication, except STORAGE and NOTIFICATION, + * which are admin only, and AI, which requires a signed-in user and hides transcription defaults from non-admins. + * + * @generated from rpc memos.api.InstanceService.GetInstanceSetting + */ + getInstanceSetting: { + methodKind: "unary"; + input: typeof GetInstanceSettingRequestSchema; + output: typeof InstanceSettingSchema; + }, + /** + * BatchGetInstanceSettings gets up to 100 instance settings in request order, with the same access rules as + * GetInstanceSetting. The call fails if any setting cannot be returned. + * + * @generated from rpc memos.api.InstanceService.BatchGetInstanceSettings + */ + batchGetInstanceSettings: { + methodKind: "unary"; + input: typeof BatchGetInstanceSettingsRequestSchema; + output: typeof BatchGetInstanceSettingsResponseSchema; + }, + /** + * UpdateInstanceSetting replaces an instance setting. Admin only. Settings configured by the deployment cannot be + * updated. Empty write-only credentials keep the stored values. + * + * @generated from rpc memos.api.InstanceService.UpdateInstanceSetting + */ + updateInstanceSetting: { + methodKind: "unary"; + input: typeof UpdateInstanceSettingRequestSchema; + output: typeof InstanceSettingSchema; + }, + /** + * TestInstanceEmailSetting sends a test email with the provided or stored SMTP settings. Admin only. + * + * @generated from rpc memos.api.InstanceService.TestInstanceEmailSetting + */ + testInstanceEmailSetting: { + methodKind: "unary"; + input: typeof TestInstanceEmailSettingRequestSchema; + output: typeof EmptySchema; + }, + /** + * GetInstanceStats gets resource usage statistics for the instance. Admin only. Results are cached for 60 seconds. + * + * @generated from rpc memos.api.InstanceService.GetInstanceStats + */ + getInstanceStats: { + methodKind: "unary"; + input: typeof GetInstanceStatsRequestSchema; + output: typeof InstanceStatsSchema; + }, +}> = /*@__PURE__*/ + serviceDesc(file_api_instance_service, 0); + diff --git a/web/src/types/proto/api/memo_service_pb.ts b/web/src/types/proto/api/memo_service_pb.ts new file mode 100644 index 000000000..aade25599 --- /dev/null +++ b/web/src/types/proto/api/memo_service_pb.ts @@ -0,0 +1,1579 @@ +// @generated by protoc-gen-es v2.12.1 with parameter "target=ts" +// @generated from file api/memo_service.proto (package memos.api, syntax proto3) +/* eslint-disable */ + +import type { GenEnum, GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv2"; +import { enumDesc, fileDesc, messageDesc, serviceDesc } from "@bufbuild/protobuf/codegenv2"; +import type { Attachment } from "./attachment_service_pb"; +import { file_api_attachment_service } from "./attachment_service_pb"; +import type { State } from "./common_pb"; +import { file_api_common } from "./common_pb"; +import { file_google_api_annotations } from "../google/api/annotations_pb"; +import { file_google_api_client } from "../google/api/client_pb"; +import { file_google_api_field_behavior } from "../google/api/field_behavior_pb"; +import { file_google_api_resource } from "../google/api/resource_pb"; +import type { EmptySchema, FieldMask, Timestamp } from "@bufbuild/protobuf/wkt"; +import { file_google_protobuf_empty, file_google_protobuf_field_mask, file_google_protobuf_timestamp } from "@bufbuild/protobuf/wkt"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file api/memo_service.proto. + */ +export const file_api_memo_service: GenFile = /*@__PURE__*/ + fileDesc("ChZhcGkvbWVtb19zZXJ2aWNlLnByb3RvEgltZW1vcy5hcGki6QYKBE1lbW8SEQoEbmFtZRgBIAEoCUID4EEIEicKB2NyZWF0b3IYAiABKAlCFuBBA/pBEAoObWVtb3MuYXBpL1VzZXISKwoFc3BhY2UYAyABKAlCF+BBAfpBEQoPbWVtb3MuYXBpL1NwYWNlSACIAQESFAoHY29udGVudBgEIAEoCUID4EECEi8KCGxvY2F0aW9uGAUgASgLMhMubWVtb3MuYXBpLkxvY2F0aW9uQgPgQQFIAYgBARIuCgp2aXNpYmlsaXR5GAYgASgOMhUubWVtb3MuYXBpLlZpc2liaWxpdHlCA+BBAhIkCgVzdGF0ZRgHIAEoDjIQLm1lbW9zLmFwaS5TdGF0ZUID4EECEhMKBnBpbm5lZBgIIAEoCEID4EEBEi8KC2F0dGFjaG1lbnRzGAkgAygLMhUubWVtb3MuYXBpLkF0dGFjaG1lbnRCA+BBARIvCglyZWxhdGlvbnMYCiADKAsyFy5tZW1vcy5hcGkuTWVtb1JlbGF0aW9uQgPgQQESKwoJcmVhY3Rpb25zGAsgAygLMhMubWVtb3MuYXBpLlJlYWN0aW9uQgPgQQMSKwoGcGFyZW50GAwgASgJQhbgQQP6QRAKDm1lbW9zLmFwaS9NZW1vSAKIAQESEQoEdGFncxgNIAMoCUID4EEDEi8KCHByb3BlcnR5GA4gASgLMhgubWVtb3MuYXBpLk1lbW8uUHJvcGVydHlCA+BBAxIUCgdzbmlwcGV0GA8gASgJQgPgQQMSNAoLY3JlYXRlX3RpbWUYECABKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wQgPgQQESNAoLdXBkYXRlX3RpbWUYESABKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wQgPgQQEacgoIUHJvcGVydHkSDQoFdGl0bGUYASABKAkSEAoIaGFzX2xpbmsYAiABKAgSEAoIaGFzX2NvZGUYAyABKAgSFQoNaGFzX3Rhc2tfbGlzdBgEIAEoCBIcChRoYXNfaW5jb21wbGV0ZV90YXNrcxgFIAEoCDou6kErCg5tZW1vcy5hcGkvTWVtbxIMbWVtb3Mve21lbW99KgVtZW1vczIEbWVtb0IICgZfc3BhY2VCCwoJX2xvY2F0aW9uQgkKB19wYXJlbnQisAEKEExpc3RNZW1vc1JlcXVlc3QSFgoJcGFnZV9zaXplGAEgASgFQgPgQQESFwoKcGFnZV90b2tlbhgCIAEoCUID4EEBEhMKBmZpbHRlchgDIAEoCUID4EEBEhUKCG9yZGVyX2J5GAQgASgJQgPgQQESGQoMc2hvd19kZWxldGVkGAUgASgIQgPgQQESJAoFc3RhdGUYBiABKA4yEC5tZW1vcy5hcGkuU3RhdGVCA+BBASJMChFMaXN0TWVtb3NSZXNwb25zZRIeCgVtZW1vcxgBIAMoCzIPLm1lbW9zLmFwaS5NZW1vEhcKD25leHRfcGFnZV90b2tlbhgCIAEoCSI2Cg5HZXRNZW1vUmVxdWVzdBIkCgRuYW1lGAEgASgJQhbgQQL6QRAKDm1lbW9zLmFwaS9NZW1vIk0KEUNyZWF0ZU1lbW9SZXF1ZXN0EiIKBG1lbW8YASABKAsyDy5tZW1vcy5hcGkuTWVtb0ID4EECEhQKB21lbW9faWQYAiABKAlCA+BBASJtChFVcGRhdGVNZW1vUmVxdWVzdBIiCgRtZW1vGAEgASgLMg8ubWVtb3MuYXBpLk1lbW9CA+BBAhI0Cgt1cGRhdGVfbWFzaxgCIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5GaWVsZE1hc2tCA+BBAiJNChFEZWxldGVNZW1vUmVxdWVzdBIkCgRuYW1lGAEgASgJQhbgQQL6QRAKDm1lbW9zLmFwaS9NZW1vEhIKBWZvcmNlGAIgASgIQgPgQQEiUwoITG9jYXRpb24SGAoLcGxhY2Vob2xkZXIYASABKAlCA+BBARIVCghsYXRpdHVkZRgCIAEoAUID4EEBEhYKCWxvbmdpdHVkZRgDIAEoAUID4EEBInUKGkxpc3RNZW1vQXR0YWNobWVudHNSZXF1ZXN0EiYKBnBhcmVudBgBIAEoCUIW4EEC+kEQCg5tZW1vcy5hcGkvTWVtbxIWCglwYWdlX3NpemUYAiABKAVCA+BBARIXCgpwYWdlX3Rva2VuGAMgASgJQgPgQQEiYgobTGlzdE1lbW9BdHRhY2htZW50c1Jlc3BvbnNlEioKC2F0dGFjaG1lbnRzGAEgAygLMhUubWVtb3MuYXBpLkF0dGFjaG1lbnQSFwoPbmV4dF9wYWdlX3Rva2VuGAIgASgJInIKGVNldE1lbW9BdHRhY2htZW50c1JlcXVlc3QSJAoEbmFtZRgBIAEoCUIW4EEC+kEQCg5tZW1vcy5hcGkvTWVtbxIvCgthdHRhY2htZW50cxgCIAMoCzIVLm1lbW9zLmFwaS5BdHRhY2htZW50QgPgQQIisAIKDE1lbW9SZWxhdGlvbhIyCgRtZW1vGAEgASgLMh8ubWVtb3MuYXBpLk1lbW9SZWxhdGlvbi5NZW1vUmVmQgPgQQISOgoMcmVsYXRlZF9tZW1vGAIgASgLMh8ubWVtb3MuYXBpLk1lbW9SZWxhdGlvbi5NZW1vUmVmQgPgQQISLwoEdHlwZRgDIAEoDjIcLm1lbW9zLmFwaS5NZW1vUmVsYXRpb24uVHlwZUID4EECGkUKB01lbW9SZWYSJAoEbmFtZRgBIAEoCUIW4EEC+kEQCg5tZW1vcy5hcGkvTWVtbxIUCgdzbmlwcGV0GAIgASgJQgPgQQMiOAoEVHlwZRIUChBUWVBFX1VOU1BFQ0lGSUVEEAASDQoJUkVGRVJFTkNFEAESCwoHQ09NTUVOVBACInMKGExpc3RNZW1vUmVsYXRpb25zUmVxdWVzdBImCgZwYXJlbnQYASABKAlCFuBBAvpBEAoObWVtb3MuYXBpL01lbW8SFgoJcGFnZV9zaXplGAIgASgFQgPgQQESFwoKcGFnZV90b2tlbhgDIAEoCUID4EEBImAKGUxpc3RNZW1vUmVsYXRpb25zUmVzcG9uc2USKgoJcmVsYXRpb25zGAEgAygLMhcubWVtb3MuYXBpLk1lbW9SZWxhdGlvbhIXCg9uZXh0X3BhZ2VfdG9rZW4YAiABKAkicAoXU2V0TWVtb1JlbGF0aW9uc1JlcXVlc3QSJAoEbmFtZRgBIAEoCUIW4EEC+kEQCg5tZW1vcy5hcGkvTWVtbxIvCglyZWxhdGlvbnMYAiADKAsyFy5tZW1vcy5hcGkuTWVtb1JlbGF0aW9uQgPgQQIiiQEKF0xpc3RNZW1vQ29tbWVudHNSZXF1ZXN0EiYKBnBhcmVudBgBIAEoCUIW4EEC+kEQCg5tZW1vcy5hcGkvTWVtbxIWCglwYWdlX3NpemUYAiABKAVCA+BBARIXCgpwYWdlX3Rva2VuGAMgASgJQgPgQQESFQoIb3JkZXJfYnkYBCABKAlCA+BBASJWChhMaXN0TWVtb0NvbW1lbnRzUmVzcG9uc2USIQoIY29tbWVudHMYASADKAsyDy5tZW1vcy5hcGkuTWVtbxIXCg9uZXh0X3BhZ2VfdG9rZW4YAiABKAkiggEKGENyZWF0ZU1lbW9Db21tZW50UmVxdWVzdBImCgZwYXJlbnQYASABKAlCFuBBAvpBEAoObWVtb3MuYXBpL01lbW8SJQoHY29tbWVudBgCIAEoCzIPLm1lbW9zLmFwaS5NZW1vQgPgQQISFwoKY29tbWVudF9pZBgDIAEoCUID4EEBIuwBCghSZWFjdGlvbhIUCgRuYW1lGAEgASgJQgbgQQPgQQgSJwoHY3JlYXRvchgCIAEoCUIW4EED+kEQCg5tZW1vcy5hcGkvVXNlchIaCg1yZWFjdGlvbl90eXBlGAMgASgJQgPgQQISNAoLY3JlYXRlX3RpbWUYBCABKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wQgPgQQM6T+pBTAoSbWVtb3MuYXBpL1JlYWN0aW9uEiFtZW1vcy97bWVtb30vcmVhY3Rpb25zL3tyZWFjdGlvbn0qCXJlYWN0aW9uczIIcmVhY3Rpb24icwoYTGlzdE1lbW9SZWFjdGlvbnNSZXF1ZXN0EiYKBnBhcmVudBgBIAEoCUIW4EEC+kEQCg5tZW1vcy5hcGkvTWVtbxIWCglwYWdlX3NpemUYAiABKAVCA+BBARIXCgpwYWdlX3Rva2VuGAMgASgJQgPgQQEiXAoZTGlzdE1lbW9SZWFjdGlvbnNSZXNwb25zZRImCglyZWFjdGlvbnMYASADKAsyEy5tZW1vcy5hcGkuUmVhY3Rpb24SFwoPbmV4dF9wYWdlX3Rva2VuGAIgASgJIkUKGURlbGV0ZU1lbW9SZWFjdGlvblJlcXVlc3QSKAoEbmFtZRgBIAEoCUIa4EEC+kEUChJtZW1vcy5hcGkvUmVhY3Rpb24ibwoZVXBzZXJ0TWVtb1JlYWN0aW9uUmVxdWVzdBImCgZwYXJlbnQYASABKAlCFuBBAvpBEAoObWVtb3MuYXBpL01lbW8SKgoIcmVhY3Rpb24YAiABKAsyEy5tZW1vcy5hcGkuUmVhY3Rpb25CA+BBAiLtAQoJTWVtb1NoYXJlEhEKBG5hbWUYASABKAlCA+BBCBI0CgtjcmVhdGVfdGltZRgCIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXBCA+BBAxI5CgtleHBpcmVfdGltZRgDIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXBCA+BBAUgAiAEBOkzqQUkKE21lbW9zLmFwaS9NZW1vU2hhcmUSG21lbW9zL3ttZW1vfS9zaGFyZXMve3NoYXJlfSoKbWVtb1NoYXJlczIJbWVtb1NoYXJlQg4KDF9leHBpcmVfdGltZSI/ChVMaXN0TWVtb1NoYXJlc1JlcXVlc3QSJgoGcGFyZW50GAEgASgJQhbgQQL6QRAKDm1lbW9zLmFwaS9NZW1vIkMKFkxpc3RNZW1vU2hhcmVzUmVzcG9uc2USKQoLbWVtb19zaGFyZXMYASADKAsyFC5tZW1vcy5hcGkuTWVtb1NoYXJlIm8KFkNyZWF0ZU1lbW9TaGFyZVJlcXVlc3QSJgoGcGFyZW50GAEgASgJQhbgQQL6QRAKDm1lbW9zLmFwaS9NZW1vEi0KCm1lbW9fc2hhcmUYAiABKAsyFC5tZW1vcy5hcGkuTWVtb1NoYXJlQgPgQQIiQwoWRGVsZXRlTWVtb1NoYXJlUmVxdWVzdBIpCgRuYW1lGAEgASgJQhvgQQL6QRUKE21lbW9zLmFwaS9NZW1vU2hhcmUiMAoUR2V0U2hhcmVkTWVtb1JlcXVlc3QSGAoLc2hhcmVfdG9rZW4YASABKAlCA+BBAiJOCgxMaW5rTWV0YWRhdGESCwoDdXJsGAEgASgJEg0KBXRpdGxlGAIgASgJEhMKC2Rlc2NyaXB0aW9uGAMgASgJEg0KBWltYWdlGAQgASgJIioKFkdldExpbmtNZXRhZGF0YVJlcXVlc3QSEAoDdXJsGAEgASgJQgPgQQIiMAobQmF0Y2hHZXRMaW5rTWV0YWRhdGFSZXF1ZXN0EhEKBHVybHMYASADKAlCA+BBAiJOChxCYXRjaEdldExpbmtNZXRhZGF0YVJlc3BvbnNlEi4KDWxpbmtfbWV0YWRhdGEYASADKAsyFy5tZW1vcy5hcGkuTGlua01ldGFkYXRhKlsKClZpc2liaWxpdHkSGgoWVklTSUJJTElUWV9VTlNQRUNJRklFRBAAEgsKB1BSSVZBVEUQARINCglQUk9URUNURUQQAhIKCgZQVUJMSUMQAxIJCgVTUEFDRRAEMoMUCgtNZW1vU2VydmljZRJdCglMaXN0TWVtb3MSGy5tZW1vcy5hcGkuTGlzdE1lbW9zUmVxdWVzdBocLm1lbW9zLmFwaS5MaXN0TWVtb3NSZXNwb25zZSIV2kEAgtPkkwIMEgovYXBpL21lbW9zElkKB0dldE1lbW8SGS5tZW1vcy5hcGkuR2V0TWVtb1JlcXVlc3QaDy5tZW1vcy5hcGkuTWVtbyIi2kEEbmFtZYLT5JMCFRITL2FwaS97bmFtZT1tZW1vcy8qfRJcCgpDcmVhdGVNZW1vEhwubWVtb3MuYXBpLkNyZWF0ZU1lbW9SZXF1ZXN0Gg8ubWVtb3MuYXBpLk1lbW8iH9pBBG1lbW+C0+STAhI6BG1lbW8iCi9hcGkvbWVtb3MSdgoKVXBkYXRlTWVtbxIcLm1lbW9zLmFwaS5VcGRhdGVNZW1vUmVxdWVzdBoPLm1lbW9zLmFwaS5NZW1vIjnaQRBtZW1vLHVwZGF0ZV9tYXNrgtPkkwIgOgRtZW1vMhgvYXBpL3ttZW1vLm5hbWU9bWVtb3MvKn0SZgoKRGVsZXRlTWVtbxIcLm1lbW9zLmFwaS5EZWxldGVNZW1vUmVxdWVzdBoWLmdvb2dsZS5wcm90b2J1Zi5FbXB0eSIi2kEEbmFtZYLT5JMCFSoTL2FwaS97bmFtZT1tZW1vcy8qfRKYAQoTTGlzdE1lbW9BdHRhY2htZW50cxIlLm1lbW9zLmFwaS5MaXN0TWVtb0F0dGFjaG1lbnRzUmVxdWVzdBomLm1lbW9zLmFwaS5MaXN0TWVtb0F0dGFjaG1lbnRzUmVzcG9uc2UiMtpBBnBhcmVudILT5JMCIxIhL2FwaS97cGFyZW50PW1lbW9zLyp9L2F0dGFjaG1lbnRzEoUBChJTZXRNZW1vQXR0YWNobWVudHMSJC5tZW1vcy5hcGkuU2V0TWVtb0F0dGFjaG1lbnRzUmVxdWVzdBoWLmdvb2dsZS5wcm90b2J1Zi5FbXB0eSIx2kEEbmFtZYLT5JMCJDoBKjIfL2FwaS97bmFtZT1tZW1vcy8qfS9hdHRhY2htZW50cxKQAQoRTGlzdE1lbW9SZWxhdGlvbnMSIy5tZW1vcy5hcGkuTGlzdE1lbW9SZWxhdGlvbnNSZXF1ZXN0GiQubWVtb3MuYXBpLkxpc3RNZW1vUmVsYXRpb25zUmVzcG9uc2UiMNpBBnBhcmVudILT5JMCIRIfL2FwaS97cGFyZW50PW1lbW9zLyp9L3JlbGF0aW9ucxJ/ChBTZXRNZW1vUmVsYXRpb25zEiIubWVtb3MuYXBpLlNldE1lbW9SZWxhdGlvbnNSZXF1ZXN0GhYuZ29vZ2xlLnByb3RvYnVmLkVtcHR5Ii/aQQRuYW1lgtPkkwIiOgEqMh0vYXBpL3tuYW1lPW1lbW9zLyp9L3JlbGF0aW9ucxKMAQoQTGlzdE1lbW9Db21tZW50cxIiLm1lbW9zLmFwaS5MaXN0TWVtb0NvbW1lbnRzUmVxdWVzdBojLm1lbW9zLmFwaS5MaXN0TWVtb0NvbW1lbnRzUmVzcG9uc2UiL9pBBnBhcmVudILT5JMCIBIeL2FwaS97cGFyZW50PW1lbW9zLyp9L2NvbW1lbnRzEosBChFDcmVhdGVNZW1vQ29tbWVudBIjLm1lbW9zLmFwaS5DcmVhdGVNZW1vQ29tbWVudFJlcXVlc3QaDy5tZW1vcy5hcGkuTWVtbyJA2kEOcGFyZW50LGNvbW1lbnSC0+STAik6B2NvbW1lbnQiHi9hcGkve3BhcmVudD1tZW1vcy8qfS9jb21tZW50cxKQAQoRTGlzdE1lbW9SZWFjdGlvbnMSIy5tZW1vcy5hcGkuTGlzdE1lbW9SZWFjdGlvbnNSZXF1ZXN0GiQubWVtb3MuYXBpLkxpc3RNZW1vUmVhY3Rpb25zUmVzcG9uc2UiMNpBBnBhcmVudILT5JMCIRIfL2FwaS97cGFyZW50PW1lbW9zLyp9L3JlYWN0aW9ucxKCAQoSRGVsZXRlTWVtb1JlYWN0aW9uEiQubWVtb3MuYXBpLkRlbGV0ZU1lbW9SZWFjdGlvblJlcXVlc3QaFi5nb29nbGUucHJvdG9idWYuRW1wdHkiLtpBBG5hbWWC0+STAiEqHy9hcGkve25hbWU9bWVtb3MvKi9yZWFjdGlvbnMvKn0ShAEKElVwc2VydE1lbW9SZWFjdGlvbhIkLm1lbW9zLmFwaS5VcHNlcnRNZW1vUmVhY3Rpb25SZXF1ZXN0GhMubWVtb3MuYXBpLlJlYWN0aW9uIjPaQQZwYXJlbnSC0+STAiQ6ASoiHy9hcGkve3BhcmVudD1tZW1vcy8qfS9yZWFjdGlvbnMShAEKDkxpc3RNZW1vU2hhcmVzEiAubWVtb3MuYXBpLkxpc3RNZW1vU2hhcmVzUmVxdWVzdBohLm1lbW9zLmFwaS5MaXN0TWVtb1NoYXJlc1Jlc3BvbnNlIi3aQQZwYXJlbnSC0+STAh4SHC9hcGkve3BhcmVudD1tZW1vcy8qfS9zaGFyZXMSkAEKD0NyZWF0ZU1lbW9TaGFyZRIhLm1lbW9zLmFwaS5DcmVhdGVNZW1vU2hhcmVSZXF1ZXN0GhQubWVtb3MuYXBpLk1lbW9TaGFyZSJE2kERcGFyZW50LG1lbW9fc2hhcmWC0+STAio6Cm1lbW9fc2hhcmUiHC9hcGkve3BhcmVudD1tZW1vcy8qfS9zaGFyZXMSeQoPRGVsZXRlTWVtb1NoYXJlEiEubWVtb3MuYXBpLkRlbGV0ZU1lbW9TaGFyZVJlcXVlc3QaFi5nb29nbGUucHJvdG9idWYuRW1wdHkiK9pBBG5hbWWC0+STAh4qHC9hcGkve25hbWU9bWVtb3MvKi9zaGFyZXMvKn0SaQoNR2V0U2hhcmVkTWVtbxIfLm1lbW9zLmFwaS5HZXRTaGFyZWRNZW1vUmVxdWVzdBoPLm1lbW9zLmFwaS5NZW1vIiaC0+STAiASHi9hcGkvc2hhcmVzL3tzaGFyZV90b2tlbn0vbWVtbxJwCg9HZXRMaW5rTWV0YWRhdGESIS5tZW1vcy5hcGkuR2V0TGlua01ldGFkYXRhUmVxdWVzdBoXLm1lbW9zLmFwaS5MaW5rTWV0YWRhdGEiIYLT5JMCGxIZL2FwaS9tZW1vcy8tL2xpbmtNZXRhZGF0YRKWAQoUQmF0Y2hHZXRMaW5rTWV0YWRhdGESJi5tZW1vcy5hcGkuQmF0Y2hHZXRMaW5rTWV0YWRhdGFSZXF1ZXN0GicubWVtb3MuYXBpLkJhdGNoR2V0TGlua01ldGFkYXRhUmVzcG9uc2UiLYLT5JMCJzoBKiIiL2FwaS9tZW1vcy8tL2xpbmtNZXRhZGF0YTpiYXRjaEdldEKPAQoNY29tLm1lbW9zLmFwaUIQTWVtb1NlcnZpY2VQcm90b1ABWidnaXRodWIuY29tL3VzZW1lbW9zL21lbW9zL3Byb3RvL2dlbi9hcGmiAgNNQViqAglNZW1vcy5BcGnKAglNZW1vc1xBcGniAhVNZW1vc1xBcGlcR1BCTWV0YWRhdGHqAgpNZW1vczo6QXBpYgZwcm90bzM", [file_api_attachment_service, file_api_common, file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_empty, file_google_protobuf_field_mask, file_google_protobuf_timestamp]); + +/** + * Memo is a Markdown note written by a user. + * + * @generated from message memos.api.Memo + */ +export type Memo = Message<"memos.api.Memo"> & { + /** + * Identifier. The resource name of the memo, where memo is the + * user-defined UID. + * Format: memos/{memo} + * + * @generated from field: string name = 1; + */ + name: string; + + /** + * Output only. The resource name of the creator. + * Format: users/{user} + * + * @generated from field: string creator = 2; + */ + creator: string; + + /** + * Optional. The space in which the memo is placed. Every memo, including a + * comment, owns its placement independently. + * Format: spaces/{space} + * + * @generated from field: optional string space = 3; + */ + space?: string | undefined; + + /** + * Required. The content of the memo in Markdown. Must not exceed the + * instance's content length limit. + * + * @generated from field: string content = 4; + */ + content: string; + + /** + * Optional. The location of the memo. + * + * @generated from field: optional memos.api.Location location = 5; + */ + location?: Location | undefined; + + /** + * Required. The visibility of the memo. Defaults to PRIVATE on creation when + * unspecified. SPACE requires the memo to be placed in a space. + * + * @generated from field: memos.api.Visibility visibility = 6; + */ + visibility: Visibility; + + /** + * Required. The state of the memo. New memos are always NORMAL; change it + * with UpdateMemo. + * + * @generated from field: memos.api.State state = 7; + */ + state: State; + + /** + * Optional. Whether the memo is pinned. Ignored on creation; change it with + * UpdateMemo. + * + * @generated from field: bool pinned = 8; + */ + pinned: boolean; + + /** + * Optional. The attachments of the memo. Setting it replaces the full set. + * + * @generated from field: repeated memos.api.Attachment attachments = 9; + */ + attachments: Attachment[]; + + /** + * Optional. The relations of the memo in both directions. Only REFERENCE + * relations can be set; COMMENT relations are output only. + * + * @generated from field: repeated memos.api.MemoRelation relations = 10; + */ + relations: MemoRelation[]; + + /** + * Output only. The reactions to the memo. + * + * @generated from field: repeated memos.api.Reaction reactions = 11; + */ + reactions: Reaction[]; + + /** + * Output only. The context memo of this COMMENT relation, if any. + * Its identity is returned even when the caller cannot read the parent. + * Fetch the parent independently; this field does not grant read access. + * Format: memos/{memo} + * + * @generated from field: optional string parent = 12; + */ + parent?: string | undefined; + + /** + * Output only. The tags extracted from the content. + * + * @generated from field: repeated string tags = 13; + */ + tags: string[]; + + /** + * Output only. The properties computed from the content. + * + * @generated from field: memos.api.Memo.Property property = 14; + */ + property?: Memo_Property | undefined; + + /** + * Output only. A plain-text snippet of the content. + * + * @generated from field: string snippet = 15; + */ + snippet: string; + + /** + * Optional. The creation time. Defaults to the current time when unset on + * creation. + * + * @generated from field: google.protobuf.Timestamp create_time = 16; + */ + createTime?: Timestamp | undefined; + + /** + * Optional. The last update time. Defaults to the current time when unset on + * creation. + * + * @generated from field: google.protobuf.Timestamp update_time = 17; + */ + updateTime?: Timestamp | undefined; +}; + +/** + * Describes the message memos.api.Memo. + * Use `create(MemoSchema)` to create a new message. + */ +export const MemoSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_memo_service, 0); + +/** + * Property holds properties computed from the memo content. + * + * @generated from message memos.api.Memo.Property + */ +export type Memo_Property = Message<"memos.api.Memo.Property"> & { + /** + * The text of the H1 heading when it is the first block of the content. + * + * @generated from field: string title = 1; + */ + title: string; + + /** + * Whether the content contains a link. + * + * @generated from field: bool has_link = 2; + */ + hasLink: boolean; + + /** + * Whether the content contains inline code or a code block. + * + * @generated from field: bool has_code = 3; + */ + hasCode: boolean; + + /** + * Whether the content contains a task list. + * + * @generated from field: bool has_task_list = 4; + */ + hasTaskList: boolean; + + /** + * Whether the content contains an unchecked task. + * + * @generated from field: bool has_incomplete_tasks = 5; + */ + hasIncompleteTasks: boolean; +}; + +/** + * Describes the message memos.api.Memo.Property. + * Use `create(Memo_PropertySchema)` to create a new message. + */ +export const Memo_PropertySchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_memo_service, 0, 0); + +/** + * Request message for MemoService.ListMemos. + * + * @generated from message memos.api.ListMemosRequest + */ +export type ListMemosRequest = Message<"memos.api.ListMemosRequest"> & { + /** + * Optional. The maximum number of memos to return. The service may return + * fewer. Defaults to 50; values above 1000 are coerced to 1000. + * + * @generated from field: int32 page_size = 1; + */ + pageSize: number; + + /** + * Optional. A page token from a previous call. Provide it to retrieve the + * next page. + * + * @generated from field: string page_token = 2; + */ + pageToken: string; + + /** + * Optional. A CEL expression to filter memos. Combine terms with && and ||. + * Available fields: + * content (string), creator (string, e.g. "users/1"), + * created_ts / updated_ts (timestamp), pinned (bool), + * visibility (string: PRIVATE | PROTECTED | PUBLIC | SPACE), + * space (string resource name, or null when the memo has no space; + * supports == and comparisons against null, e.g. space != null), + * tags (list; match with `"work" in tags`, not `tag == "work"`), + * has_task_list / has_link / has_code / has_incomplete_tasks (bool), + * has_location (bool; true when the memo has a location attached). + * Note: the time fields here are created_ts / updated_ts, which differ from + * the create_time / update_time names used by order_by. + * Examples: + * pinned == true && visibility == "PUBLIC" + * space == "spaces/team" or space == null + * tags.exists(t, t == "urgent") + * content.contains("roadmap") && created_ts > now - duration("168h") + * + * @generated from field: string filter = 3; + */ + filter: string; + + /** + * Optional. The order to sort results by, as a comma-separated list of + * fields following AIP-132. Defaults to "create_time desc". + * Supported fields: pinned, create_time, update_time, name. + * Example: "pinned desc, create_time desc" or "update_time asc". + * Note: order_by uses create_time / update_time, while the filter + * expression uses created_ts / updated_ts for the same timestamps. + * + * @generated from field: string order_by = 4; + */ + orderBy: string; + + /** + * Optional. Whether to include deleted memos. Currently ignored by the + * server. + * + * @generated from field: bool show_deleted = 5; + */ + showDeleted: boolean; + + /** + * Optional. The state of the memos to list. Defaults to NORMAL. Set to + * ARCHIVED to list the caller's own archived memos. + * + * @generated from field: memos.api.State state = 6; + */ + state: State; +}; + +/** + * Describes the message memos.api.ListMemosRequest. + * Use `create(ListMemosRequestSchema)` to create a new message. + */ +export const ListMemosRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_memo_service, 1); + +/** + * Response message for MemoService.ListMemos. + * + * @generated from message memos.api.ListMemosResponse + */ +export type ListMemosResponse = Message<"memos.api.ListMemosResponse"> & { + /** + * The memos. + * + * @generated from field: repeated memos.api.Memo memos = 1; + */ + memos: Memo[]; + + /** + * A token to retrieve the next page. Empty when there are no more pages. + * + * @generated from field: string next_page_token = 2; + */ + nextPageToken: string; +}; + +/** + * Describes the message memos.api.ListMemosResponse. + * Use `create(ListMemosResponseSchema)` to create a new message. + */ +export const ListMemosResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_memo_service, 2); + +/** + * Request message for MemoService.GetMemo. + * + * @generated from message memos.api.GetMemoRequest + */ +export type GetMemoRequest = Message<"memos.api.GetMemoRequest"> & { + /** + * Required. The resource name of the memo. + * Format: memos/{memo} + * + * @generated from field: string name = 1; + */ + name: string; +}; + +/** + * Describes the message memos.api.GetMemoRequest. + * Use `create(GetMemoRequestSchema)` to create a new message. + */ +export const GetMemoRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_memo_service, 3); + +/** + * Request message for MemoService.CreateMemo. + * + * @generated from message memos.api.CreateMemoRequest + */ +export type CreateMemoRequest = Message<"memos.api.CreateMemoRequest"> & { + /** + * Required. The memo to create. + * + * @generated from field: memos.api.Memo memo = 1; + */ + memo?: Memo | undefined; + + /** + * Optional. The ID to use for the memo, which becomes the final segment of + * its resource name. If empty, a unique ID is generated. + * Format: ^[a-zA-Z0-9]([a-zA-Z0-9-]{0,34}[a-zA-Z0-9])?$ + * + * @generated from field: string memo_id = 2; + */ + memoId: string; +}; + +/** + * Describes the message memos.api.CreateMemoRequest. + * Use `create(CreateMemoRequestSchema)` to create a new message. + */ +export const CreateMemoRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_memo_service, 4); + +/** + * Request message for MemoService.UpdateMemo. + * + * @generated from message memos.api.UpdateMemoRequest + */ +export type UpdateMemoRequest = Message<"memos.api.UpdateMemoRequest"> & { + /** + * Required. The memo to update. Its name identifies the memo. + * + * @generated from field: memos.api.Memo memo = 1; + */ + memo?: Memo | undefined; + + /** + * Required. The fields to update. Supported paths: content, visibility, + * space, pinned, state, create_time, update_time, location, attachments, + * relations. + * + * @generated from field: google.protobuf.FieldMask update_mask = 2; + */ + updateMask?: FieldMask | undefined; +}; + +/** + * Describes the message memos.api.UpdateMemoRequest. + * Use `create(UpdateMemoRequestSchema)` to create a new message. + */ +export const UpdateMemoRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_memo_service, 5); + +/** + * Request message for MemoService.DeleteMemo. + * + * @generated from message memos.api.DeleteMemoRequest + */ +export type DeleteMemoRequest = Message<"memos.api.DeleteMemoRequest"> & { + /** + * Required. The resource name of the memo to delete. + * Format: memos/{memo} + * + * @generated from field: string name = 1; + */ + name: string; + + /** + * Optional. Currently ignored by the server; deletion always includes the + * comment subtree. + * + * @generated from field: bool force = 2; + */ + force: boolean; +}; + +/** + * Describes the message memos.api.DeleteMemoRequest. + * Use `create(DeleteMemoRequestSchema)` to create a new message. + */ +export const DeleteMemoRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_memo_service, 6); + +/** + * Location is a geographic location attached to a memo. + * + * @generated from message memos.api.Location + */ +export type Location = Message<"memos.api.Location"> & { + /** + * Optional. A human-readable label for the location. + * + * @generated from field: string placeholder = 1; + */ + placeholder: string; + + /** + * Optional. The latitude of the location. + * + * @generated from field: double latitude = 2; + */ + latitude: number; + + /** + * Optional. The longitude of the location. + * + * @generated from field: double longitude = 3; + */ + longitude: number; +}; + +/** + * Describes the message memos.api.Location. + * Use `create(LocationSchema)` to create a new message. + */ +export const LocationSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_memo_service, 7); + +/** + * Request message for MemoService.ListMemoAttachments. + * + * @generated from message memos.api.ListMemoAttachmentsRequest + */ +export type ListMemoAttachmentsRequest = Message<"memos.api.ListMemoAttachmentsRequest"> & { + /** + * Required. The resource name of the memo. + * Format: memos/{memo} + * + * @generated from field: string parent = 1; + */ + parent: string; + + /** + * Optional. The maximum number of attachments to return. The service may + * return fewer. Currently ignored; all attachments are returned. + * + * @generated from field: int32 page_size = 2; + */ + pageSize: number; + + /** + * Optional. A page token from a previous call. Provide it to retrieve the + * next page. Currently ignored. + * + * @generated from field: string page_token = 3; + */ + pageToken: string; +}; + +/** + * Describes the message memos.api.ListMemoAttachmentsRequest. + * Use `create(ListMemoAttachmentsRequestSchema)` to create a new message. + */ +export const ListMemoAttachmentsRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_memo_service, 8); + +/** + * Response message for MemoService.ListMemoAttachments. + * + * @generated from message memos.api.ListMemoAttachmentsResponse + */ +export type ListMemoAttachmentsResponse = Message<"memos.api.ListMemoAttachmentsResponse"> & { + /** + * The attachments. + * + * @generated from field: repeated memos.api.Attachment attachments = 1; + */ + attachments: Attachment[]; + + /** + * A token to retrieve the next page. Empty when there are no more pages. + * + * @generated from field: string next_page_token = 2; + */ + nextPageToken: string; +}; + +/** + * Describes the message memos.api.ListMemoAttachmentsResponse. + * Use `create(ListMemoAttachmentsResponseSchema)` to create a new message. + */ +export const ListMemoAttachmentsResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_memo_service, 9); + +/** + * Request message for MemoService.SetMemoAttachments. + * + * @generated from message memos.api.SetMemoAttachmentsRequest + */ +export type SetMemoAttachmentsRequest = Message<"memos.api.SetMemoAttachmentsRequest"> & { + /** + * Required. The resource name of the memo. + * Format: memos/{memo} + * + * @generated from field: string name = 1; + */ + name: string; + + /** + * Required. The complete set of attachments for the memo. + * + * @generated from field: repeated memos.api.Attachment attachments = 2; + */ + attachments: Attachment[]; +}; + +/** + * Describes the message memos.api.SetMemoAttachmentsRequest. + * Use `create(SetMemoAttachmentsRequestSchema)` to create a new message. + */ +export const SetMemoAttachmentsRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_memo_service, 10); + +/** + * MemoRelation is a directed link from one memo to another. + * + * @generated from message memos.api.MemoRelation + */ +export type MemoRelation = Message<"memos.api.MemoRelation"> & { + /** + * Required. The source memo of the relation. For COMMENT, the comment. + * + * @generated from field: memos.api.MemoRelation.MemoRef memo = 1; + */ + memo?: MemoRelation_MemoRef | undefined; + + /** + * Required. The target memo of the relation. For COMMENT, the memo being + * commented on. + * + * @generated from field: memos.api.MemoRelation.MemoRef related_memo = 2; + */ + relatedMemo?: MemoRelation_MemoRef | undefined; + + /** + * Required. The type of the relation. + * + * @generated from field: memos.api.MemoRelation.Type type = 3; + */ + type: MemoRelation_Type; +}; + +/** + * Describes the message memos.api.MemoRelation. + * Use `create(MemoRelationSchema)` to create a new message. + */ +export const MemoRelationSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_memo_service, 11); + +/** + * MemoRef identifies a memo in a relation. + * + * @generated from message memos.api.MemoRelation.MemoRef + */ +export type MemoRelation_MemoRef = Message<"memos.api.MemoRelation.MemoRef"> & { + /** + * Required. The resource name of the memo. + * Format: memos/{memo} + * + * @generated from field: string name = 1; + */ + name: string; + + /** + * Output only. A plain-text snippet of the memo content. Empty in + * ListMemos and ListMemoComments responses. + * + * @generated from field: string snippet = 2; + */ + snippet: string; +}; + +/** + * Describes the message memos.api.MemoRelation.MemoRef. + * Use `create(MemoRelation_MemoRefSchema)` to create a new message. + */ +export const MemoRelation_MemoRefSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_memo_service, 11, 0); + +/** + * Type is the kind of a memo relation. + * + * @generated from enum memos.api.MemoRelation.Type + */ +export enum MemoRelation_Type { + /** + * @generated from enum value: TYPE_UNSPECIFIED = 0; + */ + TYPE_UNSPECIFIED = 0, + + /** + * The source memo references the target memo. Clients can set it. + * + * @generated from enum value: REFERENCE = 1; + */ + REFERENCE = 1, + + /** + * The source memo is a comment on the target memo. Output only. + * + * @generated from enum value: COMMENT = 2; + */ + COMMENT = 2, +} + +/** + * Describes the enum memos.api.MemoRelation.Type. + */ +export const MemoRelation_TypeSchema: GenEnum = /*@__PURE__*/ + enumDesc(file_api_memo_service, 11, 0); + +/** + * Request message for MemoService.ListMemoRelations. + * + * @generated from message memos.api.ListMemoRelationsRequest + */ +export type ListMemoRelationsRequest = Message<"memos.api.ListMemoRelationsRequest"> & { + /** + * Required. The resource name of the memo. + * Format: memos/{memo} + * + * @generated from field: string parent = 1; + */ + parent: string; + + /** + * Optional. The maximum number of relations to return. The service may + * return fewer. Defaults to 50; values above 1000 are coerced to 1000. + * + * @generated from field: int32 page_size = 2; + */ + pageSize: number; + + /** + * Optional. A page token from a previous call. Provide it to retrieve the + * next page. + * + * @generated from field: string page_token = 3; + */ + pageToken: string; +}; + +/** + * Describes the message memos.api.ListMemoRelationsRequest. + * Use `create(ListMemoRelationsRequestSchema)` to create a new message. + */ +export const ListMemoRelationsRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_memo_service, 12); + +/** + * Response message for MemoService.ListMemoRelations. + * + * @generated from message memos.api.ListMemoRelationsResponse + */ +export type ListMemoRelationsResponse = Message<"memos.api.ListMemoRelationsResponse"> & { + /** + * The relations. + * + * @generated from field: repeated memos.api.MemoRelation relations = 1; + */ + relations: MemoRelation[]; + + /** + * A token to retrieve the next page. Empty when there are no more pages. + * + * @generated from field: string next_page_token = 2; + */ + nextPageToken: string; +}; + +/** + * Describes the message memos.api.ListMemoRelationsResponse. + * Use `create(ListMemoRelationsResponseSchema)` to create a new message. + */ +export const ListMemoRelationsResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_memo_service, 13); + +/** + * Request message for MemoService.SetMemoRelations. + * + * @generated from message memos.api.SetMemoRelationsRequest + */ +export type SetMemoRelationsRequest = Message<"memos.api.SetMemoRelationsRequest"> & { + /** + * Required. The resource name of the memo. + * Format: memos/{memo} + * + * @generated from field: string name = 1; + */ + name: string; + + /** + * Required. The complete set of REFERENCE relations for the memo. COMMENT + * relations are rejected. + * + * @generated from field: repeated memos.api.MemoRelation relations = 2; + */ + relations: MemoRelation[]; +}; + +/** + * Describes the message memos.api.SetMemoRelationsRequest. + * Use `create(SetMemoRelationsRequestSchema)` to create a new message. + */ +export const SetMemoRelationsRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_memo_service, 14); + +/** + * Request message for MemoService.ListMemoComments. + * + * @generated from message memos.api.ListMemoCommentsRequest + */ +export type ListMemoCommentsRequest = Message<"memos.api.ListMemoCommentsRequest"> & { + /** + * Required. The resource name of the memo. + * Format: memos/{memo} + * + * @generated from field: string parent = 1; + */ + parent: string; + + /** + * Optional. The maximum number of comments to return. The service may return + * fewer. Defaults to 50; values above 1000 are coerced to 1000. + * + * @generated from field: int32 page_size = 2; + */ + pageSize: number; + + /** + * Optional. A page token from a previous call. Provide it to retrieve the + * next page. + * + * @generated from field: string page_token = 3; + */ + pageToken: string; + + /** + * Optional. The order to sort results by. Currently ignored by the server. + * + * @generated from field: string order_by = 4; + */ + orderBy: string; +}; + +/** + * Describes the message memos.api.ListMemoCommentsRequest. + * Use `create(ListMemoCommentsRequestSchema)` to create a new message. + */ +export const ListMemoCommentsRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_memo_service, 15); + +/** + * Response message for MemoService.ListMemoComments. + * + * @generated from message memos.api.ListMemoCommentsResponse + */ +export type ListMemoCommentsResponse = Message<"memos.api.ListMemoCommentsResponse"> & { + /** + * The comment memos. + * + * @generated from field: repeated memos.api.Memo comments = 1; + */ + comments: Memo[]; + + /** + * A token to retrieve the next page. Empty when there are no more pages. + * + * @generated from field: string next_page_token = 2; + */ + nextPageToken: string; +}; + +/** + * Describes the message memos.api.ListMemoCommentsResponse. + * Use `create(ListMemoCommentsResponseSchema)` to create a new message. + */ +export const ListMemoCommentsResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_memo_service, 16); + +/** + * Request message for MemoService.CreateMemoComment. + * + * @generated from message memos.api.CreateMemoCommentRequest + */ +export type CreateMemoCommentRequest = Message<"memos.api.CreateMemoCommentRequest"> & { + /** + * Required. The resource name of the memo to comment on. + * Format: memos/{memo} + * + * @generated from field: string parent = 1; + */ + parent: string; + + /** + * Required. The comment memo to create. + * + * @generated from field: memos.api.Memo comment = 2; + */ + comment?: Memo | undefined; + + /** + * Optional. The ID to use for the comment memo, in the same format as + * CreateMemoRequest.memo_id. If empty, a unique ID is generated. + * + * @generated from field: string comment_id = 3; + */ + commentId: string; +}; + +/** + * Describes the message memos.api.CreateMemoCommentRequest. + * Use `create(CreateMemoCommentRequestSchema)` to create a new message. + */ +export const CreateMemoCommentRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_memo_service, 17); + +/** + * Reaction is a reaction a user leaves on a memo. + * + * @generated from message memos.api.Reaction + */ +export type Reaction = Message<"memos.api.Reaction"> & { + /** + * Identifier. The resource name of the reaction. + * Format: memos/{memo}/reactions/{reaction} + * + * @generated from field: string name = 1; + */ + name: string; + + /** + * Output only. The resource name of the creator. + * Format: users/{user} + * + * @generated from field: string creator = 2; + */ + creator: string; + + /** + * Required. The reaction, such as an emoji ("👍", "❤️", "😄"). + * + * @generated from field: string reaction_type = 3; + */ + reactionType: string; + + /** + * Output only. The creation time. + * + * @generated from field: google.protobuf.Timestamp create_time = 4; + */ + createTime?: Timestamp | undefined; +}; + +/** + * Describes the message memos.api.Reaction. + * Use `create(ReactionSchema)` to create a new message. + */ +export const ReactionSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_memo_service, 18); + +/** + * Request message for MemoService.ListMemoReactions. + * + * @generated from message memos.api.ListMemoReactionsRequest + */ +export type ListMemoReactionsRequest = Message<"memos.api.ListMemoReactionsRequest"> & { + /** + * Required. The resource name of the memo. + * Format: memos/{memo} + * + * @generated from field: string parent = 1; + */ + parent: string; + + /** + * Optional. The maximum number of reactions to return. The service may + * return fewer. Currently ignored; all reactions are returned. + * + * @generated from field: int32 page_size = 2; + */ + pageSize: number; + + /** + * Optional. A page token from a previous call. Provide it to retrieve the + * next page. Currently ignored. + * + * @generated from field: string page_token = 3; + */ + pageToken: string; +}; + +/** + * Describes the message memos.api.ListMemoReactionsRequest. + * Use `create(ListMemoReactionsRequestSchema)` to create a new message. + */ +export const ListMemoReactionsRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_memo_service, 19); + +/** + * Response message for MemoService.ListMemoReactions. + * + * @generated from message memos.api.ListMemoReactionsResponse + */ +export type ListMemoReactionsResponse = Message<"memos.api.ListMemoReactionsResponse"> & { + /** + * The reactions. + * + * @generated from field: repeated memos.api.Reaction reactions = 1; + */ + reactions: Reaction[]; + + /** + * A token to retrieve the next page. Empty when there are no more pages. + * + * @generated from field: string next_page_token = 2; + */ + nextPageToken: string; +}; + +/** + * Describes the message memos.api.ListMemoReactionsResponse. + * Use `create(ListMemoReactionsResponseSchema)` to create a new message. + */ +export const ListMemoReactionsResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_memo_service, 20); + +/** + * Request message for MemoService.DeleteMemoReaction. + * + * @generated from message memos.api.DeleteMemoReactionRequest + */ +export type DeleteMemoReactionRequest = Message<"memos.api.DeleteMemoReactionRequest"> & { + /** + * Required. The resource name of the reaction to delete. + * Format: memos/{memo}/reactions/{reaction} + * + * @generated from field: string name = 1; + */ + name: string; +}; + +/** + * Describes the message memos.api.DeleteMemoReactionRequest. + * Use `create(DeleteMemoReactionRequestSchema)` to create a new message. + */ +export const DeleteMemoReactionRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_memo_service, 21); + +/** + * Request message for MemoService.UpsertMemoReaction. + * + * @generated from message memos.api.UpsertMemoReactionRequest + */ +export type UpsertMemoReactionRequest = Message<"memos.api.UpsertMemoReactionRequest"> & { + /** + * Required. The resource name of the memo. + * Format: memos/{memo} + * + * @generated from field: string parent = 1; + */ + parent: string; + + /** + * Required. The reaction to upsert. Only reaction_type is used. + * + * @generated from field: memos.api.Reaction reaction = 2; + */ + reaction?: Reaction | undefined; +}; + +/** + * Describes the message memos.api.UpsertMemoReactionRequest. + * Use `create(UpsertMemoReactionRequestSchema)` to create a new message. + */ +export const UpsertMemoReactionRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_memo_service, 22); + +/** + * MemoShare is an access grant that permits read-only access to a memo via an + * opaque bearer token. + * + * @generated from message memos.api.MemoShare + */ +export type MemoShare = Message<"memos.api.MemoShare"> & { + /** + * Identifier. The resource name of the share. The {share} segment is the + * opaque token used in the share URL. + * Format: memos/{memo}/shares/{share} + * + * @generated from field: string name = 1; + */ + name: string; + + /** + * Output only. The creation time. + * + * @generated from field: google.protobuf.Timestamp create_time = 2; + */ + createTime?: Timestamp | undefined; + + /** + * Optional. The time after which the share link stops working. Must be in + * the future when set. If unset, the link never expires. + * + * @generated from field: optional google.protobuf.Timestamp expire_time = 3; + */ + expireTime?: Timestamp | undefined; +}; + +/** + * Describes the message memos.api.MemoShare. + * Use `create(MemoShareSchema)` to create a new message. + */ +export const MemoShareSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_memo_service, 23); + +/** + * Request message for MemoService.ListMemoShares. + * + * @generated from message memos.api.ListMemoSharesRequest + */ +export type ListMemoSharesRequest = Message<"memos.api.ListMemoSharesRequest"> & { + /** + * Required. The resource name of the memo. + * Format: memos/{memo} + * + * @generated from field: string parent = 1; + */ + parent: string; +}; + +/** + * Describes the message memos.api.ListMemoSharesRequest. + * Use `create(ListMemoSharesRequestSchema)` to create a new message. + */ +export const ListMemoSharesRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_memo_service, 24); + +/** + * Response message for MemoService.ListMemoShares. + * + * @generated from message memos.api.ListMemoSharesResponse + */ +export type ListMemoSharesResponse = Message<"memos.api.ListMemoSharesResponse"> & { + /** + * The share links. + * + * @generated from field: repeated memos.api.MemoShare memo_shares = 1; + */ + memoShares: MemoShare[]; +}; + +/** + * Describes the message memos.api.ListMemoSharesResponse. + * Use `create(ListMemoSharesResponseSchema)` to create a new message. + */ +export const ListMemoSharesResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_memo_service, 25); + +/** + * Request message for MemoService.CreateMemoShare. + * + * @generated from message memos.api.CreateMemoShareRequest + */ +export type CreateMemoShareRequest = Message<"memos.api.CreateMemoShareRequest"> & { + /** + * Required. The resource name of the memo to share. + * Format: memos/{memo} + * + * @generated from field: string parent = 1; + */ + parent: string; + + /** + * Required. The share to create. Only expire_time is used. + * + * @generated from field: memos.api.MemoShare memo_share = 2; + */ + memoShare?: MemoShare | undefined; +}; + +/** + * Describes the message memos.api.CreateMemoShareRequest. + * Use `create(CreateMemoShareRequestSchema)` to create a new message. + */ +export const CreateMemoShareRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_memo_service, 26); + +/** + * Request message for MemoService.DeleteMemoShare. + * + * @generated from message memos.api.DeleteMemoShareRequest + */ +export type DeleteMemoShareRequest = Message<"memos.api.DeleteMemoShareRequest"> & { + /** + * Required. The resource name of the share to delete. + * Format: memos/{memo}/shares/{share} + * + * @generated from field: string name = 1; + */ + name: string; +}; + +/** + * Describes the message memos.api.DeleteMemoShareRequest. + * Use `create(DeleteMemoShareRequestSchema)` to create a new message. + */ +export const DeleteMemoShareRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_memo_service, 27); + +/** + * Request message for MemoService.GetSharedMemo. + * + * @generated from message memos.api.GetSharedMemoRequest + */ +export type GetSharedMemoRequest = Message<"memos.api.GetSharedMemoRequest"> & { + /** + * Required. The opaque bearer token from the share URL. + * + * @generated from field: string share_token = 1; + */ + shareToken: string; +}; + +/** + * Describes the message memos.api.GetSharedMemoRequest. + * Use `create(GetSharedMemoRequestSchema)` to create a new message. + */ +export const GetSharedMemoRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_memo_service, 28); + +/** + * LinkMetadata is the preview metadata of a web link. + * + * @generated from message memos.api.LinkMetadata + */ +export type LinkMetadata = Message<"memos.api.LinkMetadata"> & { + /** + * The link URL as given in the request. + * + * @generated from field: string url = 1; + */ + url: string; + + /** + * The page title. + * + * @generated from field: string title = 2; + */ + title: string; + + /** + * The page description. + * + * @generated from field: string description = 3; + */ + description: string; + + /** + * The preview image URL. + * + * @generated from field: string image = 4; + */ + image: string; +}; + +/** + * Describes the message memos.api.LinkMetadata. + * Use `create(LinkMetadataSchema)` to create a new message. + */ +export const LinkMetadataSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_memo_service, 29); + +/** + * Request message for MemoService.GetLinkMetadata. + * + * @generated from message memos.api.GetLinkMetadataRequest + */ +export type GetLinkMetadataRequest = Message<"memos.api.GetLinkMetadataRequest"> & { + /** + * Required. The link URL. + * + * @generated from field: string url = 1; + */ + url: string; +}; + +/** + * Describes the message memos.api.GetLinkMetadataRequest. + * Use `create(GetLinkMetadataRequestSchema)` to create a new message. + */ +export const GetLinkMetadataRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_memo_service, 30); + +/** + * Request message for MemoService.BatchGetLinkMetadata. + * + * @generated from message memos.api.BatchGetLinkMetadataRequest + */ +export type BatchGetLinkMetadataRequest = Message<"memos.api.BatchGetLinkMetadataRequest"> & { + /** + * Required. The link URLs. At most 10. + * + * @generated from field: repeated string urls = 1; + */ + urls: string[]; +}; + +/** + * Describes the message memos.api.BatchGetLinkMetadataRequest. + * Use `create(BatchGetLinkMetadataRequestSchema)` to create a new message. + */ +export const BatchGetLinkMetadataRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_memo_service, 31); + +/** + * Response message for MemoService.BatchGetLinkMetadata. + * + * @generated from message memos.api.BatchGetLinkMetadataResponse + */ +export type BatchGetLinkMetadataResponse = Message<"memos.api.BatchGetLinkMetadataResponse"> & { + /** + * The link metadata, in the same order as the requested URLs. + * + * @generated from field: repeated memos.api.LinkMetadata link_metadata = 1; + */ + linkMetadata: LinkMetadata[]; +}; + +/** + * Describes the message memos.api.BatchGetLinkMetadataResponse. + * Use `create(BatchGetLinkMetadataResponseSchema)` to create a new message. + */ +export const BatchGetLinkMetadataResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_memo_service, 32); + +/** + * Visibility controls who can read a memo. + * + * @generated from enum memos.api.Visibility + */ +export enum Visibility { + /** + * @generated from enum value: VISIBILITY_UNSPECIFIED = 0; + */ + VISIBILITY_UNSPECIFIED = 0, + + /** + * Only the creator can read the memo. + * + * @generated from enum value: PRIVATE = 1; + */ + PRIVATE = 1, + + /** + * Signed-in users of the instance can read the memo. + * + * @generated from enum value: PROTECTED = 2; + */ + PROTECTED = 2, + + /** + * Signed-in users can read the memo; anonymous visitors can read it when + * instance policy permits. + * + * @generated from enum value: PUBLIC = 3; + */ + PUBLIC = 3, + + /** + * Active members of the memo's space can read the memo. + * + * @generated from enum value: SPACE = 4; + */ + SPACE = 4, +} + +/** + * Describes the enum memos.api.Visibility. + */ +export const VisibilitySchema: GenEnum = /*@__PURE__*/ + enumDesc(file_api_memo_service, 0); + +/** + * MemoService manages memos and their attachments, relations, comments, + * reactions, and share links. + * + * @generated from service memos.api.MemoService + */ +export const MemoService: GenService<{ + /** + * ListMemos lists the memos the caller can read, excluding comments. + * Anonymous callers can list only when the instance allows public access. + * + * @generated from rpc memos.api.MemoService.ListMemos + */ + listMemos: { + methodKind: "unary"; + input: typeof ListMemosRequestSchema; + output: typeof ListMemosResponseSchema; + }, + /** + * GetMemo gets a memo. Requires read access to the memo. + * + * @generated from rpc memos.api.MemoService.GetMemo + */ + getMemo: { + methodKind: "unary"; + input: typeof GetMemoRequestSchema; + output: typeof MemoSchema; + }, + /** + * 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. + * + * @generated from rpc memos.api.MemoService.CreateMemo + */ + createMemo: { + methodKind: "unary"; + input: typeof CreateMemoRequestSchema; + output: typeof MemoSchema; + }, + /** + * UpdateMemo updates the memo fields listed in update_mask. Requires the memo + * creator or an instance administrator. + * + * @generated from rpc memos.api.MemoService.UpdateMemo + */ + updateMemo: { + methodKind: "unary"; + input: typeof UpdateMemoRequestSchema; + output: typeof MemoSchema; + }, + /** + * 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. + * + * @generated from rpc memos.api.MemoService.DeleteMemo + */ + deleteMemo: { + methodKind: "unary"; + input: typeof DeleteMemoRequestSchema; + output: typeof EmptySchema; + }, + /** + * ListMemoAttachments lists the attachments of a memo. Requires read access + * to the memo. + * + * @generated from rpc memos.api.MemoService.ListMemoAttachments + */ + listMemoAttachments: { + methodKind: "unary"; + input: typeof ListMemoAttachmentsRequestSchema; + output: typeof ListMemoAttachmentsResponseSchema; + }, + /** + * 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. + * + * @generated from rpc memos.api.MemoService.SetMemoAttachments + */ + setMemoAttachments: { + methodKind: "unary"; + input: typeof SetMemoAttachmentsRequestSchema; + output: typeof EmptySchema; + }, + /** + * ListMemoRelations lists the relations of a memo in both directions. + * Requires read access to the memo. + * + * @generated from rpc memos.api.MemoService.ListMemoRelations + */ + listMemoRelations: { + methodKind: "unary"; + input: typeof ListMemoRelationsRequestSchema; + output: typeof ListMemoRelationsResponseSchema; + }, + /** + * 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. + * + * @generated from rpc memos.api.MemoService.SetMemoRelations + */ + setMemoRelations: { + methodKind: "unary"; + input: typeof SetMemoRelationsRequestSchema; + output: typeof EmptySchema; + }, + /** + * ListMemoComments lists the active comments on a memo that the caller can + * read. Requires read access to the memo. + * + * @generated from rpc memos.api.MemoService.ListMemoComments + */ + listMemoComments: { + methodKind: "unary"; + input: typeof ListMemoCommentsRequestSchema; + output: typeof ListMemoCommentsResponseSchema; + }, + /** + * 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. + * + * @generated from rpc memos.api.MemoService.CreateMemoComment + */ + createMemoComment: { + methodKind: "unary"; + input: typeof CreateMemoCommentRequestSchema; + output: typeof MemoSchema; + }, + /** + * ListMemoReactions lists the reactions on a memo. Requires read access to + * the memo. + * + * @generated from rpc memos.api.MemoService.ListMemoReactions + */ + listMemoReactions: { + methodKind: "unary"; + input: typeof ListMemoReactionsRequestSchema; + output: typeof ListMemoReactionsResponseSchema; + }, + /** + * DeleteMemoReaction deletes a reaction. Requires the reaction creator or an + * instance administrator. + * + * @generated from rpc memos.api.MemoService.DeleteMemoReaction + */ + deleteMemoReaction: { + methodKind: "unary"; + input: typeof DeleteMemoReactionRequestSchema; + output: typeof EmptySchema; + }, + /** + * UpsertMemoReaction adds or updates the authenticated user's reaction on a + * memo. Requires read access to the memo. + * + * @generated from rpc memos.api.MemoService.UpsertMemoReaction + */ + upsertMemoReaction: { + methodKind: "unary"; + input: typeof UpsertMemoReactionRequestSchema; + output: typeof ReactionSchema; + }, + /** + * ListMemoShares lists all share links for a memo. Requires the memo creator + * or an instance administrator. + * + * @generated from rpc memos.api.MemoService.ListMemoShares + */ + listMemoShares: { + methodKind: "unary"; + input: typeof ListMemoSharesRequestSchema; + output: typeof ListMemoSharesResponseSchema; + }, + /** + * 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. + * + * @generated from rpc memos.api.MemoService.CreateMemoShare + */ + createMemoShare: { + methodKind: "unary"; + input: typeof CreateMemoShareRequestSchema; + output: typeof MemoShareSchema; + }, + /** + * DeleteMemoShare revokes a share link. Requires the memo creator or an + * instance administrator. + * + * @generated from rpc memos.api.MemoService.DeleteMemoShare + */ + deleteMemoShare: { + methodKind: "unary"; + input: typeof DeleteMemoShareRequestSchema; + output: typeof EmptySchema; + }, + /** + * GetSharedMemo resolves a share token to its memo. No authentication is + * required. Returns NOT_FOUND if the token is invalid or expired. + * + * @generated from rpc memos.api.MemoService.GetSharedMemo + */ + getSharedMemo: { + methodKind: "unary"; + input: typeof GetSharedMemoRequestSchema; + output: typeof MemoSchema; + }, + /** + * GetLinkMetadata fetches the title, description, and image of a link. + * + * @generated from rpc memos.api.MemoService.GetLinkMetadata + */ + getLinkMetadata: { + methodKind: "unary"; + input: typeof GetLinkMetadataRequestSchema; + output: typeof LinkMetadataSchema; + }, + /** + * BatchGetLinkMetadata fetches the metadata of up to 10 links. + * + * @generated from rpc memos.api.MemoService.BatchGetLinkMetadata + */ + batchGetLinkMetadata: { + methodKind: "unary"; + input: typeof BatchGetLinkMetadataRequestSchema; + output: typeof BatchGetLinkMetadataResponseSchema; + }, +}> = /*@__PURE__*/ + serviceDesc(file_api_memo_service, 0); + diff --git a/web/src/types/proto/api/space_service_pb.ts b/web/src/types/proto/api/space_service_pb.ts new file mode 100644 index 000000000..632ddebb9 --- /dev/null +++ b/web/src/types/proto/api/space_service_pb.ts @@ -0,0 +1,964 @@ +// @generated by protoc-gen-es v2.12.1 with parameter "target=ts" +// @generated from file api/space_service.proto (package memos.api, syntax proto3) +/* eslint-disable */ + +import type { GenEnum, GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv2"; +import { enumDesc, fileDesc, messageDesc, serviceDesc } from "@bufbuild/protobuf/codegenv2"; +import { file_google_api_annotations } from "../google/api/annotations_pb"; +import { file_google_api_client } from "../google/api/client_pb"; +import { file_google_api_field_behavior } from "../google/api/field_behavior_pb"; +import { file_google_api_resource } from "../google/api/resource_pb"; +import type { EmptySchema, FieldMask } from "@bufbuild/protobuf/wkt"; +import { file_google_protobuf_empty, file_google_protobuf_field_mask } from "@bufbuild/protobuf/wkt"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file api/space_service.proto. + */ +export const file_api_space_service: GenFile = /*@__PURE__*/ + fileDesc("ChdhcGkvc3BhY2Vfc2VydmljZS5wcm90bxIJbWVtb3MuYXBpIrMCCgVTcGFjZRIRCgRuYW1lGAEgASgJQgPgQQgSEgoFdGl0bGUYAiABKAlCA+BBAhIYCgtkZXNjcmlwdGlvbhgDIAEoCUID4EEBEigKBGljb24YBCABKAsyFS5tZW1vcy5hcGkuU3BhY2UuSWNvbkID4EEBEjsKEWN1cnJlbnRfdXNlcl9yb2xlGAUgASgOMhsubWVtb3MuYXBpLlNwYWNlTWVtYmVyLlJvbGVCA+BBAxIZCgxtZW1iZXJfY291bnQYBiABKAVCA+BBAxoyCgRJY29uEg8KBWVtb2ppGAEgASgJSAASEAoGbHVjaWRlGAIgASgJSABCBwoFdmFsdWU6M+pBMAoPbWVtb3MuYXBpL1NwYWNlEg5zcGFjZXMve3NwYWNlfSoGc3BhY2VzMgVzcGFjZSJEChFMaXN0U3BhY2VzUmVxdWVzdBIWCglwYWdlX3NpemUYASABKAVCA+BBARIXCgpwYWdlX3Rva2VuGAIgASgJQgPgQQEiTwoSTGlzdFNwYWNlc1Jlc3BvbnNlEiAKBnNwYWNlcxgBIAMoCzIQLm1lbW9zLmFwaS5TcGFjZRIXCg9uZXh0X3BhZ2VfdG9rZW4YAiABKAkiOAoPR2V0U3BhY2VSZXF1ZXN0EiUKBG5hbWUYASABKAlCF+BBAvpBEQoPbWVtb3MuYXBpL1NwYWNlIlEKEkNyZWF0ZVNwYWNlUmVxdWVzdBIkCgVzcGFjZRgBIAEoCzIQLm1lbW9zLmFwaS5TcGFjZUID4EECEhUKCHNwYWNlX2lkGAIgASgJQgPgQQEicAoSVXBkYXRlU3BhY2VSZXF1ZXN0EiQKBXNwYWNlGAEgASgLMhAubWVtb3MuYXBpLlNwYWNlQgPgQQISNAoLdXBkYXRlX21hc2sYAiABKAsyGi5nb29nbGUucHJvdG9idWYuRmllbGRNYXNrQgPgQQIiOwoSRGVsZXRlU3BhY2VSZXF1ZXN0EiUKBG5hbWUYASABKAlCF+BBAvpBEQoPbWVtb3MuYXBpL1NwYWNlIoECCgtTcGFjZU1lbWJlchIRCgRuYW1lGAEgASgJQgPgQQgSJAoEdXNlchgCIAEoCUIW4EEC+kEQCg5tZW1vcy5hcGkvVXNlchIuCgRyb2xlGAMgASgOMhsubWVtb3MuYXBpLlNwYWNlTWVtYmVyLlJvbGVCA+BBAiIxCgRSb2xlEhQKEFJPTEVfVU5TUEVDSUZJRUQQABIJCgVBRE1JThABEggKBFVTRVIQAjpW6kFTChVtZW1vcy5hcGkvU3BhY2VNZW1iZXISH3NwYWNlcy97c3BhY2V9L21lbWJlcnMve21lbWJlcn0qDHNwYWNlTWVtYmVyczILc3BhY2VNZW1iZXIieQoXTGlzdFNwYWNlTWVtYmVyc1JlcXVlc3QSLQoGcGFyZW50GAEgASgJQh3gQQL6QRcSFW1lbW9zLmFwaS9TcGFjZU1lbWJlchIWCglwYWdlX3NpemUYAiABKAVCA+BBARIXCgpwYWdlX3Rva2VuGAMgASgJQgPgQQEiYgoYTGlzdFNwYWNlTWVtYmVyc1Jlc3BvbnNlEi0KDXNwYWNlX21lbWJlcnMYASADKAsyFi5tZW1vcy5hcGkuU3BhY2VNZW1iZXISFwoPbmV4dF9wYWdlX3Rva2VuGAIgASgJIkQKFUdldFNwYWNlTWVtYmVyUmVxdWVzdBIrCgRuYW1lGAEgASgJQh3gQQL6QRcKFW1lbW9zLmFwaS9TcGFjZU1lbWJlciKDAQoYVXBkYXRlU3BhY2VNZW1iZXJSZXF1ZXN0EjEKDHNwYWNlX21lbWJlchgBIAEoCzIWLm1lbW9zLmFwaS5TcGFjZU1lbWJlckID4EECEjQKC3VwZGF0ZV9tYXNrGAIgASgLMhouZ29vZ2xlLnByb3RvYnVmLkZpZWxkTWFza0ID4EECIkcKGERlbGV0ZVNwYWNlTWVtYmVyUmVxdWVzdBIrCgRuYW1lGAEgASgJQh3gQQL6QRcKFW1lbW9zLmFwaS9TcGFjZU1lbWJlciKPAgoPU3BhY2VJbnZpdGF0aW9uEhEKBG5hbWUYASABKAlCA+BBCBInCgdpbnZpdGVlGAIgASgJQhbgQQL6QRAKDm1lbW9zLmFwaS9Vc2VyEi4KBHJvbGUYAyABKA4yGy5tZW1vcy5hcGkuU3BhY2VNZW1iZXIuUm9sZUID4EECEiQKBXNwYWNlGAQgASgLMhAubWVtb3MuYXBpLlNwYWNlQgPgQQM6aupBZwoZbWVtb3MuYXBpL1NwYWNlSW52aXRhdGlvbhInc3BhY2VzL3tzcGFjZX0vaW52aXRhdGlvbnMve2ludml0YXRpb259KhBzcGFjZUludml0YXRpb25zMg9zcGFjZUludml0YXRpb24igQEKG0xpc3RTcGFjZUludml0YXRpb25zUmVxdWVzdBIxCgZwYXJlbnQYASABKAlCIeBBAvpBGxIZbWVtb3MuYXBpL1NwYWNlSW52aXRhdGlvbhIWCglwYWdlX3NpemUYAiABKAVCA+BBARIXCgpwYWdlX3Rva2VuGAMgASgJQgPgQQEibgocTGlzdFNwYWNlSW52aXRhdGlvbnNSZXNwb25zZRI1ChFzcGFjZV9pbnZpdGF0aW9ucxgBIAMoCzIaLm1lbW9zLmFwaS5TcGFjZUludml0YXRpb24SFwoPbmV4dF9wYWdlX3Rva2VuGAIgASgJInoKH0xpc3RVc2VyU3BhY2VJbnZpdGF0aW9uc1JlcXVlc3QSJgoGcGFyZW50GAEgASgJQhbgQQL6QRAKDm1lbW9zLmFwaS9Vc2VyEhYKCXBhZ2Vfc2l6ZRgCIAEoBUID4EEBEhcKCnBhZ2VfdG9rZW4YAyABKAlCA+BBASJyCiBMaXN0VXNlclNwYWNlSW52aXRhdGlvbnNSZXNwb25zZRI1ChFzcGFjZV9pbnZpdGF0aW9ucxgBIAMoCzIaLm1lbW9zLmFwaS5TcGFjZUludml0YXRpb24SFwoPbmV4dF9wYWdlX3Rva2VuGAIgASgJIkwKGUdldFNwYWNlSW52aXRhdGlvblJlcXVlc3QSLwoEbmFtZRgBIAEoCUIh4EEC+kEbChltZW1vcy5hcGkvU3BhY2VJbnZpdGF0aW9uIowBChxDcmVhdGVTcGFjZUludml0YXRpb25SZXF1ZXN0EjEKBnBhcmVudBgBIAEoCUIh4EEC+kEbEhltZW1vcy5hcGkvU3BhY2VJbnZpdGF0aW9uEjkKEHNwYWNlX2ludml0YXRpb24YAiABKAsyGi5tZW1vcy5hcGkuU3BhY2VJbnZpdGF0aW9uQgPgQQIiTwocRGVsZXRlU3BhY2VJbnZpdGF0aW9uUmVxdWVzdBIvCgRuYW1lGAEgASgJQiHgQQL6QRsKGW1lbW9zLmFwaS9TcGFjZUludml0YXRpb24iTwocQWNjZXB0U3BhY2VJbnZpdGF0aW9uUmVxdWVzdBIvCgRuYW1lGAEgASgJQiHgQQL6QRsKGW1lbW9zLmFwaS9TcGFjZUludml0YXRpb24iUAodRGVjbGluZVNwYWNlSW52aXRhdGlvblJlcXVlc3QSLwoEbmFtZRgBIAEoCUIh4EEC+kEbChltZW1vcy5hcGkvU3BhY2VJbnZpdGF0aW9uMqwRCgxTcGFjZVNlcnZpY2USYQoKTGlzdFNwYWNlcxIcLm1lbW9zLmFwaS5MaXN0U3BhY2VzUmVxdWVzdBodLm1lbW9zLmFwaS5MaXN0U3BhY2VzUmVzcG9uc2UiFtpBAILT5JMCDRILL2FwaS9zcGFjZXMSXQoIR2V0U3BhY2USGi5tZW1vcy5hcGkuR2V0U3BhY2VSZXF1ZXN0GhAubWVtb3MuYXBpLlNwYWNlIiPaQQRuYW1lgtPkkwIWEhQvYXBpL3tuYW1lPXNwYWNlcy8qfRJiCgtDcmVhdGVTcGFjZRIdLm1lbW9zLmFwaS5DcmVhdGVTcGFjZVJlcXVlc3QaEC5tZW1vcy5hcGkuU3BhY2UiItpBBXNwYWNlgtPkkwIUOgVzcGFjZSILL2FwaS9zcGFjZXMSfQoLVXBkYXRlU3BhY2USHS5tZW1vcy5hcGkuVXBkYXRlU3BhY2VSZXF1ZXN0GhAubWVtb3MuYXBpLlNwYWNlIj3aQRFzcGFjZSx1cGRhdGVfbWFza4LT5JMCIzoFc3BhY2UyGi9hcGkve3NwYWNlLm5hbWU9c3BhY2VzLyp9EmkKC0RlbGV0ZVNwYWNlEh0ubWVtb3MuYXBpLkRlbGV0ZVNwYWNlUmVxdWVzdBoWLmdvb2dsZS5wcm90b2J1Zi5FbXB0eSIj2kEEbmFtZYLT5JMCFioUL2FwaS97bmFtZT1zcGFjZXMvKn0SjAEKEExpc3RTcGFjZU1lbWJlcnMSIi5tZW1vcy5hcGkuTGlzdFNwYWNlTWVtYmVyc1JlcXVlc3QaIy5tZW1vcy5hcGkuTGlzdFNwYWNlTWVtYmVyc1Jlc3BvbnNlIi/aQQZwYXJlbnSC0+STAiASHi9hcGkve3BhcmVudD1zcGFjZXMvKn0vbWVtYmVycxJ5Cg5HZXRTcGFjZU1lbWJlchIgLm1lbW9zLmFwaS5HZXRTcGFjZU1lbWJlclJlcXVlc3QaFi5tZW1vcy5hcGkuU3BhY2VNZW1iZXIiLdpBBG5hbWWC0+STAiASHi9hcGkve25hbWU9c3BhY2VzLyovbWVtYmVycy8qfRKuAQoRVXBkYXRlU3BhY2VNZW1iZXISIy5tZW1vcy5hcGkuVXBkYXRlU3BhY2VNZW1iZXJSZXF1ZXN0GhYubWVtb3MuYXBpLlNwYWNlTWVtYmVyIlzaQRhzcGFjZV9tZW1iZXIsdXBkYXRlX21hc2uC0+STAjs6DHNwYWNlX21lbWJlcjIrL2FwaS97c3BhY2VfbWVtYmVyLm5hbWU9c3BhY2VzLyovbWVtYmVycy8qfRJ/ChFEZWxldGVTcGFjZU1lbWJlchIjLm1lbW9zLmFwaS5EZWxldGVTcGFjZU1lbWJlclJlcXVlc3QaFi5nb29nbGUucHJvdG9idWYuRW1wdHkiLdpBBG5hbWWC0+STAiAqHi9hcGkve25hbWU9c3BhY2VzLyovbWVtYmVycy8qfRKcAQoUTGlzdFNwYWNlSW52aXRhdGlvbnMSJi5tZW1vcy5hcGkuTGlzdFNwYWNlSW52aXRhdGlvbnNSZXF1ZXN0GicubWVtb3MuYXBpLkxpc3RTcGFjZUludml0YXRpb25zUmVzcG9uc2UiM9pBBnBhcmVudILT5JMCJBIiL2FwaS97cGFyZW50PXNwYWNlcy8qfS9pbnZpdGF0aW9ucxKsAQoYTGlzdFVzZXJTcGFjZUludml0YXRpb25zEioubWVtb3MuYXBpLkxpc3RVc2VyU3BhY2VJbnZpdGF0aW9uc1JlcXVlc3QaKy5tZW1vcy5hcGkuTGlzdFVzZXJTcGFjZUludml0YXRpb25zUmVzcG9uc2UiN9pBBnBhcmVudILT5JMCKBImL2FwaS97cGFyZW50PXVzZXJzLyp9L3NwYWNlSW52aXRhdGlvbnMSiQEKEkdldFNwYWNlSW52aXRhdGlvbhIkLm1lbW9zLmFwaS5HZXRTcGFjZUludml0YXRpb25SZXF1ZXN0GhoubWVtb3MuYXBpLlNwYWNlSW52aXRhdGlvbiIx2kEEbmFtZYLT5JMCJBIiL2FwaS97bmFtZT1zcGFjZXMvKi9pbnZpdGF0aW9ucy8qfRK0AQoVQ3JlYXRlU3BhY2VJbnZpdGF0aW9uEicubWVtb3MuYXBpLkNyZWF0ZVNwYWNlSW52aXRhdGlvblJlcXVlc3QaGi5tZW1vcy5hcGkuU3BhY2VJbnZpdGF0aW9uIlbaQRdwYXJlbnQsc3BhY2VfaW52aXRhdGlvboLT5JMCNjoQc3BhY2VfaW52aXRhdGlvbiIiL2FwaS97cGFyZW50PXNwYWNlcy8qfS9pbnZpdGF0aW9ucxKLAQoVRGVsZXRlU3BhY2VJbnZpdGF0aW9uEicubWVtb3MuYXBpLkRlbGV0ZVNwYWNlSW52aXRhdGlvblJlcXVlc3QaFi5nb29nbGUucHJvdG9idWYuRW1wdHkiMdpBBG5hbWWC0+STAiQqIi9hcGkve25hbWU9c3BhY2VzLyovaW52aXRhdGlvbnMvKn0SlQEKFUFjY2VwdFNwYWNlSW52aXRhdGlvbhInLm1lbW9zLmFwaS5BY2NlcHRTcGFjZUludml0YXRpb25SZXF1ZXN0GhYubWVtb3MuYXBpLlNwYWNlTWVtYmVyIjvaQQRuYW1lgtPkkwIuOgEqIikvYXBpL3tuYW1lPXNwYWNlcy8qL2ludml0YXRpb25zLyp9OmFjY2VwdBKYAQoWRGVjbGluZVNwYWNlSW52aXRhdGlvbhIoLm1lbW9zLmFwaS5EZWNsaW5lU3BhY2VJbnZpdGF0aW9uUmVxdWVzdBoWLmdvb2dsZS5wcm90b2J1Zi5FbXB0eSI82kEEbmFtZYLT5JMCLzoBKiIqL2FwaS97bmFtZT1zcGFjZXMvKi9pbnZpdGF0aW9ucy8qfTpkZWNsaW5lQpABCg1jb20ubWVtb3MuYXBpQhFTcGFjZVNlcnZpY2VQcm90b1ABWidnaXRodWIuY29tL3VzZW1lbW9zL21lbW9zL3Byb3RvL2dlbi9hcGmiAgNNQViqAglNZW1vcy5BcGnKAglNZW1vc1xBcGniAhVNZW1vc1xBcGlcR1BCTWV0YWRhdGHqAgpNZW1vczo6QXBpYgZwcm90bzM", [file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_empty, file_google_protobuf_field_mask]); + +/** + * Space is a collaboration boundary for placed memos. + * + * @generated from message memos.api.Space + */ +export type Space = Message<"memos.api.Space"> & { + /** + * Identifier. The resource name of the space. + * Format: spaces/{space} + * + * @generated from field: string name = 1; + */ + name: string; + + /** + * Required. The human-readable title. + * + * @generated from field: string title = 2; + */ + title: string; + + /** + * Optional. A description of the space. + * + * @generated from field: string description = 3; + */ + description: string; + + /** + * Optional. The display icon. Omit it when updating with the "icon" mask to + * reset to the default space mark. + * + * @generated from field: memos.api.Space.Icon icon = 4; + */ + icon?: Space_Icon | undefined; + + /** + * Output only. The authenticated user's membership role in this space. + * ROLE_UNSPECIFIED when this space is exposed as metadata only. + * + * @generated from field: memos.api.SpaceMember.Role current_user_role = 5; + */ + currentUserRole: SpaceMember_Role; + + /** + * Output only. The number of accepted members in this space. Pending + * invitations are excluded. Zero when this space is exposed as metadata only. + * + * @generated from field: int32 member_count = 6; + */ + memberCount: number; +}; + +/** + * Describes the message memos.api.Space. + * Use `create(SpaceSchema)` to create a new message. + */ +export const SpaceSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_space_service, 0); + +/** + * Icon is the display icon of a space. + * + * @generated from message memos.api.Space.Icon + */ +export type Space_Icon = Message<"memos.api.Space.Icon"> & { + /** + * The icon value. + * + * @generated from oneof memos.api.Space.Icon.value + */ + value: { + /** + * A Unicode emoji sequence. + * + * @generated from field: string emoji = 1; + */ + value: string; + case: "emoji"; + } | { + /** + * A canonical Lucide icon name, such as "leaf". + * + * @generated from field: string lucide = 2; + */ + value: string; + case: "lucide"; + } | { case: undefined; value?: undefined }; +}; + +/** + * Describes the message memos.api.Space.Icon. + * Use `create(Space_IconSchema)` to create a new message. + */ +export const Space_IconSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_space_service, 0, 0); + +/** + * Request message for SpaceService.ListSpaces. + * + * @generated from message memos.api.ListSpacesRequest + */ +export type ListSpacesRequest = Message<"memos.api.ListSpacesRequest"> & { + /** + * Optional. The maximum number of spaces to return. The service may return fewer. + * + * @generated from field: int32 page_size = 1; + */ + pageSize: number; + + /** + * Optional. A page token from a previous call. Provide it to retrieve the next page. + * + * @generated from field: string page_token = 2; + */ + pageToken: string; +}; + +/** + * Describes the message memos.api.ListSpacesRequest. + * Use `create(ListSpacesRequestSchema)` to create a new message. + */ +export const ListSpacesRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_space_service, 1); + +/** + * Response message for SpaceService.ListSpaces. + * + * @generated from message memos.api.ListSpacesResponse + */ +export type ListSpacesResponse = Message<"memos.api.ListSpacesResponse"> & { + /** + * The spaces of which the caller is a member. + * + * @generated from field: repeated memos.api.Space spaces = 1; + */ + spaces: Space[]; + + /** + * A token to retrieve the next page. Empty when there are no more pages. + * + * @generated from field: string next_page_token = 2; + */ + nextPageToken: string; +}; + +/** + * Describes the message memos.api.ListSpacesResponse. + * Use `create(ListSpacesResponseSchema)` to create a new message. + */ +export const ListSpacesResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_space_service, 2); + +/** + * Request message for SpaceService.GetSpace. + * + * @generated from message memos.api.GetSpaceRequest + */ +export type GetSpaceRequest = Message<"memos.api.GetSpaceRequest"> & { + /** + * Required. The resource name of the space. + * Format: spaces/{space} + * + * @generated from field: string name = 1; + */ + name: string; +}; + +/** + * Describes the message memos.api.GetSpaceRequest. + * Use `create(GetSpaceRequestSchema)` to create a new message. + */ +export const GetSpaceRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_space_service, 3); + +/** + * Request message for SpaceService.CreateSpace. + * + * @generated from message memos.api.CreateSpaceRequest + */ +export type CreateSpaceRequest = Message<"memos.api.CreateSpaceRequest"> & { + /** + * Required. The space to create. + * + * @generated from field: memos.api.Space space = 1; + */ + space?: Space | undefined; + + /** + * Optional. The ID to use for the space, which becomes the final segment of + * its resource name. If empty, a UUID v4 is generated. Must match + * ^[a-zA-Z0-9]([a-zA-Z0-9-]{0,34}[a-zA-Z0-9])?$. + * + * @generated from field: string space_id = 2; + */ + spaceId: string; +}; + +/** + * Describes the message memos.api.CreateSpaceRequest. + * Use `create(CreateSpaceRequestSchema)` to create a new message. + */ +export const CreateSpaceRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_space_service, 4); + +/** + * Request message for SpaceService.UpdateSpace. + * + * @generated from message memos.api.UpdateSpaceRequest + */ +export type UpdateSpaceRequest = Message<"memos.api.UpdateSpaceRequest"> & { + /** + * Required. The space with updated values. Its name identifies the space to + * update. + * + * @generated from field: memos.api.Space space = 1; + */ + space?: Space | undefined; + + /** + * Required. The fields to update. Supported paths: title, description, icon. + * + * @generated from field: google.protobuf.FieldMask update_mask = 2; + */ + updateMask?: FieldMask | undefined; +}; + +/** + * Describes the message memos.api.UpdateSpaceRequest. + * Use `create(UpdateSpaceRequestSchema)` to create a new message. + */ +export const UpdateSpaceRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_space_service, 5); + +/** + * Request message for SpaceService.DeleteSpace. + * + * @generated from message memos.api.DeleteSpaceRequest + */ +export type DeleteSpaceRequest = Message<"memos.api.DeleteSpaceRequest"> & { + /** + * Required. The resource name of the space. + * Format: spaces/{space} + * + * @generated from field: string name = 1; + */ + name: string; +}; + +/** + * Describes the message memos.api.DeleteSpaceRequest. + * Use `create(DeleteSpaceRequestSchema)` to create a new message. + */ +export const DeleteSpaceRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_space_service, 6); + +/** + * SpaceMember is a user's membership and governance role in a space. + * + * @generated from message memos.api.SpaceMember + */ +export type SpaceMember = Message<"memos.api.SpaceMember"> & { + /** + * Identifier. The resource name of the membership. The member segment is + * the member's username. + * Format: spaces/{space}/members/{member} + * + * @generated from field: string name = 1; + */ + name: string; + + /** + * Required. The member user. + * Format: users/{user} + * + * @generated from field: string user = 2; + */ + user: string; + + /** + * Required. The member's role within this space. + * + * @generated from field: memos.api.SpaceMember.Role role = 3; + */ + role: SpaceMember_Role; +}; + +/** + * Describes the message memos.api.SpaceMember. + * Use `create(SpaceMemberSchema)` to create a new message. + */ +export const SpaceMemberSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_space_service, 7); + +/** + * Role is a member's governance role within a space. + * + * @generated from enum memos.api.SpaceMember.Role + */ +export enum SpaceMember_Role { + /** + * @generated from enum value: ROLE_UNSPECIFIED = 0; + */ + ROLE_UNSPECIFIED = 0, + + /** + * Can update and delete the space, manage members and manage invitations. + * + * @generated from enum value: ADMIN = 1; + */ + ADMIN = 1, + + /** + * A regular member without governance permissions. + * + * @generated from enum value: USER = 2; + */ + USER = 2, +} + +/** + * Describes the enum memos.api.SpaceMember.Role. + */ +export const SpaceMember_RoleSchema: GenEnum = /*@__PURE__*/ + enumDesc(file_api_space_service, 7, 0); + +/** + * Request message for SpaceService.ListSpaceMembers. + * + * @generated from message memos.api.ListSpaceMembersRequest + */ +export type ListSpaceMembersRequest = Message<"memos.api.ListSpaceMembersRequest"> & { + /** + * Required. The parent space. + * Format: spaces/{space} + * + * @generated from field: string parent = 1; + */ + parent: string; + + /** + * Optional. The maximum number of members to return. The service may return fewer. + * + * @generated from field: int32 page_size = 2; + */ + pageSize: number; + + /** + * Optional. A page token from a previous call. Provide it to retrieve the next page. + * + * @generated from field: string page_token = 3; + */ + pageToken: string; +}; + +/** + * Describes the message memos.api.ListSpaceMembersRequest. + * Use `create(ListSpaceMembersRequestSchema)` to create a new message. + */ +export const ListSpaceMembersRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_space_service, 8); + +/** + * Response message for SpaceService.ListSpaceMembers. + * + * @generated from message memos.api.ListSpaceMembersResponse + */ +export type ListSpaceMembersResponse = Message<"memos.api.ListSpaceMembersResponse"> & { + /** + * The members of the space. + * + * @generated from field: repeated memos.api.SpaceMember space_members = 1; + */ + spaceMembers: SpaceMember[]; + + /** + * A token to retrieve the next page. Empty when there are no more pages. + * + * @generated from field: string next_page_token = 2; + */ + nextPageToken: string; +}; + +/** + * Describes the message memos.api.ListSpaceMembersResponse. + * Use `create(ListSpaceMembersResponseSchema)` to create a new message. + */ +export const ListSpaceMembersResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_space_service, 9); + +/** + * Request message for SpaceService.GetSpaceMember. + * + * @generated from message memos.api.GetSpaceMemberRequest + */ +export type GetSpaceMemberRequest = Message<"memos.api.GetSpaceMemberRequest"> & { + /** + * Required. The resource name of the membership. + * Format: spaces/{space}/members/{member} + * + * @generated from field: string name = 1; + */ + name: string; +}; + +/** + * Describes the message memos.api.GetSpaceMemberRequest. + * Use `create(GetSpaceMemberRequestSchema)` to create a new message. + */ +export const GetSpaceMemberRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_space_service, 10); + +/** + * Request message for SpaceService.UpdateSpaceMember. + * + * @generated from message memos.api.UpdateSpaceMemberRequest + */ +export type UpdateSpaceMemberRequest = Message<"memos.api.UpdateSpaceMemberRequest"> & { + /** + * Required. The membership with the new role. Its name identifies the + * membership to update. + * + * @generated from field: memos.api.SpaceMember space_member = 1; + */ + spaceMember?: SpaceMember | undefined; + + /** + * Required. The fields to update. Must include role. The user path is also + * accepted, but the user must match the existing member and is never changed. + * + * @generated from field: google.protobuf.FieldMask update_mask = 2; + */ + updateMask?: FieldMask | undefined; +}; + +/** + * Describes the message memos.api.UpdateSpaceMemberRequest. + * Use `create(UpdateSpaceMemberRequestSchema)` to create a new message. + */ +export const UpdateSpaceMemberRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_space_service, 11); + +/** + * Request message for SpaceService.DeleteSpaceMember. + * + * @generated from message memos.api.DeleteSpaceMemberRequest + */ +export type DeleteSpaceMemberRequest = Message<"memos.api.DeleteSpaceMemberRequest"> & { + /** + * Required. The resource name of the membership. + * Format: spaces/{space}/members/{member} + * + * @generated from field: string name = 1; + */ + name: string; +}; + +/** + * Describes the message memos.api.DeleteSpaceMemberRequest. + * Use `create(DeleteSpaceMemberRequestSchema)` to create a new message. + */ +export const DeleteSpaceMemberRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_space_service, 12); + +/** + * SpaceInvitation is a pending invitation for an existing user to join a space. + * + * @generated from message memos.api.SpaceInvitation + */ +export type SpaceInvitation = Message<"memos.api.SpaceInvitation"> & { + /** + * Identifier. The resource name of the invitation. The invitation segment + * is the invitee's username. + * Format: spaces/{space}/invitations/{invitation} + * + * @generated from field: string name = 1; + */ + name: string; + + /** + * Required. The invited user. + * Format: users/{user} + * + * @generated from field: string invitee = 2; + */ + invitee: string; + + /** + * Required. The role the user receives after accepting the invitation. + * + * @generated from field: memos.api.SpaceMember.Role role = 3; + */ + role: SpaceMember_Role; + + /** + * Output only. The space the user is invited to, as metadata only. This lets + * an invitee understand the invitation without membership-based GetSpace + * access. + * + * @generated from field: memos.api.Space space = 4; + */ + space?: Space | undefined; +}; + +/** + * Describes the message memos.api.SpaceInvitation. + * Use `create(SpaceInvitationSchema)` to create a new message. + */ +export const SpaceInvitationSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_space_service, 13); + +/** + * Request message for SpaceService.ListSpaceInvitations. + * + * @generated from message memos.api.ListSpaceInvitationsRequest + */ +export type ListSpaceInvitationsRequest = Message<"memos.api.ListSpaceInvitationsRequest"> & { + /** + * Required. The parent space. + * Format: spaces/{space} + * + * @generated from field: string parent = 1; + */ + parent: string; + + /** + * Optional. The maximum number of invitations to return. The service may return fewer. + * + * @generated from field: int32 page_size = 2; + */ + pageSize: number; + + /** + * Optional. A page token from a previous call. Provide it to retrieve the next page. + * + * @generated from field: string page_token = 3; + */ + pageToken: string; +}; + +/** + * Describes the message memos.api.ListSpaceInvitationsRequest. + * Use `create(ListSpaceInvitationsRequestSchema)` to create a new message. + */ +export const ListSpaceInvitationsRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_space_service, 14); + +/** + * Response message for SpaceService.ListSpaceInvitations. + * + * @generated from message memos.api.ListSpaceInvitationsResponse + */ +export type ListSpaceInvitationsResponse = Message<"memos.api.ListSpaceInvitationsResponse"> & { + /** + * The pending invitations for the space. + * + * @generated from field: repeated memos.api.SpaceInvitation space_invitations = 1; + */ + spaceInvitations: SpaceInvitation[]; + + /** + * A token to retrieve the next page. Empty when there are no more pages. + * + * @generated from field: string next_page_token = 2; + */ + nextPageToken: string; +}; + +/** + * Describes the message memos.api.ListSpaceInvitationsResponse. + * Use `create(ListSpaceInvitationsResponseSchema)` to create a new message. + */ +export const ListSpaceInvitationsResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_space_service, 15); + +/** + * Request message for SpaceService.ListUserSpaceInvitations. + * + * @generated from message memos.api.ListUserSpaceInvitationsRequest + */ +export type ListUserSpaceInvitationsRequest = Message<"memos.api.ListUserSpaceInvitationsRequest"> & { + /** + * Required. The user whose invitations to list. Must be the authenticated + * user. + * Format: users/{user} + * + * @generated from field: string parent = 1; + */ + parent: string; + + /** + * Optional. The maximum number of invitations to return. The service may return fewer. + * + * @generated from field: int32 page_size = 2; + */ + pageSize: number; + + /** + * Optional. A page token from a previous call. Provide it to retrieve the next page. + * + * @generated from field: string page_token = 3; + */ + pageToken: string; +}; + +/** + * Describes the message memos.api.ListUserSpaceInvitationsRequest. + * Use `create(ListUserSpaceInvitationsRequestSchema)` to create a new message. + */ +export const ListUserSpaceInvitationsRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_space_service, 16); + +/** + * Response message for SpaceService.ListUserSpaceInvitations. + * + * @generated from message memos.api.ListUserSpaceInvitationsResponse + */ +export type ListUserSpaceInvitationsResponse = Message<"memos.api.ListUserSpaceInvitationsResponse"> & { + /** + * The pending invitations received by the user. + * + * @generated from field: repeated memos.api.SpaceInvitation space_invitations = 1; + */ + spaceInvitations: SpaceInvitation[]; + + /** + * A token to retrieve the next page. Empty when there are no more pages. + * + * @generated from field: string next_page_token = 2; + */ + nextPageToken: string; +}; + +/** + * Describes the message memos.api.ListUserSpaceInvitationsResponse. + * Use `create(ListUserSpaceInvitationsResponseSchema)` to create a new message. + */ +export const ListUserSpaceInvitationsResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_space_service, 17); + +/** + * Request message for SpaceService.GetSpaceInvitation. + * + * @generated from message memos.api.GetSpaceInvitationRequest + */ +export type GetSpaceInvitationRequest = Message<"memos.api.GetSpaceInvitationRequest"> & { + /** + * Required. The resource name of the invitation. + * Format: spaces/{space}/invitations/{invitation} + * + * @generated from field: string name = 1; + */ + name: string; +}; + +/** + * Describes the message memos.api.GetSpaceInvitationRequest. + * Use `create(GetSpaceInvitationRequestSchema)` to create a new message. + */ +export const GetSpaceInvitationRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_space_service, 18); + +/** + * Request message for SpaceService.CreateSpaceInvitation. + * + * @generated from message memos.api.CreateSpaceInvitationRequest + */ +export type CreateSpaceInvitationRequest = Message<"memos.api.CreateSpaceInvitationRequest"> & { + /** + * Required. The parent space. + * Format: spaces/{space} + * + * @generated from field: string parent = 1; + */ + parent: string; + + /** + * Required. The invitation to create. The role must be ADMIN or USER. + * + * @generated from field: memos.api.SpaceInvitation space_invitation = 2; + */ + spaceInvitation?: SpaceInvitation | undefined; +}; + +/** + * Describes the message memos.api.CreateSpaceInvitationRequest. + * Use `create(CreateSpaceInvitationRequestSchema)` to create a new message. + */ +export const CreateSpaceInvitationRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_space_service, 19); + +/** + * Request message for SpaceService.DeleteSpaceInvitation. + * + * @generated from message memos.api.DeleteSpaceInvitationRequest + */ +export type DeleteSpaceInvitationRequest = Message<"memos.api.DeleteSpaceInvitationRequest"> & { + /** + * Required. The resource name of the invitation. + * Format: spaces/{space}/invitations/{invitation} + * + * @generated from field: string name = 1; + */ + name: string; +}; + +/** + * Describes the message memos.api.DeleteSpaceInvitationRequest. + * Use `create(DeleteSpaceInvitationRequestSchema)` to create a new message. + */ +export const DeleteSpaceInvitationRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_space_service, 20); + +/** + * Request message for SpaceService.AcceptSpaceInvitation. + * + * @generated from message memos.api.AcceptSpaceInvitationRequest + */ +export type AcceptSpaceInvitationRequest = Message<"memos.api.AcceptSpaceInvitationRequest"> & { + /** + * Required. The resource name of the invitation. + * Format: spaces/{space}/invitations/{invitation} + * + * @generated from field: string name = 1; + */ + name: string; +}; + +/** + * Describes the message memos.api.AcceptSpaceInvitationRequest. + * Use `create(AcceptSpaceInvitationRequestSchema)` to create a new message. + */ +export const AcceptSpaceInvitationRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_space_service, 21); + +/** + * Request message for SpaceService.DeclineSpaceInvitation. + * + * @generated from message memos.api.DeclineSpaceInvitationRequest + */ +export type DeclineSpaceInvitationRequest = Message<"memos.api.DeclineSpaceInvitationRequest"> & { + /** + * Required. The resource name of the invitation. + * Format: spaces/{space}/invitations/{invitation} + * + * @generated from field: string name = 1; + */ + name: string; +}; + +/** + * Describes the message memos.api.DeclineSpaceInvitationRequest. + * Use `create(DeclineSpaceInvitationRequestSchema)` to create a new message. + */ +export const DeclineSpaceInvitationRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_space_service, 22); + +/** + * SpaceService manages collaborative spaces, their members and their invitations. + * + * @generated from service memos.api.SpaceService + */ +export const SpaceService: GenService<{ + /** + * ListSpaces lists the spaces of which the authenticated caller is a member. + * + * @generated from rpc memos.api.SpaceService.ListSpaces + */ + listSpaces: { + methodKind: "unary"; + input: typeof ListSpacesRequestSchema; + output: typeof ListSpacesResponseSchema; + }, + /** + * GetSpace gets a space of which the authenticated caller is a member. + * Spaces the caller is not a member of are reported as not found. + * + * @generated from rpc memos.api.SpaceService.GetSpace + */ + getSpace: { + methodKind: "unary"; + input: typeof GetSpaceRequestSchema; + output: typeof SpaceSchema; + }, + /** + * CreateSpace creates a space and makes the authenticated caller its first + * administrator. + * + * @generated from rpc memos.api.SpaceService.CreateSpace + */ + createSpace: { + methodKind: "unary"; + input: typeof CreateSpaceRequestSchema; + output: typeof SpaceSchema; + }, + /** + * UpdateSpace updates space metadata. Only a space administrator can update + * a space. + * + * @generated from rpc memos.api.SpaceService.UpdateSpace + */ + updateSpace: { + methodKind: "unary"; + input: typeof UpdateSpaceRequestSchema; + output: typeof SpaceSchema; + }, + /** + * DeleteSpace permanently deletes a space and every memo currently placed + * in it. It never follows memo relations to other memos. Only a space + * administrator can delete a space. + * + * @generated from rpc memos.api.SpaceService.DeleteSpace + */ + deleteSpace: { + methodKind: "unary"; + input: typeof DeleteSpaceRequestSchema; + output: typeof EmptySchema; + }, + /** + * ListSpaceMembers lists the members of a space. The caller must be a member + * of the space. + * + * @generated from rpc memos.api.SpaceService.ListSpaceMembers + */ + listSpaceMembers: { + methodKind: "unary"; + input: typeof ListSpaceMembersRequestSchema; + output: typeof ListSpaceMembersResponseSchema; + }, + /** + * GetSpaceMember gets one membership in a space. The caller must be a member + * of the space. + * + * @generated from rpc memos.api.SpaceService.GetSpaceMember + */ + getSpaceMember: { + methodKind: "unary"; + input: typeof GetSpaceMemberRequestSchema; + output: typeof SpaceMemberSchema; + }, + /** + * UpdateSpaceMember changes a member's space role. Only a space administrator + * can change roles, and a space must keep at least one administrator. + * + * @generated from rpc memos.api.SpaceService.UpdateSpaceMember + */ + updateSpaceMember: { + methodKind: "unary"; + input: typeof UpdateSpaceMemberRequestSchema; + output: typeof SpaceMemberSchema; + }, + /** + * DeleteSpaceMember removes a member. A space administrator can remove any + * member, and a member may delete their own membership to leave the space. + * A space must keep at least one administrator. + * + * @generated from rpc memos.api.SpaceService.DeleteSpaceMember + */ + deleteSpaceMember: { + methodKind: "unary"; + input: typeof DeleteSpaceMemberRequestSchema; + output: typeof EmptySchema; + }, + /** + * ListSpaceInvitations lists the pending invitations for a space. Only a + * space administrator can list them. + * + * @generated from rpc memos.api.SpaceService.ListSpaceInvitations + */ + listSpaceInvitations: { + methodKind: "unary"; + input: typeof ListSpaceInvitationsRequestSchema; + output: typeof ListSpaceInvitationsResponseSchema; + }, + /** + * ListUserSpaceInvitations lists the authenticated user's pending space + * invitations. A user cannot list another user's invitations. + * + * @generated from rpc memos.api.SpaceService.ListUserSpaceInvitations + */ + listUserSpaceInvitations: { + methodKind: "unary"; + input: typeof ListUserSpaceInvitationsRequestSchema; + output: typeof ListUserSpaceInvitationsResponseSchema; + }, + /** + * GetSpaceInvitation gets one pending invitation. Only the invitee or a + * space administrator can get it. + * + * @generated from rpc memos.api.SpaceService.GetSpaceInvitation + */ + getSpaceInvitation: { + methodKind: "unary"; + input: typeof GetSpaceInvitationRequestSchema; + output: typeof SpaceInvitationSchema; + }, + /** + * CreateSpaceInvitation invites an existing active user to a space. Only a + * space administrator can invite. The invitee gets no space access until + * they accept. + * + * @generated from rpc memos.api.SpaceService.CreateSpaceInvitation + */ + createSpaceInvitation: { + methodKind: "unary"; + input: typeof CreateSpaceInvitationRequestSchema; + output: typeof SpaceInvitationSchema; + }, + /** + * DeleteSpaceInvitation revokes a pending invitation. Only a space + * administrator can revoke it. + * + * @generated from rpc memos.api.SpaceService.DeleteSpaceInvitation + */ + deleteSpaceInvitation: { + methodKind: "unary"; + input: typeof DeleteSpaceInvitationRequestSchema; + output: typeof EmptySchema; + }, + /** + * AcceptSpaceInvitation accepts a pending invitation and creates a + * membership with the invited role. Only the invitee can accept it. + * + * @generated from rpc memos.api.SpaceService.AcceptSpaceInvitation + */ + acceptSpaceInvitation: { + methodKind: "unary"; + input: typeof AcceptSpaceInvitationRequestSchema; + output: typeof SpaceMemberSchema; + }, + /** + * DeclineSpaceInvitation declines a pending invitation without creating a + * membership. Only the invitee can decline it. + * + * @generated from rpc memos.api.SpaceService.DeclineSpaceInvitation + */ + declineSpaceInvitation: { + methodKind: "unary"; + input: typeof DeclineSpaceInvitationRequestSchema; + output: typeof EmptySchema; + }, +}> = /*@__PURE__*/ + serviceDesc(file_api_space_service, 0); + diff --git a/web/src/types/proto/api/user_service_pb.ts b/web/src/types/proto/api/user_service_pb.ts new file mode 100644 index 000000000..702e2fb33 --- /dev/null +++ b/web/src/types/proto/api/user_service_pb.ts @@ -0,0 +1,3022 @@ +// @generated by protoc-gen-es v2.12.1 with parameter "target=ts" +// @generated from file api/user_service.proto (package memos.api, syntax proto3) +/* eslint-disable */ + +import type { GenEnum, GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv2"; +import { enumDesc, fileDesc, messageDesc, serviceDesc } from "@bufbuild/protobuf/codegenv2"; +import type { State } from "./common_pb"; +import { file_api_common } from "./common_pb"; +import type { Space, SpaceMember_Role } from "./space_service_pb"; +import { file_api_space_service } from "./space_service_pb"; +import { file_google_api_annotations } from "../google/api/annotations_pb"; +import { file_google_api_client } from "../google/api/client_pb"; +import { file_google_api_field_behavior } from "../google/api/field_behavior_pb"; +import type { HttpBodySchema } from "../google/api/httpbody_pb"; +import { file_google_api_httpbody } from "../google/api/httpbody_pb"; +import { file_google_api_resource } from "../google/api/resource_pb"; +import type { EmptySchema, FieldMask, Timestamp } from "@bufbuild/protobuf/wkt"; +import { file_google_protobuf_empty, file_google_protobuf_field_mask, file_google_protobuf_timestamp } from "@bufbuild/protobuf/wkt"; +import type { Color } from "../google/type/color_pb"; +import { file_google_type_color } from "../google/type/color_pb"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file api/user_service.proto. + */ +export const file_api_user_service: GenFile = /*@__PURE__*/ + fileDesc("ChZhcGkvdXNlcl9zZXJ2aWNlLnByb3RvEgltZW1vcy5hcGkixwMKBFVzZXISEQoEbmFtZRgBIAEoCUID4EEIEhUKCHVzZXJuYW1lGAIgASgJQgPgQQISGQoMZGlzcGxheV9uYW1lGAMgASgJQgPgQQESEgoFZW1haWwYBCABKAlCA+BBARIXCgphdmF0YXJfdXJsGAUgASgJQgPgQQESGAoLZGVzY3JpcHRpb24YBiABKAlCA+BBARIVCghwYXNzd29yZBgHIAEoCUID4EEEEicKBHJvbGUYCCABKA4yFC5tZW1vcy5hcGkuVXNlci5Sb2xlQgPgQQISJAoFc3RhdGUYCSABKA4yEC5tZW1vcy5hcGkuU3RhdGVCA+BBAhI0CgtjcmVhdGVfdGltZRgKIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXBCA+BBAxI0Cgt1cGRhdGVfdGltZRgLIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXBCA+BBAyIxCgRSb2xlEhQKEFJPTEVfVU5TUEVDSUZJRUQQABIJCgVBRE1JThACEggKBFVTRVIQAzou6kErCg5tZW1vcy5hcGkvVXNlchIMdXNlcnMve3VzZXJ9KgV1c2VyczIEdXNlciJzChBMaXN0VXNlcnNSZXF1ZXN0EhYKCXBhZ2Vfc2l6ZRgBIAEoBUID4EEBEhcKCnBhZ2VfdG9rZW4YAiABKAlCA+BBARITCgZmaWx0ZXIYAyABKAlCA+BBARIZCgxzaG93X2RlbGV0ZWQYBCABKAhCA+BBASJMChFMaXN0VXNlcnNSZXNwb25zZRIeCgV1c2VycxgBIAMoCzIPLm1lbW9zLmFwaS5Vc2VyEhcKD25leHRfcGFnZV90b2tlbhgCIAEoCSJqCg5HZXRVc2VyUmVxdWVzdBIkCgRuYW1lGAEgASgJQhbgQQL6QRAKDm1lbW9zLmFwaS9Vc2VyEjIKCXJlYWRfbWFzaxgCIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5GaWVsZE1hc2tCA+BBASI9ChRCYXRjaEdldFVzZXJzUmVxdWVzdBIlCgVuYW1lcxgBIAMoCUIW4EEC+kEQCg5tZW1vcy5hcGkvVXNlciI3ChVCYXRjaEdldFVzZXJzUmVzcG9uc2USHgoFdXNlcnMYASADKAsyDy5tZW1vcy5hcGkuVXNlciKFAQoRQ3JlYXRlVXNlclJlcXVlc3QSJQoEdXNlchgBIAEoCzIPLm1lbW9zLmFwaS5Vc2VyQgbgQQLgQQQSFAoHdXNlcl9pZBgCIAEoCUID4EEBEhoKDXZhbGlkYXRlX29ubHkYAyABKAhCA+BBARIXCgpyZXF1ZXN0X2lkGAQgASgJQgPgQQEiiQEKEVVwZGF0ZVVzZXJSZXF1ZXN0EiIKBHVzZXIYASABKAsyDy5tZW1vcy5hcGkuVXNlckID4EECEjQKC3VwZGF0ZV9tYXNrGAIgASgLMhouZ29vZ2xlLnByb3RvYnVmLkZpZWxkTWFza0ID4EECEhoKDWFsbG93X21pc3NpbmcYAyABKAhCA+BBASJNChFEZWxldGVVc2VyUmVxdWVzdBIkCgRuYW1lGAEgASgJQhbgQQL6QRAKDm1lbW9zLmFwaS9Vc2VyEhIKBWZvcmNlGAIgASgIQgPgQQEiuwYKC1VzZXJTZXR0aW5nEhEKBG5hbWUYASABKAlCA+BBCBJACg9nZW5lcmFsX3NldHRpbmcYAiABKAsyJS5tZW1vcy5hcGkuVXNlclNldHRpbmcuR2VuZXJhbFNldHRpbmdIABJCChB3ZWJob29rc19zZXR0aW5nGAMgASgLMiYubWVtb3MuYXBpLlVzZXJTZXR0aW5nLldlYmhvb2tzU2V0dGluZ0gAEjoKDHRhZ3Nfc2V0dGluZxgEIAEoCzIiLm1lbW9zLmFwaS5Vc2VyU2V0dGluZy5UYWdzU2V0dGluZ0gAGnkKDkdlbmVyYWxTZXR0aW5nEhMKBmxvY2FsZRgBIAEoCUID4EEBEhwKD21lbW9fdmlzaWJpbGl0eRgCIAEoCUID4EEBEhIKBXRoZW1lGAMgASgJQgPgQQESIAoTc2F2ZV9tZWRpYV9tZXRhZGF0YRgEIAEoCEID4EEBGjsKD1dlYmhvb2tzU2V0dGluZxIoCgh3ZWJob29rcxgBIAMoCzIWLm1lbW9zLmFwaS5Vc2VyV2ViaG9vaxqfAQoLVGFnc1NldHRpbmcSPwoEdGFncxgBIAMoCzIsLm1lbW9zLmFwaS5Vc2VyU2V0dGluZy5UYWdzU2V0dGluZy5UYWdzRW50cnlCA+BBARpPCglUYWdzRW50cnkSCwoDa2V5GAEgASgJEjEKBXZhbHVlGAIgASgLMiIubWVtb3MuYXBpLlVzZXJTZXR0aW5nLlRhZ01ldGFkYXRhOgI4ARpbCgtUYWdNZXRhZGF0YRIxChBiYWNrZ3JvdW5kX2NvbG9yGAEgASgLMhIuZ29vZ2xlLnR5cGUuQ29sb3JCA+BBARIZCgxibHVyX2NvbnRlbnQYAiABKAhCA+BBASI/CgNLZXkSEwoPS0VZX1VOU1BFQ0lGSUVEEAASCwoHR0VORVJBTBABEgwKCFdFQkhPT0tTEAQSCAoEVEFHUxAFOlbqQVMKFW1lbW9zLmFwaS9Vc2VyU2V0dGluZxIfdXNlcnMve3VzZXJ9L3NldHRpbmdzL3tzZXR0aW5nfSoMdXNlclNldHRpbmdzMgt1c2VyU2V0dGluZ0IHCgV2YWx1ZSJyChdMaXN0VXNlclNldHRpbmdzUmVxdWVzdBImCgZwYXJlbnQYASABKAlCFuBBAvpBEAoObWVtb3MuYXBpL1VzZXISFgoJcGFnZV9zaXplGAIgASgFQgPgQQESFwoKcGFnZV90b2tlbhgDIAEoCUID4EEBImIKGExpc3RVc2VyU2V0dGluZ3NSZXNwb25zZRItCg11c2VyX3NldHRpbmdzGAEgAygLMhYubWVtb3MuYXBpLlVzZXJTZXR0aW5nEhcKD25leHRfcGFnZV90b2tlbhgCIAEoCSJEChVHZXRVc2VyU2V0dGluZ1JlcXVlc3QSKwoEbmFtZRgBIAEoCUId4EEC+kEXChVtZW1vcy5hcGkvVXNlclNldHRpbmcigwEKGFVwZGF0ZVVzZXJTZXR0aW5nUmVxdWVzdBIxCgx1c2VyX3NldHRpbmcYASABKAsyFi5tZW1vcy5hcGkuVXNlclNldHRpbmdCA+BBAhI0Cgt1cGRhdGVfbWFzaxgCIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5GaWVsZE1hc2tCA+BBAiLzBAoJVXNlclN0YXRzEhEKBG5hbWUYASABKAlCA+BBCBIYChB0b3RhbF9tZW1vX2NvdW50GAIgASgFEjsKD21lbW9fdHlwZV9zdGF0cxgDIAEoCzIiLm1lbW9zLmFwaS5Vc2VyU3RhdHMuTWVtb1R5cGVTdGF0cxI3Cgp0YWdfY291bnRzGAQgAygLMiMubWVtb3MuYXBpLlVzZXJTdGF0cy5UYWdDb3VudHNFbnRyeRIpCgxwaW5uZWRfbWVtb3MYBSADKAlCE/pBEAoObWVtb3MuYXBpL01lbW8SOwoXbWVtb19jcmVhdGVkX3RpbWVzdGFtcHMYBiADKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wEjsKF21lbW9fdXBkYXRlZF90aW1lc3RhbXBzGAcgAygLMhouZ29vZ2xlLnByb3RvYnVmLlRpbWVzdGFtcBIqChhhdHRhY2htZW50X3N0b3JhZ2VfYnl0ZXMYCCABKANCA+BBA0gAiAEBGjAKDlRhZ0NvdW50c0VudHJ5EgsKA2tleRgBIAEoCRINCgV2YWx1ZRgCIAEoBToCOAEaXwoNTWVtb1R5cGVTdGF0cxISCgpsaW5rX2NvdW50GAEgASgFEhIKCmNvZGVfY291bnQYAiABKAUSEgoKdG9kb19jb3VudBgDIAEoBRISCgp1bmRvX2NvdW50GAQgASgFOkLqQT8KE21lbW9zLmFwaS9Vc2VyU3RhdHMSEnVzZXJzL3t1c2VyfS9zdGF0cyoJdXNlclN0YXRzMgl1c2VyU3RhdHNCGwoZX2F0dGFjaG1lbnRfc3RvcmFnZV9ieXRlcyJ+ChRMaXN0VXNlclN0YXRzUmVxdWVzdBIrCgZwYXJlbnQYASABKAlCG+BBAvpBFRITbWVtb3MuYXBpL1VzZXJTdGF0cxITCgZmaWx0ZXIYAiABKAlCA+BBARIkCgVzdGF0ZRgDIAEoDjIQLm1lbW9zLmFwaS5TdGF0ZUID4EEBIkEKFUxpc3RVc2VyU3RhdHNSZXNwb25zZRIoCgp1c2VyX3N0YXRzGAEgAygLMhQubWVtb3MuYXBpLlVzZXJTdGF0cyJQChNHZXRVc2VyU3RhdHNSZXF1ZXN0EiQKBG5hbWUYASABKAlCFuBBAvpBEAoObWVtb3MuYXBpL1VzZXISEwoGZmlsdGVyGAIgASgJQgPgQQEi8AEKCE1lbW9WaWV3EhEKBG5hbWUYASABKAlCA+BBCBISCgV0aXRsZRgCIAEoCUID4EECEhMKBmZpbHRlchgDIAEoCUID4EECEisKBGljb24YBCABKAsyGC5tZW1vcy5hcGkuTWVtb1ZpZXcuSWNvbkID4EEBGjIKBEljb24SDwoFZW1vamkYASABKAlIABIQCgZsdWNpZGUYAiABKAlIAEIHCgV2YWx1ZTpH6kFEChJtZW1vcy5hcGkvTWVtb1ZpZXcSGXVzZXJzL3t1c2VyfS92aWV3cy97dmlld30qCW1lbW9WaWV3czIIbWVtb1ZpZXciQgoUTGlzdE1lbW9WaWV3c1JlcXVlc3QSKgoGcGFyZW50GAEgASgJQhrgQQL6QRQSEm1lbW9zLmFwaS9NZW1vVmlldyJAChVMaXN0TWVtb1ZpZXdzUmVzcG9uc2USJwoKbWVtb192aWV3cxgBIAMoCzITLm1lbW9zLmFwaS5NZW1vVmlldyI+ChJHZXRNZW1vVmlld1JlcXVlc3QSKAoEbmFtZRgBIAEoCUIa4EEC+kEUChJtZW1vcy5hcGkvTWVtb1ZpZXcijAEKFUNyZWF0ZU1lbW9WaWV3UmVxdWVzdBIqCgZwYXJlbnQYASABKAlCGuBBAvpBFBISbWVtb3MuYXBpL01lbW9WaWV3EisKCW1lbW9fdmlldxgCIAEoCzITLm1lbW9zLmFwaS5NZW1vVmlld0ID4EECEhoKDXZhbGlkYXRlX29ubHkYAyABKAhCA+BBASJ6ChVVcGRhdGVNZW1vVmlld1JlcXVlc3QSKwoJbWVtb192aWV3GAEgASgLMhMubWVtb3MuYXBpLk1lbW9WaWV3QgPgQQISNAoLdXBkYXRlX21hc2sYAiABKAsyGi5nb29nbGUucHJvdG9idWYuRmllbGRNYXNrQgPgQQEiQQoVRGVsZXRlTWVtb1ZpZXdSZXF1ZXN0EigKBG5hbWUYASABKAlCGuBBAvpBFAoSbWVtb3MuYXBpL01lbW9WaWV3IrMKChBVc2VyTm90aWZpY2F0aW9uEhQKBG5hbWUYASABKAlCBuBBA+BBCBImCgZzZW5kZXIYAiABKAlCFuBBA/pBEAoObWVtb3MuYXBpL1VzZXISKQoLc2VuZGVyX3VzZXIYAyABKAsyDy5tZW1vcy5hcGkuVXNlckID4EEDEjMKBHR5cGUYBCABKA4yIC5tZW1vcy5hcGkuVXNlck5vdGlmaWNhdGlvbi5UeXBlQgPgQQMSSwoMbWVtb19jb21tZW50GAUgASgLMi4ubWVtb3MuYXBpLlVzZXJOb3RpZmljYXRpb24uTWVtb0NvbW1lbnRQYXlsb2FkQgPgQQNIABJLCgxtZW1vX21lbnRpb24YBiABKAsyLi5tZW1vcy5hcGkuVXNlck5vdGlmaWNhdGlvbi5NZW1vTWVudGlvblBheWxvYWRCA+BBA0gAElMKEHNwYWNlX2ludml0YXRpb24YByABKAsyMi5tZW1vcy5hcGkuVXNlck5vdGlmaWNhdGlvbi5TcGFjZUludml0YXRpb25QYXlsb2FkQgPgQQNIABI3CgZzdGF0dXMYCCABKA4yIi5tZW1vcy5hcGkuVXNlck5vdGlmaWNhdGlvbi5TdGF0dXNCA+BBARI0CgtjcmVhdGVfdGltZRgJIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXBCA+BBAxpsChJNZW1vQ29tbWVudFBheWxvYWQSDAoEbWVtbxgBIAEoCRIUCgxyZWxhdGVkX21lbW8YAiABKAkSFAoMbWVtb19zbmlwcGV0GAMgASgJEhwKFHJlbGF0ZWRfbWVtb19zbmlwcGV0GAQgASgJGmwKEk1lbW9NZW50aW9uUGF5bG9hZBIMCgRtZW1vGAEgASgJEhQKDHJlbGF0ZWRfbWVtbxgCIAEoCRIUCgxtZW1vX3NuaXBwZXQYAyABKAkSHAoUcmVsYXRlZF9tZW1vX3NuaXBwZXQYBCABKAkatgIKFlNwYWNlSW52aXRhdGlvblBheWxvYWQSOAoQc3BhY2VfaW52aXRhdGlvbhgBIAEoCUIe+kEbChltZW1vcy5hcGkvU3BhY2VJbnZpdGF0aW9uEh8KBXNwYWNlGAIgASgLMhAubWVtb3MuYXBpLlNwYWNlEikKBHJvbGUYAyABKA4yGy5tZW1vcy5hcGkuU3BhY2VNZW1iZXIuUm9sZRJRCgVzdGF0ZRgEIAEoDjJCLm1lbW9zLmFwaS5Vc2VyTm90aWZpY2F0aW9uLlNwYWNlSW52aXRhdGlvblBheWxvYWQuSW52aXRhdGlvblN0YXRlIkMKD0ludml0YXRpb25TdGF0ZRIVChFTVEFURV9VTlNQRUNJRklFRBAAEgsKB1BFTkRJTkcQARIMCghBQ0NFUFRFRBACIjoKBlN0YXR1cxIWChJTVEFUVVNfVU5TUEVDSUZJRUQQABIKCgZVTlJFQUQQARIMCghBUkNISVZFRBACIlYKBFR5cGUSFAoQVFlQRV9VTlNQRUNJRklFRBAAEhAKDE1FTU9fQ09NTUVOVBABEhAKDE1FTU9fTUVOVElPThACEhQKEFNQQUNFX0lOVklUQVRJT04QAzpv6kFsChptZW1vcy5hcGkvVXNlck5vdGlmaWNhdGlvbhIpdXNlcnMve3VzZXJ9L25vdGlmaWNhdGlvbnMve25vdGlmaWNhdGlvbn0qEXVzZXJOb3RpZmljYXRpb25zMhB1c2VyTm90aWZpY2F0aW9uQgkKB3BheWxvYWQijAEKHExpc3RVc2VyTm90aWZpY2F0aW9uc1JlcXVlc3QSJgoGcGFyZW50GAEgASgJQhbgQQL6QRAKDm1lbW9zLmFwaS9Vc2VyEhYKCXBhZ2Vfc2l6ZRgCIAEoBUID4EEBEhcKCnBhZ2VfdG9rZW4YAyABKAlCA+BBARITCgZmaWx0ZXIYBCABKAlCA+BBASJsCh1MaXN0VXNlck5vdGlmaWNhdGlvbnNSZXNwb25zZRIyCg1ub3RpZmljYXRpb25zGAEgAygLMhsubWVtb3MuYXBpLlVzZXJOb3RpZmljYXRpb24SFwoPbmV4dF9wYWdlX3Rva2VuGAIgASgJIo0BCh1VcGRhdGVVc2VyTm90aWZpY2F0aW9uUmVxdWVzdBI2Cgxub3RpZmljYXRpb24YASABKAsyGy5tZW1vcy5hcGkuVXNlck5vdGlmaWNhdGlvbkID4EECEjQKC3VwZGF0ZV9tYXNrGAIgASgLMhouZ29vZ2xlLnByb3RvYnVmLkZpZWxkTWFza0ID4EECIlEKHURlbGV0ZVVzZXJOb3RpZmljYXRpb25SZXF1ZXN0EjAKBG5hbWUYASABKAlCIuBBAvpBHAoabWVtb3MuYXBpL1VzZXJOb3RpZmljYXRpb24ixQIKC1VzZXJXZWJob29rEhEKBG5hbWUYASABKAlCA+BBCBIUCgxkaXNwbGF5X25hbWUYAiABKAkSCwoDdXJsGAMgASgJEhsKDnNpZ25pbmdfc2VjcmV0GAQgASgJQgPgQQQSHwoSc2lnbmluZ19zZWNyZXRfc2V0GAUgASgIQgPgQQMSNAoLY3JlYXRlX3RpbWUYBiABKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wQgPgQQMSNAoLdXBkYXRlX3RpbWUYByABKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wQgPgQQM6VupBUwoVbWVtb3MuYXBpL1VzZXJXZWJob29rEh91c2Vycy97dXNlcn0vd2ViaG9va3Mve3dlYmhvb2t9Kgx1c2VyV2ViaG9va3MyC3VzZXJXZWJob29rIkgKF0xpc3RVc2VyV2ViaG9va3NSZXF1ZXN0Ei0KBnBhcmVudBgBIAEoCUId4EEC+kEXEhVtZW1vcy5hcGkvVXNlcldlYmhvb2siRAoYTGlzdFVzZXJXZWJob29rc1Jlc3BvbnNlEigKCHdlYmhvb2tzGAEgAygLMhYubWVtb3MuYXBpLlVzZXJXZWJob29rIncKGENyZWF0ZVVzZXJXZWJob29rUmVxdWVzdBItCgZwYXJlbnQYASABKAlCHeBBAvpBFxIVbWVtb3MuYXBpL1VzZXJXZWJob29rEiwKB3dlYmhvb2sYAiABKAsyFi5tZW1vcy5hcGkuVXNlcldlYmhvb2tCA+BBAiJ5ChhVcGRhdGVVc2VyV2ViaG9va1JlcXVlc3QSLAoHd2ViaG9vaxgBIAEoCzIWLm1lbW9zLmFwaS5Vc2VyV2ViaG9va0ID4EECEi8KC3VwZGF0ZV9tYXNrGAIgASgLMhouZ29vZ2xlLnByb3RvYnVmLkZpZWxkTWFzayJHChhEZWxldGVVc2VyV2ViaG9va1JlcXVlc3QSKwoEbmFtZRgBIAEoCUId4EEC+kEXChVtZW1vcy5hcGkvVXNlcldlYmhvb2siUQoiR2V0VXNlcldlYmhvb2tTaWduaW5nU2VjcmV0UmVxdWVzdBIrCgRuYW1lGAEgASgJQh3gQQL6QRcKFW1lbW9zLmFwaS9Vc2VyV2ViaG9vayI9CiNHZXRVc2VyV2ViaG9va1NpZ25pbmdTZWNyZXRSZXNwb25zZRIWCg5zaWduaW5nX3NlY3JldBgBIAEoCSLvAQoOTGlua2VkSWRlbnRpdHkSEQoEbmFtZRgBIAEoCUID4EEIEj0KEWlkZW50aXR5X3Byb3ZpZGVyGAIgASgJQiLgQQP6QRwKGm1lbW9zLmFwaS9JZGVudGl0eVByb3ZpZGVyEhkKDGV4dGVybmFsX3VpZBgDIAEoCUID4EEDOnDqQW0KGG1lbW9zLmFwaS9MaW5rZWRJZGVudGl0eRIvdXNlcnMve3VzZXJ9L2xpbmtlZElkZW50aXRpZXMve2xpbmtlZF9pZGVudGl0eX0qEGxpbmtlZElkZW50aXRpZXMyDmxpbmtlZElkZW50aXR5IkUKG0xpc3RMaW5rZWRJZGVudGl0aWVzUmVxdWVzdBImCgZwYXJlbnQYASABKAlCFuBBAvpBEAoObWVtb3MuYXBpL1VzZXIiVAocTGlzdExpbmtlZElkZW50aXRpZXNSZXNwb25zZRI0ChFsaW5rZWRfaWRlbnRpdGllcxgBIAMoCzIZLm1lbW9zLmFwaS5MaW5rZWRJZGVudGl0eSJKChhHZXRMaW5rZWRJZGVudGl0eVJlcXVlc3QSLgoEbmFtZRgBIAEoCUIg4EEC+kEaChhtZW1vcy5hcGkvTGlua2VkSWRlbnRpdHkizgEKG0NyZWF0ZUxpbmtlZElkZW50aXR5UmVxdWVzdBImCgZwYXJlbnQYASABKAlCFuBBAvpBEAoObWVtb3MuYXBpL1VzZXISPQoRaWRlbnRpdHlfcHJvdmlkZXIYAiABKAlCIuBBAvpBHAoabWVtb3MuYXBpL0lkZW50aXR5UHJvdmlkZXISEQoEY29kZRgDIAEoCUID4EECEhkKDHJlZGlyZWN0X3VyaRgEIAEoCUID4EECEhoKDWNvZGVfdmVyaWZpZXIYBSABKAlCA+BBASJNChtEZWxldGVMaW5rZWRJZGVudGl0eVJlcXVlc3QSLgoEbmFtZRgBIAEoCUIg4EEC+kEaChhtZW1vcy5hcGkvTGlua2VkSWRlbnRpdHki8gIKE1BlcnNvbmFsQWNjZXNzVG9rZW4SEQoEbmFtZRgBIAEoCUID4EEIEhgKC2Rlc2NyaXB0aW9uGAIgASgJQgPgQQESNAoLY3JlYXRlX3RpbWUYAyABKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wQgPgQQMSNAoLZXhwaXJlX3RpbWUYBCABKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wQgPgQQESNgoNbGFzdF91c2VfdGltZRgFIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXBCA+BBAzqJAepBhQEKHW1lbW9zLmFwaS9QZXJzb25hbEFjY2Vzc1Rva2VuEjl1c2Vycy97dXNlcn0vcGVyc29uYWxBY2Nlc3NUb2tlbnMve3BlcnNvbmFsX2FjY2Vzc190b2tlbn0qFHBlcnNvbmFsQWNjZXNzVG9rZW5zMhNwZXJzb25hbEFjY2Vzc1Rva2VuInoKH0xpc3RQZXJzb25hbEFjY2Vzc1Rva2Vuc1JlcXVlc3QSJgoGcGFyZW50GAEgASgJQhbgQQL6QRAKDm1lbW9zLmFwaS9Vc2VyEhYKCXBhZ2Vfc2l6ZRgCIAEoBUID4EEBEhcKCnBhZ2VfdG9rZW4YAyABKAlCA+BBASJ7CiBMaXN0UGVyc29uYWxBY2Nlc3NUb2tlbnNSZXNwb25zZRI+ChZwZXJzb25hbF9hY2Nlc3NfdG9rZW5zGAEgAygLMh4ubWVtb3MuYXBpLlBlcnNvbmFsQWNjZXNzVG9rZW4SFwoPbmV4dF9wYWdlX3Rva2VuGAIgASgJIoIBCiBDcmVhdGVQZXJzb25hbEFjY2Vzc1Rva2VuUmVxdWVzdBImCgZwYXJlbnQYASABKAlCFuBBAvpBEAoObWVtb3MuYXBpL1VzZXISGAoLZGVzY3JpcHRpb24YAiABKAlCA+BBARIcCg9leHBpcmVzX2luX2RheXMYAyABKAVCA+BBASJxCiFDcmVhdGVQZXJzb25hbEFjY2Vzc1Rva2VuUmVzcG9uc2USPQoVcGVyc29uYWxfYWNjZXNzX3Rva2VuGAEgASgLMh4ubWVtb3MuYXBpLlBlcnNvbmFsQWNjZXNzVG9rZW4SDQoFdG9rZW4YAiABKAkiVwogRGVsZXRlUGVyc29uYWxBY2Nlc3NUb2tlblJlcXVlc3QSMwoEbmFtZRgBIAEoCUIl4EEC+kEfCh1tZW1vcy5hcGkvUGVyc29uYWxBY2Nlc3NUb2tlbiI6ChJFeHBvcnRNZW1vc1JlcXVlc3QSJAoEbmFtZRgBIAEoCUIW4EEC+kEQCg5tZW1vcy5hcGkvVXNlciKPAwoSSW1wb3J0TWVtb3NSZXF1ZXN0EiQKBG5hbWUYASABKAlCFuBBAvpBEAoObWVtb3MuYXBpL1VzZXISKgoEc3BlYxgCIAEoCzIaLm1lbW9zLmFwaS5JbXBvcnRNZW1vc1NwZWNIABITCgl1cGxvYWRfaWQYAyABKAlIABIZCgx3cml0ZV9vZmZzZXQYBCABKANCA+BBAhIRCgRkYXRhGAUgASgMQgPgQQESGQoMZmluaXNoX3dyaXRlGAYgASgIQgPgQQESSgoPY29uZmxpY3RfcG9saWN5GAcgASgOMiwubWVtb3MuYXBpLkltcG9ydE1lbW9zUmVxdWVzdC5Db25mbGljdFBvbGljeUID4EEBEhoKDXZhbGlkYXRlX29ubHkYCCABKAhCA+BBASJXCg5Db25mbGljdFBvbGljeRIfChtDT05GTElDVF9QT0xJQ1lfVU5TUEVDSUZJRUQQABIICgRTS0lQEAESCwoHUkVQTEFDRRACEg0KCURVUExJQ0FURRADQggKBnVwbG9hZCK+AQoTSW1wb3J0TWVtb3NSZXNwb25zZRIRCgl1cGxvYWRfaWQYASABKAkSFgoOY29tbWl0dGVkX3NpemUYAiABKAMSFgoObWF4X2NodW5rX3NpemUYAyABKAUSKgoEcGxhbhgEIAEoCzIaLm1lbW9zLmFwaS5JbXBvcnRNZW1vc1BsYW5IABIuCgZyZXBvcnQYBSABKAsyHC5tZW1vcy5hcGkuSW1wb3J0TWVtb3NSZXBvcnRIAEIICgZyZXN1bHQiKgoPSW1wb3J0TWVtb3NTcGVjEhcKCnRvdGFsX3NpemUYASABKANCA+BBASL0AQoPSW1wb3J0TWVtb3NQbGFuEi8KC2V4cG9ydF90aW1lGAEgASgLMhouZ29vZ2xlLnByb3RvYnVmLlRpbWVzdGFtcBIQCghleHBvcnRlchgCIAEoCRIRCglnZW5lcmF0b3IYAyABKAkSEgoKbWVtb19jb3VudBgEIAEoBRIYChBhdHRhY2htZW50X2NvdW50GAUgASgFEgsKA25ldxgGIAEoBRIQCghleGlzdGluZxgHIAEoBRIPCgdyZW5hbWVkGAggASgFEi0KCHdhcm5pbmdzGAkgAygLMhsubWVtb3MuYXBpLkltcG9ydE1lbW9zSXNzdWUitAEKEUltcG9ydE1lbW9zUmVwb3J0Eg8KB2NyZWF0ZWQYASABKAUSDwoHdXBkYXRlZBgCIAEoBRIPCgdza2lwcGVkGAMgASgFEg4KBmZhaWxlZBgEIAEoBRItCgh3YXJuaW5ncxgFIAMoCzIbLm1lbW9zLmFwaS5JbXBvcnRNZW1vc0lzc3VlEi0KCGZhaWx1cmVzGAYgAygLMhsubWVtb3MuYXBpLkltcG9ydE1lbW9zSXNzdWUiNQoQSW1wb3J0TWVtb3NJc3N1ZRIQCghtZW1vX3VpZBgBIAEoCRIPCgdtZXNzYWdlGAIgASgJMpokCgtVc2VyU2VydmljZRJaCglMaXN0VXNlcnMSGy5tZW1vcy5hcGkuTGlzdFVzZXJzUmVxdWVzdBocLm1lbW9zLmFwaS5MaXN0VXNlcnNSZXNwb25zZSISgtPkkwIMEgovYXBpL3VzZXJzElkKB0dldFVzZXISGS5tZW1vcy5hcGkuR2V0VXNlclJlcXVlc3QaDy5tZW1vcy5hcGkuVXNlciIi2kEEbmFtZYLT5JMCFRITL2FwaS97bmFtZT11c2Vycy8qfRJyCg1CYXRjaEdldFVzZXJzEh8ubWVtb3MuYXBpLkJhdGNoR2V0VXNlcnNSZXF1ZXN0GiAubWVtb3MuYXBpLkJhdGNoR2V0VXNlcnNSZXNwb25zZSIegtPkkwIYOgEqIhMvYXBpL3VzZXJzOmJhdGNoR2V0EmQKCkNyZWF0ZVVzZXISHC5tZW1vcy5hcGkuQ3JlYXRlVXNlclJlcXVlc3QaDy5tZW1vcy5hcGkuVXNlciIn2kEMdXNlcix1c2VyX2lkgtPkkwISOgR1c2VyIgovYXBpL3VzZXJzEnYKClVwZGF0ZVVzZXISHC5tZW1vcy5hcGkuVXBkYXRlVXNlclJlcXVlc3QaDy5tZW1vcy5hcGkuVXNlciI52kEQdXNlcix1cGRhdGVfbWFza4LT5JMCIDoEdXNlcjIYL2FwaS97dXNlci5uYW1lPXVzZXJzLyp9EmYKCkRlbGV0ZVVzZXISHC5tZW1vcy5hcGkuRGVsZXRlVXNlclJlcXVlc3QaFi5nb29nbGUucHJvdG9idWYuRW1wdHkiItpBBG5hbWWC0+STAhUqEy9hcGkve25hbWU9dXNlcnMvKn0SjAEKEExpc3RVc2VyU2V0dGluZ3MSIi5tZW1vcy5hcGkuTGlzdFVzZXJTZXR0aW5nc1JlcXVlc3QaIy5tZW1vcy5hcGkuTGlzdFVzZXJTZXR0aW5nc1Jlc3BvbnNlIi/aQQZwYXJlbnSC0+STAiASHi9hcGkve3BhcmVudD11c2Vycy8qfS9zZXR0aW5ncxJ5Cg5HZXRVc2VyU2V0dGluZxIgLm1lbW9zLmFwaS5HZXRVc2VyU2V0dGluZ1JlcXVlc3QaFi5tZW1vcy5hcGkuVXNlclNldHRpbmciLdpBBG5hbWWC0+STAiASHi9hcGkve25hbWU9dXNlcnMvKi9zZXR0aW5ncy8qfRKuAQoRVXBkYXRlVXNlclNldHRpbmcSIy5tZW1vcy5hcGkuVXBkYXRlVXNlclNldHRpbmdSZXF1ZXN0GhYubWVtb3MuYXBpLlVzZXJTZXR0aW5nIlzaQRh1c2VyX3NldHRpbmcsdXBkYXRlX21hc2uC0+STAjs6DHVzZXJfc2V0dGluZzIrL2FwaS97dXNlcl9zZXR0aW5nLm5hbWU9dXNlcnMvKi9zZXR0aW5ncy8qfRKAAQoNTGlzdFVzZXJTdGF0cxIfLm1lbW9zLmFwaS5MaXN0VXNlclN0YXRzUmVxdWVzdBogLm1lbW9zLmFwaS5MaXN0VXNlclN0YXRzUmVzcG9uc2UiLNpBBnBhcmVudILT5JMCHRIbL2FwaS97cGFyZW50PXVzZXJzLyp9L3N0YXRzEnEKDEdldFVzZXJTdGF0cxIeLm1lbW9zLmFwaS5HZXRVc2VyU3RhdHNSZXF1ZXN0GhQubWVtb3MuYXBpLlVzZXJTdGF0cyIr2kEEbmFtZYLT5JMCHhIcL2FwaS97bmFtZT11c2Vycy8qfTpnZXRTdGF0cxKAAQoNTGlzdE1lbW9WaWV3cxIfLm1lbW9zLmFwaS5MaXN0TWVtb1ZpZXdzUmVxdWVzdBogLm1lbW9zLmFwaS5MaXN0TWVtb1ZpZXdzUmVzcG9uc2UiLNpBBnBhcmVudILT5JMCHRIbL2FwaS97cGFyZW50PXVzZXJzLyp9L3ZpZXdzEm0KC0dldE1lbW9WaWV3Eh0ubWVtb3MuYXBpLkdldE1lbW9WaWV3UmVxdWVzdBoTLm1lbW9zLmFwaS5NZW1vVmlldyIq2kEEbmFtZYLT5JMCHRIbL2FwaS97bmFtZT11c2Vycy8qL3ZpZXdzLyp9EooBCg5DcmVhdGVNZW1vVmlldxIgLm1lbW9zLmFwaS5DcmVhdGVNZW1vVmlld1JlcXVlc3QaEy5tZW1vcy5hcGkuTWVtb1ZpZXciQdpBEHBhcmVudCxtZW1vX3ZpZXeC0+STAig6CW1lbW9fdmlldyIbL2FwaS97cGFyZW50PXVzZXJzLyp9L3ZpZXdzEpkBCg5VcGRhdGVNZW1vVmlldxIgLm1lbW9zLmFwaS5VcGRhdGVNZW1vVmlld1JlcXVlc3QaEy5tZW1vcy5hcGkuTWVtb1ZpZXciUNpBFW1lbW9fdmlldyx1cGRhdGVfbWFza4LT5JMCMjoJbWVtb192aWV3MiUvYXBpL3ttZW1vX3ZpZXcubmFtZT11c2Vycy8qL3ZpZXdzLyp9EnYKDkRlbGV0ZU1lbW9WaWV3EiAubWVtb3MuYXBpLkRlbGV0ZU1lbW9WaWV3UmVxdWVzdBoWLmdvb2dsZS5wcm90b2J1Zi5FbXB0eSIq2kEEbmFtZYLT5JMCHSobL2FwaS97bmFtZT11c2Vycy8qL3ZpZXdzLyp9EqABChVMaXN0VXNlck5vdGlmaWNhdGlvbnMSJy5tZW1vcy5hcGkuTGlzdFVzZXJOb3RpZmljYXRpb25zUmVxdWVzdBooLm1lbW9zLmFwaS5MaXN0VXNlck5vdGlmaWNhdGlvbnNSZXNwb25zZSI02kEGcGFyZW50gtPkkwIlEiMvYXBpL3twYXJlbnQ9dXNlcnMvKn0vbm90aWZpY2F0aW9ucxLCAQoWVXBkYXRlVXNlck5vdGlmaWNhdGlvbhIoLm1lbW9zLmFwaS5VcGRhdGVVc2VyTm90aWZpY2F0aW9uUmVxdWVzdBobLm1lbW9zLmFwaS5Vc2VyTm90aWZpY2F0aW9uImHaQRhub3RpZmljYXRpb24sdXBkYXRlX21hc2uC0+STAkA6DG5vdGlmaWNhdGlvbjIwL2FwaS97bm90aWZpY2F0aW9uLm5hbWU9dXNlcnMvKi9ub3RpZmljYXRpb25zLyp9Eo4BChZEZWxldGVVc2VyTm90aWZpY2F0aW9uEigubWVtb3MuYXBpLkRlbGV0ZVVzZXJOb3RpZmljYXRpb25SZXF1ZXN0GhYuZ29vZ2xlLnByb3RvYnVmLkVtcHR5IjLaQQRuYW1lgtPkkwIlKiMvYXBpL3tuYW1lPXVzZXJzLyovbm90aWZpY2F0aW9ucy8qfRKMAQoQTGlzdFVzZXJXZWJob29rcxIiLm1lbW9zLmFwaS5MaXN0VXNlcldlYmhvb2tzUmVxdWVzdBojLm1lbW9zLmFwaS5MaXN0VXNlcldlYmhvb2tzUmVzcG9uc2UiL9pBBnBhcmVudILT5JMCIBIeL2FwaS97cGFyZW50PXVzZXJzLyp9L3dlYmhvb2tzEpIBChFDcmVhdGVVc2VyV2ViaG9vaxIjLm1lbW9zLmFwaS5DcmVhdGVVc2VyV2ViaG9va1JlcXVlc3QaFi5tZW1vcy5hcGkuVXNlcldlYmhvb2siQNpBDnBhcmVudCx3ZWJob29rgtPkkwIpOgd3ZWJob29rIh4vYXBpL3twYXJlbnQ9dXNlcnMvKn0vd2ViaG9va3MSnwEKEVVwZGF0ZVVzZXJXZWJob29rEiMubWVtb3MuYXBpLlVwZGF0ZVVzZXJXZWJob29rUmVxdWVzdBoWLm1lbW9zLmFwaS5Vc2VyV2ViaG9vayJN2kETd2ViaG9vayx1cGRhdGVfbWFza4LT5JMCMToHd2ViaG9vazImL2FwaS97d2ViaG9vay5uYW1lPXVzZXJzLyovd2ViaG9va3MvKn0SfwoRRGVsZXRlVXNlcldlYmhvb2sSIy5tZW1vcy5hcGkuRGVsZXRlVXNlcldlYmhvb2tSZXF1ZXN0GhYuZ29vZ2xlLnByb3RvYnVmLkVtcHR5Ii3aQQRuYW1lgtPkkwIgKh4vYXBpL3tuYW1lPXVzZXJzLyovd2ViaG9va3MvKn0SvAEKG0dldFVzZXJXZWJob29rU2lnbmluZ1NlY3JldBItLm1lbW9zLmFwaS5HZXRVc2VyV2ViaG9va1NpZ25pbmdTZWNyZXRSZXF1ZXN0Gi4ubWVtb3MuYXBpLkdldFVzZXJXZWJob29rU2lnbmluZ1NlY3JldFJlc3BvbnNlIj7aQQRuYW1lgtPkkwIxEi8vYXBpL3tuYW1lPXVzZXJzLyovd2ViaG9va3MvKn06Z2V0U2lnbmluZ1NlY3JldBKgAQoUTGlzdExpbmtlZElkZW50aXRpZXMSJi5tZW1vcy5hcGkuTGlzdExpbmtlZElkZW50aXRpZXNSZXF1ZXN0GicubWVtb3MuYXBpLkxpc3RMaW5rZWRJZGVudGl0aWVzUmVzcG9uc2UiN9pBBnBhcmVudILT5JMCKBImL2FwaS97cGFyZW50PXVzZXJzLyp9L2xpbmtlZElkZW50aXRpZXMSigEKEUdldExpbmtlZElkZW50aXR5EiMubWVtb3MuYXBpLkdldExpbmtlZElkZW50aXR5UmVxdWVzdBoZLm1lbW9zLmFwaS5MaW5rZWRJZGVudGl0eSI12kEEbmFtZYLT5JMCKBImL2FwaS97bmFtZT11c2Vycy8qL2xpbmtlZElkZW50aXRpZXMvKn0SpwEKFENyZWF0ZUxpbmtlZElkZW50aXR5EiYubWVtb3MuYXBpLkNyZWF0ZUxpbmtlZElkZW50aXR5UmVxdWVzdBoZLm1lbW9zLmFwaS5MaW5rZWRJZGVudGl0eSJM2kEYcGFyZW50LGlkZW50aXR5X3Byb3ZpZGVygtPkkwIrOgEqIiYvYXBpL3twYXJlbnQ9dXNlcnMvKn0vbGlua2VkSWRlbnRpdGllcxKNAQoURGVsZXRlTGlua2VkSWRlbnRpdHkSJi5tZW1vcy5hcGkuRGVsZXRlTGlua2VkSWRlbnRpdHlSZXF1ZXN0GhYuZ29vZ2xlLnByb3RvYnVmLkVtcHR5IjXaQQRuYW1lgtPkkwIoKiYvYXBpL3tuYW1lPXVzZXJzLyovbGlua2VkSWRlbnRpdGllcy8qfRKwAQoYTGlzdFBlcnNvbmFsQWNjZXNzVG9rZW5zEioubWVtb3MuYXBpLkxpc3RQZXJzb25hbEFjY2Vzc1Rva2Vuc1JlcXVlc3QaKy5tZW1vcy5hcGkuTGlzdFBlcnNvbmFsQWNjZXNzVG9rZW5zUmVzcG9uc2UiO9pBBnBhcmVudILT5JMCLBIqL2FwaS97cGFyZW50PXVzZXJzLyp9L3BlcnNvbmFsQWNjZXNzVG9rZW5zEq0BChlDcmVhdGVQZXJzb25hbEFjY2Vzc1Rva2VuEisubWVtb3MuYXBpLkNyZWF0ZVBlcnNvbmFsQWNjZXNzVG9rZW5SZXF1ZXN0GiwubWVtb3MuYXBpLkNyZWF0ZVBlcnNvbmFsQWNjZXNzVG9rZW5SZXNwb25zZSI1gtPkkwIvOgEqIiovYXBpL3twYXJlbnQ9dXNlcnMvKn0vcGVyc29uYWxBY2Nlc3NUb2tlbnMSmwEKGURlbGV0ZVBlcnNvbmFsQWNjZXNzVG9rZW4SKy5tZW1vcy5hcGkuRGVsZXRlUGVyc29uYWxBY2Nlc3NUb2tlblJlcXVlc3QaFi5nb29nbGUucHJvdG9idWYuRW1wdHkiOdpBBG5hbWWC0+STAiwqKi9hcGkve25hbWU9dXNlcnMvKi9wZXJzb25hbEFjY2Vzc1Rva2Vucy8qfRJyCgtFeHBvcnRNZW1vcxIdLm1lbW9zLmFwaS5FeHBvcnRNZW1vc1JlcXVlc3QaFC5nb29nbGUuYXBpLkh0dHBCb2R5Ii7aQQRuYW1lgtPkkwIhEh8vYXBpL3tuYW1lPXVzZXJzLyp9OmV4cG9ydE1lbW9zEngKC0ltcG9ydE1lbW9zEh0ubWVtb3MuYXBpLkltcG9ydE1lbW9zUmVxdWVzdBoeLm1lbW9zLmFwaS5JbXBvcnRNZW1vc1Jlc3BvbnNlIiqC0+STAiQ6ASoiHy9hcGkve25hbWU9dXNlcnMvKn06aW1wb3J0TWVtb3NCjwEKDWNvbS5tZW1vcy5hcGlCEFVzZXJTZXJ2aWNlUHJvdG9QAVonZ2l0aHViLmNvbS91c2VtZW1vcy9tZW1vcy9wcm90by9nZW4vYXBpogIDTUFYqgIJTWVtb3MuQXBpygIJTWVtb3NcQXBp4gIVTWVtb3NcQXBpXEdQQk1ldGFkYXRh6gIKTWVtb3M6OkFwaWIGcHJvdG8z", [file_api_common, file_api_space_service, file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_httpbody, file_google_api_resource, file_google_protobuf_empty, file_google_protobuf_field_mask, file_google_protobuf_timestamp, file_google_type_color]); + +/** + * User is an account on the instance. + * + * @generated from message memos.api.User + */ +export type User = Message<"memos.api.User"> & { + /** + * Identifier. The resource name of the user. {user} is the username. + * Format: users/{user} + * + * @generated from field: string name = 1; + */ + name: string; + + /** + * Required. The unique username, used to sign in. + * + * @generated from field: string username = 2; + */ + username: string; + + /** + * Optional. The display name of the user. + * + * @generated from field: string display_name = 3; + */ + displayName: string; + + /** + * Optional. The email address of the user. Stored trimmed and lowercased; + * empty means no address. An address belongs to at most one user on the + * instance, so writes that would reuse one fail with ALREADY_EXISTS. + * Returned only to the user and to admins. + * + * @generated from field: string email = 4; + */ + email: string; + + /** + * Optional. The avatar URL of the user. An avatar set as a data URI (PNG, + * JPEG, GIF or WebP, at most 2 MiB) is returned as a file server URL. + * + * @generated from field: string avatar_url = 5; + */ + avatarUrl: string; + + /** + * Optional. The description of the user. + * + * @generated from field: string description = 6; + */ + description: string; + + /** + * Input only. The password of the user. Never returned. + * + * @generated from field: string password = 7; + */ + password: string; + + /** + * Required. The role of the user. Only admins can change it. + * + * @generated from field: memos.api.User.Role role = 8; + */ + role: User_Role; + + /** + * Required. The state of the user. Only admins can change it. + * + * @generated from field: memos.api.State state = 9; + */ + state: State; + + /** + * Output only. The creation timestamp. + * + * @generated from field: google.protobuf.Timestamp create_time = 10; + */ + createTime?: Timestamp | undefined; + + /** + * Output only. The last update timestamp. + * + * @generated from field: google.protobuf.Timestamp update_time = 11; + */ + updateTime?: Timestamp | undefined; +}; + +/** + * Describes the message memos.api.User. + * Use `create(UserSchema)` to create a new message. + */ +export const UserSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_user_service, 0); + +/** + * Role is the instance-wide role of a user. + * + * @generated from enum memos.api.User.Role + */ +export enum User_Role { + /** + * @generated from enum value: ROLE_UNSPECIFIED = 0; + */ + ROLE_UNSPECIFIED = 0, + + /** + * An administrator of the instance. + * + * @generated from enum value: ADMIN = 2; + */ + ADMIN = 2, + + /** + * A regular user. + * + * @generated from enum value: USER = 3; + */ + USER = 3, +} + +/** + * Describes the enum memos.api.User.Role. + */ +export const User_RoleSchema: GenEnum = /*@__PURE__*/ + enumDesc(file_api_user_service, 0, 0); + +/** + * Request message for UserService.ListUsers. + * + * @generated from message memos.api.ListUsersRequest + */ +export type ListUsersRequest = Message<"memos.api.ListUsersRequest"> & { + /** + * Optional. The maximum number of users to return. The service may return + * fewer. If unspecified, at most 50 users are returned. The maximum value is + * 1000; values above 1000 are coerced to 1000. + * + * @generated from field: int32 page_size = 1; + */ + pageSize: number; + + /** + * Optional. A page token from a previous call. Provide it to retrieve the + * next page. + * + * @generated from field: string page_token = 2; + */ + pageToken: string; + + /** + * Optional. A CEL filter on the users. Only `username == ''` is + * supported. + * Example: "username == 'steven'" + * + * @generated from field: string filter = 3; + */ + filter: string; + + /** + * Optional. Currently ignored; the list includes users in every state. + * + * @generated from field: bool show_deleted = 4; + */ + showDeleted: boolean; +}; + +/** + * Describes the message memos.api.ListUsersRequest. + * Use `create(ListUsersRequestSchema)` to create a new message. + */ +export const ListUsersRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_user_service, 1); + +/** + * Response message for UserService.ListUsers. + * + * @generated from message memos.api.ListUsersResponse + */ +export type ListUsersResponse = Message<"memos.api.ListUsersResponse"> & { + /** + * The users. + * + * @generated from field: repeated memos.api.User users = 1; + */ + users: User[]; + + /** + * A token to retrieve the next page. Empty when there are no more pages. + * + * @generated from field: string next_page_token = 2; + */ + nextPageToken: string; +}; + +/** + * Describes the message memos.api.ListUsersResponse. + * Use `create(ListUsersResponseSchema)` to create a new message. + */ +export const ListUsersResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_user_service, 2); + +/** + * Request message for UserService.GetUser. + * + * @generated from message memos.api.GetUserRequest + */ +export type GetUserRequest = Message<"memos.api.GetUserRequest"> & { + /** + * Required. The resource name of the user. + * Format: users/{user} + * + * @generated from field: string name = 1; + */ + name: string; + + /** + * Optional. Currently ignored; all fields are returned. + * + * @generated from field: google.protobuf.FieldMask read_mask = 2; + */ + readMask?: FieldMask | undefined; +}; + +/** + * Describes the message memos.api.GetUserRequest. + * Use `create(GetUserRequestSchema)` to create a new message. + */ +export const GetUserRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_user_service, 3); + +/** + * Request message for UserService.BatchGetUsers. + * + * @generated from message memos.api.BatchGetUsersRequest + */ +export type BatchGetUsersRequest = Message<"memos.api.BatchGetUsersRequest"> & { + /** + * Required. The resource names of the users to get. Empty and duplicate + * entries are ignored. At most 100 non-empty names are allowed. + * Format: users/{user} + * + * @generated from field: repeated string names = 1; + */ + names: string[]; +}; + +/** + * Describes the message memos.api.BatchGetUsersRequest. + * Use `create(BatchGetUsersRequestSchema)` to create a new message. + */ +export const BatchGetUsersRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_user_service, 4); + +/** + * Response message for UserService.BatchGetUsers. + * + * @generated from message memos.api.BatchGetUsersResponse + */ +export type BatchGetUsersResponse = Message<"memos.api.BatchGetUsersResponse"> & { + /** + * The active users that match the requested names. + * + * @generated from field: repeated memos.api.User users = 1; + */ + users: User[]; +}; + +/** + * Describes the message memos.api.BatchGetUsersResponse. + * Use `create(BatchGetUsersResponseSchema)` to create a new message. + */ +export const BatchGetUsersResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_user_service, 5); + +/** + * Request message for UserService.CreateUser. + * + * @generated from message memos.api.CreateUserRequest + */ +export type CreateUserRequest = Message<"memos.api.CreateUserRequest"> & { + /** + * Required. The user to create. username and password are required; role + * is honored only when an admin calls the method. + * + * @generated from field: memos.api.User user = 1; + */ + user?: User | undefined; + + /** + * Optional. The resource ID to use for this user. If set, it must equal + * user.username and follow the username format. + * Format: ^[a-zA-Z0-9]([a-zA-Z0-9-]{0,34}[a-zA-Z0-9])?$ + * + * @generated from field: string user_id = 2; + */ + userId: string; + + /** + * Optional. If set, validate the request but do not create the user. + * + * @generated from field: bool validate_only = 3; + */ + validateOnly: boolean; + + /** + * Optional. An idempotency token. Currently ignored. + * + * @generated from field: string request_id = 4; + */ + requestId: string; +}; + +/** + * Describes the message memos.api.CreateUserRequest. + * Use `create(CreateUserRequestSchema)` to create a new message. + */ +export const CreateUserRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_user_service, 6); + +/** + * Request message for UserService.UpdateUser. + * + * @generated from message memos.api.UpdateUserRequest + */ +export type UpdateUserRequest = Message<"memos.api.UpdateUserRequest"> & { + /** + * Required. The user to update. Its name identifies the user. + * + * @generated from field: memos.api.User user = 1; + */ + user?: User | undefined; + + /** + * Required. The fields to update. Supported paths: username, display_name, + * email, avatar_url, description, password, role, state. role and state + * require an admin. + * + * @generated from field: google.protobuf.FieldMask update_mask = 2; + */ + updateMask?: FieldMask | undefined; + + /** + * Optional. Currently ignored; updating a missing user fails with NOT_FOUND. + * + * @generated from field: bool allow_missing = 3; + */ + allowMissing: boolean; +}; + +/** + * Describes the message memos.api.UpdateUserRequest. + * Use `create(UpdateUserRequestSchema)` to create a new message. + */ +export const UpdateUserRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_user_service, 7); + +/** + * Request message for UserService.DeleteUser. + * + * @generated from message memos.api.DeleteUserRequest + */ +export type DeleteUserRequest = Message<"memos.api.DeleteUserRequest"> & { + /** + * Required. The resource name of the user to delete. + * Format: users/{user} + * + * @generated from field: string name = 1; + */ + name: string; + + /** + * Optional. Currently ignored; deleting a user who belongs to any space + * fails with FAILED_PRECONDITION. + * + * @generated from field: bool force = 2; + */ + force: boolean; +}; + +/** + * Describes the message memos.api.DeleteUserRequest. + * Use `create(DeleteUserRequestSchema)` to create a new message. + */ +export const DeleteUserRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_user_service, 8); + +/** + * UserSetting is one group of a user's preferences, identified by its key. + * + * @generated from message memos.api.UserSetting + */ +export type UserSetting = Message<"memos.api.UserSetting"> & { + /** + * Identifier. The resource name of the user setting. {setting} is the + * setting key, such as GENERAL. + * Format: users/{user}/settings/{setting} + * + * @generated from field: string name = 1; + */ + name: string; + + /** + * The setting value. The set field matches the setting key. + * + * @generated from oneof memos.api.UserSetting.value + */ + value: { + /** + * The value of the GENERAL setting. + * + * @generated from field: memos.api.UserSetting.GeneralSetting general_setting = 2; + */ + value: UserSetting_GeneralSetting; + case: "generalSetting"; + } | { + /** + * The value of the WEBHOOKS setting. + * + * @generated from field: memos.api.UserSetting.WebhooksSetting webhooks_setting = 3; + */ + value: UserSetting_WebhooksSetting; + case: "webhooksSetting"; + } | { + /** + * The value of the TAGS setting. + * + * @generated from field: memos.api.UserSetting.TagsSetting tags_setting = 4; + */ + value: UserSetting_TagsSetting; + case: "tagsSetting"; + } | { case: undefined; value?: undefined }; +}; + +/** + * Describes the message memos.api.UserSetting. + * Use `create(UserSettingSchema)` to create a new message. + */ +export const UserSettingSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_user_service, 9); + +/** + * GeneralSetting holds general user preferences. + * + * @generated from message memos.api.UserSetting.GeneralSetting + */ +export type UserSetting_GeneralSetting = Message<"memos.api.UserSetting.GeneralSetting"> & { + /** + * Optional. The preferred locale of the user. + * + * @generated from field: string locale = 1; + */ + locale: string; + + /** + * Optional. The default visibility of new memos: PRIVATE, PROTECTED or + * PUBLIC. + * + * @generated from field: string memo_visibility = 2; + */ + memoVisibility: string; + + /** + * Optional. The preferred theme of the user. This references a CSS file in + * the web/public/themes/ directory. If not set, the default theme is used. + * + * @generated from field: string theme = 3; + */ + theme: string; + + /** + * Optional. Whether the official client should save metadata from future + * media uploads. + * + * @generated from field: bool save_media_metadata = 4; + */ + saveMediaMetadata: boolean; +}; + +/** + * Describes the message memos.api.UserSetting.GeneralSetting. + * Use `create(UserSetting_GeneralSettingSchema)` to create a new message. + */ +export const UserSetting_GeneralSettingSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_user_service, 9, 0); + +/** + * WebhooksSetting holds a user's webhooks. + * + * @generated from message memos.api.UserSetting.WebhooksSetting + */ +export type UserSetting_WebhooksSetting = Message<"memos.api.UserSetting.WebhooksSetting"> & { + /** + * The user's webhooks. + * + * @generated from field: repeated memos.api.UserWebhook webhooks = 1; + */ + webhooks: UserWebhook[]; +}; + +/** + * Describes the message memos.api.UserSetting.WebhooksSetting. + * Use `create(UserSetting_WebhooksSettingSchema)` to create a new message. + */ +export const UserSetting_WebhooksSettingSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_user_service, 9, 1); + +/** + * TagsSetting holds user-specific tag metadata. + * + * @generated from message memos.api.UserSetting.TagsSetting + */ +export type UserSetting_TagsSetting = Message<"memos.api.UserSetting.TagsSetting"> & { + /** + * Optional. Map of tag name pattern to tag metadata. Each key is treated as + * an anchored regular expression (^pattern$). + * + * @generated from field: map tags = 1; + */ + tags: { [key: string]: UserSetting_TagMetadata }; +}; + +/** + * Describes the message memos.api.UserSetting.TagsSetting. + * Use `create(UserSetting_TagsSettingSchema)` to create a new message. + */ +export const UserSetting_TagsSettingSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_user_service, 9, 2); + +/** + * TagMetadata holds user-specific display rules for a tag. + * + * @generated from message memos.api.UserSetting.TagMetadata + */ +export type UserSetting_TagMetadata = Message<"memos.api.UserSetting.TagMetadata"> & { + /** + * Optional. The background color of the tag label. When unset, the default + * tag color is used. + * + * @generated from field: google.type.Color background_color = 1; + */ + backgroundColor?: Color | undefined; + + /** + * Optional. Whether memos with this tag have their content blurred. + * + * @generated from field: bool blur_content = 2; + */ + blurContent: boolean; +}; + +/** + * Describes the message memos.api.UserSetting.TagMetadata. + * Use `create(UserSetting_TagMetadataSchema)` to create a new message. + */ +export const UserSetting_TagMetadataSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_user_service, 9, 3); + +/** + * Key identifies a user setting. + * + * @generated from enum memos.api.UserSetting.Key + */ +export enum UserSetting_Key { + /** + * @generated from enum value: KEY_UNSPECIFIED = 0; + */ + KEY_UNSPECIFIED = 0, + + /** + * General user preferences. + * + * @generated from enum value: GENERAL = 1; + */ + GENERAL = 1, + + /** + * The user's webhooks. + * + * @generated from enum value: WEBHOOKS = 4; + */ + WEBHOOKS = 4, + + /** + * Per-user tag metadata. + * + * @generated from enum value: TAGS = 5; + */ + TAGS = 5, +} + +/** + * Describes the enum memos.api.UserSetting.Key. + */ +export const UserSetting_KeySchema: GenEnum = /*@__PURE__*/ + enumDesc(file_api_user_service, 9, 0); + +/** + * Request message for UserService.ListUserSettings. + * + * @generated from message memos.api.ListUserSettingsRequest + */ +export type ListUserSettingsRequest = Message<"memos.api.ListUserSettingsRequest"> & { + /** + * Required. The user whose settings are listed. + * Format: users/{user} + * + * @generated from field: string parent = 1; + */ + parent: string; + + /** + * Optional. The maximum number of settings to return. The service may return + * fewer. Currently ignored; all settings are returned in one page. + * + * @generated from field: int32 page_size = 2; + */ + pageSize: number; + + /** + * Optional. A page token from a previous call. Provide it to retrieve the + * next page. + * + * @generated from field: string page_token = 3; + */ + pageToken: string; +}; + +/** + * Describes the message memos.api.ListUserSettingsRequest. + * Use `create(ListUserSettingsRequestSchema)` to create a new message. + */ +export const ListUserSettingsRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_user_service, 10); + +/** + * Response message for UserService.ListUserSettings. + * + * @generated from message memos.api.ListUserSettingsResponse + */ +export type ListUserSettingsResponse = Message<"memos.api.ListUserSettingsResponse"> & { + /** + * The user settings. + * + * @generated from field: repeated memos.api.UserSetting user_settings = 1; + */ + userSettings: UserSetting[]; + + /** + * A token to retrieve the next page. Empty when there are no more pages. + * + * @generated from field: string next_page_token = 2; + */ + nextPageToken: string; +}; + +/** + * Describes the message memos.api.ListUserSettingsResponse. + * Use `create(ListUserSettingsResponseSchema)` to create a new message. + */ +export const ListUserSettingsResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_user_service, 11); + +/** + * Request message for UserService.GetUserSetting. + * + * @generated from message memos.api.GetUserSettingRequest + */ +export type GetUserSettingRequest = Message<"memos.api.GetUserSettingRequest"> & { + /** + * Required. The resource name of the user setting. + * Format: users/{user}/settings/{setting} + * + * @generated from field: string name = 1; + */ + name: string; +}; + +/** + * Describes the message memos.api.GetUserSettingRequest. + * Use `create(GetUserSettingRequestSchema)` to create a new message. + */ +export const GetUserSettingRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_user_service, 12); + +/** + * Request message for UserService.UpdateUserSetting. + * + * @generated from message memos.api.UpdateUserSettingRequest + */ +export type UpdateUserSettingRequest = Message<"memos.api.UpdateUserSettingRequest"> & { + /** + * Required. The user setting to update. Its name identifies the setting. + * + * @generated from field: memos.api.UserSetting user_setting = 1; + */ + userSetting?: UserSetting | undefined; + + /** + * Required. The fields to update, relative to the setting value. GENERAL + * supports locale, memo_visibility, theme and save_media_metadata; TAGS + * supports tags. + * + * @generated from field: google.protobuf.FieldMask update_mask = 2; + */ + updateMask?: FieldMask | undefined; +}; + +/** + * Describes the message memos.api.UpdateUserSettingRequest. + * Use `create(UpdateUserSettingRequestSchema)` to create a new message. + */ +export const UpdateUserSettingRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_user_service, 13); + +/** + * UserStats is a summary of a user's memos. Comments are not counted. + * + * @generated from message memos.api.UserStats + */ +export type UserStats = Message<"memos.api.UserStats"> & { + /** + * Identifier. The resource name of the user statistics singleton. + * Format: users/{user}/stats + * + * @generated from field: string name = 1; + */ + name: string; + + /** + * The number of counted memos. + * + * @generated from field: int32 total_memo_count = 2; + */ + totalMemoCount: number; + + /** + * The number of counted memos by content type. + * + * @generated from field: memos.api.UserStats.MemoTypeStats memo_type_stats = 3; + */ + memoTypeStats?: UserStats_MemoTypeStats | undefined; + + /** + * The number of counted memos per tag. + * + * @generated from field: map tag_counts = 4; + */ + tagCounts: { [key: string]: number }; + + /** + * The pinned memos among the counted memos. + * Format: memos/{memo} + * + * @generated from field: repeated string pinned_memos = 5; + */ + pinnedMemos: string[]; + + /** + * The creation timestamps of the counted memos, one per memo. + * + * @generated from field: repeated google.protobuf.Timestamp memo_created_timestamps = 6; + */ + memoCreatedTimestamps: Timestamp[]; + + /** + * The latest update timestamps of the counted memos (one per memo, mirrors + * memo_created_timestamps). Used by the activity heatmap when the client's + * view is set to update_time basis. + * + * @generated from field: repeated google.protobuf.Timestamp memo_updated_timestamps = 7; + */ + memoUpdatedTimestamps: Timestamp[]; + + /** + * Output only. Total persisted attachment size in bytes, including unlinked + * uploads and attachments in all spaces. Excludes temporary uploads and + * derived files. Returned only by GetUserStats for the authenticated user's + * own stats, independently of the request's memo filter. + * + * @generated from field: optional int64 attachment_storage_bytes = 8; + */ + attachmentStorageBytes?: bigint | undefined; +}; + +/** + * Describes the message memos.api.UserStats. + * Use `create(UserStatsSchema)` to create a new message. + */ +export const UserStatsSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_user_service, 14); + +/** + * MemoTypeStats counts memos by the kind of content they contain. + * + * @generated from message memos.api.UserStats.MemoTypeStats + */ +export type UserStats_MemoTypeStats = Message<"memos.api.UserStats.MemoTypeStats"> & { + /** + * The number of memos that contain a link. + * + * @generated from field: int32 link_count = 1; + */ + linkCount: number; + + /** + * The number of memos that contain code. + * + * @generated from field: int32 code_count = 2; + */ + codeCount: number; + + /** + * The number of memos that contain a task list. + * + * @generated from field: int32 todo_count = 3; + */ + todoCount: number; + + /** + * The number of memos that contain incomplete tasks. + * + * @generated from field: int32 undo_count = 4; + */ + undoCount: number; +}; + +/** + * Describes the message memos.api.UserStats.MemoTypeStats. + * Use `create(UserStats_MemoTypeStatsSchema)` to create a new message. + */ +export const UserStats_MemoTypeStatsSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_user_service, 14, 0); + +/** + * Request message for UserService.ListUserStats. + * + * @generated from message memos.api.ListUserStatsRequest + */ +export type ListUserStatsRequest = Message<"memos.api.ListUserStatsRequest"> & { + /** + * Required. The users to list statistics for: users/- for all users, or + * users/{user} for one user. + * Format: users/{user} + * + * @generated from field: string parent = 1; + */ + parent: string; + + /** + * Optional. A CEL expression selecting the memos to count. Uses the same + * filter syntax as ListMemos. + * + * @generated from field: string filter = 2; + */ + filter: string; + + /** + * Optional. The state of the memos to count. Defaults to NORMAL. ARCHIVED + * counts only the caller's own memos. + * + * @generated from field: memos.api.State state = 3; + */ + state: State; +}; + +/** + * Describes the message memos.api.ListUserStatsRequest. + * Use `create(ListUserStatsRequestSchema)` to create a new message. + */ +export const ListUserStatsRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_user_service, 15); + +/** + * Response message for UserService.ListUserStats. + * + * @generated from message memos.api.ListUserStatsResponse + */ +export type ListUserStatsResponse = Message<"memos.api.ListUserStatsResponse"> & { + /** + * The statistics, one entry per user. + * + * @generated from field: repeated memos.api.UserStats user_stats = 1; + */ + userStats: UserStats[]; +}; + +/** + * Describes the message memos.api.ListUserStatsResponse. + * Use `create(ListUserStatsResponseSchema)` to create a new message. + */ +export const ListUserStatsResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_user_service, 16); + +/** + * Request message for UserService.GetUserStats. + * + * @generated from message memos.api.GetUserStatsRequest + */ +export type GetUserStatsRequest = Message<"memos.api.GetUserStatsRequest"> & { + /** + * Required. The resource name of the user. + * Format: users/{user} + * + * @generated from field: string name = 1; + */ + name: string; + + /** + * Optional. A CEL expression selecting the readable non-comment memos to + * count. Supports the same fields as ListMemos, including `space`. + * + * @generated from field: string filter = 2; + */ + filter: string; +}; + +/** + * Describes the message memos.api.GetUserStatsRequest. + * Use `create(GetUserStatsRequestSchema)` to create a new message. + */ +export const GetUserStatsRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_user_service, 17); + +/** + * MemoView is a user's saved memo filter. + * + * @generated from message memos.api.MemoView + */ +export type MemoView = Message<"memos.api.MemoView"> & { + /** + * Identifier. The resource name of the memo view. + * Format: users/{user}/views/{view} + * + * @generated from field: string name = 1; + */ + name: string; + + /** + * Required. The title of the memo view. + * + * @generated from field: string title = 2; + */ + title: string; + + /** + * Required. The CEL filter expression for the memo view, using the same + * grammar as the ListMemos `filter` argument. Reuse it by passing this value + * to ListMemos. + * + * @generated from field: string filter = 3; + */ + filter: string; + + /** + * Optional. Display icon. Omit when updating with the "icon" mask to reset to + * the default view icon. + * + * @generated from field: memos.api.MemoView.Icon icon = 4; + */ + icon?: MemoView_Icon | undefined; +}; + +/** + * Describes the message memos.api.MemoView. + * Use `create(MemoViewSchema)` to create a new message. + */ +export const MemoViewSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_user_service, 18); + +/** + * Icon is the display icon of a memo view. + * + * @generated from message memos.api.MemoView.Icon + */ +export type MemoView_Icon = Message<"memos.api.MemoView.Icon"> & { + /** + * The icon value. + * + * @generated from oneof memos.api.MemoView.Icon.value + */ + value: { + /** + * A Unicode emoji sequence. + * + * @generated from field: string emoji = 1; + */ + value: string; + case: "emoji"; + } | { + /** + * A canonical Lucide icon name, such as "leaf". + * + * @generated from field: string lucide = 2; + */ + value: string; + case: "lucide"; + } | { case: undefined; value?: undefined }; +}; + +/** + * Describes the message memos.api.MemoView.Icon. + * Use `create(MemoView_IconSchema)` to create a new message. + */ +export const MemoView_IconSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_user_service, 18, 0); + +/** + * Request message for UserService.ListMemoViews. + * + * @generated from message memos.api.ListMemoViewsRequest + */ +export type ListMemoViewsRequest = Message<"memos.api.ListMemoViewsRequest"> & { + /** + * Required. The user whose memo views are listed. + * Format: users/{user} + * + * @generated from field: string parent = 1; + */ + parent: string; +}; + +/** + * Describes the message memos.api.ListMemoViewsRequest. + * Use `create(ListMemoViewsRequestSchema)` to create a new message. + */ +export const ListMemoViewsRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_user_service, 19); + +/** + * Response message for UserService.ListMemoViews. + * + * @generated from message memos.api.ListMemoViewsResponse + */ +export type ListMemoViewsResponse = Message<"memos.api.ListMemoViewsResponse"> & { + /** + * The memo views. + * + * @generated from field: repeated memos.api.MemoView memo_views = 1; + */ + memoViews: MemoView[]; +}; + +/** + * Describes the message memos.api.ListMemoViewsResponse. + * Use `create(ListMemoViewsResponseSchema)` to create a new message. + */ +export const ListMemoViewsResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_user_service, 20); + +/** + * Request message for UserService.GetMemoView. + * + * @generated from message memos.api.GetMemoViewRequest + */ +export type GetMemoViewRequest = Message<"memos.api.GetMemoViewRequest"> & { + /** + * Required. The resource name of the memo view. + * Format: users/{user}/views/{view} + * + * @generated from field: string name = 1; + */ + name: string; +}; + +/** + * Describes the message memos.api.GetMemoViewRequest. + * Use `create(GetMemoViewRequestSchema)` to create a new message. + */ +export const GetMemoViewRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_user_service, 21); + +/** + * Request message for UserService.CreateMemoView. + * + * @generated from message memos.api.CreateMemoViewRequest + */ +export type CreateMemoViewRequest = Message<"memos.api.CreateMemoViewRequest"> & { + /** + * Required. The user who owns the memo view. + * Format: users/{user} + * + * @generated from field: string parent = 1; + */ + parent: string; + + /** + * Required. The memo view to create. + * + * @generated from field: memos.api.MemoView memo_view = 2; + */ + memoView?: MemoView | undefined; + + /** + * Optional. If set, validate the request but do not create the memo view. + * + * @generated from field: bool validate_only = 3; + */ + validateOnly: boolean; +}; + +/** + * Describes the message memos.api.CreateMemoViewRequest. + * Use `create(CreateMemoViewRequestSchema)` to create a new message. + */ +export const CreateMemoViewRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_user_service, 22); + +/** + * Request message for UserService.UpdateMemoView. + * + * @generated from message memos.api.UpdateMemoViewRequest + */ +export type UpdateMemoViewRequest = Message<"memos.api.UpdateMemoViewRequest"> & { + /** + * Required. The memo view to update. Its name identifies the memo view. + * + * @generated from field: memos.api.MemoView memo_view = 1; + */ + memoView?: MemoView | undefined; + + /** + * Optional. The fields to update. Supported paths: title, filter, icon. The + * service rejects an empty mask. + * + * @generated from field: google.protobuf.FieldMask update_mask = 2; + */ + updateMask?: FieldMask | undefined; +}; + +/** + * Describes the message memos.api.UpdateMemoViewRequest. + * Use `create(UpdateMemoViewRequestSchema)` to create a new message. + */ +export const UpdateMemoViewRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_user_service, 23); + +/** + * Request message for UserService.DeleteMemoView. + * + * @generated from message memos.api.DeleteMemoViewRequest + */ +export type DeleteMemoViewRequest = Message<"memos.api.DeleteMemoViewRequest"> & { + /** + * Required. The resource name of the memo view to delete. + * Format: users/{user}/views/{view} + * + * @generated from field: string name = 1; + */ + name: string; +}; + +/** + * Describes the message memos.api.DeleteMemoViewRequest. + * Use `create(DeleteMemoViewRequestSchema)` to create a new message. + */ +export const DeleteMemoViewRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_user_service, 24); + +/** + * UserNotification is a notification delivered to a user. + * + * @generated from message memos.api.UserNotification + */ +export type UserNotification = Message<"memos.api.UserNotification"> & { + /** + * Identifier. The resource name of the notification. + * Format: users/{user}/notifications/{notification} + * + * @generated from field: string name = 1; + */ + name: string; + + /** + * Output only. The user who caused the notification. + * Format: users/{user} + * + * @generated from field: string sender = 2; + */ + sender: string; + + /** + * Output only. The sender user details. + * + * @generated from field: memos.api.User sender_user = 3; + */ + senderUser?: User | undefined; + + /** + * Output only. The type of the notification. + * + * @generated from field: memos.api.UserNotification.Type type = 4; + */ + type: UserNotification_Type; + + /** + * The type-specific details. The set field matches the type. + * + * @generated from oneof memos.api.UserNotification.payload + */ + payload: { + /** + * Output only. Details of a MEMO_COMMENT notification. + * + * @generated from field: memos.api.UserNotification.MemoCommentPayload memo_comment = 5; + */ + value: UserNotification_MemoCommentPayload; + case: "memoComment"; + } | { + /** + * Output only. Details of a MEMO_MENTION notification. + * + * @generated from field: memos.api.UserNotification.MemoMentionPayload memo_mention = 6; + */ + value: UserNotification_MemoMentionPayload; + case: "memoMention"; + } | { + /** + * Output only. Details of a SPACE_INVITATION notification. + * + * @generated from field: memos.api.UserNotification.SpaceInvitationPayload space_invitation = 7; + */ + value: UserNotification_SpaceInvitationPayload; + case: "spaceInvitation"; + } | { case: undefined; value?: undefined }; + + /** + * Optional. The status of the notification. + * + * @generated from field: memos.api.UserNotification.Status status = 8; + */ + status: UserNotification_Status; + + /** + * Output only. The creation timestamp. + * + * @generated from field: google.protobuf.Timestamp create_time = 9; + */ + createTime?: Timestamp | undefined; +}; + +/** + * Describes the message memos.api.UserNotification. + * Use `create(UserNotificationSchema)` to create a new message. + */ +export const UserNotificationSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_user_service, 25); + +/** + * MemoCommentPayload holds the details of a MEMO_COMMENT notification. + * + * @generated from message memos.api.UserNotification.MemoCommentPayload + */ +export type UserNotification_MemoCommentPayload = Message<"memos.api.UserNotification.MemoCommentPayload"> & { + /** + * The comment memo. + * Format: memos/{memo} + * + * @generated from field: string memo = 1; + */ + memo: string; + + /** + * The memo that was commented on. + * Format: memos/{memo} + * + * @generated from field: string related_memo = 2; + */ + relatedMemo: string; + + /** + * Preview text of the comment memo. + * + * @generated from field: string memo_snippet = 3; + */ + memoSnippet: string; + + /** + * Preview text of the related memo. + * + * @generated from field: string related_memo_snippet = 4; + */ + relatedMemoSnippet: string; +}; + +/** + * Describes the message memos.api.UserNotification.MemoCommentPayload. + * Use `create(UserNotification_MemoCommentPayloadSchema)` to create a new message. + */ +export const UserNotification_MemoCommentPayloadSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_user_service, 25, 0); + +/** + * MemoMentionPayload holds the details of a MEMO_MENTION notification. + * + * @generated from message memos.api.UserNotification.MemoMentionPayload + */ +export type UserNotification_MemoMentionPayload = Message<"memos.api.UserNotification.MemoMentionPayload"> & { + /** + * The memo that contains the mention. + * Format: memos/{memo} + * + * @generated from field: string memo = 1; + */ + memo: string; + + /** + * The related parent memo when the mention was created in a comment. + * Format: memos/{memo} + * + * @generated from field: string related_memo = 2; + */ + relatedMemo: string; + + /** + * Preview text of the memo that contains the mention. + * + * @generated from field: string memo_snippet = 3; + */ + memoSnippet: string; + + /** + * Preview text of the related parent memo. + * + * @generated from field: string related_memo_snippet = 4; + */ + relatedMemoSnippet: string; +}; + +/** + * Describes the message memos.api.UserNotification.MemoMentionPayload. + * Use `create(UserNotification_MemoMentionPayloadSchema)` to create a new message. + */ +export const UserNotification_MemoMentionPayloadSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_user_service, 25, 1); + +/** + * SpaceInvitationPayload holds the details of a SPACE_INVITATION + * notification. + * + * @generated from message memos.api.UserNotification.SpaceInvitationPayload + */ +export type UserNotification_SpaceInvitationPayload = Message<"memos.api.UserNotification.SpaceInvitationPayload"> & { + /** + * The invitation. + * Format: spaces/{space}/invitations/{invitation} + * + * @generated from field: string space_invitation = 1; + */ + spaceInvitation: string; + + /** + * The read-only Space summary carried by the invitation. + * + * @generated from field: memos.api.Space space = 2; + */ + space?: Space | undefined; + + /** + * The role the invitation offers. + * + * @generated from field: memos.api.SpaceMember.Role role = 3; + */ + role: SpaceMember_Role; + + /** + * The current state of the invitation for the receiver. + * + * @generated from field: memos.api.UserNotification.SpaceInvitationPayload.InvitationState state = 4; + */ + state: UserNotification_SpaceInvitationPayload_InvitationState; +}; + +/** + * Describes the message memos.api.UserNotification.SpaceInvitationPayload. + * Use `create(UserNotification_SpaceInvitationPayloadSchema)` to create a new message. + */ +export const UserNotification_SpaceInvitationPayloadSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_user_service, 25, 2); + +/** + * InvitationState is the receiver's progress on the invitation. + * + * @generated from enum memos.api.UserNotification.SpaceInvitationPayload.InvitationState + */ +export enum UserNotification_SpaceInvitationPayload_InvitationState { + /** + * @generated from enum value: STATE_UNSPECIFIED = 0; + */ + STATE_UNSPECIFIED = 0, + + /** + * The receiver has not yet accepted or declined the invitation. + * + * @generated from enum value: PENDING = 1; + */ + PENDING = 1, + + /** + * The receiver accepted the invitation and is an active member. + * + * @generated from enum value: ACCEPTED = 2; + */ + ACCEPTED = 2, +} + +/** + * Describes the enum memos.api.UserNotification.SpaceInvitationPayload.InvitationState. + */ +export const UserNotification_SpaceInvitationPayload_InvitationStateSchema: GenEnum = /*@__PURE__*/ + enumDesc(file_api_user_service, 25, 2, 0); + +/** + * Status is the receiver's handling state of a notification. + * + * @generated from enum memos.api.UserNotification.Status + */ +export enum UserNotification_Status { + /** + * @generated from enum value: STATUS_UNSPECIFIED = 0; + */ + STATUS_UNSPECIFIED = 0, + + /** + * The receiver has not handled the notification yet. + * + * @generated from enum value: UNREAD = 1; + */ + UNREAD = 1, + + /** + * The receiver has archived the notification. + * + * @generated from enum value: ARCHIVED = 2; + */ + ARCHIVED = 2, +} + +/** + * Describes the enum memos.api.UserNotification.Status. + */ +export const UserNotification_StatusSchema: GenEnum = /*@__PURE__*/ + enumDesc(file_api_user_service, 25, 0); + +/** + * Type is the kind of event a notification reports. + * + * @generated from enum memos.api.UserNotification.Type + */ +export enum UserNotification_Type { + /** + * @generated from enum value: TYPE_UNSPECIFIED = 0; + */ + TYPE_UNSPECIFIED = 0, + + /** + * Someone commented on a memo. + * + * @generated from enum value: MEMO_COMMENT = 1; + */ + MEMO_COMMENT = 1, + + /** + * Someone mentioned the receiver in a memo. + * + * @generated from enum value: MEMO_MENTION = 2; + */ + MEMO_MENTION = 2, + + /** + * Someone invited the receiver to a space. + * + * @generated from enum value: SPACE_INVITATION = 3; + */ + SPACE_INVITATION = 3, +} + +/** + * Describes the enum memos.api.UserNotification.Type. + */ +export const UserNotification_TypeSchema: GenEnum = /*@__PURE__*/ + enumDesc(file_api_user_service, 25, 1); + +/** + * Request message for UserService.ListUserNotifications. + * + * @generated from message memos.api.ListUserNotificationsRequest + */ +export type ListUserNotificationsRequest = Message<"memos.api.ListUserNotificationsRequest"> & { + /** + * Required. The user whose notifications are listed. + * Format: users/{user} + * + * @generated from field: string parent = 1; + */ + parent: string; + + /** + * Optional. The maximum number of notifications to return. The service may + * return fewer. Currently ignored; all notifications are returned in one + * page. + * + * @generated from field: int32 page_size = 2; + */ + pageSize: number; + + /** + * Optional. A page token from a previous call. Provide it to retrieve the + * next page. + * + * @generated from field: string page_token = 3; + */ + pageToken: string; + + /** + * Optional. A filter on the notifications. Currently ignored. + * + * @generated from field: string filter = 4; + */ + filter: string; +}; + +/** + * Describes the message memos.api.ListUserNotificationsRequest. + * Use `create(ListUserNotificationsRequestSchema)` to create a new message. + */ +export const ListUserNotificationsRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_user_service, 26); + +/** + * Response message for UserService.ListUserNotifications. + * + * @generated from message memos.api.ListUserNotificationsResponse + */ +export type ListUserNotificationsResponse = Message<"memos.api.ListUserNotificationsResponse"> & { + /** + * The notifications. + * + * @generated from field: repeated memos.api.UserNotification notifications = 1; + */ + notifications: UserNotification[]; + + /** + * A token to retrieve the next page. Empty when there are no more pages. + * + * @generated from field: string next_page_token = 2; + */ + nextPageToken: string; +}; + +/** + * Describes the message memos.api.ListUserNotificationsResponse. + * Use `create(ListUserNotificationsResponseSchema)` to create a new message. + */ +export const ListUserNotificationsResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_user_service, 27); + +/** + * Request message for UserService.UpdateUserNotification. + * + * @generated from message memos.api.UpdateUserNotificationRequest + */ +export type UpdateUserNotificationRequest = Message<"memos.api.UpdateUserNotificationRequest"> & { + /** + * Required. The notification to update. Its name identifies the + * notification. + * + * @generated from field: memos.api.UserNotification notification = 1; + */ + notification?: UserNotification | undefined; + + /** + * Required. The fields to update. Only status is supported. + * + * @generated from field: google.protobuf.FieldMask update_mask = 2; + */ + updateMask?: FieldMask | undefined; +}; + +/** + * Describes the message memos.api.UpdateUserNotificationRequest. + * Use `create(UpdateUserNotificationRequestSchema)` to create a new message. + */ +export const UpdateUserNotificationRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_user_service, 28); + +/** + * Request message for UserService.DeleteUserNotification. + * + * @generated from message memos.api.DeleteUserNotificationRequest + */ +export type DeleteUserNotificationRequest = Message<"memos.api.DeleteUserNotificationRequest"> & { + /** + * Required. The resource name of the notification to delete. + * Format: users/{user}/notifications/{notification} + * + * @generated from field: string name = 1; + */ + name: string; +}; + +/** + * Describes the message memos.api.DeleteUserNotificationRequest. + * Use `create(DeleteUserNotificationRequestSchema)` to create a new message. + */ +export const DeleteUserNotificationRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_user_service, 29); + +/** + * UserWebhook is a webhook owned by a user. + * + * @generated from message memos.api.UserWebhook + */ +export type UserWebhook = Message<"memos.api.UserWebhook"> & { + /** + * Identifier. The resource name of the webhook. + * Format: users/{user}/webhooks/{webhook} + * + * @generated from field: string name = 1; + */ + name: string; + + /** + * A human-readable name for the webhook. + * + * @generated from field: string display_name = 2; + */ + displayName: string; + + /** + * The URL the webhook request is sent to. Required on create. + * + * @generated from field: string url = 3; + */ + url: string; + + /** + * Input only. The secret used to HMAC-SHA256 sign the webhook request body. + * Never returned; use GetUserWebhookSigningSecret to read it. + * + * @generated from field: string signing_secret = 4; + */ + signingSecret: string; + + /** + * Output only. Whether a signing secret is configured for this webhook. + * + * @generated from field: bool signing_secret_set = 5; + */ + signingSecretSet: boolean; + + /** + * Output only. The creation timestamp. Currently never set. + * + * @generated from field: google.protobuf.Timestamp create_time = 6; + */ + createTime?: Timestamp | undefined; + + /** + * Output only. The last update timestamp. Currently never set. + * + * @generated from field: google.protobuf.Timestamp update_time = 7; + */ + updateTime?: Timestamp | undefined; +}; + +/** + * Describes the message memos.api.UserWebhook. + * Use `create(UserWebhookSchema)` to create a new message. + */ +export const UserWebhookSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_user_service, 30); + +/** + * Request message for UserService.ListUserWebhooks. + * + * @generated from message memos.api.ListUserWebhooksRequest + */ +export type ListUserWebhooksRequest = Message<"memos.api.ListUserWebhooksRequest"> & { + /** + * Required. The user whose webhooks are listed. + * Format: users/{user} + * + * @generated from field: string parent = 1; + */ + parent: string; +}; + +/** + * Describes the message memos.api.ListUserWebhooksRequest. + * Use `create(ListUserWebhooksRequestSchema)` to create a new message. + */ +export const ListUserWebhooksRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_user_service, 31); + +/** + * Response message for UserService.ListUserWebhooks. + * + * @generated from message memos.api.ListUserWebhooksResponse + */ +export type ListUserWebhooksResponse = Message<"memos.api.ListUserWebhooksResponse"> & { + /** + * The webhooks. + * + * @generated from field: repeated memos.api.UserWebhook webhooks = 1; + */ + webhooks: UserWebhook[]; +}; + +/** + * Describes the message memos.api.ListUserWebhooksResponse. + * Use `create(ListUserWebhooksResponseSchema)` to create a new message. + */ +export const ListUserWebhooksResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_user_service, 32); + +/** + * Request message for UserService.CreateUserWebhook. + * + * @generated from message memos.api.CreateUserWebhookRequest + */ +export type CreateUserWebhookRequest = Message<"memos.api.CreateUserWebhookRequest"> & { + /** + * Required. The user who owns the webhook. + * Format: users/{user} + * + * @generated from field: string parent = 1; + */ + parent: string; + + /** + * Required. The webhook to create. + * + * @generated from field: memos.api.UserWebhook webhook = 2; + */ + webhook?: UserWebhook | undefined; +}; + +/** + * Describes the message memos.api.CreateUserWebhookRequest. + * Use `create(CreateUserWebhookRequestSchema)` to create a new message. + */ +export const CreateUserWebhookRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_user_service, 33); + +/** + * Request message for UserService.UpdateUserWebhook. + * + * @generated from message memos.api.UpdateUserWebhookRequest + */ +export type UpdateUserWebhookRequest = Message<"memos.api.UpdateUserWebhookRequest"> & { + /** + * Required. The webhook to update. Its name identifies the webhook. + * + * @generated from field: memos.api.UserWebhook webhook = 1; + */ + webhook?: UserWebhook | undefined; + + /** + * The fields to update. Supported paths: url, display_name, signing_secret. + * When unset, all of them are updated, skipping an empty url or + * signing_secret. + * + * @generated from field: google.protobuf.FieldMask update_mask = 2; + */ + updateMask?: FieldMask | undefined; +}; + +/** + * Describes the message memos.api.UpdateUserWebhookRequest. + * Use `create(UpdateUserWebhookRequestSchema)` to create a new message. + */ +export const UpdateUserWebhookRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_user_service, 34); + +/** + * Request message for UserService.DeleteUserWebhook. + * + * @generated from message memos.api.DeleteUserWebhookRequest + */ +export type DeleteUserWebhookRequest = Message<"memos.api.DeleteUserWebhookRequest"> & { + /** + * Required. The resource name of the webhook to delete. + * Format: users/{user}/webhooks/{webhook} + * + * @generated from field: string name = 1; + */ + name: string; +}; + +/** + * Describes the message memos.api.DeleteUserWebhookRequest. + * Use `create(DeleteUserWebhookRequestSchema)` to create a new message. + */ +export const DeleteUserWebhookRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_user_service, 35); + +/** + * Request message for UserService.GetUserWebhookSigningSecret. + * + * @generated from message memos.api.GetUserWebhookSigningSecretRequest + */ +export type GetUserWebhookSigningSecretRequest = Message<"memos.api.GetUserWebhookSigningSecretRequest"> & { + /** + * Required. The resource name of the webhook whose signing secret to reveal. + * Format: users/{user}/webhooks/{webhook} + * + * @generated from field: string name = 1; + */ + name: string; +}; + +/** + * Describes the message memos.api.GetUserWebhookSigningSecretRequest. + * Use `create(GetUserWebhookSigningSecretRequestSchema)` to create a new message. + */ +export const GetUserWebhookSigningSecretRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_user_service, 36); + +/** + * Response message for UserService.GetUserWebhookSigningSecret. + * + * @generated from message memos.api.GetUserWebhookSigningSecretResponse + */ +export type GetUserWebhookSigningSecretResponse = Message<"memos.api.GetUserWebhookSigningSecretResponse"> & { + /** + * The signing secret, in the Standard Webhooks "whsec_" form. + * + * @generated from field: string signing_secret = 1; + */ + signingSecret: string; +}; + +/** + * Describes the message memos.api.GetUserWebhookSigningSecretResponse. + * Use `create(GetUserWebhookSigningSecretResponseSchema)` to create a new message. + */ +export const GetUserWebhookSigningSecretResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_user_service, 37); + +/** + * LinkedIdentity is an SSO identity linked to a user account. + * + * @generated from message memos.api.LinkedIdentity + */ +export type LinkedIdentity = Message<"memos.api.LinkedIdentity"> & { + /** + * Identifier. The resource name of the linked identity. {linked_identity} is + * the ID of the identity provider. + * Format: users/{user}/linkedIdentities/{linked_identity} + * + * @generated from field: string name = 1; + */ + name: string; + + /** + * Output only. The resource name of the identity provider. + * Format: identity-providers/{idp} + * + * @generated from field: string identity_provider = 2; + */ + identityProvider: string; + + /** + * Output only. The external user identifier from the identity provider. + * + * @generated from field: string external_uid = 3; + */ + externalUid: string; +}; + +/** + * Describes the message memos.api.LinkedIdentity. + * Use `create(LinkedIdentitySchema)` to create a new message. + */ +export const LinkedIdentitySchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_user_service, 38); + +/** + * Request message for UserService.ListLinkedIdentities. + * + * @generated from message memos.api.ListLinkedIdentitiesRequest + */ +export type ListLinkedIdentitiesRequest = Message<"memos.api.ListLinkedIdentitiesRequest"> & { + /** + * Required. The user whose linked identities are listed. + * Format: users/{user} + * + * @generated from field: string parent = 1; + */ + parent: string; +}; + +/** + * Describes the message memos.api.ListLinkedIdentitiesRequest. + * Use `create(ListLinkedIdentitiesRequestSchema)` to create a new message. + */ +export const ListLinkedIdentitiesRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_user_service, 39); + +/** + * Response message for UserService.ListLinkedIdentities. + * + * @generated from message memos.api.ListLinkedIdentitiesResponse + */ +export type ListLinkedIdentitiesResponse = Message<"memos.api.ListLinkedIdentitiesResponse"> & { + /** + * The linked identities. + * + * @generated from field: repeated memos.api.LinkedIdentity linked_identities = 1; + */ + linkedIdentities: LinkedIdentity[]; +}; + +/** + * Describes the message memos.api.ListLinkedIdentitiesResponse. + * Use `create(ListLinkedIdentitiesResponseSchema)` to create a new message. + */ +export const ListLinkedIdentitiesResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_user_service, 40); + +/** + * Request message for UserService.GetLinkedIdentity. + * + * @generated from message memos.api.GetLinkedIdentityRequest + */ +export type GetLinkedIdentityRequest = Message<"memos.api.GetLinkedIdentityRequest"> & { + /** + * Required. The resource name of the linked identity. + * Format: users/{user}/linkedIdentities/{linked_identity} + * + * @generated from field: string name = 1; + */ + name: string; +}; + +/** + * Describes the message memos.api.GetLinkedIdentityRequest. + * Use `create(GetLinkedIdentityRequestSchema)` to create a new message. + */ +export const GetLinkedIdentityRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_user_service, 41); + +/** + * Request message for UserService.CreateLinkedIdentity. + * + * @generated from message memos.api.CreateLinkedIdentityRequest + */ +export type CreateLinkedIdentityRequest = Message<"memos.api.CreateLinkedIdentityRequest"> & { + /** + * Required. The user who owns the linked identity. Must be the caller. + * Format: users/{user} + * + * @generated from field: string parent = 1; + */ + parent: string; + + /** + * Required. The identity provider to link. + * Format: identity-providers/{idp} + * + * @generated from field: string identity_provider = 2; + */ + identityProvider: string; + + /** + * Required. The authorization code from the identity provider. + * + * @generated from field: string code = 3; + */ + code: string; + + /** + * Required. The redirect URI used in the OAuth flow. + * + * @generated from field: string redirect_uri = 4; + */ + redirectUri: string; + + /** + * Optional. The PKCE code verifier used in the OAuth flow. + * + * @generated from field: string code_verifier = 5; + */ + codeVerifier: string; +}; + +/** + * Describes the message memos.api.CreateLinkedIdentityRequest. + * Use `create(CreateLinkedIdentityRequestSchema)` to create a new message. + */ +export const CreateLinkedIdentityRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_user_service, 42); + +/** + * Request message for UserService.DeleteLinkedIdentity. + * + * @generated from message memos.api.DeleteLinkedIdentityRequest + */ +export type DeleteLinkedIdentityRequest = Message<"memos.api.DeleteLinkedIdentityRequest"> & { + /** + * Required. The resource name of the linked identity to delete. + * Format: users/{user}/linkedIdentities/{linked_identity} + * + * @generated from field: string name = 1; + */ + name: string; +}; + +/** + * Describes the message memos.api.DeleteLinkedIdentityRequest. + * Use `create(DeleteLinkedIdentityRequestSchema)` to create a new message. + */ +export const DeleteLinkedIdentityRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_user_service, 43); + +/** + * PersonalAccessToken is a long-lived token for API and script access. + * PATs are distinct from short-lived JWT access tokens used for session + * authentication. + * + * @generated from message memos.api.PersonalAccessToken + */ +export type PersonalAccessToken = Message<"memos.api.PersonalAccessToken"> & { + /** + * Identifier. The resource name of the personal access token. + * Format: users/{user}/personalAccessTokens/{personal_access_token} + * + * @generated from field: string name = 1; + */ + name: string; + + /** + * Optional. The description of the token. + * + * @generated from field: string description = 2; + */ + description: string; + + /** + * Output only. The creation time. + * + * @generated from field: google.protobuf.Timestamp create_time = 3; + */ + createTime?: Timestamp | undefined; + + /** + * Optional. The expiration time. Unset means the token never expires. + * + * @generated from field: google.protobuf.Timestamp expire_time = 4; + */ + expireTime?: Timestamp | undefined; + + /** + * Output only. The time the token was last used. + * + * @generated from field: google.protobuf.Timestamp last_use_time = 5; + */ + lastUseTime?: Timestamp | undefined; +}; + +/** + * Describes the message memos.api.PersonalAccessToken. + * Use `create(PersonalAccessTokenSchema)` to create a new message. + */ +export const PersonalAccessTokenSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_user_service, 44); + +/** + * Request message for UserService.ListPersonalAccessTokens. + * + * @generated from message memos.api.ListPersonalAccessTokensRequest + */ +export type ListPersonalAccessTokensRequest = Message<"memos.api.ListPersonalAccessTokensRequest"> & { + /** + * Required. The user whose personal access tokens are listed. + * Format: users/{user} + * + * @generated from field: string parent = 1; + */ + parent: string; + + /** + * Optional. The maximum number of tokens to return. The service may return + * fewer. Currently ignored; all tokens are returned in one page. + * + * @generated from field: int32 page_size = 2; + */ + pageSize: number; + + /** + * Optional. A page token from a previous call. Provide it to retrieve the + * next page. + * + * @generated from field: string page_token = 3; + */ + pageToken: string; +}; + +/** + * Describes the message memos.api.ListPersonalAccessTokensRequest. + * Use `create(ListPersonalAccessTokensRequestSchema)` to create a new message. + */ +export const ListPersonalAccessTokensRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_user_service, 45); + +/** + * Response message for UserService.ListPersonalAccessTokens. + * + * @generated from message memos.api.ListPersonalAccessTokensResponse + */ +export type ListPersonalAccessTokensResponse = Message<"memos.api.ListPersonalAccessTokensResponse"> & { + /** + * The personal access tokens, without their token values. + * + * @generated from field: repeated memos.api.PersonalAccessToken personal_access_tokens = 1; + */ + personalAccessTokens: PersonalAccessToken[]; + + /** + * A token to retrieve the next page. Empty when there are no more pages. + * + * @generated from field: string next_page_token = 2; + */ + nextPageToken: string; +}; + +/** + * Describes the message memos.api.ListPersonalAccessTokensResponse. + * Use `create(ListPersonalAccessTokensResponseSchema)` to create a new message. + */ +export const ListPersonalAccessTokensResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_user_service, 46); + +/** + * Request message for UserService.CreatePersonalAccessToken. + * + * @generated from message memos.api.CreatePersonalAccessTokenRequest + */ +export type CreatePersonalAccessTokenRequest = Message<"memos.api.CreatePersonalAccessTokenRequest"> & { + /** + * Required. The user who owns the token. Must be the caller. + * Format: users/{user} + * + * @generated from field: string parent = 1; + */ + parent: string; + + /** + * Optional. The description of the token. + * + * @generated from field: string description = 2; + */ + description: string; + + /** + * Optional. The lifetime of the token in days. 0 means the token never + * expires. + * + * @generated from field: int32 expires_in_days = 3; + */ + expiresInDays: number; +}; + +/** + * Describes the message memos.api.CreatePersonalAccessTokenRequest. + * Use `create(CreatePersonalAccessTokenRequestSchema)` to create a new message. + */ +export const CreatePersonalAccessTokenRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_user_service, 47); + +/** + * Response message for UserService.CreatePersonalAccessToken. + * + * @generated from message memos.api.CreatePersonalAccessTokenResponse + */ +export type CreatePersonalAccessTokenResponse = Message<"memos.api.CreatePersonalAccessTokenResponse"> & { + /** + * The personal access token metadata. + * + * @generated from field: memos.api.PersonalAccessToken personal_access_token = 1; + */ + personalAccessToken?: PersonalAccessToken | undefined; + + /** + * The token value. This is the only time it is returned. + * + * @generated from field: string token = 2; + */ + token: string; +}; + +/** + * Describes the message memos.api.CreatePersonalAccessTokenResponse. + * Use `create(CreatePersonalAccessTokenResponseSchema)` to create a new message. + */ +export const CreatePersonalAccessTokenResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_user_service, 48); + +/** + * Request message for UserService.DeletePersonalAccessToken. + * + * @generated from message memos.api.DeletePersonalAccessTokenRequest + */ +export type DeletePersonalAccessTokenRequest = Message<"memos.api.DeletePersonalAccessTokenRequest"> & { + /** + * Required. The resource name of the personal access token to delete. + * Format: users/{user}/personalAccessTokens/{personal_access_token} + * + * @generated from field: string name = 1; + */ + name: string; +}; + +/** + * Describes the message memos.api.DeletePersonalAccessTokenRequest. + * Use `create(DeletePersonalAccessTokenRequestSchema)` to create a new message. + */ +export const DeletePersonalAccessTokenRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_user_service, 49); + +/** + * Request message for UserService.ExportMemos. + * + * @generated from message memos.api.ExportMemosRequest + */ +export type ExportMemosRequest = Message<"memos.api.ExportMemosRequest"> & { + /** + * Required. The user whose memos are exported. Must be the caller. + * Format: users/{user} + * + * @generated from field: string name = 1; + */ + name: string; +}; + +/** + * Describes the message memos.api.ExportMemosRequest. + * Use `create(ExportMemosRequestSchema)` to create a new message. + */ +export const ExportMemosRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_user_service, 50); + +/** + * Request message for UserService.ImportMemos. + * + * @generated from message memos.api.ImportMemosRequest + */ +export type ImportMemosRequest = Message<"memos.api.ImportMemosRequest"> & { + /** + * Required. The user who receives the memos. Must be the caller. + * Format: users/{user} + * + * @generated from field: string name = 1; + */ + name: string; + + /** + * Required. Start a new upload or continue an existing one. + * + * @generated from oneof memos.api.ImportMemosRequest.upload + */ + upload: { + /** + * Starts a new upload. The same call may also carry data and finish_write. + * + * @generated from field: memos.api.ImportMemosSpec spec = 2; + */ + value: ImportMemosSpec; + case: "spec"; + } | { + /** + * Continues the upload identified by a previous response. + * + * @generated from field: string upload_id = 3; + */ + value: string; + case: "uploadId"; + } | { case: undefined; value?: undefined }; + + /** + * Required. Zero-based byte offset at which data is written. Must equal the + * committed size, except when retrying the most recently accepted chunk + * with identical bytes and offset, which is accepted without writing again. + * + * @generated from field: int64 write_offset = 4; + */ + writeOffset: bigint; + + /** + * Optional. Archive bytes, at most max_chunk_size long. With no data and + * finish_write false, the call reports progress without writing, and + * write_offset is ignored. + * + * @generated from field: bytes data = 5; + */ + data: Uint8Array; + + /** + * Optional. Finish the upload after writing data. The committed size must + * then equal total_size. The archive is validated and, unless + * validate_only is set, imported. Any later call for an imported upload + * returns the same report. + * + * @generated from field: bool finish_write = 6; + */ + finishWrite: boolean; + + /** + * Optional. Read on the finishing call that imports. Unspecified means SKIP. + * + * @generated from field: memos.api.ImportMemosRequest.ConflictPolicy conflict_policy = 7; + */ + conflictPolicy: ImportMemosRequest_ConflictPolicy; + + /** + * Optional. On a finishing call, validate the archive and return the plan + * without importing. The upload stays staged so a later finishing call can + * import it. + * + * @generated from field: bool validate_only = 8; + */ + validateOnly: boolean; +}; + +/** + * Describes the message memos.api.ImportMemosRequest. + * Use `create(ImportMemosRequestSchema)` to create a new message. + */ +export const ImportMemosRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_user_service, 51); + +/** + * ConflictPolicy says what the importer does with a memo whose UID the user + * already holds. + * + * @generated from enum memos.api.ImportMemosRequest.ConflictPolicy + */ +export enum ImportMemosRequest_ConflictPolicy { + /** + * @generated from enum value: CONFLICT_POLICY_UNSPECIFIED = 0; + */ + CONFLICT_POLICY_UNSPECIFIED = 0, + + /** + * Leave the existing memo untouched. This is the default. + * + * @generated from enum value: SKIP = 1; + */ + SKIP = 1, + + /** + * Update the existing memo's content and metadata from the archive. + * + * @generated from enum value: REPLACE = 2; + */ + REPLACE = 2, + + /** + * Keep the existing memo and create the archive version under a fresh UID. + * + * @generated from enum value: DUPLICATE = 3; + */ + DUPLICATE = 3, +} + +/** + * Describes the enum memos.api.ImportMemosRequest.ConflictPolicy. + */ +export const ImportMemosRequest_ConflictPolicySchema: GenEnum = /*@__PURE__*/ + enumDesc(file_api_user_service, 51, 0); + +/** + * Response message for UserService.ImportMemos. + * + * @generated from message memos.api.ImportMemosResponse + */ +export type ImportMemosResponse = Message<"memos.api.ImportMemosResponse"> & { + /** + * Opaque ID for subsequent calls. This is not a resource name. + * + * @generated from field: string upload_id = 1; + */ + uploadId: string; + + /** + * Number of archive bytes committed so far. + * + * @generated from field: int64 committed_size = 2; + */ + committedSize: bigint; + + /** + * Maximum number of data bytes accepted in one call. + * + * @generated from field: int32 max_chunk_size = 3; + */ + maxChunkSize: number; + + /** + * Set once the upload has been finished. + * + * @generated from oneof memos.api.ImportMemosResponse.result + */ + result: { + /** + * What the import would do. Set by a finishing call with validate_only. + * + * @generated from field: memos.api.ImportMemosPlan plan = 4; + */ + value: ImportMemosPlan; + case: "plan"; + } | { + /** + * What the import did. Set by a finishing call that imported. + * + * @generated from field: memos.api.ImportMemosReport report = 5; + */ + value: ImportMemosReport; + case: "report"; + } | { case: undefined; value?: undefined }; +}; + +/** + * Describes the message memos.api.ImportMemosResponse. + * Use `create(ImportMemosResponseSchema)` to create a new message. + */ +export const ImportMemosResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_user_service, 52); + +/** + * ImportMemosSpec describes a new memo import upload. + * + * @generated from message memos.api.ImportMemosSpec + */ +export type ImportMemosSpec = Message<"memos.api.ImportMemosSpec"> & { + /** + * Optional. Total size of the archive in bytes. + * + * @generated from field: int64 total_size = 1; + */ + totalSize: bigint; +}; + +/** + * Describes the message memos.api.ImportMemosSpec. + * Use `create(ImportMemosSpecSchema)` to create a new message. + */ +export const ImportMemosSpecSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_user_service, 53); + +/** + * ImportMemosPlan describes what importing a staged archive would do. + * + * @generated from message memos.api.ImportMemosPlan + */ +export type ImportMemosPlan = Message<"memos.api.ImportMemosPlan"> & { + /** + * When the archive was written. + * + * @generated from field: google.protobuf.Timestamp export_time = 1; + */ + exportTime?: Timestamp | undefined; + + /** + * Username of the user who exported the archive. + * + * @generated from field: string exporter = 2; + */ + exporter: string; + + /** + * The software that wrote the archive. + * + * @generated from field: string generator = 3; + */ + generator: string; + + /** + * Number of memo records in the archive. + * + * @generated from field: int32 memo_count = 4; + */ + memoCount: number; + + /** + * Number of attachment files in the archive. + * + * @generated from field: int32 attachment_count = 5; + */ + attachmentCount: number; + + /** + * Memos whose UID nobody on the instance holds. + * + * @generated from field: int32 new = 6; + */ + new: number; + + /** + * Memos the user already holds; the conflict policy applies to them. + * + * @generated from field: int32 existing = 7; + */ + existing: number; + + /** + * Memos whose UID another account holds; they are imported under fresh UIDs. + * + * @generated from field: int32 renamed = 8; + */ + renamed: number; + + /** + * Deviations the archive reader corrected while validating. + * + * @generated from field: repeated memos.api.ImportMemosIssue warnings = 9; + */ + warnings: ImportMemosIssue[]; +}; + +/** + * Describes the message memos.api.ImportMemosPlan. + * Use `create(ImportMemosPlanSchema)` to create a new message. + */ +export const ImportMemosPlanSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_user_service, 54); + +/** + * ImportMemosReport is the outcome of an import. + * + * @generated from message memos.api.ImportMemosReport + */ +export type ImportMemosReport = Message<"memos.api.ImportMemosReport"> & { + /** + * Number of memos created. + * + * @generated from field: int32 created = 1; + */ + created: number; + + /** + * Number of existing memos replaced under the REPLACE policy. + * + * @generated from field: int32 updated = 2; + */ + updated: number; + + /** + * Number of existing memos left untouched under the SKIP policy. + * + * @generated from field: int32 skipped = 3; + */ + skipped: number; + + /** + * Number of memos that could not be imported. + * + * @generated from field: int32 failed = 4; + */ + failed: number; + + /** + * Deviations the importer corrected or tolerated. + * + * @generated from field: repeated memos.api.ImportMemosIssue warnings = 5; + */ + warnings: ImportMemosIssue[]; + + /** + * One entry per failed memo, with the reason. + * + * @generated from field: repeated memos.api.ImportMemosIssue failures = 6; + */ + failures: ImportMemosIssue[]; +}; + +/** + * Describes the message memos.api.ImportMemosReport. + * Use `create(ImportMemosReportSchema)` to create a new message. + */ +export const ImportMemosReportSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_user_service, 55); + +/** + * ImportMemosIssue is one warning or failure of an import, tied to the memo + * UID from the archive when there is one. + * + * @generated from message memos.api.ImportMemosIssue + */ +export type ImportMemosIssue = Message<"memos.api.ImportMemosIssue"> & { + /** + * The archive memo UID the issue concerns, if any. + * + * @generated from field: string memo_uid = 1; + */ + memoUid: string; + + /** + * A description of the issue. + * + * @generated from field: string message = 2; + */ + message: string; +}; + +/** + * Describes the message memos.api.ImportMemosIssue. + * Use `create(ImportMemosIssueSchema)` to create a new message. + */ +export const ImportMemosIssueSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_api_user_service, 56); + +/** + * UserService manages users and the resources they own: settings, statistics, + * memo views, notifications, webhooks, linked identities, personal access + * tokens, and memo export files. + * + * @generated from service memos.api.UserService + */ +export const UserService: GenService<{ + /** + * ListUsers lists users in every state. Only admins may call it. + * + * @generated from rpc memos.api.UserService.ListUsers + */ + listUsers: { + methodKind: "unary"; + input: typeof ListUsersRequestSchema; + output: typeof ListUsersResponseSchema; + }, + /** + * GetUser gets a user by resource name. + * + * @generated from rpc memos.api.UserService.GetUser + */ + getUser: { + methodKind: "unary"; + input: typeof GetUserRequestSchema; + output: typeof UserSchema; + }, + /** + * BatchGetUsers gets active users by username. Usernames that match no + * active user are omitted from the response. + * + * @generated from rpc memos.api.UserService.BatchGetUsers + */ + batchGetUsers: { + methodKind: "unary"; + input: typeof BatchGetUsersRequestSchema; + output: typeof BatchGetUsersResponseSchema; + }, + /** + * 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. + * + * @generated from rpc memos.api.UserService.CreateUser + */ + createUser: { + methodKind: "unary"; + input: typeof CreateUserRequestSchema; + output: typeof UserSchema; + }, + /** + * UpdateUser updates a user. Users may update themselves; admins may update + * anyone. Changing the password ends the user's other sessions. + * + * @generated from rpc memos.api.UserService.UpdateUser + */ + updateUser: { + methodKind: "unary"; + input: typeof UpdateUserRequestSchema; + output: typeof UserSchema; + }, + /** + * DeleteUser deletes a user. Users may delete themselves; admins may delete + * anyone. A user who belongs to any space cannot be deleted. + * + * @generated from rpc memos.api.UserService.DeleteUser + */ + deleteUser: { + methodKind: "unary"; + input: typeof DeleteUserRequestSchema; + output: typeof EmptySchema; + }, + /** + * 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. + * + * @generated from rpc memos.api.UserService.ListUserSettings + */ + listUserSettings: { + methodKind: "unary"; + input: typeof ListUserSettingsRequestSchema; + output: typeof ListUserSettingsResponseSchema; + }, + /** + * GetUserSetting gets a user setting. Only the user may call it. + * + * @generated from rpc memos.api.UserService.GetUserSetting + */ + getUserSetting: { + methodKind: "unary"; + input: typeof GetUserSettingRequestSchema; + output: typeof UserSettingSchema; + }, + /** + * UpdateUserSetting updates a user setting. Only the user may call it, and + * only the GENERAL and TAGS settings can be updated. + * + * @generated from rpc memos.api.UserService.UpdateUserSetting + */ + updateUserSetting: { + methodKind: "unary"; + input: typeof UpdateUserSettingRequestSchema; + output: typeof UserSettingSchema; + }, + /** + * 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. + * + * @generated from rpc memos.api.UserService.ListUserStats + */ + listUserStats: { + methodKind: "unary"; + input: typeof ListUserStatsRequestSchema; + output: typeof ListUserStatsResponseSchema; + }, + /** + * GetUserStats returns memo statistics for one user, counting the user's + * memos that the caller can read. + * + * @generated from rpc memos.api.UserService.GetUserStats + */ + getUserStats: { + methodKind: "unary"; + input: typeof GetUserStatsRequestSchema; + output: typeof UserStatsSchema; + }, + /** + * 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. + * + * @generated from rpc memos.api.UserService.ListMemoViews + */ + listMemoViews: { + methodKind: "unary"; + input: typeof ListMemoViewsRequestSchema; + output: typeof ListMemoViewsResponseSchema; + }, + /** + * GetMemoView gets a memo view. Only the owner may call it. + * + * @generated from rpc memos.api.UserService.GetMemoView + */ + getMemoView: { + methodKind: "unary"; + input: typeof GetMemoViewRequestSchema; + output: typeof MemoViewSchema; + }, + /** + * CreateMemoView creates a memo view for a user. Only the user may call it. + * + * @generated from rpc memos.api.UserService.CreateMemoView + */ + createMemoView: { + methodKind: "unary"; + input: typeof CreateMemoViewRequestSchema; + output: typeof MemoViewSchema; + }, + /** + * UpdateMemoView updates a memo view. Only the owner may call it. + * + * @generated from rpc memos.api.UserService.UpdateMemoView + */ + updateMemoView: { + methodKind: "unary"; + input: typeof UpdateMemoViewRequestSchema; + output: typeof MemoViewSchema; + }, + /** + * DeleteMemoView deletes a memo view. Only the owner may call it. + * + * @generated from rpc memos.api.UserService.DeleteMemoView + */ + deleteMemoView: { + methodKind: "unary"; + input: typeof DeleteMemoViewRequestSchema; + output: typeof EmptySchema; + }, + /** + * 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. + * + * @generated from rpc memos.api.UserService.ListUserNotifications + */ + listUserNotifications: { + methodKind: "unary"; + input: typeof ListUserNotificationsRequestSchema; + output: typeof ListUserNotificationsResponseSchema; + }, + /** + * UpdateUserNotification updates a notification's status. Only the receiver + * may call it. + * + * @generated from rpc memos.api.UserService.UpdateUserNotification + */ + updateUserNotification: { + methodKind: "unary"; + input: typeof UpdateUserNotificationRequestSchema; + output: typeof UserNotificationSchema; + }, + /** + * DeleteUserNotification permanently deletes a notification. Only the + * receiver may call it. + * + * @generated from rpc memos.api.UserService.DeleteUserNotification + */ + deleteUserNotification: { + methodKind: "unary"; + input: typeof DeleteUserNotificationRequestSchema; + output: typeof EmptySchema; + }, + /** + * ListUserWebhooks lists a user's webhooks. Only the user may call it. + * + * @generated from rpc memos.api.UserService.ListUserWebhooks + */ + listUserWebhooks: { + methodKind: "unary"; + input: typeof ListUserWebhooksRequestSchema; + output: typeof ListUserWebhooksResponseSchema; + }, + /** + * CreateUserWebhook creates a webhook for a user. Only the user may call it. + * The service generates a signing secret when none is given. + * + * @generated from rpc memos.api.UserService.CreateUserWebhook + */ + createUserWebhook: { + methodKind: "unary"; + input: typeof CreateUserWebhookRequestSchema; + output: typeof UserWebhookSchema; + }, + /** + * UpdateUserWebhook updates a webhook. Only the owner may call it. + * + * @generated from rpc memos.api.UserService.UpdateUserWebhook + */ + updateUserWebhook: { + methodKind: "unary"; + input: typeof UpdateUserWebhookRequestSchema; + output: typeof UserWebhookSchema; + }, + /** + * DeleteUserWebhook deletes a webhook. Only the owner may call it. + * + * @generated from rpc memos.api.UserService.DeleteUserWebhook + */ + deleteUserWebhook: { + methodKind: "unary"; + input: typeof DeleteUserWebhookRequestSchema; + output: typeof EmptySchema; + }, + /** + * 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. + * + * @generated from rpc memos.api.UserService.GetUserWebhookSigningSecret + */ + getUserWebhookSigningSecret: { + methodKind: "unary"; + input: typeof GetUserWebhookSigningSecretRequestSchema; + output: typeof GetUserWebhookSigningSecretResponseSchema; + }, + /** + * ListLinkedIdentities lists the SSO identities linked to a user. The user + * and admins may call it. + * + * @generated from rpc memos.api.UserService.ListLinkedIdentities + */ + listLinkedIdentities: { + methodKind: "unary"; + input: typeof ListLinkedIdentitiesRequestSchema; + output: typeof ListLinkedIdentitiesResponseSchema; + }, + /** + * GetLinkedIdentity gets an SSO identity linked to a user. The user and + * admins may call it. + * + * @generated from rpc memos.api.UserService.GetLinkedIdentity + */ + getLinkedIdentity: { + methodKind: "unary"; + input: typeof GetLinkedIdentityRequestSchema; + output: typeof LinkedIdentitySchema; + }, + /** + * CreateLinkedIdentity completes an OAuth flow and links the resulting SSO + * identity to the authenticated user, who must be the parent. + * + * @generated from rpc memos.api.UserService.CreateLinkedIdentity + */ + createLinkedIdentity: { + methodKind: "unary"; + input: typeof CreateLinkedIdentityRequestSchema; + output: typeof LinkedIdentitySchema; + }, + /** + * DeleteLinkedIdentity unlinks an SSO identity from a user. The user and + * admins may call it. + * + * @generated from rpc memos.api.UserService.DeleteLinkedIdentity + */ + deleteLinkedIdentity: { + methodKind: "unary"; + input: typeof DeleteLinkedIdentityRequestSchema; + output: typeof EmptySchema; + }, + /** + * 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. + * + * @generated from rpc memos.api.UserService.ListPersonalAccessTokens + */ + listPersonalAccessTokens: { + methodKind: "unary"; + input: typeof ListPersonalAccessTokensRequestSchema; + output: typeof ListPersonalAccessTokensResponseSchema; + }, + /** + * 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. + * + * @generated from rpc memos.api.UserService.CreatePersonalAccessToken + */ + createPersonalAccessToken: { + methodKind: "unary"; + input: typeof CreatePersonalAccessTokenRequestSchema; + output: typeof CreatePersonalAccessTokenResponseSchema; + }, + /** + * DeletePersonalAccessToken deletes a personal access token, which stops + * working immediately. Only the owner may call it. + * + * @generated from rpc memos.api.UserService.DeletePersonalAccessToken + */ + deletePersonalAccessToken: { + methodKind: "unary"; + input: typeof DeletePersonalAccessTokenRequestSchema; + output: typeof EmptySchema; + }, + /** + * ExportMemos writes every memo the user created, with comments, archived + * memos, and attachment files, as a Memos export file (a ZIP file, see + * docs/design/memos-export-format.md). Only the user may export their own + * memos. The body is the archive; content_type is its media type. + * + * @generated from rpc memos.api.UserService.ExportMemos + */ + exportMemos: { + methodKind: "unary"; + input: typeof ExportMemosRequestSchema; + output: typeof HttpBodySchema; + }, + /** + * 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. + * + * @generated from rpc memos.api.UserService.ImportMemos + */ + importMemos: { + methodKind: "unary"; + input: typeof ImportMemosRequestSchema; + output: typeof ImportMemosResponseSchema; + }, +}> = /*@__PURE__*/ + serviceDesc(file_api_user_service, 0); + diff --git a/web/src/types/proto/api/v1/ai_service_pb.ts b/web/src/types/proto/api/v1/ai_service_pb.ts deleted file mode 100644 index 0eda8d962..000000000 --- a/web/src/types/proto/api/v1/ai_service_pb.ts +++ /dev/null @@ -1,119 +0,0 @@ -// @generated by protoc-gen-es v2.12.1 with parameter "target=ts" -// @generated from file api/v1/ai_service.proto (package memos.api.v1, syntax proto3) -/* eslint-disable */ - -import type { GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv2"; -import { fileDesc, messageDesc, serviceDesc } from "@bufbuild/protobuf/codegenv2"; -import { file_google_api_annotations } from "../../google/api/annotations_pb"; -import { file_google_api_client } from "../../google/api/client_pb"; -import { file_google_api_field_behavior } from "../../google/api/field_behavior_pb"; -import type { Message } from "@bufbuild/protobuf"; - -/** - * Describes the file api/v1/ai_service.proto. - */ -export const file_api_v1_ai_service: GenFile = /*@__PURE__*/ - fileDesc("ChdhcGkvdjEvYWlfc2VydmljZS5wcm90bxIMbWVtb3MuYXBpLnYxIkkKEVRyYW5zY3JpYmVSZXF1ZXN0EjQKBWF1ZGlvGAEgASgLMiAubWVtb3MuYXBpLnYxLlRyYW5zY3JpcHRpb25BdWRpb0ID4EECIncKElRyYW5zY3JpcHRpb25BdWRpbxIWCgdjb250ZW50GAEgASgMQgPgQQRIABINCgN1cmkYAiABKAlIABIVCghmaWxlbmFtZRgDIAEoCUID4EEBEhkKDGNvbnRlbnRfdHlwZRgEIAEoCUID4EEBQggKBnNvdXJjZSIiChJUcmFuc2NyaWJlUmVzcG9uc2USDAoEdGV4dBgBIAEoCTKGAQoJQUlTZXJ2aWNlEnkKClRyYW5zY3JpYmUSHy5tZW1vcy5hcGkudjEuVHJhbnNjcmliZVJlcXVlc3QaIC5tZW1vcy5hcGkudjEuVHJhbnNjcmliZVJlc3BvbnNlIijaQQVhdWRpb4LT5JMCGjoBKiIVL2FwaS92MS9haTp0cmFuc2NyaWJlQqYBChBjb20ubWVtb3MuYXBpLnYxQg5BaVNlcnZpY2VQcm90b1ABWjBnaXRodWIuY29tL3VzZW1lbW9zL21lbW9zL3Byb3RvL2dlbi9hcGkvdjE7YXBpdjGiAgNNQViqAgxNZW1vcy5BcGkuVjHKAgxNZW1vc1xBcGlcVjHiAhhNZW1vc1xBcGlcVjFcR1BCTWV0YWRhdGHqAg5NZW1vczo6QXBpOjpWMWIGcHJvdG8z", [file_google_api_annotations, file_google_api_client, file_google_api_field_behavior]); - -/** - * @generated from message memos.api.v1.TranscribeRequest - */ -export type TranscribeRequest = Message<"memos.api.v1.TranscribeRequest"> & { - /** - * Required. Audio input. - * - * @generated from field: memos.api.v1.TranscriptionAudio audio = 1; - */ - audio?: TranscriptionAudio | undefined; -}; - -/** - * Describes the message memos.api.v1.TranscribeRequest. - * Use `create(TranscribeRequestSchema)` to create a new message. - */ -export const TranscribeRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_ai_service, 0); - -/** - * @generated from message memos.api.v1.TranscriptionAudio - */ -export type TranscriptionAudio = Message<"memos.api.v1.TranscriptionAudio"> & { - /** - * @generated from oneof memos.api.v1.TranscriptionAudio.source - */ - source: { - /** - * Inline audio bytes. - * - * @generated from field: bytes content = 1; - */ - value: Uint8Array; - case: "content"; - } | { - /** - * URI for audio content. Reserved for future use. - * - * @generated from field: string uri = 2; - */ - value: string; - case: "uri"; - } | { case: undefined; value?: undefined }; - - /** - * Optional. The uploaded filename. - * - * @generated from field: string filename = 3; - */ - filename: string; - - /** - * Optional. The MIME type of the input audio. - * - * @generated from field: string content_type = 4; - */ - contentType: string; -}; - -/** - * Describes the message memos.api.v1.TranscriptionAudio. - * Use `create(TranscriptionAudioSchema)` to create a new message. - */ -export const TranscriptionAudioSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_ai_service, 1); - -/** - * @generated from message memos.api.v1.TranscribeResponse - */ -export type TranscribeResponse = Message<"memos.api.v1.TranscribeResponse"> & { - /** - * The transcribed text. - * - * @generated from field: string text = 1; - */ - text: string; -}; - -/** - * Describes the message memos.api.v1.TranscribeResponse. - * Use `create(TranscribeResponseSchema)` to create a new message. - */ -export const TranscribeResponseSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_ai_service, 2); - -/** - * @generated from service memos.api.v1.AIService - */ -export const AIService: GenService<{ - /** - * Transcribe transcribes an audio file using an instance AI provider. - * - * @generated from rpc memos.api.v1.AIService.Transcribe - */ - transcribe: { - methodKind: "unary"; - input: typeof TranscribeRequestSchema; - output: typeof TranscribeResponseSchema; - }, -}> = /*@__PURE__*/ - serviceDesc(file_api_v1_ai_service, 0); - diff --git a/web/src/types/proto/api/v1/attachment_service_pb.ts b/web/src/types/proto/api/v1/attachment_service_pb.ts deleted file mode 100644 index b674e9d1a..000000000 --- a/web/src/types/proto/api/v1/attachment_service_pb.ts +++ /dev/null @@ -1,809 +0,0 @@ -// @generated by protoc-gen-es v2.12.1 with parameter "target=ts" -// @generated from file api/v1/attachment_service.proto (package memos.api.v1, syntax proto3) -/* eslint-disable */ - -import type { GenEnum, GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv2"; -import { enumDesc, fileDesc, messageDesc, serviceDesc } from "@bufbuild/protobuf/codegenv2"; -import { file_google_api_annotations } from "../../google/api/annotations_pb"; -import { file_google_api_client } from "../../google/api/client_pb"; -import { file_google_api_field_behavior } from "../../google/api/field_behavior_pb"; -import { file_google_api_resource } from "../../google/api/resource_pb"; -import type { EmptySchema, FieldMask, Timestamp } from "@bufbuild/protobuf/wkt"; -import { file_google_protobuf_empty, file_google_protobuf_field_mask, file_google_protobuf_timestamp } from "@bufbuild/protobuf/wkt"; -import type { Message } from "@bufbuild/protobuf"; - -/** - * Describes the file api/v1/attachment_service.proto. - */ -export const file_api_v1_attachment_service: GenFile = /*@__PURE__*/ - fileDesc("Ch9hcGkvdjEvYXR0YWNobWVudF9zZXJ2aWNlLnByb3RvEgxtZW1vcy5hcGkudjEivAEKC01vdGlvbk1lZGlhEi8KBmZhbWlseRgBIAEoDjIfLm1lbW9zLmFwaS52MS5Nb3Rpb25NZWRpYUZhbWlseRIrCgRyb2xlGAIgASgOMh0ubWVtb3MuYXBpLnYxLk1vdGlvbk1lZGlhUm9sZRIQCghncm91cF9pZBgDIAEoCRIhChlwcmVzZW50YXRpb25fdGltZXN0YW1wX3VzGAQgASgDEhoKEmhhc19lbWJlZGRlZF92aWRlbxgFIAEoCCK0AQoNTWVkaWFNZXRhZGF0YRISCgV3aWR0aBgBIAEoBUgBiAEBEhMKBmhlaWdodBgCIAEoBUgCiAEBEiwKBXBob3RvGAMgASgLMhsubWVtb3MuYXBpLnYxLlBob3RvTWV0YWRhdGFIABIsCgV2aWRlbxgEIAEoCzIbLm1lbW9zLmFwaS52MS5WaWRlb01ldGFkYXRhSABCCQoHZGV0YWlsc0IICgZfd2lkdGhCCQoHX2hlaWdodCKjAwoNUGhvdG9NZXRhZGF0YRI0CgxjYXB0dXJlX3RpbWUYASABKAsyHi5tZW1vcy5hcGkudjEuTWVkaWFDYXB0dXJlVGltZRItCghsb2NhdGlvbhgCIAEoCzIbLm1lbW9zLmFwaS52MS5NZWRpYUxvY2F0aW9uEiQKF3NvdXJjZV9leGlmX29yaWVudGF0aW9uGAMgASgFSACIAQESEwoLY2FtZXJhX21ha2UYBCABKAkSFAoMY2FtZXJhX21vZGVsGAUgASgJEhIKCmxlbnNfbW9kZWwYBiABKAkSFQoIZl9udW1iZXIYByABKAFIAYgBARIiChVleHBvc3VyZV90aW1lX3NlY29uZHMYCCABKAFIAogBARIQCgNpc28YCSABKAVIA4gBARIcCg9mb2NhbF9sZW5ndGhfbW0YCiABKAFIBIgBAUIaChhfc291cmNlX2V4aWZfb3JpZW50YXRpb25CCwoJX2ZfbnVtYmVyQhgKFl9leHBvc3VyZV90aW1lX3NlY29uZHNCBgoEX2lzb0ISChBfZm9jYWxfbGVuZ3RoX21tIlMKEE1lZGlhQ2FwdHVyZVRpbWUSFwoPbG9jYWxfZGF0ZV90aW1lGAEgASgJEhcKCnV0Y19vZmZzZXQYAiABKAlIAIgBAUINCgtfdXRjX29mZnNldCKLAQoNTWVkaWFMb2NhdGlvbhIVCghsYXRpdHVkZRgBIAEoAUgAiAEBEhYKCWxvbmdpdHVkZRgCIAEoAUgBiAEBEhwKD2FsdGl0dWRlX21ldGVycxgDIAEoAUgCiAEBQgsKCV9sYXRpdHVkZUIMCgpfbG9uZ2l0dWRlQhIKEF9hbHRpdHVkZV9tZXRlcnMiQwoNVmlkZW9NZXRhZGF0YRIdChBkdXJhdGlvbl9zZWNvbmRzGAEgASgBSACIAQFCEwoRX2R1cmF0aW9uX3NlY29uZHMi1QMKCkF0dGFjaG1lbnQSEQoEbmFtZRgBIAEoCUID4EEIEjQKC2NyZWF0ZV90aW1lGAIgASgLMhouZ29vZ2xlLnByb3RvYnVmLlRpbWVzdGFtcEID4EEDEhUKCGZpbGVuYW1lGAMgASgJQgPgQQISFAoHY29udGVudBgEIAEoDEID4EEEEhoKDWV4dGVybmFsX2xpbmsYBSABKAlCA+BBARIRCgR0eXBlGAYgASgJQgPgQQISEQoEc2l6ZRgHIAEoA0ID4EEDEhYKBG1lbW8YCCABKAlCA+BBAUgAiAEBEjQKDG1vdGlvbl9tZWRpYRgJIAEoCzIZLm1lbW9zLmFwaS52MS5Nb3Rpb25NZWRpYUID4EEBEjsKDm1lZGlhX21ldGFkYXRhGAogASgLMhsubWVtb3MuYXBpLnYxLk1lZGlhTWV0YWRhdGFCBuBBAeBBBRIqCgdjcmVhdG9yGAsgASgJQhngQQP6QRMKEW1lbW9zLmFwaS52MS9Vc2VyOk/qQUwKF21lbW9zLmFwaS52MS9BdHRhY2htZW50EhhhdHRhY2htZW50cy97YXR0YWNobWVudH0qC2F0dGFjaG1lbnRzMgphdHRhY2htZW50QgcKBV9tZW1vImgKF0NyZWF0ZUF0dGFjaG1lbnRSZXF1ZXN0EjEKCmF0dGFjaG1lbnQYASABKAsyGC5tZW1vcy5hcGkudjEuQXR0YWNobWVudEID4EECEhoKDWF0dGFjaG1lbnRfaWQYAiABKAlCA+BBASK1AQoXVXBsb2FkQXR0YWNobWVudFJlcXVlc3QSMgoEc3BlYxgBIAEoCzIiLm1lbW9zLmFwaS52MS5VcGxvYWRBdHRhY2htZW50U3BlY0gAEhMKCXVwbG9hZF9pZBgCIAEoCUgAEhkKDHdyaXRlX29mZnNldBgDIAEoA0ID4EECEhEKBGRhdGEYBCABKAxCA+BBARIZCgxmaW5pc2hfd3JpdGUYBSABKAhCA+BBAUIICgZ1cGxvYWQifgoUVXBsb2FkQXR0YWNobWVudFNwZWMSMQoKYXR0YWNobWVudBgBIAEoCzIYLm1lbW9zLmFwaS52MS5BdHRhY2htZW50QgPgQQISGgoNYXR0YWNobWVudF9pZBgCIAEoCUID4EEBEhcKCnRvdGFsX3NpemUYAyABKANCA+BBASKLAQoYVXBsb2FkQXR0YWNobWVudFJlc3BvbnNlEhEKCXVwbG9hZF9pZBgBIAEoCRIWCg5jb21taXR0ZWRfc2l6ZRgCIAEoAxIsCgphdHRhY2htZW50GAMgASgLMhgubWVtb3MuYXBpLnYxLkF0dGFjaG1lbnQSFgoObWF4X2NodW5rX3NpemUYBCABKAUilAEKFkxpc3RBdHRhY2htZW50c1JlcXVlc3QSFgoJcGFnZV9zaXplGAEgASgFQgPgQQESFwoKcGFnZV90b2tlbhgCIAEoCUID4EEBEhMKBmZpbHRlchgDIAEoCUID4EEBEhUKCG9yZGVyX2J5GAQgASgJQgPgQQFKBAgFEAZKBAgGEAdSBXNwYWNlUgp1bmFzc2lnbmVkImEKF0xpc3RBdHRhY2htZW50c1Jlc3BvbnNlEi0KC2F0dGFjaG1lbnRzGAEgAygLMhgubWVtb3MuYXBpLnYxLkF0dGFjaG1lbnQSFwoPbmV4dF9wYWdlX3Rva2VuGAIgASgJIkUKFEdldEF0dGFjaG1lbnRSZXF1ZXN0Ei0KBG5hbWUYASABKAlCH+BBAvpBGQoXbWVtb3MuYXBpLnYxL0F0dGFjaG1lbnQiggEKF1VwZGF0ZUF0dGFjaG1lbnRSZXF1ZXN0EjEKCmF0dGFjaG1lbnQYASABKAsyGC5tZW1vcy5hcGkudjEuQXR0YWNobWVudEID4EECEjQKC3VwZGF0ZV9tYXNrGAIgASgLMhouZ29vZ2xlLnByb3RvYnVmLkZpZWxkTWFza0ID4EECIkgKF0RlbGV0ZUF0dGFjaG1lbnRSZXF1ZXN0Ei0KBG5hbWUYASABKAlCH+BBAvpBGQoXbWVtb3MuYXBpLnYxL0F0dGFjaG1lbnQiMwodQmF0Y2hEZWxldGVBdHRhY2htZW50c1JlcXVlc3QSEgoFbmFtZXMYASADKAlCA+BBAipoChFNb3Rpb25NZWRpYUZhbWlseRIjCh9NT1RJT05fTUVESUFfRkFNSUxZX1VOU1BFQ0lGSUVEEAASFAoQQVBQTEVfTElWRV9QSE9UTxABEhgKFEFORFJPSURfTU9USU9OX1BIT1RPEAIqWQoPTW90aW9uTWVkaWFSb2xlEiEKHU1PVElPTl9NRURJQV9ST0xFX1VOU1BFQ0lGSUVEEAASCQoFU1RJTEwQARIJCgVWSURFTxACEg0KCUNPTlRBSU5FUhADMtsHChFBdHRhY2htZW50U2VydmljZRKJAQoQQ3JlYXRlQXR0YWNobWVudBIlLm1lbW9zLmFwaS52MS5DcmVhdGVBdHRhY2htZW50UmVxdWVzdBoYLm1lbW9zLmFwaS52MS5BdHRhY2htZW50IjTaQQphdHRhY2htZW50gtPkkwIhOgphdHRhY2htZW50IhMvYXBpL3YxL2F0dGFjaG1lbnRzEogBChBVcGxvYWRBdHRhY2htZW50EiUubWVtb3MuYXBpLnYxLlVwbG9hZEF0dGFjaG1lbnRSZXF1ZXN0GiYubWVtb3MuYXBpLnYxLlVwbG9hZEF0dGFjaG1lbnRSZXNwb25zZSIlgtPkkwIfOgEqIhovYXBpL3YxL2F0dGFjaG1lbnRzOnVwbG9hZBJ7Cg9MaXN0QXR0YWNobWVudHMSJC5tZW1vcy5hcGkudjEuTGlzdEF0dGFjaG1lbnRzUmVxdWVzdBolLm1lbW9zLmFwaS52MS5MaXN0QXR0YWNobWVudHNSZXNwb25zZSIbgtPkkwIVEhMvYXBpL3YxL2F0dGFjaG1lbnRzEnoKDUdldEF0dGFjaG1lbnQSIi5tZW1vcy5hcGkudjEuR2V0QXR0YWNobWVudFJlcXVlc3QaGC5tZW1vcy5hcGkudjEuQXR0YWNobWVudCIr2kEEbmFtZYLT5JMCHhIcL2FwaS92MS97bmFtZT1hdHRhY2htZW50cy8qfRKpAQoQVXBkYXRlQXR0YWNobWVudBIlLm1lbW9zLmFwaS52MS5VcGRhdGVBdHRhY2htZW50UmVxdWVzdBoYLm1lbW9zLmFwaS52MS5BdHRhY2htZW50IlTaQRZhdHRhY2htZW50LHVwZGF0ZV9tYXNrgtPkkwI1OgphdHRhY2htZW50MicvYXBpL3YxL3thdHRhY2htZW50Lm5hbWU9YXR0YWNobWVudHMvKn0SfgoQRGVsZXRlQXR0YWNobWVudBIlLm1lbW9zLmFwaS52MS5EZWxldGVBdHRhY2htZW50UmVxdWVzdBoWLmdvb2dsZS5wcm90b2J1Zi5FbXB0eSIr2kEEbmFtZYLT5JMCHiocL2FwaS92MS97bmFtZT1hdHRhY2htZW50cy8qfRKJAQoWQmF0Y2hEZWxldGVBdHRhY2htZW50cxIrLm1lbW9zLmFwaS52MS5CYXRjaERlbGV0ZUF0dGFjaG1lbnRzUmVxdWVzdBoWLmdvb2dsZS5wcm90b2J1Zi5FbXB0eSIqgtPkkwIkOgEqIh8vYXBpL3YxL2F0dGFjaG1lbnRzOmJhdGNoRGVsZXRlQq4BChBjb20ubWVtb3MuYXBpLnYxQhZBdHRhY2htZW50U2VydmljZVByb3RvUAFaMGdpdGh1Yi5jb20vdXNlbWVtb3MvbWVtb3MvcHJvdG8vZ2VuL2FwaS92MTthcGl2MaICA01BWKoCDE1lbW9zLkFwaS5WMcoCDE1lbW9zXEFwaVxWMeICGE1lbW9zXEFwaVxWMVxHUEJNZXRhZGF0YeoCDk1lbW9zOjpBcGk6OlYxYgZwcm90bzM", [file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_empty, file_google_protobuf_field_mask, file_google_protobuf_timestamp]); - -/** - * @generated from message memos.api.v1.MotionMedia - */ -export type MotionMedia = Message<"memos.api.v1.MotionMedia"> & { - /** - * @generated from field: memos.api.v1.MotionMediaFamily family = 1; - */ - family: MotionMediaFamily; - - /** - * @generated from field: memos.api.v1.MotionMediaRole role = 2; - */ - role: MotionMediaRole; - - /** - * @generated from field: string group_id = 3; - */ - groupId: string; - - /** - * @generated from field: int64 presentation_timestamp_us = 4; - */ - presentationTimestampUs: bigint; - - /** - * @generated from field: bool has_embedded_video = 5; - */ - hasEmbeddedVideo: boolean; -}; - -/** - * Describes the message memos.api.v1.MotionMedia. - * Use `create(MotionMediaSchema)` to create a new message. - */ -export const MotionMediaSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_attachment_service, 0); - -/** - * MediaMetadata contains normalized metadata explicitly supplied by a client. - * The server validates and stores this data but does not extract it from the media file. - * - * @generated from message memos.api.v1.MediaMetadata - */ -export type MediaMetadata = Message<"memos.api.v1.MediaMetadata"> & { - /** - * Optional. Display-oriented width in pixels. - * - * @generated from field: optional int32 width = 1; - */ - width?: number | undefined; - - /** - * Optional. Display-oriented height in pixels. - * - * @generated from field: optional int32 height = 2; - */ - height?: number | undefined; - - /** - * @generated from oneof memos.api.v1.MediaMetadata.details - */ - details: { - /** - * @generated from field: memos.api.v1.PhotoMetadata photo = 3; - */ - value: PhotoMetadata; - case: "photo"; - } | { - /** - * @generated from field: memos.api.v1.VideoMetadata video = 4; - */ - value: VideoMetadata; - case: "video"; - } | { case: undefined; value?: undefined }; -}; - -/** - * Describes the message memos.api.v1.MediaMetadata. - * Use `create(MediaMetadataSchema)` to create a new message. - */ -export const MediaMetadataSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_attachment_service, 1); - -/** - * @generated from message memos.api.v1.PhotoMetadata - */ -export type PhotoMetadata = Message<"memos.api.v1.PhotoMetadata"> & { - /** - * Optional. Capture time as recorded by the source media. - * - * @generated from field: memos.api.v1.MediaCaptureTime capture_time = 1; - */ - captureTime?: MediaCaptureTime | undefined; - - /** - * Optional. Geographic location recorded by the source media. - * - * @generated from field: memos.api.v1.MediaLocation location = 2; - */ - location?: MediaLocation | undefined; - - /** - * Optional. EXIF orientation value from 1 through 8 as recorded by the source file. - * This value is informational and must not be reapplied to the stored attachment; - * width and height already describe its display-oriented dimensions. - * - * @generated from field: optional int32 source_exif_orientation = 3; - */ - sourceExifOrientation?: number | undefined; - - /** - * @generated from field: string camera_make = 4; - */ - cameraMake: string; - - /** - * @generated from field: string camera_model = 5; - */ - cameraModel: string; - - /** - * @generated from field: string lens_model = 6; - */ - lensModel: string; - - /** - * @generated from field: optional double f_number = 7; - */ - fNumber?: number | undefined; - - /** - * @generated from field: optional double exposure_time_seconds = 8; - */ - exposureTimeSeconds?: number | undefined; - - /** - * @generated from field: optional int32 iso = 9; - */ - iso?: number | undefined; - - /** - * @generated from field: optional double focal_length_mm = 10; - */ - focalLengthMm?: number | undefined; -}; - -/** - * Describes the message memos.api.v1.PhotoMetadata. - * Use `create(PhotoMetadataSchema)` to create a new message. - */ -export const PhotoMetadataSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_attachment_service, 2); - -/** - * @generated from message memos.api.v1.MediaCaptureTime - */ -export type MediaCaptureTime = Message<"memos.api.v1.MediaCaptureTime"> & { - /** - * Local date and time without a time zone, formatted as YYYY-MM-DDTHH:mm:ss[.fraction]. - * - * @generated from field: string local_date_time = 1; - */ - localDateTime: string; - - /** - * Optional. UTC offset formatted as Z or +/-HH:MM. - * - * @generated from field: optional string utc_offset = 2; - */ - utcOffset?: string | undefined; -}; - -/** - * Describes the message memos.api.v1.MediaCaptureTime. - * Use `create(MediaCaptureTimeSchema)` to create a new message. - */ -export const MediaCaptureTimeSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_attachment_service, 3); - -/** - * @generated from message memos.api.v1.MediaLocation - */ -export type MediaLocation = Message<"memos.api.v1.MediaLocation"> & { - /** - * Optional. WGS84 latitude in decimal degrees. Must be provided with longitude. - * - * @generated from field: optional double latitude = 1; - */ - latitude?: number | undefined; - - /** - * Optional. WGS84 longitude in decimal degrees. Must be provided with latitude. - * - * @generated from field: optional double longitude = 2; - */ - longitude?: number | undefined; - - /** - * Optional. Signed altitude in meters relative to sea level. - * - * @generated from field: optional double altitude_meters = 3; - */ - altitudeMeters?: number | undefined; -}; - -/** - * Describes the message memos.api.v1.MediaLocation. - * Use `create(MediaLocationSchema)` to create a new message. - */ -export const MediaLocationSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_attachment_service, 4); - -/** - * @generated from message memos.api.v1.VideoMetadata - */ -export type VideoMetadata = Message<"memos.api.v1.VideoMetadata"> & { - /** - * @generated from field: optional double duration_seconds = 1; - */ - durationSeconds?: number | undefined; -}; - -/** - * Describes the message memos.api.v1.VideoMetadata. - * Use `create(VideoMetadataSchema)` to create a new message. - */ -export const VideoMetadataSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_attachment_service, 5); - -/** - * @generated from message memos.api.v1.Attachment - */ -export type Attachment = Message<"memos.api.v1.Attachment"> & { - /** - * The name of the attachment. - * Format: attachments/{attachment} - * - * @generated from field: string name = 1; - */ - name: string; - - /** - * Output only. The creation timestamp. - * - * @generated from field: google.protobuf.Timestamp create_time = 2; - */ - createTime?: Timestamp | undefined; - - /** - * The filename of the attachment. - * - * @generated from field: string filename = 3; - */ - filename: string; - - /** - * Input only. The content of the attachment. - * - * @generated from field: bytes content = 4; - */ - content: Uint8Array; - - /** - * Optional. The external link of the attachment. - * - * @generated from field: string external_link = 5; - */ - externalLink: string; - - /** - * The MIME type of the attachment. - * - * @generated from field: string type = 6; - */ - type: string; - - /** - * Output only. The size of the attachment in bytes. - * - * @generated from field: int64 size = 7; - */ - size: bigint; - - /** - * Optional. The related memo. Refer to `Memo.name`. - * Format: memos/{memo} - * - * @generated from field: optional string memo = 8; - */ - memo?: string | undefined; - - /** - * Optional. Motion media metadata. - * - * @generated from field: memos.api.v1.MotionMedia motion_media = 9; - */ - motionMedia?: MotionMedia | undefined; - - /** - * Optional. Immutable normalized media metadata explicitly supplied by the client at creation time. - * - * @generated from field: memos.api.v1.MediaMetadata media_metadata = 10; - */ - mediaMetadata?: MediaMetadata | undefined; - - /** - * Output only. The user who uploaded this attachment, which may differ from - * the creator of the linked memo. Format: users/{user}. - * - * @generated from field: string creator = 11; - */ - creator: string; -}; - -/** - * Describes the message memos.api.v1.Attachment. - * Use `create(AttachmentSchema)` to create a new message. - */ -export const AttachmentSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_attachment_service, 6); - -/** - * @generated from message memos.api.v1.CreateAttachmentRequest - */ -export type CreateAttachmentRequest = Message<"memos.api.v1.CreateAttachmentRequest"> & { - /** - * Required. The attachment to create. - * - * @generated from field: memos.api.v1.Attachment attachment = 1; - */ - attachment?: Attachment | undefined; - - /** - * Optional. The attachment ID to use for this attachment. - * If empty, a unique ID will be generated. - * Format: ^[a-zA-Z0-9]([a-zA-Z0-9-]{0,34}[a-zA-Z0-9])?$ - * - * @generated from field: string attachment_id = 2; - */ - attachmentId: string; -}; - -/** - * Describes the message memos.api.v1.CreateAttachmentRequest. - * Use `create(CreateAttachmentRequestSchema)` to create a new message. - */ -export const CreateAttachmentRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_attachment_service, 7); - -/** - * @generated from message memos.api.v1.UploadAttachmentRequest - */ -export type UploadAttachmentRequest = Message<"memos.api.v1.UploadAttachmentRequest"> & { - /** - * Required. Start a new upload or continue an existing one. - * - * @generated from oneof memos.api.v1.UploadAttachmentRequest.upload - */ - upload: { - /** - * Starts a new upload. The same call may also carry data and finish_write. - * - * @generated from field: memos.api.v1.UploadAttachmentSpec spec = 1; - */ - value: UploadAttachmentSpec; - case: "spec"; - } | { - /** - * Continues the upload identified by a previous response. - * - * @generated from field: string upload_id = 2; - */ - value: string; - case: "uploadId"; - } | { case: undefined; value?: undefined }; - - /** - * Required. Zero-based byte offset at which data is written. Must equal the - * committed size, except when retrying the most recently accepted chunk - * with identical bytes and offset, which is accepted without writing again. - * - * @generated from field: int64 write_offset = 3; - */ - writeOffset: bigint; - - /** - * Optional. File bytes, at most max_chunk_size long. With no data and - * finish_write false, the call reports progress without writing, and - * write_offset is ignored. - * - * @generated from field: bytes data = 4; - */ - data: Uint8Array; - - /** - * Optional. Finalize the upload after writing data. The committed size must - * then equal total_size. Any later call for the same upload_id returns the - * created attachment. - * - * @generated from field: bool finish_write = 5; - */ - finishWrite: boolean; -}; - -/** - * Describes the message memos.api.v1.UploadAttachmentRequest. - * Use `create(UploadAttachmentRequestSchema)` to create a new message. - */ -export const UploadAttachmentRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_attachment_service, 8); - -/** - * @generated from message memos.api.v1.UploadAttachmentSpec - */ -export type UploadAttachmentSpec = Message<"memos.api.v1.UploadAttachmentSpec"> & { - /** - * Required. Metadata for the attachment to create. content must be empty; - * file bytes are sent in data. - * - * @generated from field: memos.api.v1.Attachment attachment = 1; - */ - attachment?: Attachment | undefined; - - /** - * Optional. The attachment ID to use for this attachment. - * If empty, a unique ID will be generated. - * Format: ^[a-zA-Z0-9]([a-zA-Z0-9-]{0,34}[a-zA-Z0-9])?$ - * - * @generated from field: string attachment_id = 2; - */ - attachmentId: string; - - /** - * Optional. Total size of the file in bytes before media processing. - * Zero represents an empty file. - * - * @generated from field: int64 total_size = 3; - */ - totalSize: bigint; -}; - -/** - * Describes the message memos.api.v1.UploadAttachmentSpec. - * Use `create(UploadAttachmentSpecSchema)` to create a new message. - */ -export const UploadAttachmentSpecSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_attachment_service, 9); - -/** - * @generated from message memos.api.v1.UploadAttachmentResponse - */ -export type UploadAttachmentResponse = Message<"memos.api.v1.UploadAttachmentResponse"> & { - /** - * Opaque ID for subsequent calls. This is not a resource name. - * - * @generated from field: string upload_id = 1; - */ - uploadId: string; - - /** - * Number of file bytes committed so far. - * - * @generated from field: int64 committed_size = 2; - */ - committedSize: bigint; - - /** - * Set once the upload has been finalized. - * - * @generated from field: memos.api.v1.Attachment attachment = 3; - */ - attachment?: Attachment | undefined; - - /** - * Maximum number of data bytes accepted in one call. - * - * @generated from field: int32 max_chunk_size = 4; - */ - maxChunkSize: number; -}; - -/** - * Describes the message memos.api.v1.UploadAttachmentResponse. - * Use `create(UploadAttachmentResponseSchema)` to create a new message. - */ -export const UploadAttachmentResponseSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_attachment_service, 10); - -/** - * @generated from message memos.api.v1.ListAttachmentsRequest - */ -export type ListAttachmentsRequest = Message<"memos.api.v1.ListAttachmentsRequest"> & { - /** - * Optional. The maximum number of attachments to return. - * The service may return fewer than this value. - * If unspecified, at most 50 attachments will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. - * - * @generated from field: int32 page_size = 1; - */ - pageSize: number; - - /** - * Optional. A page token, received from a previous `ListAttachments` call. - * Provide this to retrieve the subsequent page. - * - * @generated from field: string page_token = 2; - */ - pageToken: string; - - /** - * Optional. Filter to apply to the list results. - * Example: "mime_type==\"image/png\"" or "filename.contains(\"test\")" - * Supported operators: =, !=, <, <=, >, >=, : (contains), in - * Supported fields: creator, filename, mime_type, create_time, memo_id, space. - * `creator` is the linked memo's creator, or the uploader for an unlinked - * attachment. It supports equality with a User resource name. - * `space` only supports a non-negated `==` comparison with a Space resource - * name or null. - * `space` is the linked memo's space resource name, or null when the - * attachment is unlinked or its linked memo has no space. - * - * @generated from field: string filter = 3; - */ - filter: string; - - /** - * Optional. The order to sort results by. - * Example: "create_time desc" or "filename asc" - * - * @generated from field: string order_by = 4; - */ - orderBy: string; -}; - -/** - * Describes the message memos.api.v1.ListAttachmentsRequest. - * Use `create(ListAttachmentsRequestSchema)` to create a new message. - */ -export const ListAttachmentsRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_attachment_service, 11); - -/** - * @generated from message memos.api.v1.ListAttachmentsResponse - */ -export type ListAttachmentsResponse = Message<"memos.api.v1.ListAttachmentsResponse"> & { - /** - * The list of attachments. - * - * @generated from field: repeated memos.api.v1.Attachment attachments = 1; - */ - attachments: Attachment[]; - - /** - * A token that can be sent as `page_token` to retrieve the next page. - * If this field is omitted, there are no subsequent pages. - * - * @generated from field: string next_page_token = 2; - */ - nextPageToken: string; -}; - -/** - * Describes the message memos.api.v1.ListAttachmentsResponse. - * Use `create(ListAttachmentsResponseSchema)` to create a new message. - */ -export const ListAttachmentsResponseSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_attachment_service, 12); - -/** - * @generated from message memos.api.v1.GetAttachmentRequest - */ -export type GetAttachmentRequest = Message<"memos.api.v1.GetAttachmentRequest"> & { - /** - * Required. The attachment name of the attachment to retrieve. - * Format: attachments/{attachment} - * - * @generated from field: string name = 1; - */ - name: string; -}; - -/** - * Describes the message memos.api.v1.GetAttachmentRequest. - * Use `create(GetAttachmentRequestSchema)` to create a new message. - */ -export const GetAttachmentRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_attachment_service, 13); - -/** - * @generated from message memos.api.v1.UpdateAttachmentRequest - */ -export type UpdateAttachmentRequest = Message<"memos.api.v1.UpdateAttachmentRequest"> & { - /** - * Required. The attachment which replaces the attachment on the server. - * - * @generated from field: memos.api.v1.Attachment attachment = 1; - */ - attachment?: Attachment | undefined; - - /** - * Required. The list of fields to update. - * - * @generated from field: google.protobuf.FieldMask update_mask = 2; - */ - updateMask?: FieldMask | undefined; -}; - -/** - * Describes the message memos.api.v1.UpdateAttachmentRequest. - * Use `create(UpdateAttachmentRequestSchema)` to create a new message. - */ -export const UpdateAttachmentRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_attachment_service, 14); - -/** - * @generated from message memos.api.v1.DeleteAttachmentRequest - */ -export type DeleteAttachmentRequest = Message<"memos.api.v1.DeleteAttachmentRequest"> & { - /** - * Required. The attachment name of the attachment to delete. - * Format: attachments/{attachment} - * - * @generated from field: string name = 1; - */ - name: string; -}; - -/** - * Describes the message memos.api.v1.DeleteAttachmentRequest. - * Use `create(DeleteAttachmentRequestSchema)` to create a new message. - */ -export const DeleteAttachmentRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_attachment_service, 15); - -/** - * @generated from message memos.api.v1.BatchDeleteAttachmentsRequest - */ -export type BatchDeleteAttachmentsRequest = Message<"memos.api.v1.BatchDeleteAttachmentsRequest"> & { - /** - * @generated from field: repeated string names = 1; - */ - names: string[]; -}; - -/** - * Describes the message memos.api.v1.BatchDeleteAttachmentsRequest. - * Use `create(BatchDeleteAttachmentsRequestSchema)` to create a new message. - */ -export const BatchDeleteAttachmentsRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_attachment_service, 16); - -/** - * @generated from enum memos.api.v1.MotionMediaFamily - */ -export enum MotionMediaFamily { - /** - * @generated from enum value: MOTION_MEDIA_FAMILY_UNSPECIFIED = 0; - */ - MOTION_MEDIA_FAMILY_UNSPECIFIED = 0, - - /** - * @generated from enum value: APPLE_LIVE_PHOTO = 1; - */ - APPLE_LIVE_PHOTO = 1, - - /** - * @generated from enum value: ANDROID_MOTION_PHOTO = 2; - */ - ANDROID_MOTION_PHOTO = 2, -} - -/** - * Describes the enum memos.api.v1.MotionMediaFamily. - */ -export const MotionMediaFamilySchema: GenEnum = /*@__PURE__*/ - enumDesc(file_api_v1_attachment_service, 0); - -/** - * @generated from enum memos.api.v1.MotionMediaRole - */ -export enum MotionMediaRole { - /** - * @generated from enum value: MOTION_MEDIA_ROLE_UNSPECIFIED = 0; - */ - MOTION_MEDIA_ROLE_UNSPECIFIED = 0, - - /** - * @generated from enum value: STILL = 1; - */ - STILL = 1, - - /** - * @generated from enum value: VIDEO = 2; - */ - VIDEO = 2, - - /** - * @generated from enum value: CONTAINER = 3; - */ - CONTAINER = 3, -} - -/** - * Describes the enum memos.api.v1.MotionMediaRole. - */ -export const MotionMediaRoleSchema: GenEnum = /*@__PURE__*/ - enumDesc(file_api_v1_attachment_service, 1); - -/** - * @generated from service memos.api.v1.AttachmentService - */ -export const AttachmentService: GenService<{ - /** - * CreateAttachment creates a new attachment. - * - * @generated from rpc memos.api.v1.AttachmentService.CreateAttachment - */ - createAttachment: { - methodKind: "unary"; - input: typeof CreateAttachmentRequestSchema; - output: typeof AttachmentSchema; - }, - /** - * UploadAttachment uploads a file in bounded chunks. The first call carries - * the spec and returns an upload_id; later calls carry that upload_id. - * Uploads are bound to the authenticated user, expire after 30 minutes of - * inactivity, and do not survive a server restart. - * - * @generated from rpc memos.api.v1.AttachmentService.UploadAttachment - */ - uploadAttachment: { - methodKind: "unary"; - input: typeof UploadAttachmentRequestSchema; - output: typeof UploadAttachmentResponseSchema; - }, - /** - * ListAttachments lists attachments linked to readable memos and the caller's unlinked uploads. - * - * @generated from rpc memos.api.v1.AttachmentService.ListAttachments - */ - listAttachments: { - methodKind: "unary"; - input: typeof ListAttachmentsRequestSchema; - output: typeof ListAttachmentsResponseSchema; - }, - /** - * GetAttachment returns an attachment by name. - * - * @generated from rpc memos.api.v1.AttachmentService.GetAttachment - */ - getAttachment: { - methodKind: "unary"; - input: typeof GetAttachmentRequestSchema; - output: typeof AttachmentSchema; - }, - /** - * UpdateAttachment updates an attachment. - * - * @generated from rpc memos.api.v1.AttachmentService.UpdateAttachment - */ - updateAttachment: { - methodKind: "unary"; - input: typeof UpdateAttachmentRequestSchema; - output: typeof AttachmentSchema; - }, - /** - * DeleteAttachment deletes an attachment by name. - * - * @generated from rpc memos.api.v1.AttachmentService.DeleteAttachment - */ - deleteAttachment: { - methodKind: "unary"; - input: typeof DeleteAttachmentRequestSchema; - output: typeof EmptySchema; - }, - /** - * BatchDeleteAttachments deletes multiple attachments in one request. - * - * @generated from rpc memos.api.v1.AttachmentService.BatchDeleteAttachments - */ - batchDeleteAttachments: { - methodKind: "unary"; - input: typeof BatchDeleteAttachmentsRequestSchema; - output: typeof EmptySchema; - }, -}> = /*@__PURE__*/ - serviceDesc(file_api_v1_attachment_service, 0); - diff --git a/web/src/types/proto/api/v1/auth_service_pb.ts b/web/src/types/proto/api/v1/auth_service_pb.ts deleted file mode 100644 index b9f3bfff5..000000000 --- a/web/src/types/proto/api/v1/auth_service_pb.ts +++ /dev/null @@ -1,300 +0,0 @@ -// @generated by protoc-gen-es v2.12.1 with parameter "target=ts" -// @generated from file api/v1/auth_service.proto (package memos.api.v1, syntax proto3) -/* eslint-disable */ - -import type { GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv2"; -import { fileDesc, messageDesc, serviceDesc } from "@bufbuild/protobuf/codegenv2"; -import type { User } from "./user_service_pb"; -import { file_api_v1_user_service } from "./user_service_pb"; -import { file_google_api_annotations } from "../../google/api/annotations_pb"; -import { file_google_api_field_behavior } from "../../google/api/field_behavior_pb"; -import type { EmptySchema, Timestamp } from "@bufbuild/protobuf/wkt"; -import { file_google_protobuf_empty, file_google_protobuf_timestamp } from "@bufbuild/protobuf/wkt"; -import type { Message } from "@bufbuild/protobuf"; - -/** - * Describes the file api/v1/auth_service.proto. - */ -export const file_api_v1_auth_service: GenFile = /*@__PURE__*/ - fileDesc("ChlhcGkvdjEvYXV0aF9zZXJ2aWNlLnByb3RvEgxtZW1vcy5hcGkudjEiFwoVR2V0Q3VycmVudFVzZXJSZXF1ZXN0IjoKFkdldEN1cnJlbnRVc2VyUmVzcG9uc2USIAoEdXNlchgBIAEoCzISLm1lbW9zLmFwaS52MS5Vc2VyIu4CCg1TaWduSW5SZXF1ZXN0Ek8KFHBhc3N3b3JkX2NyZWRlbnRpYWxzGAEgASgLMi8ubWVtb3MuYXBpLnYxLlNpZ25JblJlcXVlc3QuUGFzc3dvcmRDcmVkZW50aWFsc0gAEkUKD3Nzb19jcmVkZW50aWFscxgCIAEoCzIqLm1lbW9zLmFwaS52MS5TaWduSW5SZXF1ZXN0LlNTT0NyZWRlbnRpYWxzSAAaQwoTUGFzc3dvcmRDcmVkZW50aWFscxIVCgh1c2VybmFtZRgBIAEoCUID4EECEhUKCHBhc3N3b3JkGAIgASgJQgPgQQIacQoOU1NPQ3JlZGVudGlhbHMSFQoIaWRwX25hbWUYASABKAlCA+BBAhIRCgRjb2RlGAIgASgJQgPgQQISGQoMcmVkaXJlY3RfdXJpGAMgASgJQgPgQQISGgoNY29kZV92ZXJpZmllchgEIAEoCUID4EEBQg0KC2NyZWRlbnRpYWxzIoUBCg5TaWduSW5SZXNwb25zZRIgCgR1c2VyGAEgASgLMhIubWVtb3MuYXBpLnYxLlVzZXISFAoMYWNjZXNzX3Rva2VuGAIgASgJEjsKF2FjY2Vzc190b2tlbl9leHBpcmVzX2F0GAMgASgLMhouZ29vZ2xlLnByb3RvYnVmLlRpbWVzdGFtcCIQCg5TaWduT3V0UmVxdWVzdCIVChNSZWZyZXNoVG9rZW5SZXF1ZXN0IlwKFFJlZnJlc2hUb2tlblJlc3BvbnNlEhQKDGFjY2Vzc190b2tlbhgBIAEoCRIuCgpleHBpcmVzX2F0GAIgASgLMhouZ29vZ2xlLnByb3RvYnVmLlRpbWVzdGFtcDK/AwoLQXV0aFNlcnZpY2USdAoOR2V0Q3VycmVudFVzZXISIy5tZW1vcy5hcGkudjEuR2V0Q3VycmVudFVzZXJSZXF1ZXN0GiQubWVtb3MuYXBpLnYxLkdldEN1cnJlbnRVc2VyUmVzcG9uc2UiF4LT5JMCERIPL2FwaS92MS9hdXRoL21lEmMKBlNpZ25JbhIbLm1lbW9zLmFwaS52MS5TaWduSW5SZXF1ZXN0GhwubWVtb3MuYXBpLnYxLlNpZ25JblJlc3BvbnNlIh6C0+STAhg6ASoiEy9hcGkvdjEvYXV0aC9zaWduaW4SXQoHU2lnbk91dBIcLm1lbW9zLmFwaS52MS5TaWduT3V0UmVxdWVzdBoWLmdvb2dsZS5wcm90b2J1Zi5FbXB0eSIcgtPkkwIWIhQvYXBpL3YxL2F1dGgvc2lnbm91dBJ2CgxSZWZyZXNoVG9rZW4SIS5tZW1vcy5hcGkudjEuUmVmcmVzaFRva2VuUmVxdWVzdBoiLm1lbW9zLmFwaS52MS5SZWZyZXNoVG9rZW5SZXNwb25zZSIfgtPkkwIZOgEqIhQvYXBpL3YxL2F1dGgvcmVmcmVzaEKoAQoQY29tLm1lbW9zLmFwaS52MUIQQXV0aFNlcnZpY2VQcm90b1ABWjBnaXRodWIuY29tL3VzZW1lbW9zL21lbW9zL3Byb3RvL2dlbi9hcGkvdjE7YXBpdjGiAgNNQViqAgxNZW1vcy5BcGkuVjHKAgxNZW1vc1xBcGlcVjHiAhhNZW1vc1xBcGlcVjFcR1BCTWV0YWRhdGHqAg5NZW1vczo6QXBpOjpWMWIGcHJvdG8z", [file_api_v1_user_service, file_google_api_annotations, file_google_api_field_behavior, file_google_protobuf_empty, file_google_protobuf_timestamp]); - -/** - * @generated from message memos.api.v1.GetCurrentUserRequest - */ -export type GetCurrentUserRequest = Message<"memos.api.v1.GetCurrentUserRequest"> & { -}; - -/** - * Describes the message memos.api.v1.GetCurrentUserRequest. - * Use `create(GetCurrentUserRequestSchema)` to create a new message. - */ -export const GetCurrentUserRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_auth_service, 0); - -/** - * @generated from message memos.api.v1.GetCurrentUserResponse - */ -export type GetCurrentUserResponse = Message<"memos.api.v1.GetCurrentUserResponse"> & { - /** - * The authenticated user's information. - * - * @generated from field: memos.api.v1.User user = 1; - */ - user?: User | undefined; -}; - -/** - * Describes the message memos.api.v1.GetCurrentUserResponse. - * Use `create(GetCurrentUserResponseSchema)` to create a new message. - */ -export const GetCurrentUserResponseSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_auth_service, 1); - -/** - * @generated from message memos.api.v1.SignInRequest - */ -export type SignInRequest = Message<"memos.api.v1.SignInRequest"> & { - /** - * Authentication credentials. Provide one method. - * - * @generated from oneof memos.api.v1.SignInRequest.credentials - */ - credentials: { - /** - * Username and password authentication. - * - * @generated from field: memos.api.v1.SignInRequest.PasswordCredentials password_credentials = 1; - */ - value: SignInRequest_PasswordCredentials; - case: "passwordCredentials"; - } | { - /** - * SSO provider authentication. - * - * @generated from field: memos.api.v1.SignInRequest.SSOCredentials sso_credentials = 2; - */ - value: SignInRequest_SSOCredentials; - case: "ssoCredentials"; - } | { case: undefined; value?: undefined }; -}; - -/** - * Describes the message memos.api.v1.SignInRequest. - * Use `create(SignInRequestSchema)` to create a new message. - */ -export const SignInRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_auth_service, 2); - -/** - * Nested message for password-based authentication credentials. - * - * @generated from message memos.api.v1.SignInRequest.PasswordCredentials - */ -export type SignInRequest_PasswordCredentials = Message<"memos.api.v1.SignInRequest.PasswordCredentials"> & { - /** - * The username to sign in with. - * - * @generated from field: string username = 1; - */ - username: string; - - /** - * The password to sign in with. - * - * @generated from field: string password = 2; - */ - password: string; -}; - -/** - * Describes the message memos.api.v1.SignInRequest.PasswordCredentials. - * Use `create(SignInRequest_PasswordCredentialsSchema)` to create a new message. - */ -export const SignInRequest_PasswordCredentialsSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_auth_service, 2, 0); - -/** - * Nested message for SSO authentication credentials. - * - * @generated from message memos.api.v1.SignInRequest.SSOCredentials - */ -export type SignInRequest_SSOCredentials = Message<"memos.api.v1.SignInRequest.SSOCredentials"> & { - /** - * The resource name of the SSO provider. - * Format: identity-providers/{idp} - * - * @generated from field: string idp_name = 1; - */ - idpName: string; - - /** - * The authorization code from the SSO provider. - * - * @generated from field: string code = 2; - */ - code: string; - - /** - * The redirect URI used in the SSO flow. - * - * @generated from field: string redirect_uri = 3; - */ - redirectUri: string; - - /** - * The PKCE code verifier for enhanced security (RFC 7636). - * Optional - enables PKCE flow protection against authorization code interception. - * - * @generated from field: string code_verifier = 4; - */ - codeVerifier: string; -}; - -/** - * Describes the message memos.api.v1.SignInRequest.SSOCredentials. - * Use `create(SignInRequest_SSOCredentialsSchema)` to create a new message. - */ -export const SignInRequest_SSOCredentialsSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_auth_service, 2, 1); - -/** - * @generated from message memos.api.v1.SignInResponse - */ -export type SignInResponse = Message<"memos.api.v1.SignInResponse"> & { - /** - * The authenticated user's information. - * - * @generated from field: memos.api.v1.User user = 1; - */ - user?: User | undefined; - - /** - * The short-lived access token for API requests. - * Store in memory only, not in localStorage. - * - * @generated from field: string access_token = 2; - */ - accessToken: string; - - /** - * When the access token expires. - * Client should call RefreshToken before this time. - * - * @generated from field: google.protobuf.Timestamp access_token_expires_at = 3; - */ - accessTokenExpiresAt?: Timestamp | undefined; -}; - -/** - * Describes the message memos.api.v1.SignInResponse. - * Use `create(SignInResponseSchema)` to create a new message. - */ -export const SignInResponseSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_auth_service, 3); - -/** - * @generated from message memos.api.v1.SignOutRequest - */ -export type SignOutRequest = Message<"memos.api.v1.SignOutRequest"> & { -}; - -/** - * Describes the message memos.api.v1.SignOutRequest. - * Use `create(SignOutRequestSchema)` to create a new message. - */ -export const SignOutRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_auth_service, 4); - -/** - * @generated from message memos.api.v1.RefreshTokenRequest - */ -export type RefreshTokenRequest = Message<"memos.api.v1.RefreshTokenRequest"> & { -}; - -/** - * Describes the message memos.api.v1.RefreshTokenRequest. - * Use `create(RefreshTokenRequestSchema)` to create a new message. - */ -export const RefreshTokenRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_auth_service, 5); - -/** - * @generated from message memos.api.v1.RefreshTokenResponse - */ -export type RefreshTokenResponse = Message<"memos.api.v1.RefreshTokenResponse"> & { - /** - * The new short-lived access token. - * - * @generated from field: string access_token = 1; - */ - accessToken: string; - - /** - * When the access token expires. - * - * @generated from field: google.protobuf.Timestamp expires_at = 2; - */ - expiresAt?: Timestamp | undefined; -}; - -/** - * Describes the message memos.api.v1.RefreshTokenResponse. - * Use `create(RefreshTokenResponseSchema)` to create a new message. - */ -export const RefreshTokenResponseSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_auth_service, 6); - -/** - * @generated from service memos.api.v1.AuthService - */ -export const AuthService: GenService<{ - /** - * GetCurrentUser returns the authenticated user's information. - * Validates the access token and returns user details. - * Similar to OIDC's /userinfo endpoint. - * - * @generated from rpc memos.api.v1.AuthService.GetCurrentUser - */ - getCurrentUser: { - methodKind: "unary"; - input: typeof GetCurrentUserRequestSchema; - output: typeof GetCurrentUserResponseSchema; - }, - /** - * SignIn authenticates a user with credentials and returns tokens. - * On success, returns an access token and sets a refresh token cookie. - * Supports password-based and SSO authentication methods. - * - * @generated from rpc memos.api.v1.AuthService.SignIn - */ - signIn: { - methodKind: "unary"; - input: typeof SignInRequestSchema; - output: typeof SignInResponseSchema; - }, - /** - * SignOut terminates the user's authentication. - * Revokes the refresh token and clears the authentication cookie. - * - * @generated from rpc memos.api.v1.AuthService.SignOut - */ - signOut: { - methodKind: "unary"; - input: typeof SignOutRequestSchema; - output: typeof EmptySchema; - }, - /** - * RefreshToken exchanges a valid refresh token for a new access token. - * The refresh token is read from the HttpOnly cookie. - * Returns a new short-lived access token. - * - * @generated from rpc memos.api.v1.AuthService.RefreshToken - */ - refreshToken: { - methodKind: "unary"; - input: typeof RefreshTokenRequestSchema; - output: typeof RefreshTokenResponseSchema; - }, -}> = /*@__PURE__*/ - serviceDesc(file_api_v1_auth_service, 0); - diff --git a/web/src/types/proto/api/v1/common_pb.ts b/web/src/types/proto/api/v1/common_pb.ts deleted file mode 100644 index 08769097c..000000000 --- a/web/src/types/proto/api/v1/common_pb.ts +++ /dev/null @@ -1,90 +0,0 @@ -// @generated by protoc-gen-es v2.12.1 with parameter "target=ts" -// @generated from file api/v1/common.proto (package memos.api.v1, syntax proto3) -/* eslint-disable */ - -import type { GenEnum, GenFile, GenMessage } from "@bufbuild/protobuf/codegenv2"; -import { enumDesc, fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv2"; -import type { Message } from "@bufbuild/protobuf"; - -/** - * Describes the file api/v1/common.proto. - */ -export const file_api_v1_common: GenFile = /*@__PURE__*/ - fileDesc("ChNhcGkvdjEvY29tbW9uLnByb3RvEgxtZW1vcy5hcGkudjEiKgoJUGFnZVRva2VuEg0KBWxpbWl0GAEgASgFEg4KBm9mZnNldBgCIAEoBSo4CgVTdGF0ZRIVChFTVEFURV9VTlNQRUNJRklFRBAAEgoKBk5PUk1BTBABEgwKCEFSQ0hJVkVEEAIqOQoJRGlyZWN0aW9uEhkKFURJUkVDVElPTl9VTlNQRUNJRklFRBAAEgcKA0FTQxABEggKBERFU0MQAkKjAQoQY29tLm1lbW9zLmFwaS52MUILQ29tbW9uUHJvdG9QAVowZ2l0aHViLmNvbS91c2VtZW1vcy9tZW1vcy9wcm90by9nZW4vYXBpL3YxO2FwaXYxogIDTUFYqgIMTWVtb3MuQXBpLlYxygIMTWVtb3NcQXBpXFYx4gIYTWVtb3NcQXBpXFYxXEdQQk1ldGFkYXRh6gIOTWVtb3M6OkFwaTo6VjFiBnByb3RvMw"); - -/** - * Used internally for obfuscating the page token. - * - * @generated from message memos.api.v1.PageToken - */ -export type PageToken = Message<"memos.api.v1.PageToken"> & { - /** - * @generated from field: int32 limit = 1; - */ - limit: number; - - /** - * @generated from field: int32 offset = 2; - */ - offset: number; -}; - -/** - * Describes the message memos.api.v1.PageToken. - * Use `create(PageTokenSchema)` to create a new message. - */ -export const PageTokenSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_common, 0); - -/** - * @generated from enum memos.api.v1.State - */ -export enum State { - /** - * @generated from enum value: STATE_UNSPECIFIED = 0; - */ - STATE_UNSPECIFIED = 0, - - /** - * @generated from enum value: NORMAL = 1; - */ - NORMAL = 1, - - /** - * @generated from enum value: ARCHIVED = 2; - */ - ARCHIVED = 2, -} - -/** - * Describes the enum memos.api.v1.State. - */ -export const StateSchema: GenEnum = /*@__PURE__*/ - enumDesc(file_api_v1_common, 0); - -/** - * @generated from enum memos.api.v1.Direction - */ -export enum Direction { - /** - * @generated from enum value: DIRECTION_UNSPECIFIED = 0; - */ - DIRECTION_UNSPECIFIED = 0, - - /** - * @generated from enum value: ASC = 1; - */ - ASC = 1, - - /** - * @generated from enum value: DESC = 2; - */ - DESC = 2, -} - -/** - * Describes the enum memos.api.v1.Direction. - */ -export const DirectionSchema: GenEnum = /*@__PURE__*/ - enumDesc(file_api_v1_common, 1); - diff --git a/web/src/types/proto/api/v1/idp_service_pb.ts b/web/src/types/proto/api/v1/idp_service_pb.ts deleted file mode 100644 index 7ee474f03..000000000 --- a/web/src/types/proto/api/v1/idp_service_pb.ts +++ /dev/null @@ -1,377 +0,0 @@ -// @generated by protoc-gen-es v2.12.1 with parameter "target=ts" -// @generated from file api/v1/idp_service.proto (package memos.api.v1, syntax proto3) -/* eslint-disable */ - -import type { GenEnum, GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv2"; -import { enumDesc, fileDesc, messageDesc, serviceDesc } from "@bufbuild/protobuf/codegenv2"; -import { file_google_api_annotations } from "../../google/api/annotations_pb"; -import { file_google_api_client } from "../../google/api/client_pb"; -import { file_google_api_field_behavior } from "../../google/api/field_behavior_pb"; -import { file_google_api_resource } from "../../google/api/resource_pb"; -import type { EmptySchema, FieldMask } from "@bufbuild/protobuf/wkt"; -import { file_google_protobuf_empty, file_google_protobuf_field_mask } from "@bufbuild/protobuf/wkt"; -import type { Message } from "@bufbuild/protobuf"; - -/** - * Describes the file api/v1/idp_service.proto. - */ -export const file_api_v1_idp_service: GenFile = /*@__PURE__*/ - fileDesc("ChhhcGkvdjEvaWRwX3NlcnZpY2UucHJvdG8SDG1lbW9zLmFwaS52MSLfAgoQSWRlbnRpdHlQcm92aWRlchIRCgRuYW1lGAEgASgJQgPgQQgSNgoEdHlwZRgCIAEoDjIjLm1lbW9zLmFwaS52MS5JZGVudGl0eVByb3ZpZGVyLlR5cGVCA+BBAhISCgV0aXRsZRgDIAEoCUID4EECEh4KEWlkZW50aWZpZXJfZmlsdGVyGAQgASgJQgPgQQESOQoGY29uZmlnGAUgASgLMiQubWVtb3MuYXBpLnYxLklkZW50aXR5UHJvdmlkZXJDb25maWdCA+BBAiIoCgRUeXBlEhQKEFRZUEVfVU5TUEVDSUZJRUQQABIKCgZPQVVUSDIQATpn6kFkCh1tZW1vcy5hcGkudjEvSWRlbnRpdHlQcm92aWRlchIYaWRlbnRpdHktcHJvdmlkZXJzL3tpZHB9GgRuYW1lKhFpZGVudGl0eVByb3ZpZGVyczIQaWRlbnRpdHlQcm92aWRlciJXChZJZGVudGl0eVByb3ZpZGVyQ29uZmlnEjMKDW9hdXRoMl9jb25maWcYASABKAsyGi5tZW1vcy5hcGkudjEuT0F1dGgyQ29uZmlnSABCCAoGY29uZmlnIlsKDEZpZWxkTWFwcGluZxISCgppZGVudGlmaWVyGAEgASgJEhQKDGRpc3BsYXlfbmFtZRgCIAEoCRINCgVlbWFpbBgDIAEoCRISCgphdmF0YXJfdXJsGAQgASgJIrcBCgxPQXV0aDJDb25maWcSEQoJY2xpZW50X2lkGAEgASgJEhUKDWNsaWVudF9zZWNyZXQYAiABKAkSEAoIYXV0aF91cmwYAyABKAkSEQoJdG9rZW5fdXJsGAQgASgJEhUKDXVzZXJfaW5mb191cmwYBSABKAkSDgoGc2NvcGVzGAYgAygJEjEKDWZpZWxkX21hcHBpbmcYByABKAsyGi5tZW1vcy5hcGkudjEuRmllbGRNYXBwaW5nIh4KHExpc3RJZGVudGl0eVByb3ZpZGVyc1JlcXVlc3QiWwodTGlzdElkZW50aXR5UHJvdmlkZXJzUmVzcG9uc2USOgoSaWRlbnRpdHlfcHJvdmlkZXJzGAEgAygLMh4ubWVtb3MuYXBpLnYxLklkZW50aXR5UHJvdmlkZXIiUQoaR2V0SWRlbnRpdHlQcm92aWRlclJlcXVlc3QSMwoEbmFtZRgBIAEoCUIl4EEC+kEfCh1tZW1vcy5hcGkudjEvSWRlbnRpdHlQcm92aWRlciKCAQodQ3JlYXRlSWRlbnRpdHlQcm92aWRlclJlcXVlc3QSPgoRaWRlbnRpdHlfcHJvdmlkZXIYASABKAsyHi5tZW1vcy5hcGkudjEuSWRlbnRpdHlQcm92aWRlckID4EECEiEKFGlkZW50aXR5X3Byb3ZpZGVyX2lkGAIgASgJQgPgQQEilQEKHVVwZGF0ZUlkZW50aXR5UHJvdmlkZXJSZXF1ZXN0Ej4KEWlkZW50aXR5X3Byb3ZpZGVyGAEgASgLMh4ubWVtb3MuYXBpLnYxLklkZW50aXR5UHJvdmlkZXJCA+BBAhI0Cgt1cGRhdGVfbWFzaxgCIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5GaWVsZE1hc2tCA+BBAiJUCh1EZWxldGVJZGVudGl0eVByb3ZpZGVyUmVxdWVzdBIzCgRuYW1lGAEgASgJQiXgQQL6QR8KHW1lbW9zLmFwaS52MS9JZGVudGl0eVByb3ZpZGVyMucGChdJZGVudGl0eVByb3ZpZGVyU2VydmljZRKUAQoVTGlzdElkZW50aXR5UHJvdmlkZXJzEioubWVtb3MuYXBpLnYxLkxpc3RJZGVudGl0eVByb3ZpZGVyc1JlcXVlc3QaKy5tZW1vcy5hcGkudjEuTGlzdElkZW50aXR5UHJvdmlkZXJzUmVzcG9uc2UiIoLT5JMCHBIaL2FwaS92MS9pZGVudGl0eS1wcm92aWRlcnMSkwEKE0dldElkZW50aXR5UHJvdmlkZXISKC5tZW1vcy5hcGkudjEuR2V0SWRlbnRpdHlQcm92aWRlclJlcXVlc3QaHi5tZW1vcy5hcGkudjEuSWRlbnRpdHlQcm92aWRlciIy2kEEbmFtZYLT5JMCJRIjL2FwaS92MS97bmFtZT1pZGVudGl0eS1wcm92aWRlcnMvKn0SsAEKFkNyZWF0ZUlkZW50aXR5UHJvdmlkZXISKy5tZW1vcy5hcGkudjEuQ3JlYXRlSWRlbnRpdHlQcm92aWRlclJlcXVlc3QaHi5tZW1vcy5hcGkudjEuSWRlbnRpdHlQcm92aWRlciJJ2kERaWRlbnRpdHlfcHJvdmlkZXKC0+STAi86EWlkZW50aXR5X3Byb3ZpZGVyIhovYXBpL3YxL2lkZW50aXR5LXByb3ZpZGVycxLXAQoWVXBkYXRlSWRlbnRpdHlQcm92aWRlchIrLm1lbW9zLmFwaS52MS5VcGRhdGVJZGVudGl0eVByb3ZpZGVyUmVxdWVzdBoeLm1lbW9zLmFwaS52MS5JZGVudGl0eVByb3ZpZGVyInDaQR1pZGVudGl0eV9wcm92aWRlcix1cGRhdGVfbWFza4LT5JMCSjoRaWRlbnRpdHlfcHJvdmlkZXIyNS9hcGkvdjEve2lkZW50aXR5X3Byb3ZpZGVyLm5hbWU9aWRlbnRpdHktcHJvdmlkZXJzLyp9EpEBChZEZWxldGVJZGVudGl0eVByb3ZpZGVyEisubWVtb3MuYXBpLnYxLkRlbGV0ZUlkZW50aXR5UHJvdmlkZXJSZXF1ZXN0GhYuZ29vZ2xlLnByb3RvYnVmLkVtcHR5IjLaQQRuYW1lgtPkkwIlKiMvYXBpL3YxL3tuYW1lPWlkZW50aXR5LXByb3ZpZGVycy8qfUKnAQoQY29tLm1lbW9zLmFwaS52MUIPSWRwU2VydmljZVByb3RvUAFaMGdpdGh1Yi5jb20vdXNlbWVtb3MvbWVtb3MvcHJvdG8vZ2VuL2FwaS92MTthcGl2MaICA01BWKoCDE1lbW9zLkFwaS5WMcoCDE1lbW9zXEFwaVxWMeICGE1lbW9zXEFwaVxWMVxHUEJNZXRhZGF0YeoCDk1lbW9zOjpBcGk6OlYxYgZwcm90bzM", [file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_empty, file_google_protobuf_field_mask]); - -/** - * @generated from message memos.api.v1.IdentityProvider - */ -export type IdentityProvider = Message<"memos.api.v1.IdentityProvider"> & { - /** - * The resource name of the identity provider. - * Format: identity-providers/{idp} - * - * @generated from field: string name = 1; - */ - name: string; - - /** - * Required. The type of the identity provider. - * - * @generated from field: memos.api.v1.IdentityProvider.Type type = 2; - */ - type: IdentityProvider_Type; - - /** - * Required. The display title of the identity provider. - * - * @generated from field: string title = 3; - */ - title: string; - - /** - * Optional. Filter applied to user identifiers. - * - * @generated from field: string identifier_filter = 4; - */ - identifierFilter: string; - - /** - * Required. Configuration for the identity provider. - * - * @generated from field: memos.api.v1.IdentityProviderConfig config = 5; - */ - config?: IdentityProviderConfig | undefined; -}; - -/** - * Describes the message memos.api.v1.IdentityProvider. - * Use `create(IdentityProviderSchema)` to create a new message. - */ -export const IdentityProviderSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_idp_service, 0); - -/** - * @generated from enum memos.api.v1.IdentityProvider.Type - */ -export enum IdentityProvider_Type { - /** - * @generated from enum value: TYPE_UNSPECIFIED = 0; - */ - TYPE_UNSPECIFIED = 0, - - /** - * OAuth2 identity provider. - * - * @generated from enum value: OAUTH2 = 1; - */ - OAUTH2 = 1, -} - -/** - * Describes the enum memos.api.v1.IdentityProvider.Type. - */ -export const IdentityProvider_TypeSchema: GenEnum = /*@__PURE__*/ - enumDesc(file_api_v1_idp_service, 0, 0); - -/** - * @generated from message memos.api.v1.IdentityProviderConfig - */ -export type IdentityProviderConfig = Message<"memos.api.v1.IdentityProviderConfig"> & { - /** - * @generated from oneof memos.api.v1.IdentityProviderConfig.config - */ - config: { - /** - * @generated from field: memos.api.v1.OAuth2Config oauth2_config = 1; - */ - value: OAuth2Config; - case: "oauth2Config"; - } | { case: undefined; value?: undefined }; -}; - -/** - * Describes the message memos.api.v1.IdentityProviderConfig. - * Use `create(IdentityProviderConfigSchema)` to create a new message. - */ -export const IdentityProviderConfigSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_idp_service, 1); - -/** - * @generated from message memos.api.v1.FieldMapping - */ -export type FieldMapping = Message<"memos.api.v1.FieldMapping"> & { - /** - * @generated from field: string identifier = 1; - */ - identifier: string; - - /** - * @generated from field: string display_name = 2; - */ - displayName: string; - - /** - * @generated from field: string email = 3; - */ - email: string; - - /** - * @generated from field: string avatar_url = 4; - */ - avatarUrl: string; -}; - -/** - * Describes the message memos.api.v1.FieldMapping. - * Use `create(FieldMappingSchema)` to create a new message. - */ -export const FieldMappingSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_idp_service, 2); - -/** - * @generated from message memos.api.v1.OAuth2Config - */ -export type OAuth2Config = Message<"memos.api.v1.OAuth2Config"> & { - /** - * @generated from field: string client_id = 1; - */ - clientId: string; - - /** - * @generated from field: string client_secret = 2; - */ - clientSecret: string; - - /** - * @generated from field: string auth_url = 3; - */ - authUrl: string; - - /** - * @generated from field: string token_url = 4; - */ - tokenUrl: string; - - /** - * @generated from field: string user_info_url = 5; - */ - userInfoUrl: string; - - /** - * @generated from field: repeated string scopes = 6; - */ - scopes: string[]; - - /** - * @generated from field: memos.api.v1.FieldMapping field_mapping = 7; - */ - fieldMapping?: FieldMapping | undefined; -}; - -/** - * Describes the message memos.api.v1.OAuth2Config. - * Use `create(OAuth2ConfigSchema)` to create a new message. - */ -export const OAuth2ConfigSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_idp_service, 3); - -/** - * @generated from message memos.api.v1.ListIdentityProvidersRequest - */ -export type ListIdentityProvidersRequest = Message<"memos.api.v1.ListIdentityProvidersRequest"> & { -}; - -/** - * Describes the message memos.api.v1.ListIdentityProvidersRequest. - * Use `create(ListIdentityProvidersRequestSchema)` to create a new message. - */ -export const ListIdentityProvidersRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_idp_service, 4); - -/** - * @generated from message memos.api.v1.ListIdentityProvidersResponse - */ -export type ListIdentityProvidersResponse = Message<"memos.api.v1.ListIdentityProvidersResponse"> & { - /** - * The list of identity providers. - * - * @generated from field: repeated memos.api.v1.IdentityProvider identity_providers = 1; - */ - identityProviders: IdentityProvider[]; -}; - -/** - * Describes the message memos.api.v1.ListIdentityProvidersResponse. - * Use `create(ListIdentityProvidersResponseSchema)` to create a new message. - */ -export const ListIdentityProvidersResponseSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_idp_service, 5); - -/** - * @generated from message memos.api.v1.GetIdentityProviderRequest - */ -export type GetIdentityProviderRequest = Message<"memos.api.v1.GetIdentityProviderRequest"> & { - /** - * Required. The resource name of the identity provider to get. - * Format: identity-providers/{idp} - * - * @generated from field: string name = 1; - */ - name: string; -}; - -/** - * Describes the message memos.api.v1.GetIdentityProviderRequest. - * Use `create(GetIdentityProviderRequestSchema)` to create a new message. - */ -export const GetIdentityProviderRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_idp_service, 6); - -/** - * @generated from message memos.api.v1.CreateIdentityProviderRequest - */ -export type CreateIdentityProviderRequest = Message<"memos.api.v1.CreateIdentityProviderRequest"> & { - /** - * Required. The identity provider to create. - * - * @generated from field: memos.api.v1.IdentityProvider identity_provider = 1; - */ - identityProvider?: IdentityProvider | undefined; - - /** - * Optional. The ID to use for the identity provider, which will become the final component of the resource name. - * If not provided, the system will generate one. - * Format: ^[a-zA-Z0-9]([a-zA-Z0-9-]{0,34}[a-zA-Z0-9])?$ - * - * @generated from field: string identity_provider_id = 2; - */ - identityProviderId: string; -}; - -/** - * Describes the message memos.api.v1.CreateIdentityProviderRequest. - * Use `create(CreateIdentityProviderRequestSchema)` to create a new message. - */ -export const CreateIdentityProviderRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_idp_service, 7); - -/** - * @generated from message memos.api.v1.UpdateIdentityProviderRequest - */ -export type UpdateIdentityProviderRequest = Message<"memos.api.v1.UpdateIdentityProviderRequest"> & { - /** - * Required. The identity provider to update. - * - * @generated from field: memos.api.v1.IdentityProvider identity_provider = 1; - */ - identityProvider?: IdentityProvider | undefined; - - /** - * Required. The update mask applies to the resource. Only the top level fields of - * IdentityProvider are supported. - * - * @generated from field: google.protobuf.FieldMask update_mask = 2; - */ - updateMask?: FieldMask | undefined; -}; - -/** - * Describes the message memos.api.v1.UpdateIdentityProviderRequest. - * Use `create(UpdateIdentityProviderRequestSchema)` to create a new message. - */ -export const UpdateIdentityProviderRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_idp_service, 8); - -/** - * @generated from message memos.api.v1.DeleteIdentityProviderRequest - */ -export type DeleteIdentityProviderRequest = Message<"memos.api.v1.DeleteIdentityProviderRequest"> & { - /** - * Required. The resource name of the identity provider to delete. - * Format: identity-providers/{idp} - * - * @generated from field: string name = 1; - */ - name: string; -}; - -/** - * Describes the message memos.api.v1.DeleteIdentityProviderRequest. - * Use `create(DeleteIdentityProviderRequestSchema)` to create a new message. - */ -export const DeleteIdentityProviderRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_idp_service, 9); - -/** - * @generated from service memos.api.v1.IdentityProviderService - */ -export const IdentityProviderService: GenService<{ - /** - * ListIdentityProviders lists identity providers. - * - * @generated from rpc memos.api.v1.IdentityProviderService.ListIdentityProviders - */ - listIdentityProviders: { - methodKind: "unary"; - input: typeof ListIdentityProvidersRequestSchema; - output: typeof ListIdentityProvidersResponseSchema; - }, - /** - * GetIdentityProvider gets an identity provider. - * - * @generated from rpc memos.api.v1.IdentityProviderService.GetIdentityProvider - */ - getIdentityProvider: { - methodKind: "unary"; - input: typeof GetIdentityProviderRequestSchema; - output: typeof IdentityProviderSchema; - }, - /** - * CreateIdentityProvider creates an identity provider. - * - * @generated from rpc memos.api.v1.IdentityProviderService.CreateIdentityProvider - */ - createIdentityProvider: { - methodKind: "unary"; - input: typeof CreateIdentityProviderRequestSchema; - output: typeof IdentityProviderSchema; - }, - /** - * UpdateIdentityProvider updates an identity provider. - * - * @generated from rpc memos.api.v1.IdentityProviderService.UpdateIdentityProvider - */ - updateIdentityProvider: { - methodKind: "unary"; - input: typeof UpdateIdentityProviderRequestSchema; - output: typeof IdentityProviderSchema; - }, - /** - * DeleteIdentityProvider deletes an identity provider. - * - * @generated from rpc memos.api.v1.IdentityProviderService.DeleteIdentityProvider - */ - deleteIdentityProvider: { - methodKind: "unary"; - input: typeof DeleteIdentityProviderRequestSchema; - output: typeof EmptySchema; - }, -}> = /*@__PURE__*/ - serviceDesc(file_api_v1_idp_service, 0); - diff --git a/web/src/types/proto/api/v1/instance_service_pb.ts b/web/src/types/proto/api/v1/instance_service_pb.ts deleted file mode 100644 index 963a6354d..000000000 --- a/web/src/types/proto/api/v1/instance_service_pb.ts +++ /dev/null @@ -1,1306 +0,0 @@ -// @generated by protoc-gen-es v2.12.1 with parameter "target=ts" -// @generated from file api/v1/instance_service.proto (package memos.api.v1, syntax proto3) -/* eslint-disable */ - -import type { GenEnum, GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv2"; -import { enumDesc, fileDesc, messageDesc, serviceDesc } from "@bufbuild/protobuf/codegenv2"; -import type { User } from "./user_service_pb"; -import { file_api_v1_user_service } from "./user_service_pb"; -import { file_google_api_annotations } from "../../google/api/annotations_pb"; -import { file_google_api_client } from "../../google/api/client_pb"; -import { file_google_api_field_behavior } from "../../google/api/field_behavior_pb"; -import { file_google_api_resource } from "../../google/api/resource_pb"; -import type { EmptySchema, FieldMask, Timestamp } from "@bufbuild/protobuf/wkt"; -import { file_google_protobuf_empty, file_google_protobuf_field_mask, file_google_protobuf_timestamp } from "@bufbuild/protobuf/wkt"; -import type { Color } from "../../google/type/color_pb"; -import { file_google_type_color } from "../../google/type/color_pb"; -import type { Message } from "@bufbuild/protobuf"; - -/** - * Describes the file api/v1/instance_service.proto. - */ -export const file_api_v1_instance_service: GenFile = /*@__PURE__*/ - fileDesc("Ch1hcGkvdjEvaW5zdGFuY2Vfc2VydmljZS5wcm90bxIMbWVtb3MuYXBpLnYxIrICCg9JbnN0YW5jZVByb2ZpbGUSDwoHdmVyc2lvbhgCIAEoCRIMCgRkZW1vGAMgASgIEhQKDGluc3RhbmNlX3VybBgGIAEoCRIhCgVhZG1pbhgHIAEoCzISLm1lbW9zLmFwaS52MS5Vc2VyEg4KBmNvbW1pdBgIIAEoCRITCgtuZWVkc19zZXR1cBgJIAEoCBI1CgthY2Nlc3NfbW9kZRgKIAEoDjIgLm1lbW9zLmFwaS52MS5JbnN0YW5jZUFjY2Vzc01vZGUSOgoJY2hhbGxlbmdlGAsgASgLMicubWVtb3MuYXBpLnYxLkluc3RhbmNlUHJvZmlsZS5DaGFsbGVuZ2UaLwoJQ2hhbGxlbmdlEhAKCHByb3ZpZGVyGAEgASgJEhAKCHNpdGVfa2V5GAIgASgJIhsKGUdldEluc3RhbmNlUHJvZmlsZVJlcXVlc3QikRsKD0luc3RhbmNlU2V0dGluZxIRCgRuYW1lGAEgASgJQgPgQQgSRwoPZ2VuZXJhbF9zZXR0aW5nGAIgASgLMiwubWVtb3MuYXBpLnYxLkluc3RhbmNlU2V0dGluZy5HZW5lcmFsU2V0dGluZ0gAEkcKD3N0b3JhZ2Vfc2V0dGluZxgDIAEoCzIsLm1lbW9zLmFwaS52MS5JbnN0YW5jZVNldHRpbmcuU3RvcmFnZVNldHRpbmdIABJQChRtZW1vX3JlbGF0ZWRfc2V0dGluZxgEIAEoCzIwLm1lbW9zLmFwaS52MS5JbnN0YW5jZVNldHRpbmcuTWVtb1JlbGF0ZWRTZXR0aW5nSAASQQoMdGFnc19zZXR0aW5nGAUgASgLMikubWVtb3MuYXBpLnYxLkluc3RhbmNlU2V0dGluZy5UYWdzU2V0dGluZ0gAElEKFG5vdGlmaWNhdGlvbl9zZXR0aW5nGAYgASgLMjEubWVtb3MuYXBpLnYxLkluc3RhbmNlU2V0dGluZy5Ob3RpZmljYXRpb25TZXR0aW5nSAASPQoKYWlfc2V0dGluZxgHIAEoCzInLm1lbW9zLmFwaS52MS5JbnN0YW5jZVNldHRpbmcuQUlTZXR0aW5nSAASRQoOYWNjZXNzX3NldHRpbmcYCCABKAsyKy5tZW1vcy5hcGkudjEuSW5zdGFuY2VTZXR0aW5nLkFjY2Vzc1NldHRpbmdIABqHAwoOR2VuZXJhbFNldHRpbmcSIgoaZGlzYWxsb3dfdXNlcl9yZWdpc3RyYXRpb24YAiABKAgSHgoWZGlzYWxsb3dfcGFzc3dvcmRfYXV0aBgDIAEoCBIZChFhZGRpdGlvbmFsX3NjcmlwdBgEIAEoCRIYChBhZGRpdGlvbmFsX3N0eWxlGAUgASgJElIKDmN1c3RvbV9wcm9maWxlGAYgASgLMjoubWVtb3MuYXBpLnYxLkluc3RhbmNlU2V0dGluZy5HZW5lcmFsU2V0dGluZy5DdXN0b21Qcm9maWxlEh0KFXdlZWtfc3RhcnRfZGF5X29mZnNldBgHIAEoBRIgChhkaXNhbGxvd19jaGFuZ2VfdXNlcm5hbWUYCCABKAgSIAoYZGlzYWxsb3dfY2hhbmdlX25pY2tuYW1lGAkgASgIGkUKDUN1c3RvbVByb2ZpbGUSDQoFdGl0bGUYASABKAkSEwoLZGVzY3JpcHRpb24YAiABKAkSEAoIbG9nb191cmwYAyABKAka2wIKB1N0b3JhZ2USCgoCaWQYASABKAkSDAoEbmFtZRgCIAEoCRI3CgR0eXBlGAMgASgOMikubWVtb3MuYXBpLnYxLkluc3RhbmNlU2V0dGluZy5TdG9yYWdlVHlwZRJDCglzM19jb25maWcYCiABKAsyLi5tZW1vcy5hcGkudjEuSW5zdGFuY2VTZXR0aW5nLlN0b3JhZ2UuUzNDb25maWdIABqtAQoIUzNDb25maWcSFQoNYWNjZXNzX2tleV9pZBgBIAEoCRIeChFhY2Nlc3Nfa2V5X3NlY3JldBgCIAEoCUID4EEEEhAKCGVuZHBvaW50GAMgASgJEg4KBnJlZ2lvbhgEIAEoCRIOCgZidWNrZXQYBSABKAkSFgoOdXNlX3BhdGhfc3R5bGUYBiABKAgSIAoYaW5zZWN1cmVfc2tpcF90bHNfdmVyaWZ5GAcgASgIQggKBmNvbmZpZxq2BAoOU3RvcmFnZVNldHRpbmcSTgoMc3RvcmFnZV90eXBlGAEgASgOMjgubWVtb3MuYXBpLnYxLkluc3RhbmNlU2V0dGluZy5TdG9yYWdlU2V0dGluZy5TdG9yYWdlVHlwZRIZChFmaWxlcGF0aF90ZW1wbGF0ZRgCIAEoCRIcChR1cGxvYWRfc2l6ZV9saW1pdF9tYhgDIAEoAxJICglzM19jb25maWcYBCABKAsyNS5tZW1vcy5hcGkudjEuSW5zdGFuY2VTZXR0aW5nLlN0b3JhZ2VTZXR0aW5nLlMzQ29uZmlnEjcKCHN0b3JhZ2VzGAUgAygLMiUubWVtb3MuYXBpLnYxLkluc3RhbmNlU2V0dGluZy5TdG9yYWdlEhoKEmRlZmF1bHRfc3RvcmFnZV9pZBgGIAEoCRqtAQoIUzNDb25maWcSFQoNYWNjZXNzX2tleV9pZBgBIAEoCRIeChFhY2Nlc3Nfa2V5X3NlY3JldBgCIAEoCUID4EEEEhAKCGVuZHBvaW50GAMgASgJEg4KBnJlZ2lvbhgEIAEoCRIOCgZidWNrZXQYBSABKAkSFgoOdXNlX3BhdGhfc3R5bGUYBiABKAgSIAoYaW5zZWN1cmVfc2tpcF90bHNfdmVyaWZ5GAcgASgIIkwKC1N0b3JhZ2VUeXBlEhwKGFNUT1JBR0VfVFlQRV9VTlNQRUNJRklFRBAAEgwKCERBVEFCQVNFEAESCQoFTE9DQUwQAhIGCgJTMxADGocBChJNZW1vUmVsYXRlZFNldHRpbmcSHAoUY29udGVudF9sZW5ndGhfbGltaXQYAyABKAUSIAoYZW5hYmxlX2RvdWJsZV9jbGlja19lZGl0GAQgASgIEhEKCXJlYWN0aW9ucxgHIAMoCUoECAIQA1IYZGlzcGxheV93aXRoX3VwZGF0ZV90aW1lGlEKC1RhZ01ldGFkYXRhEiwKEGJhY2tncm91bmRfY29sb3IYASABKAsyEi5nb29nbGUudHlwZS5Db2xvchIUCgxibHVyX2NvbnRlbnQYAiABKAgaqAEKC1RhZ3NTZXR0aW5nEkEKBHRhZ3MYASADKAsyMy5tZW1vcy5hcGkudjEuSW5zdGFuY2VTZXR0aW5nLlRhZ3NTZXR0aW5nLlRhZ3NFbnRyeRpWCglUYWdzRW50cnkSCwoDa2V5GAEgASgJEjgKBXZhbHVlGAIgASgLMikubWVtb3MuYXBpLnYxLkluc3RhbmNlU2V0dGluZy5UYWdNZXRhZGF0YToCOAEaugIKE05vdGlmaWNhdGlvblNldHRpbmcSTQoFZW1haWwYASABKAsyPi5tZW1vcy5hcGkudjEuSW5zdGFuY2VTZXR0aW5nLk5vdGlmaWNhdGlvblNldHRpbmcuRW1haWxTZXR0aW5nGtMBCgxFbWFpbFNldHRpbmcSDwoHZW5hYmxlZBgBIAEoCBIRCglzbXRwX2hvc3QYAiABKAkSEQoJc210cF9wb3J0GAMgASgFEhUKDXNtdHBfdXNlcm5hbWUYBCABKAkSGgoNc210cF9wYXNzd29yZBgFIAEoCUID4EEEEhIKCmZyb21fZW1haWwYBiABKAkSEQoJZnJvbV9uYW1lGAcgASgJEhAKCHJlcGx5X3RvGAggASgJEg8KB3VzZV90bHMYCSABKAgSDwoHdXNlX3NzbBgKIAEoCBqYAQoJQUlTZXR0aW5nEkEKCXByb3ZpZGVycxgBIAMoCzIuLm1lbW9zLmFwaS52MS5JbnN0YW5jZVNldHRpbmcuQUlQcm92aWRlckNvbmZpZxJICg10cmFuc2NyaXB0aW9uGAIgASgLMjEubWVtb3MuYXBpLnYxLkluc3RhbmNlU2V0dGluZy5UcmFuc2NyaXB0aW9uQ29uZmlnGsYBChBBSVByb3ZpZGVyQ29uZmlnEgoKAmlkGAEgASgJEg0KBXRpdGxlGAIgASgJEjoKBHR5cGUYAyABKA4yLC5tZW1vcy5hcGkudjEuSW5zdGFuY2VTZXR0aW5nLkFJUHJvdmlkZXJUeXBlEhAKCGVuZHBvaW50GAQgASgJEhQKB2FwaV9rZXkYBSABKAlCA+BBBBIYCgthcGlfa2V5X3NldBgIIAEoCEID4EEDEhkKDGFwaV9rZXlfaGludBgJIAEoCUID4EEDGlsKE1RyYW5zY3JpcHRpb25Db25maWcSEwoLcHJvdmlkZXJfaWQYASABKAkSDQoFbW9kZWwYAiABKAkSEAoIbGFuZ3VhZ2UYAyABKAkSDgoGcHJvbXB0GAQgASgJGkYKDUFjY2Vzc1NldHRpbmcSNQoLYWNjZXNzX21vZGUYASABKA4yIC5tZW1vcy5hcGkudjEuSW5zdGFuY2VBY2Nlc3NNb2RlInYKA0tleRITCg9LRVlfVU5TUEVDSUZJRUQQABILCgdHRU5FUkFMEAESCwoHU1RPUkFHRRACEhAKDE1FTU9fUkVMQVRFRBADEggKBFRBR1MQBBIQCgxOT1RJRklDQVRJT04QBRIGCgJBSRAGEgoKBkFDQ0VTUxAHIkwKC1N0b3JhZ2VUeXBlEhwKGFNUT1JBR0VfVFlQRV9VTlNQRUNJRklFRBAAEgwKCERBVEFCQVNFEAESCQoFTE9DQUwQAhIGCgJTMxADIkoKDkFJUHJvdmlkZXJUeXBlEiAKHEFJX1BST1ZJREVSX1RZUEVfVU5TUEVDSUZJRUQQABIKCgZPUEVOQUkQARIKCgZHRU1JTkkQAjph6kFeChxtZW1vcy5hcGkudjEvSW5zdGFuY2VTZXR0aW5nEhtpbnN0YW5jZS9zZXR0aW5ncy97c2V0dGluZ30qEGluc3RhbmNlU2V0dGluZ3MyD2luc3RhbmNlU2V0dGluZ0IHCgV2YWx1ZSJPChlHZXRJbnN0YW5jZVNldHRpbmdSZXF1ZXN0EjIKBG5hbWUYASABKAlCJOBBAvpBHgocbWVtb3MuYXBpLnYxL0luc3RhbmNlU2V0dGluZyJWCh9CYXRjaEdldEluc3RhbmNlU2V0dGluZ3NSZXF1ZXN0EjMKBW5hbWVzGAEgAygJQiTgQQL6QR4KHG1lbW9zLmFwaS52MS9JbnN0YW5jZVNldHRpbmciUwogQmF0Y2hHZXRJbnN0YW5jZVNldHRpbmdzUmVzcG9uc2USLwoIc2V0dGluZ3MYASADKAsyHS5tZW1vcy5hcGkudjEuSW5zdGFuY2VTZXR0aW5nIokBChxVcGRhdGVJbnN0YW5jZVNldHRpbmdSZXF1ZXN0EjMKB3NldHRpbmcYASABKAsyHS5tZW1vcy5hcGkudjEuSW5zdGFuY2VTZXR0aW5nQgPgQQISNAoLdXBkYXRlX21hc2sYAiABKAsyGi5nb29nbGUucHJvdG9idWYuRmllbGRNYXNrQgPgQQEikwEKH1Rlc3RJbnN0YW5jZUVtYWlsU2V0dGluZ1JlcXVlc3QSUgoFZW1haWwYASABKAsyPi5tZW1vcy5hcGkudjEuSW5zdGFuY2VTZXR0aW5nLk5vdGlmaWNhdGlvblNldHRpbmcuRW1haWxTZXR0aW5nQgPgQQESHAoPcmVjaXBpZW50X2VtYWlsGAIgASgJQgPgQQEiGQoXR2V0SW5zdGFuY2VTdGF0c1JlcXVlc3Qi0gEKDUluc3RhbmNlU3RhdHMSOwoIZGF0YWJhc2UYASABKAsyKS5tZW1vcy5hcGkudjEuSW5zdGFuY2VTdGF0cy5EYXRhYmFzZVN0YXRzEhsKE2xvY2FsX3N0b3JhZ2VfYnl0ZXMYAiABKAMSMgoOZ2VuZXJhdGVkX3RpbWUYBCABKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wGjMKDURhdGFiYXNlU3RhdHMSDgoGZHJpdmVyGAEgASgJEhIKCnNpemVfYnl0ZXMYAiABKAMqfQoSSW5zdGFuY2VBY2Nlc3NNb2RlEiQKIElOU1RBTkNFX0FDQ0VTU19NT0RFX1VOU1BFQ0lGSUVEEAASIAocSU5TVEFOQ0VfQUNDRVNTX01PREVfUFJJVkFURRABEh8KG0lOU1RBTkNFX0FDQ0VTU19NT0RFX1BVQkxJQxACMp8HCg9JbnN0YW5jZVNlcnZpY2USfgoSR2V0SW5zdGFuY2VQcm9maWxlEicubWVtb3MuYXBpLnYxLkdldEluc3RhbmNlUHJvZmlsZVJlcXVlc3QaHS5tZW1vcy5hcGkudjEuSW5zdGFuY2VQcm9maWxlIiCC0+STAhoSGC9hcGkvdjEvaW5zdGFuY2UvcHJvZmlsZRKPAQoSR2V0SW5zdGFuY2VTZXR0aW5nEicubWVtb3MuYXBpLnYxLkdldEluc3RhbmNlU2V0dGluZ1JlcXVlc3QaHS5tZW1vcy5hcGkudjEuSW5zdGFuY2VTZXR0aW5nIjHaQQRuYW1lgtPkkwIkEiIvYXBpL3YxL3tuYW1lPWluc3RhbmNlL3NldHRpbmdzLyp9EqgBChhCYXRjaEdldEluc3RhbmNlU2V0dGluZ3MSLS5tZW1vcy5hcGkudjEuQmF0Y2hHZXRJbnN0YW5jZVNldHRpbmdzUmVxdWVzdBouLm1lbW9zLmFwaS52MS5CYXRjaEdldEluc3RhbmNlU2V0dGluZ3NSZXNwb25zZSItgtPkkwInOgEqIiIvYXBpL3YxL2luc3RhbmNlL3NldHRpbmdzOmJhdGNoR2V0ErUBChVVcGRhdGVJbnN0YW5jZVNldHRpbmcSKi5tZW1vcy5hcGkudjEuVXBkYXRlSW5zdGFuY2VTZXR0aW5nUmVxdWVzdBodLm1lbW9zLmFwaS52MS5JbnN0YW5jZVNldHRpbmciUdpBE3NldHRpbmcsdXBkYXRlX21hc2uC0+STAjU6B3NldHRpbmcyKi9hcGkvdjEve3NldHRpbmcubmFtZT1pbnN0YW5jZS9zZXR0aW5ncy8qfRKeAQoYVGVzdEluc3RhbmNlRW1haWxTZXR0aW5nEi0ubWVtb3MuYXBpLnYxLlRlc3RJbnN0YW5jZUVtYWlsU2V0dGluZ1JlcXVlc3QaFi5nb29nbGUucHJvdG9idWYuRW1wdHkiO4LT5JMCNToBKiIwL2FwaS92MS9pbnN0YW5jZS9zZXR0aW5ncy9ub3RpZmljYXRpb246dGVzdEVtYWlsEnYKEEdldEluc3RhbmNlU3RhdHMSJS5tZW1vcy5hcGkudjEuR2V0SW5zdGFuY2VTdGF0c1JlcXVlc3QaGy5tZW1vcy5hcGkudjEuSW5zdGFuY2VTdGF0cyIegtPkkwIYEhYvYXBpL3YxL2luc3RhbmNlL3N0YXRzQqwBChBjb20ubWVtb3MuYXBpLnYxQhRJbnN0YW5jZVNlcnZpY2VQcm90b1ABWjBnaXRodWIuY29tL3VzZW1lbW9zL21lbW9zL3Byb3RvL2dlbi9hcGkvdjE7YXBpdjGiAgNNQViqAgxNZW1vcy5BcGkuVjHKAgxNZW1vc1xBcGlcVjHiAhhNZW1vc1xBcGlcVjFcR1BCTWV0YWRhdGHqAg5NZW1vczo6QXBpOjpWMWIGcHJvdG8z", [file_api_v1_user_service, file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_empty, file_google_protobuf_field_mask, file_google_protobuf_timestamp, file_google_type_color]); - -/** - * Instance profile message containing basic instance information. - * - * @generated from message memos.api.v1.InstanceProfile - */ -export type InstanceProfile = Message<"memos.api.v1.InstanceProfile"> & { - /** - * Version is the current version of instance. - * - * @generated from field: string version = 2; - */ - version: string; - - /** - * Demo indicates if the instance is in demo mode. - * - * @generated from field: bool demo = 3; - */ - demo: boolean; - - /** - * Instance URL is the URL of the instance. - * - * @generated from field: string instance_url = 6; - */ - instanceUrl: string; - - /** - * The first administrator who set up this instance, for display purposes. - * May be null on an instance that has lost all admins; use needs_setup to - * determine whether initial setup is actually required. - * - * @generated from field: memos.api.v1.User admin = 7; - */ - admin?: User | undefined; - - /** - * Commit is the current build commit of instance. - * - * @generated from field: string commit = 8; - */ - commit: string; - - /** - * NeedsSetup is true when the instance has no users yet and requires initial - * setup (creating the first admin account). Unlike a null admin, this stays - * false once any user exists, so an instance that has lost its admins is not - * mistaken for a fresh install. - * - * @generated from field: bool needs_setup = 9; - */ - needsSetup: boolean; - - /** - * Access mode controls whether unauthenticated users may access instance content. - * - * @generated from field: memos.api.v1.InstanceAccessMode access_mode = 10; - */ - accessMode: InstanceAccessMode; - - /** - * @generated from field: memos.api.v1.InstanceProfile.Challenge challenge = 11; - */ - challenge?: InstanceProfile_Challenge | undefined; -}; - -/** - * Describes the message memos.api.v1.InstanceProfile. - * Use `create(InstanceProfileSchema)` to create a new message. - */ -export const InstanceProfileSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_instance_service, 0); - -/** - * A proof-of-humanity challenge the deployment requires on signup and - * password sign-in. Absent when none is configured, which is the case on - * every self-hosted instance. - * - * @generated from message memos.api.v1.InstanceProfile.Challenge - */ -export type InstanceProfile_Challenge = Message<"memos.api.v1.InstanceProfile.Challenge"> & { - /** - * The challenge provider, which selects the widget the web app renders. - * - * @generated from field: string provider = 1; - */ - provider: string; - - /** - * The provider's public site key for the widget. - * - * @generated from field: string site_key = 2; - */ - siteKey: string; -}; - -/** - * Describes the message memos.api.v1.InstanceProfile.Challenge. - * Use `create(InstanceProfile_ChallengeSchema)` to create a new message. - */ -export const InstanceProfile_ChallengeSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_instance_service, 0, 0); - -/** - * Request for instance profile. - * - * @generated from message memos.api.v1.GetInstanceProfileRequest - */ -export type GetInstanceProfileRequest = Message<"memos.api.v1.GetInstanceProfileRequest"> & { -}; - -/** - * Describes the message memos.api.v1.GetInstanceProfileRequest. - * Use `create(GetInstanceProfileRequestSchema)` to create a new message. - */ -export const GetInstanceProfileRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_instance_service, 1); - -/** - * An instance setting resource. - * - * @generated from message memos.api.v1.InstanceSetting - */ -export type InstanceSetting = Message<"memos.api.v1.InstanceSetting"> & { - /** - * The name of the instance setting. - * Format: instance/settings/{setting} - * - * @generated from field: string name = 1; - */ - name: string; - - /** - * @generated from oneof memos.api.v1.InstanceSetting.value - */ - value: { - /** - * @generated from field: memos.api.v1.InstanceSetting.GeneralSetting general_setting = 2; - */ - value: InstanceSetting_GeneralSetting; - case: "generalSetting"; - } | { - /** - * @generated from field: memos.api.v1.InstanceSetting.StorageSetting storage_setting = 3; - */ - value: InstanceSetting_StorageSetting; - case: "storageSetting"; - } | { - /** - * @generated from field: memos.api.v1.InstanceSetting.MemoRelatedSetting memo_related_setting = 4; - */ - value: InstanceSetting_MemoRelatedSetting; - case: "memoRelatedSetting"; - } | { - /** - * @generated from field: memos.api.v1.InstanceSetting.TagsSetting tags_setting = 5; - */ - value: InstanceSetting_TagsSetting; - case: "tagsSetting"; - } | { - /** - * @generated from field: memos.api.v1.InstanceSetting.NotificationSetting notification_setting = 6; - */ - value: InstanceSetting_NotificationSetting; - case: "notificationSetting"; - } | { - /** - * @generated from field: memos.api.v1.InstanceSetting.AISetting ai_setting = 7; - */ - value: InstanceSetting_AISetting; - case: "aiSetting"; - } | { - /** - * @generated from field: memos.api.v1.InstanceSetting.AccessSetting access_setting = 8; - */ - value: InstanceSetting_AccessSetting; - case: "accessSetting"; - } | { case: undefined; value?: undefined }; -}; - -/** - * Describes the message memos.api.v1.InstanceSetting. - * Use `create(InstanceSettingSchema)` to create a new message. - */ -export const InstanceSettingSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_instance_service, 2); - -/** - * General instance settings configuration. - * - * @generated from message memos.api.v1.InstanceSetting.GeneralSetting - */ -export type InstanceSetting_GeneralSetting = Message<"memos.api.v1.InstanceSetting.GeneralSetting"> & { - /** - * disallow_user_registration disallows user registration. - * - * @generated from field: bool disallow_user_registration = 2; - */ - disallowUserRegistration: boolean; - - /** - * disallow_password_auth disallows password authentication. - * - * @generated from field: bool disallow_password_auth = 3; - */ - disallowPasswordAuth: boolean; - - /** - * additional_script is the additional script. - * - * @generated from field: string additional_script = 4; - */ - additionalScript: string; - - /** - * additional_style is the additional style. - * - * @generated from field: string additional_style = 5; - */ - additionalStyle: string; - - /** - * custom_profile is the custom profile. - * - * @generated from field: memos.api.v1.InstanceSetting.GeneralSetting.CustomProfile custom_profile = 6; - */ - customProfile?: InstanceSetting_GeneralSetting_CustomProfile | undefined; - - /** - * week_start_day_offset is the week start day offset from Sunday. - * 0: Sunday, 1: Monday, 2: Tuesday, 3: Wednesday, 4: Thursday, 5: Friday, 6: Saturday - * Default is Sunday. - * - * @generated from field: int32 week_start_day_offset = 7; - */ - weekStartDayOffset: number; - - /** - * disallow_change_username disallows changing username. - * - * @generated from field: bool disallow_change_username = 8; - */ - disallowChangeUsername: boolean; - - /** - * disallow_change_nickname disallows changing nickname. - * - * @generated from field: bool disallow_change_nickname = 9; - */ - disallowChangeNickname: boolean; -}; - -/** - * Describes the message memos.api.v1.InstanceSetting.GeneralSetting. - * Use `create(InstanceSetting_GeneralSettingSchema)` to create a new message. - */ -export const InstanceSetting_GeneralSettingSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_instance_service, 2, 0); - -/** - * Custom profile configuration for instance branding. - * - * @generated from message memos.api.v1.InstanceSetting.GeneralSetting.CustomProfile - */ -export type InstanceSetting_GeneralSetting_CustomProfile = Message<"memos.api.v1.InstanceSetting.GeneralSetting.CustomProfile"> & { - /** - * @generated from field: string title = 1; - */ - title: string; - - /** - * @generated from field: string description = 2; - */ - description: string; - - /** - * @generated from field: string logo_url = 3; - */ - logoUrl: string; -}; - -/** - * Describes the message memos.api.v1.InstanceSetting.GeneralSetting.CustomProfile. - * Use `create(InstanceSetting_GeneralSetting_CustomProfileSchema)` to create a new message. - */ -export const InstanceSetting_GeneralSetting_CustomProfileSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_instance_service, 2, 0, 0); - -/** - * Storage is a configured attachment storage instance. - * - * @generated from message memos.api.v1.InstanceSetting.Storage - */ -export type InstanceSetting_Storage = Message<"memos.api.v1.InstanceSetting.Storage"> & { - /** - * id is the stable identifier referenced by attachments. - * - * @generated from field: string id = 1; - */ - id: string; - - /** - * name is the human-readable storage name. - * - * @generated from field: string name = 2; - */ - name: string; - - /** - * @generated from field: memos.api.v1.InstanceSetting.StorageType type = 3; - */ - type: InstanceSetting_StorageType; - - /** - * @generated from oneof memos.api.v1.InstanceSetting.Storage.config - */ - config: { - /** - * @generated from field: memos.api.v1.InstanceSetting.Storage.S3Config s3_config = 10; - */ - value: InstanceSetting_Storage_S3Config; - case: "s3Config"; - } | { case: undefined; value?: undefined }; -}; - -/** - * Describes the message memos.api.v1.InstanceSetting.Storage. - * Use `create(InstanceSetting_StorageSchema)` to create a new message. - */ -export const InstanceSetting_StorageSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_instance_service, 2, 1); - -/** - * S3 configuration for an S3-compatible object store. - * Reference: https://developers.cloudflare.com/r2/examples/aws/aws-sdk-go/ - * - * @generated from message memos.api.v1.InstanceSetting.Storage.S3Config - */ -export type InstanceSetting_Storage_S3Config = Message<"memos.api.v1.InstanceSetting.Storage.S3Config"> & { - /** - * @generated from field: string access_key_id = 1; - */ - accessKeyId: string; - - /** - * @generated from field: string access_key_secret = 2; - */ - accessKeySecret: string; - - /** - * @generated from field: string endpoint = 3; - */ - endpoint: string; - - /** - * @generated from field: string region = 4; - */ - region: string; - - /** - * @generated from field: string bucket = 5; - */ - bucket: string; - - /** - * @generated from field: bool use_path_style = 6; - */ - usePathStyle: boolean; - - /** - * insecure_skip_tls_verify disables TLS certificate verification when connecting - * to the S3 endpoint. Only enable this for trusted endpoints that use a self-signed - * certificate; it removes protection against man-in-the-middle attacks. - * - * @generated from field: bool insecure_skip_tls_verify = 7; - */ - insecureSkipTlsVerify: boolean; -}; - -/** - * Describes the message memos.api.v1.InstanceSetting.Storage.S3Config. - * Use `create(InstanceSetting_Storage_S3ConfigSchema)` to create a new message. - */ -export const InstanceSetting_Storage_S3ConfigSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_instance_service, 2, 1, 0); - -/** - * Storage configuration settings for instance attachments. - * - * @generated from message memos.api.v1.InstanceSetting.StorageSetting - */ -export type InstanceSetting_StorageSetting = Message<"memos.api.v1.InstanceSetting.StorageSetting"> & { - /** - * Legacy compatibility field. New clients use default_storage_id. - * - * @generated from field: memos.api.v1.InstanceSetting.StorageSetting.StorageType storage_type = 1; - */ - storageType: InstanceSetting_StorageSetting_StorageType; - - /** - * The template of file path. - * e.g. assets/{timestamp}_{filename} - * - * @generated from field: string filepath_template = 2; - */ - filepathTemplate: string; - - /** - * The max upload size in megabytes. - * - * @generated from field: int64 upload_size_limit_mb = 3; - */ - uploadSizeLimitMb: bigint; - - /** - * Legacy compatibility field. New clients use storages. - * - * @generated from field: memos.api.v1.InstanceSetting.StorageSetting.S3Config s3_config = 4; - */ - s3Config?: InstanceSetting_StorageSetting_S3Config | undefined; - - /** - * Configured storage instances, including inactive instances referenced by attachments. - * - * @generated from field: repeated memos.api.v1.InstanceSetting.Storage storages = 5; - */ - storages: InstanceSetting_Storage[]; - - /** - * Storage used for new attachments. - * - * @generated from field: string default_storage_id = 6; - */ - defaultStorageId: string; -}; - -/** - * Describes the message memos.api.v1.InstanceSetting.StorageSetting. - * Use `create(InstanceSetting_StorageSettingSchema)` to create a new message. - */ -export const InstanceSetting_StorageSettingSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_instance_service, 2, 2); - -/** - * Legacy S3 configuration retained for compatibility with existing clients. - * Reference: https://developers.cloudflare.com/r2/examples/aws/aws-sdk-go/ - * - * @generated from message memos.api.v1.InstanceSetting.StorageSetting.S3Config - */ -export type InstanceSetting_StorageSetting_S3Config = Message<"memos.api.v1.InstanceSetting.StorageSetting.S3Config"> & { - /** - * @generated from field: string access_key_id = 1; - */ - accessKeyId: string; - - /** - * @generated from field: string access_key_secret = 2; - */ - accessKeySecret: string; - - /** - * @generated from field: string endpoint = 3; - */ - endpoint: string; - - /** - * @generated from field: string region = 4; - */ - region: string; - - /** - * @generated from field: string bucket = 5; - */ - bucket: string; - - /** - * @generated from field: bool use_path_style = 6; - */ - usePathStyle: boolean; - - /** - * insecure_skip_tls_verify disables TLS certificate verification when connecting - * to the S3 endpoint. Only enable this for trusted endpoints that use a self-signed - * certificate; it removes protection against man-in-the-middle attacks. - * - * @generated from field: bool insecure_skip_tls_verify = 7; - */ - insecureSkipTlsVerify: boolean; -}; - -/** - * Describes the message memos.api.v1.InstanceSetting.StorageSetting.S3Config. - * Use `create(InstanceSetting_StorageSetting_S3ConfigSchema)` to create a new message. - */ -export const InstanceSetting_StorageSetting_S3ConfigSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_instance_service, 2, 2, 0); - -/** - * Legacy storage type enum retained for compatibility with existing clients. - * - * @generated from enum memos.api.v1.InstanceSetting.StorageSetting.StorageType - */ -export enum InstanceSetting_StorageSetting_StorageType { - /** - * @generated from enum value: STORAGE_TYPE_UNSPECIFIED = 0; - */ - STORAGE_TYPE_UNSPECIFIED = 0, - - /** - * DATABASE is the database storage type. - * - * @generated from enum value: DATABASE = 1; - */ - DATABASE = 1, - - /** - * LOCAL is the local storage type. - * - * @generated from enum value: LOCAL = 2; - */ - LOCAL = 2, - - /** - * S3 is the S3 storage type. - * - * @generated from enum value: S3 = 3; - */ - S3 = 3, -} - -/** - * Describes the enum memos.api.v1.InstanceSetting.StorageSetting.StorageType. - */ -export const InstanceSetting_StorageSetting_StorageTypeSchema: GenEnum = /*@__PURE__*/ - enumDesc(file_api_v1_instance_service, 2, 2, 0); - -/** - * Memo-related instance settings and policies. - * - * @generated from message memos.api.v1.InstanceSetting.MemoRelatedSetting - */ -export type InstanceSetting_MemoRelatedSetting = Message<"memos.api.v1.InstanceSetting.MemoRelatedSetting"> & { - /** - * content_length_limit is the limit of content length. Unit is byte. - * - * @generated from field: int32 content_length_limit = 3; - */ - contentLengthLimit: number; - - /** - * enable_double_click_edit enables editing on double click. - * - * @generated from field: bool enable_double_click_edit = 4; - */ - enableDoubleClickEdit: boolean; - - /** - * reactions is the list of reactions. - * - * @generated from field: repeated string reactions = 7; - */ - reactions: string[]; -}; - -/** - * Describes the message memos.api.v1.InstanceSetting.MemoRelatedSetting. - * Use `create(InstanceSetting_MemoRelatedSettingSchema)` to create a new message. - */ -export const InstanceSetting_MemoRelatedSettingSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_instance_service, 2, 3); - -/** - * Metadata for a tag. - * - * @generated from message memos.api.v1.InstanceSetting.TagMetadata - */ -export type InstanceSetting_TagMetadata = Message<"memos.api.v1.InstanceSetting.TagMetadata"> & { - /** - * Optional background color for the tag label. - * When unset, the default tag color is used. - * - * @generated from field: google.type.Color background_color = 1; - */ - backgroundColor?: Color | undefined; - - /** - * Whether memos with this tag should have their content blurred. - * - * @generated from field: bool blur_content = 2; - */ - blurContent: boolean; -}; - -/** - * Describes the message memos.api.v1.InstanceSetting.TagMetadata. - * Use `create(InstanceSetting_TagMetadataSchema)` to create a new message. - */ -export const InstanceSetting_TagMetadataSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_instance_service, 2, 4); - -/** - * Tag metadata configuration. - * Active tag metadata is stored in per-user tag settings. - * This message remains for backward compatibility with existing clients and migrations. - * - * @generated from message memos.api.v1.InstanceSetting.TagsSetting - */ -export type InstanceSetting_TagsSetting = Message<"memos.api.v1.InstanceSetting.TagsSetting"> & { - /** - * Map of tag name pattern to tag metadata. - * Each key is treated as an anchored regular expression (^pattern$), - * so a single entry like "project/.*" matches all tags under that prefix. - * Exact tag names are also valid (they are trivially valid regex patterns). - * - * @generated from field: map tags = 1; - */ - tags: { [key: string]: InstanceSetting_TagMetadata }; -}; - -/** - * Describes the message memos.api.v1.InstanceSetting.TagsSetting. - * Use `create(InstanceSetting_TagsSettingSchema)` to create a new message. - */ -export const InstanceSetting_TagsSettingSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_instance_service, 2, 5); - -/** - * Notification transport configuration. - * - * @generated from message memos.api.v1.InstanceSetting.NotificationSetting - */ -export type InstanceSetting_NotificationSetting = Message<"memos.api.v1.InstanceSetting.NotificationSetting"> & { - /** - * @generated from field: memos.api.v1.InstanceSetting.NotificationSetting.EmailSetting email = 1; - */ - email?: InstanceSetting_NotificationSetting_EmailSetting | undefined; -}; - -/** - * Describes the message memos.api.v1.InstanceSetting.NotificationSetting. - * Use `create(InstanceSetting_NotificationSettingSchema)` to create a new message. - */ -export const InstanceSetting_NotificationSettingSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_instance_service, 2, 6); - -/** - * Email delivery configuration for notifications. - * - * @generated from message memos.api.v1.InstanceSetting.NotificationSetting.EmailSetting - */ -export type InstanceSetting_NotificationSetting_EmailSetting = Message<"memos.api.v1.InstanceSetting.NotificationSetting.EmailSetting"> & { - /** - * @generated from field: bool enabled = 1; - */ - enabled: boolean; - - /** - * @generated from field: string smtp_host = 2; - */ - smtpHost: string; - - /** - * @generated from field: int32 smtp_port = 3; - */ - smtpPort: number; - - /** - * @generated from field: string smtp_username = 4; - */ - smtpUsername: string; - - /** - * @generated from field: string smtp_password = 5; - */ - smtpPassword: string; - - /** - * @generated from field: string from_email = 6; - */ - fromEmail: string; - - /** - * @generated from field: string from_name = 7; - */ - fromName: string; - - /** - * @generated from field: string reply_to = 8; - */ - replyTo: string; - - /** - * @generated from field: bool use_tls = 9; - */ - useTls: boolean; - - /** - * @generated from field: bool use_ssl = 10; - */ - useSsl: boolean; -}; - -/** - * Describes the message memos.api.v1.InstanceSetting.NotificationSetting.EmailSetting. - * Use `create(InstanceSetting_NotificationSetting_EmailSettingSchema)` to create a new message. - */ -export const InstanceSetting_NotificationSetting_EmailSettingSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_instance_service, 2, 6, 0); - -/** - * AI provider configuration settings. - * - * @generated from message memos.api.v1.InstanceSetting.AISetting - */ -export type InstanceSetting_AISetting = Message<"memos.api.v1.InstanceSetting.AISetting"> & { - /** - * providers is the list of AI provider configurations available instance-wide. - * - * @generated from field: repeated memos.api.v1.InstanceSetting.AIProviderConfig providers = 1; - */ - providers: InstanceSetting_AIProviderConfig[]; - - /** - * transcription is the speech-to-text feature configuration. - * When unset or transcription.provider_id is empty, transcription is disabled. - * - * @generated from field: memos.api.v1.InstanceSetting.TranscriptionConfig transcription = 2; - */ - transcription?: InstanceSetting_TranscriptionConfig | undefined; -}; - -/** - * Describes the message memos.api.v1.InstanceSetting.AISetting. - * Use `create(InstanceSetting_AISettingSchema)` to create a new message. - */ -export const InstanceSetting_AISettingSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_instance_service, 2, 7); - -/** - * AIProviderConfig represents one callable AI provider connection. - * - * @generated from message memos.api.v1.InstanceSetting.AIProviderConfig - */ -export type InstanceSetting_AIProviderConfig = Message<"memos.api.v1.InstanceSetting.AIProviderConfig"> & { - /** - * @generated from field: string id = 1; - */ - id: string; - - /** - * @generated from field: string title = 2; - */ - title: string; - - /** - * @generated from field: memos.api.v1.InstanceSetting.AIProviderType type = 3; - */ - type: InstanceSetting_AIProviderType; - - /** - * @generated from field: string endpoint = 4; - */ - endpoint: string; - - /** - * api_key is write-only and is never returned by GetInstanceSetting. - * - * @generated from field: string api_key = 5; - */ - apiKey: string; - - /** - * api_key_set indicates whether an API key is stored for this provider. - * - * @generated from field: bool api_key_set = 8; - */ - apiKeySet: boolean; - - /** - * api_key_hint is a masked hint for the stored API key. - * - * @generated from field: string api_key_hint = 9; - */ - apiKeyHint: string; -}; - -/** - * Describes the message memos.api.v1.InstanceSetting.AIProviderConfig. - * Use `create(InstanceSetting_AIProviderConfigSchema)` to create a new message. - */ -export const InstanceSetting_AIProviderConfigSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_instance_service, 2, 8); - -/** - * TranscriptionConfig configures the speech-to-text feature. - * - * @generated from message memos.api.v1.InstanceSetting.TranscriptionConfig - */ -export type InstanceSetting_TranscriptionConfig = Message<"memos.api.v1.InstanceSetting.TranscriptionConfig"> & { - /** - * provider_id references an entry in AISetting.providers[].id. - * Empty string means transcription is disabled. - * - * @generated from field: string provider_id = 1; - */ - providerId: string; - - /** - * model is the provider-specific model identifier. - * Empty string falls back to the engine default - * (whisper-1 for OPENAI providers, gemini-2.5-flash for GEMINI providers). - * - * @generated from field: string model = 2; - */ - model: string; - - /** - * language is the default ISO 639-1 language hint sent to the provider. - * Empty string lets the provider auto-detect. - * - * @generated from field: string language = 3; - */ - language: string; - - /** - * prompt is a default spelling/vocabulary hint passed to the provider. - * - * @generated from field: string prompt = 4; - */ - prompt: string; -}; - -/** - * Describes the message memos.api.v1.InstanceSetting.TranscriptionConfig. - * Use `create(InstanceSetting_TranscriptionConfigSchema)` to create a new message. - */ -export const InstanceSetting_TranscriptionConfigSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_instance_service, 2, 9); - -/** - * Access policy configuration for the instance. - * - * @generated from message memos.api.v1.InstanceSetting.AccessSetting - */ -export type InstanceSetting_AccessSetting = Message<"memos.api.v1.InstanceSetting.AccessSetting"> & { - /** - * @generated from field: memos.api.v1.InstanceAccessMode access_mode = 1; - */ - accessMode: InstanceAccessMode; -}; - -/** - * Describes the message memos.api.v1.InstanceSetting.AccessSetting. - * Use `create(InstanceSetting_AccessSettingSchema)` to create a new message. - */ -export const InstanceSetting_AccessSettingSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_instance_service, 2, 10); - -/** - * Enumeration of instance setting keys. - * - * @generated from enum memos.api.v1.InstanceSetting.Key - */ -export enum InstanceSetting_Key { - /** - * @generated from enum value: KEY_UNSPECIFIED = 0; - */ - KEY_UNSPECIFIED = 0, - - /** - * GENERAL is the key for general settings. - * - * @generated from enum value: GENERAL = 1; - */ - GENERAL = 1, - - /** - * STORAGE is the key for storage settings. - * - * @generated from enum value: STORAGE = 2; - */ - STORAGE = 2, - - /** - * MEMO_RELATED is the key for memo related settings. - * - * @generated from enum value: MEMO_RELATED = 3; - */ - MEMO_RELATED = 3, - - /** - * TAGS is the key for tag metadata. - * - * @generated from enum value: TAGS = 4; - */ - TAGS = 4, - - /** - * NOTIFICATION is the key for notification transport settings. - * - * @generated from enum value: NOTIFICATION = 5; - */ - NOTIFICATION = 5, - - /** - * AI is the key for AI provider settings. - * - * @generated from enum value: AI = 6; - */ - AI = 6, - - /** - * ACCESS is the key for instance access policy settings. - * - * @generated from enum value: ACCESS = 7; - */ - ACCESS = 7, -} - -/** - * Describes the enum memos.api.v1.InstanceSetting.Key. - */ -export const InstanceSetting_KeySchema: GenEnum = /*@__PURE__*/ - enumDesc(file_api_v1_instance_service, 2, 0); - -/** - * @generated from enum memos.api.v1.InstanceSetting.StorageType - */ -export enum InstanceSetting_StorageType { - /** - * @generated from enum value: STORAGE_TYPE_UNSPECIFIED = 0; - */ - STORAGE_TYPE_UNSPECIFIED = 0, - - /** - * DATABASE stores attachment content in the application database. - * - * @generated from enum value: DATABASE = 1; - */ - DATABASE = 1, - - /** - * LOCAL stores attachment content on the local filesystem. - * - * @generated from enum value: LOCAL = 2; - */ - LOCAL = 2, - - /** - * S3 stores attachment content in an S3-compatible object store. - * - * @generated from enum value: S3 = 3; - */ - S3 = 3, -} - -/** - * Describes the enum memos.api.v1.InstanceSetting.StorageType. - */ -export const InstanceSetting_StorageTypeSchema: GenEnum = /*@__PURE__*/ - enumDesc(file_api_v1_instance_service, 2, 1); - -/** - * AIProviderType is the provider implementation type. - * - * @generated from enum memos.api.v1.InstanceSetting.AIProviderType - */ -export enum InstanceSetting_AIProviderType { - /** - * @generated from enum value: AI_PROVIDER_TYPE_UNSPECIFIED = 0; - */ - AI_PROVIDER_TYPE_UNSPECIFIED = 0, - - /** - * @generated from enum value: OPENAI = 1; - */ - OPENAI = 1, - - /** - * @generated from enum value: GEMINI = 2; - */ - GEMINI = 2, -} - -/** - * Describes the enum memos.api.v1.InstanceSetting.AIProviderType. - */ -export const InstanceSetting_AIProviderTypeSchema: GenEnum = /*@__PURE__*/ - enumDesc(file_api_v1_instance_service, 2, 2); - -/** - * Request message for GetInstanceSetting method. - * - * @generated from message memos.api.v1.GetInstanceSettingRequest - */ -export type GetInstanceSettingRequest = Message<"memos.api.v1.GetInstanceSettingRequest"> & { - /** - * The resource name of the instance setting. - * Format: instance/settings/{setting} - * - * @generated from field: string name = 1; - */ - name: string; -}; - -/** - * Describes the message memos.api.v1.GetInstanceSettingRequest. - * Use `create(GetInstanceSettingRequestSchema)` to create a new message. - */ -export const GetInstanceSettingRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_instance_service, 3); - -/** - * Request message for BatchGetInstanceSettings method. - * - * @generated from message memos.api.v1.BatchGetInstanceSettingsRequest - */ -export type BatchGetInstanceSettingsRequest = Message<"memos.api.v1.BatchGetInstanceSettingsRequest"> & { - /** - * The resource names of the instance settings. - * Format: instance/settings/{setting} - * - * @generated from field: repeated string names = 1; - */ - names: string[]; -}; - -/** - * Describes the message memos.api.v1.BatchGetInstanceSettingsRequest. - * Use `create(BatchGetInstanceSettingsRequestSchema)` to create a new message. - */ -export const BatchGetInstanceSettingsRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_instance_service, 4); - -/** - * Response message for BatchGetInstanceSettings method. - * - * @generated from message memos.api.v1.BatchGetInstanceSettingsResponse - */ -export type BatchGetInstanceSettingsResponse = Message<"memos.api.v1.BatchGetInstanceSettingsResponse"> & { - /** - * The instance settings in the same order as the input names. - * - * @generated from field: repeated memos.api.v1.InstanceSetting settings = 1; - */ - settings: InstanceSetting[]; -}; - -/** - * Describes the message memos.api.v1.BatchGetInstanceSettingsResponse. - * Use `create(BatchGetInstanceSettingsResponseSchema)` to create a new message. - */ -export const BatchGetInstanceSettingsResponseSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_instance_service, 5); - -/** - * Request message for UpdateInstanceSetting method. - * - * @generated from message memos.api.v1.UpdateInstanceSettingRequest - */ -export type UpdateInstanceSettingRequest = Message<"memos.api.v1.UpdateInstanceSettingRequest"> & { - /** - * The instance setting resource which replaces the resource on the server. - * - * @generated from field: memos.api.v1.InstanceSetting setting = 1; - */ - setting?: InstanceSetting | undefined; - - /** - * The list of fields to update. - * - * @generated from field: google.protobuf.FieldMask update_mask = 2; - */ - updateMask?: FieldMask | undefined; -}; - -/** - * Describes the message memos.api.v1.UpdateInstanceSettingRequest. - * Use `create(UpdateInstanceSettingRequestSchema)` to create a new message. - */ -export const UpdateInstanceSettingRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_instance_service, 6); - -/** - * Request message for TestInstanceEmailSetting method. - * - * @generated from message memos.api.v1.TestInstanceEmailSettingRequest - */ -export type TestInstanceEmailSettingRequest = Message<"memos.api.v1.TestInstanceEmailSettingRequest"> & { - /** - * Optional. SMTP email settings to test. If omitted, the stored notification email setting is used. - * - * @generated from field: memos.api.v1.InstanceSetting.NotificationSetting.EmailSetting email = 1; - */ - email?: InstanceSetting_NotificationSetting_EmailSetting | undefined; - - /** - * Optional. Recipient email address. If omitted, the current user's email address is used. - * - * @generated from field: string recipient_email = 2; - */ - recipientEmail: string; -}; - -/** - * Describes the message memos.api.v1.TestInstanceEmailSettingRequest. - * Use `create(TestInstanceEmailSettingRequestSchema)` to create a new message. - */ -export const TestInstanceEmailSettingRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_instance_service, 7); - -/** - * Request message for GetInstanceStats. - * - * @generated from message memos.api.v1.GetInstanceStatsRequest - */ -export type GetInstanceStatsRequest = Message<"memos.api.v1.GetInstanceStatsRequest"> & { -}; - -/** - * Describes the message memos.api.v1.GetInstanceStatsRequest. - * Use `create(GetInstanceStatsRequestSchema)` to create a new message. - */ -export const GetInstanceStatsRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_instance_service, 8); - -/** - * Resource usage statistics for the instance. - * - * @generated from message memos.api.v1.InstanceStats - */ -export type InstanceStats = Message<"memos.api.v1.InstanceStats"> & { - /** - * @generated from field: memos.api.v1.InstanceStats.DatabaseStats database = 1; - */ - database?: InstanceStats_DatabaseStats | undefined; - - /** - * Recursive size of the data directory in bytes. -1 if unavailable. - * - * @generated from field: int64 local_storage_bytes = 2; - */ - localStorageBytes: bigint; - - /** - * Server-side timestamp when the snapshot was generated. - * - * @generated from field: google.protobuf.Timestamp generated_time = 4; - */ - generatedTime?: Timestamp | undefined; -}; - -/** - * Describes the message memos.api.v1.InstanceStats. - * Use `create(InstanceStatsSchema)` to create a new message. - */ -export const InstanceStatsSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_instance_service, 9); - -/** - * Database size statistics. - * - * @generated from message memos.api.v1.InstanceStats.DatabaseStats - */ -export type InstanceStats_DatabaseStats = Message<"memos.api.v1.InstanceStats.DatabaseStats"> & { - /** - * driver is one of "sqlite", "mysql", "postgres". - * - * @generated from field: string driver = 1; - */ - driver: string; - - /** - * size_bytes is the database size in bytes; -1 if unavailable. - * - * @generated from field: int64 size_bytes = 2; - */ - sizeBytes: bigint; -}; - -/** - * Describes the message memos.api.v1.InstanceStats.DatabaseStats. - * Use `create(InstanceStats_DatabaseStatsSchema)` to create a new message. - */ -export const InstanceStats_DatabaseStatsSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_instance_service, 9, 0); - -/** - * InstanceAccessMode controls whether unauthenticated users may access instance content. - * - * @generated from enum memos.api.v1.InstanceAccessMode - */ -export enum InstanceAccessMode { - /** - * @generated from enum value: INSTANCE_ACCESS_MODE_UNSPECIFIED = 0; - */ - UNSPECIFIED = 0, - - /** - * @generated from enum value: INSTANCE_ACCESS_MODE_PRIVATE = 1; - */ - PRIVATE = 1, - - /** - * @generated from enum value: INSTANCE_ACCESS_MODE_PUBLIC = 2; - */ - PUBLIC = 2, -} - -/** - * Describes the enum memos.api.v1.InstanceAccessMode. - */ -export const InstanceAccessModeSchema: GenEnum = /*@__PURE__*/ - enumDesc(file_api_v1_instance_service, 0); - -/** - * @generated from service memos.api.v1.InstanceService - */ -export const InstanceService: GenService<{ - /** - * Gets the instance profile. - * - * @generated from rpc memos.api.v1.InstanceService.GetInstanceProfile - */ - getInstanceProfile: { - methodKind: "unary"; - input: typeof GetInstanceProfileRequestSchema; - output: typeof InstanceProfileSchema; - }, - /** - * Gets an instance setting. - * - * @generated from rpc memos.api.v1.InstanceService.GetInstanceSetting - */ - getInstanceSetting: { - methodKind: "unary"; - input: typeof GetInstanceSettingRequestSchema; - output: typeof InstanceSettingSchema; - }, - /** - * Batch gets instance settings. - * - * @generated from rpc memos.api.v1.InstanceService.BatchGetInstanceSettings - */ - batchGetInstanceSettings: { - methodKind: "unary"; - input: typeof BatchGetInstanceSettingsRequestSchema; - output: typeof BatchGetInstanceSettingsResponseSchema; - }, - /** - * Updates an instance setting. - * - * @generated from rpc memos.api.v1.InstanceService.UpdateInstanceSetting - */ - updateInstanceSetting: { - methodKind: "unary"; - input: typeof UpdateInstanceSettingRequestSchema; - output: typeof InstanceSettingSchema; - }, - /** - * Tests notification email delivery with the provided or stored SMTP settings. - * - * @generated from rpc memos.api.v1.InstanceService.TestInstanceEmailSetting - */ - testInstanceEmailSetting: { - methodKind: "unary"; - input: typeof TestInstanceEmailSettingRequestSchema; - output: typeof EmptySchema; - }, - /** - * GetInstanceStats returns resource usage statistics for the instance. Admin only. - * - * @generated from rpc memos.api.v1.InstanceService.GetInstanceStats - */ - getInstanceStats: { - methodKind: "unary"; - input: typeof GetInstanceStatsRequestSchema; - output: typeof InstanceStatsSchema; - }, -}> = /*@__PURE__*/ - serviceDesc(file_api_v1_instance_service, 0); - diff --git a/web/src/types/proto/api/v1/memo_service_pb.ts b/web/src/types/proto/api/v1/memo_service_pb.ts deleted file mode 100644 index 4955af37d..000000000 --- a/web/src/types/proto/api/v1/memo_service_pb.ts +++ /dev/null @@ -1,1469 +0,0 @@ -// @generated by protoc-gen-es v2.12.1 with parameter "target=ts" -// @generated from file api/v1/memo_service.proto (package memos.api.v1, syntax proto3) -/* eslint-disable */ - -import type { GenEnum, GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv2"; -import { enumDesc, fileDesc, messageDesc, serviceDesc } from "@bufbuild/protobuf/codegenv2"; -import type { Attachment } from "./attachment_service_pb"; -import { file_api_v1_attachment_service } from "./attachment_service_pb"; -import type { State } from "./common_pb"; -import { file_api_v1_common } from "./common_pb"; -import { file_google_api_annotations } from "../../google/api/annotations_pb"; -import { file_google_api_client } from "../../google/api/client_pb"; -import { file_google_api_field_behavior } from "../../google/api/field_behavior_pb"; -import { file_google_api_resource } from "../../google/api/resource_pb"; -import type { EmptySchema, FieldMask, Timestamp } from "@bufbuild/protobuf/wkt"; -import { file_google_protobuf_empty, file_google_protobuf_field_mask, file_google_protobuf_timestamp } from "@bufbuild/protobuf/wkt"; -import type { Message } from "@bufbuild/protobuf"; - -/** - * Describes the file api/v1/memo_service.proto. - */ -export const file_api_v1_memo_service: GenFile = /*@__PURE__*/ - fileDesc("ChlhcGkvdjEvbWVtb19zZXJ2aWNlLnByb3RvEgxtZW1vcy5hcGkudjEiigIKCFJlYWN0aW9uEhQKBG5hbWUYASABKAlCBuBBA+BBCBIqCgdjcmVhdG9yGAIgASgJQhngQQP6QRMKEW1lbW9zLmFwaS52MS9Vc2VyEhoKDXJlYWN0aW9uX3R5cGUYBCABKAlCA+BBAhI0CgtjcmVhdGVfdGltZRgFIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXBCA+BBAzpY6kFVChVtZW1vcy5hcGkudjEvUmVhY3Rpb24SIW1lbW9zL3ttZW1vfS9yZWFjdGlvbnMve3JlYWN0aW9ufRoEbmFtZSoJcmVhY3Rpb25zMghyZWFjdGlvbkoECAMQBFIKY29udGVudF9pZCKkBwoETWVtbxIRCgRuYW1lGAEgASgJQgPgQQgSJwoFc3RhdGUYAiABKA4yEy5tZW1vcy5hcGkudjEuU3RhdGVCA+BBAhIqCgdjcmVhdG9yGAMgASgJQhngQQP6QRMKEW1lbW9zLmFwaS52MS9Vc2VyEjQKC2NyZWF0ZV90aW1lGAQgASgLMhouZ29vZ2xlLnByb3RvYnVmLlRpbWVzdGFtcEID4EEBEjQKC3VwZGF0ZV90aW1lGAUgASgLMhouZ29vZ2xlLnByb3RvYnVmLlRpbWVzdGFtcEID4EEBEhQKB2NvbnRlbnQYByABKAlCA+BBAhIxCgp2aXNpYmlsaXR5GAkgASgOMhgubWVtb3MuYXBpLnYxLlZpc2liaWxpdHlCA+BBAhIRCgR0YWdzGAogAygJQgPgQQMSEwoGcGlubmVkGAsgASgIQgPgQQESMgoLYXR0YWNobWVudHMYDCADKAsyGC5tZW1vcy5hcGkudjEuQXR0YWNobWVudEID4EEBEjIKCXJlbGF0aW9ucxgNIAMoCzIaLm1lbW9zLmFwaS52MS5NZW1vUmVsYXRpb25CA+BBARIuCglyZWFjdGlvbnMYDiADKAsyFi5tZW1vcy5hcGkudjEuUmVhY3Rpb25CA+BBAxIyCghwcm9wZXJ0eRgPIAEoCzIbLm1lbW9zLmFwaS52MS5NZW1vLlByb3BlcnR5QgPgQQMSLgoGcGFyZW50GBAgASgJQhngQQP6QRMKEW1lbW9zLmFwaS52MS9NZW1vSACIAQESFAoHc25pcHBldBgRIAEoCUID4EEDEjIKCGxvY2F0aW9uGBIgASgLMhYubWVtb3MuYXBpLnYxLkxvY2F0aW9uQgPgQQFIAYgBARIuCgVzcGFjZRgTIAEoCUIa4EEB+kEUChJtZW1vcy5hcGkudjEvU3BhY2VIAogBARpyCghQcm9wZXJ0eRIQCghoYXNfbGluaxgBIAEoCBIVCg1oYXNfdGFza19saXN0GAIgASgIEhAKCGhhc19jb2RlGAMgASgIEhwKFGhhc19pbmNvbXBsZXRlX3Rhc2tzGAQgASgIEg0KBXRpdGxlGAUgASgJOjfqQTQKEW1lbW9zLmFwaS52MS9NZW1vEgxtZW1vcy97bWVtb30aBG5hbWUqBW1lbW9zMgRtZW1vQgkKB19wYXJlbnRCCwoJX2xvY2F0aW9uQggKBl9zcGFjZUoECAYQB1IMZGlzcGxheV90aW1lIlMKCExvY2F0aW9uEhgKC3BsYWNlaG9sZGVyGAEgASgJQgPgQQESFQoIbGF0aXR1ZGUYAiABKAFCA+BBARIWCglsb25naXR1ZGUYAyABKAFCA+BBASJQChFDcmVhdGVNZW1vUmVxdWVzdBIlCgRtZW1vGAEgASgLMhIubWVtb3MuYXBpLnYxLk1lbW9CA+BBAhIUCgdtZW1vX2lkGAIgASgJQgPgQQEi0gEKEExpc3RNZW1vc1JlcXVlc3QSFgoJcGFnZV9zaXplGAEgASgFQgPgQQESFwoKcGFnZV90b2tlbhgCIAEoCUID4EEBEicKBXN0YXRlGAMgASgOMhMubWVtb3MuYXBpLnYxLlN0YXRlQgPgQQESFQoIb3JkZXJfYnkYBCABKAlCA+BBARITCgZmaWx0ZXIYBSABKAlCA+BBARIZCgxzaG93X2RlbGV0ZWQYBiABKAhCA+BBAUoECAcQCEoECAgQCVIFc3BhY2VSCnVuYXNzaWduZWQiTwoRTGlzdE1lbW9zUmVzcG9uc2USIQoFbWVtb3MYASADKAsyEi5tZW1vcy5hcGkudjEuTWVtbxIXCg9uZXh0X3BhZ2VfdG9rZW4YAiABKAkiOQoOR2V0TWVtb1JlcXVlc3QSJwoEbmFtZRgBIAEoCUIZ4EEC+kETChFtZW1vcy5hcGkudjEvTWVtbyJwChFVcGRhdGVNZW1vUmVxdWVzdBIlCgRtZW1vGAEgASgLMhIubWVtb3MuYXBpLnYxLk1lbW9CA+BBAhI0Cgt1cGRhdGVfbWFzaxgCIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5GaWVsZE1hc2tCA+BBAiJQChFEZWxldGVNZW1vUmVxdWVzdBInCgRuYW1lGAEgASgJQhngQQL6QRMKEW1lbW9zLmFwaS52MS9NZW1vEhIKBWZvcmNlGAIgASgIQgPgQQEieAoZU2V0TWVtb0F0dGFjaG1lbnRzUmVxdWVzdBInCgRuYW1lGAEgASgJQhngQQL6QRMKEW1lbW9zLmFwaS52MS9NZW1vEjIKC2F0dGFjaG1lbnRzGAIgAygLMhgubWVtb3MuYXBpLnYxLkF0dGFjaG1lbnRCA+BBAiJ2ChpMaXN0TWVtb0F0dGFjaG1lbnRzUmVxdWVzdBInCgRuYW1lGAEgASgJQhngQQL6QRMKEW1lbW9zLmFwaS52MS9NZW1vEhYKCXBhZ2Vfc2l6ZRgCIAEoBUID4EEBEhcKCnBhZ2VfdG9rZW4YAyABKAlCA+BBASJlChtMaXN0TWVtb0F0dGFjaG1lbnRzUmVzcG9uc2USLQoLYXR0YWNobWVudHMYASADKAsyGC5tZW1vcy5hcGkudjEuQXR0YWNobWVudBIXCg9uZXh0X3BhZ2VfdG9rZW4YAiABKAkiswIKDE1lbW9SZWxhdGlvbhIyCgRtZW1vGAEgASgLMh8ubWVtb3MuYXBpLnYxLk1lbW9SZWxhdGlvbi5NZW1vQgPgQQISOgoMcmVsYXRlZF9tZW1vGAIgASgLMh8ubWVtb3MuYXBpLnYxLk1lbW9SZWxhdGlvbi5NZW1vQgPgQQISMgoEdHlwZRgDIAEoDjIfLm1lbW9zLmFwaS52MS5NZW1vUmVsYXRpb24uVHlwZUID4EECGkUKBE1lbW8SJwoEbmFtZRgBIAEoCUIZ4EEC+kETChFtZW1vcy5hcGkudjEvTWVtbxIUCgdzbmlwcGV0GAIgASgJQgPgQQMiOAoEVHlwZRIUChBUWVBFX1VOU1BFQ0lGSUVEEAASDQoJUkVGRVJFTkNFEAESCwoHQ09NTUVOVBACInYKF1NldE1lbW9SZWxhdGlvbnNSZXF1ZXN0EicKBG5hbWUYASABKAlCGeBBAvpBEwoRbWVtb3MuYXBpLnYxL01lbW8SMgoJcmVsYXRpb25zGAIgAygLMhoubWVtb3MuYXBpLnYxLk1lbW9SZWxhdGlvbkID4EECInQKGExpc3RNZW1vUmVsYXRpb25zUmVxdWVzdBInCgRuYW1lGAEgASgJQhngQQL6QRMKEW1lbW9zLmFwaS52MS9NZW1vEhYKCXBhZ2Vfc2l6ZRgCIAEoBUID4EEBEhcKCnBhZ2VfdG9rZW4YAyABKAlCA+BBASJjChlMaXN0TWVtb1JlbGF0aW9uc1Jlc3BvbnNlEi0KCXJlbGF0aW9ucxgBIAMoCzIaLm1lbW9zLmFwaS52MS5NZW1vUmVsYXRpb24SFwoPbmV4dF9wYWdlX3Rva2VuGAIgASgJIoYBChhDcmVhdGVNZW1vQ29tbWVudFJlcXVlc3QSJwoEbmFtZRgBIAEoCUIZ4EEC+kETChFtZW1vcy5hcGkudjEvTWVtbxIoCgdjb21tZW50GAIgASgLMhIubWVtb3MuYXBpLnYxLk1lbW9CA+BBAhIXCgpjb21tZW50X2lkGAMgASgJQgPgQQEiigEKF0xpc3RNZW1vQ29tbWVudHNSZXF1ZXN0EicKBG5hbWUYASABKAlCGeBBAvpBEwoRbWVtb3MuYXBpLnYxL01lbW8SFgoJcGFnZV9zaXplGAIgASgFQgPgQQESFwoKcGFnZV90b2tlbhgDIAEoCUID4EEBEhUKCG9yZGVyX2J5GAQgASgJQgPgQQEiVgoYTGlzdE1lbW9Db21tZW50c1Jlc3BvbnNlEiEKBW1lbW9zGAEgAygLMhIubWVtb3MuYXBpLnYxLk1lbW8SFwoPbmV4dF9wYWdlX3Rva2VuGAIgASgJInQKGExpc3RNZW1vUmVhY3Rpb25zUmVxdWVzdBInCgRuYW1lGAEgASgJQhngQQL6QRMKEW1lbW9zLmFwaS52MS9NZW1vEhYKCXBhZ2Vfc2l6ZRgCIAEoBUID4EEBEhcKCnBhZ2VfdG9rZW4YAyABKAlCA+BBASJfChlMaXN0TWVtb1JlYWN0aW9uc1Jlc3BvbnNlEikKCXJlYWN0aW9ucxgBIAMoCzIWLm1lbW9zLmFwaS52MS5SZWFjdGlvbhIXCg9uZXh0X3BhZ2VfdG9rZW4YAiABKAkicwoZVXBzZXJ0TWVtb1JlYWN0aW9uUmVxdWVzdBInCgRuYW1lGAEgASgJQhngQQL6QRMKEW1lbW9zLmFwaS52MS9NZW1vEi0KCHJlYWN0aW9uGAIgASgLMhYubWVtb3MuYXBpLnYxLlJlYWN0aW9uQgPgQQIiSAoZRGVsZXRlTWVtb1JlYWN0aW9uUmVxdWVzdBIrCgRuYW1lGAEgASgJQh3gQQL6QRcKFW1lbW9zLmFwaS52MS9SZWFjdGlvbiLoAQoJTWVtb1NoYXJlEhEKBG5hbWUYASABKAlCA+BBCBI0CgtjcmVhdGVfdGltZRgCIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXBCA+BBAxI5CgtleHBpcmVfdGltZRgDIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXBCA+BBAUgAiAEBOkfqQUQKFm1lbW9zLmFwaS52MS9NZW1vU2hhcmUSG21lbW9zL3ttZW1vfS9zaGFyZXMve3NoYXJlfSoGc2hhcmVzMgVzaGFyZUIOCgxfZXhwaXJlX3RpbWUidQoWQ3JlYXRlTWVtb1NoYXJlUmVxdWVzdBIpCgZwYXJlbnQYASABKAlCGeBBAvpBEwoRbWVtb3MuYXBpLnYxL01lbW8SMAoKbWVtb19zaGFyZRgCIAEoCzIXLm1lbW9zLmFwaS52MS5NZW1vU2hhcmVCA+BBAiJCChVMaXN0TWVtb1NoYXJlc1JlcXVlc3QSKQoGcGFyZW50GAEgASgJQhngQQL6QRMKEW1lbW9zLmFwaS52MS9NZW1vIkYKFkxpc3RNZW1vU2hhcmVzUmVzcG9uc2USLAoLbWVtb19zaGFyZXMYASADKAsyFy5tZW1vcy5hcGkudjEuTWVtb1NoYXJlIkYKFkRlbGV0ZU1lbW9TaGFyZVJlcXVlc3QSLAoEbmFtZRgBIAEoCUIe4EEC+kEYChZtZW1vcy5hcGkudjEvTWVtb1NoYXJlIjAKFEdldFNoYXJlZE1lbW9SZXF1ZXN0EhgKC3NoYXJlX3Rva2VuGAEgASgJQgPgQQIiKgoWR2V0TGlua01ldGFkYXRhUmVxdWVzdBIQCgN1cmwYASABKAlCA+BBAiIwChtCYXRjaEdldExpbmtNZXRhZGF0YVJlcXVlc3QSEQoEdXJscxgBIAMoCUID4EECIlEKHEJhdGNoR2V0TGlua01ldGFkYXRhUmVzcG9uc2USMQoNbGlua19tZXRhZGF0YRgBIAMoCzIaLm1lbW9zLmFwaS52MS5MaW5rTWV0YWRhdGEiTgoMTGlua01ldGFkYXRhEgsKA3VybBgBIAEoCRINCgV0aXRsZRgCIAEoCRITCgtkZXNjcmlwdGlvbhgDIAEoCRINCgVpbWFnZRgEIAEoCSpbCgpWaXNpYmlsaXR5EhoKFlZJU0lCSUxJVFlfVU5TUEVDSUZJRUQQABILCgdQUklWQVRFEAESDQoJUFJPVEVDVEVEEAISCgoGUFVCTElDEAMSCQoFU1BBQ0UQBDKRFQoLTWVtb1NlcnZpY2USZQoKQ3JlYXRlTWVtbxIfLm1lbW9zLmFwaS52MS5DcmVhdGVNZW1vUmVxdWVzdBoSLm1lbW9zLmFwaS52MS5NZW1vIiLaQQRtZW1vgtPkkwIVOgRtZW1vIg0vYXBpL3YxL21lbW9zEmYKCUxpc3RNZW1vcxIeLm1lbW9zLmFwaS52MS5MaXN0TWVtb3NSZXF1ZXN0Gh8ubWVtb3MuYXBpLnYxLkxpc3RNZW1vc1Jlc3BvbnNlIhjaQQCC0+STAg8SDS9hcGkvdjEvbWVtb3MSYgoHR2V0TWVtbxIcLm1lbW9zLmFwaS52MS5HZXRNZW1vUmVxdWVzdBoSLm1lbW9zLmFwaS52MS5NZW1vIiXaQQRuYW1lgtPkkwIYEhYvYXBpL3YxL3tuYW1lPW1lbW9zLyp9En8KClVwZGF0ZU1lbW8SHy5tZW1vcy5hcGkudjEuVXBkYXRlTWVtb1JlcXVlc3QaEi5tZW1vcy5hcGkudjEuTWVtbyI82kEQbWVtbyx1cGRhdGVfbWFza4LT5JMCIzoEbWVtbzIbL2FwaS92MS97bWVtby5uYW1lPW1lbW9zLyp9EmwKCkRlbGV0ZU1lbW8SHy5tZW1vcy5hcGkudjEuRGVsZXRlTWVtb1JlcXVlc3QaFi5nb29nbGUucHJvdG9idWYuRW1wdHkiJdpBBG5hbWWC0+STAhgqFi9hcGkvdjEve25hbWU9bWVtb3MvKn0SiwEKElNldE1lbW9BdHRhY2htZW50cxInLm1lbW9zLmFwaS52MS5TZXRNZW1vQXR0YWNobWVudHNSZXF1ZXN0GhYuZ29vZ2xlLnByb3RvYnVmLkVtcHR5IjTaQQRuYW1lgtPkkwInOgEqMiIvYXBpL3YxL3tuYW1lPW1lbW9zLyp9L2F0dGFjaG1lbnRzEp0BChNMaXN0TWVtb0F0dGFjaG1lbnRzEigubWVtb3MuYXBpLnYxLkxpc3RNZW1vQXR0YWNobWVudHNSZXF1ZXN0GikubWVtb3MuYXBpLnYxLkxpc3RNZW1vQXR0YWNobWVudHNSZXNwb25zZSIx2kEEbmFtZYLT5JMCJBIiL2FwaS92MS97bmFtZT1tZW1vcy8qfS9hdHRhY2htZW50cxKFAQoQU2V0TWVtb1JlbGF0aW9ucxIlLm1lbW9zLmFwaS52MS5TZXRNZW1vUmVsYXRpb25zUmVxdWVzdBoWLmdvb2dsZS5wcm90b2J1Zi5FbXB0eSIy2kEEbmFtZYLT5JMCJToBKjIgL2FwaS92MS97bmFtZT1tZW1vcy8qfS9yZWxhdGlvbnMSlQEKEUxpc3RNZW1vUmVsYXRpb25zEiYubWVtb3MuYXBpLnYxLkxpc3RNZW1vUmVsYXRpb25zUmVxdWVzdBonLm1lbW9zLmFwaS52MS5MaXN0TWVtb1JlbGF0aW9uc1Jlc3BvbnNlIi/aQQRuYW1lgtPkkwIiEiAvYXBpL3YxL3tuYW1lPW1lbW9zLyp9L3JlbGF0aW9ucxKQAQoRQ3JlYXRlTWVtb0NvbW1lbnQSJi5tZW1vcy5hcGkudjEuQ3JlYXRlTWVtb0NvbW1lbnRSZXF1ZXN0GhIubWVtb3MuYXBpLnYxLk1lbW8iP9pBDG5hbWUsY29tbWVudILT5JMCKjoHY29tbWVudCIfL2FwaS92MS97bmFtZT1tZW1vcy8qfS9jb21tZW50cxKRAQoQTGlzdE1lbW9Db21tZW50cxIlLm1lbW9zLmFwaS52MS5MaXN0TWVtb0NvbW1lbnRzUmVxdWVzdBomLm1lbW9zLmFwaS52MS5MaXN0TWVtb0NvbW1lbnRzUmVzcG9uc2UiLtpBBG5hbWWC0+STAiESHy9hcGkvdjEve25hbWU9bWVtb3MvKn0vY29tbWVudHMSlQEKEUxpc3RNZW1vUmVhY3Rpb25zEiYubWVtb3MuYXBpLnYxLkxpc3RNZW1vUmVhY3Rpb25zUmVxdWVzdBonLm1lbW9zLmFwaS52MS5MaXN0TWVtb1JlYWN0aW9uc1Jlc3BvbnNlIi/aQQRuYW1lgtPkkwIiEiAvYXBpL3YxL3tuYW1lPW1lbW9zLyp9L3JlYWN0aW9ucxKJAQoSVXBzZXJ0TWVtb1JlYWN0aW9uEicubWVtb3MuYXBpLnYxLlVwc2VydE1lbW9SZWFjdGlvblJlcXVlc3QaFi5tZW1vcy5hcGkudjEuUmVhY3Rpb24iMtpBBG5hbWWC0+STAiU6ASoiIC9hcGkvdjEve25hbWU9bWVtb3MvKn0vcmVhY3Rpb25zEogBChJEZWxldGVNZW1vUmVhY3Rpb24SJy5tZW1vcy5hcGkudjEuRGVsZXRlTWVtb1JlYWN0aW9uUmVxdWVzdBoWLmdvb2dsZS5wcm90b2J1Zi5FbXB0eSIx2kEEbmFtZYLT5JMCJCoiL2FwaS92MS97bmFtZT1tZW1vcy8qL3JlYWN0aW9ucy8qfRKZAQoPQ3JlYXRlTWVtb1NoYXJlEiQubWVtb3MuYXBpLnYxLkNyZWF0ZU1lbW9TaGFyZVJlcXVlc3QaFy5tZW1vcy5hcGkudjEuTWVtb1NoYXJlIkfaQRFwYXJlbnQsbWVtb19zaGFyZYLT5JMCLToKbWVtb19zaGFyZSIfL2FwaS92MS97cGFyZW50PW1lbW9zLyp9L3NoYXJlcxKNAQoOTGlzdE1lbW9TaGFyZXMSIy5tZW1vcy5hcGkudjEuTGlzdE1lbW9TaGFyZXNSZXF1ZXN0GiQubWVtb3MuYXBpLnYxLkxpc3RNZW1vU2hhcmVzUmVzcG9uc2UiMNpBBnBhcmVudILT5JMCIRIfL2FwaS92MS97cGFyZW50PW1lbW9zLyp9L3NoYXJlcxJ/Cg9EZWxldGVNZW1vU2hhcmUSJC5tZW1vcy5hcGkudjEuRGVsZXRlTWVtb1NoYXJlUmVxdWVzdBoWLmdvb2dsZS5wcm90b2J1Zi5FbXB0eSIu2kEEbmFtZYLT5JMCISofL2FwaS92MS97bmFtZT1tZW1vcy8qL3NoYXJlcy8qfRJyCg1HZXRTaGFyZWRNZW1vEiIubWVtb3MuYXBpLnYxLkdldFNoYXJlZE1lbW9SZXF1ZXN0GhIubWVtb3MuYXBpLnYxLk1lbW8iKYLT5JMCIxIhL2FwaS92MS9zaGFyZXMve3NoYXJlX3Rva2VufS9tZW1vEnkKD0dldExpbmtNZXRhZGF0YRIkLm1lbW9zLmFwaS52MS5HZXRMaW5rTWV0YWRhdGFSZXF1ZXN0GhoubWVtb3MuYXBpLnYxLkxpbmtNZXRhZGF0YSIkgtPkkwIeEhwvYXBpL3YxL21lbW9zLy0vbGlua01ldGFkYXRhEp8BChRCYXRjaEdldExpbmtNZXRhZGF0YRIpLm1lbW9zLmFwaS52MS5CYXRjaEdldExpbmtNZXRhZGF0YVJlcXVlc3QaKi5tZW1vcy5hcGkudjEuQmF0Y2hHZXRMaW5rTWV0YWRhdGFSZXNwb25zZSIwgtPkkwIqOgEqIiUvYXBpL3YxL21lbW9zLy0vbGlua01ldGFkYXRhOmJhdGNoR2V0QqgBChBjb20ubWVtb3MuYXBpLnYxQhBNZW1vU2VydmljZVByb3RvUAFaMGdpdGh1Yi5jb20vdXNlbWVtb3MvbWVtb3MvcHJvdG8vZ2VuL2FwaS92MTthcGl2MaICA01BWKoCDE1lbW9zLkFwaS5WMcoCDE1lbW9zXEFwaVxWMeICGE1lbW9zXEFwaVxWMVxHUEJNZXRhZGF0YeoCDk1lbW9zOjpBcGk6OlYxYgZwcm90bzM", [file_api_v1_attachment_service, file_api_v1_common, file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_empty, file_google_protobuf_field_mask, file_google_protobuf_timestamp]); - -/** - * Reaction is a reaction attached to a memo. - * - * @generated from message memos.api.v1.Reaction - */ -export type Reaction = Message<"memos.api.v1.Reaction"> & { - /** - * The resource name of the reaction. - * Format: memos/{memo}/reactions/{reaction} - * - * @generated from field: string name = 1; - */ - name: string; - - /** - * The resource name of the creator. - * Format: users/{user} - * - * @generated from field: string creator = 2; - */ - creator: string; - - /** - * Required. The type of reaction (e.g., "👍", "❤️", "😄"). - * - * @generated from field: string reaction_type = 4; - */ - reactionType: string; - - /** - * Output only. The creation timestamp. - * - * @generated from field: google.protobuf.Timestamp create_time = 5; - */ - createTime?: Timestamp | undefined; -}; - -/** - * Describes the message memos.api.v1.Reaction. - * Use `create(ReactionSchema)` to create a new message. - */ -export const ReactionSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_memo_service, 0); - -/** - * @generated from message memos.api.v1.Memo - */ -export type Memo = Message<"memos.api.v1.Memo"> & { - /** - * The resource name of the memo. - * Format: memos/{memo}, where memo is the user-defined UID. - * - * @generated from field: string name = 1; - */ - name: string; - - /** - * The state of the memo. - * - * @generated from field: memos.api.v1.State state = 2; - */ - state: State; - - /** - * The name of the creator. - * Format: users/{user} - * - * @generated from field: string creator = 3; - */ - creator: string; - - /** - * The creation timestamp. - * If not set on creation, the server will set it to the current time. - * - * @generated from field: google.protobuf.Timestamp create_time = 4; - */ - createTime?: Timestamp | undefined; - - /** - * The last update timestamp. - * If not set on creation, the server will set it to the current time. - * - * @generated from field: google.protobuf.Timestamp update_time = 5; - */ - updateTime?: Timestamp | undefined; - - /** - * Required. The content of the memo in Markdown format. - * - * @generated from field: string content = 7; - */ - content: string; - - /** - * The visibility of the memo. - * One of PRIVATE (creator only), PROTECTED (signed-in users), PUBLIC - * (anonymous-eligible), or SPACE (active space members). Defaults to - * PRIVATE on creation when unspecified. - * - * @generated from field: memos.api.v1.Visibility visibility = 9; - */ - visibility: Visibility; - - /** - * Output only. The tags extracted from the content. - * - * @generated from field: repeated string tags = 10; - */ - tags: string[]; - - /** - * Whether the memo is pinned. - * - * @generated from field: bool pinned = 11; - */ - pinned: boolean; - - /** - * Optional. The attachments of the memo. - * - * @generated from field: repeated memos.api.v1.Attachment attachments = 12; - */ - attachments: Attachment[]; - - /** - * Optional. The relations of the memo. - * - * @generated from field: repeated memos.api.v1.MemoRelation relations = 13; - */ - relations: MemoRelation[]; - - /** - * Output only. The reactions to the memo. - * - * @generated from field: repeated memos.api.v1.Reaction reactions = 14; - */ - reactions: Reaction[]; - - /** - * Output only. The computed properties of the memo. - * - * @generated from field: memos.api.v1.Memo.Property property = 15; - */ - property?: Memo_Property | undefined; - - /** - * Output only. The context memo of this COMMENT relation, if any. - * Its identity is returned even when the caller cannot read the parent. - * Fetch the parent independently; this field does not grant read access. - * Format: memos/{memo} - * - * @generated from field: optional string parent = 16; - */ - parent?: string | undefined; - - /** - * Output only. The snippet of the memo content. Plain text only. - * - * @generated from field: string snippet = 17; - */ - snippet: string; - - /** - * Optional. The location of the memo. - * - * @generated from field: optional memos.api.v1.Location location = 18; - */ - location?: Location | undefined; - - /** - * Optional. The space in which this memo is placed. Format: spaces/{space}. - * Every memo, including a comment, owns its placement independently. - * - * @generated from field: optional string space = 19; - */ - space?: string | undefined; -}; - -/** - * Describes the message memos.api.v1.Memo. - * Use `create(MemoSchema)` to create a new message. - */ -export const MemoSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_memo_service, 1); - -/** - * Computed properties of a memo. - * - * @generated from message memos.api.v1.Memo.Property - */ -export type Memo_Property = Message<"memos.api.v1.Memo.Property"> & { - /** - * @generated from field: bool has_link = 1; - */ - hasLink: boolean; - - /** - * @generated from field: bool has_task_list = 2; - */ - hasTaskList: boolean; - - /** - * @generated from field: bool has_code = 3; - */ - hasCode: boolean; - - /** - * @generated from field: bool has_incomplete_tasks = 4; - */ - hasIncompleteTasks: boolean; - - /** - * The title extracted from the first H1 heading, if present. - * - * @generated from field: string title = 5; - */ - title: string; -}; - -/** - * Describes the message memos.api.v1.Memo.Property. - * Use `create(Memo_PropertySchema)` to create a new message. - */ -export const Memo_PropertySchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_memo_service, 1, 0); - -/** - * @generated from message memos.api.v1.Location - */ -export type Location = Message<"memos.api.v1.Location"> & { - /** - * A placeholder text for the location. - * - * @generated from field: string placeholder = 1; - */ - placeholder: string; - - /** - * The latitude of the location. - * - * @generated from field: double latitude = 2; - */ - latitude: number; - - /** - * The longitude of the location. - * - * @generated from field: double longitude = 3; - */ - longitude: number; -}; - -/** - * Describes the message memos.api.v1.Location. - * Use `create(LocationSchema)` to create a new message. - */ -export const LocationSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_memo_service, 2); - -/** - * @generated from message memos.api.v1.CreateMemoRequest - */ -export type CreateMemoRequest = Message<"memos.api.v1.CreateMemoRequest"> & { - /** - * Required. The memo to create. - * - * @generated from field: memos.api.v1.Memo memo = 1; - */ - memo?: Memo | undefined; - - /** - * Optional. The memo ID to use for this memo. - * If empty, a unique ID will be generated. - * Format: ^[a-zA-Z0-9]([a-zA-Z0-9-]{0,34}[a-zA-Z0-9])?$ - * - * @generated from field: string memo_id = 2; - */ - memoId: string; -}; - -/** - * Describes the message memos.api.v1.CreateMemoRequest. - * Use `create(CreateMemoRequestSchema)` to create a new message. - */ -export const CreateMemoRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_memo_service, 3); - -/** - * @generated from message memos.api.v1.ListMemosRequest - */ -export type ListMemosRequest = Message<"memos.api.v1.ListMemosRequest"> & { - /** - * Optional. The maximum number of memos to return. - * The service may return fewer than this value. - * If unspecified, at most 50 memos will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. - * - * @generated from field: int32 page_size = 1; - */ - pageSize: number; - - /** - * Optional. A page token, received from a previous `ListMemos` call. - * Provide this to retrieve the subsequent page. - * - * @generated from field: string page_token = 2; - */ - pageToken: string; - - /** - * Optional. The state of the memos to list. - * Default to `NORMAL`. Set to `ARCHIVED` to list archived memos. - * - * @generated from field: memos.api.v1.State state = 3; - */ - state: State; - - /** - * Optional. The order to sort results by. - * Default to "create_time desc". - * Supports comma-separated list of fields following AIP-132. - * Example: "pinned desc, create_time desc" or "update_time asc" - * Supported fields: pinned, create_time, update_time, name. - * Note: order_by uses create_time / update_time, while the filter - * expression uses created_ts / updated_ts for the same timestamps. - * - * @generated from field: string order_by = 4; - */ - orderBy: string; - - /** - * Optional. A CEL expression to filter memos. Combine terms with && and ||. - * Available fields: - * content (string), creator (string, e.g. "users/1"), - * created_ts / updated_ts (timestamp), pinned (bool), - * visibility (string: PRIVATE | PROTECTED | PUBLIC | SPACE), - * space (string resource name, or null when the memo has no space; - * supports == and comparisons against null, e.g. space != null), - * tags (list; match with `"work" in tags`, not `tag == "work"`), - * has_task_list / has_link / has_code / has_incomplete_tasks (bool), - * has_location (bool; true when the memo has a location attached). - * Note: the time fields here are created_ts / updated_ts, which differ from - * the create_time / update_time names used by order_by. - * Examples: - * pinned == true && visibility == "PUBLIC" - * space == "spaces/team" or space == null - * tags.exists(t, t == "urgent") - * content.contains("roadmap") && created_ts > now - duration("168h") - * - * @generated from field: string filter = 5; - */ - filter: string; - - /** - * Optional. If true, show deleted memos in the response. - * - * @generated from field: bool show_deleted = 6; - */ - showDeleted: boolean; -}; - -/** - * Describes the message memos.api.v1.ListMemosRequest. - * Use `create(ListMemosRequestSchema)` to create a new message. - */ -export const ListMemosRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_memo_service, 4); - -/** - * @generated from message memos.api.v1.ListMemosResponse - */ -export type ListMemosResponse = Message<"memos.api.v1.ListMemosResponse"> & { - /** - * The list of memos. - * - * @generated from field: repeated memos.api.v1.Memo memos = 1; - */ - memos: Memo[]; - - /** - * A token that can be sent as `page_token` to retrieve the next page. - * If this field is omitted, there are no subsequent pages. - * - * @generated from field: string next_page_token = 2; - */ - nextPageToken: string; -}; - -/** - * Describes the message memos.api.v1.ListMemosResponse. - * Use `create(ListMemosResponseSchema)` to create a new message. - */ -export const ListMemosResponseSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_memo_service, 5); - -/** - * @generated from message memos.api.v1.GetMemoRequest - */ -export type GetMemoRequest = Message<"memos.api.v1.GetMemoRequest"> & { - /** - * Required. The resource name of the memo. - * Format: memos/{memo} - * - * @generated from field: string name = 1; - */ - name: string; -}; - -/** - * Describes the message memos.api.v1.GetMemoRequest. - * Use `create(GetMemoRequestSchema)` to create a new message. - */ -export const GetMemoRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_memo_service, 6); - -/** - * @generated from message memos.api.v1.UpdateMemoRequest - */ -export type UpdateMemoRequest = Message<"memos.api.v1.UpdateMemoRequest"> & { - /** - * Required. The memo to update. - * The `name` field is required. - * - * @generated from field: memos.api.v1.Memo memo = 1; - */ - memo?: Memo | undefined; - - /** - * Required. The list of fields to update. - * - * @generated from field: google.protobuf.FieldMask update_mask = 2; - */ - updateMask?: FieldMask | undefined; -}; - -/** - * Describes the message memos.api.v1.UpdateMemoRequest. - * Use `create(UpdateMemoRequestSchema)` to create a new message. - */ -export const UpdateMemoRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_memo_service, 7); - -/** - * @generated from message memos.api.v1.DeleteMemoRequest - */ -export type DeleteMemoRequest = Message<"memos.api.v1.DeleteMemoRequest"> & { - /** - * Required. The resource name of the memo to delete. - * Format: memos/{memo} - * - * @generated from field: string name = 1; - */ - name: string; - - /** - * Optional. If set to true, the memo will be deleted even if it has associated data. - * - * @generated from field: bool force = 2; - */ - force: boolean; -}; - -/** - * Describes the message memos.api.v1.DeleteMemoRequest. - * Use `create(DeleteMemoRequestSchema)` to create a new message. - */ -export const DeleteMemoRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_memo_service, 8); - -/** - * @generated from message memos.api.v1.SetMemoAttachmentsRequest - */ -export type SetMemoAttachmentsRequest = Message<"memos.api.v1.SetMemoAttachmentsRequest"> & { - /** - * Required. The resource name of the memo. - * Format: memos/{memo} - * - * @generated from field: string name = 1; - */ - name: string; - - /** - * Required. The attachments to set for the memo. - * - * @generated from field: repeated memos.api.v1.Attachment attachments = 2; - */ - attachments: Attachment[]; -}; - -/** - * Describes the message memos.api.v1.SetMemoAttachmentsRequest. - * Use `create(SetMemoAttachmentsRequestSchema)` to create a new message. - */ -export const SetMemoAttachmentsRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_memo_service, 9); - -/** - * @generated from message memos.api.v1.ListMemoAttachmentsRequest - */ -export type ListMemoAttachmentsRequest = Message<"memos.api.v1.ListMemoAttachmentsRequest"> & { - /** - * Required. The resource name of the memo. - * Format: memos/{memo} - * - * @generated from field: string name = 1; - */ - name: string; - - /** - * Optional. The maximum number of attachments to return. - * - * @generated from field: int32 page_size = 2; - */ - pageSize: number; - - /** - * Optional. A page token for pagination. - * - * @generated from field: string page_token = 3; - */ - pageToken: string; -}; - -/** - * Describes the message memos.api.v1.ListMemoAttachmentsRequest. - * Use `create(ListMemoAttachmentsRequestSchema)` to create a new message. - */ -export const ListMemoAttachmentsRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_memo_service, 10); - -/** - * @generated from message memos.api.v1.ListMemoAttachmentsResponse - */ -export type ListMemoAttachmentsResponse = Message<"memos.api.v1.ListMemoAttachmentsResponse"> & { - /** - * The list of attachments. - * - * @generated from field: repeated memos.api.v1.Attachment attachments = 1; - */ - attachments: Attachment[]; - - /** - * A token for the next page of results. - * - * @generated from field: string next_page_token = 2; - */ - nextPageToken: string; -}; - -/** - * Describes the message memos.api.v1.ListMemoAttachmentsResponse. - * Use `create(ListMemoAttachmentsResponseSchema)` to create a new message. - */ -export const ListMemoAttachmentsResponseSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_memo_service, 11); - -/** - * @generated from message memos.api.v1.MemoRelation - */ -export type MemoRelation = Message<"memos.api.v1.MemoRelation"> & { - /** - * The memo in the relation. - * - * @generated from field: memos.api.v1.MemoRelation.Memo memo = 1; - */ - memo?: MemoRelation_Memo | undefined; - - /** - * The related memo. - * - * @generated from field: memos.api.v1.MemoRelation.Memo related_memo = 2; - */ - relatedMemo?: MemoRelation_Memo | undefined; - - /** - * @generated from field: memos.api.v1.MemoRelation.Type type = 3; - */ - type: MemoRelation_Type; -}; - -/** - * Describes the message memos.api.v1.MemoRelation. - * Use `create(MemoRelationSchema)` to create a new message. - */ -export const MemoRelationSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_memo_service, 12); - -/** - * Memo reference in relations. - * - * @generated from message memos.api.v1.MemoRelation.Memo - */ -export type MemoRelation_Memo = Message<"memos.api.v1.MemoRelation.Memo"> & { - /** - * The resource name of the memo. - * Format: memos/{memo} - * - * @generated from field: string name = 1; - */ - name: string; - - /** - * Output only. The snippet of the memo content. Plain text only. - * - * @generated from field: string snippet = 2; - */ - snippet: string; -}; - -/** - * Describes the message memos.api.v1.MemoRelation.Memo. - * Use `create(MemoRelation_MemoSchema)` to create a new message. - */ -export const MemoRelation_MemoSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_memo_service, 12, 0); - -/** - * The type of the relation. - * - * @generated from enum memos.api.v1.MemoRelation.Type - */ -export enum MemoRelation_Type { - /** - * @generated from enum value: TYPE_UNSPECIFIED = 0; - */ - TYPE_UNSPECIFIED = 0, - - /** - * @generated from enum value: REFERENCE = 1; - */ - REFERENCE = 1, - - /** - * @generated from enum value: COMMENT = 2; - */ - COMMENT = 2, -} - -/** - * Describes the enum memos.api.v1.MemoRelation.Type. - */ -export const MemoRelation_TypeSchema: GenEnum = /*@__PURE__*/ - enumDesc(file_api_v1_memo_service, 12, 0); - -/** - * @generated from message memos.api.v1.SetMemoRelationsRequest - */ -export type SetMemoRelationsRequest = Message<"memos.api.v1.SetMemoRelationsRequest"> & { - /** - * Required. The resource name of the memo. - * Format: memos/{memo} - * - * @generated from field: string name = 1; - */ - name: string; - - /** - * Required. The REFERENCE relations to set for the memo. COMMENT is invalid. - * - * @generated from field: repeated memos.api.v1.MemoRelation relations = 2; - */ - relations: MemoRelation[]; -}; - -/** - * Describes the message memos.api.v1.SetMemoRelationsRequest. - * Use `create(SetMemoRelationsRequestSchema)` to create a new message. - */ -export const SetMemoRelationsRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_memo_service, 13); - -/** - * @generated from message memos.api.v1.ListMemoRelationsRequest - */ -export type ListMemoRelationsRequest = Message<"memos.api.v1.ListMemoRelationsRequest"> & { - /** - * Required. The resource name of the memo. - * Format: memos/{memo} - * - * @generated from field: string name = 1; - */ - name: string; - - /** - * Optional. The maximum number of relations to return. - * - * @generated from field: int32 page_size = 2; - */ - pageSize: number; - - /** - * Optional. A page token for pagination. - * - * @generated from field: string page_token = 3; - */ - pageToken: string; -}; - -/** - * Describes the message memos.api.v1.ListMemoRelationsRequest. - * Use `create(ListMemoRelationsRequestSchema)` to create a new message. - */ -export const ListMemoRelationsRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_memo_service, 14); - -/** - * @generated from message memos.api.v1.ListMemoRelationsResponse - */ -export type ListMemoRelationsResponse = Message<"memos.api.v1.ListMemoRelationsResponse"> & { - /** - * The list of relations. - * - * @generated from field: repeated memos.api.v1.MemoRelation relations = 1; - */ - relations: MemoRelation[]; - - /** - * A token for the next page of results. - * - * @generated from field: string next_page_token = 2; - */ - nextPageToken: string; -}; - -/** - * Describes the message memos.api.v1.ListMemoRelationsResponse. - * Use `create(ListMemoRelationsResponseSchema)` to create a new message. - */ -export const ListMemoRelationsResponseSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_memo_service, 15); - -/** - * @generated from message memos.api.v1.CreateMemoCommentRequest - */ -export type CreateMemoCommentRequest = Message<"memos.api.v1.CreateMemoCommentRequest"> & { - /** - * Required. The resource name of the memo. - * Format: memos/{memo} - * - * @generated from field: string name = 1; - */ - name: string; - - /** - * Required. The comment to create. - * - * @generated from field: memos.api.v1.Memo comment = 2; - */ - comment?: Memo | undefined; - - /** - * Optional. The comment ID to use. - * - * @generated from field: string comment_id = 3; - */ - commentId: string; -}; - -/** - * Describes the message memos.api.v1.CreateMemoCommentRequest. - * Use `create(CreateMemoCommentRequestSchema)` to create a new message. - */ -export const CreateMemoCommentRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_memo_service, 16); - -/** - * @generated from message memos.api.v1.ListMemoCommentsRequest - */ -export type ListMemoCommentsRequest = Message<"memos.api.v1.ListMemoCommentsRequest"> & { - /** - * Required. The resource name of the memo. - * Format: memos/{memo} - * - * @generated from field: string name = 1; - */ - name: string; - - /** - * Optional. The maximum number of comments to return. - * - * @generated from field: int32 page_size = 2; - */ - pageSize: number; - - /** - * Optional. A page token for pagination. - * - * @generated from field: string page_token = 3; - */ - pageToken: string; - - /** - * Optional. The order to sort results by. - * - * @generated from field: string order_by = 4; - */ - orderBy: string; -}; - -/** - * Describes the message memos.api.v1.ListMemoCommentsRequest. - * Use `create(ListMemoCommentsRequestSchema)` to create a new message. - */ -export const ListMemoCommentsRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_memo_service, 17); - -/** - * @generated from message memos.api.v1.ListMemoCommentsResponse - */ -export type ListMemoCommentsResponse = Message<"memos.api.v1.ListMemoCommentsResponse"> & { - /** - * The list of comment memos. - * - * @generated from field: repeated memos.api.v1.Memo memos = 1; - */ - memos: Memo[]; - - /** - * A token for the next page of results. - * - * @generated from field: string next_page_token = 2; - */ - nextPageToken: string; -}; - -/** - * Describes the message memos.api.v1.ListMemoCommentsResponse. - * Use `create(ListMemoCommentsResponseSchema)` to create a new message. - */ -export const ListMemoCommentsResponseSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_memo_service, 18); - -/** - * @generated from message memos.api.v1.ListMemoReactionsRequest - */ -export type ListMemoReactionsRequest = Message<"memos.api.v1.ListMemoReactionsRequest"> & { - /** - * Required. The resource name of the memo. - * Format: memos/{memo} - * - * @generated from field: string name = 1; - */ - name: string; - - /** - * Optional. The maximum number of reactions to return. - * - * @generated from field: int32 page_size = 2; - */ - pageSize: number; - - /** - * Optional. A page token for pagination. - * - * @generated from field: string page_token = 3; - */ - pageToken: string; -}; - -/** - * Describes the message memos.api.v1.ListMemoReactionsRequest. - * Use `create(ListMemoReactionsRequestSchema)` to create a new message. - */ -export const ListMemoReactionsRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_memo_service, 19); - -/** - * @generated from message memos.api.v1.ListMemoReactionsResponse - */ -export type ListMemoReactionsResponse = Message<"memos.api.v1.ListMemoReactionsResponse"> & { - /** - * The list of reactions. - * - * @generated from field: repeated memos.api.v1.Reaction reactions = 1; - */ - reactions: Reaction[]; - - /** - * A token for the next page of results. - * - * @generated from field: string next_page_token = 2; - */ - nextPageToken: string; -}; - -/** - * Describes the message memos.api.v1.ListMemoReactionsResponse. - * Use `create(ListMemoReactionsResponseSchema)` to create a new message. - */ -export const ListMemoReactionsResponseSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_memo_service, 20); - -/** - * @generated from message memos.api.v1.UpsertMemoReactionRequest - */ -export type UpsertMemoReactionRequest = Message<"memos.api.v1.UpsertMemoReactionRequest"> & { - /** - * Required. The resource name of the memo. - * Format: memos/{memo} - * - * @generated from field: string name = 1; - */ - name: string; - - /** - * Required. The reaction to upsert. - * - * @generated from field: memos.api.v1.Reaction reaction = 2; - */ - reaction?: Reaction | undefined; -}; - -/** - * Describes the message memos.api.v1.UpsertMemoReactionRequest. - * Use `create(UpsertMemoReactionRequestSchema)` to create a new message. - */ -export const UpsertMemoReactionRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_memo_service, 21); - -/** - * @generated from message memos.api.v1.DeleteMemoReactionRequest - */ -export type DeleteMemoReactionRequest = Message<"memos.api.v1.DeleteMemoReactionRequest"> & { - /** - * Required. The resource name of the reaction to delete. - * Format: memos/{memo}/reactions/{reaction} - * - * @generated from field: string name = 1; - */ - name: string; -}; - -/** - * Describes the message memos.api.v1.DeleteMemoReactionRequest. - * Use `create(DeleteMemoReactionRequestSchema)` to create a new message. - */ -export const DeleteMemoReactionRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_memo_service, 22); - -/** - * MemoShare is an access grant that permits read-only access to a memo via an opaque bearer token. - * - * @generated from message memos.api.v1.MemoShare - */ -export type MemoShare = Message<"memos.api.v1.MemoShare"> & { - /** - * The resource name of the share. Format: memos/{memo}/shares/{share} - * The {share} segment is the opaque token used in the share URL. - * - * @generated from field: string name = 1; - */ - name: string; - - /** - * Output only. When this share link was created. - * - * @generated from field: google.protobuf.Timestamp create_time = 2; - */ - createTime?: Timestamp | undefined; - - /** - * Optional. When set, the share link stops working after this time. - * If unset, the link never expires. - * - * @generated from field: optional google.protobuf.Timestamp expire_time = 3; - */ - expireTime?: Timestamp | undefined; -}; - -/** - * Describes the message memos.api.v1.MemoShare. - * Use `create(MemoShareSchema)` to create a new message. - */ -export const MemoShareSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_memo_service, 23); - -/** - * @generated from message memos.api.v1.CreateMemoShareRequest - */ -export type CreateMemoShareRequest = Message<"memos.api.v1.CreateMemoShareRequest"> & { - /** - * Required. The resource name of the memo to share. - * Format: memos/{memo} - * - * @generated from field: string parent = 1; - */ - parent: string; - - /** - * Required. The share to create. - * - * @generated from field: memos.api.v1.MemoShare memo_share = 2; - */ - memoShare?: MemoShare | undefined; -}; - -/** - * Describes the message memos.api.v1.CreateMemoShareRequest. - * Use `create(CreateMemoShareRequestSchema)` to create a new message. - */ -export const CreateMemoShareRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_memo_service, 24); - -/** - * @generated from message memos.api.v1.ListMemoSharesRequest - */ -export type ListMemoSharesRequest = Message<"memos.api.v1.ListMemoSharesRequest"> & { - /** - * Required. The resource name of the memo. - * Format: memos/{memo} - * - * @generated from field: string parent = 1; - */ - parent: string; -}; - -/** - * Describes the message memos.api.v1.ListMemoSharesRequest. - * Use `create(ListMemoSharesRequestSchema)` to create a new message. - */ -export const ListMemoSharesRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_memo_service, 25); - -/** - * @generated from message memos.api.v1.ListMemoSharesResponse - */ -export type ListMemoSharesResponse = Message<"memos.api.v1.ListMemoSharesResponse"> & { - /** - * The list of share links. - * - * @generated from field: repeated memos.api.v1.MemoShare memo_shares = 1; - */ - memoShares: MemoShare[]; -}; - -/** - * Describes the message memos.api.v1.ListMemoSharesResponse. - * Use `create(ListMemoSharesResponseSchema)` to create a new message. - */ -export const ListMemoSharesResponseSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_memo_service, 26); - -/** - * @generated from message memos.api.v1.DeleteMemoShareRequest - */ -export type DeleteMemoShareRequest = Message<"memos.api.v1.DeleteMemoShareRequest"> & { - /** - * Required. The resource name of the share to delete. - * Format: memos/{memo}/shares/{share} - * - * @generated from field: string name = 1; - */ - name: string; -}; - -/** - * Describes the message memos.api.v1.DeleteMemoShareRequest. - * Use `create(DeleteMemoShareRequestSchema)` to create a new message. - */ -export const DeleteMemoShareRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_memo_service, 27); - -/** - * @generated from message memos.api.v1.GetSharedMemoRequest - */ -export type GetSharedMemoRequest = Message<"memos.api.v1.GetSharedMemoRequest"> & { - /** - * Required. The opaque bearer token extracted from the share URL. - * - * @generated from field: string share_token = 1; - */ - shareToken: string; -}; - -/** - * Describes the message memos.api.v1.GetSharedMemoRequest. - * Use `create(GetSharedMemoRequestSchema)` to create a new message. - */ -export const GetSharedMemoRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_memo_service, 28); - -/** - * @generated from message memos.api.v1.GetLinkMetadataRequest - */ -export type GetLinkMetadataRequest = Message<"memos.api.v1.GetLinkMetadataRequest"> & { - /** - * Required. The link URL. - * - * @generated from field: string url = 1; - */ - url: string; -}; - -/** - * Describes the message memos.api.v1.GetLinkMetadataRequest. - * Use `create(GetLinkMetadataRequestSchema)` to create a new message. - */ -export const GetLinkMetadataRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_memo_service, 29); - -/** - * @generated from message memos.api.v1.BatchGetLinkMetadataRequest - */ -export type BatchGetLinkMetadataRequest = Message<"memos.api.v1.BatchGetLinkMetadataRequest"> & { - /** - * Required. The link URLs. - * - * @generated from field: repeated string urls = 1; - */ - urls: string[]; -}; - -/** - * Describes the message memos.api.v1.BatchGetLinkMetadataRequest. - * Use `create(BatchGetLinkMetadataRequestSchema)` to create a new message. - */ -export const BatchGetLinkMetadataRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_memo_service, 30); - -/** - * @generated from message memos.api.v1.BatchGetLinkMetadataResponse - */ -export type BatchGetLinkMetadataResponse = Message<"memos.api.v1.BatchGetLinkMetadataResponse"> & { - /** - * The link metadata list, in the same order as the input URLs. - * - * @generated from field: repeated memos.api.v1.LinkMetadata link_metadata = 1; - */ - linkMetadata: LinkMetadata[]; -}; - -/** - * Describes the message memos.api.v1.BatchGetLinkMetadataResponse. - * Use `create(BatchGetLinkMetadataResponseSchema)` to create a new message. - */ -export const BatchGetLinkMetadataResponseSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_memo_service, 31); - -/** - * @generated from message memos.api.v1.LinkMetadata - */ -export type LinkMetadata = Message<"memos.api.v1.LinkMetadata"> & { - /** - * The original link URL. - * - * @generated from field: string url = 1; - */ - url: string; - - /** - * The link title. - * - * @generated from field: string title = 2; - */ - title: string; - - /** - * The link description. - * - * @generated from field: string description = 3; - */ - description: string; - - /** - * The link image URL. - * - * @generated from field: string image = 4; - */ - image: string; -}; - -/** - * Describes the message memos.api.v1.LinkMetadata. - * Use `create(LinkMetadataSchema)` to create a new message. - */ -export const LinkMetadataSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_memo_service, 32); - -/** - * Visibility controls who can read a memo. - * - * @generated from enum memos.api.v1.Visibility - */ -export enum Visibility { - /** - * @generated from enum value: VISIBILITY_UNSPECIFIED = 0; - */ - VISIBILITY_UNSPECIFIED = 0, - - /** - * PRIVATE: only the creator can read the memo. - * - * @generated from enum value: PRIVATE = 1; - */ - PRIVATE = 1, - - /** - * PROTECTED: signed-in users of the instance can read the memo. - * - * @generated from enum value: PROTECTED = 2; - */ - PROTECTED = 2, - - /** - * PUBLIC: signed-in users can read the memo; anonymous visitors can read it - * when instance policy permits. - * - * @generated from enum value: PUBLIC = 3; - */ - PUBLIC = 3, - - /** - * SPACE: active members of the memo's space can read it. - * - * @generated from enum value: SPACE = 4; - */ - SPACE = 4, -} - -/** - * Describes the enum memos.api.v1.Visibility. - */ -export const VisibilitySchema: GenEnum = /*@__PURE__*/ - enumDesc(file_api_v1_memo_service, 0); - -/** - * @generated from service memos.api.v1.MemoService - */ -export const MemoService: GenService<{ - /** - * CreateMemo creates a memo. The request body is a Memo; set its content - * (Markdown) and visibility (PRIVATE | PROTECTED | PUBLIC | SPACE, - * default PRIVATE). - * The memo is owned by the authenticated user; requires authentication. - * - * @generated from rpc memos.api.v1.MemoService.CreateMemo - */ - createMemo: { - methodKind: "unary"; - input: typeof CreateMemoRequestSchema; - output: typeof MemoSchema; - }, - /** - * ListMemos lists readable non-comment memos with pagination and filter. - * - * @generated from rpc memos.api.v1.MemoService.ListMemos - */ - listMemos: { - methodKind: "unary"; - input: typeof ListMemosRequestSchema; - output: typeof ListMemosResponseSchema; - }, - /** - * GetMemo gets a memo. - * - * @generated from rpc memos.api.v1.MemoService.GetMemo - */ - getMemo: { - methodKind: "unary"; - input: typeof GetMemoRequestSchema; - output: typeof MemoSchema; - }, - /** - * UpdateMemo updates a memo. - * - * @generated from rpc memos.api.v1.MemoService.UpdateMemo - */ - updateMemo: { - methodKind: "unary"; - input: typeof UpdateMemoRequestSchema; - output: typeof MemoSchema; - }, - /** - * DeleteMemo deletes the named memo and its comment subtree, including nested - * replies and their owned resources. It removes incident relations for all - * deleted memos. - * - * @generated from rpc memos.api.v1.MemoService.DeleteMemo - */ - deleteMemo: { - methodKind: "unary"; - input: typeof DeleteMemoRequestSchema; - output: typeof EmptySchema; - }, - /** - * 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. - * - * @generated from rpc memos.api.v1.MemoService.SetMemoAttachments - */ - setMemoAttachments: { - methodKind: "unary"; - input: typeof SetMemoAttachmentsRequestSchema; - output: typeof EmptySchema; - }, - /** - * ListMemoAttachments lists attachments for a memo. - * - * @generated from rpc memos.api.v1.MemoService.ListMemoAttachments - */ - listMemoAttachments: { - methodKind: "unary"; - input: typeof ListMemoAttachmentsRequestSchema; - output: typeof ListMemoAttachmentsResponseSchema; - }, - /** - * 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. - * - * @generated from rpc memos.api.v1.MemoService.SetMemoRelations - */ - setMemoRelations: { - methodKind: "unary"; - input: typeof SetMemoRelationsRequestSchema; - output: typeof EmptySchema; - }, - /** - * ListMemoRelations lists relations for a memo. - * - * @generated from rpc memos.api.v1.MemoService.ListMemoRelations - */ - listMemoRelations: { - methodKind: "unary"; - input: typeof ListMemoRelationsRequestSchema; - output: typeof ListMemoRelationsResponseSchema; - }, - /** - * 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. - * - * @generated from rpc memos.api.v1.MemoService.CreateMemoComment - */ - createMemoComment: { - methodKind: "unary"; - input: typeof CreateMemoCommentRequestSchema; - output: typeof MemoSchema; - }, - /** - * ListMemoComments lists comments for a memo. - * - * @generated from rpc memos.api.v1.MemoService.ListMemoComments - */ - listMemoComments: { - methodKind: "unary"; - input: typeof ListMemoCommentsRequestSchema; - output: typeof ListMemoCommentsResponseSchema; - }, - /** - * ListMemoReactions lists reactions for a memo. - * - * @generated from rpc memos.api.v1.MemoService.ListMemoReactions - */ - listMemoReactions: { - methodKind: "unary"; - input: typeof ListMemoReactionsRequestSchema; - output: typeof ListMemoReactionsResponseSchema; - }, - /** - * UpsertMemoReaction adds or updates the authenticated user's reaction on a memo. - * - * @generated from rpc memos.api.v1.MemoService.UpsertMemoReaction - */ - upsertMemoReaction: { - methodKind: "unary"; - input: typeof UpsertMemoReactionRequestSchema; - output: typeof ReactionSchema; - }, - /** - * DeleteMemoReaction deletes a reaction for a memo. - * - * @generated from rpc memos.api.v1.MemoService.DeleteMemoReaction - */ - deleteMemoReaction: { - methodKind: "unary"; - input: typeof DeleteMemoReactionRequestSchema; - output: typeof EmptySchema; - }, - /** - * CreateMemoShare creates a share link for a memo. Requires the memo creator or an instance administrator. - * - * @generated from rpc memos.api.v1.MemoService.CreateMemoShare - */ - createMemoShare: { - methodKind: "unary"; - input: typeof CreateMemoShareRequestSchema; - output: typeof MemoShareSchema; - }, - /** - * ListMemoShares lists all share links for a memo. Requires the memo creator or an instance administrator. - * - * @generated from rpc memos.api.v1.MemoService.ListMemoShares - */ - listMemoShares: { - methodKind: "unary"; - input: typeof ListMemoSharesRequestSchema; - output: typeof ListMemoSharesResponseSchema; - }, - /** - * DeleteMemoShare revokes a share link. Requires the memo creator or an instance administrator. - * - * @generated from rpc memos.api.v1.MemoService.DeleteMemoShare - */ - deleteMemoShare: { - methodKind: "unary"; - input: typeof DeleteMemoShareRequestSchema; - output: typeof EmptySchema; - }, - /** - * GetSharedMemo resolves a share token to its memo. No authentication required. - * Returns NOT_FOUND if the token is invalid or expired. - * - * @generated from rpc memos.api.v1.MemoService.GetSharedMemo - */ - getSharedMemo: { - methodKind: "unary"; - input: typeof GetSharedMemoRequestSchema; - output: typeof MemoSchema; - }, - /** - * GetLinkMetadata gets metadata for a link. - * - * @generated from rpc memos.api.v1.MemoService.GetLinkMetadata - */ - getLinkMetadata: { - methodKind: "unary"; - input: typeof GetLinkMetadataRequestSchema; - output: typeof LinkMetadataSchema; - }, - /** - * BatchGetLinkMetadata gets metadata for links. - * - * @generated from rpc memos.api.v1.MemoService.BatchGetLinkMetadata - */ - batchGetLinkMetadata: { - methodKind: "unary"; - input: typeof BatchGetLinkMetadataRequestSchema; - output: typeof BatchGetLinkMetadataResponseSchema; - }, -}> = /*@__PURE__*/ - serviceDesc(file_api_v1_memo_service, 0); - diff --git a/web/src/types/proto/api/v1/space_service_pb.ts b/web/src/types/proto/api/v1/space_service_pb.ts deleted file mode 100644 index ed0b7356e..000000000 --- a/web/src/types/proto/api/v1/space_service_pb.ts +++ /dev/null @@ -1,859 +0,0 @@ -// @generated by protoc-gen-es v2.12.1 with parameter "target=ts" -// @generated from file api/v1/space_service.proto (package memos.api.v1, syntax proto3) -/* eslint-disable */ - -import type { GenEnum, GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv2"; -import { enumDesc, fileDesc, messageDesc, serviceDesc } from "@bufbuild/protobuf/codegenv2"; -import { file_google_api_annotations } from "../../google/api/annotations_pb"; -import { file_google_api_client } from "../../google/api/client_pb"; -import { file_google_api_field_behavior } from "../../google/api/field_behavior_pb"; -import { file_google_api_resource } from "../../google/api/resource_pb"; -import type { EmptySchema, FieldMask } from "@bufbuild/protobuf/wkt"; -import { file_google_protobuf_empty, file_google_protobuf_field_mask } from "@bufbuild/protobuf/wkt"; -import type { Message } from "@bufbuild/protobuf"; - -/** - * Describes the file api/v1/space_service.proto. - */ -export const file_api_v1_space_service: GenFile = /*@__PURE__*/ - fileDesc("ChphcGkvdjEvc3BhY2Vfc2VydmljZS5wcm90bxIMbWVtb3MuYXBpLnYxIsICCgVTcGFjZRIRCgRuYW1lGAEgASgJQgPgQQgSEgoFdGl0bGUYAiABKAlCA+BBAhIYCgtkZXNjcmlwdGlvbhgDIAEoCUID4EEBEj4KEWN1cnJlbnRfdXNlcl9yb2xlGAQgASgOMh4ubWVtb3MuYXBpLnYxLlNwYWNlTWVtYmVyLlJvbGVCA+BBAxIZCgxtZW1iZXJfY291bnQYBSABKAVCA+BBAxIrCgRpY29uGAYgASgLMhgubWVtb3MuYXBpLnYxLlNwYWNlLkljb25CA+BBARoyCgRJY29uEg8KBWVtb2ppGAEgASgJSAASEAoGbHVjaWRlGAIgASgJSABCBwoFdmFsdWU6POpBOQoSbWVtb3MuYXBpLnYxL1NwYWNlEg5zcGFjZXMve3NwYWNlfRoEbmFtZSoGc3BhY2VzMgVzcGFjZSKQAgoLU3BhY2VNZW1iZXISEQoEbmFtZRgBIAEoCUID4EEIEicKBHVzZXIYAiABKAlCGeBBAvpBEwoRbWVtb3MuYXBpLnYxL1VzZXISMQoEcm9sZRgDIAEoDjIeLm1lbW9zLmFwaS52MS5TcGFjZU1lbWJlci5Sb2xlQgPgQQIiMQoEUm9sZRIUChBST0xFX1VOU1BFQ0lGSUVEEAASCQoFQURNSU4QARIICgRVU0VSEAI6X+pBXAoYbWVtb3MuYXBpLnYxL1NwYWNlTWVtYmVyEh9zcGFjZXMve3NwYWNlfS9tZW1iZXJzL3ttZW1iZXJ9GgRuYW1lKgxzcGFjZU1lbWJlcnMyC3NwYWNlTWVtYmVyIqECCg9TcGFjZUludml0YXRpb24SEQoEbmFtZRgBIAEoCUID4EEIEioKB2ludml0ZWUYAiABKAlCGeBBAvpBEwoRbWVtb3MuYXBpLnYxL1VzZXISMQoEcm9sZRgDIAEoDjIeLm1lbW9zLmFwaS52MS5TcGFjZU1lbWJlci5Sb2xlQgPgQQISJwoFc3BhY2UYBCABKAsyEy5tZW1vcy5hcGkudjEuU3BhY2VCA+BBAzpz6kFwChxtZW1vcy5hcGkudjEvU3BhY2VJbnZpdGF0aW9uEidzcGFjZXMve3NwYWNlfS9pbnZpdGF0aW9ucy97aW52aXRhdGlvbn0aBG5hbWUqEHNwYWNlSW52aXRhdGlvbnMyD3NwYWNlSW52aXRhdGlvbiJUChJDcmVhdGVTcGFjZVJlcXVlc3QSJwoFc3BhY2UYASABKAsyEy5tZW1vcy5hcGkudjEuU3BhY2VCA+BBAhIVCghzcGFjZV9pZBgCIAEoCUID4EEBIkQKEUxpc3RTcGFjZXNSZXF1ZXN0EhYKCXBhZ2Vfc2l6ZRgBIAEoBUID4EEBEhcKCnBhZ2VfdG9rZW4YAiABKAlCA+BBASJSChJMaXN0U3BhY2VzUmVzcG9uc2USIwoGc3BhY2VzGAEgAygLMhMubWVtb3MuYXBpLnYxLlNwYWNlEhcKD25leHRfcGFnZV90b2tlbhgCIAEoCSI7Cg9HZXRTcGFjZVJlcXVlc3QSKAoEbmFtZRgBIAEoCUIa4EEC+kEUChJtZW1vcy5hcGkudjEvU3BhY2UicwoSVXBkYXRlU3BhY2VSZXF1ZXN0EicKBXNwYWNlGAEgASgLMhMubWVtb3MuYXBpLnYxLlNwYWNlQgPgQQISNAoLdXBkYXRlX21hc2sYAiABKAsyGi5nb29nbGUucHJvdG9idWYuRmllbGRNYXNrQgPgQQIiPgoSRGVsZXRlU3BhY2VSZXF1ZXN0EigKBG5hbWUYASABKAlCGuBBAvpBFAoSbWVtb3MuYXBpLnYxL1NwYWNlIpIBChxDcmVhdGVTcGFjZUludml0YXRpb25SZXF1ZXN0EjQKBnBhcmVudBgBIAEoCUIk4EEC+kEeEhxtZW1vcy5hcGkudjEvU3BhY2VJbnZpdGF0aW9uEjwKEHNwYWNlX2ludml0YXRpb24YAiABKAsyHS5tZW1vcy5hcGkudjEuU3BhY2VJbnZpdGF0aW9uQgPgQQIihAEKG0xpc3RTcGFjZUludml0YXRpb25zUmVxdWVzdBI0CgZwYXJlbnQYASABKAlCJOBBAvpBHhIcbWVtb3MuYXBpLnYxL1NwYWNlSW52aXRhdGlvbhIWCglwYWdlX3NpemUYAiABKAVCA+BBARIXCgpwYWdlX3Rva2VuGAMgASgJQgPgQQEicQocTGlzdFNwYWNlSW52aXRhdGlvbnNSZXNwb25zZRI4ChFzcGFjZV9pbnZpdGF0aW9ucxgBIAMoCzIdLm1lbW9zLmFwaS52MS5TcGFjZUludml0YXRpb24SFwoPbmV4dF9wYWdlX3Rva2VuGAIgASgJIn0KH0xpc3RVc2VyU3BhY2VJbnZpdGF0aW9uc1JlcXVlc3QSKQoGcGFyZW50GAEgASgJQhngQQL6QRMKEW1lbW9zLmFwaS52MS9Vc2VyEhYKCXBhZ2Vfc2l6ZRgCIAEoBUID4EEBEhcKCnBhZ2VfdG9rZW4YAyABKAlCA+BBASJ1CiBMaXN0VXNlclNwYWNlSW52aXRhdGlvbnNSZXNwb25zZRI4ChFzcGFjZV9pbnZpdGF0aW9ucxgBIAMoCzIdLm1lbW9zLmFwaS52MS5TcGFjZUludml0YXRpb24SFwoPbmV4dF9wYWdlX3Rva2VuGAIgASgJIk8KGUdldFNwYWNlSW52aXRhdGlvblJlcXVlc3QSMgoEbmFtZRgBIAEoCUIk4EEC+kEeChxtZW1vcy5hcGkudjEvU3BhY2VJbnZpdGF0aW9uIlIKHERlbGV0ZVNwYWNlSW52aXRhdGlvblJlcXVlc3QSMgoEbmFtZRgBIAEoCUIk4EEC+kEeChxtZW1vcy5hcGkudjEvU3BhY2VJbnZpdGF0aW9uIlIKHEFjY2VwdFNwYWNlSW52aXRhdGlvblJlcXVlc3QSMgoEbmFtZRgBIAEoCUIk4EEC+kEeChxtZW1vcy5hcGkudjEvU3BhY2VJbnZpdGF0aW9uIlMKHURlY2xpbmVTcGFjZUludml0YXRpb25SZXF1ZXN0EjIKBG5hbWUYASABKAlCJOBBAvpBHgocbWVtb3MuYXBpLnYxL1NwYWNlSW52aXRhdGlvbiJ8ChdMaXN0U3BhY2VNZW1iZXJzUmVxdWVzdBIwCgZwYXJlbnQYASABKAlCIOBBAvpBGhIYbWVtb3MuYXBpLnYxL1NwYWNlTWVtYmVyEhYKCXBhZ2Vfc2l6ZRgCIAEoBUID4EEBEhcKCnBhZ2VfdG9rZW4YAyABKAlCA+BBASJlChhMaXN0U3BhY2VNZW1iZXJzUmVzcG9uc2USMAoNc3BhY2VfbWVtYmVycxgBIAMoCzIZLm1lbW9zLmFwaS52MS5TcGFjZU1lbWJlchIXCg9uZXh0X3BhZ2VfdG9rZW4YAiABKAkiRwoVR2V0U3BhY2VNZW1iZXJSZXF1ZXN0Ei4KBG5hbWUYASABKAlCIOBBAvpBGgoYbWVtb3MuYXBpLnYxL1NwYWNlTWVtYmVyIoYBChhVcGRhdGVTcGFjZU1lbWJlclJlcXVlc3QSNAoMc3BhY2VfbWVtYmVyGAEgASgLMhkubWVtb3MuYXBpLnYxLlNwYWNlTWVtYmVyQgPgQQISNAoLdXBkYXRlX21hc2sYAiABKAsyGi5nb29nbGUucHJvdG9idWYuRmllbGRNYXNrQgPgQQIiSgoYRGVsZXRlU3BhY2VNZW1iZXJSZXF1ZXN0Ei4KBG5hbWUYASABKAlCIOBBAvpBGgoYbWVtb3MuYXBpLnYxL1NwYWNlTWVtYmVyMrMSCgxTcGFjZVNlcnZpY2USawoLQ3JlYXRlU3BhY2USIC5tZW1vcy5hcGkudjEuQ3JlYXRlU3BhY2VSZXF1ZXN0GhMubWVtb3MuYXBpLnYxLlNwYWNlIiXaQQVzcGFjZYLT5JMCFzoFc3BhY2UiDi9hcGkvdjEvc3BhY2VzEmoKCkxpc3RTcGFjZXMSHy5tZW1vcy5hcGkudjEuTGlzdFNwYWNlc1JlcXVlc3QaIC5tZW1vcy5hcGkudjEuTGlzdFNwYWNlc1Jlc3BvbnNlIhnaQQCC0+STAhASDi9hcGkvdjEvc3BhY2VzEmYKCEdldFNwYWNlEh0ubWVtb3MuYXBpLnYxLkdldFNwYWNlUmVxdWVzdBoTLm1lbW9zLmFwaS52MS5TcGFjZSIm2kEEbmFtZYLT5JMCGRIXL2FwaS92MS97bmFtZT1zcGFjZXMvKn0ShgEKC1VwZGF0ZVNwYWNlEiAubWVtb3MuYXBpLnYxLlVwZGF0ZVNwYWNlUmVxdWVzdBoTLm1lbW9zLmFwaS52MS5TcGFjZSJA2kERc3BhY2UsdXBkYXRlX21hc2uC0+STAiY6BXNwYWNlMh0vYXBpL3YxL3tzcGFjZS5uYW1lPXNwYWNlcy8qfRJvCgtEZWxldGVTcGFjZRIgLm1lbW9zLmFwaS52MS5EZWxldGVTcGFjZVJlcXVlc3QaFi5nb29nbGUucHJvdG9idWYuRW1wdHkiJtpBBG5hbWWC0+STAhkqFy9hcGkvdjEve25hbWU9c3BhY2VzLyp9Er0BChVDcmVhdGVTcGFjZUludml0YXRpb24SKi5tZW1vcy5hcGkudjEuQ3JlYXRlU3BhY2VJbnZpdGF0aW9uUmVxdWVzdBodLm1lbW9zLmFwaS52MS5TcGFjZUludml0YXRpb24iWdpBF3BhcmVudCxzcGFjZV9pbnZpdGF0aW9ugtPkkwI5OhBzcGFjZV9pbnZpdGF0aW9uIiUvYXBpL3YxL3twYXJlbnQ9c3BhY2VzLyp9L2ludml0YXRpb25zEqUBChRMaXN0U3BhY2VJbnZpdGF0aW9ucxIpLm1lbW9zLmFwaS52MS5MaXN0U3BhY2VJbnZpdGF0aW9uc1JlcXVlc3QaKi5tZW1vcy5hcGkudjEuTGlzdFNwYWNlSW52aXRhdGlvbnNSZXNwb25zZSI22kEGcGFyZW50gtPkkwInEiUvYXBpL3YxL3twYXJlbnQ9c3BhY2VzLyp9L2ludml0YXRpb25zErUBChhMaXN0VXNlclNwYWNlSW52aXRhdGlvbnMSLS5tZW1vcy5hcGkudjEuTGlzdFVzZXJTcGFjZUludml0YXRpb25zUmVxdWVzdBouLm1lbW9zLmFwaS52MS5MaXN0VXNlclNwYWNlSW52aXRhdGlvbnNSZXNwb25zZSI62kEGcGFyZW50gtPkkwIrEikvYXBpL3YxL3twYXJlbnQ9dXNlcnMvKn0vc3BhY2VJbnZpdGF0aW9ucxKSAQoSR2V0U3BhY2VJbnZpdGF0aW9uEicubWVtb3MuYXBpLnYxLkdldFNwYWNlSW52aXRhdGlvblJlcXVlc3QaHS5tZW1vcy5hcGkudjEuU3BhY2VJbnZpdGF0aW9uIjTaQQRuYW1lgtPkkwInEiUvYXBpL3YxL3tuYW1lPXNwYWNlcy8qL2ludml0YXRpb25zLyp9EpEBChVEZWxldGVTcGFjZUludml0YXRpb24SKi5tZW1vcy5hcGkudjEuRGVsZXRlU3BhY2VJbnZpdGF0aW9uUmVxdWVzdBoWLmdvb2dsZS5wcm90b2J1Zi5FbXB0eSI02kEEbmFtZYLT5JMCJyolL2FwaS92MS97bmFtZT1zcGFjZXMvKi9pbnZpdGF0aW9ucy8qfRKeAQoVQWNjZXB0U3BhY2VJbnZpdGF0aW9uEioubWVtb3MuYXBpLnYxLkFjY2VwdFNwYWNlSW52aXRhdGlvblJlcXVlc3QaGS5tZW1vcy5hcGkudjEuU3BhY2VNZW1iZXIiPtpBBG5hbWWC0+STAjE6ASoiLC9hcGkvdjEve25hbWU9c3BhY2VzLyovaW52aXRhdGlvbnMvKn06YWNjZXB0Ep4BChZEZWNsaW5lU3BhY2VJbnZpdGF0aW9uEisubWVtb3MuYXBpLnYxLkRlY2xpbmVTcGFjZUludml0YXRpb25SZXF1ZXN0GhYuZ29vZ2xlLnByb3RvYnVmLkVtcHR5Ij/aQQRuYW1lgtPkkwIyOgEqIi0vYXBpL3YxL3tuYW1lPXNwYWNlcy8qL2ludml0YXRpb25zLyp9OmRlY2xpbmUSlQEKEExpc3RTcGFjZU1lbWJlcnMSJS5tZW1vcy5hcGkudjEuTGlzdFNwYWNlTWVtYmVyc1JlcXVlc3QaJi5tZW1vcy5hcGkudjEuTGlzdFNwYWNlTWVtYmVyc1Jlc3BvbnNlIjLaQQZwYXJlbnSC0+STAiMSIS9hcGkvdjEve3BhcmVudD1zcGFjZXMvKn0vbWVtYmVycxKCAQoOR2V0U3BhY2VNZW1iZXISIy5tZW1vcy5hcGkudjEuR2V0U3BhY2VNZW1iZXJSZXF1ZXN0GhkubWVtb3MuYXBpLnYxLlNwYWNlTWVtYmVyIjDaQQRuYW1lgtPkkwIjEiEvYXBpL3YxL3tuYW1lPXNwYWNlcy8qL21lbWJlcnMvKn0StwEKEVVwZGF0ZVNwYWNlTWVtYmVyEiYubWVtb3MuYXBpLnYxLlVwZGF0ZVNwYWNlTWVtYmVyUmVxdWVzdBoZLm1lbW9zLmFwaS52MS5TcGFjZU1lbWJlciJf2kEYc3BhY2VfbWVtYmVyLHVwZGF0ZV9tYXNrgtPkkwI+OgxzcGFjZV9tZW1iZXIyLi9hcGkvdjEve3NwYWNlX21lbWJlci5uYW1lPXNwYWNlcy8qL21lbWJlcnMvKn0ShQEKEURlbGV0ZVNwYWNlTWVtYmVyEiYubWVtb3MuYXBpLnYxLkRlbGV0ZVNwYWNlTWVtYmVyUmVxdWVzdBoWLmdvb2dsZS5wcm90b2J1Zi5FbXB0eSIw2kEEbmFtZYLT5JMCIyohL2FwaS92MS97bmFtZT1zcGFjZXMvKi9tZW1iZXJzLyp9QqkBChBjb20ubWVtb3MuYXBpLnYxQhFTcGFjZVNlcnZpY2VQcm90b1ABWjBnaXRodWIuY29tL3VzZW1lbW9zL21lbW9zL3Byb3RvL2dlbi9hcGkvdjE7YXBpdjGiAgNNQViqAgxNZW1vcy5BcGkuVjHKAgxNZW1vc1xBcGlcVjHiAhhNZW1vc1xBcGlcVjFcR1BCTWV0YWRhdGHqAg5NZW1vczo6QXBpOjpWMWIGcHJvdG8z", [file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_empty, file_google_protobuf_field_mask]); - -/** - * Space is a collaboration boundary for placed memos. - * - * @generated from message memos.api.v1.Space - */ -export type Space = Message<"memos.api.v1.Space"> & { - /** - * The resource name of the space. Format: spaces/{space}. - * - * @generated from field: string name = 1; - */ - name: string; - - /** - * Required. The human-readable title. - * - * @generated from field: string title = 2; - */ - title: string; - - /** - * Optional. A description of the space. - * - * @generated from field: string description = 3; - */ - description: string; - - /** - * Output only. The authenticated user's membership role in this space. - * ROLE_UNSPECIFIED when this Space is exposed as metadata-only. - * - * @generated from field: memos.api.v1.SpaceMember.Role current_user_role = 4; - */ - currentUserRole: SpaceMember_Role; - - /** - * Output only. The number of accepted members in this space. Pending - * invitations are excluded. Zero when this Space is exposed as metadata-only. - * - * @generated from field: int32 member_count = 5; - */ - memberCount: number; - - /** - * Optional. Display icon. Omit when updating with the "icon" mask to reset - * to the default Space mark. - * - * @generated from field: memos.api.v1.Space.Icon icon = 6; - */ - icon?: Space_Icon | undefined; -}; - -/** - * Describes the message memos.api.v1.Space. - * Use `create(SpaceSchema)` to create a new message. - */ -export const SpaceSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_space_service, 0); - -/** - * @generated from message memos.api.v1.Space.Icon - */ -export type Space_Icon = Message<"memos.api.v1.Space.Icon"> & { - /** - * @generated from oneof memos.api.v1.Space.Icon.value - */ - value: { - /** - * A Unicode emoji sequence. - * - * @generated from field: string emoji = 1; - */ - value: string; - case: "emoji"; - } | { - /** - * A canonical Lucide icon name, such as "leaf". - * - * @generated from field: string lucide = 2; - */ - value: string; - case: "lucide"; - } | { case: undefined; value?: undefined }; -}; - -/** - * Describes the message memos.api.v1.Space.Icon. - * Use `create(Space_IconSchema)` to create a new message. - */ -export const Space_IconSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_space_service, 0, 0); - -/** - * SpaceMember is a user's membership and governance role in a space. - * - * @generated from message memos.api.v1.SpaceMember - */ -export type SpaceMember = Message<"memos.api.v1.SpaceMember"> & { - /** - * The resource name. Format: spaces/{space}/members/{username}. - * - * @generated from field: string name = 1; - */ - name: string; - - /** - * Required. The member user. Format: users/{username}. - * - * @generated from field: string user = 2; - */ - user: string; - - /** - * Required. The member's role within this space. - * - * @generated from field: memos.api.v1.SpaceMember.Role role = 3; - */ - role: SpaceMember_Role; -}; - -/** - * Describes the message memos.api.v1.SpaceMember. - * Use `create(SpaceMemberSchema)` to create a new message. - */ -export const SpaceMemberSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_space_service, 1); - -/** - * @generated from enum memos.api.v1.SpaceMember.Role - */ -export enum SpaceMember_Role { - /** - * @generated from enum value: ROLE_UNSPECIFIED = 0; - */ - ROLE_UNSPECIFIED = 0, - - /** - * @generated from enum value: ADMIN = 1; - */ - ADMIN = 1, - - /** - * @generated from enum value: USER = 2; - */ - USER = 2, -} - -/** - * Describes the enum memos.api.v1.SpaceMember.Role. - */ -export const SpaceMember_RoleSchema: GenEnum = /*@__PURE__*/ - enumDesc(file_api_v1_space_service, 1, 0); - -/** - * SpaceInvitation is a pending invitation for an existing user to join a space. - * - * @generated from message memos.api.v1.SpaceInvitation - */ -export type SpaceInvitation = Message<"memos.api.v1.SpaceInvitation"> & { - /** - * The resource name. Format: spaces/{space}/invitations/{username}. - * - * @generated from field: string name = 1; - */ - name: string; - - /** - * Required. The invited user. Format: users/{username}. - * - * @generated from field: string invitee = 2; - */ - invitee: string; - - /** - * Required. The role the user will receive after accepting the invitation. - * - * @generated from field: memos.api.v1.SpaceMember.Role role = 3; - */ - role: SpaceMember_Role; - - /** - * Output only. The Space the user is invited to. This lets an invitee - * understand the invitation without granting membership-based GetSpace access. - * - * @generated from field: memos.api.v1.Space space = 4; - */ - space?: Space | undefined; -}; - -/** - * Describes the message memos.api.v1.SpaceInvitation. - * Use `create(SpaceInvitationSchema)` to create a new message. - */ -export const SpaceInvitationSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_space_service, 2); - -/** - * @generated from message memos.api.v1.CreateSpaceRequest - */ -export type CreateSpaceRequest = Message<"memos.api.v1.CreateSpaceRequest"> & { - /** - * Required. The space to create. - * - * @generated from field: memos.api.v1.Space space = 1; - */ - space?: Space | undefined; - - /** - * Optional. The space UID to use for this space. - * If empty, a canonical UUID v4 will be generated. - * Format: ^[a-zA-Z0-9]([a-zA-Z0-9-]{0,34}[a-zA-Z0-9])?$ - * - * @generated from field: string space_id = 2; - */ - spaceId: string; -}; - -/** - * Describes the message memos.api.v1.CreateSpaceRequest. - * Use `create(CreateSpaceRequestSchema)` to create a new message. - */ -export const CreateSpaceRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_space_service, 3); - -/** - * @generated from message memos.api.v1.ListSpacesRequest - */ -export type ListSpacesRequest = Message<"memos.api.v1.ListSpacesRequest"> & { - /** - * Optional. The maximum number of spaces to return. - * - * @generated from field: int32 page_size = 1; - */ - pageSize: number; - - /** - * Optional. A token from a previous ListSpaces response. - * - * @generated from field: string page_token = 2; - */ - pageToken: string; -}; - -/** - * Describes the message memos.api.v1.ListSpacesRequest. - * Use `create(ListSpacesRequestSchema)` to create a new message. - */ -export const ListSpacesRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_space_service, 4); - -/** - * @generated from message memos.api.v1.ListSpacesResponse - */ -export type ListSpacesResponse = Message<"memos.api.v1.ListSpacesResponse"> & { - /** - * @generated from field: repeated memos.api.v1.Space spaces = 1; - */ - spaces: Space[]; - - /** - * @generated from field: string next_page_token = 2; - */ - nextPageToken: string; -}; - -/** - * Describes the message memos.api.v1.ListSpacesResponse. - * Use `create(ListSpacesResponseSchema)` to create a new message. - */ -export const ListSpacesResponseSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_space_service, 5); - -/** - * @generated from message memos.api.v1.GetSpaceRequest - */ -export type GetSpaceRequest = Message<"memos.api.v1.GetSpaceRequest"> & { - /** - * Required. The resource name of the space. - * - * @generated from field: string name = 1; - */ - name: string; -}; - -/** - * Describes the message memos.api.v1.GetSpaceRequest. - * Use `create(GetSpaceRequestSchema)` to create a new message. - */ -export const GetSpaceRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_space_service, 6); - -/** - * @generated from message memos.api.v1.UpdateSpaceRequest - */ -export type UpdateSpaceRequest = Message<"memos.api.v1.UpdateSpaceRequest"> & { - /** - * Required. The space with updated values. - * - * @generated from field: memos.api.v1.Space space = 1; - */ - space?: Space | undefined; - - /** - * Required. The fields to update: title or description. - * - * @generated from field: google.protobuf.FieldMask update_mask = 2; - */ - updateMask?: FieldMask | undefined; -}; - -/** - * Describes the message memos.api.v1.UpdateSpaceRequest. - * Use `create(UpdateSpaceRequestSchema)` to create a new message. - */ -export const UpdateSpaceRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_space_service, 7); - -/** - * @generated from message memos.api.v1.DeleteSpaceRequest - */ -export type DeleteSpaceRequest = Message<"memos.api.v1.DeleteSpaceRequest"> & { - /** - * Required. The resource name of the space. - * - * @generated from field: string name = 1; - */ - name: string; -}; - -/** - * Describes the message memos.api.v1.DeleteSpaceRequest. - * Use `create(DeleteSpaceRequestSchema)` to create a new message. - */ -export const DeleteSpaceRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_space_service, 8); - -/** - * @generated from message memos.api.v1.CreateSpaceInvitationRequest - */ -export type CreateSpaceInvitationRequest = Message<"memos.api.v1.CreateSpaceInvitationRequest"> & { - /** - * Required. The parent space. Format: spaces/{space}. - * - * @generated from field: string parent = 1; - */ - parent: string; - - /** - * Required. The invitation to create. - * - * @generated from field: memos.api.v1.SpaceInvitation space_invitation = 2; - */ - spaceInvitation?: SpaceInvitation | undefined; -}; - -/** - * Describes the message memos.api.v1.CreateSpaceInvitationRequest. - * Use `create(CreateSpaceInvitationRequestSchema)` to create a new message. - */ -export const CreateSpaceInvitationRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_space_service, 9); - -/** - * @generated from message memos.api.v1.ListSpaceInvitationsRequest - */ -export type ListSpaceInvitationsRequest = Message<"memos.api.v1.ListSpaceInvitationsRequest"> & { - /** - * Required. The parent space. Format: spaces/{space}. - * - * @generated from field: string parent = 1; - */ - parent: string; - - /** - * Optional. The maximum number of invitations to return. - * - * @generated from field: int32 page_size = 2; - */ - pageSize: number; - - /** - * Optional. A token from a previous ListSpaceInvitations response. - * - * @generated from field: string page_token = 3; - */ - pageToken: string; -}; - -/** - * Describes the message memos.api.v1.ListSpaceInvitationsRequest. - * Use `create(ListSpaceInvitationsRequestSchema)` to create a new message. - */ -export const ListSpaceInvitationsRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_space_service, 10); - -/** - * @generated from message memos.api.v1.ListSpaceInvitationsResponse - */ -export type ListSpaceInvitationsResponse = Message<"memos.api.v1.ListSpaceInvitationsResponse"> & { - /** - * @generated from field: repeated memos.api.v1.SpaceInvitation space_invitations = 1; - */ - spaceInvitations: SpaceInvitation[]; - - /** - * @generated from field: string next_page_token = 2; - */ - nextPageToken: string; -}; - -/** - * Describes the message memos.api.v1.ListSpaceInvitationsResponse. - * Use `create(ListSpaceInvitationsResponseSchema)` to create a new message. - */ -export const ListSpaceInvitationsResponseSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_space_service, 11); - -/** - * @generated from message memos.api.v1.ListUserSpaceInvitationsRequest - */ -export type ListUserSpaceInvitationsRequest = Message<"memos.api.v1.ListUserSpaceInvitationsRequest"> & { - /** - * Required. The authenticated user. Format: users/{username}. - * - * @generated from field: string parent = 1; - */ - parent: string; - - /** - * Optional. The maximum number of invitations to return. - * - * @generated from field: int32 page_size = 2; - */ - pageSize: number; - - /** - * Optional. A token from a previous ListUserSpaceInvitations response. - * - * @generated from field: string page_token = 3; - */ - pageToken: string; -}; - -/** - * Describes the message memos.api.v1.ListUserSpaceInvitationsRequest. - * Use `create(ListUserSpaceInvitationsRequestSchema)` to create a new message. - */ -export const ListUserSpaceInvitationsRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_space_service, 12); - -/** - * @generated from message memos.api.v1.ListUserSpaceInvitationsResponse - */ -export type ListUserSpaceInvitationsResponse = Message<"memos.api.v1.ListUserSpaceInvitationsResponse"> & { - /** - * @generated from field: repeated memos.api.v1.SpaceInvitation space_invitations = 1; - */ - spaceInvitations: SpaceInvitation[]; - - /** - * @generated from field: string next_page_token = 2; - */ - nextPageToken: string; -}; - -/** - * Describes the message memos.api.v1.ListUserSpaceInvitationsResponse. - * Use `create(ListUserSpaceInvitationsResponseSchema)` to create a new message. - */ -export const ListUserSpaceInvitationsResponseSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_space_service, 13); - -/** - * @generated from message memos.api.v1.GetSpaceInvitationRequest - */ -export type GetSpaceInvitationRequest = Message<"memos.api.v1.GetSpaceInvitationRequest"> & { - /** - * Required. Format: spaces/{space}/invitations/{username}. - * - * @generated from field: string name = 1; - */ - name: string; -}; - -/** - * Describes the message memos.api.v1.GetSpaceInvitationRequest. - * Use `create(GetSpaceInvitationRequestSchema)` to create a new message. - */ -export const GetSpaceInvitationRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_space_service, 14); - -/** - * @generated from message memos.api.v1.DeleteSpaceInvitationRequest - */ -export type DeleteSpaceInvitationRequest = Message<"memos.api.v1.DeleteSpaceInvitationRequest"> & { - /** - * Required. Format: spaces/{space}/invitations/{username}. - * - * @generated from field: string name = 1; - */ - name: string; -}; - -/** - * Describes the message memos.api.v1.DeleteSpaceInvitationRequest. - * Use `create(DeleteSpaceInvitationRequestSchema)` to create a new message. - */ -export const DeleteSpaceInvitationRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_space_service, 15); - -/** - * @generated from message memos.api.v1.AcceptSpaceInvitationRequest - */ -export type AcceptSpaceInvitationRequest = Message<"memos.api.v1.AcceptSpaceInvitationRequest"> & { - /** - * Required. Format: spaces/{space}/invitations/{username}. - * - * @generated from field: string name = 1; - */ - name: string; -}; - -/** - * Describes the message memos.api.v1.AcceptSpaceInvitationRequest. - * Use `create(AcceptSpaceInvitationRequestSchema)` to create a new message. - */ -export const AcceptSpaceInvitationRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_space_service, 16); - -/** - * @generated from message memos.api.v1.DeclineSpaceInvitationRequest - */ -export type DeclineSpaceInvitationRequest = Message<"memos.api.v1.DeclineSpaceInvitationRequest"> & { - /** - * Required. Format: spaces/{space}/invitations/{username}. - * - * @generated from field: string name = 1; - */ - name: string; -}; - -/** - * Describes the message memos.api.v1.DeclineSpaceInvitationRequest. - * Use `create(DeclineSpaceInvitationRequestSchema)` to create a new message. - */ -export const DeclineSpaceInvitationRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_space_service, 17); - -/** - * @generated from message memos.api.v1.ListSpaceMembersRequest - */ -export type ListSpaceMembersRequest = Message<"memos.api.v1.ListSpaceMembersRequest"> & { - /** - * Required. The parent space. Format: spaces/{space}. - * - * @generated from field: string parent = 1; - */ - parent: string; - - /** - * Optional. The maximum number of members to return. - * - * @generated from field: int32 page_size = 2; - */ - pageSize: number; - - /** - * Optional. A token from a previous ListSpaceMembers response. - * - * @generated from field: string page_token = 3; - */ - pageToken: string; -}; - -/** - * Describes the message memos.api.v1.ListSpaceMembersRequest. - * Use `create(ListSpaceMembersRequestSchema)` to create a new message. - */ -export const ListSpaceMembersRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_space_service, 18); - -/** - * @generated from message memos.api.v1.ListSpaceMembersResponse - */ -export type ListSpaceMembersResponse = Message<"memos.api.v1.ListSpaceMembersResponse"> & { - /** - * @generated from field: repeated memos.api.v1.SpaceMember space_members = 1; - */ - spaceMembers: SpaceMember[]; - - /** - * @generated from field: string next_page_token = 2; - */ - nextPageToken: string; -}; - -/** - * Describes the message memos.api.v1.ListSpaceMembersResponse. - * Use `create(ListSpaceMembersResponseSchema)` to create a new message. - */ -export const ListSpaceMembersResponseSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_space_service, 19); - -/** - * @generated from message memos.api.v1.GetSpaceMemberRequest - */ -export type GetSpaceMemberRequest = Message<"memos.api.v1.GetSpaceMemberRequest"> & { - /** - * Required. Format: spaces/{space}/members/{username}. - * - * @generated from field: string name = 1; - */ - name: string; -}; - -/** - * Describes the message memos.api.v1.GetSpaceMemberRequest. - * Use `create(GetSpaceMemberRequestSchema)` to create a new message. - */ -export const GetSpaceMemberRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_space_service, 20); - -/** - * @generated from message memos.api.v1.UpdateSpaceMemberRequest - */ -export type UpdateSpaceMemberRequest = Message<"memos.api.v1.UpdateSpaceMemberRequest"> & { - /** - * Required. The membership with the new role. - * - * @generated from field: memos.api.v1.SpaceMember space_member = 1; - */ - spaceMember?: SpaceMember | undefined; - - /** - * Required. Only role is supported. - * - * @generated from field: google.protobuf.FieldMask update_mask = 2; - */ - updateMask?: FieldMask | undefined; -}; - -/** - * Describes the message memos.api.v1.UpdateSpaceMemberRequest. - * Use `create(UpdateSpaceMemberRequestSchema)` to create a new message. - */ -export const UpdateSpaceMemberRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_space_service, 21); - -/** - * @generated from message memos.api.v1.DeleteSpaceMemberRequest - */ -export type DeleteSpaceMemberRequest = Message<"memos.api.v1.DeleteSpaceMemberRequest"> & { - /** - * Required. Format: spaces/{space}/members/{username}. - * - * @generated from field: string name = 1; - */ - name: string; -}; - -/** - * Describes the message memos.api.v1.DeleteSpaceMemberRequest. - * Use `create(DeleteSpaceMemberRequestSchema)` to create a new message. - */ -export const DeleteSpaceMemberRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_space_service, 22); - -/** - * SpaceService manages collaborative spaces and their memberships. - * - * @generated from service memos.api.v1.SpaceService - */ -export const SpaceService: GenService<{ - /** - * CreateSpace creates a space and makes the authenticated caller its first - * administrator. - * - * @generated from rpc memos.api.v1.SpaceService.CreateSpace - */ - createSpace: { - methodKind: "unary"; - input: typeof CreateSpaceRequestSchema; - output: typeof SpaceSchema; - }, - /** - * ListSpaces lists spaces of which the authenticated caller is a member. - * - * @generated from rpc memos.api.v1.SpaceService.ListSpaces - */ - listSpaces: { - methodKind: "unary"; - input: typeof ListSpacesRequestSchema; - output: typeof ListSpacesResponseSchema; - }, - /** - * GetSpace gets a space of which the authenticated caller is a member. - * - * @generated from rpc memos.api.v1.SpaceService.GetSpace - */ - getSpace: { - methodKind: "unary"; - input: typeof GetSpaceRequestSchema; - output: typeof SpaceSchema; - }, - /** - * UpdateSpace updates space metadata. - * - * @generated from rpc memos.api.v1.SpaceService.UpdateSpace - */ - updateSpace: { - methodKind: "unary"; - input: typeof UpdateSpaceRequestSchema; - output: typeof SpaceSchema; - }, - /** - * DeleteSpace permanently deletes a space and every memo currently placed - * in it. It never follows memo relations to other memos. - * - * @generated from rpc memos.api.v1.SpaceService.DeleteSpace - */ - deleteSpace: { - methodKind: "unary"; - input: typeof DeleteSpaceRequestSchema; - output: typeof EmptySchema; - }, - /** - * CreateSpaceInvitation invites an existing active user to a space. - * - * @generated from rpc memos.api.v1.SpaceService.CreateSpaceInvitation - */ - createSpaceInvitation: { - methodKind: "unary"; - input: typeof CreateSpaceInvitationRequestSchema; - output: typeof SpaceInvitationSchema; - }, - /** - * ListSpaceInvitations lists the pending invitations for a space. - * - * @generated from rpc memos.api.v1.SpaceService.ListSpaceInvitations - */ - listSpaceInvitations: { - methodKind: "unary"; - input: typeof ListSpaceInvitationsRequestSchema; - output: typeof ListSpaceInvitationsResponseSchema; - }, - /** - * ListUserSpaceInvitations lists the authenticated user's pending space invitations. - * - * @generated from rpc memos.api.v1.SpaceService.ListUserSpaceInvitations - */ - listUserSpaceInvitations: { - methodKind: "unary"; - input: typeof ListUserSpaceInvitationsRequestSchema; - output: typeof ListUserSpaceInvitationsResponseSchema; - }, - /** - * GetSpaceInvitation gets one pending invitation. - * - * @generated from rpc memos.api.v1.SpaceService.GetSpaceInvitation - */ - getSpaceInvitation: { - methodKind: "unary"; - input: typeof GetSpaceInvitationRequestSchema; - output: typeof SpaceInvitationSchema; - }, - /** - * DeleteSpaceInvitation revokes a pending invitation. - * - * @generated from rpc memos.api.v1.SpaceService.DeleteSpaceInvitation - */ - deleteSpaceInvitation: { - methodKind: "unary"; - input: typeof DeleteSpaceInvitationRequestSchema; - output: typeof EmptySchema; - }, - /** - * AcceptSpaceInvitation accepts a pending invitation and creates a membership. - * - * @generated from rpc memos.api.v1.SpaceService.AcceptSpaceInvitation - */ - acceptSpaceInvitation: { - methodKind: "unary"; - input: typeof AcceptSpaceInvitationRequestSchema; - output: typeof SpaceMemberSchema; - }, - /** - * DeclineSpaceInvitation declines a pending invitation. - * - * @generated from rpc memos.api.v1.SpaceService.DeclineSpaceInvitation - */ - declineSpaceInvitation: { - methodKind: "unary"; - input: typeof DeclineSpaceInvitationRequestSchema; - output: typeof EmptySchema; - }, - /** - * ListSpaceMembers lists the members of a space. - * - * @generated from rpc memos.api.v1.SpaceService.ListSpaceMembers - */ - listSpaceMembers: { - methodKind: "unary"; - input: typeof ListSpaceMembersRequestSchema; - output: typeof ListSpaceMembersResponseSchema; - }, - /** - * GetSpaceMember gets one membership in a space. - * - * @generated from rpc memos.api.v1.SpaceService.GetSpaceMember - */ - getSpaceMember: { - methodKind: "unary"; - input: typeof GetSpaceMemberRequestSchema; - output: typeof SpaceMemberSchema; - }, - /** - * UpdateSpaceMember changes a member's space role. - * - * @generated from rpc memos.api.v1.SpaceService.UpdateSpaceMember - */ - updateSpaceMember: { - methodKind: "unary"; - input: typeof UpdateSpaceMemberRequestSchema; - output: typeof SpaceMemberSchema; - }, - /** - * DeleteSpaceMember removes a member. A member may delete their own - * membership to leave the space. - * - * @generated from rpc memos.api.v1.SpaceService.DeleteSpaceMember - */ - deleteSpaceMember: { - methodKind: "unary"; - input: typeof DeleteSpaceMemberRequestSchema; - output: typeof EmptySchema; - }, -}> = /*@__PURE__*/ - serviceDesc(file_api_v1_space_service, 0); - diff --git a/web/src/types/proto/api/v1/user_service_pb.ts b/web/src/types/proto/api/v1/user_service_pb.ts deleted file mode 100644 index 48f389b20..000000000 --- a/web/src/types/proto/api/v1/user_service_pb.ts +++ /dev/null @@ -1,2794 +0,0 @@ -// @generated by protoc-gen-es v2.12.1 with parameter "target=ts" -// @generated from file api/v1/user_service.proto (package memos.api.v1, syntax proto3) -/* eslint-disable */ - -import type { GenEnum, GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv2"; -import { enumDesc, fileDesc, messageDesc, serviceDesc } from "@bufbuild/protobuf/codegenv2"; -import type { State } from "./common_pb"; -import { file_api_v1_common } from "./common_pb"; -import type { Space, SpaceMember_Role } from "./space_service_pb"; -import { file_api_v1_space_service } from "./space_service_pb"; -import { file_google_api_annotations } from "../../google/api/annotations_pb"; -import { file_google_api_client } from "../../google/api/client_pb"; -import { file_google_api_field_behavior } from "../../google/api/field_behavior_pb"; -import type { HttpBodySchema } from "../../google/api/httpbody_pb"; -import { file_google_api_httpbody } from "../../google/api/httpbody_pb"; -import { file_google_api_resource } from "../../google/api/resource_pb"; -import type { EmptySchema, FieldMask, Timestamp } from "@bufbuild/protobuf/wkt"; -import { file_google_protobuf_empty, file_google_protobuf_field_mask, file_google_protobuf_timestamp } from "@bufbuild/protobuf/wkt"; -import type { Color } from "../../google/type/color_pb"; -import { file_google_type_color } from "../../google/type/color_pb"; -import type { Message } from "@bufbuild/protobuf"; - -/** - * Describes the file api/v1/user_service.proto. - */ -export const file_api_v1_user_service: GenFile = /*@__PURE__*/ - fileDesc("ChlhcGkvdjEvdXNlcl9zZXJ2aWNlLnByb3RvEgxtZW1vcy5hcGkudjEi1gMKBFVzZXISEQoEbmFtZRgBIAEoCUID4EEIEioKBHJvbGUYAiABKA4yFy5tZW1vcy5hcGkudjEuVXNlci5Sb2xlQgPgQQISFQoIdXNlcm5hbWUYAyABKAlCA+BBAhISCgVlbWFpbBgEIAEoCUID4EEBEhkKDGRpc3BsYXlfbmFtZRgFIAEoCUID4EEBEhcKCmF2YXRhcl91cmwYBiABKAlCA+BBARIYCgtkZXNjcmlwdGlvbhgHIAEoCUID4EEBEhUKCHBhc3N3b3JkGAggASgJQgPgQQQSJwoFc3RhdGUYCSABKA4yEy5tZW1vcy5hcGkudjEuU3RhdGVCA+BBAhI0CgtjcmVhdGVfdGltZRgKIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXBCA+BBAxI0Cgt1cGRhdGVfdGltZRgLIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXBCA+BBAyIxCgRSb2xlEhQKEFJPTEVfVU5TUEVDSUZJRUQQABIJCgVBRE1JThACEggKBFVTRVIQAzo36kE0ChFtZW1vcy5hcGkudjEvVXNlchIMdXNlcnMve3VzZXJ9GgRuYW1lKgV1c2VyczIEdXNlciJzChBMaXN0VXNlcnNSZXF1ZXN0EhYKCXBhZ2Vfc2l6ZRgBIAEoBUID4EEBEhcKCnBhZ2VfdG9rZW4YAiABKAlCA+BBARITCgZmaWx0ZXIYAyABKAlCA+BBARIZCgxzaG93X2RlbGV0ZWQYBCABKAhCA+BBASJPChFMaXN0VXNlcnNSZXNwb25zZRIhCgV1c2VycxgBIAMoCzISLm1lbW9zLmFwaS52MS5Vc2VyEhcKD25leHRfcGFnZV90b2tlbhgCIAEoCSIpChRCYXRjaEdldFVzZXJzUmVxdWVzdBIRCgl1c2VybmFtZXMYASADKAkiOgoVQmF0Y2hHZXRVc2Vyc1Jlc3BvbnNlEiEKBXVzZXJzGAEgAygLMhIubWVtb3MuYXBpLnYxLlVzZXIibQoOR2V0VXNlclJlcXVlc3QSJwoEbmFtZRgBIAEoCUIZ4EEC+kETChFtZW1vcy5hcGkudjEvVXNlchIyCglyZWFkX21hc2sYAiABKAsyGi5nb29nbGUucHJvdG9idWYuRmllbGRNYXNrQgPgQQEiiAEKEUNyZWF0ZVVzZXJSZXF1ZXN0EigKBHVzZXIYASABKAsyEi5tZW1vcy5hcGkudjEuVXNlckIG4EEC4EEEEhQKB3VzZXJfaWQYAiABKAlCA+BBARIaCg12YWxpZGF0ZV9vbmx5GAMgASgIQgPgQQESFwoKcmVxdWVzdF9pZBgEIAEoCUID4EEBIowBChFVcGRhdGVVc2VyUmVxdWVzdBIlCgR1c2VyGAEgASgLMhIubWVtb3MuYXBpLnYxLlVzZXJCA+BBAhI0Cgt1cGRhdGVfbWFzaxgCIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5GaWVsZE1hc2tCA+BBAhIaCg1hbGxvd19taXNzaW5nGAMgASgIQgPgQQEiUAoRRGVsZXRlVXNlclJlcXVlc3QSJwoEbmFtZRgBIAEoCUIZ4EEC+kETChFtZW1vcy5hcGkudjEvVXNlchISCgVmb3JjZRgCIAEoCEID4EEBIpsFCglVc2VyU3RhdHMSEQoEbmFtZRgBIAEoCUID4EEIEj4KD21lbW9fdHlwZV9zdGF0cxgDIAEoCzIlLm1lbW9zLmFwaS52MS5Vc2VyU3RhdHMuTWVtb1R5cGVTdGF0cxI4Cgl0YWdfY291bnQYBCADKAsyJS5tZW1vcy5hcGkudjEuVXNlclN0YXRzLlRhZ0NvdW50RW50cnkSOwoXbWVtb19jcmVhdGVkX3RpbWVzdGFtcHMYByADKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wEjsKF21lbW9fdXBkYXRlZF90aW1lc3RhbXBzGAggAygLMhouZ29vZ2xlLnByb3RvYnVmLlRpbWVzdGFtcBIsCgxwaW5uZWRfbWVtb3MYBSADKAlCFvpBEwoRbWVtb3MuYXBpLnYxL01lbW8SGAoQdG90YWxfbWVtb19jb3VudBgGIAEoBRIqChhhdHRhY2htZW50X3N0b3JhZ2VfYnl0ZXMYCSABKANCA+BBA0gAiAEBGi8KDVRhZ0NvdW50RW50cnkSCwoDa2V5GAEgASgJEg0KBXZhbHVlGAIgASgFOgI4ARpfCg1NZW1vVHlwZVN0YXRzEhIKCmxpbmtfY291bnQYASABKAUSEgoKY29kZV9jb3VudBgCIAEoBRISCgp0b2RvX2NvdW50GAMgASgFEhIKCnVuZG9fY291bnQYBCABKAU6RepBQgoWbWVtb3MuYXBpLnYxL1VzZXJTdGF0cxISdXNlcnMve3VzZXJ9L3N0YXRzKgl1c2VyU3RhdHMyCXVzZXJTdGF0c0IbChlfYXR0YWNobWVudF9zdG9yYWdlX2J5dGVzSgQIAhADUhdtZW1vX2Rpc3BsYXlfdGltZXN0YW1wcyI9ChJFeHBvcnRNZW1vc1JlcXVlc3QSJwoEbmFtZRgBIAEoCUIZ4EEC+kETChFtZW1vcy5hcGkudjEvVXNlciKYAwoSSW1wb3J0TWVtb3NSZXF1ZXN0EicKBG5hbWUYASABKAlCGeBBAvpBEwoRbWVtb3MuYXBpLnYxL1VzZXISLQoEc3BlYxgCIAEoCzIdLm1lbW9zLmFwaS52MS5JbXBvcnRNZW1vc1NwZWNIABITCgl1cGxvYWRfaWQYAyABKAlIABIZCgx3cml0ZV9vZmZzZXQYBCABKANCA+BBAhIRCgRkYXRhGAUgASgMQgPgQQESGQoMZmluaXNoX3dyaXRlGAYgASgIQgPgQQESGgoNdmFsaWRhdGVfb25seRgHIAEoCEID4EEBEk0KD2NvbmZsaWN0X3BvbGljeRgIIAEoDjIvLm1lbW9zLmFwaS52MS5JbXBvcnRNZW1vc1JlcXVlc3QuQ29uZmxpY3RQb2xpY3lCA+BBASJXCg5Db25mbGljdFBvbGljeRIfChtDT05GTElDVF9QT0xJQ1lfVU5TUEVDSUZJRUQQABIICgRTS0lQEAESCwoHUkVQTEFDRRACEg0KCURVUExJQ0FURRADQggKBnVwbG9hZCIqCg9JbXBvcnRNZW1vc1NwZWMSFwoKdG90YWxfc2l6ZRgBIAEoA0ID4EEBIsIBChNJbXBvcnRNZW1vc1Jlc3BvbnNlEhEKCXVwbG9hZF9pZBgBIAEoCRIWCg5jb21taXR0ZWRfc2l6ZRgCIAEoAxIWCg5tYXhfY2h1bmtfc2l6ZRgDIAEoBRIsCgRwbGFuGAQgASgLMhwubWVtb3MuYXBpLnYxLk1lbW9JbXBvcnRQbGFuSAASMAoGcmVwb3J0GAUgASgLMh4ubWVtb3MuYXBpLnYxLk1lbW9JbXBvcnRSZXBvcnRIAEIICgZyZXN1bHQiMAoPTWVtb0ltcG9ydElzc3VlEgwKBG1lbW8YASABKAkSDwoHbWVzc2FnZRgCIAEoCSLrAQoOTWVtb0ltcG9ydFBsYW4SLwoLZXhwb3J0X3RpbWUYASABKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wEhAKCGV4cG9ydGVyGAIgASgJEhEKCWdlbmVyYXRvchgDIAEoCRINCgVtZW1vcxgEIAEoBRITCgthdHRhY2htZW50cxgFIAEoBRILCgNuZXcYBiABKAUSEAoIZXhpc3RpbmcYByABKAUSDwoHcmVuYW1lZBgIIAEoBRIvCgh3YXJuaW5ncxgJIAMoCzIdLm1lbW9zLmFwaS52MS5NZW1vSW1wb3J0SXNzdWUitwEKEE1lbW9JbXBvcnRSZXBvcnQSDwoHY3JlYXRlZBgBIAEoBRIPCgd1cGRhdGVkGAIgASgFEg8KB3NraXBwZWQYAyABKAUSDgoGZmFpbGVkGAQgASgFEi8KCHdhcm5pbmdzGAUgAygLMh0ubWVtb3MuYXBpLnYxLk1lbW9JbXBvcnRJc3N1ZRIvCghmYWlsdXJlcxgGIAMoCzIdLm1lbW9zLmFwaS52MS5NZW1vSW1wb3J0SXNzdWUibAoTR2V0VXNlclN0YXRzUmVxdWVzdBInCgRuYW1lGAEgASgJQhngQQL6QRMKEW1lbW9zLmFwaS52MS9Vc2VyEhMKBmZpbHRlchgCIAEoCUID4EEBSgQIAxAEUgVzcGFjZVIKdW5hc3NpZ25lZCJ2ChdMaXN0QWxsVXNlclN0YXRzUmVxdWVzdBInCgVzdGF0ZRgBIAEoDjITLm1lbW9zLmFwaS52MS5TdGF0ZUID4EEBEhMKBmZpbHRlchgCIAEoCUID4EEBSgQIAxAESgQIBBAFUgVzcGFjZVIKdW5hc3NpZ25lZCJCChhMaXN0QWxsVXNlclN0YXRzUmVzcG9uc2USJgoFc3RhdHMYASADKAsyFy5tZW1vcy5hcGkudjEuVXNlclN0YXRzItAGCgtVc2VyU2V0dGluZxIRCgRuYW1lGAEgASgJQgPgQQgSQwoPZ2VuZXJhbF9zZXR0aW5nGAIgASgLMigubWVtb3MuYXBpLnYxLlVzZXJTZXR0aW5nLkdlbmVyYWxTZXR0aW5nSAASRQoQd2ViaG9va3Nfc2V0dGluZxgFIAEoCzIpLm1lbW9zLmFwaS52MS5Vc2VyU2V0dGluZy5XZWJob29rc1NldHRpbmdIABI9Cgx0YWdzX3NldHRpbmcYBiABKAsyJS5tZW1vcy5hcGkudjEuVXNlclNldHRpbmcuVGFnc1NldHRpbmdIABp5Cg5HZW5lcmFsU2V0dGluZxITCgZsb2NhbGUYASABKAlCA+BBARIcCg9tZW1vX3Zpc2liaWxpdHkYAyABKAlCA+BBARISCgV0aGVtZRgEIAEoCUID4EEBEiAKE3NhdmVfbWVkaWFfbWV0YWRhdGEYBSABKAhCA+BBARpbCgtUYWdNZXRhZGF0YRIxChBiYWNrZ3JvdW5kX2NvbG9yGAEgASgLMhIuZ29vZ2xlLnR5cGUuQ29sb3JCA+BBARIZCgxibHVyX2NvbnRlbnQYAiABKAhCA+BBARqlAQoLVGFnc1NldHRpbmcSQgoEdGFncxgBIAMoCzIvLm1lbW9zLmFwaS52MS5Vc2VyU2V0dGluZy5UYWdzU2V0dGluZy5UYWdzRW50cnlCA+BBARpSCglUYWdzRW50cnkSCwoDa2V5GAEgASgJEjQKBXZhbHVlGAIgASgLMiUubWVtb3MuYXBpLnYxLlVzZXJTZXR0aW5nLlRhZ01ldGFkYXRhOgI4ARo+Cg9XZWJob29rc1NldHRpbmcSKwoId2ViaG9va3MYASADKAsyGS5tZW1vcy5hcGkudjEuVXNlcldlYmhvb2siPwoDS2V5EhMKD0tFWV9VTlNQRUNJRklFRBAAEgsKB0dFTkVSQUwQARIMCghXRUJIT09LUxAEEggKBFRBR1MQBTpZ6kFWChhtZW1vcy5hcGkudjEvVXNlclNldHRpbmcSH3VzZXJzL3t1c2VyfS9zZXR0aW5ncy97c2V0dGluZ30qDHVzZXJTZXR0aW5nczILdXNlclNldHRpbmdCBwoFdmFsdWUiRwoVR2V0VXNlclNldHRpbmdSZXF1ZXN0Ei4KBG5hbWUYASABKAlCIOBBAvpBGgoYbWVtb3MuYXBpLnYxL1VzZXJTZXR0aW5nIoEBChhVcGRhdGVVc2VyU2V0dGluZ1JlcXVlc3QSLwoHc2V0dGluZxgBIAEoCzIZLm1lbW9zLmFwaS52MS5Vc2VyU2V0dGluZ0ID4EECEjQKC3VwZGF0ZV9tYXNrGAIgASgLMhouZ29vZ2xlLnByb3RvYnVmLkZpZWxkTWFza0ID4EECInUKF0xpc3RVc2VyU2V0dGluZ3NSZXF1ZXN0EikKBnBhcmVudBgBIAEoCUIZ4EEC+kETChFtZW1vcy5hcGkudjEvVXNlchIWCglwYWdlX3NpemUYAiABKAVCA+BBARIXCgpwYWdlX3Rva2VuGAMgASgJQgPgQQEiYAoYTGlzdFVzZXJTZXR0aW5nc1Jlc3BvbnNlEisKCHNldHRpbmdzGAEgAygLMhkubWVtb3MuYXBpLnYxLlVzZXJTZXR0aW5nEhcKD25leHRfcGFnZV90b2tlbhgCIAEoCSLuAQoITWVtb1ZpZXcSEQoEbmFtZRgBIAEoCUID4EEIEhIKBXRpdGxlGAIgASgJQgPgQQISEwoGZmlsdGVyGAMgASgJQgPgQQISLgoEaWNvbhgEIAEoCzIbLm1lbW9zLmFwaS52MS5NZW1vVmlldy5JY29uQgPgQQEaMgoESWNvbhIPCgVlbW9qaRgBIAEoCUgAEhAKBmx1Y2lkZRgCIAEoCUgAQgcKBXZhbHVlOkLqQT8KFW1lbW9zLmFwaS52MS9NZW1vVmlldxIZdXNlcnMve3VzZXJ9L3ZpZXdzL3t2aWV3fSoFdmlld3MyBHZpZXciRQoUTGlzdE1lbW9WaWV3c1JlcXVlc3QSLQoGcGFyZW50GAEgASgJQh3gQQL6QRcSFW1lbW9zLmFwaS52MS9NZW1vVmlldyJDChVMaXN0TWVtb1ZpZXdzUmVzcG9uc2USKgoKbWVtb192aWV3cxgBIAMoCzIWLm1lbW9zLmFwaS52MS5NZW1vVmlldyJBChJHZXRNZW1vVmlld1JlcXVlc3QSKwoEbmFtZRgBIAEoCUId4EEC+kEXChVtZW1vcy5hcGkudjEvTWVtb1ZpZXcikgEKFUNyZWF0ZU1lbW9WaWV3UmVxdWVzdBItCgZwYXJlbnQYASABKAlCHeBBAvpBFxIVbWVtb3MuYXBpLnYxL01lbW9WaWV3Ei4KCW1lbW9fdmlldxgCIAEoCzIWLm1lbW9zLmFwaS52MS5NZW1vVmlld0ID4EECEhoKDXZhbGlkYXRlX29ubHkYAyABKAhCA+BBASJ9ChVVcGRhdGVNZW1vVmlld1JlcXVlc3QSLgoJbWVtb192aWV3GAEgASgLMhYubWVtb3MuYXBpLnYxLk1lbW9WaWV3QgPgQQISNAoLdXBkYXRlX21hc2sYAiABKAsyGi5nb29nbGUucHJvdG9idWYuRmllbGRNYXNrQgPgQQEiRAoVRGVsZXRlTWVtb1ZpZXdSZXF1ZXN0EisKBG5hbWUYASABKAlCHeBBAvpBFwoVbWVtb3MuYXBpLnYxL01lbW9WaWV3IuoBCg5MaW5rZWRJZGVudGl0eRIRCgRuYW1lGAEgASgJQgPgQQgSNwoIaWRwX25hbWUYAiABKAlCJeBBA/pBHwodbWVtb3MuYXBpLnYxL0lkZW50aXR5UHJvdmlkZXISFwoKZXh0ZXJuX3VpZBgDIAEoCUID4EEDOnPqQXAKG21lbW9zLmFwaS52MS9MaW5rZWRJZGVudGl0eRIvdXNlcnMve3VzZXJ9L2xpbmtlZElkZW50aXRpZXMve2xpbmtlZF9pZGVudGl0eX0qEGxpbmtlZElkZW50aXRpZXMyDmxpbmtlZElkZW50aXR5IkgKG0xpc3RMaW5rZWRJZGVudGl0aWVzUmVxdWVzdBIpCgZwYXJlbnQYASABKAlCGeBBAvpBEwoRbWVtb3MuYXBpLnYxL1VzZXIiVwocTGlzdExpbmtlZElkZW50aXRpZXNSZXNwb25zZRI3ChFsaW5rZWRfaWRlbnRpdGllcxgBIAMoCzIcLm1lbW9zLmFwaS52MS5MaW5rZWRJZGVudGl0eSLLAQobQ3JlYXRlTGlua2VkSWRlbnRpdHlSZXF1ZXN0EikKBnBhcmVudBgBIAEoCUIZ4EEC+kETChFtZW1vcy5hcGkudjEvVXNlchI3CghpZHBfbmFtZRgCIAEoCUIl4EEC+kEfCh1tZW1vcy5hcGkudjEvSWRlbnRpdHlQcm92aWRlchIRCgRjb2RlGAMgASgJQgPgQQISGQoMcmVkaXJlY3RfdXJpGAQgASgJQgPgQQISGgoNY29kZV92ZXJpZmllchgFIAEoCUID4EEBIk0KGEdldExpbmtlZElkZW50aXR5UmVxdWVzdBIxCgRuYW1lGAEgASgJQiPgQQL6QR0KG21lbW9zLmFwaS52MS9MaW5rZWRJZGVudGl0eSJQChtEZWxldGVMaW5rZWRJZGVudGl0eVJlcXVlc3QSMQoEbmFtZRgBIAEoCUIj4EEC+kEdChttZW1vcy5hcGkudjEvTGlua2VkSWRlbnRpdHki8gIKE1BlcnNvbmFsQWNjZXNzVG9rZW4SEQoEbmFtZRgBIAEoCUID4EEIEhgKC2Rlc2NyaXB0aW9uGAIgASgJQgPgQQESMwoKY3JlYXRlZF9hdBgDIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXBCA+BBAxIzCgpleHBpcmVzX2F0GAQgASgLMhouZ29vZ2xlLnByb3RvYnVmLlRpbWVzdGFtcEID4EEBEjUKDGxhc3RfdXNlZF9hdBgFIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXBCA+BBAzqMAepBiAEKIG1lbW9zLmFwaS52MS9QZXJzb25hbEFjY2Vzc1Rva2VuEjl1c2Vycy97dXNlcn0vcGVyc29uYWxBY2Nlc3NUb2tlbnMve3BlcnNvbmFsX2FjY2Vzc190b2tlbn0qFHBlcnNvbmFsQWNjZXNzVG9rZW5zMhNwZXJzb25hbEFjY2Vzc1Rva2VuIn0KH0xpc3RQZXJzb25hbEFjY2Vzc1Rva2Vuc1JlcXVlc3QSKQoGcGFyZW50GAEgASgJQhngQQL6QRMKEW1lbW9zLmFwaS52MS9Vc2VyEhYKCXBhZ2Vfc2l6ZRgCIAEoBUID4EEBEhcKCnBhZ2VfdG9rZW4YAyABKAlCA+BBASJ+CiBMaXN0UGVyc29uYWxBY2Nlc3NUb2tlbnNSZXNwb25zZRJBChZwZXJzb25hbF9hY2Nlc3NfdG9rZW5zGAEgAygLMiEubWVtb3MuYXBpLnYxLlBlcnNvbmFsQWNjZXNzVG9rZW4SFwoPbmV4dF9wYWdlX3Rva2VuGAIgASgJIoUBCiBDcmVhdGVQZXJzb25hbEFjY2Vzc1Rva2VuUmVxdWVzdBIpCgZwYXJlbnQYASABKAlCGeBBAvpBEwoRbWVtb3MuYXBpLnYxL1VzZXISGAoLZGVzY3JpcHRpb24YAiABKAlCA+BBARIcCg9leHBpcmVzX2luX2RheXMYAyABKAVCA+BBASJ0CiFDcmVhdGVQZXJzb25hbEFjY2Vzc1Rva2VuUmVzcG9uc2USQAoVcGVyc29uYWxfYWNjZXNzX3Rva2VuGAEgASgLMiEubWVtb3MuYXBpLnYxLlBlcnNvbmFsQWNjZXNzVG9rZW4SDQoFdG9rZW4YAiABKAkiWgogRGVsZXRlUGVyc29uYWxBY2Nlc3NUb2tlblJlcXVlc3QSNgoEbmFtZRgBIAEoCUIo4EEC+kEiCiBtZW1vcy5hcGkudjEvUGVyc29uYWxBY2Nlc3NUb2tlbiLIAgoLVXNlcldlYmhvb2sSEQoEbmFtZRgBIAEoCUID4EEIEgsKA3VybBgCIAEoCRIUCgxkaXNwbGF5X25hbWUYAyABKAkSNAoLY3JlYXRlX3RpbWUYBCABKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wQgPgQQMSNAoLdXBkYXRlX3RpbWUYBSABKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wQgPgQQMSGwoOc2lnbmluZ19zZWNyZXQYBiABKAlCA+BBBBIfChJzaWduaW5nX3NlY3JldF9zZXQYByABKAhCA+BBAzpZ6kFWChhtZW1vcy5hcGkudjEvVXNlcldlYmhvb2sSH3VzZXJzL3t1c2VyfS93ZWJob29rcy97d2ViaG9va30qDHVzZXJXZWJob29rczILdXNlcldlYmhvb2siSwoXTGlzdFVzZXJXZWJob29rc1JlcXVlc3QSMAoGcGFyZW50GAEgASgJQiDgQQL6QRoSGG1lbW9zLmFwaS52MS9Vc2VyV2ViaG9vayJHChhMaXN0VXNlcldlYmhvb2tzUmVzcG9uc2USKwoId2ViaG9va3MYASADKAsyGS5tZW1vcy5hcGkudjEuVXNlcldlYmhvb2sifQoYQ3JlYXRlVXNlcldlYmhvb2tSZXF1ZXN0EjAKBnBhcmVudBgBIAEoCUIg4EEC+kEaEhhtZW1vcy5hcGkudjEvVXNlcldlYmhvb2sSLwoHd2ViaG9vaxgCIAEoCzIZLm1lbW9zLmFwaS52MS5Vc2VyV2ViaG9va0ID4EECInwKGFVwZGF0ZVVzZXJXZWJob29rUmVxdWVzdBIvCgd3ZWJob29rGAEgASgLMhkubWVtb3MuYXBpLnYxLlVzZXJXZWJob29rQgPgQQISLwoLdXBkYXRlX21hc2sYAiABKAsyGi5nb29nbGUucHJvdG9idWYuRmllbGRNYXNrIkoKGERlbGV0ZVVzZXJXZWJob29rUmVxdWVzdBIuCgRuYW1lGAEgASgJQiDgQQL6QRoKGG1lbW9zLmFwaS52MS9Vc2VyV2ViaG9vayJUCiJHZXRVc2VyV2ViaG9va1NpZ25pbmdTZWNyZXRSZXF1ZXN0Ei4KBG5hbWUYASABKAlCIOBBAvpBGgoYbWVtb3MuYXBpLnYxL1VzZXJXZWJob29rIj0KI0dldFVzZXJXZWJob29rU2lnbmluZ1NlY3JldFJlc3BvbnNlEhYKDnNpZ25pbmdfc2VjcmV0GAEgASgJIsEKChBVc2VyTm90aWZpY2F0aW9uEhQKBG5hbWUYASABKAlCBuBBA+BBCBIpCgZzZW5kZXIYAiABKAlCGeBBA/pBEwoRbWVtb3MuYXBpLnYxL1VzZXISLAoLc2VuZGVyX3VzZXIYCCABKAsyEi5tZW1vcy5hcGkudjEuVXNlckID4EEDEjoKBnN0YXR1cxgDIAEoDjIlLm1lbW9zLmFwaS52MS5Vc2VyTm90aWZpY2F0aW9uLlN0YXR1c0ID4EEBEjQKC2NyZWF0ZV90aW1lGAQgASgLMhouZ29vZ2xlLnByb3RvYnVmLlRpbWVzdGFtcEID4EEDEjYKBHR5cGUYBSABKA4yIy5tZW1vcy5hcGkudjEuVXNlck5vdGlmaWNhdGlvbi5UeXBlQgPgQQMSTgoMbWVtb19jb21tZW50GAYgASgLMjEubWVtb3MuYXBpLnYxLlVzZXJOb3RpZmljYXRpb24uTWVtb0NvbW1lbnRQYXlsb2FkQgPgQQNIABJOCgxtZW1vX21lbnRpb24YByABKAsyMS5tZW1vcy5hcGkudjEuVXNlck5vdGlmaWNhdGlvbi5NZW1vTWVudGlvblBheWxvYWRCA+BBA0gAElYKEHNwYWNlX2ludml0YXRpb24YCSABKAsyNS5tZW1vcy5hcGkudjEuVXNlck5vdGlmaWNhdGlvbi5TcGFjZUludml0YXRpb25QYXlsb2FkQgPgQQNIABpsChJNZW1vQ29tbWVudFBheWxvYWQSDAoEbWVtbxgBIAEoCRIUCgxyZWxhdGVkX21lbW8YAiABKAkSFAoMbWVtb19zbmlwcGV0GAMgASgJEhwKFHJlbGF0ZWRfbWVtb19zbmlwcGV0GAQgASgJGmwKEk1lbW9NZW50aW9uUGF5bG9hZBIMCgRtZW1vGAEgASgJEhQKDHJlbGF0ZWRfbWVtbxgCIAEoCRIUCgxtZW1vX3NuaXBwZXQYAyABKAkSHAoUcmVsYXRlZF9tZW1vX3NuaXBwZXQYBCABKAkargIKFlNwYWNlSW52aXRhdGlvblBheWxvYWQSOwoQc3BhY2VfaW52aXRhdGlvbhgBIAEoCUIh+kEeChxtZW1vcy5hcGkudjEvU3BhY2VJbnZpdGF0aW9uEiIKBXNwYWNlGAIgASgLMhMubWVtb3MuYXBpLnYxLlNwYWNlEiwKBHJvbGUYAyABKA4yHi5tZW1vcy5hcGkudjEuU3BhY2VNZW1iZXIuUm9sZRJKCgVzdGF0ZRgEIAEoDjI7Lm1lbW9zLmFwaS52MS5Vc2VyTm90aWZpY2F0aW9uLlNwYWNlSW52aXRhdGlvblBheWxvYWQuU3RhdGUiOQoFU3RhdGUSFQoRU1RBVEVfVU5TUEVDSUZJRUQQABILCgdQRU5ESU5HEAESDAoIQUNDRVBURUQQAiI6CgZTdGF0dXMSFgoSU1RBVFVTX1VOU1BFQ0lGSUVEEAASCgoGVU5SRUFEEAESDAoIQVJDSElWRUQQAiJWCgRUeXBlEhQKEFRZUEVfVU5TUEVDSUZJRUQQABIQCgxNRU1PX0NPTU1FTlQQARIQCgxNRU1PX01FTlRJT04QAhIUChBTUEFDRV9JTlZJVEFUSU9OEAM6cOpBbQodbWVtb3MuYXBpLnYxL1VzZXJOb3RpZmljYXRpb24SKXVzZXJzL3t1c2VyfS9ub3RpZmljYXRpb25zL3tub3RpZmljYXRpb259GgRuYW1lKg1ub3RpZmljYXRpb25zMgxub3RpZmljYXRpb25CCQoHcGF5bG9hZCKPAQocTGlzdFVzZXJOb3RpZmljYXRpb25zUmVxdWVzdBIpCgZwYXJlbnQYASABKAlCGeBBAvpBEwoRbWVtb3MuYXBpLnYxL1VzZXISFgoJcGFnZV9zaXplGAIgASgFQgPgQQESFwoKcGFnZV90b2tlbhgDIAEoCUID4EEBEhMKBmZpbHRlchgEIAEoCUID4EEBIm8KHUxpc3RVc2VyTm90aWZpY2F0aW9uc1Jlc3BvbnNlEjUKDW5vdGlmaWNhdGlvbnMYASADKAsyHi5tZW1vcy5hcGkudjEuVXNlck5vdGlmaWNhdGlvbhIXCg9uZXh0X3BhZ2VfdG9rZW4YAiABKAkikAEKHVVwZGF0ZVVzZXJOb3RpZmljYXRpb25SZXF1ZXN0EjkKDG5vdGlmaWNhdGlvbhgBIAEoCzIeLm1lbW9zLmFwaS52MS5Vc2VyTm90aWZpY2F0aW9uQgPgQQISNAoLdXBkYXRlX21hc2sYAiABKAsyGi5nb29nbGUucHJvdG9idWYuRmllbGRNYXNrQgPgQQIiVAodRGVsZXRlVXNlck5vdGlmaWNhdGlvblJlcXVlc3QSMwoEbmFtZRgBIAEoCUIl4EEC+kEfCh1tZW1vcy5hcGkudjEvVXNlck5vdGlmaWNhdGlvbjKNJgoLVXNlclNlcnZpY2USYwoJTGlzdFVzZXJzEh4ubWVtb3MuYXBpLnYxLkxpc3RVc2Vyc1JlcXVlc3QaHy5tZW1vcy5hcGkudjEuTGlzdFVzZXJzUmVzcG9uc2UiFYLT5JMCDxINL2FwaS92MS91c2VycxJ7Cg1CYXRjaEdldFVzZXJzEiIubWVtb3MuYXBpLnYxLkJhdGNoR2V0VXNlcnNSZXF1ZXN0GiMubWVtb3MuYXBpLnYxLkJhdGNoR2V0VXNlcnNSZXNwb25zZSIhgtPkkwIbOgEqIhYvYXBpL3YxL3VzZXJzOmJhdGNoR2V0EmIKB0dldFVzZXISHC5tZW1vcy5hcGkudjEuR2V0VXNlclJlcXVlc3QaEi5tZW1vcy5hcGkudjEuVXNlciIl2kEEbmFtZYLT5JMCGBIWL2FwaS92MS97bmFtZT11c2Vycy8qfRJtCgpDcmVhdGVVc2VyEh8ubWVtb3MuYXBpLnYxLkNyZWF0ZVVzZXJSZXF1ZXN0GhIubWVtb3MuYXBpLnYxLlVzZXIiKtpBDHVzZXIsdXNlcl9pZILT5JMCFToEdXNlciINL2FwaS92MS91c2VycxJ/CgpVcGRhdGVVc2VyEh8ubWVtb3MuYXBpLnYxLlVwZGF0ZVVzZXJSZXF1ZXN0GhIubWVtb3MuYXBpLnYxLlVzZXIiPNpBEHVzZXIsdXBkYXRlX21hc2uC0+STAiM6BHVzZXIyGy9hcGkvdjEve3VzZXIubmFtZT11c2Vycy8qfRJsCgpEZWxldGVVc2VyEh8ubWVtb3MuYXBpLnYxLkRlbGV0ZVVzZXJSZXF1ZXN0GhYuZ29vZ2xlLnByb3RvYnVmLkVtcHR5IiXaQQRuYW1lgtPkkwIYKhYvYXBpL3YxL3tuYW1lPXVzZXJzLyp9En4KEExpc3RBbGxVc2VyU3RhdHMSJS5tZW1vcy5hcGkudjEuTGlzdEFsbFVzZXJTdGF0c1JlcXVlc3QaJi5tZW1vcy5hcGkudjEuTGlzdEFsbFVzZXJTdGF0c1Jlc3BvbnNlIhuC0+STAhUSEy9hcGkvdjEvdXNlcnM6c3RhdHMSegoMR2V0VXNlclN0YXRzEiEubWVtb3MuYXBpLnYxLkdldFVzZXJTdGF0c1JlcXVlc3QaFy5tZW1vcy5hcGkudjEuVXNlclN0YXRzIi7aQQRuYW1lgtPkkwIhEh8vYXBpL3YxL3tuYW1lPXVzZXJzLyp9OmdldFN0YXRzEngKC0V4cG9ydE1lbW9zEiAubWVtb3MuYXBpLnYxLkV4cG9ydE1lbW9zUmVxdWVzdBoULmdvb2dsZS5hcGkuSHR0cEJvZHkiMdpBBG5hbWWC0+STAiQSIi9hcGkvdjEve25hbWU9dXNlcnMvKn06ZXhwb3J0TWVtb3MSgQEKC0ltcG9ydE1lbW9zEiAubWVtb3MuYXBpLnYxLkltcG9ydE1lbW9zUmVxdWVzdBohLm1lbW9zLmFwaS52MS5JbXBvcnRNZW1vc1Jlc3BvbnNlIi2C0+STAic6ASoiIi9hcGkvdjEve25hbWU9dXNlcnMvKn06aW1wb3J0TWVtb3MSggEKDkdldFVzZXJTZXR0aW5nEiMubWVtb3MuYXBpLnYxLkdldFVzZXJTZXR0aW5nUmVxdWVzdBoZLm1lbW9zLmFwaS52MS5Vc2VyU2V0dGluZyIw2kEEbmFtZYLT5JMCIxIhL2FwaS92MS97bmFtZT11c2Vycy8qL3NldHRpbmdzLyp9EqgBChFVcGRhdGVVc2VyU2V0dGluZxImLm1lbW9zLmFwaS52MS5VcGRhdGVVc2VyU2V0dGluZ1JlcXVlc3QaGS5tZW1vcy5hcGkudjEuVXNlclNldHRpbmciUNpBE3NldHRpbmcsdXBkYXRlX21hc2uC0+STAjQ6B3NldHRpbmcyKS9hcGkvdjEve3NldHRpbmcubmFtZT11c2Vycy8qL3NldHRpbmdzLyp9EpUBChBMaXN0VXNlclNldHRpbmdzEiUubWVtb3MuYXBpLnYxLkxpc3RVc2VyU2V0dGluZ3NSZXF1ZXN0GiYubWVtb3MuYXBpLnYxLkxpc3RVc2VyU2V0dGluZ3NSZXNwb25zZSIy2kEGcGFyZW50gtPkkwIjEiEvYXBpL3YxL3twYXJlbnQ9dXNlcnMvKn0vc2V0dGluZ3MSiQEKDUxpc3RNZW1vVmlld3MSIi5tZW1vcy5hcGkudjEuTGlzdE1lbW9WaWV3c1JlcXVlc3QaIy5tZW1vcy5hcGkudjEuTGlzdE1lbW9WaWV3c1Jlc3BvbnNlIi/aQQZwYXJlbnSC0+STAiASHi9hcGkvdjEve3BhcmVudD11c2Vycy8qfS92aWV3cxJ2CgtHZXRNZW1vVmlldxIgLm1lbW9zLmFwaS52MS5HZXRNZW1vVmlld1JlcXVlc3QaFi5tZW1vcy5hcGkudjEuTWVtb1ZpZXciLdpBBG5hbWWC0+STAiASHi9hcGkvdjEve25hbWU9dXNlcnMvKi92aWV3cy8qfRKTAQoOQ3JlYXRlTWVtb1ZpZXcSIy5tZW1vcy5hcGkudjEuQ3JlYXRlTWVtb1ZpZXdSZXF1ZXN0GhYubWVtb3MuYXBpLnYxLk1lbW9WaWV3IkTaQRBwYXJlbnQsbWVtb192aWV3gtPkkwIrOgltZW1vX3ZpZXciHi9hcGkvdjEve3BhcmVudD11c2Vycy8qfS92aWV3cxKiAQoOVXBkYXRlTWVtb1ZpZXcSIy5tZW1vcy5hcGkudjEuVXBkYXRlTWVtb1ZpZXdSZXF1ZXN0GhYubWVtb3MuYXBpLnYxLk1lbW9WaWV3IlPaQRVtZW1vX3ZpZXcsdXBkYXRlX21hc2uC0+STAjU6CW1lbW9fdmlldzIoL2FwaS92MS97bWVtb192aWV3Lm5hbWU9dXNlcnMvKi92aWV3cy8qfRJ8Cg5EZWxldGVNZW1vVmlldxIjLm1lbW9zLmFwaS52MS5EZWxldGVNZW1vVmlld1JlcXVlc3QaFi5nb29nbGUucHJvdG9idWYuRW1wdHkiLdpBBG5hbWWC0+STAiAqHi9hcGkvdjEve25hbWU9dXNlcnMvKi92aWV3cy8qfRKpAQoUTGlzdExpbmtlZElkZW50aXRpZXMSKS5tZW1vcy5hcGkudjEuTGlzdExpbmtlZElkZW50aXRpZXNSZXF1ZXN0GioubWVtb3MuYXBpLnYxLkxpc3RMaW5rZWRJZGVudGl0aWVzUmVzcG9uc2UiOtpBBnBhcmVudILT5JMCKxIpL2FwaS92MS97cGFyZW50PXVzZXJzLyp9L2xpbmtlZElkZW50aXRpZXMSpwEKFENyZWF0ZUxpbmtlZElkZW50aXR5EikubWVtb3MuYXBpLnYxLkNyZWF0ZUxpbmtlZElkZW50aXR5UmVxdWVzdBocLm1lbW9zLmFwaS52MS5MaW5rZWRJZGVudGl0eSJG2kEPcGFyZW50LGlkcF9uYW1lgtPkkwIuOgEqIikvYXBpL3YxL3twYXJlbnQ9dXNlcnMvKn0vbGlua2VkSWRlbnRpdGllcxKTAQoRR2V0TGlua2VkSWRlbnRpdHkSJi5tZW1vcy5hcGkudjEuR2V0TGlua2VkSWRlbnRpdHlSZXF1ZXN0GhwubWVtb3MuYXBpLnYxLkxpbmtlZElkZW50aXR5IjjaQQRuYW1lgtPkkwIrEikvYXBpL3YxL3tuYW1lPXVzZXJzLyovbGlua2VkSWRlbnRpdGllcy8qfRKTAQoURGVsZXRlTGlua2VkSWRlbnRpdHkSKS5tZW1vcy5hcGkudjEuRGVsZXRlTGlua2VkSWRlbnRpdHlSZXF1ZXN0GhYuZ29vZ2xlLnByb3RvYnVmLkVtcHR5IjjaQQRuYW1lgtPkkwIrKikvYXBpL3YxL3tuYW1lPXVzZXJzLyovbGlua2VkSWRlbnRpdGllcy8qfRK5AQoYTGlzdFBlcnNvbmFsQWNjZXNzVG9rZW5zEi0ubWVtb3MuYXBpLnYxLkxpc3RQZXJzb25hbEFjY2Vzc1Rva2Vuc1JlcXVlc3QaLi5tZW1vcy5hcGkudjEuTGlzdFBlcnNvbmFsQWNjZXNzVG9rZW5zUmVzcG9uc2UiPtpBBnBhcmVudILT5JMCLxItL2FwaS92MS97cGFyZW50PXVzZXJzLyp9L3BlcnNvbmFsQWNjZXNzVG9rZW5zErYBChlDcmVhdGVQZXJzb25hbEFjY2Vzc1Rva2VuEi4ubWVtb3MuYXBpLnYxLkNyZWF0ZVBlcnNvbmFsQWNjZXNzVG9rZW5SZXF1ZXN0Gi8ubWVtb3MuYXBpLnYxLkNyZWF0ZVBlcnNvbmFsQWNjZXNzVG9rZW5SZXNwb25zZSI4gtPkkwIyOgEqIi0vYXBpL3YxL3twYXJlbnQ9dXNlcnMvKn0vcGVyc29uYWxBY2Nlc3NUb2tlbnMSoQEKGURlbGV0ZVBlcnNvbmFsQWNjZXNzVG9rZW4SLi5tZW1vcy5hcGkudjEuRGVsZXRlUGVyc29uYWxBY2Nlc3NUb2tlblJlcXVlc3QaFi5nb29nbGUucHJvdG9idWYuRW1wdHkiPNpBBG5hbWWC0+STAi8qLS9hcGkvdjEve25hbWU9dXNlcnMvKi9wZXJzb25hbEFjY2Vzc1Rva2Vucy8qfRKVAQoQTGlzdFVzZXJXZWJob29rcxIlLm1lbW9zLmFwaS52MS5MaXN0VXNlcldlYmhvb2tzUmVxdWVzdBomLm1lbW9zLmFwaS52MS5MaXN0VXNlcldlYmhvb2tzUmVzcG9uc2UiMtpBBnBhcmVudILT5JMCIxIhL2FwaS92MS97cGFyZW50PXVzZXJzLyp9L3dlYmhvb2tzEpsBChFDcmVhdGVVc2VyV2ViaG9vaxImLm1lbW9zLmFwaS52MS5DcmVhdGVVc2VyV2ViaG9va1JlcXVlc3QaGS5tZW1vcy5hcGkudjEuVXNlcldlYmhvb2siQ9pBDnBhcmVudCx3ZWJob29rgtPkkwIsOgd3ZWJob29rIiEvYXBpL3YxL3twYXJlbnQ9dXNlcnMvKn0vd2ViaG9va3MSqAEKEVVwZGF0ZVVzZXJXZWJob29rEiYubWVtb3MuYXBpLnYxLlVwZGF0ZVVzZXJXZWJob29rUmVxdWVzdBoZLm1lbW9zLmFwaS52MS5Vc2VyV2ViaG9vayJQ2kETd2ViaG9vayx1cGRhdGVfbWFza4LT5JMCNDoHd2ViaG9vazIpL2FwaS92MS97d2ViaG9vay5uYW1lPXVzZXJzLyovd2ViaG9va3MvKn0ShQEKEURlbGV0ZVVzZXJXZWJob29rEiYubWVtb3MuYXBpLnYxLkRlbGV0ZVVzZXJXZWJob29rUmVxdWVzdBoWLmdvb2dsZS5wcm90b2J1Zi5FbXB0eSIw2kEEbmFtZYLT5JMCIyohL2FwaS92MS97bmFtZT11c2Vycy8qL3dlYmhvb2tzLyp9EsUBChtHZXRVc2VyV2ViaG9va1NpZ25pbmdTZWNyZXQSMC5tZW1vcy5hcGkudjEuR2V0VXNlcldlYmhvb2tTaWduaW5nU2VjcmV0UmVxdWVzdBoxLm1lbW9zLmFwaS52MS5HZXRVc2VyV2ViaG9va1NpZ25pbmdTZWNyZXRSZXNwb25zZSJB2kEEbmFtZYLT5JMCNBIyL2FwaS92MS97bmFtZT11c2Vycy8qL3dlYmhvb2tzLyp9OmdldFNpZ25pbmdTZWNyZXQSqQEKFUxpc3RVc2VyTm90aWZpY2F0aW9ucxIqLm1lbW9zLmFwaS52MS5MaXN0VXNlck5vdGlmaWNhdGlvbnNSZXF1ZXN0GisubWVtb3MuYXBpLnYxLkxpc3RVc2VyTm90aWZpY2F0aW9uc1Jlc3BvbnNlIjfaQQZwYXJlbnSC0+STAigSJi9hcGkvdjEve3BhcmVudD11c2Vycy8qfS9ub3RpZmljYXRpb25zEssBChZVcGRhdGVVc2VyTm90aWZpY2F0aW9uEisubWVtb3MuYXBpLnYxLlVwZGF0ZVVzZXJOb3RpZmljYXRpb25SZXF1ZXN0Gh4ubWVtb3MuYXBpLnYxLlVzZXJOb3RpZmljYXRpb24iZNpBGG5vdGlmaWNhdGlvbix1cGRhdGVfbWFza4LT5JMCQzoMbm90aWZpY2F0aW9uMjMvYXBpL3YxL3tub3RpZmljYXRpb24ubmFtZT11c2Vycy8qL25vdGlmaWNhdGlvbnMvKn0SlAEKFkRlbGV0ZVVzZXJOb3RpZmljYXRpb24SKy5tZW1vcy5hcGkudjEuRGVsZXRlVXNlck5vdGlmaWNhdGlvblJlcXVlc3QaFi5nb29nbGUucHJvdG9idWYuRW1wdHkiNdpBBG5hbWWC0+STAigqJi9hcGkvdjEve25hbWU9dXNlcnMvKi9ub3RpZmljYXRpb25zLyp9QqgBChBjb20ubWVtb3MuYXBpLnYxQhBVc2VyU2VydmljZVByb3RvUAFaMGdpdGh1Yi5jb20vdXNlbWVtb3MvbWVtb3MvcHJvdG8vZ2VuL2FwaS92MTthcGl2MaICA01BWKoCDE1lbW9zLkFwaS5WMcoCDE1lbW9zXEFwaVxWMeICGE1lbW9zXEFwaVxWMVxHUEJNZXRhZGF0YeoCDk1lbW9zOjpBcGk6OlYxYgZwcm90bzM", [file_api_v1_common, file_api_v1_space_service, file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_httpbody, file_google_api_resource, file_google_protobuf_empty, file_google_protobuf_field_mask, file_google_protobuf_timestamp, file_google_type_color]); - -/** - * @generated from message memos.api.v1.User - */ -export type User = Message<"memos.api.v1.User"> & { - /** - * The resource name of the user. - * Format: users/{user} - * - * @generated from field: string name = 1; - */ - name: string; - - /** - * The role of the user. - * - * @generated from field: memos.api.v1.User.Role role = 2; - */ - role: User_Role; - - /** - * Required. The unique username for login. - * - * @generated from field: string username = 3; - */ - username: string; - - /** - * Optional. The email address of the user. Stored trimmed and lowercased; - * empty means no address. An address belongs to at most one user on the - * instance, so writes that would reuse one fail with ALREADY_EXISTS. - * - * @generated from field: string email = 4; - */ - email: string; - - /** - * Optional. The display name of the user. - * - * @generated from field: string display_name = 5; - */ - displayName: string; - - /** - * Optional. The avatar URL of the user. - * - * @generated from field: string avatar_url = 6; - */ - avatarUrl: string; - - /** - * Optional. The description of the user. - * - * @generated from field: string description = 7; - */ - description: string; - - /** - * Input only. The password for the user. - * - * @generated from field: string password = 8; - */ - password: string; - - /** - * The state of the user. - * - * @generated from field: memos.api.v1.State state = 9; - */ - state: State; - - /** - * Output only. The creation timestamp. - * - * @generated from field: google.protobuf.Timestamp create_time = 10; - */ - createTime?: Timestamp | undefined; - - /** - * Output only. The last update timestamp. - * - * @generated from field: google.protobuf.Timestamp update_time = 11; - */ - updateTime?: Timestamp | undefined; -}; - -/** - * Describes the message memos.api.v1.User. - * Use `create(UserSchema)` to create a new message. - */ -export const UserSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_user_service, 0); - -/** - * User role enumeration. - * - * @generated from enum memos.api.v1.User.Role - */ -export enum User_Role { - /** - * @generated from enum value: ROLE_UNSPECIFIED = 0; - */ - ROLE_UNSPECIFIED = 0, - - /** - * Admin role with system access. - * - * @generated from enum value: ADMIN = 2; - */ - ADMIN = 2, - - /** - * User role with limited access. - * - * @generated from enum value: USER = 3; - */ - USER = 3, -} - -/** - * Describes the enum memos.api.v1.User.Role. - */ -export const User_RoleSchema: GenEnum = /*@__PURE__*/ - enumDesc(file_api_v1_user_service, 0, 0); - -/** - * @generated from message memos.api.v1.ListUsersRequest - */ -export type ListUsersRequest = Message<"memos.api.v1.ListUsersRequest"> & { - /** - * Optional. The maximum number of users to return. - * The service may return fewer than this value. - * If unspecified, at most 50 users will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. - * - * @generated from field: int32 page_size = 1; - */ - pageSize: number; - - /** - * Optional. A page token, received from a previous `ListUsers` call. - * Provide this to retrieve the subsequent page. - * - * @generated from field: string page_token = 2; - */ - pageToken: string; - - /** - * Optional. Filter to apply to the list results. - * Example: "username == 'steven'" - * Supported operators: == - * Supported fields: username - * - * @generated from field: string filter = 3; - */ - filter: string; - - /** - * Optional. If true, show deleted users in the response. - * - * @generated from field: bool show_deleted = 4; - */ - showDeleted: boolean; -}; - -/** - * Describes the message memos.api.v1.ListUsersRequest. - * Use `create(ListUsersRequestSchema)` to create a new message. - */ -export const ListUsersRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_user_service, 1); - -/** - * @generated from message memos.api.v1.ListUsersResponse - */ -export type ListUsersResponse = Message<"memos.api.v1.ListUsersResponse"> & { - /** - * The list of users. - * - * @generated from field: repeated memos.api.v1.User users = 1; - */ - users: User[]; - - /** - * A token that can be sent as `page_token` to retrieve the next page. - * If this field is omitted, there are no subsequent pages. - * - * @generated from field: string next_page_token = 2; - */ - nextPageToken: string; -}; - -/** - * Describes the message memos.api.v1.ListUsersResponse. - * Use `create(ListUsersResponseSchema)` to create a new message. - */ -export const ListUsersResponseSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_user_service, 2); - -/** - * @generated from message memos.api.v1.BatchGetUsersRequest - */ -export type BatchGetUsersRequest = Message<"memos.api.v1.BatchGetUsersRequest"> & { - /** - * @generated from field: repeated string usernames = 1; - */ - usernames: string[]; -}; - -/** - * Describes the message memos.api.v1.BatchGetUsersRequest. - * Use `create(BatchGetUsersRequestSchema)` to create a new message. - */ -export const BatchGetUsersRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_user_service, 3); - -/** - * @generated from message memos.api.v1.BatchGetUsersResponse - */ -export type BatchGetUsersResponse = Message<"memos.api.v1.BatchGetUsersResponse"> & { - /** - * @generated from field: repeated memos.api.v1.User users = 1; - */ - users: User[]; -}; - -/** - * Describes the message memos.api.v1.BatchGetUsersResponse. - * Use `create(BatchGetUsersResponseSchema)` to create a new message. - */ -export const BatchGetUsersResponseSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_user_service, 4); - -/** - * @generated from message memos.api.v1.GetUserRequest - */ -export type GetUserRequest = Message<"memos.api.v1.GetUserRequest"> & { - /** - * Required. The resource name of the user. - * Format: users/{user} - * - * @generated from field: string name = 1; - */ - name: string; - - /** - * Optional. The fields to return in the response. - * If not specified, all fields are returned. - * - * @generated from field: google.protobuf.FieldMask read_mask = 2; - */ - readMask?: FieldMask | undefined; -}; - -/** - * Describes the message memos.api.v1.GetUserRequest. - * Use `create(GetUserRequestSchema)` to create a new message. - */ -export const GetUserRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_user_service, 5); - -/** - * @generated from message memos.api.v1.CreateUserRequest - */ -export type CreateUserRequest = Message<"memos.api.v1.CreateUserRequest"> & { - /** - * Required. The user to create. - * - * @generated from field: memos.api.v1.User user = 1; - */ - user?: User | undefined; - - /** - * Optional. The resource ID to use for this user. If set, it must equal - * user.username and follow the username format. - * Format: ^[a-zA-Z0-9]([a-zA-Z0-9-]{0,34}[a-zA-Z0-9])?$ - * - * @generated from field: string user_id = 2; - */ - userId: string; - - /** - * Optional. If set, validate the request but don't actually create the user. - * - * @generated from field: bool validate_only = 3; - */ - validateOnly: boolean; - - /** - * Optional. An idempotency token that can be used to ensure that multiple - * requests to create a user have the same result. - * - * @generated from field: string request_id = 4; - */ - requestId: string; -}; - -/** - * Describes the message memos.api.v1.CreateUserRequest. - * Use `create(CreateUserRequestSchema)` to create a new message. - */ -export const CreateUserRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_user_service, 6); - -/** - * @generated from message memos.api.v1.UpdateUserRequest - */ -export type UpdateUserRequest = Message<"memos.api.v1.UpdateUserRequest"> & { - /** - * Required. The user to update. - * - * @generated from field: memos.api.v1.User user = 1; - */ - user?: User | undefined; - - /** - * Required. The list of fields to update. - * - * @generated from field: google.protobuf.FieldMask update_mask = 2; - */ - updateMask?: FieldMask | undefined; - - /** - * Optional. If set to true, allows updating sensitive fields. - * - * @generated from field: bool allow_missing = 3; - */ - allowMissing: boolean; -}; - -/** - * Describes the message memos.api.v1.UpdateUserRequest. - * Use `create(UpdateUserRequestSchema)` to create a new message. - */ -export const UpdateUserRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_user_service, 7); - -/** - * @generated from message memos.api.v1.DeleteUserRequest - */ -export type DeleteUserRequest = Message<"memos.api.v1.DeleteUserRequest"> & { - /** - * Required. The resource name of the user to delete. - * Format: users/{user} - * - * @generated from field: string name = 1; - */ - name: string; - - /** - * Optional. If set to true, the user will be deleted even if they have associated data. - * - * @generated from field: bool force = 2; - */ - force: boolean; -}; - -/** - * Describes the message memos.api.v1.DeleteUserRequest. - * Use `create(DeleteUserRequestSchema)` to create a new message. - */ -export const DeleteUserRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_user_service, 8); - -/** - * User statistics messages - * - * @generated from message memos.api.v1.UserStats - */ -export type UserStats = Message<"memos.api.v1.UserStats"> & { - /** - * The resource name of the user statistics singleton. - * Format: users/{user}/stats - * - * @generated from field: string name = 1; - */ - name: string; - - /** - * The stats of memo types. - * - * @generated from field: memos.api.v1.UserStats.MemoTypeStats memo_type_stats = 3; - */ - memoTypeStats?: UserStats_MemoTypeStats | undefined; - - /** - * The count of tags. - * - * @generated from field: map tag_count = 4; - */ - tagCount: { [key: string]: number }; - - /** - * The creation timestamps of the user's memos. - * - * @generated from field: repeated google.protobuf.Timestamp memo_created_timestamps = 7; - */ - memoCreatedTimestamps: Timestamp[]; - - /** - * The latest update timestamps of the user's memos (one per memo, - * mirrors memo_created_timestamps). Used by the activity heatmap when - * the client's view is set to update_time basis. - * - * @generated from field: repeated google.protobuf.Timestamp memo_updated_timestamps = 8; - */ - memoUpdatedTimestamps: Timestamp[]; - - /** - * The pinned memos of the user. - * - * @generated from field: repeated string pinned_memos = 5; - */ - pinnedMemos: string[]; - - /** - * Total memo count. - * - * @generated from field: int32 total_memo_count = 6; - */ - totalMemoCount: number; - - /** - * Total persisted attachment size in bytes, including unlinked uploads and - * attachments in all spaces. Excludes temporary uploads and derived files. - * Returned only by GetUserStats for the authenticated user's own stats, - * independently of the request's memo filter. - * - * @generated from field: optional int64 attachment_storage_bytes = 9; - */ - attachmentStorageBytes?: bigint | undefined; -}; - -/** - * Describes the message memos.api.v1.UserStats. - * Use `create(UserStatsSchema)` to create a new message. - */ -export const UserStatsSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_user_service, 9); - -/** - * Memo type statistics. - * - * @generated from message memos.api.v1.UserStats.MemoTypeStats - */ -export type UserStats_MemoTypeStats = Message<"memos.api.v1.UserStats.MemoTypeStats"> & { - /** - * @generated from field: int32 link_count = 1; - */ - linkCount: number; - - /** - * @generated from field: int32 code_count = 2; - */ - codeCount: number; - - /** - * @generated from field: int32 todo_count = 3; - */ - todoCount: number; - - /** - * @generated from field: int32 undo_count = 4; - */ - undoCount: number; -}; - -/** - * Describes the message memos.api.v1.UserStats.MemoTypeStats. - * Use `create(UserStats_MemoTypeStatsSchema)` to create a new message. - */ -export const UserStats_MemoTypeStatsSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_user_service, 9, 0); - -/** - * @generated from message memos.api.v1.ExportMemosRequest - */ -export type ExportMemosRequest = Message<"memos.api.v1.ExportMemosRequest"> & { - /** - * Required. The user whose memos are exported. Must be the caller. - * Format: users/{user} - * - * @generated from field: string name = 1; - */ - name: string; -}; - -/** - * Describes the message memos.api.v1.ExportMemosRequest. - * Use `create(ExportMemosRequestSchema)` to create a new message. - */ -export const ExportMemosRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_user_service, 10); - -/** - * @generated from message memos.api.v1.ImportMemosRequest - */ -export type ImportMemosRequest = Message<"memos.api.v1.ImportMemosRequest"> & { - /** - * Required. The user who receives the memos. Must be the caller. - * Format: users/{user} - * - * @generated from field: string name = 1; - */ - name: string; - - /** - * Required. Start a new upload or continue an existing one. - * - * @generated from oneof memos.api.v1.ImportMemosRequest.upload - */ - upload: { - /** - * Starts a new upload. The same call may also carry data and finish_write. - * - * @generated from field: memos.api.v1.ImportMemosSpec spec = 2; - */ - value: ImportMemosSpec; - case: "spec"; - } | { - /** - * Continues the upload identified by a previous response. - * - * @generated from field: string upload_id = 3; - */ - value: string; - case: "uploadId"; - } | { case: undefined; value?: undefined }; - - /** - * Required. Zero-based byte offset at which data is written. Must equal the - * committed size, except when retrying the most recently accepted chunk - * with identical bytes and offset, which is accepted without writing again. - * - * @generated from field: int64 write_offset = 4; - */ - writeOffset: bigint; - - /** - * Optional. Archive bytes, at most max_chunk_size long. With no data and - * finish_write false, the call reports progress without writing, and - * write_offset is ignored. - * - * @generated from field: bytes data = 5; - */ - data: Uint8Array; - - /** - * Optional. Finish the upload after writing data. The committed size must - * then equal total_size. The archive is validated and, unless - * validate_only is set, imported. Any later call for an imported upload - * returns the same report. - * - * @generated from field: bool finish_write = 6; - */ - finishWrite: boolean; - - /** - * Optional. On a finishing call, validate the archive and return the plan - * without importing. The upload stays staged so a later finishing call can - * import it. - * - * @generated from field: bool validate_only = 7; - */ - validateOnly: boolean; - - /** - * Optional. Read on the finishing call that imports. Unspecified means SKIP. - * - * @generated from field: memos.api.v1.ImportMemosRequest.ConflictPolicy conflict_policy = 8; - */ - conflictPolicy: ImportMemosRequest_ConflictPolicy; -}; - -/** - * Describes the message memos.api.v1.ImportMemosRequest. - * Use `create(ImportMemosRequestSchema)` to create a new message. - */ -export const ImportMemosRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_user_service, 11); - -/** - * What the importer does with a memo whose UID the user already holds. - * - * @generated from enum memos.api.v1.ImportMemosRequest.ConflictPolicy - */ -export enum ImportMemosRequest_ConflictPolicy { - /** - * @generated from enum value: CONFLICT_POLICY_UNSPECIFIED = 0; - */ - CONFLICT_POLICY_UNSPECIFIED = 0, - - /** - * Leave the existing memo untouched. This is the default. - * - * @generated from enum value: SKIP = 1; - */ - SKIP = 1, - - /** - * Update the existing memo's content and metadata from the archive. - * - * @generated from enum value: REPLACE = 2; - */ - REPLACE = 2, - - /** - * Keep the existing memo and create the archive version under a fresh UID. - * - * @generated from enum value: DUPLICATE = 3; - */ - DUPLICATE = 3, -} - -/** - * Describes the enum memos.api.v1.ImportMemosRequest.ConflictPolicy. - */ -export const ImportMemosRequest_ConflictPolicySchema: GenEnum = /*@__PURE__*/ - enumDesc(file_api_v1_user_service, 11, 0); - -/** - * @generated from message memos.api.v1.ImportMemosSpec - */ -export type ImportMemosSpec = Message<"memos.api.v1.ImportMemosSpec"> & { - /** - * Optional. Total size of the archive in bytes. - * - * @generated from field: int64 total_size = 1; - */ - totalSize: bigint; -}; - -/** - * Describes the message memos.api.v1.ImportMemosSpec. - * Use `create(ImportMemosSpecSchema)` to create a new message. - */ -export const ImportMemosSpecSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_user_service, 12); - -/** - * @generated from message memos.api.v1.ImportMemosResponse - */ -export type ImportMemosResponse = Message<"memos.api.v1.ImportMemosResponse"> & { - /** - * Opaque ID for subsequent calls. This is not a resource name. - * - * @generated from field: string upload_id = 1; - */ - uploadId: string; - - /** - * Number of archive bytes committed so far. - * - * @generated from field: int64 committed_size = 2; - */ - committedSize: bigint; - - /** - * Maximum number of data bytes accepted in one call. - * - * @generated from field: int32 max_chunk_size = 3; - */ - maxChunkSize: number; - - /** - * Set once the upload has been finished. - * - * @generated from oneof memos.api.v1.ImportMemosResponse.result - */ - result: { - /** - * What the import would do. Set by a finishing call with validate_only. - * - * @generated from field: memos.api.v1.MemoImportPlan plan = 4; - */ - value: MemoImportPlan; - case: "plan"; - } | { - /** - * What the import did. Set by a finishing call that imported. - * - * @generated from field: memos.api.v1.MemoImportReport report = 5; - */ - value: MemoImportReport; - case: "report"; - } | { case: undefined; value?: undefined }; -}; - -/** - * Describes the message memos.api.v1.ImportMemosResponse. - * Use `create(ImportMemosResponseSchema)` to create a new message. - */ -export const ImportMemosResponseSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_user_service, 13); - -/** - * MemoImportIssue is one warning or failure of an import, tied to the memo - * UID from the archive when there is one. - * - * @generated from message memos.api.v1.MemoImportIssue - */ -export type MemoImportIssue = Message<"memos.api.v1.MemoImportIssue"> & { - /** - * The archive memo UID the issue concerns, if any. - * - * @generated from field: string memo = 1; - */ - memo: string; - - /** - * @generated from field: string message = 2; - */ - message: string; -}; - -/** - * Describes the message memos.api.v1.MemoImportIssue. - * Use `create(MemoImportIssueSchema)` to create a new message. - */ -export const MemoImportIssueSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_user_service, 14); - -/** - * MemoImportPlan describes what importing a staged archive would do. - * - * @generated from message memos.api.v1.MemoImportPlan - */ -export type MemoImportPlan = Message<"memos.api.v1.MemoImportPlan"> & { - /** - * When the archive was written. - * - * @generated from field: google.protobuf.Timestamp export_time = 1; - */ - exportTime?: Timestamp | undefined; - - /** - * Username of the user who exported the archive. - * - * @generated from field: string exporter = 2; - */ - exporter: string; - - /** - * The software that wrote the archive. - * - * @generated from field: string generator = 3; - */ - generator: string; - - /** - * Number of memo records in the archive. - * - * @generated from field: int32 memos = 4; - */ - memos: number; - - /** - * Number of attachment files in the archive. - * - * @generated from field: int32 attachments = 5; - */ - attachments: number; - - /** - * Memos whose UID nobody on the instance holds. - * - * @generated from field: int32 new = 6; - */ - new: number; - - /** - * Memos the user already holds; the conflict policy applies to them. - * - * @generated from field: int32 existing = 7; - */ - existing: number; - - /** - * Memos whose UID another account holds; they are imported under fresh UIDs. - * - * @generated from field: int32 renamed = 8; - */ - renamed: number; - - /** - * Deviations the archive reader corrected while validating. - * - * @generated from field: repeated memos.api.v1.MemoImportIssue warnings = 9; - */ - warnings: MemoImportIssue[]; -}; - -/** - * Describes the message memos.api.v1.MemoImportPlan. - * Use `create(MemoImportPlanSchema)` to create a new message. - */ -export const MemoImportPlanSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_user_service, 15); - -/** - * MemoImportReport is the outcome of an import. - * - * @generated from message memos.api.v1.MemoImportReport - */ -export type MemoImportReport = Message<"memos.api.v1.MemoImportReport"> & { - /** - * @generated from field: int32 created = 1; - */ - created: number; - - /** - * @generated from field: int32 updated = 2; - */ - updated: number; - - /** - * @generated from field: int32 skipped = 3; - */ - skipped: number; - - /** - * @generated from field: int32 failed = 4; - */ - failed: number; - - /** - * @generated from field: repeated memos.api.v1.MemoImportIssue warnings = 5; - */ - warnings: MemoImportIssue[]; - - /** - * One entry per failed memo, with the reason. - * - * @generated from field: repeated memos.api.v1.MemoImportIssue failures = 6; - */ - failures: MemoImportIssue[]; -}; - -/** - * Describes the message memos.api.v1.MemoImportReport. - * Use `create(MemoImportReportSchema)` to create a new message. - */ -export const MemoImportReportSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_user_service, 16); - -/** - * @generated from message memos.api.v1.GetUserStatsRequest - */ -export type GetUserStatsRequest = Message<"memos.api.v1.GetUserStatsRequest"> & { - /** - * Required. The resource name of the user. - * Format: users/{user} - * - * @generated from field: string name = 1; - */ - name: string; - - /** - * Optional. CEL expression selecting the readable non-comment memos to - * include. Supports the same fields as ListMemos, including `space`. - * - * @generated from field: string filter = 2; - */ - filter: string; -}; - -/** - * Describes the message memos.api.v1.GetUserStatsRequest. - * Use `create(GetUserStatsRequestSchema)` to create a new message. - */ -export const GetUserStatsRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_user_service, 17); - -/** - * @generated from message memos.api.v1.ListAllUserStatsRequest - */ -export type ListAllUserStatsRequest = Message<"memos.api.v1.ListAllUserStatsRequest"> & { - /** - * Optional. The state of memos to include. Defaults to NORMAL. - * - * @generated from field: memos.api.v1.State state = 1; - */ - state: State; - - /** - * Optional. Filter to apply to memo stats. - * Uses the same filter syntax as ListMemos. - * - * @generated from field: string filter = 2; - */ - filter: string; -}; - -/** - * Describes the message memos.api.v1.ListAllUserStatsRequest. - * Use `create(ListAllUserStatsRequestSchema)` to create a new message. - */ -export const ListAllUserStatsRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_user_service, 18); - -/** - * @generated from message memos.api.v1.ListAllUserStatsResponse - */ -export type ListAllUserStatsResponse = Message<"memos.api.v1.ListAllUserStatsResponse"> & { - /** - * The list of user statistics. - * - * @generated from field: repeated memos.api.v1.UserStats stats = 1; - */ - stats: UserStats[]; -}; - -/** - * Describes the message memos.api.v1.ListAllUserStatsResponse. - * Use `create(ListAllUserStatsResponseSchema)` to create a new message. - */ -export const ListAllUserStatsResponseSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_user_service, 19); - -/** - * User settings message - * - * @generated from message memos.api.v1.UserSetting - */ -export type UserSetting = Message<"memos.api.v1.UserSetting"> & { - /** - * The name of the user setting. - * Format: users/{user}/settings/{setting}, {setting} is the key for the setting. - * For example, "users/steven/settings/GENERAL" for general settings. - * - * @generated from field: string name = 1; - */ - name: string; - - /** - * @generated from oneof memos.api.v1.UserSetting.value - */ - value: { - /** - * @generated from field: memos.api.v1.UserSetting.GeneralSetting general_setting = 2; - */ - value: UserSetting_GeneralSetting; - case: "generalSetting"; - } | { - /** - * @generated from field: memos.api.v1.UserSetting.WebhooksSetting webhooks_setting = 5; - */ - value: UserSetting_WebhooksSetting; - case: "webhooksSetting"; - } | { - /** - * @generated from field: memos.api.v1.UserSetting.TagsSetting tags_setting = 6; - */ - value: UserSetting_TagsSetting; - case: "tagsSetting"; - } | { case: undefined; value?: undefined }; -}; - -/** - * Describes the message memos.api.v1.UserSetting. - * Use `create(UserSettingSchema)` to create a new message. - */ -export const UserSettingSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_user_service, 20); - -/** - * General user settings configuration. - * - * @generated from message memos.api.v1.UserSetting.GeneralSetting - */ -export type UserSetting_GeneralSetting = Message<"memos.api.v1.UserSetting.GeneralSetting"> & { - /** - * The preferred locale of the user. - * - * @generated from field: string locale = 1; - */ - locale: string; - - /** - * The default visibility of the memo. - * - * @generated from field: string memo_visibility = 3; - */ - memoVisibility: string; - - /** - * The preferred theme of the user. - * This references a CSS file in the web/public/themes/ directory. - * If not set, the default theme will be used. - * - * @generated from field: string theme = 4; - */ - theme: string; - - /** - * Whether the official client should save metadata from future media uploads. - * - * @generated from field: bool save_media_metadata = 5; - */ - saveMediaMetadata: boolean; -}; - -/** - * Describes the message memos.api.v1.UserSetting.GeneralSetting. - * Use `create(UserSetting_GeneralSettingSchema)` to create a new message. - */ -export const UserSetting_GeneralSettingSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_user_service, 20, 0); - -/** - * Tag metadata for user-specific display rules. - * - * @generated from message memos.api.v1.UserSetting.TagMetadata - */ -export type UserSetting_TagMetadata = Message<"memos.api.v1.UserSetting.TagMetadata"> & { - /** - * Optional background color for the tag label. - * When unset, the default tag color is used. - * - * @generated from field: google.type.Color background_color = 1; - */ - backgroundColor?: Color | undefined; - - /** - * Whether memos with this tag should have their content blurred. - * - * @generated from field: bool blur_content = 2; - */ - blurContent: boolean; -}; - -/** - * Describes the message memos.api.v1.UserSetting.TagMetadata. - * Use `create(UserSetting_TagMetadataSchema)` to create a new message. - */ -export const UserSetting_TagMetadataSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_user_service, 20, 1); - -/** - * User-specific tag metadata. - * - * @generated from message memos.api.v1.UserSetting.TagsSetting - */ -export type UserSetting_TagsSetting = Message<"memos.api.v1.UserSetting.TagsSetting"> & { - /** - * Map of tag name pattern to tag metadata. - * Each key is treated as an anchored regular expression (^pattern$). - * - * @generated from field: map tags = 1; - */ - tags: { [key: string]: UserSetting_TagMetadata }; -}; - -/** - * Describes the message memos.api.v1.UserSetting.TagsSetting. - * Use `create(UserSetting_TagsSettingSchema)` to create a new message. - */ -export const UserSetting_TagsSettingSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_user_service, 20, 2); - -/** - * User webhooks configuration. - * - * @generated from message memos.api.v1.UserSetting.WebhooksSetting - */ -export type UserSetting_WebhooksSetting = Message<"memos.api.v1.UserSetting.WebhooksSetting"> & { - /** - * List of user webhooks. - * - * @generated from field: repeated memos.api.v1.UserWebhook webhooks = 1; - */ - webhooks: UserWebhook[]; -}; - -/** - * Describes the message memos.api.v1.UserSetting.WebhooksSetting. - * Use `create(UserSetting_WebhooksSettingSchema)` to create a new message. - */ -export const UserSetting_WebhooksSettingSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_user_service, 20, 3); - -/** - * Enumeration of user setting keys. - * - * @generated from enum memos.api.v1.UserSetting.Key - */ -export enum UserSetting_Key { - /** - * @generated from enum value: KEY_UNSPECIFIED = 0; - */ - KEY_UNSPECIFIED = 0, - - /** - * GENERAL is the key for general user settings. - * - * @generated from enum value: GENERAL = 1; - */ - GENERAL = 1, - - /** - * WEBHOOKS is the key for user webhooks. - * - * @generated from enum value: WEBHOOKS = 4; - */ - WEBHOOKS = 4, - - /** - * TAGS is the key for per-user tag metadata. - * - * @generated from enum value: TAGS = 5; - */ - TAGS = 5, -} - -/** - * Describes the enum memos.api.v1.UserSetting.Key. - */ -export const UserSetting_KeySchema: GenEnum = /*@__PURE__*/ - enumDesc(file_api_v1_user_service, 20, 0); - -/** - * @generated from message memos.api.v1.GetUserSettingRequest - */ -export type GetUserSettingRequest = Message<"memos.api.v1.GetUserSettingRequest"> & { - /** - * Required. The resource name of the user setting. - * Format: users/{user}/settings/{setting} - * - * @generated from field: string name = 1; - */ - name: string; -}; - -/** - * Describes the message memos.api.v1.GetUserSettingRequest. - * Use `create(GetUserSettingRequestSchema)` to create a new message. - */ -export const GetUserSettingRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_user_service, 21); - -/** - * @generated from message memos.api.v1.UpdateUserSettingRequest - */ -export type UpdateUserSettingRequest = Message<"memos.api.v1.UpdateUserSettingRequest"> & { - /** - * Required. The user setting to update. - * - * @generated from field: memos.api.v1.UserSetting setting = 1; - */ - setting?: UserSetting | undefined; - - /** - * Required. The list of fields to update. - * - * @generated from field: google.protobuf.FieldMask update_mask = 2; - */ - updateMask?: FieldMask | undefined; -}; - -/** - * Describes the message memos.api.v1.UpdateUserSettingRequest. - * Use `create(UpdateUserSettingRequestSchema)` to create a new message. - */ -export const UpdateUserSettingRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_user_service, 22); - -/** - * Request message for ListUserSettings method. - * - * @generated from message memos.api.v1.ListUserSettingsRequest - */ -export type ListUserSettingsRequest = Message<"memos.api.v1.ListUserSettingsRequest"> & { - /** - * Required. The parent resource whose settings will be listed. - * Format: users/{user} - * - * @generated from field: string parent = 1; - */ - parent: string; - - /** - * Optional. The maximum number of settings to return. - * The service may return fewer than this value. - * If unspecified, at most 50 settings will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. - * - * @generated from field: int32 page_size = 2; - */ - pageSize: number; - - /** - * Optional. A page token, received from a previous `ListUserSettings` call. - * Provide this to retrieve the subsequent page. - * - * @generated from field: string page_token = 3; - */ - pageToken: string; -}; - -/** - * Describes the message memos.api.v1.ListUserSettingsRequest. - * Use `create(ListUserSettingsRequestSchema)` to create a new message. - */ -export const ListUserSettingsRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_user_service, 23); - -/** - * Response message for ListUserSettings method. - * - * @generated from message memos.api.v1.ListUserSettingsResponse - */ -export type ListUserSettingsResponse = Message<"memos.api.v1.ListUserSettingsResponse"> & { - /** - * The list of user settings. - * - * @generated from field: repeated memos.api.v1.UserSetting settings = 1; - */ - settings: UserSetting[]; - - /** - * A token that can be sent as `page_token` to retrieve the next page. - * If this field is omitted, there are no subsequent pages. - * - * @generated from field: string next_page_token = 2; - */ - nextPageToken: string; -}; - -/** - * Describes the message memos.api.v1.ListUserSettingsResponse. - * Use `create(ListUserSettingsResponseSchema)` to create a new message. - */ -export const ListUserSettingsResponseSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_user_service, 24); - -/** - * Saved memo view messages - * - * @generated from message memos.api.v1.MemoView - */ -export type MemoView = Message<"memos.api.v1.MemoView"> & { - /** - * The resource name of the memo view. - * Format: users/{user}/views/{view} - * - * @generated from field: string name = 1; - */ - name: string; - - /** - * The title of the memo view. - * - * @generated from field: string title = 2; - */ - title: string; - - /** - * The CEL filter expression for the memo view, using the same grammar as the - * ListMemos `filter` argument. Reuse it by passing this value to ListMemos. - * - * @generated from field: string filter = 3; - */ - filter: string; - - /** - * Optional. Display icon. Omit when updating with the "icon" mask to reset - * to the default view icon. - * - * @generated from field: memos.api.v1.MemoView.Icon icon = 4; - */ - icon?: MemoView_Icon | undefined; -}; - -/** - * Describes the message memos.api.v1.MemoView. - * Use `create(MemoViewSchema)` to create a new message. - */ -export const MemoViewSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_user_service, 25); - -/** - * @generated from message memos.api.v1.MemoView.Icon - */ -export type MemoView_Icon = Message<"memos.api.v1.MemoView.Icon"> & { - /** - * @generated from oneof memos.api.v1.MemoView.Icon.value - */ - value: { - /** - * A Unicode emoji sequence. - * - * @generated from field: string emoji = 1; - */ - value: string; - case: "emoji"; - } | { - /** - * A canonical Lucide icon name, such as "leaf". - * - * @generated from field: string lucide = 2; - */ - value: string; - case: "lucide"; - } | { case: undefined; value?: undefined }; -}; - -/** - * Describes the message memos.api.v1.MemoView.Icon. - * Use `create(MemoView_IconSchema)` to create a new message. - */ -export const MemoView_IconSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_user_service, 25, 0); - -/** - * @generated from message memos.api.v1.ListMemoViewsRequest - */ -export type ListMemoViewsRequest = Message<"memos.api.v1.ListMemoViewsRequest"> & { - /** - * Required. The parent resource where memo views are listed. - * Format: users/{user} - * - * @generated from field: string parent = 1; - */ - parent: string; -}; - -/** - * Describes the message memos.api.v1.ListMemoViewsRequest. - * Use `create(ListMemoViewsRequestSchema)` to create a new message. - */ -export const ListMemoViewsRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_user_service, 26); - -/** - * @generated from message memos.api.v1.ListMemoViewsResponse - */ -export type ListMemoViewsResponse = Message<"memos.api.v1.ListMemoViewsResponse"> & { - /** - * The list of memo views. - * - * @generated from field: repeated memos.api.v1.MemoView memo_views = 1; - */ - memoViews: MemoView[]; -}; - -/** - * Describes the message memos.api.v1.ListMemoViewsResponse. - * Use `create(ListMemoViewsResponseSchema)` to create a new message. - */ -export const ListMemoViewsResponseSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_user_service, 27); - -/** - * @generated from message memos.api.v1.GetMemoViewRequest - */ -export type GetMemoViewRequest = Message<"memos.api.v1.GetMemoViewRequest"> & { - /** - * Required. The resource name of the memo view to retrieve. - * Format: users/{user}/views/{view} - * - * @generated from field: string name = 1; - */ - name: string; -}; - -/** - * Describes the message memos.api.v1.GetMemoViewRequest. - * Use `create(GetMemoViewRequestSchema)` to create a new message. - */ -export const GetMemoViewRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_user_service, 28); - -/** - * @generated from message memos.api.v1.CreateMemoViewRequest - */ -export type CreateMemoViewRequest = Message<"memos.api.v1.CreateMemoViewRequest"> & { - /** - * Required. The parent resource where this memo view will be created. - * Format: users/{user} - * - * @generated from field: string parent = 1; - */ - parent: string; - - /** - * Required. The memo view to create. - * - * @generated from field: memos.api.v1.MemoView memo_view = 2; - */ - memoView?: MemoView | undefined; - - /** - * Optional. If set, validate the request, but do not actually create the memo view. - * - * @generated from field: bool validate_only = 3; - */ - validateOnly: boolean; -}; - -/** - * Describes the message memos.api.v1.CreateMemoViewRequest. - * Use `create(CreateMemoViewRequestSchema)` to create a new message. - */ -export const CreateMemoViewRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_user_service, 29); - -/** - * @generated from message memos.api.v1.UpdateMemoViewRequest - */ -export type UpdateMemoViewRequest = Message<"memos.api.v1.UpdateMemoViewRequest"> & { - /** - * Required. The memo view resource which replaces the resource on the server. - * - * @generated from field: memos.api.v1.MemoView memo_view = 1; - */ - memoView?: MemoView | undefined; - - /** - * Optional. The list of fields to update. - * - * @generated from field: google.protobuf.FieldMask update_mask = 2; - */ - updateMask?: FieldMask | undefined; -}; - -/** - * Describes the message memos.api.v1.UpdateMemoViewRequest. - * Use `create(UpdateMemoViewRequestSchema)` to create a new message. - */ -export const UpdateMemoViewRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_user_service, 30); - -/** - * @generated from message memos.api.v1.DeleteMemoViewRequest - */ -export type DeleteMemoViewRequest = Message<"memos.api.v1.DeleteMemoViewRequest"> & { - /** - * Required. The resource name of the memo view to delete. - * Format: users/{user}/views/{view} - * - * @generated from field: string name = 1; - */ - name: string; -}; - -/** - * Describes the message memos.api.v1.DeleteMemoViewRequest. - * Use `create(DeleteMemoViewRequestSchema)` to create a new message. - */ -export const DeleteMemoViewRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_user_service, 31); - -/** - * LinkedIdentity represents an SSO identity linked to a user account. - * - * @generated from message memos.api.v1.LinkedIdentity - */ -export type LinkedIdentity = Message<"memos.api.v1.LinkedIdentity"> & { - /** - * The resource name of the linked identity. - * Format: users/{user}/linkedIdentities/{linked_identity} - * - * @generated from field: string name = 1; - */ - name: string; - - /** - * The resource name of the identity provider. - * Format: identity-providers/{idp} - * - * @generated from field: string idp_name = 2; - */ - idpName: string; - - /** - * The external user identifier from the identity provider. - * - * @generated from field: string extern_uid = 3; - */ - externUid: string; -}; - -/** - * Describes the message memos.api.v1.LinkedIdentity. - * Use `create(LinkedIdentitySchema)` to create a new message. - */ -export const LinkedIdentitySchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_user_service, 32); - -/** - * @generated from message memos.api.v1.ListLinkedIdentitiesRequest - */ -export type ListLinkedIdentitiesRequest = Message<"memos.api.v1.ListLinkedIdentitiesRequest"> & { - /** - * Required. The parent resource whose linked identities will be listed. - * Format: users/{user} - * - * @generated from field: string parent = 1; - */ - parent: string; -}; - -/** - * Describes the message memos.api.v1.ListLinkedIdentitiesRequest. - * Use `create(ListLinkedIdentitiesRequestSchema)` to create a new message. - */ -export const ListLinkedIdentitiesRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_user_service, 33); - -/** - * @generated from message memos.api.v1.ListLinkedIdentitiesResponse - */ -export type ListLinkedIdentitiesResponse = Message<"memos.api.v1.ListLinkedIdentitiesResponse"> & { - /** - * The list of linked identities. - * - * @generated from field: repeated memos.api.v1.LinkedIdentity linked_identities = 1; - */ - linkedIdentities: LinkedIdentity[]; -}; - -/** - * Describes the message memos.api.v1.ListLinkedIdentitiesResponse. - * Use `create(ListLinkedIdentitiesResponseSchema)` to create a new message. - */ -export const ListLinkedIdentitiesResponseSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_user_service, 34); - -/** - * @generated from message memos.api.v1.CreateLinkedIdentityRequest - */ -export type CreateLinkedIdentityRequest = Message<"memos.api.v1.CreateLinkedIdentityRequest"> & { - /** - * Required. The parent user who owns the linked identity. - * Format: users/{user} - * - * @generated from field: string parent = 1; - */ - parent: string; - - /** - * Required. The identity provider to link. - * Format: identity-providers/{idp} - * - * @generated from field: string idp_name = 2; - */ - idpName: string; - - /** - * Required. The authorization code from the identity provider. - * - * @generated from field: string code = 3; - */ - code: string; - - /** - * Required. The redirect URI used in the OAuth flow. - * - * @generated from field: string redirect_uri = 4; - */ - redirectUri: string; - - /** - * Optional. The PKCE code verifier used in the OAuth flow. - * - * @generated from field: string code_verifier = 5; - */ - codeVerifier: string; -}; - -/** - * Describes the message memos.api.v1.CreateLinkedIdentityRequest. - * Use `create(CreateLinkedIdentityRequestSchema)` to create a new message. - */ -export const CreateLinkedIdentityRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_user_service, 35); - -/** - * @generated from message memos.api.v1.GetLinkedIdentityRequest - */ -export type GetLinkedIdentityRequest = Message<"memos.api.v1.GetLinkedIdentityRequest"> & { - /** - * Required. The resource name of the linked identity to get. - * Format: users/{user}/linkedIdentities/{linked_identity} - * - * @generated from field: string name = 1; - */ - name: string; -}; - -/** - * Describes the message memos.api.v1.GetLinkedIdentityRequest. - * Use `create(GetLinkedIdentityRequestSchema)` to create a new message. - */ -export const GetLinkedIdentityRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_user_service, 36); - -/** - * @generated from message memos.api.v1.DeleteLinkedIdentityRequest - */ -export type DeleteLinkedIdentityRequest = Message<"memos.api.v1.DeleteLinkedIdentityRequest"> & { - /** - * Required. The resource name of the linked identity to delete. - * Format: users/{user}/linkedIdentities/{linked_identity} - * - * @generated from field: string name = 1; - */ - name: string; -}; - -/** - * Describes the message memos.api.v1.DeleteLinkedIdentityRequest. - * Use `create(DeleteLinkedIdentityRequestSchema)` to create a new message. - */ -export const DeleteLinkedIdentityRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_user_service, 37); - -/** - * PersonalAccessToken represents a long-lived token for API/script access. - * PATs are distinct from short-lived JWT access tokens used for session authentication. - * - * @generated from message memos.api.v1.PersonalAccessToken - */ -export type PersonalAccessToken = Message<"memos.api.v1.PersonalAccessToken"> & { - /** - * The resource name of the personal access token. - * Format: users/{user}/personalAccessTokens/{personal_access_token} - * - * @generated from field: string name = 1; - */ - name: string; - - /** - * The description of the token. - * - * @generated from field: string description = 2; - */ - description: string; - - /** - * Output only. The creation timestamp. - * - * @generated from field: google.protobuf.Timestamp created_at = 3; - */ - createdAt?: Timestamp | undefined; - - /** - * Optional. The expiration timestamp. - * - * @generated from field: google.protobuf.Timestamp expires_at = 4; - */ - expiresAt?: Timestamp | undefined; - - /** - * Output only. The last used timestamp. - * - * @generated from field: google.protobuf.Timestamp last_used_at = 5; - */ - lastUsedAt?: Timestamp | undefined; -}; - -/** - * Describes the message memos.api.v1.PersonalAccessToken. - * Use `create(PersonalAccessTokenSchema)` to create a new message. - */ -export const PersonalAccessTokenSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_user_service, 38); - -/** - * @generated from message memos.api.v1.ListPersonalAccessTokensRequest - */ -export type ListPersonalAccessTokensRequest = Message<"memos.api.v1.ListPersonalAccessTokensRequest"> & { - /** - * Required. The parent resource whose personal access tokens will be listed. - * Format: users/{user} - * - * @generated from field: string parent = 1; - */ - parent: string; - - /** - * Optional. The maximum number of tokens to return. - * - * @generated from field: int32 page_size = 2; - */ - pageSize: number; - - /** - * Optional. A page token for pagination. - * - * @generated from field: string page_token = 3; - */ - pageToken: string; -}; - -/** - * Describes the message memos.api.v1.ListPersonalAccessTokensRequest. - * Use `create(ListPersonalAccessTokensRequestSchema)` to create a new message. - */ -export const ListPersonalAccessTokensRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_user_service, 39); - -/** - * @generated from message memos.api.v1.ListPersonalAccessTokensResponse - */ -export type ListPersonalAccessTokensResponse = Message<"memos.api.v1.ListPersonalAccessTokensResponse"> & { - /** - * The list of personal access tokens. - * - * @generated from field: repeated memos.api.v1.PersonalAccessToken personal_access_tokens = 1; - */ - personalAccessTokens: PersonalAccessToken[]; - - /** - * A token for the next page of results. - * - * @generated from field: string next_page_token = 2; - */ - nextPageToken: string; -}; - -/** - * Describes the message memos.api.v1.ListPersonalAccessTokensResponse. - * Use `create(ListPersonalAccessTokensResponseSchema)` to create a new message. - */ -export const ListPersonalAccessTokensResponseSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_user_service, 40); - -/** - * @generated from message memos.api.v1.CreatePersonalAccessTokenRequest - */ -export type CreatePersonalAccessTokenRequest = Message<"memos.api.v1.CreatePersonalAccessTokenRequest"> & { - /** - * Required. The parent resource where this token will be created. - * Format: users/{user} - * - * @generated from field: string parent = 1; - */ - parent: string; - - /** - * Optional. Description of the personal access token. - * - * @generated from field: string description = 2; - */ - description: string; - - /** - * Optional. Expiration duration in days (0 = never expires). - * - * @generated from field: int32 expires_in_days = 3; - */ - expiresInDays: number; -}; - -/** - * Describes the message memos.api.v1.CreatePersonalAccessTokenRequest. - * Use `create(CreatePersonalAccessTokenRequestSchema)` to create a new message. - */ -export const CreatePersonalAccessTokenRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_user_service, 41); - -/** - * @generated from message memos.api.v1.CreatePersonalAccessTokenResponse - */ -export type CreatePersonalAccessTokenResponse = Message<"memos.api.v1.CreatePersonalAccessTokenResponse"> & { - /** - * The personal access token metadata. - * - * @generated from field: memos.api.v1.PersonalAccessToken personal_access_token = 1; - */ - personalAccessToken?: PersonalAccessToken | undefined; - - /** - * The actual token value - only returned on creation. - * This is the only time the token value will be visible. - * - * @generated from field: string token = 2; - */ - token: string; -}; - -/** - * Describes the message memos.api.v1.CreatePersonalAccessTokenResponse. - * Use `create(CreatePersonalAccessTokenResponseSchema)` to create a new message. - */ -export const CreatePersonalAccessTokenResponseSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_user_service, 42); - -/** - * @generated from message memos.api.v1.DeletePersonalAccessTokenRequest - */ -export type DeletePersonalAccessTokenRequest = Message<"memos.api.v1.DeletePersonalAccessTokenRequest"> & { - /** - * Required. The resource name of the personal access token to delete. - * Format: users/{user}/personalAccessTokens/{personal_access_token} - * - * @generated from field: string name = 1; - */ - name: string; -}; - -/** - * Describes the message memos.api.v1.DeletePersonalAccessTokenRequest. - * Use `create(DeletePersonalAccessTokenRequestSchema)` to create a new message. - */ -export const DeletePersonalAccessTokenRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_user_service, 43); - -/** - * UserWebhook represents a webhook owned by a user. - * - * @generated from message memos.api.v1.UserWebhook - */ -export type UserWebhook = Message<"memos.api.v1.UserWebhook"> & { - /** - * The name of the webhook. - * Format: users/{user}/webhooks/{webhook} - * - * @generated from field: string name = 1; - */ - name: string; - - /** - * The URL to send the webhook to. - * - * @generated from field: string url = 2; - */ - url: string; - - /** - * Optional. Human-readable name for the webhook. - * - * @generated from field: string display_name = 3; - */ - displayName: string; - - /** - * The creation time of the webhook. - * - * @generated from field: google.protobuf.Timestamp create_time = 4; - */ - createTime?: Timestamp | undefined; - - /** - * The last update time of the webhook. - * - * @generated from field: google.protobuf.Timestamp update_time = 5; - */ - updateTime?: Timestamp | undefined; - - /** - * Optional. Signing secret used to HMAC-SHA256 sign the webhook request body. - * This field is input-only; it is never returned in responses. - * - * @generated from field: string signing_secret = 6; - */ - signingSecret: string; - - /** - * Whether a signing secret is configured for this webhook. - * - * @generated from field: bool signing_secret_set = 7; - */ - signingSecretSet: boolean; -}; - -/** - * Describes the message memos.api.v1.UserWebhook. - * Use `create(UserWebhookSchema)` to create a new message. - */ -export const UserWebhookSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_user_service, 44); - -/** - * @generated from message memos.api.v1.ListUserWebhooksRequest - */ -export type ListUserWebhooksRequest = Message<"memos.api.v1.ListUserWebhooksRequest"> & { - /** - * The parent user resource. - * Format: users/{user} - * - * @generated from field: string parent = 1; - */ - parent: string; -}; - -/** - * Describes the message memos.api.v1.ListUserWebhooksRequest. - * Use `create(ListUserWebhooksRequestSchema)` to create a new message. - */ -export const ListUserWebhooksRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_user_service, 45); - -/** - * @generated from message memos.api.v1.ListUserWebhooksResponse - */ -export type ListUserWebhooksResponse = Message<"memos.api.v1.ListUserWebhooksResponse"> & { - /** - * The list of webhooks. - * - * @generated from field: repeated memos.api.v1.UserWebhook webhooks = 1; - */ - webhooks: UserWebhook[]; -}; - -/** - * Describes the message memos.api.v1.ListUserWebhooksResponse. - * Use `create(ListUserWebhooksResponseSchema)` to create a new message. - */ -export const ListUserWebhooksResponseSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_user_service, 46); - -/** - * @generated from message memos.api.v1.CreateUserWebhookRequest - */ -export type CreateUserWebhookRequest = Message<"memos.api.v1.CreateUserWebhookRequest"> & { - /** - * The parent user resource. - * Format: users/{user} - * - * @generated from field: string parent = 1; - */ - parent: string; - - /** - * The webhook to create. - * - * @generated from field: memos.api.v1.UserWebhook webhook = 2; - */ - webhook?: UserWebhook | undefined; -}; - -/** - * Describes the message memos.api.v1.CreateUserWebhookRequest. - * Use `create(CreateUserWebhookRequestSchema)` to create a new message. - */ -export const CreateUserWebhookRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_user_service, 47); - -/** - * @generated from message memos.api.v1.UpdateUserWebhookRequest - */ -export type UpdateUserWebhookRequest = Message<"memos.api.v1.UpdateUserWebhookRequest"> & { - /** - * The webhook to update. - * - * @generated from field: memos.api.v1.UserWebhook webhook = 1; - */ - webhook?: UserWebhook | undefined; - - /** - * The list of fields to update. - * - * @generated from field: google.protobuf.FieldMask update_mask = 2; - */ - updateMask?: FieldMask | undefined; -}; - -/** - * Describes the message memos.api.v1.UpdateUserWebhookRequest. - * Use `create(UpdateUserWebhookRequestSchema)` to create a new message. - */ -export const UpdateUserWebhookRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_user_service, 48); - -/** - * @generated from message memos.api.v1.DeleteUserWebhookRequest - */ -export type DeleteUserWebhookRequest = Message<"memos.api.v1.DeleteUserWebhookRequest"> & { - /** - * The name of the webhook to delete. - * Format: users/{user}/webhooks/{webhook} - * - * @generated from field: string name = 1; - */ - name: string; -}; - -/** - * Describes the message memos.api.v1.DeleteUserWebhookRequest. - * Use `create(DeleteUserWebhookRequestSchema)` to create a new message. - */ -export const DeleteUserWebhookRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_user_service, 49); - -/** - * @generated from message memos.api.v1.GetUserWebhookSigningSecretRequest - */ -export type GetUserWebhookSigningSecretRequest = Message<"memos.api.v1.GetUserWebhookSigningSecretRequest"> & { - /** - * The name of the webhook whose signing secret to reveal. - * Format: users/{user}/webhooks/{webhook} - * - * @generated from field: string name = 1; - */ - name: string; -}; - -/** - * Describes the message memos.api.v1.GetUserWebhookSigningSecretRequest. - * Use `create(GetUserWebhookSigningSecretRequestSchema)` to create a new message. - */ -export const GetUserWebhookSigningSecretRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_user_service, 50); - -/** - * @generated from message memos.api.v1.GetUserWebhookSigningSecretResponse - */ -export type GetUserWebhookSigningSecretResponse = Message<"memos.api.v1.GetUserWebhookSigningSecretResponse"> & { - /** - * The signing secret, in the Standard Webhooks "whsec_" form. - * - * @generated from field: string signing_secret = 1; - */ - signingSecret: string; -}; - -/** - * Describes the message memos.api.v1.GetUserWebhookSigningSecretResponse. - * Use `create(GetUserWebhookSigningSecretResponseSchema)` to create a new message. - */ -export const GetUserWebhookSigningSecretResponseSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_user_service, 51); - -/** - * @generated from message memos.api.v1.UserNotification - */ -export type UserNotification = Message<"memos.api.v1.UserNotification"> & { - /** - * The resource name of the notification. - * Format: users/{user}/notifications/{notification} - * - * @generated from field: string name = 1; - */ - name: string; - - /** - * The sender of the notification. - * Format: users/{user} - * - * @generated from field: string sender = 2; - */ - sender: string; - - /** - * The sender user details. - * - * @generated from field: memos.api.v1.User sender_user = 8; - */ - senderUser?: User | undefined; - - /** - * The status of the notification. - * - * @generated from field: memos.api.v1.UserNotification.Status status = 3; - */ - status: UserNotification_Status; - - /** - * The creation timestamp. - * - * @generated from field: google.protobuf.Timestamp create_time = 4; - */ - createTime?: Timestamp | undefined; - - /** - * The type of the notification. - * - * @generated from field: memos.api.v1.UserNotification.Type type = 5; - */ - type: UserNotification_Type; - - /** - * @generated from oneof memos.api.v1.UserNotification.payload - */ - payload: { - /** - * @generated from field: memos.api.v1.UserNotification.MemoCommentPayload memo_comment = 6; - */ - value: UserNotification_MemoCommentPayload; - case: "memoComment"; - } | { - /** - * @generated from field: memos.api.v1.UserNotification.MemoMentionPayload memo_mention = 7; - */ - value: UserNotification_MemoMentionPayload; - case: "memoMention"; - } | { - /** - * @generated from field: memos.api.v1.UserNotification.SpaceInvitationPayload space_invitation = 9; - */ - value: UserNotification_SpaceInvitationPayload; - case: "spaceInvitation"; - } | { case: undefined; value?: undefined }; -}; - -/** - * Describes the message memos.api.v1.UserNotification. - * Use `create(UserNotificationSchema)` to create a new message. - */ -export const UserNotificationSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_user_service, 52); - -/** - * @generated from message memos.api.v1.UserNotification.MemoCommentPayload - */ -export type UserNotification_MemoCommentPayload = Message<"memos.api.v1.UserNotification.MemoCommentPayload"> & { - /** - * The memo name of comment. - * Format: memos/{memo} - * - * @generated from field: string memo = 1; - */ - memo: string; - - /** - * The name of related memo. - * Format: memos/{memo} - * - * @generated from field: string related_memo = 2; - */ - relatedMemo: string; - - /** - * Preview text of the comment memo. - * - * @generated from field: string memo_snippet = 3; - */ - memoSnippet: string; - - /** - * Preview text of the related memo. - * - * @generated from field: string related_memo_snippet = 4; - */ - relatedMemoSnippet: string; -}; - -/** - * Describes the message memos.api.v1.UserNotification.MemoCommentPayload. - * Use `create(UserNotification_MemoCommentPayloadSchema)` to create a new message. - */ -export const UserNotification_MemoCommentPayloadSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_user_service, 52, 0); - -/** - * @generated from message memos.api.v1.UserNotification.MemoMentionPayload - */ -export type UserNotification_MemoMentionPayload = Message<"memos.api.v1.UserNotification.MemoMentionPayload"> & { - /** - * The memo that contains the mention. - * Format: memos/{memo} - * - * @generated from field: string memo = 1; - */ - memo: string; - - /** - * The related parent memo when the mention was created in a comment. - * Format: memos/{memo} - * - * @generated from field: string related_memo = 2; - */ - relatedMemo: string; - - /** - * Preview text of the memo that contains the mention. - * - * @generated from field: string memo_snippet = 3; - */ - memoSnippet: string; - - /** - * Preview text of the related parent memo. - * - * @generated from field: string related_memo_snippet = 4; - */ - relatedMemoSnippet: string; -}; - -/** - * Describes the message memos.api.v1.UserNotification.MemoMentionPayload. - * Use `create(UserNotification_MemoMentionPayloadSchema)` to create a new message. - */ -export const UserNotification_MemoMentionPayloadSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_user_service, 52, 1); - -/** - * @generated from message memos.api.v1.UserNotification.SpaceInvitationPayload - */ -export type UserNotification_SpaceInvitationPayload = Message<"memos.api.v1.UserNotification.SpaceInvitationPayload"> & { - /** - * The invitation resource. - * Format: spaces/{space}/invitations/{username} - * - * @generated from field: string space_invitation = 1; - */ - spaceInvitation: string; - - /** - * The read-only Space summary carried by the invitation. - * - * @generated from field: memos.api.v1.Space space = 2; - */ - space?: Space | undefined; - - /** - * The role the invitation offers. - * - * @generated from field: memos.api.v1.SpaceMember.Role role = 3; - */ - role: SpaceMember_Role; - - /** - * The current state of the invitation for the receiver. - * - * @generated from field: memos.api.v1.UserNotification.SpaceInvitationPayload.State state = 4; - */ - state: UserNotification_SpaceInvitationPayload_State; -}; - -/** - * Describes the message memos.api.v1.UserNotification.SpaceInvitationPayload. - * Use `create(UserNotification_SpaceInvitationPayloadSchema)` to create a new message. - */ -export const UserNotification_SpaceInvitationPayloadSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_user_service, 52, 2); - -/** - * @generated from enum memos.api.v1.UserNotification.SpaceInvitationPayload.State - */ -export enum UserNotification_SpaceInvitationPayload_State { - /** - * @generated from enum value: STATE_UNSPECIFIED = 0; - */ - STATE_UNSPECIFIED = 0, - - /** - * The receiver has not yet accepted or declined the invitation. - * - * @generated from enum value: PENDING = 1; - */ - PENDING = 1, - - /** - * The receiver accepted the invitation and is an active member. - * - * @generated from enum value: ACCEPTED = 2; - */ - ACCEPTED = 2, -} - -/** - * Describes the enum memos.api.v1.UserNotification.SpaceInvitationPayload.State. - */ -export const UserNotification_SpaceInvitationPayload_StateSchema: GenEnum = /*@__PURE__*/ - enumDesc(file_api_v1_user_service, 52, 2, 0); - -/** - * @generated from enum memos.api.v1.UserNotification.Status - */ -export enum UserNotification_Status { - /** - * @generated from enum value: STATUS_UNSPECIFIED = 0; - */ - STATUS_UNSPECIFIED = 0, - - /** - * @generated from enum value: UNREAD = 1; - */ - UNREAD = 1, - - /** - * @generated from enum value: ARCHIVED = 2; - */ - ARCHIVED = 2, -} - -/** - * Describes the enum memos.api.v1.UserNotification.Status. - */ -export const UserNotification_StatusSchema: GenEnum = /*@__PURE__*/ - enumDesc(file_api_v1_user_service, 52, 0); - -/** - * @generated from enum memos.api.v1.UserNotification.Type - */ -export enum UserNotification_Type { - /** - * @generated from enum value: TYPE_UNSPECIFIED = 0; - */ - TYPE_UNSPECIFIED = 0, - - /** - * @generated from enum value: MEMO_COMMENT = 1; - */ - MEMO_COMMENT = 1, - - /** - * @generated from enum value: MEMO_MENTION = 2; - */ - MEMO_MENTION = 2, - - /** - * @generated from enum value: SPACE_INVITATION = 3; - */ - SPACE_INVITATION = 3, -} - -/** - * Describes the enum memos.api.v1.UserNotification.Type. - */ -export const UserNotification_TypeSchema: GenEnum = /*@__PURE__*/ - enumDesc(file_api_v1_user_service, 52, 1); - -/** - * @generated from message memos.api.v1.ListUserNotificationsRequest - */ -export type ListUserNotificationsRequest = Message<"memos.api.v1.ListUserNotificationsRequest"> & { - /** - * The parent user resource. - * Format: users/{user} - * - * @generated from field: string parent = 1; - */ - parent: string; - - /** - * @generated from field: int32 page_size = 2; - */ - pageSize: number; - - /** - * @generated from field: string page_token = 3; - */ - pageToken: string; - - /** - * @generated from field: string filter = 4; - */ - filter: string; -}; - -/** - * Describes the message memos.api.v1.ListUserNotificationsRequest. - * Use `create(ListUserNotificationsRequestSchema)` to create a new message. - */ -export const ListUserNotificationsRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_user_service, 53); - -/** - * @generated from message memos.api.v1.ListUserNotificationsResponse - */ -export type ListUserNotificationsResponse = Message<"memos.api.v1.ListUserNotificationsResponse"> & { - /** - * @generated from field: repeated memos.api.v1.UserNotification notifications = 1; - */ - notifications: UserNotification[]; - - /** - * @generated from field: string next_page_token = 2; - */ - nextPageToken: string; -}; - -/** - * Describes the message memos.api.v1.ListUserNotificationsResponse. - * Use `create(ListUserNotificationsResponseSchema)` to create a new message. - */ -export const ListUserNotificationsResponseSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_user_service, 54); - -/** - * @generated from message memos.api.v1.UpdateUserNotificationRequest - */ -export type UpdateUserNotificationRequest = Message<"memos.api.v1.UpdateUserNotificationRequest"> & { - /** - * @generated from field: memos.api.v1.UserNotification notification = 1; - */ - notification?: UserNotification | undefined; - - /** - * @generated from field: google.protobuf.FieldMask update_mask = 2; - */ - updateMask?: FieldMask | undefined; -}; - -/** - * Describes the message memos.api.v1.UpdateUserNotificationRequest. - * Use `create(UpdateUserNotificationRequestSchema)` to create a new message. - */ -export const UpdateUserNotificationRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_user_service, 55); - -/** - * @generated from message memos.api.v1.DeleteUserNotificationRequest - */ -export type DeleteUserNotificationRequest = Message<"memos.api.v1.DeleteUserNotificationRequest"> & { - /** - * Format: users/{user}/notifications/{notification} - * - * @generated from field: string name = 1; - */ - name: string; -}; - -/** - * Describes the message memos.api.v1.DeleteUserNotificationRequest. - * Use `create(DeleteUserNotificationRequestSchema)` to create a new message. - */ -export const DeleteUserNotificationRequestSchema: GenMessage = /*@__PURE__*/ - messageDesc(file_api_v1_user_service, 56); - -/** - * @generated from service memos.api.v1.UserService - */ -export const UserService: GenService<{ - /** - * ListUsers returns a list of users. - * - * @generated from rpc memos.api.v1.UserService.ListUsers - */ - listUsers: { - methodKind: "unary"; - input: typeof ListUsersRequestSchema; - output: typeof ListUsersResponseSchema; - }, - /** - * BatchGetUsers returns active users by usernames. - * - * @generated from rpc memos.api.v1.UserService.BatchGetUsers - */ - batchGetUsers: { - methodKind: "unary"; - input: typeof BatchGetUsersRequestSchema; - output: typeof BatchGetUsersResponseSchema; - }, - /** - * GetUser gets a user by username. - * Format: users/{user} (e.g., users/steven) - * - * @generated from rpc memos.api.v1.UserService.GetUser - */ - getUser: { - methodKind: "unary"; - input: typeof GetUserRequestSchema; - output: typeof UserSchema; - }, - /** - * CreateUser creates a new user. - * - * @generated from rpc memos.api.v1.UserService.CreateUser - */ - createUser: { - methodKind: "unary"; - input: typeof CreateUserRequestSchema; - output: typeof UserSchema; - }, - /** - * UpdateUser updates a user. - * - * @generated from rpc memos.api.v1.UserService.UpdateUser - */ - updateUser: { - methodKind: "unary"; - input: typeof UpdateUserRequestSchema; - output: typeof UserSchema; - }, - /** - * DeleteUser deletes a user. - * - * @generated from rpc memos.api.v1.UserService.DeleteUser - */ - deleteUser: { - methodKind: "unary"; - input: typeof DeleteUserRequestSchema; - output: typeof EmptySchema; - }, - /** - * ListAllUserStats returns statistics for all users. - * - * @generated from rpc memos.api.v1.UserService.ListAllUserStats - */ - listAllUserStats: { - methodKind: "unary"; - input: typeof ListAllUserStatsRequestSchema; - output: typeof ListAllUserStatsResponseSchema; - }, - /** - * GetUserStats returns statistics for a specific user. - * - * @generated from rpc memos.api.v1.UserService.GetUserStats - */ - getUserStats: { - methodKind: "unary"; - input: typeof GetUserStatsRequestSchema; - output: typeof UserStatsSchema; - }, - /** - * ExportMemos writes every memo the user created, with comments, archived - * memos, and attachment files, as a Memos export file (a ZIP file, see - * docs/design/memos-export-format.md). Only the user may export their own - * memos. The body is the archive; content_type is its media type. - * - * @generated from rpc memos.api.v1.UserService.ExportMemos - */ - exportMemos: { - methodKind: "unary"; - input: typeof ExportMemosRequestSchema; - output: typeof HttpBodySchema; - }, - /** - * 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. - * - * @generated from rpc memos.api.v1.UserService.ImportMemos - */ - importMemos: { - methodKind: "unary"; - input: typeof ImportMemosRequestSchema; - output: typeof ImportMemosResponseSchema; - }, - /** - * GetUserSetting returns the user setting. - * - * @generated from rpc memos.api.v1.UserService.GetUserSetting - */ - getUserSetting: { - methodKind: "unary"; - input: typeof GetUserSettingRequestSchema; - output: typeof UserSettingSchema; - }, - /** - * UpdateUserSetting updates the user setting. - * - * @generated from rpc memos.api.v1.UserService.UpdateUserSetting - */ - updateUserSetting: { - methodKind: "unary"; - input: typeof UpdateUserSettingRequestSchema; - output: typeof UserSettingSchema; - }, - /** - * ListUserSettings returns a list of user settings. - * - * @generated from rpc memos.api.v1.UserService.ListUserSettings - */ - listUserSettings: { - methodKind: "unary"; - input: typeof ListUserSettingsRequestSchema; - output: typeof ListUserSettingsResponseSchema; - }, - /** - * ListMemoViews returns a user's memo views. Each view is a named, reusable - * CEL filter (see MemoView.filter); pass its filter string directly to the - * ListMemos `filter` argument. - * - * @generated from rpc memos.api.v1.UserService.ListMemoViews - */ - listMemoViews: { - methodKind: "unary"; - input: typeof ListMemoViewsRequestSchema; - output: typeof ListMemoViewsResponseSchema; - }, - /** - * GetMemoView gets a memo view by name. - * - * @generated from rpc memos.api.v1.UserService.GetMemoView - */ - getMemoView: { - methodKind: "unary"; - input: typeof GetMemoViewRequestSchema; - output: typeof MemoViewSchema; - }, - /** - * CreateMemoView creates a new memo view for a user. - * - * @generated from rpc memos.api.v1.UserService.CreateMemoView - */ - createMemoView: { - methodKind: "unary"; - input: typeof CreateMemoViewRequestSchema; - output: typeof MemoViewSchema; - }, - /** - * UpdateMemoView updates a memo view for a user. - * - * @generated from rpc memos.api.v1.UserService.UpdateMemoView - */ - updateMemoView: { - methodKind: "unary"; - input: typeof UpdateMemoViewRequestSchema; - output: typeof MemoViewSchema; - }, - /** - * DeleteMemoView deletes a memo view for a user. - * - * @generated from rpc memos.api.v1.UserService.DeleteMemoView - */ - deleteMemoView: { - methodKind: "unary"; - input: typeof DeleteMemoViewRequestSchema; - output: typeof EmptySchema; - }, - /** - * ListLinkedIdentities returns a list of linked SSO identities for a user. - * - * @generated from rpc memos.api.v1.UserService.ListLinkedIdentities - */ - listLinkedIdentities: { - methodKind: "unary"; - input: typeof ListLinkedIdentitiesRequestSchema; - output: typeof ListLinkedIdentitiesResponseSchema; - }, - /** - * CreateLinkedIdentity links an SSO identity to the authenticated user. - * - * @generated from rpc memos.api.v1.UserService.CreateLinkedIdentity - */ - createLinkedIdentity: { - methodKind: "unary"; - input: typeof CreateLinkedIdentityRequestSchema; - output: typeof LinkedIdentitySchema; - }, - /** - * GetLinkedIdentity gets a linked SSO identity for a user. - * - * @generated from rpc memos.api.v1.UserService.GetLinkedIdentity - */ - getLinkedIdentity: { - methodKind: "unary"; - input: typeof GetLinkedIdentityRequestSchema; - output: typeof LinkedIdentitySchema; - }, - /** - * DeleteLinkedIdentity unlinks an SSO identity from a user. - * - * @generated from rpc memos.api.v1.UserService.DeleteLinkedIdentity - */ - deleteLinkedIdentity: { - methodKind: "unary"; - input: typeof DeleteLinkedIdentityRequestSchema; - output: typeof EmptySchema; - }, - /** - * ListPersonalAccessTokens returns a list of Personal Access Tokens (PATs) for a user. - * PATs are long-lived tokens for API/script access, distinct from short-lived JWT access tokens. - * - * @generated from rpc memos.api.v1.UserService.ListPersonalAccessTokens - */ - listPersonalAccessTokens: { - methodKind: "unary"; - input: typeof ListPersonalAccessTokensRequestSchema; - output: typeof ListPersonalAccessTokensResponseSchema; - }, - /** - * CreatePersonalAccessToken creates a new Personal Access Token for a user. - * The token value is only returned once upon creation. - * - * @generated from rpc memos.api.v1.UserService.CreatePersonalAccessToken - */ - createPersonalAccessToken: { - methodKind: "unary"; - input: typeof CreatePersonalAccessTokenRequestSchema; - output: typeof CreatePersonalAccessTokenResponseSchema; - }, - /** - * DeletePersonalAccessToken deletes a Personal Access Token. - * - * @generated from rpc memos.api.v1.UserService.DeletePersonalAccessToken - */ - deletePersonalAccessToken: { - methodKind: "unary"; - input: typeof DeletePersonalAccessTokenRequestSchema; - output: typeof EmptySchema; - }, - /** - * ListUserWebhooks returns a list of webhooks for a user. - * - * @generated from rpc memos.api.v1.UserService.ListUserWebhooks - */ - listUserWebhooks: { - methodKind: "unary"; - input: typeof ListUserWebhooksRequestSchema; - output: typeof ListUserWebhooksResponseSchema; - }, - /** - * CreateUserWebhook creates a new webhook for a user. - * - * @generated from rpc memos.api.v1.UserService.CreateUserWebhook - */ - createUserWebhook: { - methodKind: "unary"; - input: typeof CreateUserWebhookRequestSchema; - output: typeof UserWebhookSchema; - }, - /** - * UpdateUserWebhook updates an existing webhook for a user. - * - * @generated from rpc memos.api.v1.UserService.UpdateUserWebhook - */ - updateUserWebhook: { - methodKind: "unary"; - input: typeof UpdateUserWebhookRequestSchema; - output: typeof UserWebhookSchema; - }, - /** - * DeleteUserWebhook deletes a webhook for a user. - * - * @generated from rpc memos.api.v1.UserService.DeleteUserWebhook - */ - deleteUserWebhook: { - methodKind: "unary"; - input: typeof DeleteUserWebhookRequestSchema; - output: typeof EmptySchema; - }, - /** - * GetUserWebhookSigningSecret returns the signing secret for a webhook. - * The secret is returned only through this explicit, owner-gated call; it is - * never included in List/Create/Update responses. - * - * @generated from rpc memos.api.v1.UserService.GetUserWebhookSigningSecret - */ - getUserWebhookSigningSecret: { - methodKind: "unary"; - input: typeof GetUserWebhookSigningSecretRequestSchema; - output: typeof GetUserWebhookSigningSecretResponseSchema; - }, - /** - * ListUserNotifications lists notifications for a user. - * - * @generated from rpc memos.api.v1.UserService.ListUserNotifications - */ - listUserNotifications: { - methodKind: "unary"; - input: typeof ListUserNotificationsRequestSchema; - output: typeof ListUserNotificationsResponseSchema; - }, - /** - * UpdateUserNotification updates a notification. - * - * @generated from rpc memos.api.v1.UserService.UpdateUserNotification - */ - updateUserNotification: { - methodKind: "unary"; - input: typeof UpdateUserNotificationRequestSchema; - output: typeof UserNotificationSchema; - }, - /** - * DeleteUserNotification deletes a notification. - * - * @generated from rpc memos.api.v1.UserService.DeleteUserNotification - */ - deleteUserNotification: { - methodKind: "unary"; - input: typeof DeleteUserNotificationRequestSchema; - output: typeof EmptySchema; - }, -}> = /*@__PURE__*/ - serviceDesc(file_api_v1_user_service, 0); - diff --git a/web/src/utils/attachment.ts b/web/src/utils/attachment.ts index eac7c453d..b85542d0c 100644 --- a/web/src/utils/attachment.ts +++ b/web/src/utils/attachment.ts @@ -1,4 +1,4 @@ -import { Attachment, MotionMediaFamily, MotionMediaRole } from "@/types/proto/api/v1/attachment_service_pb"; +import { Attachment, MotionMediaFamily, MotionMediaRole } from "@/types/proto/api/attachment_service_pb"; export const getAttachmentUrl = (attachment: Attachment) => { if (attachment.externalLink) { diff --git a/web/src/utils/managed-attachment.ts b/web/src/utils/managed-attachment.ts index 195e9a094..c9e4b465e 100644 --- a/web/src/utils/managed-attachment.ts +++ b/web/src/utils/managed-attachment.ts @@ -4,7 +4,7 @@ import { gfmFromMarkdown } from "mdast-util-gfm"; import { gfm } from "micromark-extension-gfm"; import { normalizeIdentifier } from "micromark-util-normalize-identifier"; import { visit } from "unist-util-visit"; -import type { Attachment } from "@/types/proto/api/v1/attachment_service_pb"; +import type { Attachment } from "@/types/proto/api/attachment_service_pb"; import { getAttachmentMotionGroupId, getAttachmentUrl, isImage } from "@/utils/attachment"; const ATTACHMENT_NAME_PREFIX = "attachments/"; diff --git a/web/src/utils/media-item.ts b/web/src/utils/media-item.ts index 6636c57df..49f26275e 100644 --- a/web/src/utils/media-item.ts +++ b/web/src/utils/media-item.ts @@ -1,4 +1,4 @@ -import type { Attachment } from "@/types/proto/api/v1/attachment_service_pb"; +import type { Attachment } from "@/types/proto/api/attachment_service_pb"; import { getAttachmentMotionClipUrl, getAttachmentMotionGroupId, diff --git a/web/src/utils/media-metadata.ts b/web/src/utils/media-metadata.ts index 6c3d537ae..3fe7e5977 100644 --- a/web/src/utils/media-metadata.ts +++ b/web/src/utils/media-metadata.ts @@ -1,5 +1,5 @@ import { timestampDate } from "@bufbuild/protobuf/wkt"; -import type { Attachment } from "@/types/proto/api/v1/attachment_service_pb"; +import type { Attachment } from "@/types/proto/api/attachment_service_pb"; import { formatFileSize, getFileTypeLabel } from "./format"; export interface MediaLocationDisplay { diff --git a/web/src/utils/memo.ts b/web/src/utils/memo.ts index 375890f24..b7c6d0ee4 100644 --- a/web/src/utils/memo.ts +++ b/web/src/utils/memo.ts @@ -1,5 +1,5 @@ import { Globe2Icon, LockIcon, type LucideIcon, UserLockIcon, UsersIcon } from "lucide-react"; -import { Visibility } from "@/types/proto/api/v1/memo_service_pb"; +import { Visibility } from "@/types/proto/api/memo_service_pb"; export interface VisibilityOption { value: Visibility; diff --git a/web/src/utils/user.ts b/web/src/utils/user.ts index d989d4a57..eade5bb9d 100644 --- a/web/src/utils/user.ts +++ b/web/src/utils/user.ts @@ -1,4 +1,4 @@ -import { User, User_Role } from "@/types/proto/api/v1/user_service_pb"; +import { User, User_Role } from "@/types/proto/api/user_service_pb"; export const isSuperUser = (user: User | undefined) => { return user && user.role === User_Role.ADMIN; diff --git a/web/tests/attachment-inline-placement.test.tsx b/web/tests/attachment-inline-placement.test.tsx index 5d780a743..59a5a8ce5 100644 --- a/web/tests/attachment-inline-placement.test.tsx +++ b/web/tests/attachment-inline-placement.test.tsx @@ -2,7 +2,7 @@ import { create } from "@bufbuild/protobuf"; import { fireEvent, render, screen } from "@testing-library/react"; import { beforeAll, describe, expect, it, vi } from "vitest"; import AttachmentListEditor from "@/components/MemoMetadata/Attachment/AttachmentListEditor"; -import { AttachmentSchema } from "@/types/proto/api/v1/attachment_service_pb"; +import { AttachmentSchema } from "@/types/proto/api/attachment_service_pb"; const image = create(AttachmentSchema, { name: "attachments/photo", diff --git a/web/tests/attachment-library-source-link.test.tsx b/web/tests/attachment-library-source-link.test.tsx index 0d02f3269..bee20b624 100644 --- a/web/tests/attachment-library-source-link.test.tsx +++ b/web/tests/attachment-library-source-link.test.tsx @@ -5,8 +5,8 @@ import { describe, expect, it, vi } from "vitest"; import { AttachmentDocumentRows } from "@/components/AttachmentLibrary/AttachmentFileRows"; import AttachmentMediaGrid from "@/components/AttachmentLibrary/AttachmentMediaGrid"; import type { AttachmentLibraryMonthGroup } from "@/hooks/useAttachmentLibrary"; -import { AttachmentSchema, MediaMetadataSchema, VideoMetadataSchema } from "@/types/proto/api/v1/attachment_service_pb"; -import { UserSchema } from "@/types/proto/api/v1/user_service_pb"; +import { AttachmentSchema, MediaMetadataSchema, VideoMetadataSchema } from "@/types/proto/api/attachment_service_pb"; +import { UserSchema } from "@/types/proto/api/user_service_pb"; vi.mock("@/utils/i18n", () => ({ useTranslate: () => (key: string) => key })); diff --git a/web/tests/attachment-library-stats.test.ts b/web/tests/attachment-library-stats.test.ts index 73dcb10a3..908667afe 100644 --- a/web/tests/attachment-library-stats.test.ts +++ b/web/tests/attachment-library-stats.test.ts @@ -10,7 +10,7 @@ import { MotionMediaFamily, MotionMediaRole, MotionMediaSchema, -} from "@/types/proto/api/v1/attachment_service_pb"; +} from "@/types/proto/api/attachment_service_pb"; const clients = vi.hoisted(() => ({ listAttachments: vi.fn() })); diff --git a/web/tests/attachment-transcription-action.test.tsx b/web/tests/attachment-transcription-action.test.tsx index 7a223fb0d..96e36bf6e 100644 --- a/web/tests/attachment-transcription-action.test.tsx +++ b/web/tests/attachment-transcription-action.test.tsx @@ -2,7 +2,7 @@ import { create } from "@bufbuild/protobuf"; import { fireEvent, render, screen } from "@testing-library/react"; import { beforeAll, describe, expect, it, vi } from "vitest"; import AttachmentListEditor from "@/components/MemoMetadata/Attachment/AttachmentListEditor"; -import { AttachmentSchema } from "@/types/proto/api/v1/attachment_service_pb"; +import { AttachmentSchema } from "@/types/proto/api/attachment_service_pb"; const audio = create(AttachmentSchema, { name: "attachments/voice", filename: "voice.wav", type: "audio/wav" }); diff --git a/web/tests/attachment-urls.test.ts b/web/tests/attachment-urls.test.ts index 470f3bcf4..7c749ea7e 100644 --- a/web/tests/attachment-urls.test.ts +++ b/web/tests/attachment-urls.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "vitest"; -import type { Attachment } from "@/types/proto/api/v1/attachment_service_pb"; +import type { Attachment } from "@/types/proto/api/attachment_service_pb"; import { getAttachmentMotionClipUrl, getAttachmentThumbnailUrl, getAttachmentUrl } from "@/utils/attachment"; const origin = window.location.origin; diff --git a/web/tests/audience-menu.test.tsx b/web/tests/audience-menu.test.tsx index 8b2b026ad..d97ae975a 100644 --- a/web/tests/audience-menu.test.tsx +++ b/web/tests/audience-menu.test.tsx @@ -3,7 +3,7 @@ import { beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; import { createInitialState, EditorProvider, useEditorContext, useEditorSelector } from "@/components/MemoEditor/state"; import AudienceMenu from "@/components/MemoEditor/Toolbar/AudienceMenu"; import { EditorToolbar } from "@/components/MemoEditor/Toolbar/EditorToolbar"; -import { Visibility } from "@/types/proto/api/v1/memo_service_pb"; +import { Visibility } from "@/types/proto/api/memo_service_pb"; const spacesQuery = vi.hoisted(() => ({ data: [ diff --git a/web/tests/auth-context-initialization.test.tsx b/web/tests/auth-context-initialization.test.tsx index 9bd2458e5..1895b494c 100644 --- a/web/tests/auth-context-initialization.test.tsx +++ b/web/tests/auth-context-initialization.test.tsx @@ -55,9 +55,9 @@ describe("AuthProvider initialization", () => { }); it("resets full readiness while post-sign-in settings are pending", async () => { - let resolveSettings!: (value: { settings: [] }) => void; + let resolveSettings!: (value: { userSettings: [] }) => void; clients.getCurrentUser.mockResolvedValue({ user: { name: "users/alice", username: "alice" } }); - clients.listUserSettings.mockImplementation(() => new Promise<{ settings: [] }>((resolve) => (resolveSettings = resolve))); + clients.listUserSettings.mockImplementation(() => new Promise<{ userSettings: [] }>((resolve) => (resolveSettings = resolve))); render(, { wrapper }); @@ -72,7 +72,7 @@ describe("AuthProvider initialization", () => { expect(screen.getByTestId("initialized")).toHaveTextContent("no"); expect(screen.getByTestId("user-settings-initialized")).toHaveTextContent("no"); - resolveSettings({ settings: [] }); + resolveSettings({ userSettings: [] }); await waitFor(() => expect(screen.getByTestId("user-settings-initialized")).toHaveTextContent("yes")); expect(screen.getByTestId("initialized")).toHaveTextContent("yes"); }); diff --git a/web/tests/auth-page-layout.test.tsx b/web/tests/auth-page-layout.test.tsx index 87b4e0045..353675ace 100644 --- a/web/tests/auth-page-layout.test.tsx +++ b/web/tests/auth-page-layout.test.tsx @@ -2,7 +2,7 @@ import { render, screen } from "@testing-library/react"; import { MemoryRouter } from "react-router-dom"; import { beforeEach, describe, expect, it, vi } from "vitest"; import AuthPageLayout from "@/components/AuthPageLayout"; -import { InstanceAccessMode } from "@/types/proto/api/v1/instance_service_pb"; +import { InstanceAccessMode } from "@/types/proto/api/instance_service_pb"; const instance = vi.hoisted(() => ({ instanceUrl: "https://notes.example.com", accessMode: 1 })); diff --git a/web/tests/calendar-day-model.test.ts b/web/tests/calendar-day-model.test.ts index 68b99ff3e..bea2ef5e5 100644 --- a/web/tests/calendar-day-model.test.ts +++ b/web/tests/calendar-day-model.test.ts @@ -2,8 +2,8 @@ import { create, type MessageInitShape } from "@bufbuild/protobuf"; import { timestampFromDate } from "@bufbuild/protobuf/wkt"; import { describe, expect, it } from "vitest"; import { buildCalendarMonthModel, getMemoThumbnail } from "@/components/CalendarView/dayModel"; -import { AttachmentSchema } from "@/types/proto/api/v1/attachment_service_pb"; -import { type Memo, MemoSchema } from "@/types/proto/api/v1/memo_service_pb"; +import { AttachmentSchema } from "@/types/proto/api/attachment_service_pb"; +import { type Memo, MemoSchema } from "@/types/proto/api/memo_service_pb"; const memoAt = (hour: number, overrides: MessageInitShape = {}): Memo => create(MemoSchema, { diff --git a/web/tests/calendar-day-snapshot.test.tsx b/web/tests/calendar-day-snapshot.test.tsx index aa5236027..9c630c810 100644 --- a/web/tests/calendar-day-snapshot.test.tsx +++ b/web/tests/calendar-day-snapshot.test.tsx @@ -4,7 +4,7 @@ import { MemoryRouter } from "react-router-dom"; import { describe, expect, it, vi } from "vitest"; import { CalendarDayCell, layoutForCellSize } from "@/components/CalendarView/CalendarDayCell"; import type { CalendarDaySummary } from "@/components/CalendarView/dayModel"; -import { MemoSchema } from "@/types/proto/api/v1/memo_service_pb"; +import { MemoSchema } from "@/types/proto/api/memo_service_pb"; const users: Record = { "users/bob": { name: "users/bob", username: "bob", displayName: "Bob Martin", avatarUrl: "/bob.png" }, diff --git a/web/tests/can-manage-memo.test.ts b/web/tests/can-manage-memo.test.ts index 4ff83d153..5387eae24 100644 --- a/web/tests/can-manage-memo.test.ts +++ b/web/tests/can-manage-memo.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "vitest"; -import { User, User_Role } from "@/types/proto/api/v1/user_service_pb"; +import { User, User_Role } from "@/types/proto/api/user_service_pb"; import { canManageMemo } from "@/utils/user"; const user = (name: string, role: User_Role) => ({ name, role }) as User; diff --git a/web/tests/editor-suggestions.test.tsx b/web/tests/editor-suggestions.test.tsx index c6645bba6..0501ebe9f 100644 --- a/web/tests/editor-suggestions.test.tsx +++ b/web/tests/editor-suggestions.test.tsx @@ -6,7 +6,7 @@ import { EditorSuggestions, SuggestionsBar } from "@/components/MemoEditor/compo import { createInitialState, EditorProvider, useEditorContext } from "@/components/MemoEditor/state"; import type { EditorController } from "@/components/MemoEditor/types/editorController"; import { getMemoSuggestions, type MemoSuggestion } from "@/lib/memo-suggestions"; -import { Visibility } from "@/types/proto/api/v1/memo_service_pb"; +import { Visibility } from "@/types/proto/api/memo_service_pb"; vi.mock("@/utils/i18n", () => ({ useTranslate: () => (key: string) => key })); vi.mock("@/hooks/useUserQueries", () => ({ useTagCounts: () => ({ data: {} }) })); diff --git a/web/tests/error-info.test.ts b/web/tests/error-info.test.ts index 2e45c50db..7da065ccd 100644 --- a/web/tests/error-info.test.ts +++ b/web/tests/error-info.test.ts @@ -22,7 +22,7 @@ function rateLimitError(retryAfterSeconds: string): ConnectError { error.details.push( { type: "google.rpc.ErrorInfo", - value: encodeErrorInfo(ERROR_REASON_RATE_LIMITED, "memos.api.v1", { + value: encodeErrorInfo(ERROR_REASON_RATE_LIMITED, "memos.api", { scope: "signin_ip", retry_after_seconds: retryAfterSeconds, }), @@ -37,7 +37,7 @@ describe("ErrorInfo decoding", () => { const info = getErrorInfo(rateLimitError("42")); expect(info).toEqual({ reason: ERROR_REASON_RATE_LIMITED, - domain: "memos.api.v1", + domain: "memos.api", metadata: { scope: "signin_ip", retry_after_seconds: "42" }, }); expect(hasErrorReason(rateLimitError("42"), ERROR_REASON_RATE_LIMITED)).toBe(true); diff --git a/web/tests/filtered-memo-stats.test.ts b/web/tests/filtered-memo-stats.test.ts index 1949c8a61..9c8808d57 100644 --- a/web/tests/filtered-memo-stats.test.ts +++ b/web/tests/filtered-memo-stats.test.ts @@ -25,7 +25,7 @@ vi.mock("@/contexts/ViewContext", async () => { import { useFilteredMemoStats } from "@/hooks/useFilteredMemoStats"; import { useAllUserStats, useUserStats } from "@/hooks/useUserQueries"; -import { State } from "@/types/proto/api/v1/common_pb"; +import { State } from "@/types/proto/api/common_pb"; const wrapper = ({ children }: { children: ReactNode }) => children as never; @@ -44,7 +44,7 @@ describe("useFilteredMemoStats", () => { data: { memoCreatedTimestamps: [ts(2026, 5, 1), ts(2026, 5, 1), ts(2026, 5, 2)], memoUpdatedTimestamps: [ts(2026, 5, 3), ts(2026, 5, 3), ts(2026, 5, 3)], - tagCount: {}, + tagCounts: {}, }, isLoading: false, } as unknown as ReturnType); @@ -89,7 +89,7 @@ describe("useFilteredMemoStats", () => { data: { memoCreatedTimestamps: [ts(2026, 5, 1)], memoUpdatedTimestamps: [], - tagCount: {}, + tagCounts: {}, }, isLoading: false, } as unknown as ReturnType); diff --git a/web/tests/hoist-new-memo.test.ts b/web/tests/hoist-new-memo.test.ts index 19df814b1..ff209f17d 100644 --- a/web/tests/hoist-new-memo.test.ts +++ b/web/tests/hoist-new-memo.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from "vitest"; import { hoistMemoToFront } from "@/hooks/useMemoSorting"; -import type { Memo } from "@/types/proto/api/v1/memo_service_pb"; +import type { Memo } from "@/types/proto/api/memo_service_pb"; const memo = (name: string) => ({ name }) as Memo; diff --git a/web/tests/inline-image-upload-files.test.ts b/web/tests/inline-image-upload-files.test.ts index 3eaf7ba33..904dc39a5 100644 --- a/web/tests/inline-image-upload-files.test.ts +++ b/web/tests/inline-image-upload-files.test.ts @@ -2,7 +2,7 @@ import { describe, expect, it } from "vitest"; import { pairAppleLivePhotoFiles } from "@/components/MemoEditor/hooks"; import { splitInlineLocalFiles } from "@/components/MemoEditor/hooks/useInlineImageUpload"; import type { LocalFile } from "@/components/MemoEditor/types/attachment"; -import { MotionMediaRole } from "@/types/proto/api/v1/attachment_service_pb"; +import { MotionMediaRole } from "@/types/proto/api/attachment_service_pb"; const localFile = (name: string, type: string): LocalFile => ({ file: new File([name], name, { type }), diff --git a/web/tests/instance-access-query.test.tsx b/web/tests/instance-access-query.test.tsx index 4162ee9ab..b96965e56 100644 --- a/web/tests/instance-access-query.test.tsx +++ b/web/tests/instance-access-query.test.tsx @@ -11,7 +11,7 @@ import { InstanceSetting_AccessSettingSchema, InstanceSetting_Key, InstanceSettingSchema, -} from "@/types/proto/api/v1/instance_service_pb"; +} from "@/types/proto/api/instance_service_pb"; const clients = vi.hoisted(() => ({ batchGetInstanceSettings: vi.fn(), @@ -64,7 +64,7 @@ const InstanceProbe = () => { describe("instance ACCESS React Query integration", () => { beforeEach(() => { - clients.batchGetInstanceSettings.mockReset().mockResolvedValue({ settings: [] }); + clients.batchGetInstanceSettings.mockReset().mockResolvedValue({ instanceSettings: [] }); clients.getInstanceProfile.mockReset().mockResolvedValue(create(InstanceProfileSchema, { accessMode: InstanceAccessMode.PRIVATE })); clients.getInstanceSetting.mockReset().mockResolvedValue(buildAccessSetting(InstanceAccessMode.PRIVATE)); clients.updateInstanceSetting.mockReset().mockResolvedValue(buildAccessSetting(InstanceAccessMode.PUBLIC)); diff --git a/web/tests/instance-section-access.test.tsx b/web/tests/instance-section-access.test.tsx index 73653a009..72968a58f 100644 --- a/web/tests/instance-section-access.test.tsx +++ b/web/tests/instance-section-access.test.tsx @@ -1,7 +1,7 @@ import { fireEvent, render, screen, waitFor } from "@testing-library/react"; import { beforeEach, describe, expect, it, vi } from "vitest"; import InstanceSection from "@/components/Settings/InstanceSection"; -import { InstanceAccessMode } from "@/types/proto/api/v1/instance_service_pb"; +import { InstanceAccessMode } from "@/types/proto/api/instance_service_pb"; const instance = vi.hoisted(() => ({ accessSetting: { accessMode: 1 }, diff --git a/web/tests/invite-space-member-dialog.test.tsx b/web/tests/invite-space-member-dialog.test.tsx index 192c89a11..85cf1e7d9 100644 --- a/web/tests/invite-space-member-dialog.test.tsx +++ b/web/tests/invite-space-member-dialog.test.tsx @@ -2,9 +2,9 @@ import { act, fireEvent, render, screen } from "@testing-library/react"; import type { ReactNode } from "react"; import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; import InviteSpaceMemberDialog from "@/components/Settings/InviteSpaceMemberDialog"; -import { State } from "@/types/proto/api/v1/common_pb"; -import { type Space, SpaceMember_Role } from "@/types/proto/api/v1/space_service_pb"; -import type { User } from "@/types/proto/api/v1/user_service_pb"; +import { State } from "@/types/proto/api/common_pb"; +import { type Space, SpaceMember_Role } from "@/types/proto/api/space_service_pb"; +import type { User } from "@/types/proto/api/user_service_pb"; const state = vi.hoisted(() => ({ candidate: undefined as User | undefined, @@ -73,7 +73,7 @@ vi.mock("@/utils/i18n", () => ({ })); const productSpace: Space = { - $typeName: "memos.api.v1.Space", + $typeName: "memos.api.Space", name: "spaces/product", title: "Product", description: "Product decisions", @@ -82,7 +82,7 @@ const productSpace: Space = { }; const alice: User = { - $typeName: "memos.api.v1.User", + $typeName: "memos.api.User", name: "users/alice", username: "alice", displayName: "Alice", diff --git a/web/tests/location-display-view.test.tsx b/web/tests/location-display-view.test.tsx index 816c94c3e..4c913e6e3 100644 --- a/web/tests/location-display-view.test.tsx +++ b/web/tests/location-display-view.test.tsx @@ -1,7 +1,7 @@ import { fireEvent, render, screen } from "@testing-library/react"; import { describe, expect, it, vi } from "vitest"; import LocationDisplayView from "@/components/MemoMetadata/Location/LocationDisplayView"; -import type { Location } from "@/types/proto/api/v1/memo_service_pb"; +import type { Location } from "@/types/proto/api/memo_service_pb"; vi.mock("@/components/map/LazyLocationPicker", () => ({ LazyLocationPicker: () =>
, diff --git a/web/tests/managed-attachment.test.ts b/web/tests/managed-attachment.test.ts index baba9beb1..94420c50b 100644 --- a/web/tests/managed-attachment.test.ts +++ b/web/tests/managed-attachment.test.ts @@ -1,6 +1,6 @@ import { create } from "@bufbuild/protobuf"; import { afterEach, describe, expect, it } from "vitest"; -import { AttachmentSchema, MotionMediaFamily, MotionMediaRole, MotionMediaSchema } from "@/types/proto/api/v1/attachment_service_pb"; +import { AttachmentSchema, MotionMediaFamily, MotionMediaRole, MotionMediaSchema } from "@/types/proto/api/attachment_service_pb"; import { buildManagedAttachmentMarkdown, extractManagedAttachmentUIDs, diff --git a/web/tests/map-canvas.test.tsx b/web/tests/map-canvas.test.tsx index 9cc7b80a3..749ea92a7 100644 --- a/web/tests/map-canvas.test.tsx +++ b/web/tests/map-canvas.test.tsx @@ -3,7 +3,7 @@ import { render } from "@testing-library/react"; import type { ComponentProps, ReactNode } from "react"; import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; import { MapCanvas } from "@/components/MapView/MapCanvas"; -import { MemoSchema } from "@/types/proto/api/v1/memo_service_pb"; +import { MemoSchema } from "@/types/proto/api/memo_service_pb"; const markers = vi.hoisted(() => [] as { icon: { options: { html?: string } }; title: string; alt: string }[]); const map = vi.hoisted(() => ({ diff --git a/web/tests/map-memos.test.tsx b/web/tests/map-memos.test.tsx index e5206c098..226dedf00 100644 --- a/web/tests/map-memos.test.tsx +++ b/web/tests/map-memos.test.tsx @@ -6,7 +6,7 @@ import type { ReactNode } from "react"; import { beforeEach, describe, expect, it, vi } from "vitest"; import { useMapMemos } from "@/components/MapView/useMapMemos"; import { memoDetailQueryOptions, useDeleteMemo, useUpdateMemo } from "@/hooks/useMemoQueries"; -import { MemoSchema } from "@/types/proto/api/v1/memo_service_pb"; +import { MemoSchema } from "@/types/proto/api/memo_service_pb"; const state = vi.hoisted(() => ({ list: vi.fn(), update: vi.fn(), delete: vi.fn(), get: vi.fn(), filter: "", settingsReady: true })); vi.mock("@/connect", () => ({ diff --git a/web/tests/map-model.test.ts b/web/tests/map-model.test.ts index 92712eead..71b4d3e06 100644 --- a/web/tests/map-model.test.ts +++ b/web/tests/map-model.test.ts @@ -10,7 +10,7 @@ import { splitLabel, validLocation, } from "@/components/MapView/model"; -import { LocationSchema, MemoSchema } from "@/types/proto/api/v1/memo_service_pb"; +import { LocationSchema, MemoSchema } from "@/types/proto/api/memo_service_pb"; const memo = (name: string, latitude = 0, longitude = 0) => create(MemoSchema, { name, location: { latitude, longitude } }); diff --git a/web/tests/map-view.test.tsx b/web/tests/map-view.test.tsx index a2df232ac..118590fa7 100644 --- a/web/tests/map-view.test.tsx +++ b/web/tests/map-view.test.tsx @@ -5,7 +5,7 @@ import { MemoryRouter } from "react-router-dom"; import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; import { MapView } from "@/components/MapView/MapView"; import type { MemoEditorProps } from "@/components/MemoEditor/types"; -import { type Memo, MemoSchema } from "@/types/proto/api/v1/memo_service_pb"; +import { type Memo, MemoSchema } from "@/types/proto/api/memo_service_pb"; const mocks = vi.hoisted(() => ({ editor: {} as MemoEditorProps, diff --git a/web/tests/media-item-preview-metadata.test.ts b/web/tests/media-item-preview-metadata.test.ts index a6e37c761..08cf5b0e3 100644 --- a/web/tests/media-item-preview-metadata.test.ts +++ b/web/tests/media-item-preview-metadata.test.ts @@ -1,6 +1,6 @@ import { create } from "@bufbuild/protobuf"; import { describe, expect, it } from "vitest"; -import { AttachmentSchema, MediaMetadataSchema } from "@/types/proto/api/v1/attachment_service_pb"; +import { AttachmentSchema, MediaMetadataSchema } from "@/types/proto/api/attachment_service_pb"; import { buildAttachmentVisualItems } from "@/utils/media-item"; describe("media preview metadata plumbing", () => { diff --git a/web/tests/media-metadata-display.test.ts b/web/tests/media-metadata-display.test.ts index 2ee5178b9..52ab4e636 100644 --- a/web/tests/media-metadata-display.test.ts +++ b/web/tests/media-metadata-display.test.ts @@ -1,6 +1,6 @@ import { create } from "@bufbuild/protobuf"; import { describe, expect, it } from "vitest"; -import { AttachmentSchema, MediaMetadataSchema, VideoMetadataSchema } from "@/types/proto/api/v1/attachment_service_pb"; +import { AttachmentSchema, MediaMetadataSchema, VideoMetadataSchema } from "@/types/proto/api/attachment_service_pb"; import { buildMediaMetadataDisplay, formatExposureTime, formatMediaDuration } from "@/utils/media-metadata"; describe("media metadata display formatting", () => { diff --git a/web/tests/memo-access-transitions.test.tsx b/web/tests/memo-access-transitions.test.tsx index 2cb5fea7d..07b8cad2f 100644 --- a/web/tests/memo-access-transitions.test.tsx +++ b/web/tests/memo-access-transitions.test.tsx @@ -6,7 +6,7 @@ import type { ReactNode } from "react"; import { beforeEach, describe, expect, it, vi } from "vitest"; import { useResolvedRelationMemos } from "@/components/MemoMetadata/Relation/useResolvedRelationMemos"; import { findMemoInCollectionQueries, memoKeys, useMemo, useUpdateMemo } from "@/hooks/useMemoQueries"; -import { ListMemosResponseSchema, MemoRelation_Type, MemoRelationSchema, MemoSchema } from "@/types/proto/api/v1/memo_service_pb"; +import { ListMemosResponseSchema, MemoRelation_Type, MemoRelationSchema, MemoSchema } from "@/types/proto/api/memo_service_pb"; const api = vi.hoisted(() => ({ getMemo: vi.fn(), updateMemo: vi.fn() })); vi.mock("@/connect", () => ({ memoServiceClient: api })); diff --git a/web/tests/memo-action-menu.test.tsx b/web/tests/memo-action-menu.test.tsx index fb10ec321..1d1af67a0 100644 --- a/web/tests/memo-action-menu.test.tsx +++ b/web/tests/memo-action-menu.test.tsx @@ -3,8 +3,8 @@ import { fireEvent, render, screen, waitFor } from "@testing-library/react"; import { MemoryRouter, useLocation } from "react-router-dom"; import { beforeEach, describe, expect, it, vi } from "vitest"; import MemoActionMenu from "@/components/MemoActionMenu"; -import { State } from "@/types/proto/api/v1/common_pb"; -import { type Memo, MemoSchema } from "@/types/proto/api/v1/memo_service_pb"; +import { State } from "@/types/proto/api/common_pb"; +import { type Memo, MemoSchema } from "@/types/proto/api/memo_service_pb"; const handlers = vi.hoisted(() => ({ isInMemoDetailPage: false, diff --git a/web/tests/memo-action-navigation.test.tsx b/web/tests/memo-action-navigation.test.tsx index db3fe513b..fa13daa85 100644 --- a/web/tests/memo-action-navigation.test.tsx +++ b/web/tests/memo-action-navigation.test.tsx @@ -4,8 +4,8 @@ import type { ReactNode } from "react"; import { MemoryRouter, useLocation } from "react-router-dom"; import { beforeEach, describe, expect, it, vi } from "vitest"; import { useMemoActionHandlers } from "@/components/MemoActionMenu/hooks"; -import { State } from "@/types/proto/api/v1/common_pb"; -import type { Memo } from "@/types/proto/api/v1/memo_service_pb"; +import { State } from "@/types/proto/api/common_pb"; +import type { Memo } from "@/types/proto/api/memo_service_pb"; const mocks = vi.hoisted(() => ({ updateMemo: vi.fn(), diff --git a/web/tests/memo-card-height.test.ts b/web/tests/memo-card-height.test.ts index 11a813edc..2d4352e03 100644 --- a/web/tests/memo-card-height.test.ts +++ b/web/tests/memo-card-height.test.ts @@ -1,8 +1,8 @@ import { create, type MessageInitShape } from "@bufbuild/protobuf"; import { describe, expect, it } from "vitest"; import { estimateMemoCardHeight } from "@/components/PagedMemoList/memoCardHeight"; -import { AttachmentSchema } from "@/types/proto/api/v1/attachment_service_pb"; -import { MemoRelation_MemoSchema, MemoRelation_Type, MemoRelationSchema, MemoSchema } from "@/types/proto/api/v1/memo_service_pb"; +import { AttachmentSchema } from "@/types/proto/api/attachment_service_pb"; +import { MemoRelation_MemoRefSchema, MemoRelation_Type, MemoRelationSchema, MemoSchema } from "@/types/proto/api/memo_service_pb"; const buildAttachment = (overrides: MessageInitShape) => create(AttachmentSchema, { @@ -15,8 +15,8 @@ const buildAttachment = (overrides: MessageInitShape) = const buildCommentRelation = (memoName: string, index: number) => create(MemoRelationSchema, { type: MemoRelation_Type.COMMENT, - memo: create(MemoRelation_MemoSchema, { name: `memos/comment-${index}` }), - relatedMemo: create(MemoRelation_MemoSchema, { name: memoName }), + memo: create(MemoRelation_MemoRefSchema, { name: `memos/comment-${index}` }), + relatedMemo: create(MemoRelation_MemoRefSchema, { name: memoName }), }); const buildMemo = (overrides: MessageInitShape = {}) => diff --git a/web/tests/memo-comment-section.test.tsx b/web/tests/memo-comment-section.test.tsx index b34a6fc8d..be5fcda93 100644 --- a/web/tests/memo-comment-section.test.tsx +++ b/web/tests/memo-comment-section.test.tsx @@ -4,8 +4,8 @@ import { act, createRef } from "react"; import { beforeEach, describe, expect, it, vi } from "vitest"; import MemoCommentSection, { type MemoCommentSectionHandle } from "@/components/MemoCommentSection"; import type { MemoEditorProps } from "@/components/MemoEditor/types"; -import { State } from "@/types/proto/api/v1/common_pb"; -import { MemoSchema } from "@/types/proto/api/v1/memo_service_pb"; +import { State } from "@/types/proto/api/common_pb"; +import { MemoSchema } from "@/types/proto/api/memo_service_pb"; const mocks = vi.hoisted(() => ({ currentUser: { name: "users/alice" } as { name: string } | undefined, diff --git a/web/tests/memo-comments-pagination.test.tsx b/web/tests/memo-comments-pagination.test.tsx index 657207a69..d95ccf93e 100644 --- a/web/tests/memo-comments-pagination.test.tsx +++ b/web/tests/memo-comments-pagination.test.tsx @@ -25,18 +25,18 @@ describe("useInfiniteMemoComments", () => { it("follows nextPageToken and flattens every fetched comment page", async () => { listMemoComments .mockResolvedValueOnce({ - memos: [{ name: "memos/comment-1" }, { name: "memos/comment-2" }], + comments: [{ name: "memos/comment-1" }, { name: "memos/comment-2" }], nextPageToken: "page-2", }) .mockResolvedValueOnce({ - memos: [{ name: "memos/comment-3" }], + comments: [{ name: "memos/comment-3" }], nextPageToken: "", }); const { result } = renderHook(() => useInfiniteMemoComments("memos/parent", { pageSize: 2 }), { wrapper }); await waitFor(() => expect(result.current.data?.map((memo) => memo.name)).toEqual(["memos/comment-1", "memos/comment-2"])); - expect(listMemoComments).toHaveBeenNthCalledWith(1, expect.objectContaining({ name: "memos/parent", pageSize: 2, pageToken: "" })); + expect(listMemoComments).toHaveBeenNthCalledWith(1, expect.objectContaining({ parent: "memos/parent", pageSize: 2, pageToken: "" })); expect(result.current.hasNextPage).toBe(true); await act(async () => { @@ -48,7 +48,7 @@ describe("useInfiniteMemoComments", () => { ); expect(listMemoComments).toHaveBeenNthCalledWith( 2, - expect.objectContaining({ name: "memos/parent", pageSize: 2, pageToken: "page-2" }), + expect.objectContaining({ parent: "memos/parent", pageSize: 2, pageToken: "page-2" }), ); expect(result.current.hasNextPage).toBe(false); }); diff --git a/web/tests/memo-detail-access.test.tsx b/web/tests/memo-detail-access.test.tsx index 37e552a4e..9ffb80c4d 100644 --- a/web/tests/memo-detail-access.test.tsx +++ b/web/tests/memo-detail-access.test.tsx @@ -7,7 +7,7 @@ import { MemoryRouter, Route, Routes } from "react-router-dom"; import { beforeEach, describe, expect, it, vi } from "vitest"; import { memoKeys } from "@/hooks/useMemoQueries"; import MemoDetail from "@/pages/MemoDetail"; -import { type Memo, MemoSchema } from "@/types/proto/api/v1/memo_service_pb"; +import { type Memo, MemoSchema } from "@/types/proto/api/memo_service_pb"; const state = vi.hoisted(() => ({ currentUser: undefined as { name: string } | undefined, @@ -47,7 +47,7 @@ describe("memo detail access recovery", () => { beforeEach(() => { vi.clearAllMocks(); state.currentUser = undefined; - state.listMemoComments.mockResolvedValue({ memos: [], nextPageToken: "" }); + state.listMemoComments.mockResolvedValue({ comments: [], nextPageToken: "" }); }); it.each(["fresh", "stale"])("revalidates a %s cached denial before showing a restored memo", async (freshness) => { diff --git a/web/tests/memo-detail-sidebar.test.tsx b/web/tests/memo-detail-sidebar.test.tsx index 73c905ee8..5fabc54a6 100644 --- a/web/tests/memo-detail-sidebar.test.tsx +++ b/web/tests/memo-detail-sidebar.test.tsx @@ -3,16 +3,16 @@ import { fireEvent, render, screen } from "@testing-library/react"; import { MemoryRouter } from "react-router-dom"; import { beforeEach, describe, expect, it, vi } from "vitest"; import MemoDetailSidebar from "@/components/MemoDetailSidebar/MemoDetailSidebar"; -import { AttachmentSchema } from "@/types/proto/api/v1/attachment_service_pb"; -import { State } from "@/types/proto/api/v1/common_pb"; +import { AttachmentSchema } from "@/types/proto/api/attachment_service_pb"; +import { State } from "@/types/proto/api/common_pb"; import { LocationSchema, - MemoRelation_MemoSchema, + MemoRelation_MemoRefSchema, MemoRelation_Type, MemoRelationSchema, MemoSchema, Visibility, -} from "@/types/proto/api/v1/memo_service_pb"; +} from "@/types/proto/api/memo_service_pb"; const copyToClipboard = vi.hoisted(() => vi.fn()); const currentUserState = vi.hoisted(() => ({ value: { name: "users/alice" } as { name: string } | undefined })); @@ -36,8 +36,8 @@ const renderSidebar = (sidebar: React.ReactNode, route = "/memos/detail") => const createIncomingReference = (memoName: string, sourceName = "memos/incoming", snippet = "Incoming backlink") => create(MemoRelationSchema, { type: MemoRelation_Type.REFERENCE, - memo: create(MemoRelation_MemoSchema, { name: sourceName, snippet }), - relatedMemo: create(MemoRelation_MemoSchema, { name: memoName }), + memo: create(MemoRelation_MemoRefSchema, { name: sourceName, snippet }), + relatedMemo: create(MemoRelation_MemoRefSchema, { name: memoName }), }); describe("MemoDetailSidebar", () => { @@ -73,8 +73,8 @@ describe("MemoDetailSidebar", () => { relations: [ create(MemoRelationSchema, { type: MemoRelation_Type.REFERENCE, - memo: create(MemoRelation_MemoSchema, { name: "memos/detail" }), - relatedMemo: create(MemoRelation_MemoSchema, { name: "memos/outgoing", snippet: "Outgoing reference" }), + memo: create(MemoRelation_MemoRefSchema, { name: "memos/detail" }), + relatedMemo: create(MemoRelation_MemoRefSchema, { name: "memos/outgoing", snippet: "Outgoing reference" }), }), createIncomingReference("memos/detail"), ], diff --git a/web/tests/memo-editor-cache.test.ts b/web/tests/memo-editor-cache.test.ts index 06cd2dd83..e4193e8b0 100644 --- a/web/tests/memo-editor-cache.test.ts +++ b/web/tests/memo-editor-cache.test.ts @@ -1,9 +1,9 @@ import { create } from "@bufbuild/protobuf"; import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; import { cacheService } from "@/components/MemoEditor/services/cacheService"; -import { AttachmentSchema, MotionMediaFamily, MotionMediaRole, MotionMediaSchema } from "@/types/proto/api/v1/attachment_service_pb"; +import { AttachmentSchema, MotionMediaFamily, MotionMediaRole, MotionMediaSchema } from "@/types/proto/api/attachment_service_pb"; -import { LocationSchema, Visibility } from "@/types/proto/api/v1/memo_service_pb"; +import { LocationSchema, Visibility } from "@/types/proto/api/memo_service_pb"; describe("memo editor cache", () => { beforeEach(() => { diff --git a/web/tests/memo-editor-relations.test.ts b/web/tests/memo-editor-relations.test.ts index 0fefc6576..51ee3ceb9 100644 --- a/web/tests/memo-editor-relations.test.ts +++ b/web/tests/memo-editor-relations.test.ts @@ -4,11 +4,11 @@ import { memoService } from "@/components/MemoEditor/services/memoService"; import { createInitialState, type EditorState } from "@/components/MemoEditor/state"; import { type Memo, - MemoRelation_MemoSchema, + MemoRelation_MemoRefSchema, MemoRelation_Type, MemoRelationSchema, MemoSchema, -} from "@/types/proto/api/v1/memo_service_pb"; +} from "@/types/proto/api/memo_service_pb"; const clients = vi.hoisted(() => ({ createMemo: vi.fn(), @@ -32,14 +32,14 @@ vi.mock("@/connect", () => ({ const createRelation = (type: MemoRelation_Type, memoName: string, relatedMemoName: string) => create(MemoRelationSchema, { type, - memo: create(MemoRelation_MemoSchema, { name: memoName }), - relatedMemo: create(MemoRelation_MemoSchema, { name: relatedMemoName }), + memo: create(MemoRelation_MemoRefSchema, { name: memoName }), + relatedMemo: create(MemoRelation_MemoRefSchema, { name: relatedMemoName }), }); const createReference = (relatedMemoName: string) => create(MemoRelationSchema, { type: MemoRelation_Type.REFERENCE, - relatedMemo: create(MemoRelation_MemoSchema, { name: relatedMemoName }), + relatedMemo: create(MemoRelation_MemoRefSchema, { name: relatedMemoName }), }); const createEditorState = (memo: Memo): EditorState => ({ @@ -88,7 +88,7 @@ describe("memo editor relation updates", () => { expect(clients.createMemoComment).toHaveBeenCalledOnce(); const request = clients.createMemoComment.mock.calls[0][0]; - expect(request.name).toBe("memos/parent"); + expect(request.parent).toBe("memos/parent"); expect(request.comment.content).toBe("Reply"); expect(request.comment.space).toBeUndefined(); }); diff --git a/web/tests/memo-editor-space-move.test.ts b/web/tests/memo-editor-space-move.test.ts index dcd47585f..260cfcc36 100644 --- a/web/tests/memo-editor-space-move.test.ts +++ b/web/tests/memo-editor-space-move.test.ts @@ -2,7 +2,7 @@ import { create } from "@bufbuild/protobuf"; import { beforeEach, describe, expect, it, vi } from "vitest"; import { memoService } from "@/components/MemoEditor/services/memoService"; import { createInitialState, type EditorState } from "@/components/MemoEditor/state"; -import { type Memo, MemoSchema, Visibility } from "@/types/proto/api/v1/memo_service_pb"; +import { type Memo, MemoSchema, Visibility } from "@/types/proto/api/memo_service_pb"; const clients = vi.hoisted(() => ({ getMemo: vi.fn(), diff --git a/web/tests/memo-editor-timestamps.test.tsx b/web/tests/memo-editor-timestamps.test.tsx index 6504cf1d7..1f3b6620b 100644 --- a/web/tests/memo-editor-timestamps.test.tsx +++ b/web/tests/memo-editor-timestamps.test.tsx @@ -5,7 +5,7 @@ import { beforeEach, describe, expect, it, vi } from "vitest"; import { TimestampPopover } from "@/components/MemoEditor/components/TimestampPopover"; import { memoService } from "@/components/MemoEditor/services/memoService"; import { createInitialState, EditorProvider, useEditorContext } from "@/components/MemoEditor/state"; -import { type Memo, MemoSchema } from "@/types/proto/api/v1/memo_service_pb"; +import { type Memo, MemoSchema } from "@/types/proto/api/memo_service_pb"; const clients = vi.hoisted(() => ({ getMemo: vi.fn(), updateMemo: vi.fn() })); vi.mock("@/connect", () => ({ diff --git a/web/tests/memo-editor-transcription.test.tsx b/web/tests/memo-editor-transcription.test.tsx index 5bca2592b..376e94579 100644 --- a/web/tests/memo-editor-transcription.test.tsx +++ b/web/tests/memo-editor-transcription.test.tsx @@ -4,8 +4,8 @@ import { act, fireEvent, render, screen, waitFor } from "@testing-library/react" import { describe, expect, it, vi } from "vitest"; import MemoEditor from "@/components/MemoEditor"; import { transcriptionService } from "@/components/MemoEditor/services"; -import { AttachmentSchema } from "@/types/proto/api/v1/attachment_service_pb"; -import { MemoSchema, Visibility } from "@/types/proto/api/v1/memo_service_pb"; +import { AttachmentSchema } from "@/types/proto/api/attachment_service_pb"; +import { MemoSchema, Visibility } from "@/types/proto/api/memo_service_pb"; vi.mock("@/hooks/useUserQueries", () => ({ useTagCounts: () => ({ data: {} }) })); vi.mock("@/hooks/useCurrentUser", () => ({ default: () => ({ name: "users/1" }) })); diff --git a/web/tests/memo-export.test.ts b/web/tests/memo-export.test.ts index a243bc42c..e44fb7087 100644 --- a/web/tests/memo-export.test.ts +++ b/web/tests/memo-export.test.ts @@ -46,7 +46,7 @@ describe("memo export files", () => { ])("uploads %s as %s without filtering by the filename or MIME type", async (fixture, name, type) => { const bytes = readFileSync(resolve(import.meta.dirname, "../../core/memoexport/testdata/1.0", fixture)); const file = new File([bytes], name, { type }); - const plan = { memos: 3 }; + const plan = { memoCount: 3 }; importRequest.mockImplementation(async (request) => ({ uploadId: "upload-id", maxChunkSize: 1024, diff --git a/web/tests/memo-panel-list.test.tsx b/web/tests/memo-panel-list.test.tsx index 0587a35ba..c64c2778b 100644 --- a/web/tests/memo-panel-list.test.tsx +++ b/web/tests/memo-panel-list.test.tsx @@ -4,7 +4,7 @@ import type { ReactNode } from "react"; import { beforeEach, describe, expect, it, vi } from "vitest"; import { MemoPanelList } from "@/components/MemoPanel/MemoPanelList"; import type { MemoViewProps } from "@/components/MemoView/types"; -import { MemoSchema } from "@/types/proto/api/v1/memo_service_pb"; +import { MemoSchema } from "@/types/proto/api/memo_service_pb"; const mocks = vi.hoisted(() => ({ creatorUsername: undefined as string | undefined, diff --git a/web/tests/memo-related-settings.test.tsx b/web/tests/memo-related-settings.test.tsx index f6abdaf70..fee997133 100644 --- a/web/tests/memo-related-settings.test.tsx +++ b/web/tests/memo-related-settings.test.tsx @@ -2,11 +2,7 @@ import { create } from "@bufbuild/protobuf"; import { fireEvent, render, screen, waitFor } from "@testing-library/react"; import { beforeEach, describe, expect, it, vi } from "vitest"; import MemoRelatedSettings from "@/components/Settings/MemoRelatedSettings"; -import { - type InstanceSetting, - InstanceSetting_Key, - InstanceSetting_MemoRelatedSettingSchema, -} from "@/types/proto/api/v1/instance_service_pb"; +import { type InstanceSetting, InstanceSetting_Key, InstanceSetting_MemoRelatedSettingSchema } from "@/types/proto/api/instance_service_pb"; const mocks = vi.hoisted(() => ({ instance: { diff --git a/web/tests/memo-share-image.test.ts b/web/tests/memo-share-image.test.ts index f8f1aa3f8..0462f5a1c 100644 --- a/web/tests/memo-share-image.test.ts +++ b/web/tests/memo-share-image.test.ts @@ -10,8 +10,8 @@ import { getMemoShareRenderWidth, } from "@/components/MemoActionMenu/memoShareImage"; import { buildMemoShareImagePreviewModel } from "@/components/MemoActionMenu/memoShareImagePreviewModel"; -import { AttachmentSchema } from "@/types/proto/api/v1/attachment_service_pb"; -import { type Memo, MemoSchema } from "@/types/proto/api/v1/memo_service_pb"; +import { AttachmentSchema } from "@/types/proto/api/attachment_service_pb"; +import { type Memo, MemoSchema } from "@/types/proto/api/memo_service_pb"; vi.mock("html-to-image", () => ({ toBlob: vi.fn(), diff --git a/web/tests/memo-view-icons.test.tsx b/web/tests/memo-view-icons.test.tsx index 257a3ae7e..9dad53f66 100644 --- a/web/tests/memo-view-icons.test.tsx +++ b/web/tests/memo-view-icons.test.tsx @@ -5,7 +5,7 @@ import { MemoryRouter } from "react-router-dom"; import { beforeEach, describe, expect, it, vi } from "vitest"; import MemoViewIcon from "@/components/MemoViewIcon"; import MemoViews from "@/pages/MemoViews"; -import { MemoView_IconSchema, MemoViewSchema } from "@/types/proto/api/v1/user_service_pb"; +import { MemoView_IconSchema, MemoViewSchema } from "@/types/proto/api/user_service_pb"; const mocks = vi.hoisted(() => ({ create: vi.fn(), update: vi.fn(), isPending: false, isError: false, refetch: vi.fn() })); vi.mock("@/connect", () => ({ userServiceClient: { createMemoView: mocks.create, updateMemoView: mocks.update } })); diff --git a/web/tests/memo-views.test.ts b/web/tests/memo-views.test.ts index ee45b4b1d..de34b5df2 100644 --- a/web/tests/memo-views.test.ts +++ b/web/tests/memo-views.test.ts @@ -2,7 +2,7 @@ import { describe, expect, it } from "vitest"; import { buildMemoFilter } from "@/hooks/useMemoFilters"; import { combineCELFilters } from "@/lib/cel-filter"; import { getMemoViewId, isMemoCollectionRoute, isMemoScopeRoute, resolveMemoScope } from "@/lib/memo-views"; -import { Visibility } from "@/types/proto/api/v1/memo_service_pb"; +import { Visibility } from "@/types/proto/api/memo_service_pb"; describe("memo scopes", () => { it("resolves collection and detail routes", () => { diff --git a/web/tests/paged-memo-list.test.tsx b/web/tests/paged-memo-list.test.tsx index 2a0dc6530..6eb5162cf 100644 --- a/web/tests/paged-memo-list.test.tsx +++ b/web/tests/paged-memo-list.test.tsx @@ -3,7 +3,7 @@ import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; import { act, fireEvent, render, screen } from "@testing-library/react"; import { beforeEach, describe, expect, it, vi } from "vitest"; import PagedMemoList from "@/components/PagedMemoList"; -import type { Memo } from "@/types/proto/api/v1/memo_service_pb"; +import type { Memo } from "@/types/proto/api/memo_service_pb"; const view = vi.hoisted(() => ({ maxColumns: 1 as 0 | 1 | 2 | 3, compactMode: false })); const feed = vi.hoisted(() => ({ diff --git a/web/tests/preview-image-dialog.test.tsx b/web/tests/preview-image-dialog.test.tsx index 6eb8c9709..87d58c4d4 100644 --- a/web/tests/preview-image-dialog.test.tsx +++ b/web/tests/preview-image-dialog.test.tsx @@ -8,7 +8,7 @@ import { MediaLocationSchema, MediaMetadataSchema, PhotoMetadataSchema, -} from "@/types/proto/api/v1/attachment_service_pb"; +} from "@/types/proto/api/attachment_service_pb"; vi.mock("@/hooks/useMediaQuery", () => ({ __esModule: true, diff --git a/web/tests/query-deduplication.test.tsx b/web/tests/query-deduplication.test.tsx index 451602f3c..4a633adb8 100644 --- a/web/tests/query-deduplication.test.tsx +++ b/web/tests/query-deduplication.test.tsx @@ -6,8 +6,8 @@ import { MentionResolutionProvider, useResolvedMentionUsernames, useResolvedUser import { useResolvedRelationMemos } from "@/components/MemoMetadata/Relation/useResolvedRelationMemos"; import { memoKeys } from "@/hooks/useMemoQueries"; import { useMemoViews, userKeys, useUser, useUsersByNames, useUsersByUsernames } from "@/hooks/useUserQueries"; -import type { Memo } from "@/types/proto/api/v1/memo_service_pb"; -import type { User } from "@/types/proto/api/v1/user_service_pb"; +import type { Memo } from "@/types/proto/api/memo_service_pb"; +import type { User } from "@/types/proto/api/user_service_pb"; const clients = vi.hoisted(() => ({ batchGetUsers: vi.fn(), @@ -148,7 +148,7 @@ describe("query deduplication", () => { }); expect(clients.batchGetUsers).toHaveBeenCalledTimes(1); - expect(clients.batchGetUsers).toHaveBeenCalledWith({ usernames: ["bob", "alice"] }); + expect(clients.batchGetUsers).toHaveBeenCalledWith({ names: ["users/bob", "users/alice"] }); expect(clients.getUser).not.toHaveBeenCalled(); }); diff --git a/web/tests/reaction-selector.test.tsx b/web/tests/reaction-selector.test.tsx index 8251f4c37..99bbb57e1 100644 --- a/web/tests/reaction-selector.test.tsx +++ b/web/tests/reaction-selector.test.tsx @@ -2,7 +2,7 @@ import { create } from "@bufbuild/protobuf"; import { fireEvent, render, screen, waitFor } from "@testing-library/react"; import { describe, expect, it, vi } from "vitest"; import ReactionSelector from "@/components/MemoReactionListView/ReactionSelector"; -import { MemoSchema } from "@/types/proto/api/v1/memo_service_pb"; +import { MemoSchema } from "@/types/proto/api/memo_service_pb"; vi.mock("@/components/MemoReactionListView/hooks", () => ({ useReactionActions: () => ({ diff --git a/web/tests/space-icon-picker.test.tsx b/web/tests/space-icon-picker.test.tsx index 4bd1ba49e..eed3d0a7c 100644 --- a/web/tests/space-icon-picker.test.tsx +++ b/web/tests/space-icon-picker.test.tsx @@ -6,7 +6,7 @@ import SpaceIcon from "@/components/SpaceIcon"; import SpaceIconPicker from "@/components/SpaceIconPicker"; import SpaceMark from "@/components/SpaceMark"; import { SPACE_EMOJI } from "@/lib/space-emoji"; -import { type Space_Icon, Space_IconSchema } from "@/types/proto/api/v1/space_service_pb"; +import { type Space_Icon, Space_IconSchema } from "@/types/proto/api/space_service_pb"; import { FULLY_QUALIFIED_EMOJI } from "@/utils/tag-unicode-data"; vi.mock("@/utils/i18n", () => ({ useTranslate: () => (key: string) => key })); diff --git a/web/tests/space-invitation-message.test.tsx b/web/tests/space-invitation-message.test.tsx index bf39f06b5..2091c97a1 100644 --- a/web/tests/space-invitation-message.test.tsx +++ b/web/tests/space-invitation-message.test.tsx @@ -2,15 +2,15 @@ import { create } from "@bufbuild/protobuf"; import { fireEvent, render, screen, waitFor } from "@testing-library/react"; import { beforeEach, describe, expect, it, vi } from "vitest"; import SpaceInvitationMessage from "@/components/Inbox/SpaceInvitationMessage"; -import { type Space, SpaceMember_Role, SpaceSchema } from "@/types/proto/api/v1/space_service_pb"; +import { type Space, SpaceMember_Role, SpaceSchema } from "@/types/proto/api/space_service_pb"; import { type UserNotification, - UserNotification_SpaceInvitationPayload_State, + UserNotification_SpaceInvitationPayload_InvitationState, UserNotification_Status, UserNotification_Type, UserNotificationSchema, UserSchema, -} from "@/types/proto/api/v1/user_service_pb"; +} from "@/types/proto/api/user_service_pb"; const state = vi.hoisted(() => ({ acceptInvitation: vi.fn(), @@ -59,7 +59,7 @@ vi.mock("@/utils/i18n", () => ({ const space: Space = create(SpaceSchema, { name: "spaces/design", title: "Design team", description: "Product design notes" }); const createNotification = (overrides: { - state: UserNotification_SpaceInvitationPayload_State; + state: UserNotification_SpaceInvitationPayload_InvitationState; status?: UserNotification_Status; role?: SpaceMember_Role; }): UserNotification => @@ -88,7 +88,11 @@ describe("SpaceInvitationMessage", () => { }); it("offers accept and decline while the invitation is pending", async () => { - render(); + render( + , + ); expect(screen.getByText("Bob")).toBeInTheDocument(); expect(screen.getByText("inbox.space-invitation")).toBeInTheDocument(); @@ -104,7 +108,11 @@ describe("SpaceInvitationMessage", () => { }); it("declines the invitation from the inbox", async () => { - render(); + render( + , + ); fireEvent.click(screen.getByRole("button", { name: "setting.spaces.decline" })); await waitFor(() => expect(state.declineInvitation).toHaveBeenCalledWith({ name: "spaces/design/invitations/alice" })); @@ -114,7 +122,11 @@ describe("SpaceInvitationMessage", () => { it("reports a failed accept without pretending it succeeded", async () => { state.acceptInvitation.mockRejectedValueOnce(new Error("space invitation not found")); - render(); + render( + , + ); fireEvent.click(screen.getByRole("button", { name: "setting.spaces.accept" })); await waitFor(() => expect(state.toastError).toHaveBeenCalled()); @@ -125,7 +137,7 @@ describe("SpaceInvitationMessage", () => { render( { it("archives through the shared notification mutation and reports failures", async () => { state.archiveNotification.mockResolvedValueOnce(undefined); const { unmount } = render( - , + , ); fireEvent.click(screen.getByRole("button", { name: "common.archive" })); @@ -153,7 +167,11 @@ describe("SpaceInvitationMessage", () => { unmount(); state.archiveNotification.mockRejectedValueOnce(new Error("offline")); - render(); + render( + , + ); fireEvent.click(screen.getByRole("button", { name: "common.archive" })); await waitFor(() => expect(state.toastError).toHaveBeenCalled()); }); @@ -163,7 +181,7 @@ describe("SpaceInvitationMessage", () => { render( , diff --git a/web/tests/space-queries.test.tsx b/web/tests/space-queries.test.tsx index 45279fb08..cdfba45e1 100644 --- a/web/tests/space-queries.test.tsx +++ b/web/tests/space-queries.test.tsx @@ -21,7 +21,7 @@ import { useUpdateSpaceMember, useUserSpaceInvitations, } from "@/hooks/useSpaceQueries"; -import { SpaceInvitationSchema, SpaceMember_Role, SpaceMemberSchema, SpaceSchema } from "@/types/proto/api/v1/space_service_pb"; +import { SpaceInvitationSchema, SpaceMember_Role, SpaceMemberSchema, SpaceSchema } from "@/types/proto/api/space_service_pb"; const clients = vi.hoisted(() => ({ acceptSpaceInvitation: vi.fn(), diff --git a/web/tests/spaces-section.test.tsx b/web/tests/spaces-section.test.tsx index 1faae2249..4575d987e 100644 --- a/web/tests/spaces-section.test.tsx +++ b/web/tests/spaces-section.test.tsx @@ -3,7 +3,7 @@ import type { ReactNode } from "react"; import { MemoryRouter, useLocation } from "react-router-dom"; import { beforeEach, describe, expect, it, vi } from "vitest"; import SpacesSection from "@/components/Settings/SpacesSection"; -import type { Space, SpaceInvitation, SpaceMember } from "@/types/proto/api/v1/space_service_pb"; +import type { Space, SpaceInvitation, SpaceMember } from "@/types/proto/api/space_service_pb"; const state = vi.hoisted(() => ({ viewerName: "users/alice", @@ -69,7 +69,7 @@ vi.mock("@/components/CreateSpaceDialog", () => ({ type="button" onClick={() => { const createdSpace: Space = { - $typeName: "memos.api.v1.Space", + $typeName: "memos.api.Space", name: "spaces/created", title: "Created", description: "", @@ -118,7 +118,7 @@ vi.mock("@/utils/i18n", () => ({ })); const adminSpace: Space = { - $typeName: "memos.api.v1.Space", + $typeName: "memos.api.Space", name: "spaces/product", title: "Product", description: "Product decisions", @@ -132,26 +132,26 @@ const userSpace: Space = { }; const adminMember: SpaceMember = { - $typeName: "memos.api.v1.SpaceMember", + $typeName: "memos.api.SpaceMember", name: "spaces/product/members/alice", user: "users/alice", role: 1, }; const ordinaryMember: SpaceMember = { - $typeName: "memos.api.v1.SpaceMember", + $typeName: "memos.api.SpaceMember", name: "spaces/product/members/bob", user: "users/bob", role: 2, }; const receivedInvitation: SpaceInvitation = { - $typeName: "memos.api.v1.SpaceInvitation", + $typeName: "memos.api.SpaceInvitation", name: "spaces/research/invitations/alice", invitee: "users/alice", role: 2, space: { - $typeName: "memos.api.v1.Space", + $typeName: "memos.api.Space", name: "spaces/research", title: "Research", description: "Research notes", @@ -161,7 +161,7 @@ const receivedInvitation: SpaceInvitation = { }; const pendingInvitation: SpaceInvitation = { - $typeName: "memos.api.v1.SpaceInvitation", + $typeName: "memos.api.SpaceInvitation", name: "spaces/product/invitations/carol", invitee: "users/carol", role: 2, @@ -275,7 +275,7 @@ describe("SpacesSection", () => { }); it("clears a saved icon with an explicit update mask", async () => { - state.spaces = [{ ...adminSpace, icon: { $typeName: "memos.api.v1.Space.Icon", value: { case: "emoji", value: "🌱" } } }]; + state.spaces = [{ ...adminSpace, icon: { $typeName: "memos.api.Space.Icon", value: { case: "emoji", value: "🌱" } } }]; state.members = [adminMember]; renderSection("/setting?space=spaces%2Fproduct#spaces"); fireEvent.click(screen.getByRole("button", { name: "space.icon.change" })); diff --git a/web/tests/tag.test.ts b/web/tests/tag.test.ts index 38259dc5c..35a8b9b4f 100644 --- a/web/tests/tag.test.ts +++ b/web/tests/tag.test.ts @@ -1,7 +1,7 @@ import { create, fromBinary, toBinary } from "@bufbuild/protobuf"; import { describe, expect, it } from "vitest"; import { findTagMetadata, mergeTagCounts } from "@/lib/tag"; -import { UserSetting_TagMetadataSchema, UserSetting_TagsSettingSchema, UserStatsSchema } from "@/types/proto/api/v1/user_service_pb"; +import { UserSetting_TagMetadataSchema, UserSetting_TagsSettingSchema, UserStatsSchema } from "@/types/proto/api/user_service_pb"; describe("exact tag keys", () => { it("aggregates names that collide with Object prototype properties", () => { @@ -24,11 +24,11 @@ describe("exact tag keys", () => { ["constructor", 2], ["__proto__", 3], ]); - const encoded = toBinary(UserStatsSchema, create(UserStatsSchema, { tagCount: source })); + const encoded = toBinary(UserStatsSchema, create(UserStatsSchema, { tagCounts: source })); const decoded = fromBinary(UserStatsSchema, encoded); - const counts = mergeTagCounts(decoded.tagCount); + const counts = mergeTagCounts(decoded.tagCounts); - expect(Object.keys(decoded.tagCount).sort()).toEqual(["__proto__", "constructor", "normal"]); + expect(Object.keys(decoded.tagCounts).sort()).toEqual(["__proto__", "constructor", "normal"]); expect(counts.normal).toBe(1); expect(counts.constructor).toBe(2); expect(counts.__proto__).toBe(3); diff --git a/web/tests/transcription-service.test.ts b/web/tests/transcription-service.test.ts index 13fa86026..384d39cca 100644 --- a/web/tests/transcription-service.test.ts +++ b/web/tests/transcription-service.test.ts @@ -1,6 +1,6 @@ import { create } from "@bufbuild/protobuf"; import { afterEach, describe, expect, it, vi } from "vitest"; -import { AttachmentSchema } from "@/types/proto/api/v1/attachment_service_pb"; +import { AttachmentSchema } from "@/types/proto/api/attachment_service_pb"; const { transcribe } = vi.hoisted(() => ({ transcribe: vi.fn() })); vi.mock("@/connect", () => ({ aiServiceClient: { transcribe } })); diff --git a/web/tests/upload-media-metadata.test.ts b/web/tests/upload-media-metadata.test.ts index 68b773f48..e24a81074 100644 --- a/web/tests/upload-media-metadata.test.ts +++ b/web/tests/upload-media-metadata.test.ts @@ -1,7 +1,7 @@ import { create } from "@bufbuild/protobuf"; import { beforeEach, describe, expect, it, vi } from "vitest"; import type { LocalFile } from "@/components/MemoEditor/types/attachment"; -import { MediaMetadataSchema } from "@/types/proto/api/v1/attachment_service_pb"; +import { MediaMetadataSchema } from "@/types/proto/api/attachment_service_pb"; const mocks = vi.hoisted(() => ({ uploadAttachment: vi.fn(), diff --git a/web/tests/upload-service.test.ts b/web/tests/upload-service.test.ts index 83ff9cb78..0ec9d5e3f 100644 --- a/web/tests/upload-service.test.ts +++ b/web/tests/upload-service.test.ts @@ -1,7 +1,7 @@ import { create } from "@bufbuild/protobuf"; import { Code, ConnectError } from "@connectrpc/connect"; import { beforeEach, describe, expect, it, vi } from "vitest"; -import { AttachmentSchema } from "@/types/proto/api/v1/attachment_service_pb"; +import { AttachmentSchema } from "@/types/proto/api/attachment_service_pb"; const { uploadAttachment } = vi.hoisted(() => ({ uploadAttachment: vi.fn() })); vi.mock("@/connect", () => ({ attachmentServiceClient: { uploadAttachment } })); diff --git a/web/tests/use-attachment-transcription.test.tsx b/web/tests/use-attachment-transcription.test.tsx index ad7b237ae..c9ba0c3ab 100644 --- a/web/tests/use-attachment-transcription.test.tsx +++ b/web/tests/use-attachment-transcription.test.tsx @@ -5,7 +5,7 @@ import { toast } from "react-hot-toast"; import { afterEach, describe, expect, it, vi } from "vitest"; import { useAttachmentTranscription } from "@/components/MemoEditor/hooks/useAttachmentTranscription"; import { transcriptionService } from "@/components/MemoEditor/services"; -import { AttachmentSchema } from "@/types/proto/api/v1/attachment_service_pb"; +import { AttachmentSchema } from "@/types/proto/api/attachment_service_pb"; vi.mock("react-hot-toast", () => ({ toast: { error: vi.fn(), success: vi.fn() } })); const audio = create(AttachmentSchema, { name: "attachments/voice", filename: "voice.wav", type: "audio/wav" }); diff --git a/web/tests/use-auto-save.test.tsx b/web/tests/use-auto-save.test.tsx index 3025e09d1..7ae555669 100644 --- a/web/tests/use-auto-save.test.tsx +++ b/web/tests/use-auto-save.test.tsx @@ -4,8 +4,8 @@ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; import { useAutoSave } from "@/components/MemoEditor/hooks/useAutoSave"; import { cacheService } from "@/components/MemoEditor/services/cacheService"; import { EditorProvider, useEditorContext } from "@/components/MemoEditor/state"; -import { AttachmentSchema } from "@/types/proto/api/v1/attachment_service_pb"; -import { Visibility } from "@/types/proto/api/v1/memo_service_pb"; +import { AttachmentSchema } from "@/types/proto/api/attachment_service_pb"; +import { Visibility } from "@/types/proto/api/memo_service_pb"; // Probe surfaces the store's dispatch/actions plus the autosave API so tests can // drive content changes the way the editor does and assert on cache writes. diff --git a/web/tests/use-inline-image-upload.test.tsx b/web/tests/use-inline-image-upload.test.tsx index d4ae3e5f2..91a407f3a 100644 --- a/web/tests/use-inline-image-upload.test.tsx +++ b/web/tests/use-inline-image-upload.test.tsx @@ -8,7 +8,7 @@ import { uploadService } from "@/components/MemoEditor/services"; import { EditorProvider, useEditorContext } from "@/components/MemoEditor/state"; import type { LocalFile } from "@/components/MemoEditor/types/attachment"; import type { EditorController } from "@/components/MemoEditor/types/editorController"; -import { AttachmentSchema } from "@/types/proto/api/v1/attachment_service_pb"; +import { AttachmentSchema } from "@/types/proto/api/attachment_service_pb"; vi.mock("@/utils/i18n", async (importOriginal) => ({ ...(await importOriginal()), diff --git a/web/tests/use-memo-init.test.tsx b/web/tests/use-memo-init.test.tsx index 132044203..03b11cd45 100644 --- a/web/tests/use-memo-init.test.tsx +++ b/web/tests/use-memo-init.test.tsx @@ -6,9 +6,9 @@ import { useMemoInit } from "@/components/MemoEditor/hooks/useMemoInit"; import { cacheService } from "@/components/MemoEditor/services/cacheService"; import { EditorProvider, useEditorContext } from "@/components/MemoEditor/state"; import type { EditorController } from "@/components/MemoEditor/types/editorController"; -import { AttachmentSchema } from "@/types/proto/api/v1/attachment_service_pb"; +import { AttachmentSchema } from "@/types/proto/api/attachment_service_pb"; -import { type Location, LocationSchema, Visibility } from "@/types/proto/api/v1/memo_service_pb"; +import { type Location, LocationSchema, Visibility } from "@/types/proto/api/memo_service_pb"; const editorRef = { current: null } as RefObject; let getEditorState: ReturnType["getState"]; diff --git a/web/tests/user-stats-filter-queries.test.tsx b/web/tests/user-stats-filter-queries.test.tsx index df5145688..414dadc44 100644 --- a/web/tests/user-stats-filter-queries.test.tsx +++ b/web/tests/user-stats-filter-queries.test.tsx @@ -3,11 +3,11 @@ import { renderHook, waitFor } from "@testing-library/react"; import type { ReactNode } from "react"; import { beforeEach, describe, expect, it, vi } from "vitest"; import { useAllUserStats, useUserStats } from "@/hooks/useUserQueries"; -import { State } from "@/types/proto/api/v1/common_pb"; +import { State } from "@/types/proto/api/common_pb"; const clients = vi.hoisted(() => ({ getUserStats: vi.fn(), - listAllUserStats: vi.fn(), + listUserStats: vi.fn(), })); vi.mock("@/connect", () => ({ @@ -24,7 +24,7 @@ const createWrapper = () => { describe("User statistics filter queries", () => { beforeEach(() => { clients.getUserStats.mockReset().mockResolvedValue({ name: "users/test/stats" }); - clients.listAllUserStats.mockReset().mockResolvedValue({ stats: [] }); + clients.listUserStats.mockReset().mockResolvedValue({ userStats: [] }); }); it("sends a Space filter with per-user statistics", async () => { @@ -40,6 +40,6 @@ describe("User statistics filter queries", () => { const { result } = renderHook(() => useAllUserStats({ state: State.ARCHIVED, filter }), { wrapper: createWrapper() }); await waitFor(() => expect(result.current.isSuccess).toBe(true)); - expect(clients.listAllUserStats).toHaveBeenCalledWith(expect.objectContaining({ state: State.ARCHIVED, filter })); + expect(clients.listUserStats).toHaveBeenCalledWith(expect.objectContaining({ parent: "users/-", state: State.ARCHIVED, filter })); }); }); diff --git a/web/tests/visibility-space.test.tsx b/web/tests/visibility-space.test.tsx index e0286c476..f9d2f816f 100644 --- a/web/tests/visibility-space.test.tsx +++ b/web/tests/visibility-space.test.tsx @@ -2,7 +2,7 @@ import { render } from "@testing-library/react"; import { UserLockIcon } from "lucide-react"; import { describe, expect, it } from "vitest"; import VisibilityIcon from "@/components/VisibilityIcon"; -import { Visibility } from "@/types/proto/api/v1/memo_service_pb"; +import { Visibility } from "@/types/proto/api/memo_service_pb"; import { convertVisibilityFromString, convertVisibilityToString, diff --git a/web/vite.config.mts b/web/vite.config.mts index 41dea73bd..a2231cbff 100644 --- a/web/vite.config.mts +++ b/web/vite.config.mts @@ -17,7 +17,7 @@ export default defineConfig({ host: "0.0.0.0", port: 3001, proxy: { - "^/api/v1/sse": { + "^/api/sse": { target: devProxyServer, xfwd: true, // SSE requires no response buffering and longer timeout. @@ -27,7 +27,7 @@ export default defineConfig({ target: devProxyServer, xfwd: true, }, - "^/memos.api.v1": { + "^/memos.api": { target: devProxyServer, xfwd: true, },