Commit da906c66 authored by Steven's avatar Steven

chore: tweak workspace service

parent 3b0c8759
...@@ -7,22 +7,27 @@ import "google/api/annotations.proto"; ...@@ -7,22 +7,27 @@ import "google/api/annotations.proto";
option go_package = "gen/api/v1"; option go_package = "gen/api/v1";
service WorkspaceService { service WorkspaceService {
// GetWorkspaceProfile returns the workspace profile. // Gets the workspace profile.
rpc GetWorkspaceProfile(GetWorkspaceProfileRequest) returns (WorkspaceProfile) { rpc GetWorkspaceProfile(GetWorkspaceProfileRequest) returns (WorkspaceProfile) {
option (google.api.http) = {get: "/api/v1/workspace/profile"}; option (google.api.http) = {get: "/api/v1/workspace/profile"};
} }
} }
// Workspace profile message containing basic workspace information.
message WorkspaceProfile { message WorkspaceProfile {
// The name of instance owner. // The name of instance owner.
// Format: users/{user} // Format: users/{user}
string owner = 1; string owner = 1;
// version is the current version of instance
// Version is the current version of instance.
string version = 2; string version = 2;
// mode is the instance mode (e.g. "prod", "dev" or "demo").
// Mode is the instance mode (e.g. "prod", "dev" or "demo").
string mode = 3; string mode = 3;
// instance_url is the URL of the instance.
// Instance URL is the URL of the instance.
string instance_url = 6; string instance_url = 6;
} }
// Request for workspace profile.
message GetWorkspaceProfileRequest {} message GetWorkspaceProfileRequest {}
...@@ -22,16 +22,17 @@ const ( ...@@ -22,16 +22,17 @@ const (
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
) )
// Workspace profile message containing basic workspace information.
type WorkspaceProfile struct { type WorkspaceProfile struct {
state protoimpl.MessageState `protogen:"open.v1"` state protoimpl.MessageState `protogen:"open.v1"`
// The name of instance owner. // The name of instance owner.
// Format: users/{user} // Format: users/{user}
Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"`
// version is the current version of instance // Version is the current version of instance.
Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"`
// mode is the instance mode (e.g. "prod", "dev" or "demo"). // Mode is the instance mode (e.g. "prod", "dev" or "demo").
Mode string `protobuf:"bytes,3,opt,name=mode,proto3" json:"mode,omitempty"` Mode string `protobuf:"bytes,3,opt,name=mode,proto3" json:"mode,omitempty"`
// instance_url is the URL of the instance. // Instance URL is the URL of the instance.
InstanceUrl string `protobuf:"bytes,6,opt,name=instance_url,json=instanceUrl,proto3" json:"instance_url,omitempty"` InstanceUrl string `protobuf:"bytes,6,opt,name=instance_url,json=instanceUrl,proto3" json:"instance_url,omitempty"`
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
...@@ -95,6 +96,7 @@ func (x *WorkspaceProfile) GetInstanceUrl() string { ...@@ -95,6 +96,7 @@ func (x *WorkspaceProfile) GetInstanceUrl() string {
return "" return ""
} }
// Request for workspace profile.
type GetWorkspaceProfileRequest struct { type GetWorkspaceProfileRequest struct {
state protoimpl.MessageState `protogen:"open.v1"` state protoimpl.MessageState `protogen:"open.v1"`
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
......
...@@ -26,7 +26,7 @@ const ( ...@@ -26,7 +26,7 @@ const (
// //
// 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. // 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.
type WorkspaceServiceClient interface { type WorkspaceServiceClient interface {
// GetWorkspaceProfile returns the workspace profile. // Gets the workspace profile.
GetWorkspaceProfile(ctx context.Context, in *GetWorkspaceProfileRequest, opts ...grpc.CallOption) (*WorkspaceProfile, error) GetWorkspaceProfile(ctx context.Context, in *GetWorkspaceProfileRequest, opts ...grpc.CallOption) (*WorkspaceProfile, error)
} }
...@@ -52,7 +52,7 @@ func (c *workspaceServiceClient) GetWorkspaceProfile(ctx context.Context, in *Ge ...@@ -52,7 +52,7 @@ func (c *workspaceServiceClient) GetWorkspaceProfile(ctx context.Context, in *Ge
// All implementations must embed UnimplementedWorkspaceServiceServer // All implementations must embed UnimplementedWorkspaceServiceServer
// for forward compatibility. // for forward compatibility.
type WorkspaceServiceServer interface { type WorkspaceServiceServer interface {
// GetWorkspaceProfile returns the workspace profile. // Gets the workspace profile.
GetWorkspaceProfile(context.Context, *GetWorkspaceProfileRequest) (*WorkspaceProfile, error) GetWorkspaceProfile(context.Context, *GetWorkspaceProfileRequest) (*WorkspaceProfile, error)
mustEmbedUnimplementedWorkspaceServiceServer() mustEmbedUnimplementedWorkspaceServiceServer()
} }
......
...@@ -694,7 +694,7 @@ paths: ...@@ -694,7 +694,7 @@ paths:
- WebhookService - WebhookService
/api/v1/workspace/profile: /api/v1/workspace/profile:
get: get:
summary: GetWorkspaceProfile returns the workspace profile. summary: Gets the workspace profile.
operationId: WorkspaceService_GetWorkspaceProfile operationId: WorkspaceService_GetWorkspaceProfile
responses: responses:
"200": "200":
...@@ -3690,10 +3690,11 @@ definitions: ...@@ -3690,10 +3690,11 @@ definitions:
Format: users/{user} Format: users/{user}
version: version:
type: string type: string
title: version is the current version of instance description: Version is the current version of instance.
mode: mode:
type: string type: string
description: mode is the instance mode (e.g. "prod", "dev" or "demo"). description: Mode is the instance mode (e.g. "prod", "dev" or "demo").
instanceUrl: instanceUrl:
type: string type: string
description: instance_url is the URL of the instance. description: Instance URL is the URL of the instance.
description: Workspace profile message containing basic workspace information.
...@@ -11,6 +11,7 @@ import ( ...@@ -11,6 +11,7 @@ import (
"github.com/usememos/memos/store" "github.com/usememos/memos/store"
) )
// GetWorkspaceProfile returns the workspace profile.
func (s *APIV1Service) GetWorkspaceProfile(ctx context.Context, _ *v1pb.GetWorkspaceProfileRequest) (*v1pb.WorkspaceProfile, error) { func (s *APIV1Service) GetWorkspaceProfile(ctx context.Context, _ *v1pb.GetWorkspaceProfileRequest) (*v1pb.WorkspaceProfile, error) {
workspaceProfile := &v1pb.WorkspaceProfile{ workspaceProfile := &v1pb.WorkspaceProfile{
Version: s.Profile.Version, Version: s.Profile.Version,
......
...@@ -9,20 +9,22 @@ import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; ...@@ -9,20 +9,22 @@ import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
export const protobufPackage = "memos.api.v1"; export const protobufPackage = "memos.api.v1";
/** Workspace profile message containing basic workspace information. */
export interface WorkspaceProfile { export interface WorkspaceProfile {
/** /**
* The name of instance owner. * The name of instance owner.
* Format: users/{user} * Format: users/{user}
*/ */
owner: string; owner: string;
/** version is the current version of instance */ /** Version is the current version of instance. */
version: string; version: string;
/** mode is the instance mode (e.g. "prod", "dev" or "demo"). */ /** Mode is the instance mode (e.g. "prod", "dev" or "demo"). */
mode: string; mode: string;
/** instance_url is the URL of the instance. */ /** Instance URL is the URL of the instance. */
instanceUrl: string; instanceUrl: string;
} }
/** Request for workspace profile. */
export interface GetWorkspaceProfileRequest { export interface GetWorkspaceProfileRequest {
} }
...@@ -147,7 +149,7 @@ export const WorkspaceServiceDefinition = { ...@@ -147,7 +149,7 @@ export const WorkspaceServiceDefinition = {
name: "WorkspaceService", name: "WorkspaceService",
fullName: "memos.api.v1.WorkspaceService", fullName: "memos.api.v1.WorkspaceService",
methods: { methods: {
/** GetWorkspaceProfile returns the workspace profile. */ /** Gets the workspace profile. */
getWorkspaceProfile: { getWorkspaceProfile: {
name: "GetWorkspaceProfile", name: "GetWorkspaceProfile",
requestType: GetWorkspaceProfileRequest, requestType: GetWorkspaceProfileRequest,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment