mirror of https://github.com/usememos/memos.git
chore: tweak workspace service
This commit is contained in:
parent
3b0c87591f
commit
da906c665c
|
|
@ -7,22 +7,27 @@ import "google/api/annotations.proto";
|
|||
option go_package = "gen/api/v1";
|
||||
|
||||
service WorkspaceService {
|
||||
// GetWorkspaceProfile returns the workspace profile.
|
||||
// Gets the workspace profile.
|
||||
rpc GetWorkspaceProfile(GetWorkspaceProfileRequest) returns (WorkspaceProfile) {
|
||||
option (google.api.http) = {get: "/api/v1/workspace/profile"};
|
||||
}
|
||||
}
|
||||
|
||||
// Workspace profile message containing basic workspace information.
|
||||
message WorkspaceProfile {
|
||||
// The name of instance owner.
|
||||
// Format: users/{user}
|
||||
string owner = 1;
|
||||
// version is the current version of instance
|
||||
|
||||
// Version is the current version of instance.
|
||||
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;
|
||||
// instance_url is the URL of the instance.
|
||||
|
||||
// Instance URL is the URL of the instance.
|
||||
string instance_url = 6;
|
||||
}
|
||||
|
||||
// Request for workspace profile.
|
||||
message GetWorkspaceProfileRequest {}
|
||||
|
|
|
|||
|
|
@ -22,16 +22,17 @@ const (
|
|||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
// Workspace profile message containing basic workspace information.
|
||||
type WorkspaceProfile struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
// The name of instance owner.
|
||||
// Format: users/{user}
|
||||
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"`
|
||||
// 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"`
|
||||
// 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"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
|
|
@ -95,6 +96,7 @@ func (x *WorkspaceProfile) GetInstanceUrl() string {
|
|||
return ""
|
||||
}
|
||||
|
||||
// Request for workspace profile.
|
||||
type GetWorkspaceProfileRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
type WorkspaceServiceClient interface {
|
||||
// GetWorkspaceProfile returns the workspace profile.
|
||||
// Gets the workspace profile.
|
||||
GetWorkspaceProfile(ctx context.Context, in *GetWorkspaceProfileRequest, opts ...grpc.CallOption) (*WorkspaceProfile, error)
|
||||
}
|
||||
|
||||
|
|
@ -52,7 +52,7 @@ func (c *workspaceServiceClient) GetWorkspaceProfile(ctx context.Context, in *Ge
|
|||
// All implementations must embed UnimplementedWorkspaceServiceServer
|
||||
// for forward compatibility.
|
||||
type WorkspaceServiceServer interface {
|
||||
// GetWorkspaceProfile returns the workspace profile.
|
||||
// Gets the workspace profile.
|
||||
GetWorkspaceProfile(context.Context, *GetWorkspaceProfileRequest) (*WorkspaceProfile, error)
|
||||
mustEmbedUnimplementedWorkspaceServiceServer()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -694,7 +694,7 @@ paths:
|
|||
- WebhookService
|
||||
/api/v1/workspace/profile:
|
||||
get:
|
||||
summary: GetWorkspaceProfile returns the workspace profile.
|
||||
summary: Gets the workspace profile.
|
||||
operationId: WorkspaceService_GetWorkspaceProfile
|
||||
responses:
|
||||
"200":
|
||||
|
|
@ -3690,10 +3690,11 @@ definitions:
|
|||
Format: users/{user}
|
||||
version:
|
||||
type: string
|
||||
title: version is the current version of instance
|
||||
description: Version is the current version of instance.
|
||||
mode:
|
||||
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:
|
||||
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 (
|
|||
"github.com/usememos/memos/store"
|
||||
)
|
||||
|
||||
// GetWorkspaceProfile returns the workspace profile.
|
||||
func (s *APIV1Service) GetWorkspaceProfile(ctx context.Context, _ *v1pb.GetWorkspaceProfileRequest) (*v1pb.WorkspaceProfile, error) {
|
||||
workspaceProfile := &v1pb.WorkspaceProfile{
|
||||
Version: s.Profile.Version,
|
||||
|
|
|
|||
|
|
@ -9,20 +9,22 @@ import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
|||
|
||||
export const protobufPackage = "memos.api.v1";
|
||||
|
||||
/** Workspace profile message containing basic workspace information. */
|
||||
export interface WorkspaceProfile {
|
||||
/**
|
||||
* The name of instance owner.
|
||||
* Format: users/{user}
|
||||
*/
|
||||
owner: string;
|
||||
/** version is the current version of instance */
|
||||
/** Version is the current version of instance. */
|
||||
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;
|
||||
/** instance_url is the URL of the instance. */
|
||||
/** Instance URL is the URL of the instance. */
|
||||
instanceUrl: string;
|
||||
}
|
||||
|
||||
/** Request for workspace profile. */
|
||||
export interface GetWorkspaceProfileRequest {
|
||||
}
|
||||
|
||||
|
|
@ -147,7 +149,7 @@ export const WorkspaceServiceDefinition = {
|
|||
name: "WorkspaceService",
|
||||
fullName: "memos.api.v1.WorkspaceService",
|
||||
methods: {
|
||||
/** GetWorkspaceProfile returns the workspace profile. */
|
||||
/** Gets the workspace profile. */
|
||||
getWorkspaceProfile: {
|
||||
name: "GetWorkspaceProfile",
|
||||
requestType: GetWorkspaceProfileRequest,
|
||||
|
|
|
|||
Loading…
Reference in New Issue