chore: generate ts definition (#2156)

* chore: generate ts definition

* chore: update
pull/2157/head
boojack 2 years ago committed by GitHub
parent 609b24f2ba
commit 19e7731abb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -10,11 +10,12 @@ import (
"github.com/spf13/cobra"
"github.com/spf13/viper"
"github.com/usememos/memos/common/log"
"github.com/usememos/memos/server"
_profile "github.com/usememos/memos/server/profile"
"github.com/usememos/memos/store"
"github.com/usememos/memos/store/db"
"go.uber.org/zap"
)
const (
@ -42,7 +43,7 @@ var (
db := db.NewDB(profile)
if err := db.Open(ctx); err != nil {
cancel()
fmt.Printf("failed to open db, error: %+v\n", err)
log.Error("failed to open db", zap.Error(err))
return
}
@ -50,7 +51,7 @@ var (
s, err := server.NewServer(ctx, profile, store)
if err != nil {
cancel()
fmt.Printf("failed to create server, error: %+v\n", err)
log.Error("failed to create server", zap.Error(err))
return
}
@ -61,16 +62,16 @@ var (
signal.Notify(c, os.Interrupt, syscall.SIGTERM)
go func() {
sig := <-c
fmt.Printf("%s received.\n", sig.String())
log.Info(fmt.Sprintf("%s received.\n", sig.String()))
s.Shutdown(ctx)
cancel()
}()
println(greetingBanner)
fmt.Printf("Version %s has started at :%d\n", profile.Version, profile.Port)
printGreetings()
if err := s.Start(ctx); err != nil {
if err != http.ErrServerClosed {
fmt.Printf("failed to start server, error: %+v\n", err)
log.Error("failed to start server", zap.Error(err))
cancel()
}
}
@ -82,6 +83,7 @@ var (
)
func Execute() error {
defer log.Sync()
return rootCmd.Execute()
}
@ -127,3 +129,13 @@ func initConfig() {
println("version:", profile.Version)
println("---")
}
func printGreetings() {
fmt.Print(greetingBanner)
fmt.Printf("Version %s has been started on port %d\n", profile.Version, profile.Port)
fmt.Println("---")
fmt.Println("See more in:")
fmt.Printf("👉Website: %s\n", "https://usememos.com")
fmt.Printf("👉GitHub: %s\n", "https://github.com/usememos/memos")
fmt.Println("---")
}

@ -1,4 +1,3 @@
// Package log implements a simple logging package.
package log
import (

@ -18,6 +18,9 @@ plugins:
out: gen
opt:
- paths=source_relative
# Build the TypeScript definitions for the web.
- plugin: buf.build/bufbuild/es:v1.3.0
out: ../web/src/types/proto
- plugin: buf.build/community/pseudomuto-doc:v1.5.1
out: gen
opt:

@ -25,7 +25,7 @@ func NewBackupRunner(store *store.Store) *BackupRunner {
func (r *BackupRunner) Run(ctx context.Context) {
intervalStr := r.Store.GetSystemSettingValueWithDefault(&ctx, apiv1.SystemSettingAutoBackupIntervalName.String(), "")
if intervalStr == "" {
log.Info("no SystemSettingAutoBackupIntervalName setting, disable auto backup")
log.Debug("no SystemSettingAutoBackupIntervalName setting, disable auto backup")
return
}

@ -0,0 +1,25 @@
// @generated by protoc-gen-es v1.3.0
// @generated from file api/v2/common.proto (package memos.api.v2, syntax proto3)
/* eslint-disable */
// @ts-nocheck
/**
* @generated from enum memos.api.v2.RowStatus
*/
export declare enum RowStatus {
/**
* @generated from enum value: ROW_STATUS_UNSPECIFIED = 0;
*/
ROW_STATUS_UNSPECIFIED = 0,
/**
* @generated from enum value: ACTIVE = 1;
*/
ACTIVE = 1,
/**
* @generated from enum value: ARCHIVED = 2;
*/
ARCHIVED = 2,
}

@ -0,0 +1,19 @@
// @generated by protoc-gen-es v1.3.0
// @generated from file api/v2/common.proto (package memos.api.v2, syntax proto3)
/* eslint-disable */
// @ts-nocheck
import { proto3 } from "@bufbuild/protobuf";
/**
* @generated from enum memos.api.v2.RowStatus
*/
export const RowStatus = proto3.makeEnum(
"memos.api.v2.RowStatus",
[
{no: 0, name: "ROW_STATUS_UNSPECIFIED"},
{no: 1, name: "ACTIVE"},
{no: 2, name: "ARCHIVED"},
],
);

@ -0,0 +1,206 @@
// @generated by protoc-gen-es v1.3.0
// @generated from file api/v2/memo_service.proto (package memos.api.v2, syntax proto3)
/* eslint-disable */
// @ts-nocheck
import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf";
import { Message, proto3 } from "@bufbuild/protobuf";
import type { RowStatus } from "./common_pb.js";
/**
* @generated from enum memos.api.v2.Visibility
*/
export declare enum Visibility {
/**
* @generated from enum value: VISIBILITY_UNSPECIFIED = 0;
*/
VISIBILITY_UNSPECIFIED = 0,
/**
* @generated from enum value: PRIVATE = 1;
*/
PRIVATE = 1,
/**
* @generated from enum value: PROTECTED = 2;
*/
PROTECTED = 2,
/**
* @generated from enum value: PUBLIC = 3;
*/
PUBLIC = 3,
}
/**
* @generated from message memos.api.v2.Memo
*/
export declare class Memo extends Message<Memo> {
/**
* @generated from field: int32 id = 1;
*/
id: number;
/**
* @generated from field: memos.api.v2.RowStatus row_status = 2;
*/
rowStatus: RowStatus;
/**
* @generated from field: int32 creator_id = 3;
*/
creatorId: number;
/**
* @generated from field: int64 created_ts = 4;
*/
createdTs: bigint;
/**
* @generated from field: int64 updated_ts = 5;
*/
updatedTs: bigint;
/**
* @generated from field: string content = 6;
*/
content: string;
/**
* @generated from field: memos.api.v2.Visibility visibility = 7;
*/
visibility: Visibility;
/**
* @generated from field: bool pinned = 8;
*/
pinned: boolean;
constructor(data?: PartialMessage<Memo>);
static readonly runtime: typeof proto3;
static readonly typeName = "memos.api.v2.Memo";
static readonly fields: FieldList;
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): Memo;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): Memo;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): Memo;
static equals(a: Memo | PlainMessage<Memo> | undefined, b: Memo | PlainMessage<Memo> | undefined): boolean;
}
/**
* @generated from message memos.api.v2.ListMemosRequest
*/
export declare class ListMemosRequest extends Message<ListMemosRequest> {
/**
* @generated from field: int32 page = 1;
*/
page: number;
/**
* @generated from field: int32 page_size = 2;
*/
pageSize: number;
/**
* Filter is used to filter memos returned in the list.
*
* @generated from field: string filter = 3;
*/
filter: string;
constructor(data?: PartialMessage<ListMemosRequest>);
static readonly runtime: typeof proto3;
static readonly typeName = "memos.api.v2.ListMemosRequest";
static readonly fields: FieldList;
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): ListMemosRequest;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): ListMemosRequest;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): ListMemosRequest;
static equals(a: ListMemosRequest | PlainMessage<ListMemosRequest> | undefined, b: ListMemosRequest | PlainMessage<ListMemosRequest> | undefined): boolean;
}
/**
* @generated from message memos.api.v2.ListMemosResponse
*/
export declare class ListMemosResponse extends Message<ListMemosResponse> {
/**
* @generated from field: repeated memos.api.v2.Memo memos = 1;
*/
memos: Memo[];
/**
* @generated from field: int32 total = 2;
*/
total: number;
constructor(data?: PartialMessage<ListMemosResponse>);
static readonly runtime: typeof proto3;
static readonly typeName = "memos.api.v2.ListMemosResponse";
static readonly fields: FieldList;
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): ListMemosResponse;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): ListMemosResponse;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): ListMemosResponse;
static equals(a: ListMemosResponse | PlainMessage<ListMemosResponse> | undefined, b: ListMemosResponse | PlainMessage<ListMemosResponse> | undefined): boolean;
}
/**
* @generated from message memos.api.v2.GetMemoRequest
*/
export declare class GetMemoRequest extends Message<GetMemoRequest> {
/**
* @generated from field: int32 id = 1;
*/
id: number;
constructor(data?: PartialMessage<GetMemoRequest>);
static readonly runtime: typeof proto3;
static readonly typeName = "memos.api.v2.GetMemoRequest";
static readonly fields: FieldList;
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): GetMemoRequest;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): GetMemoRequest;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): GetMemoRequest;
static equals(a: GetMemoRequest | PlainMessage<GetMemoRequest> | undefined, b: GetMemoRequest | PlainMessage<GetMemoRequest> | undefined): boolean;
}
/**
* @generated from message memos.api.v2.GetMemoResponse
*/
export declare class GetMemoResponse extends Message<GetMemoResponse> {
/**
* @generated from field: memos.api.v2.Memo memo = 1;
*/
memo?: Memo;
constructor(data?: PartialMessage<GetMemoResponse>);
static readonly runtime: typeof proto3;
static readonly typeName = "memos.api.v2.GetMemoResponse";
static readonly fields: FieldList;
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): GetMemoResponse;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): GetMemoResponse;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): GetMemoResponse;
static equals(a: GetMemoResponse | PlainMessage<GetMemoResponse> | undefined, b: GetMemoResponse | PlainMessage<GetMemoResponse> | undefined): boolean;
}

@ -0,0 +1,81 @@
// @generated by protoc-gen-es v1.3.0
// @generated from file api/v2/memo_service.proto (package memos.api.v2, syntax proto3)
/* eslint-disable */
// @ts-nocheck
import { proto3 } from "@bufbuild/protobuf";
import { RowStatus } from "./common_pb.js";
/**
* @generated from enum memos.api.v2.Visibility
*/
export const Visibility = proto3.makeEnum(
"memos.api.v2.Visibility",
[
{no: 0, name: "VISIBILITY_UNSPECIFIED"},
{no: 1, name: "PRIVATE"},
{no: 2, name: "PROTECTED"},
{no: 3, name: "PUBLIC"},
],
);
/**
* @generated from message memos.api.v2.Memo
*/
export const Memo = proto3.makeMessageType(
"memos.api.v2.Memo",
() => [
{ no: 1, name: "id", kind: "scalar", T: 5 /* ScalarType.INT32 */ },
{ no: 2, name: "row_status", kind: "enum", T: proto3.getEnumType(RowStatus) },
{ no: 3, name: "creator_id", kind: "scalar", T: 5 /* ScalarType.INT32 */ },
{ no: 4, name: "created_ts", kind: "scalar", T: 3 /* ScalarType.INT64 */ },
{ no: 5, name: "updated_ts", kind: "scalar", T: 3 /* ScalarType.INT64 */ },
{ no: 6, name: "content", kind: "scalar", T: 9 /* ScalarType.STRING */ },
{ no: 7, name: "visibility", kind: "enum", T: proto3.getEnumType(Visibility) },
{ no: 8, name: "pinned", kind: "scalar", T: 8 /* ScalarType.BOOL */ },
],
);
/**
* @generated from message memos.api.v2.ListMemosRequest
*/
export const ListMemosRequest = proto3.makeMessageType(
"memos.api.v2.ListMemosRequest",
() => [
{ no: 1, name: "page", kind: "scalar", T: 5 /* ScalarType.INT32 */ },
{ no: 2, name: "page_size", kind: "scalar", T: 5 /* ScalarType.INT32 */ },
{ no: 3, name: "filter", kind: "scalar", T: 9 /* ScalarType.STRING */ },
],
);
/**
* @generated from message memos.api.v2.ListMemosResponse
*/
export const ListMemosResponse = proto3.makeMessageType(
"memos.api.v2.ListMemosResponse",
() => [
{ no: 1, name: "memos", kind: "message", T: Memo, repeated: true },
{ no: 2, name: "total", kind: "scalar", T: 5 /* ScalarType.INT32 */ },
],
);
/**
* @generated from message memos.api.v2.GetMemoRequest
*/
export const GetMemoRequest = proto3.makeMessageType(
"memos.api.v2.GetMemoRequest",
() => [
{ no: 1, name: "id", kind: "scalar", T: 5 /* ScalarType.INT32 */ },
],
);
/**
* @generated from message memos.api.v2.GetMemoResponse
*/
export const GetMemoResponse = proto3.makeMessageType(
"memos.api.v2.GetMemoResponse",
() => [
{ no: 1, name: "memo", kind: "message", T: Memo },
],
);

@ -0,0 +1,105 @@
// @generated by protoc-gen-es v1.3.0
// @generated from file api/v2/system_service.proto (package memos.api.v2, syntax proto3)
/* eslint-disable */
// @ts-nocheck
import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf";
import { Message, proto3 } from "@bufbuild/protobuf";
/**
* @generated from message memos.api.v2.SystemInfo
*/
export declare class SystemInfo extends Message<SystemInfo> {
/**
* @generated from field: string version = 1;
*/
version: string;
/**
* @generated from field: string mode = 2;
*/
mode: string;
/**
* @generated from field: bool allow_registration = 3;
*/
allowRegistration: boolean;
/**
* @generated from field: bool disable_password_login = 4;
*/
disablePasswordLogin: boolean;
/**
* @generated from field: string additional_script = 5;
*/
additionalScript: string;
/**
* @generated from field: string additional_style = 6;
*/
additionalStyle: string;
/**
* @generated from field: int64 db_size = 7;
*/
dbSize: bigint;
constructor(data?: PartialMessage<SystemInfo>);
static readonly runtime: typeof proto3;
static readonly typeName = "memos.api.v2.SystemInfo";
static readonly fields: FieldList;
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): SystemInfo;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): SystemInfo;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): SystemInfo;
static equals(a: SystemInfo | PlainMessage<SystemInfo> | undefined, b: SystemInfo | PlainMessage<SystemInfo> | undefined): boolean;
}
/**
* @generated from message memos.api.v2.GetSystemInfoRequest
*/
export declare class GetSystemInfoRequest extends Message<GetSystemInfoRequest> {
constructor(data?: PartialMessage<GetSystemInfoRequest>);
static readonly runtime: typeof proto3;
static readonly typeName = "memos.api.v2.GetSystemInfoRequest";
static readonly fields: FieldList;
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): GetSystemInfoRequest;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): GetSystemInfoRequest;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): GetSystemInfoRequest;
static equals(a: GetSystemInfoRequest | PlainMessage<GetSystemInfoRequest> | undefined, b: GetSystemInfoRequest | PlainMessage<GetSystemInfoRequest> | undefined): boolean;
}
/**
* @generated from message memos.api.v2.GetSystemInfoResponse
*/
export declare class GetSystemInfoResponse extends Message<GetSystemInfoResponse> {
/**
* @generated from field: memos.api.v2.SystemInfo system_info = 1;
*/
systemInfo?: SystemInfo;
constructor(data?: PartialMessage<GetSystemInfoResponse>);
static readonly runtime: typeof proto3;
static readonly typeName = "memos.api.v2.GetSystemInfoResponse";
static readonly fields: FieldList;
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): GetSystemInfoResponse;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): GetSystemInfoResponse;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): GetSystemInfoResponse;
static equals(a: GetSystemInfoResponse | PlainMessage<GetSystemInfoResponse> | undefined, b: GetSystemInfoResponse | PlainMessage<GetSystemInfoResponse> | undefined): boolean;
}

@ -0,0 +1,41 @@
// @generated by protoc-gen-es v1.3.0
// @generated from file api/v2/system_service.proto (package memos.api.v2, syntax proto3)
/* eslint-disable */
// @ts-nocheck
import { proto3 } from "@bufbuild/protobuf";
/**
* @generated from message memos.api.v2.SystemInfo
*/
export const SystemInfo = proto3.makeMessageType(
"memos.api.v2.SystemInfo",
() => [
{ no: 1, name: "version", kind: "scalar", T: 9 /* ScalarType.STRING */ },
{ no: 2, name: "mode", kind: "scalar", T: 9 /* ScalarType.STRING */ },
{ no: 3, name: "allow_registration", kind: "scalar", T: 8 /* ScalarType.BOOL */ },
{ no: 4, name: "disable_password_login", kind: "scalar", T: 8 /* ScalarType.BOOL */ },
{ no: 5, name: "additional_script", kind: "scalar", T: 9 /* ScalarType.STRING */ },
{ no: 6, name: "additional_style", kind: "scalar", T: 9 /* ScalarType.STRING */ },
{ no: 7, name: "db_size", kind: "scalar", T: 3 /* ScalarType.INT64 */ },
],
);
/**
* @generated from message memos.api.v2.GetSystemInfoRequest
*/
export const GetSystemInfoRequest = proto3.makeMessageType(
"memos.api.v2.GetSystemInfoRequest",
[],
);
/**
* @generated from message memos.api.v2.GetSystemInfoResponse
*/
export const GetSystemInfoResponse = proto3.makeMessageType(
"memos.api.v2.GetSystemInfoResponse",
() => [
{ no: 1, name: "system_info", kind: "message", T: SystemInfo },
],
);

@ -0,0 +1,85 @@
// @generated by protoc-gen-es v1.3.0
// @generated from file api/v2/tag_service.proto (package memos.api.v2, syntax proto3)
/* eslint-disable */
// @ts-nocheck
import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf";
import { Message, proto3 } from "@bufbuild/protobuf";
/**
* @generated from message memos.api.v2.Tag
*/
export declare class Tag extends Message<Tag> {
/**
* @generated from field: string name = 1;
*/
name: string;
/**
* @generated from field: int32 creator_id = 2;
*/
creatorId: number;
constructor(data?: PartialMessage<Tag>);
static readonly runtime: typeof proto3;
static readonly typeName = "memos.api.v2.Tag";
static readonly fields: FieldList;
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): Tag;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): Tag;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): Tag;
static equals(a: Tag | PlainMessage<Tag> | undefined, b: Tag | PlainMessage<Tag> | undefined): boolean;
}
/**
* @generated from message memos.api.v2.ListTagsRequest
*/
export declare class ListTagsRequest extends Message<ListTagsRequest> {
/**
* @generated from field: int32 creator_id = 1;
*/
creatorId: number;
constructor(data?: PartialMessage<ListTagsRequest>);
static readonly runtime: typeof proto3;
static readonly typeName = "memos.api.v2.ListTagsRequest";
static readonly fields: FieldList;
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): ListTagsRequest;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): ListTagsRequest;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): ListTagsRequest;
static equals(a: ListTagsRequest | PlainMessage<ListTagsRequest> | undefined, b: ListTagsRequest | PlainMessage<ListTagsRequest> | undefined): boolean;
}
/**
* @generated from message memos.api.v2.ListTagsResponse
*/
export declare class ListTagsResponse extends Message<ListTagsResponse> {
/**
* @generated from field: repeated memos.api.v2.Tag tags = 1;
*/
tags: Tag[];
constructor(data?: PartialMessage<ListTagsResponse>);
static readonly runtime: typeof proto3;
static readonly typeName = "memos.api.v2.ListTagsResponse";
static readonly fields: FieldList;
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): ListTagsResponse;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): ListTagsResponse;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): ListTagsResponse;
static equals(a: ListTagsResponse | PlainMessage<ListTagsResponse> | undefined, b: ListTagsResponse | PlainMessage<ListTagsResponse> | undefined): boolean;
}

@ -0,0 +1,38 @@
// @generated by protoc-gen-es v1.3.0
// @generated from file api/v2/tag_service.proto (package memos.api.v2, syntax proto3)
/* eslint-disable */
// @ts-nocheck
import { proto3 } from "@bufbuild/protobuf";
/**
* @generated from message memos.api.v2.Tag
*/
export const Tag = proto3.makeMessageType(
"memos.api.v2.Tag",
() => [
{ no: 1, name: "name", kind: "scalar", T: 9 /* ScalarType.STRING */ },
{ no: 2, name: "creator_id", kind: "scalar", T: 5 /* ScalarType.INT32 */ },
],
);
/**
* @generated from message memos.api.v2.ListTagsRequest
*/
export const ListTagsRequest = proto3.makeMessageType(
"memos.api.v2.ListTagsRequest",
() => [
{ no: 1, name: "creator_id", kind: "scalar", T: 5 /* ScalarType.INT32 */ },
],
);
/**
* @generated from message memos.api.v2.ListTagsResponse
*/
export const ListTagsResponse = proto3.makeMessageType(
"memos.api.v2.ListTagsResponse",
() => [
{ no: 1, name: "tags", kind: "message", T: Tag, repeated: true },
],
);

@ -0,0 +1,268 @@
// @generated by protoc-gen-es v1.3.0
// @generated from file api/v2/user_service.proto (package memos.api.v2, syntax proto3)
/* eslint-disable */
// @ts-nocheck
import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf";
import { Message, proto3 } from "@bufbuild/protobuf";
import type { RowStatus } from "./common_pb.js";
import type { Visibility } from "./memo_service_pb.js";
/**
* @generated from enum memos.api.v2.Role
*/
export declare enum Role {
/**
* @generated from enum value: ROLE_UNSPECIFIED = 0;
*/
ROLE_UNSPECIFIED = 0,
/**
* @generated from enum value: HOST = 1;
*/
HOST = 1,
/**
* @generated from enum value: ADMIN = 2;
*/
ADMIN = 2,
/**
* @generated from enum value: USER = 3;
*/
USER = 3,
}
/**
* @generated from message memos.api.v2.User
*/
export declare class User extends Message<User> {
/**
* @generated from field: int32 id = 1;
*/
id: number;
/**
* @generated from field: memos.api.v2.RowStatus row_status = 2;
*/
rowStatus: RowStatus;
/**
* @generated from field: int64 created_ts = 3;
*/
createdTs: bigint;
/**
* @generated from field: int64 updated_ts = 4;
*/
updatedTs: bigint;
/**
* @generated from field: string username = 5;
*/
username: string;
/**
* @generated from field: memos.api.v2.Role role = 6;
*/
role: Role;
/**
* @generated from field: string email = 7;
*/
email: string;
/**
* @generated from field: string nickname = 8;
*/
nickname: string;
/**
* @generated from field: string open_id = 9;
*/
openId: string;
/**
* @generated from field: string avatar_url = 10;
*/
avatarUrl: string;
constructor(data?: PartialMessage<User>);
static readonly runtime: typeof proto3;
static readonly typeName = "memos.api.v2.User";
static readonly fields: FieldList;
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): User;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): User;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): User;
static equals(a: User | PlainMessage<User> | undefined, b: User | PlainMessage<User> | undefined): boolean;
}
/**
* @generated from message memos.api.v2.GetUserRequest
*/
export declare class GetUserRequest extends Message<GetUserRequest> {
/**
* @generated from field: string name = 1;
*/
name: string;
constructor(data?: PartialMessage<GetUserRequest>);
static readonly runtime: typeof proto3;
static readonly typeName = "memos.api.v2.GetUserRequest";
static readonly fields: FieldList;
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): GetUserRequest;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): GetUserRequest;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): GetUserRequest;
static equals(a: GetUserRequest | PlainMessage<GetUserRequest> | undefined, b: GetUserRequest | PlainMessage<GetUserRequest> | undefined): boolean;
}
/**
* @generated from message memos.api.v2.GetUserResponse
*/
export declare class GetUserResponse extends Message<GetUserResponse> {
/**
* @generated from field: memos.api.v2.User user = 1;
*/
user?: User;
constructor(data?: PartialMessage<GetUserResponse>);
static readonly runtime: typeof proto3;
static readonly typeName = "memos.api.v2.GetUserResponse";
static readonly fields: FieldList;
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): GetUserResponse;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): GetUserResponse;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): GetUserResponse;
static equals(a: GetUserResponse | PlainMessage<GetUserResponse> | undefined, b: GetUserResponse | PlainMessage<GetUserResponse> | undefined): boolean;
}
/**
* @generated from message memos.api.v2.UserSetting
*/
export declare class UserSetting extends Message<UserSetting> {
/**
* The user id of the setting.
*
* @generated from field: int32 user_id = 1;
*/
userId: number;
/**
* The key of the setting.
*
* @generated from field: memos.api.v2.UserSetting.Key key = 2;
*/
key: UserSetting_Key;
/**
* The value of the setting.
*
* @generated from field: memos.api.v2.UserSettingValue value = 3;
*/
value?: UserSettingValue;
constructor(data?: PartialMessage<UserSetting>);
static readonly runtime: typeof proto3;
static readonly typeName = "memos.api.v2.UserSetting";
static readonly fields: FieldList;
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): UserSetting;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): UserSetting;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): UserSetting;
static equals(a: UserSetting | PlainMessage<UserSetting> | undefined, b: UserSetting | PlainMessage<UserSetting> | undefined): boolean;
}
/**
* @generated from enum memos.api.v2.UserSetting.Key
*/
export declare enum UserSetting_Key {
/**
* @generated from enum value: KEY_UNSPECIFIED = 0;
*/
KEY_UNSPECIFIED = 0,
/**
* The preferred locale.
*
* @generated from enum value: LOCALE = 1;
*/
LOCALE = 1,
/**
* The preferred appearance.
*
* @generated from enum value: APPEARANCE = 2;
*/
APPEARANCE = 2,
/**
* The default visibility of the memo when creating a new memo.
*
* @generated from enum value: MEMO_VISIBILITY = 3;
*/
MEMO_VISIBILITY = 3,
/**
* User's telegram id
*
* @generated from enum value: TELEGRAM_USER_ID = 4;
*/
TELEGRAM_USER_ID = 4,
}
/**
* @generated from message memos.api.v2.UserSettingValue
*/
export declare class UserSettingValue extends Message<UserSettingValue> {
/**
* @generated from oneof memos.api.v2.UserSettingValue.value
*/
value: {
/**
* Default value as a string.
*
* @generated from field: string string_value = 1;
*/
value: string;
case: "stringValue";
} | {
/**
* @generated from field: memos.api.v2.Visibility visibility_value = 2;
*/
value: Visibility;
case: "visibilityValue";
} | { case: undefined; value?: undefined };
constructor(data?: PartialMessage<UserSettingValue>);
static readonly runtime: typeof proto3;
static readonly typeName = "memos.api.v2.UserSettingValue";
static readonly fields: FieldList;
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): UserSettingValue;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): UserSettingValue;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): UserSettingValue;
static equals(a: UserSettingValue | PlainMessage<UserSettingValue> | undefined, b: UserSettingValue | PlainMessage<UserSettingValue> | undefined): boolean;
}

@ -0,0 +1,98 @@
// @generated by protoc-gen-es v1.3.0
// @generated from file api/v2/user_service.proto (package memos.api.v2, syntax proto3)
/* eslint-disable */
// @ts-nocheck
import { proto3 } from "@bufbuild/protobuf";
import { RowStatus } from "./common_pb.js";
import { Visibility } from "./memo_service_pb.js";
/**
* @generated from enum memos.api.v2.Role
*/
export const Role = proto3.makeEnum(
"memos.api.v2.Role",
[
{no: 0, name: "ROLE_UNSPECIFIED"},
{no: 1, name: "HOST"},
{no: 2, name: "ADMIN"},
{no: 3, name: "USER"},
],
);
/**
* @generated from message memos.api.v2.User
*/
export const User = proto3.makeMessageType(
"memos.api.v2.User",
() => [
{ no: 1, name: "id", kind: "scalar", T: 5 /* ScalarType.INT32 */ },
{ no: 2, name: "row_status", kind: "enum", T: proto3.getEnumType(RowStatus) },
{ no: 3, name: "created_ts", kind: "scalar", T: 3 /* ScalarType.INT64 */ },
{ no: 4, name: "updated_ts", kind: "scalar", T: 3 /* ScalarType.INT64 */ },
{ no: 5, name: "username", kind: "scalar", T: 9 /* ScalarType.STRING */ },
{ no: 6, name: "role", kind: "enum", T: proto3.getEnumType(Role) },
{ no: 7, name: "email", kind: "scalar", T: 9 /* ScalarType.STRING */ },
{ no: 8, name: "nickname", kind: "scalar", T: 9 /* ScalarType.STRING */ },
{ no: 9, name: "open_id", kind: "scalar", T: 9 /* ScalarType.STRING */ },
{ no: 10, name: "avatar_url", kind: "scalar", T: 9 /* ScalarType.STRING */ },
],
);
/**
* @generated from message memos.api.v2.GetUserRequest
*/
export const GetUserRequest = proto3.makeMessageType(
"memos.api.v2.GetUserRequest",
() => [
{ no: 1, name: "name", kind: "scalar", T: 9 /* ScalarType.STRING */ },
],
);
/**
* @generated from message memos.api.v2.GetUserResponse
*/
export const GetUserResponse = proto3.makeMessageType(
"memos.api.v2.GetUserResponse",
() => [
{ no: 1, name: "user", kind: "message", T: User },
],
);
/**
* @generated from message memos.api.v2.UserSetting
*/
export const UserSetting = proto3.makeMessageType(
"memos.api.v2.UserSetting",
() => [
{ no: 1, name: "user_id", kind: "scalar", T: 5 /* ScalarType.INT32 */ },
{ no: 2, name: "key", kind: "enum", T: proto3.getEnumType(UserSetting_Key) },
{ no: 3, name: "value", kind: "message", T: UserSettingValue },
],
);
/**
* @generated from enum memos.api.v2.UserSetting.Key
*/
export const UserSetting_Key = proto3.makeEnum(
"memos.api.v2.UserSetting.Key",
[
{no: 0, name: "KEY_UNSPECIFIED"},
{no: 1, name: "LOCALE"},
{no: 2, name: "APPEARANCE"},
{no: 3, name: "MEMO_VISIBILITY"},
{no: 4, name: "TELEGRAM_USER_ID"},
],
);
/**
* @generated from message memos.api.v2.UserSettingValue
*/
export const UserSettingValue = proto3.makeMessageType(
"memos.api.v2.UserSettingValue",
() => [
{ no: 1, name: "string_value", kind: "scalar", T: 9 /* ScalarType.STRING */, oneof: "value" },
{ no: 2, name: "visibility_value", kind: "enum", T: proto3.getEnumType(Visibility), oneof: "value" },
],
);
Loading…
Cancel
Save