chore: add frontend type definitions (#2482)

chore: update
This commit is contained in:
boojack 2023-11-06 21:00:42 +08:00 committed by GitHub
parent 865cc997a4
commit 64d4db81ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
23 changed files with 11969 additions and 1 deletions

1
web/.gitignore vendored
View File

@ -3,4 +3,3 @@ node_modules
dist
dist-ssr
*.local
src/types/proto

View File

@ -0,0 +1,372 @@
/* eslint-disable */
import _m0 from "protobufjs/minimal";
import { Timestamp } from "../../google/protobuf/timestamp";
export const protobufPackage = "memos.api.v2";
export interface Activity {
id: number;
creatorId: number;
type: string;
level: string;
createTime?: Date | undefined;
payload?: ActivityPayload | undefined;
}
export interface ActivityMemoCommentPayload {
memoId: number;
relatedMemoId: number;
}
export interface ActivityPayload {
memoComment?: ActivityMemoCommentPayload | undefined;
}
export interface GetActivityRequest {
id: number;
}
export interface GetActivityResponse {
activity?: Activity | undefined;
}
function createBaseActivity(): Activity {
return { id: 0, creatorId: 0, type: "", level: "", createTime: undefined, payload: undefined };
}
export const Activity = {
encode(message: Activity, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.id !== 0) {
writer.uint32(8).int32(message.id);
}
if (message.creatorId !== 0) {
writer.uint32(16).int32(message.creatorId);
}
if (message.type !== "") {
writer.uint32(26).string(message.type);
}
if (message.level !== "") {
writer.uint32(34).string(message.level);
}
if (message.createTime !== undefined) {
Timestamp.encode(toTimestamp(message.createTime), writer.uint32(42).fork()).ldelim();
}
if (message.payload !== undefined) {
ActivityPayload.encode(message.payload, writer.uint32(50).fork()).ldelim();
}
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): Activity {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseActivity();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 8) {
break;
}
message.id = reader.int32();
continue;
case 2:
if (tag !== 16) {
break;
}
message.creatorId = reader.int32();
continue;
case 3:
if (tag !== 26) {
break;
}
message.type = reader.string();
continue;
case 4:
if (tag !== 34) {
break;
}
message.level = reader.string();
continue;
case 5:
if (tag !== 42) {
break;
}
message.createTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
continue;
case 6:
if (tag !== 50) {
break;
}
message.payload = ActivityPayload.decode(reader, reader.uint32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
create(base?: DeepPartial<Activity>): Activity {
return Activity.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<Activity>): Activity {
const message = createBaseActivity();
message.id = object.id ?? 0;
message.creatorId = object.creatorId ?? 0;
message.type = object.type ?? "";
message.level = object.level ?? "";
message.createTime = object.createTime ?? undefined;
message.payload = (object.payload !== undefined && object.payload !== null)
? ActivityPayload.fromPartial(object.payload)
: undefined;
return message;
},
};
function createBaseActivityMemoCommentPayload(): ActivityMemoCommentPayload {
return { memoId: 0, relatedMemoId: 0 };
}
export const ActivityMemoCommentPayload = {
encode(message: ActivityMemoCommentPayload, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.memoId !== 0) {
writer.uint32(8).int32(message.memoId);
}
if (message.relatedMemoId !== 0) {
writer.uint32(16).int32(message.relatedMemoId);
}
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): ActivityMemoCommentPayload {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseActivityMemoCommentPayload();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 8) {
break;
}
message.memoId = reader.int32();
continue;
case 2:
if (tag !== 16) {
break;
}
message.relatedMemoId = reader.int32();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
create(base?: DeepPartial<ActivityMemoCommentPayload>): ActivityMemoCommentPayload {
return ActivityMemoCommentPayload.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<ActivityMemoCommentPayload>): ActivityMemoCommentPayload {
const message = createBaseActivityMemoCommentPayload();
message.memoId = object.memoId ?? 0;
message.relatedMemoId = object.relatedMemoId ?? 0;
return message;
},
};
function createBaseActivityPayload(): ActivityPayload {
return { memoComment: undefined };
}
export const ActivityPayload = {
encode(message: ActivityPayload, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.memoComment !== undefined) {
ActivityMemoCommentPayload.encode(message.memoComment, writer.uint32(10).fork()).ldelim();
}
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): ActivityPayload {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseActivityPayload();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.memoComment = ActivityMemoCommentPayload.decode(reader, reader.uint32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
create(base?: DeepPartial<ActivityPayload>): ActivityPayload {
return ActivityPayload.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<ActivityPayload>): ActivityPayload {
const message = createBaseActivityPayload();
message.memoComment = (object.memoComment !== undefined && object.memoComment !== null)
? ActivityMemoCommentPayload.fromPartial(object.memoComment)
: undefined;
return message;
},
};
function createBaseGetActivityRequest(): GetActivityRequest {
return { id: 0 };
}
export const GetActivityRequest = {
encode(message: GetActivityRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.id !== 0) {
writer.uint32(8).int32(message.id);
}
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): GetActivityRequest {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseGetActivityRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 8) {
break;
}
message.id = reader.int32();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
create(base?: DeepPartial<GetActivityRequest>): GetActivityRequest {
return GetActivityRequest.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<GetActivityRequest>): GetActivityRequest {
const message = createBaseGetActivityRequest();
message.id = object.id ?? 0;
return message;
},
};
function createBaseGetActivityResponse(): GetActivityResponse {
return { activity: undefined };
}
export const GetActivityResponse = {
encode(message: GetActivityResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.activity !== undefined) {
Activity.encode(message.activity, writer.uint32(10).fork()).ldelim();
}
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): GetActivityResponse {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseGetActivityResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.activity = Activity.decode(reader, reader.uint32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
create(base?: DeepPartial<GetActivityResponse>): GetActivityResponse {
return GetActivityResponse.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<GetActivityResponse>): GetActivityResponse {
const message = createBaseGetActivityResponse();
message.activity = (object.activity !== undefined && object.activity !== null)
? Activity.fromPartial(object.activity)
: undefined;
return message;
},
};
export type ActivityServiceDefinition = typeof ActivityServiceDefinition;
export const ActivityServiceDefinition = {
name: "ActivityService",
fullName: "memos.api.v2.ActivityService",
methods: {
getActivity: {
name: "GetActivity",
requestType: GetActivityRequest,
requestStream: false,
responseType: GetActivityResponse,
responseStream: false,
options: {
_unknownFields: {
578365826: [new Uint8Array([16, 18, 14, 47, 118, 50, 47, 97, 99, 116, 105, 118, 105, 116, 105, 101, 115])],
},
},
},
},
} as const;
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
export type DeepPartial<T> = T extends Builtin ? T
: T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
: T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
: Partial<T>;
function toTimestamp(date: Date): Timestamp {
const seconds = date.getTime() / 1_000;
const nanos = (date.getTime() % 1_000) * 1_000_000;
return { seconds, nanos };
}
function fromTimestamp(t: Timestamp): Date {
let millis = (t.seconds || 0) * 1_000;
millis += (t.nanos || 0) / 1_000_000;
return new Date(millis);
}

View File

@ -0,0 +1,10 @@
/* eslint-disable */
export const protobufPackage = "memos.api.v2";
export enum RowStatus {
ROW_STATUS_UNSPECIFIED = 0,
ACTIVE = 1,
ARCHIVED = 2,
UNRECOGNIZED = -1,
}

View File

@ -0,0 +1,569 @@
/* eslint-disable */
import _m0 from "protobufjs/minimal";
import { FieldMask } from "../../google/protobuf/field_mask";
import { Timestamp } from "../../google/protobuf/timestamp";
export const protobufPackage = "memos.api.v2";
export interface Inbox {
/**
* The name of the inbox.
* Format: inboxes/{id}
*/
name: string;
/** Format: users/{username} */
sender: string;
/** Format: users/{username} */
receiver: string;
status: Inbox_Status;
createTime?: Date | undefined;
type: Inbox_Type;
activityId?: number | undefined;
}
export enum Inbox_Status {
STATUS_UNSPECIFIED = 0,
UNREAD = 1,
ARCHIVED = 2,
UNRECOGNIZED = -1,
}
export enum Inbox_Type {
TYPE_UNSPECIFIED = 0,
TYPE_MEMO_COMMENT = 1,
UNRECOGNIZED = -1,
}
export interface ListInboxesRequest {
/** Format: users/{username} */
user: string;
}
export interface ListInboxesResponse {
inboxes: Inbox[];
}
export interface UpdateInboxRequest {
inbox?: Inbox | undefined;
updateMask?: string[] | undefined;
}
export interface UpdateInboxResponse {
inbox?: Inbox | undefined;
}
export interface DeleteInboxRequest {
/**
* The name of the inbox to delete.
* Format: inboxes/{inbox}
*/
name: string;
}
export interface DeleteInboxResponse {
}
function createBaseInbox(): Inbox {
return { name: "", sender: "", receiver: "", status: 0, createTime: undefined, type: 0, activityId: undefined };
}
export const Inbox = {
encode(message: Inbox, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.name !== "") {
writer.uint32(10).string(message.name);
}
if (message.sender !== "") {
writer.uint32(18).string(message.sender);
}
if (message.receiver !== "") {
writer.uint32(26).string(message.receiver);
}
if (message.status !== 0) {
writer.uint32(32).int32(message.status);
}
if (message.createTime !== undefined) {
Timestamp.encode(toTimestamp(message.createTime), writer.uint32(42).fork()).ldelim();
}
if (message.type !== 0) {
writer.uint32(48).int32(message.type);
}
if (message.activityId !== undefined) {
writer.uint32(56).int32(message.activityId);
}
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): Inbox {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseInbox();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.name = reader.string();
continue;
case 2:
if (tag !== 18) {
break;
}
message.sender = reader.string();
continue;
case 3:
if (tag !== 26) {
break;
}
message.receiver = reader.string();
continue;
case 4:
if (tag !== 32) {
break;
}
message.status = reader.int32() as any;
continue;
case 5:
if (tag !== 42) {
break;
}
message.createTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
continue;
case 6:
if (tag !== 48) {
break;
}
message.type = reader.int32() as any;
continue;
case 7:
if (tag !== 56) {
break;
}
message.activityId = reader.int32();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
create(base?: DeepPartial<Inbox>): Inbox {
return Inbox.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<Inbox>): Inbox {
const message = createBaseInbox();
message.name = object.name ?? "";
message.sender = object.sender ?? "";
message.receiver = object.receiver ?? "";
message.status = object.status ?? 0;
message.createTime = object.createTime ?? undefined;
message.type = object.type ?? 0;
message.activityId = object.activityId ?? undefined;
return message;
},
};
function createBaseListInboxesRequest(): ListInboxesRequest {
return { user: "" };
}
export const ListInboxesRequest = {
encode(message: ListInboxesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.user !== "") {
writer.uint32(10).string(message.user);
}
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): ListInboxesRequest {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseListInboxesRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.user = reader.string();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
create(base?: DeepPartial<ListInboxesRequest>): ListInboxesRequest {
return ListInboxesRequest.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<ListInboxesRequest>): ListInboxesRequest {
const message = createBaseListInboxesRequest();
message.user = object.user ?? "";
return message;
},
};
function createBaseListInboxesResponse(): ListInboxesResponse {
return { inboxes: [] };
}
export const ListInboxesResponse = {
encode(message: ListInboxesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
for (const v of message.inboxes) {
Inbox.encode(v!, writer.uint32(10).fork()).ldelim();
}
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): ListInboxesResponse {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseListInboxesResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.inboxes.push(Inbox.decode(reader, reader.uint32()));
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
create(base?: DeepPartial<ListInboxesResponse>): ListInboxesResponse {
return ListInboxesResponse.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<ListInboxesResponse>): ListInboxesResponse {
const message = createBaseListInboxesResponse();
message.inboxes = object.inboxes?.map((e) => Inbox.fromPartial(e)) || [];
return message;
},
};
function createBaseUpdateInboxRequest(): UpdateInboxRequest {
return { inbox: undefined, updateMask: undefined };
}
export const UpdateInboxRequest = {
encode(message: UpdateInboxRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.inbox !== undefined) {
Inbox.encode(message.inbox, writer.uint32(10).fork()).ldelim();
}
if (message.updateMask !== undefined) {
FieldMask.encode(FieldMask.wrap(message.updateMask), writer.uint32(18).fork()).ldelim();
}
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): UpdateInboxRequest {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseUpdateInboxRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.inbox = Inbox.decode(reader, reader.uint32());
continue;
case 2:
if (tag !== 18) {
break;
}
message.updateMask = FieldMask.unwrap(FieldMask.decode(reader, reader.uint32()));
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
create(base?: DeepPartial<UpdateInboxRequest>): UpdateInboxRequest {
return UpdateInboxRequest.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<UpdateInboxRequest>): UpdateInboxRequest {
const message = createBaseUpdateInboxRequest();
message.inbox = (object.inbox !== undefined && object.inbox !== null) ? Inbox.fromPartial(object.inbox) : undefined;
message.updateMask = object.updateMask ?? undefined;
return message;
},
};
function createBaseUpdateInboxResponse(): UpdateInboxResponse {
return { inbox: undefined };
}
export const UpdateInboxResponse = {
encode(message: UpdateInboxResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.inbox !== undefined) {
Inbox.encode(message.inbox, writer.uint32(10).fork()).ldelim();
}
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): UpdateInboxResponse {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseUpdateInboxResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.inbox = Inbox.decode(reader, reader.uint32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
create(base?: DeepPartial<UpdateInboxResponse>): UpdateInboxResponse {
return UpdateInboxResponse.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<UpdateInboxResponse>): UpdateInboxResponse {
const message = createBaseUpdateInboxResponse();
message.inbox = (object.inbox !== undefined && object.inbox !== null) ? Inbox.fromPartial(object.inbox) : undefined;
return message;
},
};
function createBaseDeleteInboxRequest(): DeleteInboxRequest {
return { name: "" };
}
export const DeleteInboxRequest = {
encode(message: DeleteInboxRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.name !== "") {
writer.uint32(10).string(message.name);
}
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): DeleteInboxRequest {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseDeleteInboxRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.name = reader.string();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
create(base?: DeepPartial<DeleteInboxRequest>): DeleteInboxRequest {
return DeleteInboxRequest.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<DeleteInboxRequest>): DeleteInboxRequest {
const message = createBaseDeleteInboxRequest();
message.name = object.name ?? "";
return message;
},
};
function createBaseDeleteInboxResponse(): DeleteInboxResponse {
return {};
}
export const DeleteInboxResponse = {
encode(_: DeleteInboxResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): DeleteInboxResponse {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseDeleteInboxResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
create(base?: DeepPartial<DeleteInboxResponse>): DeleteInboxResponse {
return DeleteInboxResponse.fromPartial(base ?? {});
},
fromPartial(_: DeepPartial<DeleteInboxResponse>): DeleteInboxResponse {
const message = createBaseDeleteInboxResponse();
return message;
},
};
export type InboxServiceDefinition = typeof InboxServiceDefinition;
export const InboxServiceDefinition = {
name: "InboxService",
fullName: "memos.api.v2.InboxService",
methods: {
listInboxes: {
name: "ListInboxes",
requestType: ListInboxesRequest,
requestStream: false,
responseType: ListInboxesResponse,
responseStream: false,
options: {
_unknownFields: {
578365826: [
new Uint8Array([17, 18, 15, 47, 97, 112, 105, 47, 118, 50, 47, 105, 110, 98, 111, 120, 101, 115]),
],
},
},
},
updateInbox: {
name: "UpdateInbox",
requestType: UpdateInboxRequest,
requestStream: false,
responseType: UpdateInboxResponse,
responseStream: false,
options: {
_unknownFields: {
8410: [new Uint8Array([17, 105, 110, 98, 111, 120, 44, 117, 112, 100, 97, 116, 101, 95, 109, 97, 115, 107])],
578365826: [
new Uint8Array([
20,
58,
5,
105,
110,
98,
111,
120,
50,
11,
47,
118,
50,
47,
105,
110,
98,
111,
120,
101,
115,
]),
],
},
},
},
deleteInbox: {
name: "DeleteInbox",
requestType: DeleteInboxRequest,
requestStream: false,
responseType: DeleteInboxResponse,
responseStream: false,
options: {
_unknownFields: {
8410: [new Uint8Array([4, 110, 97, 109, 101])],
578365826: [
new Uint8Array([
22,
42,
20,
47,
118,
50,
47,
123,
110,
97,
109,
101,
61,
105,
110,
98,
111,
120,
101,
115,
47,
42,
125,
]),
],
},
},
},
},
} as const;
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
export type DeepPartial<T> = T extends Builtin ? T
: T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
: T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
: Partial<T>;
function toTimestamp(date: Date): Timestamp {
const seconds = date.getTime() / 1_000;
const nanos = (date.getTime() % 1_000) * 1_000_000;
return { seconds, nanos };
}
function fromTimestamp(t: Timestamp): Date {
let millis = (t.seconds || 0) * 1_000;
millis += (t.nanos || 0) / 1_000_000;
return new Date(millis);
}

View File

@ -0,0 +1,911 @@
/* eslint-disable */
import Long from "long";
import _m0 from "protobufjs/minimal";
import { RowStatus } from "./common";
export const protobufPackage = "memos.api.v2";
export enum Visibility {
VISIBILITY_UNSPECIFIED = 0,
PRIVATE = 1,
PROTECTED = 2,
PUBLIC = 3,
UNRECOGNIZED = -1,
}
export interface Memo {
id: number;
rowStatus: RowStatus;
creatorId: number;
createdTs: number;
updatedTs: number;
content: string;
visibility: Visibility;
pinned: boolean;
}
export interface CreateMemoRequest {
content: string;
visibility: Visibility;
}
export interface CreateMemoResponse {
memo?: Memo | undefined;
}
export interface ListMemosRequest {
page: number;
pageSize: number;
/** Filter is used to filter memos returned in the list. */
filter: string;
creatorId?: number | undefined;
}
export interface ListMemosResponse {
memos: Memo[];
}
export interface GetMemoRequest {
id: number;
}
export interface GetMemoResponse {
memo?: Memo | undefined;
}
export interface CreateMemoCommentRequest {
/** id is the memo id to create comment for. */
id: number;
create?: CreateMemoRequest | undefined;
}
export interface CreateMemoCommentResponse {
memo?: Memo | undefined;
}
export interface ListMemoCommentsRequest {
id: number;
}
export interface ListMemoCommentsResponse {
memos: Memo[];
}
function createBaseMemo(): Memo {
return { id: 0, rowStatus: 0, creatorId: 0, createdTs: 0, updatedTs: 0, content: "", visibility: 0, pinned: false };
}
export const Memo = {
encode(message: Memo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.id !== 0) {
writer.uint32(8).int32(message.id);
}
if (message.rowStatus !== 0) {
writer.uint32(16).int32(message.rowStatus);
}
if (message.creatorId !== 0) {
writer.uint32(24).int32(message.creatorId);
}
if (message.createdTs !== 0) {
writer.uint32(32).int64(message.createdTs);
}
if (message.updatedTs !== 0) {
writer.uint32(40).int64(message.updatedTs);
}
if (message.content !== "") {
writer.uint32(50).string(message.content);
}
if (message.visibility !== 0) {
writer.uint32(56).int32(message.visibility);
}
if (message.pinned === true) {
writer.uint32(64).bool(message.pinned);
}
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): Memo {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseMemo();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 8) {
break;
}
message.id = reader.int32();
continue;
case 2:
if (tag !== 16) {
break;
}
message.rowStatus = reader.int32() as any;
continue;
case 3:
if (tag !== 24) {
break;
}
message.creatorId = reader.int32();
continue;
case 4:
if (tag !== 32) {
break;
}
message.createdTs = longToNumber(reader.int64() as Long);
continue;
case 5:
if (tag !== 40) {
break;
}
message.updatedTs = longToNumber(reader.int64() as Long);
continue;
case 6:
if (tag !== 50) {
break;
}
message.content = reader.string();
continue;
case 7:
if (tag !== 56) {
break;
}
message.visibility = reader.int32() as any;
continue;
case 8:
if (tag !== 64) {
break;
}
message.pinned = reader.bool();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
create(base?: DeepPartial<Memo>): Memo {
return Memo.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<Memo>): Memo {
const message = createBaseMemo();
message.id = object.id ?? 0;
message.rowStatus = object.rowStatus ?? 0;
message.creatorId = object.creatorId ?? 0;
message.createdTs = object.createdTs ?? 0;
message.updatedTs = object.updatedTs ?? 0;
message.content = object.content ?? "";
message.visibility = object.visibility ?? 0;
message.pinned = object.pinned ?? false;
return message;
},
};
function createBaseCreateMemoRequest(): CreateMemoRequest {
return { content: "", visibility: 0 };
}
export const CreateMemoRequest = {
encode(message: CreateMemoRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.content !== "") {
writer.uint32(10).string(message.content);
}
if (message.visibility !== 0) {
writer.uint32(16).int32(message.visibility);
}
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): CreateMemoRequest {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseCreateMemoRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.content = reader.string();
continue;
case 2:
if (tag !== 16) {
break;
}
message.visibility = reader.int32() as any;
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
create(base?: DeepPartial<CreateMemoRequest>): CreateMemoRequest {
return CreateMemoRequest.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<CreateMemoRequest>): CreateMemoRequest {
const message = createBaseCreateMemoRequest();
message.content = object.content ?? "";
message.visibility = object.visibility ?? 0;
return message;
},
};
function createBaseCreateMemoResponse(): CreateMemoResponse {
return { memo: undefined };
}
export const CreateMemoResponse = {
encode(message: CreateMemoResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.memo !== undefined) {
Memo.encode(message.memo, writer.uint32(10).fork()).ldelim();
}
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): CreateMemoResponse {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseCreateMemoResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.memo = Memo.decode(reader, reader.uint32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
create(base?: DeepPartial<CreateMemoResponse>): CreateMemoResponse {
return CreateMemoResponse.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<CreateMemoResponse>): CreateMemoResponse {
const message = createBaseCreateMemoResponse();
message.memo = (object.memo !== undefined && object.memo !== null) ? Memo.fromPartial(object.memo) : undefined;
return message;
},
};
function createBaseListMemosRequest(): ListMemosRequest {
return { page: 0, pageSize: 0, filter: "", creatorId: undefined };
}
export const ListMemosRequest = {
encode(message: ListMemosRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.page !== 0) {
writer.uint32(8).int32(message.page);
}
if (message.pageSize !== 0) {
writer.uint32(16).int32(message.pageSize);
}
if (message.filter !== "") {
writer.uint32(26).string(message.filter);
}
if (message.creatorId !== undefined) {
writer.uint32(32).int32(message.creatorId);
}
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): ListMemosRequest {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseListMemosRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 8) {
break;
}
message.page = reader.int32();
continue;
case 2:
if (tag !== 16) {
break;
}
message.pageSize = reader.int32();
continue;
case 3:
if (tag !== 26) {
break;
}
message.filter = reader.string();
continue;
case 4:
if (tag !== 32) {
break;
}
message.creatorId = reader.int32();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
create(base?: DeepPartial<ListMemosRequest>): ListMemosRequest {
return ListMemosRequest.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<ListMemosRequest>): ListMemosRequest {
const message = createBaseListMemosRequest();
message.page = object.page ?? 0;
message.pageSize = object.pageSize ?? 0;
message.filter = object.filter ?? "";
message.creatorId = object.creatorId ?? undefined;
return message;
},
};
function createBaseListMemosResponse(): ListMemosResponse {
return { memos: [] };
}
export const ListMemosResponse = {
encode(message: ListMemosResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
for (const v of message.memos) {
Memo.encode(v!, writer.uint32(10).fork()).ldelim();
}
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): ListMemosResponse {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseListMemosResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.memos.push(Memo.decode(reader, reader.uint32()));
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
create(base?: DeepPartial<ListMemosResponse>): ListMemosResponse {
return ListMemosResponse.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<ListMemosResponse>): ListMemosResponse {
const message = createBaseListMemosResponse();
message.memos = object.memos?.map((e) => Memo.fromPartial(e)) || [];
return message;
},
};
function createBaseGetMemoRequest(): GetMemoRequest {
return { id: 0 };
}
export const GetMemoRequest = {
encode(message: GetMemoRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.id !== 0) {
writer.uint32(8).int32(message.id);
}
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): GetMemoRequest {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseGetMemoRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 8) {
break;
}
message.id = reader.int32();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
create(base?: DeepPartial<GetMemoRequest>): GetMemoRequest {
return GetMemoRequest.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<GetMemoRequest>): GetMemoRequest {
const message = createBaseGetMemoRequest();
message.id = object.id ?? 0;
return message;
},
};
function createBaseGetMemoResponse(): GetMemoResponse {
return { memo: undefined };
}
export const GetMemoResponse = {
encode(message: GetMemoResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.memo !== undefined) {
Memo.encode(message.memo, writer.uint32(10).fork()).ldelim();
}
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): GetMemoResponse {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseGetMemoResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.memo = Memo.decode(reader, reader.uint32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
create(base?: DeepPartial<GetMemoResponse>): GetMemoResponse {
return GetMemoResponse.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<GetMemoResponse>): GetMemoResponse {
const message = createBaseGetMemoResponse();
message.memo = (object.memo !== undefined && object.memo !== null) ? Memo.fromPartial(object.memo) : undefined;
return message;
},
};
function createBaseCreateMemoCommentRequest(): CreateMemoCommentRequest {
return { id: 0, create: undefined };
}
export const CreateMemoCommentRequest = {
encode(message: CreateMemoCommentRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.id !== 0) {
writer.uint32(8).int32(message.id);
}
if (message.create !== undefined) {
CreateMemoRequest.encode(message.create, writer.uint32(18).fork()).ldelim();
}
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): CreateMemoCommentRequest {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseCreateMemoCommentRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 8) {
break;
}
message.id = reader.int32();
continue;
case 2:
if (tag !== 18) {
break;
}
message.create = CreateMemoRequest.decode(reader, reader.uint32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
create(base?: DeepPartial<CreateMemoCommentRequest>): CreateMemoCommentRequest {
return CreateMemoCommentRequest.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<CreateMemoCommentRequest>): CreateMemoCommentRequest {
const message = createBaseCreateMemoCommentRequest();
message.id = object.id ?? 0;
message.create = (object.create !== undefined && object.create !== null)
? CreateMemoRequest.fromPartial(object.create)
: undefined;
return message;
},
};
function createBaseCreateMemoCommentResponse(): CreateMemoCommentResponse {
return { memo: undefined };
}
export const CreateMemoCommentResponse = {
encode(message: CreateMemoCommentResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.memo !== undefined) {
Memo.encode(message.memo, writer.uint32(10).fork()).ldelim();
}
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): CreateMemoCommentResponse {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseCreateMemoCommentResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.memo = Memo.decode(reader, reader.uint32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
create(base?: DeepPartial<CreateMemoCommentResponse>): CreateMemoCommentResponse {
return CreateMemoCommentResponse.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<CreateMemoCommentResponse>): CreateMemoCommentResponse {
const message = createBaseCreateMemoCommentResponse();
message.memo = (object.memo !== undefined && object.memo !== null) ? Memo.fromPartial(object.memo) : undefined;
return message;
},
};
function createBaseListMemoCommentsRequest(): ListMemoCommentsRequest {
return { id: 0 };
}
export const ListMemoCommentsRequest = {
encode(message: ListMemoCommentsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.id !== 0) {
writer.uint32(8).int32(message.id);
}
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): ListMemoCommentsRequest {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseListMemoCommentsRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 8) {
break;
}
message.id = reader.int32();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
create(base?: DeepPartial<ListMemoCommentsRequest>): ListMemoCommentsRequest {
return ListMemoCommentsRequest.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<ListMemoCommentsRequest>): ListMemoCommentsRequest {
const message = createBaseListMemoCommentsRequest();
message.id = object.id ?? 0;
return message;
},
};
function createBaseListMemoCommentsResponse(): ListMemoCommentsResponse {
return { memos: [] };
}
export const ListMemoCommentsResponse = {
encode(message: ListMemoCommentsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
for (const v of message.memos) {
Memo.encode(v!, writer.uint32(10).fork()).ldelim();
}
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): ListMemoCommentsResponse {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseListMemoCommentsResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.memos.push(Memo.decode(reader, reader.uint32()));
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
create(base?: DeepPartial<ListMemoCommentsResponse>): ListMemoCommentsResponse {
return ListMemoCommentsResponse.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<ListMemoCommentsResponse>): ListMemoCommentsResponse {
const message = createBaseListMemoCommentsResponse();
message.memos = object.memos?.map((e) => Memo.fromPartial(e)) || [];
return message;
},
};
export type MemoServiceDefinition = typeof MemoServiceDefinition;
export const MemoServiceDefinition = {
name: "MemoService",
fullName: "memos.api.v2.MemoService",
methods: {
createMemo: {
name: "CreateMemo",
requestType: CreateMemoRequest,
requestStream: false,
responseType: CreateMemoResponse,
responseStream: false,
options: {
_unknownFields: {
578365826: [new Uint8Array([15, 34, 13, 47, 97, 112, 105, 47, 118, 50, 47, 109, 101, 109, 111, 115])],
},
},
},
listMemos: {
name: "ListMemos",
requestType: ListMemosRequest,
requestStream: false,
responseType: ListMemosResponse,
responseStream: false,
options: {
_unknownFields: {
578365826: [new Uint8Array([15, 18, 13, 47, 97, 112, 105, 47, 118, 50, 47, 109, 101, 109, 111, 115])],
},
},
},
getMemo: {
name: "GetMemo",
requestType: GetMemoRequest,
requestStream: false,
responseType: GetMemoResponse,
responseStream: false,
options: {
_unknownFields: {
8410: [new Uint8Array([2, 105, 100])],
578365826: [
new Uint8Array([
20,
18,
18,
47,
97,
112,
105,
47,
118,
50,
47,
109,
101,
109,
111,
115,
47,
123,
105,
100,
125,
]),
],
},
},
},
createMemoComment: {
name: "CreateMemoComment",
requestType: CreateMemoCommentRequest,
requestStream: false,
responseType: CreateMemoCommentResponse,
responseStream: false,
options: {
_unknownFields: {
8410: [new Uint8Array([2, 105, 100])],
578365826: [
new Uint8Array([
29,
34,
27,
47,
97,
112,
105,
47,
118,
50,
47,
109,
101,
109,
111,
115,
47,
123,
105,
100,
125,
47,
99,
111,
109,
109,
101,
110,
116,
115,
]),
],
},
},
},
listMemoComments: {
name: "ListMemoComments",
requestType: ListMemoCommentsRequest,
requestStream: false,
responseType: ListMemoCommentsResponse,
responseStream: false,
options: {
_unknownFields: {
8410: [new Uint8Array([2, 105, 100])],
578365826: [
new Uint8Array([
29,
18,
27,
47,
97,
112,
105,
47,
118,
50,
47,
109,
101,
109,
111,
115,
47,
123,
105,
100,
125,
47,
99,
111,
109,
109,
101,
110,
116,
115,
]),
],
},
},
},
},
} as const;
declare const self: any | undefined;
declare const window: any | undefined;
declare const global: any | undefined;
const tsProtoGlobalThis: any = (() => {
if (typeof globalThis !== "undefined") {
return globalThis;
}
if (typeof self !== "undefined") {
return self;
}
if (typeof window !== "undefined") {
return window;
}
if (typeof global !== "undefined") {
return global;
}
throw "Unable to locate global object";
})();
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
export type DeepPartial<T> = T extends Builtin ? T
: T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
: T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
: Partial<T>;
function longToNumber(long: Long): number {
if (long.gt(Number.MAX_SAFE_INTEGER)) {
throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
}
return long.toNumber();
}
if (_m0.util.Long !== Long) {
_m0.util.Long = Long as any;
_m0.configure();
}

View File

@ -0,0 +1,770 @@
/* eslint-disable */
import Long from "long";
import _m0 from "protobufjs/minimal";
import { FieldMask } from "../../google/protobuf/field_mask";
import { Timestamp } from "../../google/protobuf/timestamp";
export const protobufPackage = "memos.api.v2";
export interface Resource {
id: number;
createdTs?: Date | undefined;
filename: string;
externalLink: string;
type: string;
size: number;
memoId?: number | undefined;
}
export interface CreateResourceRequest {
filename: string;
externalLink: string;
type: string;
memoId?: number | undefined;
}
export interface CreateResourceResponse {
resource?: Resource | undefined;
}
export interface ListResourcesRequest {
}
export interface ListResourcesResponse {
resources: Resource[];
}
export interface UpdateResourceRequest {
resource?: Resource | undefined;
updateMask?: string[] | undefined;
}
export interface UpdateResourceResponse {
resource?: Resource | undefined;
}
export interface DeleteResourceRequest {
id: number;
}
export interface DeleteResourceResponse {
}
function createBaseResource(): Resource {
return { id: 0, createdTs: undefined, filename: "", externalLink: "", type: "", size: 0, memoId: undefined };
}
export const Resource = {
encode(message: Resource, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.id !== 0) {
writer.uint32(8).int32(message.id);
}
if (message.createdTs !== undefined) {
Timestamp.encode(toTimestamp(message.createdTs), writer.uint32(18).fork()).ldelim();
}
if (message.filename !== "") {
writer.uint32(26).string(message.filename);
}
if (message.externalLink !== "") {
writer.uint32(34).string(message.externalLink);
}
if (message.type !== "") {
writer.uint32(42).string(message.type);
}
if (message.size !== 0) {
writer.uint32(48).int64(message.size);
}
if (message.memoId !== undefined) {
writer.uint32(56).int32(message.memoId);
}
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): Resource {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseResource();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 8) {
break;
}
message.id = reader.int32();
continue;
case 2:
if (tag !== 18) {
break;
}
message.createdTs = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
continue;
case 3:
if (tag !== 26) {
break;
}
message.filename = reader.string();
continue;
case 4:
if (tag !== 34) {
break;
}
message.externalLink = reader.string();
continue;
case 5:
if (tag !== 42) {
break;
}
message.type = reader.string();
continue;
case 6:
if (tag !== 48) {
break;
}
message.size = longToNumber(reader.int64() as Long);
continue;
case 7:
if (tag !== 56) {
break;
}
message.memoId = reader.int32();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
create(base?: DeepPartial<Resource>): Resource {
return Resource.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<Resource>): Resource {
const message = createBaseResource();
message.id = object.id ?? 0;
message.createdTs = object.createdTs ?? undefined;
message.filename = object.filename ?? "";
message.externalLink = object.externalLink ?? "";
message.type = object.type ?? "";
message.size = object.size ?? 0;
message.memoId = object.memoId ?? undefined;
return message;
},
};
function createBaseCreateResourceRequest(): CreateResourceRequest {
return { filename: "", externalLink: "", type: "", memoId: undefined };
}
export const CreateResourceRequest = {
encode(message: CreateResourceRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.filename !== "") {
writer.uint32(10).string(message.filename);
}
if (message.externalLink !== "") {
writer.uint32(18).string(message.externalLink);
}
if (message.type !== "") {
writer.uint32(26).string(message.type);
}
if (message.memoId !== undefined) {
writer.uint32(32).int32(message.memoId);
}
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): CreateResourceRequest {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseCreateResourceRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.filename = reader.string();
continue;
case 2:
if (tag !== 18) {
break;
}
message.externalLink = reader.string();
continue;
case 3:
if (tag !== 26) {
break;
}
message.type = reader.string();
continue;
case 4:
if (tag !== 32) {
break;
}
message.memoId = reader.int32();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
create(base?: DeepPartial<CreateResourceRequest>): CreateResourceRequest {
return CreateResourceRequest.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<CreateResourceRequest>): CreateResourceRequest {
const message = createBaseCreateResourceRequest();
message.filename = object.filename ?? "";
message.externalLink = object.externalLink ?? "";
message.type = object.type ?? "";
message.memoId = object.memoId ?? undefined;
return message;
},
};
function createBaseCreateResourceResponse(): CreateResourceResponse {
return { resource: undefined };
}
export const CreateResourceResponse = {
encode(message: CreateResourceResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.resource !== undefined) {
Resource.encode(message.resource, writer.uint32(10).fork()).ldelim();
}
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): CreateResourceResponse {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseCreateResourceResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.resource = Resource.decode(reader, reader.uint32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
create(base?: DeepPartial<CreateResourceResponse>): CreateResourceResponse {
return CreateResourceResponse.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<CreateResourceResponse>): CreateResourceResponse {
const message = createBaseCreateResourceResponse();
message.resource = (object.resource !== undefined && object.resource !== null)
? Resource.fromPartial(object.resource)
: undefined;
return message;
},
};
function createBaseListResourcesRequest(): ListResourcesRequest {
return {};
}
export const ListResourcesRequest = {
encode(_: ListResourcesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): ListResourcesRequest {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseListResourcesRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
create(base?: DeepPartial<ListResourcesRequest>): ListResourcesRequest {
return ListResourcesRequest.fromPartial(base ?? {});
},
fromPartial(_: DeepPartial<ListResourcesRequest>): ListResourcesRequest {
const message = createBaseListResourcesRequest();
return message;
},
};
function createBaseListResourcesResponse(): ListResourcesResponse {
return { resources: [] };
}
export const ListResourcesResponse = {
encode(message: ListResourcesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
for (const v of message.resources) {
Resource.encode(v!, writer.uint32(10).fork()).ldelim();
}
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): ListResourcesResponse {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseListResourcesResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.resources.push(Resource.decode(reader, reader.uint32()));
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
create(base?: DeepPartial<ListResourcesResponse>): ListResourcesResponse {
return ListResourcesResponse.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<ListResourcesResponse>): ListResourcesResponse {
const message = createBaseListResourcesResponse();
message.resources = object.resources?.map((e) => Resource.fromPartial(e)) || [];
return message;
},
};
function createBaseUpdateResourceRequest(): UpdateResourceRequest {
return { resource: undefined, updateMask: undefined };
}
export const UpdateResourceRequest = {
encode(message: UpdateResourceRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.resource !== undefined) {
Resource.encode(message.resource, writer.uint32(10).fork()).ldelim();
}
if (message.updateMask !== undefined) {
FieldMask.encode(FieldMask.wrap(message.updateMask), writer.uint32(18).fork()).ldelim();
}
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): UpdateResourceRequest {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseUpdateResourceRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.resource = Resource.decode(reader, reader.uint32());
continue;
case 2:
if (tag !== 18) {
break;
}
message.updateMask = FieldMask.unwrap(FieldMask.decode(reader, reader.uint32()));
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
create(base?: DeepPartial<UpdateResourceRequest>): UpdateResourceRequest {
return UpdateResourceRequest.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<UpdateResourceRequest>): UpdateResourceRequest {
const message = createBaseUpdateResourceRequest();
message.resource = (object.resource !== undefined && object.resource !== null)
? Resource.fromPartial(object.resource)
: undefined;
message.updateMask = object.updateMask ?? undefined;
return message;
},
};
function createBaseUpdateResourceResponse(): UpdateResourceResponse {
return { resource: undefined };
}
export const UpdateResourceResponse = {
encode(message: UpdateResourceResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.resource !== undefined) {
Resource.encode(message.resource, writer.uint32(10).fork()).ldelim();
}
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): UpdateResourceResponse {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseUpdateResourceResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.resource = Resource.decode(reader, reader.uint32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
create(base?: DeepPartial<UpdateResourceResponse>): UpdateResourceResponse {
return UpdateResourceResponse.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<UpdateResourceResponse>): UpdateResourceResponse {
const message = createBaseUpdateResourceResponse();
message.resource = (object.resource !== undefined && object.resource !== null)
? Resource.fromPartial(object.resource)
: undefined;
return message;
},
};
function createBaseDeleteResourceRequest(): DeleteResourceRequest {
return { id: 0 };
}
export const DeleteResourceRequest = {
encode(message: DeleteResourceRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.id !== 0) {
writer.uint32(8).int32(message.id);
}
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): DeleteResourceRequest {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseDeleteResourceRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 8) {
break;
}
message.id = reader.int32();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
create(base?: DeepPartial<DeleteResourceRequest>): DeleteResourceRequest {
return DeleteResourceRequest.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<DeleteResourceRequest>): DeleteResourceRequest {
const message = createBaseDeleteResourceRequest();
message.id = object.id ?? 0;
return message;
},
};
function createBaseDeleteResourceResponse(): DeleteResourceResponse {
return {};
}
export const DeleteResourceResponse = {
encode(_: DeleteResourceResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): DeleteResourceResponse {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseDeleteResourceResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
create(base?: DeepPartial<DeleteResourceResponse>): DeleteResourceResponse {
return DeleteResourceResponse.fromPartial(base ?? {});
},
fromPartial(_: DeepPartial<DeleteResourceResponse>): DeleteResourceResponse {
const message = createBaseDeleteResourceResponse();
return message;
},
};
export type ResourceServiceDefinition = typeof ResourceServiceDefinition;
export const ResourceServiceDefinition = {
name: "ResourceService",
fullName: "memos.api.v2.ResourceService",
methods: {
createResource: {
name: "CreateResource",
requestType: CreateResourceRequest,
requestStream: false,
responseType: CreateResourceResponse,
responseStream: false,
options: {
_unknownFields: {
578365826: [
new Uint8Array([19, 34, 17, 47, 97, 112, 105, 47, 118, 50, 47, 114, 101, 115, 111, 117, 114, 99, 101, 115]),
],
},
},
},
listResources: {
name: "ListResources",
requestType: ListResourcesRequest,
requestStream: false,
responseType: ListResourcesResponse,
responseStream: false,
options: {
_unknownFields: {
578365826: [
new Uint8Array([19, 18, 17, 47, 97, 112, 105, 47, 118, 50, 47, 114, 101, 115, 111, 117, 114, 99, 101, 115]),
],
},
},
},
updateResource: {
name: "UpdateResource",
requestType: UpdateResourceRequest,
requestStream: false,
responseType: UpdateResourceResponse,
responseStream: false,
options: {
_unknownFields: {
8410: [
new Uint8Array([
20,
114,
101,
115,
111,
117,
114,
99,
101,
44,
117,
112,
100,
97,
116,
101,
95,
109,
97,
115,
107,
]),
],
578365826: [
new Uint8Array([
43,
58,
8,
114,
101,
115,
111,
117,
114,
99,
101,
50,
31,
47,
97,
112,
105,
47,
118,
50,
47,
114,
101,
115,
111,
117,
114,
99,
101,
115,
47,
123,
114,
101,
115,
111,
117,
114,
99,
101,
46,
105,
100,
125,
]),
],
},
},
},
deleteResource: {
name: "DeleteResource",
requestType: DeleteResourceRequest,
requestStream: false,
responseType: DeleteResourceResponse,
responseStream: false,
options: {
_unknownFields: {
8410: [new Uint8Array([2, 105, 100])],
578365826: [
new Uint8Array([
24,
18,
22,
47,
97,
112,
105,
47,
118,
50,
47,
114,
101,
115,
111,
117,
114,
99,
101,
115,
47,
123,
105,
100,
125,
]),
],
},
},
},
},
} as const;
declare const self: any | undefined;
declare const window: any | undefined;
declare const global: any | undefined;
const tsProtoGlobalThis: any = (() => {
if (typeof globalThis !== "undefined") {
return globalThis;
}
if (typeof self !== "undefined") {
return self;
}
if (typeof window !== "undefined") {
return window;
}
if (typeof global !== "undefined") {
return global;
}
throw "Unable to locate global object";
})();
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
export type DeepPartial<T> = T extends Builtin ? T
: T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
: T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
: Partial<T>;
function toTimestamp(date: Date): Timestamp {
const seconds = date.getTime() / 1_000;
const nanos = (date.getTime() % 1_000) * 1_000_000;
return { seconds, nanos };
}
function fromTimestamp(t: Timestamp): Date {
let millis = (t.seconds || 0) * 1_000;
millis += (t.nanos || 0) / 1_000_000;
return new Date(millis);
}
function longToNumber(long: Long): number {
if (long.gt(Number.MAX_SAFE_INTEGER)) {
throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
}
return long.toNumber();
}
if (_m0.util.Long !== Long) {
_m0.util.Long = Long as any;
_m0.configure();
}

View File

@ -0,0 +1,504 @@
/* eslint-disable */
import Long from "long";
import _m0 from "protobufjs/minimal";
import { FieldMask } from "../../google/protobuf/field_mask";
export const protobufPackage = "memos.api.v2";
export interface SystemInfo {
version: string;
mode: string;
allowRegistration: boolean;
disablePasswordLogin: boolean;
additionalScript: string;
additionalStyle: string;
dbSize: number;
}
export interface GetSystemInfoRequest {
}
export interface GetSystemInfoResponse {
systemInfo?: SystemInfo | undefined;
}
export interface UpdateSystemInfoRequest {
/** System info is the updated data. */
systemInfo?: SystemInfo | undefined;
updateMask?: string[] | undefined;
}
export interface UpdateSystemInfoResponse {
systemInfo?: SystemInfo | undefined;
}
function createBaseSystemInfo(): SystemInfo {
return {
version: "",
mode: "",
allowRegistration: false,
disablePasswordLogin: false,
additionalScript: "",
additionalStyle: "",
dbSize: 0,
};
}
export const SystemInfo = {
encode(message: SystemInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.version !== "") {
writer.uint32(10).string(message.version);
}
if (message.mode !== "") {
writer.uint32(18).string(message.mode);
}
if (message.allowRegistration === true) {
writer.uint32(24).bool(message.allowRegistration);
}
if (message.disablePasswordLogin === true) {
writer.uint32(32).bool(message.disablePasswordLogin);
}
if (message.additionalScript !== "") {
writer.uint32(42).string(message.additionalScript);
}
if (message.additionalStyle !== "") {
writer.uint32(50).string(message.additionalStyle);
}
if (message.dbSize !== 0) {
writer.uint32(56).int64(message.dbSize);
}
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): SystemInfo {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseSystemInfo();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.version = reader.string();
continue;
case 2:
if (tag !== 18) {
break;
}
message.mode = reader.string();
continue;
case 3:
if (tag !== 24) {
break;
}
message.allowRegistration = reader.bool();
continue;
case 4:
if (tag !== 32) {
break;
}
message.disablePasswordLogin = reader.bool();
continue;
case 5:
if (tag !== 42) {
break;
}
message.additionalScript = reader.string();
continue;
case 6:
if (tag !== 50) {
break;
}
message.additionalStyle = reader.string();
continue;
case 7:
if (tag !== 56) {
break;
}
message.dbSize = longToNumber(reader.int64() as Long);
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
create(base?: DeepPartial<SystemInfo>): SystemInfo {
return SystemInfo.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<SystemInfo>): SystemInfo {
const message = createBaseSystemInfo();
message.version = object.version ?? "";
message.mode = object.mode ?? "";
message.allowRegistration = object.allowRegistration ?? false;
message.disablePasswordLogin = object.disablePasswordLogin ?? false;
message.additionalScript = object.additionalScript ?? "";
message.additionalStyle = object.additionalStyle ?? "";
message.dbSize = object.dbSize ?? 0;
return message;
},
};
function createBaseGetSystemInfoRequest(): GetSystemInfoRequest {
return {};
}
export const GetSystemInfoRequest = {
encode(_: GetSystemInfoRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): GetSystemInfoRequest {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseGetSystemInfoRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
create(base?: DeepPartial<GetSystemInfoRequest>): GetSystemInfoRequest {
return GetSystemInfoRequest.fromPartial(base ?? {});
},
fromPartial(_: DeepPartial<GetSystemInfoRequest>): GetSystemInfoRequest {
const message = createBaseGetSystemInfoRequest();
return message;
},
};
function createBaseGetSystemInfoResponse(): GetSystemInfoResponse {
return { systemInfo: undefined };
}
export const GetSystemInfoResponse = {
encode(message: GetSystemInfoResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.systemInfo !== undefined) {
SystemInfo.encode(message.systemInfo, writer.uint32(10).fork()).ldelim();
}
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): GetSystemInfoResponse {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseGetSystemInfoResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.systemInfo = SystemInfo.decode(reader, reader.uint32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
create(base?: DeepPartial<GetSystemInfoResponse>): GetSystemInfoResponse {
return GetSystemInfoResponse.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<GetSystemInfoResponse>): GetSystemInfoResponse {
const message = createBaseGetSystemInfoResponse();
message.systemInfo = (object.systemInfo !== undefined && object.systemInfo !== null)
? SystemInfo.fromPartial(object.systemInfo)
: undefined;
return message;
},
};
function createBaseUpdateSystemInfoRequest(): UpdateSystemInfoRequest {
return { systemInfo: undefined, updateMask: undefined };
}
export const UpdateSystemInfoRequest = {
encode(message: UpdateSystemInfoRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.systemInfo !== undefined) {
SystemInfo.encode(message.systemInfo, writer.uint32(10).fork()).ldelim();
}
if (message.updateMask !== undefined) {
FieldMask.encode(FieldMask.wrap(message.updateMask), writer.uint32(18).fork()).ldelim();
}
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): UpdateSystemInfoRequest {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseUpdateSystemInfoRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.systemInfo = SystemInfo.decode(reader, reader.uint32());
continue;
case 2:
if (tag !== 18) {
break;
}
message.updateMask = FieldMask.unwrap(FieldMask.decode(reader, reader.uint32()));
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
create(base?: DeepPartial<UpdateSystemInfoRequest>): UpdateSystemInfoRequest {
return UpdateSystemInfoRequest.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<UpdateSystemInfoRequest>): UpdateSystemInfoRequest {
const message = createBaseUpdateSystemInfoRequest();
message.systemInfo = (object.systemInfo !== undefined && object.systemInfo !== null)
? SystemInfo.fromPartial(object.systemInfo)
: undefined;
message.updateMask = object.updateMask ?? undefined;
return message;
},
};
function createBaseUpdateSystemInfoResponse(): UpdateSystemInfoResponse {
return { systemInfo: undefined };
}
export const UpdateSystemInfoResponse = {
encode(message: UpdateSystemInfoResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.systemInfo !== undefined) {
SystemInfo.encode(message.systemInfo, writer.uint32(10).fork()).ldelim();
}
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): UpdateSystemInfoResponse {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseUpdateSystemInfoResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.systemInfo = SystemInfo.decode(reader, reader.uint32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
create(base?: DeepPartial<UpdateSystemInfoResponse>): UpdateSystemInfoResponse {
return UpdateSystemInfoResponse.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<UpdateSystemInfoResponse>): UpdateSystemInfoResponse {
const message = createBaseUpdateSystemInfoResponse();
message.systemInfo = (object.systemInfo !== undefined && object.systemInfo !== null)
? SystemInfo.fromPartial(object.systemInfo)
: undefined;
return message;
},
};
export type SystemServiceDefinition = typeof SystemServiceDefinition;
export const SystemServiceDefinition = {
name: "SystemService",
fullName: "memos.api.v2.SystemService",
methods: {
getSystemInfo: {
name: "GetSystemInfo",
requestType: GetSystemInfoRequest,
requestStream: false,
responseType: GetSystemInfoResponse,
responseStream: false,
options: {
_unknownFields: {
578365826: [
new Uint8Array([
21,
18,
19,
47,
97,
112,
105,
47,
118,
50,
47,
115,
121,
115,
116,
101,
109,
47,
105,
110,
102,
111,
]),
],
},
},
},
updateSystemInfo: {
name: "UpdateSystemInfo",
requestType: UpdateSystemInfoRequest,
requestStream: false,
responseType: UpdateSystemInfoResponse,
responseStream: false,
options: {
_unknownFields: {
8410: [
new Uint8Array([
23,
115,
121,
115,
116,
101,
109,
95,
105,
110,
102,
111,
44,
117,
112,
100,
97,
116,
101,
95,
109,
97,
115,
107,
]),
],
578365826: [
new Uint8Array([
34,
58,
11,
115,
121,
115,
116,
101,
109,
95,
105,
110,
102,
111,
50,
19,
47,
97,
112,
105,
47,
118,
50,
47,
115,
121,
115,
116,
101,
109,
47,
105,
110,
102,
111,
]),
],
},
},
},
},
} as const;
declare const self: any | undefined;
declare const window: any | undefined;
declare const global: any | undefined;
const tsProtoGlobalThis: any = (() => {
if (typeof globalThis !== "undefined") {
return globalThis;
}
if (typeof self !== "undefined") {
return self;
}
if (typeof window !== "undefined") {
return window;
}
if (typeof global !== "undefined") {
return global;
}
throw "Unable to locate global object";
})();
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
export type DeepPartial<T> = T extends Builtin ? T
: T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
: T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
: Partial<T>;
function longToNumber(long: Long): number {
if (long.gt(Number.MAX_SAFE_INTEGER)) {
throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
}
return long.toNumber();
}
if (_m0.util.Long !== Long) {
_m0.util.Long = Long as any;
_m0.configure();
}

View File

@ -0,0 +1,413 @@
/* eslint-disable */
import _m0 from "protobufjs/minimal";
export const protobufPackage = "memos.api.v2";
export interface Tag {
name: string;
/**
* The creator of tags.
* Format: users/{username}
*/
creator: string;
}
export interface UpsertTagRequest {
name: string;
}
export interface UpsertTagResponse {
tag?: Tag | undefined;
}
export interface ListTagsRequest {
/**
* The creator of tags.
* Format: users/{username}
*/
creator: string;
}
export interface ListTagsResponse {
tags: Tag[];
}
export interface DeleteTagRequest {
tag?: Tag | undefined;
}
export interface DeleteTagResponse {
}
function createBaseTag(): Tag {
return { name: "", creator: "" };
}
export const Tag = {
encode(message: Tag, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.name !== "") {
writer.uint32(10).string(message.name);
}
if (message.creator !== "") {
writer.uint32(18).string(message.creator);
}
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): Tag {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseTag();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.name = reader.string();
continue;
case 2:
if (tag !== 18) {
break;
}
message.creator = reader.string();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
create(base?: DeepPartial<Tag>): Tag {
return Tag.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<Tag>): Tag {
const message = createBaseTag();
message.name = object.name ?? "";
message.creator = object.creator ?? "";
return message;
},
};
function createBaseUpsertTagRequest(): UpsertTagRequest {
return { name: "" };
}
export const UpsertTagRequest = {
encode(message: UpsertTagRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.name !== "") {
writer.uint32(10).string(message.name);
}
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): UpsertTagRequest {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseUpsertTagRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.name = reader.string();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
create(base?: DeepPartial<UpsertTagRequest>): UpsertTagRequest {
return UpsertTagRequest.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<UpsertTagRequest>): UpsertTagRequest {
const message = createBaseUpsertTagRequest();
message.name = object.name ?? "";
return message;
},
};
function createBaseUpsertTagResponse(): UpsertTagResponse {
return { tag: undefined };
}
export const UpsertTagResponse = {
encode(message: UpsertTagResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.tag !== undefined) {
Tag.encode(message.tag, writer.uint32(10).fork()).ldelim();
}
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): UpsertTagResponse {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseUpsertTagResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.tag = Tag.decode(reader, reader.uint32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
create(base?: DeepPartial<UpsertTagResponse>): UpsertTagResponse {
return UpsertTagResponse.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<UpsertTagResponse>): UpsertTagResponse {
const message = createBaseUpsertTagResponse();
message.tag = (object.tag !== undefined && object.tag !== null) ? Tag.fromPartial(object.tag) : undefined;
return message;
},
};
function createBaseListTagsRequest(): ListTagsRequest {
return { creator: "" };
}
export const ListTagsRequest = {
encode(message: ListTagsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.creator !== "") {
writer.uint32(10).string(message.creator);
}
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): ListTagsRequest {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseListTagsRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.creator = reader.string();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
create(base?: DeepPartial<ListTagsRequest>): ListTagsRequest {
return ListTagsRequest.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<ListTagsRequest>): ListTagsRequest {
const message = createBaseListTagsRequest();
message.creator = object.creator ?? "";
return message;
},
};
function createBaseListTagsResponse(): ListTagsResponse {
return { tags: [] };
}
export const ListTagsResponse = {
encode(message: ListTagsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
for (const v of message.tags) {
Tag.encode(v!, writer.uint32(10).fork()).ldelim();
}
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): ListTagsResponse {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseListTagsResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.tags.push(Tag.decode(reader, reader.uint32()));
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
create(base?: DeepPartial<ListTagsResponse>): ListTagsResponse {
return ListTagsResponse.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<ListTagsResponse>): ListTagsResponse {
const message = createBaseListTagsResponse();
message.tags = object.tags?.map((e) => Tag.fromPartial(e)) || [];
return message;
},
};
function createBaseDeleteTagRequest(): DeleteTagRequest {
return { tag: undefined };
}
export const DeleteTagRequest = {
encode(message: DeleteTagRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.tag !== undefined) {
Tag.encode(message.tag, writer.uint32(10).fork()).ldelim();
}
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): DeleteTagRequest {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseDeleteTagRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.tag = Tag.decode(reader, reader.uint32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
create(base?: DeepPartial<DeleteTagRequest>): DeleteTagRequest {
return DeleteTagRequest.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<DeleteTagRequest>): DeleteTagRequest {
const message = createBaseDeleteTagRequest();
message.tag = (object.tag !== undefined && object.tag !== null) ? Tag.fromPartial(object.tag) : undefined;
return message;
},
};
function createBaseDeleteTagResponse(): DeleteTagResponse {
return {};
}
export const DeleteTagResponse = {
encode(_: DeleteTagResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): DeleteTagResponse {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseDeleteTagResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
create(base?: DeepPartial<DeleteTagResponse>): DeleteTagResponse {
return DeleteTagResponse.fromPartial(base ?? {});
},
fromPartial(_: DeepPartial<DeleteTagResponse>): DeleteTagResponse {
const message = createBaseDeleteTagResponse();
return message;
},
};
export type TagServiceDefinition = typeof TagServiceDefinition;
export const TagServiceDefinition = {
name: "TagService",
fullName: "memos.api.v2.TagService",
methods: {
upsertTag: {
name: "UpsertTag",
requestType: UpsertTagRequest,
requestStream: false,
responseType: UpsertTagResponse,
responseStream: false,
options: {
_unknownFields: {
578365826: [new Uint8Array([14, 34, 12, 47, 97, 112, 105, 47, 118, 50, 47, 116, 97, 103, 115])],
},
},
},
listTags: {
name: "ListTags",
requestType: ListTagsRequest,
requestStream: false,
responseType: ListTagsResponse,
responseStream: false,
options: {
_unknownFields: {
578365826: [new Uint8Array([14, 18, 12, 47, 97, 112, 105, 47, 118, 50, 47, 116, 97, 103, 115])],
},
},
},
deleteTag: {
name: "DeleteTag",
requestType: DeleteTagRequest,
requestStream: false,
responseType: DeleteTagResponse,
responseStream: false,
options: {
_unknownFields: {
578365826: [new Uint8Array([14, 42, 12, 47, 97, 112, 105, 47, 118, 50, 47, 116, 97, 103, 115])],
},
},
},
},
} as const;
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
export type DeepPartial<T> = T extends Builtin ? T
: T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
: T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
: Partial<T>;

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,3 @@
/* eslint-disable */
export const protobufPackage = "google.api";

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,62 @@
/* eslint-disable */
export const protobufPackage = "google.api";
/**
* An indicator of the behavior of a given field (for example, that a field
* is required in requests, or given as output but ignored as input).
* This **does not** change the behavior in protocol buffers itself; it only
* denotes the behavior and may affect how API tooling handles the field.
*
* Note: This enum **may** receive new values in the future.
*/
export enum FieldBehavior {
/** FIELD_BEHAVIOR_UNSPECIFIED - Conventional default for enums. Do not use this. */
FIELD_BEHAVIOR_UNSPECIFIED = 0,
/**
* OPTIONAL - Specifically denotes a field as optional.
* While all fields in protocol buffers are optional, this may be specified
* for emphasis if appropriate.
*/
OPTIONAL = 1,
/**
* REQUIRED - Denotes a field as required.
* This indicates that the field **must** be provided as part of the request,
* and failure to do so will cause an error (usually `INVALID_ARGUMENT`).
*/
REQUIRED = 2,
/**
* OUTPUT_ONLY - Denotes a field as output only.
* This indicates that the field is provided in responses, but including the
* field in a request does nothing (the server *must* ignore it and
* *must not* throw an error as a result of the field's presence).
*/
OUTPUT_ONLY = 3,
/**
* INPUT_ONLY - Denotes a field as input only.
* This indicates that the field is provided in requests, and the
* corresponding field is not included in output.
*/
INPUT_ONLY = 4,
/**
* IMMUTABLE - Denotes a field as immutable.
* This indicates that the field may be set once in a request to create a
* resource, but may not be changed thereafter.
*/
IMMUTABLE = 5,
/**
* UNORDERED_LIST - Denotes that a (repeated) field is an unordered list.
* This indicates that the service may provide the elements of the list
* in any arbitrary order, rather than the order the user originally
* provided. Additionally, the list's order may or may not be stable.
*/
UNORDERED_LIST = 6,
/**
* NON_EMPTY_DEFAULT - Denotes that this field returns a non-empty default value if not set.
* This indicates that if the user provides the empty value in a request,
* a non-empty value will be returned. The user will not be aware of what
* non-empty value to expect.
*/
NON_EMPTY_DEFAULT = 7,
UNRECOGNIZED = -1,
}

View File

@ -0,0 +1,653 @@
/* eslint-disable */
import _m0 from "protobufjs/minimal";
export const protobufPackage = "google.api";
/**
* Defines the HTTP configuration for an API service. It contains a list of
* [HttpRule][google.api.HttpRule], each specifying the mapping of an RPC method
* to one or more HTTP REST API methods.
*/
export interface Http {
/**
* A list of HTTP configuration rules that apply to individual API methods.
*
* **NOTE:** All service configuration rules follow "last one wins" order.
*/
rules: HttpRule[];
/**
* When set to true, URL path parameters will be fully URI-decoded except in
* cases of single segment matches in reserved expansion, where "%2F" will be
* left encoded.
*
* The default behavior is to not decode RFC 6570 reserved characters in multi
* segment matches.
*/
fullyDecodeReservedExpansion: boolean;
}
/**
* # gRPC Transcoding
*
* gRPC Transcoding is a feature for mapping between a gRPC method and one or
* more HTTP REST endpoints. It allows developers to build a single API service
* that supports both gRPC APIs and REST APIs. Many systems, including [Google
* APIs](https://github.com/googleapis/googleapis),
* [Cloud Endpoints](https://cloud.google.com/endpoints), [gRPC
* Gateway](https://github.com/grpc-ecosystem/grpc-gateway),
* and [Envoy](https://github.com/envoyproxy/envoy) proxy support this feature
* and use it for large scale production services.
*
* `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies
* how different portions of the gRPC request message are mapped to the URL
* path, URL query parameters, and HTTP request body. It also controls how the
* gRPC response message is mapped to the HTTP response body. `HttpRule` is
* typically specified as an `google.api.http` annotation on the gRPC method.
*
* Each mapping specifies a URL path template and an HTTP method. The path
* template may refer to one or more fields in the gRPC request message, as long
* as each field is a non-repeated field with a primitive (non-message) type.
* The path template controls how fields of the request message are mapped to
* the URL path.
*
* Example:
*
* service Messaging {
* rpc GetMessage(GetMessageRequest) returns (Message) {
* option (google.api.http) = {
* get: "/v1/{name=messages/*}"
* };
* }
* }
* message GetMessageRequest {
* string name = 1; // Mapped to URL path.
* }
* message Message {
* string text = 1; // The resource content.
* }
*
* This enables an HTTP REST to gRPC mapping as below:
*
* HTTP | gRPC
* -----|-----
* `GET /v1/messages/123456` | `GetMessage(name: "messages/123456")`
*
* Any fields in the request message which are not bound by the path template
* automatically become HTTP query parameters if there is no HTTP request body.
* For example:
*
* service Messaging {
* rpc GetMessage(GetMessageRequest) returns (Message) {
* option (google.api.http) = {
* get:"/v1/messages/{message_id}"
* };
* }
* }
* message GetMessageRequest {
* message SubMessage {
* string subfield = 1;
* }
* string message_id = 1; // Mapped to URL path.
* int64 revision = 2; // Mapped to URL query parameter `revision`.
* SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`.
* }
*
* This enables a HTTP JSON to RPC mapping as below:
*
* HTTP | gRPC
* -----|-----
* `GET /v1/messages/123456?revision=2&sub.subfield=foo` |
* `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield:
* "foo"))`
*
* Note that fields which are mapped to URL query parameters must have a
* primitive type or a repeated primitive type or a non-repeated message type.
* In the case of a repeated type, the parameter can be repeated in the URL
* as `...?param=A&param=B`. In the case of a message type, each field of the
* message is mapped to a separate parameter, such as
* `...?foo.a=A&foo.b=B&foo.c=C`.
*
* For HTTP methods that allow a request body, the `body` field
* specifies the mapping. Consider a REST update method on the
* message resource collection:
*
* service Messaging {
* rpc UpdateMessage(UpdateMessageRequest) returns (Message) {
* option (google.api.http) = {
* patch: "/v1/messages/{message_id}"
* body: "message"
* };
* }
* }
* message UpdateMessageRequest {
* string message_id = 1; // mapped to the URL
* Message message = 2; // mapped to the body
* }
*
* The following HTTP JSON to RPC mapping is enabled, where the
* representation of the JSON in the request body is determined by
* protos JSON encoding:
*
* HTTP | gRPC
* -----|-----
* `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id:
* "123456" message { text: "Hi!" })`
*
* The special name `*` can be used in the body mapping to define that
* every field not bound by the path template should be mapped to the
* request body. This enables the following alternative definition of
* the update method:
*
* service Messaging {
* rpc UpdateMessage(Message) returns (Message) {
* option (google.api.http) = {
* patch: "/v1/messages/{message_id}"
* body: "*"
* };
* }
* }
* message Message {
* string message_id = 1;
* string text = 2;
* }
*
* The following HTTP JSON to RPC mapping is enabled:
*
* HTTP | gRPC
* -----|-----
* `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id:
* "123456" text: "Hi!")`
*
* Note that when using `*` in the body mapping, it is not possible to
* have HTTP parameters, as all fields not bound by the path end in
* the body. This makes this option more rarely used in practice when
* defining REST APIs. The common usage of `*` is in custom methods
* which don't use the URL at all for transferring data.
*
* It is possible to define multiple HTTP methods for one RPC by using
* the `additional_bindings` option. Example:
*
* service Messaging {
* rpc GetMessage(GetMessageRequest) returns (Message) {
* option (google.api.http) = {
* get: "/v1/messages/{message_id}"
* additional_bindings {
* get: "/v1/users/{user_id}/messages/{message_id}"
* }
* };
* }
* }
* message GetMessageRequest {
* string message_id = 1;
* string user_id = 2;
* }
*
* This enables the following two alternative HTTP JSON to RPC mappings:
*
* HTTP | gRPC
* -----|-----
* `GET /v1/messages/123456` | `GetMessage(message_id: "123456")`
* `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id:
* "123456")`
*
* ## Rules for HTTP mapping
*
* 1. Leaf request fields (recursive expansion nested messages in the request
* message) are classified into three categories:
* - Fields referred by the path template. They are passed via the URL path.
* - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They
* are passed via the HTTP
* request body.
* - All other fields are passed via the URL query parameters, and the
* parameter name is the field path in the request message. A repeated
* field can be represented as multiple query parameters under the same
* name.
* 2. If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL
* query parameter, all fields
* are passed via URL path and HTTP request body.
* 3. If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP
* request body, all
* fields are passed via URL path and URL query parameters.
*
* ### Path template syntax
*
* Template = "/" Segments [ Verb ] ;
* Segments = Segment { "/" Segment } ;
* Segment = "*" | "**" | LITERAL | Variable ;
* Variable = "{" FieldPath [ "=" Segments ] "}" ;
* FieldPath = IDENT { "." IDENT } ;
* Verb = ":" LITERAL ;
*
* The syntax `*` matches a single URL path segment. The syntax `**` matches
* zero or more URL path segments, which must be the last part of the URL path
* except the `Verb`.
*
* The syntax `Variable` matches part of the URL path as specified by its
* template. A variable template must not contain other variables. If a variable
* matches a single path segment, its template may be omitted, e.g. `{var}`
* is equivalent to `{var=*}`.
*
* The syntax `LITERAL` matches literal text in the URL path. If the `LITERAL`
* contains any reserved character, such characters should be percent-encoded
* before the matching.
*
* If a variable contains exactly one path segment, such as `"{var}"` or
* `"{var=*}"`, when such a variable is expanded into a URL path on the client
* side, all characters except `[-_.~0-9a-zA-Z]` are percent-encoded. The
* server side does the reverse decoding. Such variables show up in the
* [Discovery
* Document](https://developers.google.com/discovery/v1/reference/apis) as
* `{var}`.
*
* If a variable contains multiple path segments, such as `"{var=foo/*}"`
* or `"{var=**}"`, when such a variable is expanded into a URL path on the
* client side, all characters except `[-_.~/0-9a-zA-Z]` are percent-encoded.
* The server side does the reverse decoding, except "%2F" and "%2f" are left
* unchanged. Such variables show up in the
* [Discovery
* Document](https://developers.google.com/discovery/v1/reference/apis) as
* `{+var}`.
*
* ## Using gRPC API Service Configuration
*
* gRPC API Service Configuration (service config) is a configuration language
* for configuring a gRPC service to become a user-facing product. The
* service config is simply the YAML representation of the `google.api.Service`
* proto message.
*
* As an alternative to annotating your proto file, you can configure gRPC
* transcoding in your service config YAML files. You do this by specifying a
* `HttpRule` that maps the gRPC method to a REST endpoint, achieving the same
* effect as the proto annotation. This can be particularly useful if you
* have a proto that is reused in multiple services. Note that any transcoding
* specified in the service config will override any matching transcoding
* configuration in the proto.
*
* Example:
*
* http:
* rules:
* # Selects a gRPC method and applies HttpRule to it.
* - selector: example.v1.Messaging.GetMessage
* get: /v1/messages/{message_id}/{sub.subfield}
*
* ## Special notes
*
* When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the
* proto to JSON conversion must follow the [proto3
* specification](https://developers.google.com/protocol-buffers/docs/proto3#json).
*
* While the single segment variable follows the semantics of
* [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String
* Expansion, the multi segment variable **does not** follow RFC 6570 Section
* 3.2.3 Reserved Expansion. The reason is that the Reserved Expansion
* does not expand special characters like `?` and `#`, which would lead
* to invalid URLs. As the result, gRPC Transcoding uses a custom encoding
* for multi segment variables.
*
* The path variables **must not** refer to any repeated or mapped field,
* because client libraries are not capable of handling such variable expansion.
*
* The path variables **must not** capture the leading "/" character. The reason
* is that the most common use case "{var}" does not capture the leading "/"
* character. For consistency, all path variables must share the same behavior.
*
* Repeated message fields must not be mapped to URL query parameters, because
* no client library can support such complicated mapping.
*
* If an API needs to use a JSON array for request or response body, it can map
* the request or response body to a repeated field. However, some gRPC
* Transcoding implementations may not support this feature.
*/
export interface HttpRule {
/**
* Selects a method to which this rule applies.
*
* Refer to [selector][google.api.DocumentationRule.selector] for syntax
* details.
*/
selector: string;
/**
* Maps to HTTP GET. Used for listing and getting information about
* resources.
*/
get?:
| string
| undefined;
/** Maps to HTTP PUT. Used for replacing a resource. */
put?:
| string
| undefined;
/** Maps to HTTP POST. Used for creating a resource or performing an action. */
post?:
| string
| undefined;
/** Maps to HTTP DELETE. Used for deleting a resource. */
delete?:
| string
| undefined;
/** Maps to HTTP PATCH. Used for updating a resource. */
patch?:
| string
| undefined;
/**
* The custom pattern is used for specifying an HTTP method that is not
* included in the `pattern` field, such as HEAD, or "*" to leave the
* HTTP method unspecified for this rule. The wild-card rule is useful
* for services that provide content to Web (HTML) clients.
*/
custom?:
| CustomHttpPattern
| undefined;
/**
* The name of the request field whose value is mapped to the HTTP request
* body, or `*` for mapping all request fields not captured by the path
* pattern to the HTTP body, or omitted for not having any HTTP request body.
*
* NOTE: the referred field must be present at the top-level of the request
* message type.
*/
body: string;
/**
* Optional. The name of the response field whose value is mapped to the HTTP
* response body. When omitted, the entire response message will be used
* as the HTTP response body.
*
* NOTE: The referred field must be present at the top-level of the response
* message type.
*/
responseBody: string;
/**
* Additional HTTP bindings for the selector. Nested bindings must
* not contain an `additional_bindings` field themselves (that is,
* the nesting may only be one level deep).
*/
additionalBindings: HttpRule[];
}
/** A custom pattern is used for defining custom HTTP verb. */
export interface CustomHttpPattern {
/** The name of this custom HTTP verb. */
kind: string;
/** The path matched by this custom verb. */
path: string;
}
function createBaseHttp(): Http {
return { rules: [], fullyDecodeReservedExpansion: false };
}
export const Http = {
encode(message: Http, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
for (const v of message.rules) {
HttpRule.encode(v!, writer.uint32(10).fork()).ldelim();
}
if (message.fullyDecodeReservedExpansion === true) {
writer.uint32(16).bool(message.fullyDecodeReservedExpansion);
}
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): Http {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseHttp();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.rules.push(HttpRule.decode(reader, reader.uint32()));
continue;
case 2:
if (tag !== 16) {
break;
}
message.fullyDecodeReservedExpansion = reader.bool();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
create(base?: DeepPartial<Http>): Http {
return Http.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<Http>): Http {
const message = createBaseHttp();
message.rules = object.rules?.map((e) => HttpRule.fromPartial(e)) || [];
message.fullyDecodeReservedExpansion = object.fullyDecodeReservedExpansion ?? false;
return message;
},
};
function createBaseHttpRule(): HttpRule {
return {
selector: "",
get: undefined,
put: undefined,
post: undefined,
delete: undefined,
patch: undefined,
custom: undefined,
body: "",
responseBody: "",
additionalBindings: [],
};
}
export const HttpRule = {
encode(message: HttpRule, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.selector !== "") {
writer.uint32(10).string(message.selector);
}
if (message.get !== undefined) {
writer.uint32(18).string(message.get);
}
if (message.put !== undefined) {
writer.uint32(26).string(message.put);
}
if (message.post !== undefined) {
writer.uint32(34).string(message.post);
}
if (message.delete !== undefined) {
writer.uint32(42).string(message.delete);
}
if (message.patch !== undefined) {
writer.uint32(50).string(message.patch);
}
if (message.custom !== undefined) {
CustomHttpPattern.encode(message.custom, writer.uint32(66).fork()).ldelim();
}
if (message.body !== "") {
writer.uint32(58).string(message.body);
}
if (message.responseBody !== "") {
writer.uint32(98).string(message.responseBody);
}
for (const v of message.additionalBindings) {
HttpRule.encode(v!, writer.uint32(90).fork()).ldelim();
}
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): HttpRule {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseHttpRule();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.selector = reader.string();
continue;
case 2:
if (tag !== 18) {
break;
}
message.get = reader.string();
continue;
case 3:
if (tag !== 26) {
break;
}
message.put = reader.string();
continue;
case 4:
if (tag !== 34) {
break;
}
message.post = reader.string();
continue;
case 5:
if (tag !== 42) {
break;
}
message.delete = reader.string();
continue;
case 6:
if (tag !== 50) {
break;
}
message.patch = reader.string();
continue;
case 8:
if (tag !== 66) {
break;
}
message.custom = CustomHttpPattern.decode(reader, reader.uint32());
continue;
case 7:
if (tag !== 58) {
break;
}
message.body = reader.string();
continue;
case 12:
if (tag !== 98) {
break;
}
message.responseBody = reader.string();
continue;
case 11:
if (tag !== 90) {
break;
}
message.additionalBindings.push(HttpRule.decode(reader, reader.uint32()));
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
create(base?: DeepPartial<HttpRule>): HttpRule {
return HttpRule.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<HttpRule>): HttpRule {
const message = createBaseHttpRule();
message.selector = object.selector ?? "";
message.get = object.get ?? undefined;
message.put = object.put ?? undefined;
message.post = object.post ?? undefined;
message.delete = object.delete ?? undefined;
message.patch = object.patch ?? undefined;
message.custom = (object.custom !== undefined && object.custom !== null)
? CustomHttpPattern.fromPartial(object.custom)
: undefined;
message.body = object.body ?? "";
message.responseBody = object.responseBody ?? "";
message.additionalBindings = object.additionalBindings?.map((e) => HttpRule.fromPartial(e)) || [];
return message;
},
};
function createBaseCustomHttpPattern(): CustomHttpPattern {
return { kind: "", path: "" };
}
export const CustomHttpPattern = {
encode(message: CustomHttpPattern, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.kind !== "") {
writer.uint32(10).string(message.kind);
}
if (message.path !== "") {
writer.uint32(18).string(message.path);
}
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): CustomHttpPattern {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseCustomHttpPattern();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.kind = reader.string();
continue;
case 2:
if (tag !== 18) {
break;
}
message.path = reader.string();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
create(base?: DeepPartial<CustomHttpPattern>): CustomHttpPattern {
return CustomHttpPattern.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<CustomHttpPattern>): CustomHttpPattern {
const message = createBaseCustomHttpPattern();
message.kind = object.kind ?? "";
message.path = object.path ?? "";
return message;
},
};
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
export type DeepPartial<T> = T extends Builtin ? T
: T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
: T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
: Partial<T>;

View File

@ -0,0 +1,58 @@
/* eslint-disable */
export const protobufPackage = "google.api";
/**
* The launch stage as defined by [Google Cloud Platform
* Launch Stages](https://cloud.google.com/terms/launch-stages).
*/
export enum LaunchStage {
/** LAUNCH_STAGE_UNSPECIFIED - Do not use this default value. */
LAUNCH_STAGE_UNSPECIFIED = 0,
/** UNIMPLEMENTED - The feature is not yet implemented. Users can not use it. */
UNIMPLEMENTED = 6,
/** PRELAUNCH - Prelaunch features are hidden from users and are only visible internally. */
PRELAUNCH = 7,
/**
* EARLY_ACCESS - Early Access features are limited to a closed group of testers. To use
* these features, you must sign up in advance and sign a Trusted Tester
* agreement (which includes confidentiality provisions). These features may
* be unstable, changed in backward-incompatible ways, and are not
* guaranteed to be released.
*/
EARLY_ACCESS = 1,
/**
* ALPHA - Alpha is a limited availability test for releases before they are cleared
* for widespread use. By Alpha, all significant design issues are resolved
* and we are in the process of verifying functionality. Alpha customers
* need to apply for access, agree to applicable terms, and have their
* projects allowlisted. Alpha releases don't have to be feature complete,
* no SLAs are provided, and there are no technical support obligations, but
* they will be far enough along that customers can actually use them in
* test environments or for limited-use tests -- just like they would in
* normal production cases.
*/
ALPHA = 2,
/**
* BETA - Beta is the point at which we are ready to open a release for any
* customer to use. There are no SLA or technical support obligations in a
* Beta release. Products will be complete from a feature perspective, but
* may have some open outstanding issues. Beta releases are suitable for
* limited production use cases.
*/
BETA = 3,
/**
* GA - GA features are open to all developers and are considered stable and
* fully qualified for production use.
*/
GA = 4,
/**
* DEPRECATED - Deprecated features are scheduled to be shut down and removed. For more
* information, see the "Deprecation Policy" section of our [Terms of
* Service](https://cloud.google.com/terms/)
* and the [Google Cloud Platform Subject to the Deprecation
* Policy](https://cloud.google.com/terms/deprecation) documentation.
*/
DEPRECATED = 5,
UNRECOGNIZED = -1,
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,178 @@
/* eslint-disable */
import Long from "long";
import _m0 from "protobufjs/minimal";
export const protobufPackage = "google.protobuf";
/**
* A Duration represents a signed, fixed-length span of time represented
* as a count of seconds and fractions of seconds at nanosecond
* resolution. It is independent of any calendar and concepts like "day"
* or "month". It is related to Timestamp in that the difference between
* two Timestamp values is a Duration and it can be added or subtracted
* from a Timestamp. Range is approximately +-10,000 years.
*
* # Examples
*
* Example 1: Compute Duration from two Timestamps in pseudo code.
*
* Timestamp start = ...;
* Timestamp end = ...;
* Duration duration = ...;
*
* duration.seconds = end.seconds - start.seconds;
* duration.nanos = end.nanos - start.nanos;
*
* if (duration.seconds < 0 && duration.nanos > 0) {
* duration.seconds += 1;
* duration.nanos -= 1000000000;
* } else if (duration.seconds > 0 && duration.nanos < 0) {
* duration.seconds -= 1;
* duration.nanos += 1000000000;
* }
*
* Example 2: Compute Timestamp from Timestamp + Duration in pseudo code.
*
* Timestamp start = ...;
* Duration duration = ...;
* Timestamp end = ...;
*
* end.seconds = start.seconds + duration.seconds;
* end.nanos = start.nanos + duration.nanos;
*
* if (end.nanos < 0) {
* end.seconds -= 1;
* end.nanos += 1000000000;
* } else if (end.nanos >= 1000000000) {
* end.seconds += 1;
* end.nanos -= 1000000000;
* }
*
* Example 3: Compute Duration from datetime.timedelta in Python.
*
* td = datetime.timedelta(days=3, minutes=10)
* duration = Duration()
* duration.FromTimedelta(td)
*
* # JSON Mapping
*
* In JSON format, the Duration type is encoded as a string rather than an
* object, where the string ends in the suffix "s" (indicating seconds) and
* is preceded by the number of seconds, with nanoseconds expressed as
* fractional seconds. For example, 3 seconds with 0 nanoseconds should be
* encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should
* be expressed in JSON format as "3.000000001s", and 3 seconds and 1
* microsecond should be expressed in JSON format as "3.000001s".
*/
export interface Duration {
/**
* Signed seconds of the span of time. Must be from -315,576,000,000
* to +315,576,000,000 inclusive. Note: these bounds are computed from:
* 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years
*/
seconds: number;
/**
* Signed fractions of a second at nanosecond resolution of the span
* of time. Durations less than one second are represented with a 0
* `seconds` field and a positive or negative `nanos` field. For durations
* of one second or more, a non-zero value for the `nanos` field must be
* of the same sign as the `seconds` field. Must be from -999,999,999
* to +999,999,999 inclusive.
*/
nanos: number;
}
function createBaseDuration(): Duration {
return { seconds: 0, nanos: 0 };
}
export const Duration = {
encode(message: Duration, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.seconds !== 0) {
writer.uint32(8).int64(message.seconds);
}
if (message.nanos !== 0) {
writer.uint32(16).int32(message.nanos);
}
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): Duration {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseDuration();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 8) {
break;
}
message.seconds = longToNumber(reader.int64() as Long);
continue;
case 2:
if (tag !== 16) {
break;
}
message.nanos = reader.int32();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
create(base?: DeepPartial<Duration>): Duration {
return Duration.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<Duration>): Duration {
const message = createBaseDuration();
message.seconds = object.seconds ?? 0;
message.nanos = object.nanos ?? 0;
return message;
},
};
declare const self: any | undefined;
declare const window: any | undefined;
declare const global: any | undefined;
const tsProtoGlobalThis: any = (() => {
if (typeof globalThis !== "undefined") {
return globalThis;
}
if (typeof self !== "undefined") {
return self;
}
if (typeof window !== "undefined") {
return window;
}
if (typeof global !== "undefined") {
return global;
}
throw "Unable to locate global object";
})();
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
export type DeepPartial<T> = T extends Builtin ? T
: T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
: T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
: Partial<T>;
function longToNumber(long: Long): number {
if (long.gt(Number.MAX_SAFE_INTEGER)) {
throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
}
return long.toNumber();
}
if (_m0.util.Long !== Long) {
_m0.util.Long = Long as any;
_m0.configure();
}

View File

@ -0,0 +1,272 @@
/* eslint-disable */
import _m0 from "protobufjs/minimal";
export const protobufPackage = "google.protobuf";
/**
* `FieldMask` represents a set of symbolic field paths, for example:
*
* paths: "f.a"
* paths: "f.b.d"
*
* Here `f` represents a field in some root message, `a` and `b`
* fields in the message found in `f`, and `d` a field found in the
* message in `f.b`.
*
* Field masks are used to specify a subset of fields that should be
* returned by a get operation or modified by an update operation.
* Field masks also have a custom JSON encoding (see below).
*
* # Field Masks in Projections
*
* When used in the context of a projection, a response message or
* sub-message is filtered by the API to only contain those fields as
* specified in the mask. For example, if the mask in the previous
* example is applied to a response message as follows:
*
* f {
* a : 22
* b {
* d : 1
* x : 2
* }
* y : 13
* }
* z: 8
*
* The result will not contain specific values for fields x,y and z
* (their value will be set to the default, and omitted in proto text
* output):
*
* f {
* a : 22
* b {
* d : 1
* }
* }
*
* A repeated field is not allowed except at the last position of a
* paths string.
*
* If a FieldMask object is not present in a get operation, the
* operation applies to all fields (as if a FieldMask of all fields
* had been specified).
*
* Note that a field mask does not necessarily apply to the
* top-level response message. In case of a REST get operation, the
* field mask applies directly to the response, but in case of a REST
* list operation, the mask instead applies to each individual message
* in the returned resource list. In case of a REST custom method,
* other definitions may be used. Where the mask applies will be
* clearly documented together with its declaration in the API. In
* any case, the effect on the returned resource/resources is required
* behavior for APIs.
*
* # Field Masks in Update Operations
*
* A field mask in update operations specifies which fields of the
* targeted resource are going to be updated. The API is required
* to only change the values of the fields as specified in the mask
* and leave the others untouched. If a resource is passed in to
* describe the updated values, the API ignores the values of all
* fields not covered by the mask.
*
* If a repeated field is specified for an update operation, new values will
* be appended to the existing repeated field in the target resource. Note that
* a repeated field is only allowed in the last position of a `paths` string.
*
* If a sub-message is specified in the last position of the field mask for an
* update operation, then new value will be merged into the existing sub-message
* in the target resource.
*
* For example, given the target message:
*
* f {
* b {
* d: 1
* x: 2
* }
* c: [1]
* }
*
* And an update message:
*
* f {
* b {
* d: 10
* }
* c: [2]
* }
*
* then if the field mask is:
*
* paths: ["f.b", "f.c"]
*
* then the result will be:
*
* f {
* b {
* d: 10
* x: 2
* }
* c: [1, 2]
* }
*
* An implementation may provide options to override this default behavior for
* repeated and message fields.
*
* In order to reset a field's value to the default, the field must
* be in the mask and set to the default value in the provided resource.
* Hence, in order to reset all fields of a resource, provide a default
* instance of the resource and set all fields in the mask, or do
* not provide a mask as described below.
*
* If a field mask is not present on update, the operation applies to
* all fields (as if a field mask of all fields has been specified).
* Note that in the presence of schema evolution, this may mean that
* fields the client does not know and has therefore not filled into
* the request will be reset to their default. If this is unwanted
* behavior, a specific service may require a client to always specify
* a field mask, producing an error if not.
*
* As with get operations, the location of the resource which
* describes the updated values in the request message depends on the
* operation kind. In any case, the effect of the field mask is
* required to be honored by the API.
*
* ## Considerations for HTTP REST
*
* The HTTP kind of an update operation which uses a field mask must
* be set to PATCH instead of PUT in order to satisfy HTTP semantics
* (PUT must only be used for full updates).
*
* # JSON Encoding of Field Masks
*
* In JSON, a field mask is encoded as a single string where paths are
* separated by a comma. Fields name in each path are converted
* to/from lower-camel naming conventions.
*
* As an example, consider the following message declarations:
*
* message Profile {
* User user = 1;
* Photo photo = 2;
* }
* message User {
* string display_name = 1;
* string address = 2;
* }
*
* In proto a field mask for `Profile` may look as such:
*
* mask {
* paths: "user.display_name"
* paths: "photo"
* }
*
* In JSON, the same mask is represented as below:
*
* {
* mask: "user.displayName,photo"
* }
*
* # Field Masks and Oneof Fields
*
* Field masks treat fields in oneofs just as regular fields. Consider the
* following message:
*
* message SampleMessage {
* oneof test_oneof {
* string name = 4;
* SubMessage sub_message = 9;
* }
* }
*
* The field mask can be:
*
* mask {
* paths: "name"
* }
*
* Or:
*
* mask {
* paths: "sub_message"
* }
*
* Note that oneof type names ("test_oneof" in this case) cannot be used in
* paths.
*
* ## Field Mask Verification
*
* The implementation of any API method which has a FieldMask type field in the
* request should verify the included field paths, and return an
* `INVALID_ARGUMENT` error if any path is unmappable.
*/
export interface FieldMask {
/** The set of field mask paths. */
paths: string[];
}
function createBaseFieldMask(): FieldMask {
return { paths: [] };
}
export const FieldMask = {
encode(message: FieldMask, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
for (const v of message.paths) {
writer.uint32(10).string(v!);
}
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): FieldMask {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseFieldMask();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.paths.push(reader.string());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
create(base?: DeepPartial<FieldMask>): FieldMask {
return FieldMask.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<FieldMask>): FieldMask {
const message = createBaseFieldMask();
message.paths = object.paths?.map((e) => e) || [];
return message;
},
wrap(paths: string[]): FieldMask {
const result = createBaseFieldMask();
result.paths = paths;
return result;
},
unwrap(message: FieldMask): string[] {
return message.paths;
},
};
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
export type DeepPartial<T> = T extends Builtin ? T
: T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
: T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
: Partial<T>;

View File

@ -0,0 +1,207 @@
/* eslint-disable */
import Long from "long";
import _m0 from "protobufjs/minimal";
export const protobufPackage = "google.protobuf";
/**
* A Timestamp represents a point in time independent of any time zone or local
* calendar, encoded as a count of seconds and fractions of seconds at
* nanosecond resolution. The count is relative to an epoch at UTC midnight on
* January 1, 1970, in the proleptic Gregorian calendar which extends the
* Gregorian calendar backwards to year one.
*
* All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap
* second table is needed for interpretation, using a [24-hour linear
* smear](https://developers.google.com/time/smear).
*
* The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By
* restricting to that range, we ensure that we can convert to and from [RFC
* 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings.
*
* # Examples
*
* Example 1: Compute Timestamp from POSIX `time()`.
*
* Timestamp timestamp;
* timestamp.set_seconds(time(NULL));
* timestamp.set_nanos(0);
*
* Example 2: Compute Timestamp from POSIX `gettimeofday()`.
*
* struct timeval tv;
* gettimeofday(&tv, NULL);
*
* Timestamp timestamp;
* timestamp.set_seconds(tv.tv_sec);
* timestamp.set_nanos(tv.tv_usec * 1000);
*
* Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
*
* FILETIME ft;
* GetSystemTimeAsFileTime(&ft);
* UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
*
* // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
* // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
* Timestamp timestamp;
* timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
* timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
*
* Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
*
* long millis = System.currentTimeMillis();
*
* Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
* .setNanos((int) ((millis % 1000) * 1000000)).build();
*
* Example 5: Compute Timestamp from Java `Instant.now()`.
*
* Instant now = Instant.now();
*
* Timestamp timestamp =
* Timestamp.newBuilder().setSeconds(now.getEpochSecond())
* .setNanos(now.getNano()).build();
*
* Example 6: Compute Timestamp from current time in Python.
*
* timestamp = Timestamp()
* timestamp.GetCurrentTime()
*
* # JSON Mapping
*
* In JSON format, the Timestamp type is encoded as a string in the
* [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the
* format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z"
* where {year} is always expressed using four digits while {month}, {day},
* {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional
* seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
* are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
* is required. A proto3 JSON serializer should always use UTC (as indicated by
* "Z") when printing the Timestamp type and a proto3 JSON parser should be
* able to accept both UTC and other timezones (as indicated by an offset).
*
* For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
* 01:30 UTC on January 15, 2017.
*
* In JavaScript, one can convert a Date object to this format using the
* standard
* [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
* method. In Python, a standard `datetime.datetime` object can be converted
* to this format using
* [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with
* the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use
* the Joda Time's [`ISODateTimeFormat.dateTime()`](
* http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D
* ) to obtain a formatter capable of generating timestamps in this format.
*/
export interface Timestamp {
/**
* Represents seconds of UTC time since Unix epoch
* 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
* 9999-12-31T23:59:59Z inclusive.
*/
seconds: number;
/**
* Non-negative fractions of a second at nanosecond resolution. Negative
* second values with fractions must still have non-negative nanos values
* that count forward in time. Must be from 0 to 999,999,999
* inclusive.
*/
nanos: number;
}
function createBaseTimestamp(): Timestamp {
return { seconds: 0, nanos: 0 };
}
export const Timestamp = {
encode(message: Timestamp, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.seconds !== 0) {
writer.uint32(8).int64(message.seconds);
}
if (message.nanos !== 0) {
writer.uint32(16).int32(message.nanos);
}
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): Timestamp {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseTimestamp();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 8) {
break;
}
message.seconds = longToNumber(reader.int64() as Long);
continue;
case 2:
if (tag !== 16) {
break;
}
message.nanos = reader.int32();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
create(base?: DeepPartial<Timestamp>): Timestamp {
return Timestamp.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<Timestamp>): Timestamp {
const message = createBaseTimestamp();
message.seconds = object.seconds ?? 0;
message.nanos = object.nanos ?? 0;
return message;
},
};
declare const self: any | undefined;
declare const window: any | undefined;
declare const global: any | undefined;
const tsProtoGlobalThis: any = (() => {
if (typeof globalThis !== "undefined") {
return globalThis;
}
if (typeof self !== "undefined") {
return self;
}
if (typeof window !== "undefined") {
return window;
}
if (typeof global !== "undefined") {
return global;
}
throw "Unable to locate global object";
})();
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
export type DeepPartial<T> = T extends Builtin ? T
: T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
: T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
: Partial<T>;
function longToNumber(long: Long): number {
if (long.gt(Number.MAX_SAFE_INTEGER)) {
throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
}
return long.toNumber();
}
if (_m0.util.Long !== Long) {
_m0.util.Long = Long as any;
_m0.configure();
}

View File

@ -0,0 +1,189 @@
/* eslint-disable */
import _m0 from "protobufjs/minimal";
export const protobufPackage = "memos.store";
export interface ActivityMemoCommentPayload {
memoId: number;
relatedMemoId: number;
}
export interface ActivityVersionUpdatePayload {
version: string;
}
export interface ActivityPayload {
memoComment?: ActivityMemoCommentPayload | undefined;
versionUpdate?: ActivityVersionUpdatePayload | undefined;
}
function createBaseActivityMemoCommentPayload(): ActivityMemoCommentPayload {
return { memoId: 0, relatedMemoId: 0 };
}
export const ActivityMemoCommentPayload = {
encode(message: ActivityMemoCommentPayload, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.memoId !== 0) {
writer.uint32(8).int32(message.memoId);
}
if (message.relatedMemoId !== 0) {
writer.uint32(16).int32(message.relatedMemoId);
}
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): ActivityMemoCommentPayload {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseActivityMemoCommentPayload();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 8) {
break;
}
message.memoId = reader.int32();
continue;
case 2:
if (tag !== 16) {
break;
}
message.relatedMemoId = reader.int32();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
create(base?: DeepPartial<ActivityMemoCommentPayload>): ActivityMemoCommentPayload {
return ActivityMemoCommentPayload.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<ActivityMemoCommentPayload>): ActivityMemoCommentPayload {
const message = createBaseActivityMemoCommentPayload();
message.memoId = object.memoId ?? 0;
message.relatedMemoId = object.relatedMemoId ?? 0;
return message;
},
};
function createBaseActivityVersionUpdatePayload(): ActivityVersionUpdatePayload {
return { version: "" };
}
export const ActivityVersionUpdatePayload = {
encode(message: ActivityVersionUpdatePayload, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.version !== "") {
writer.uint32(10).string(message.version);
}
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): ActivityVersionUpdatePayload {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseActivityVersionUpdatePayload();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.version = reader.string();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
create(base?: DeepPartial<ActivityVersionUpdatePayload>): ActivityVersionUpdatePayload {
return ActivityVersionUpdatePayload.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<ActivityVersionUpdatePayload>): ActivityVersionUpdatePayload {
const message = createBaseActivityVersionUpdatePayload();
message.version = object.version ?? "";
return message;
},
};
function createBaseActivityPayload(): ActivityPayload {
return { memoComment: undefined, versionUpdate: undefined };
}
export const ActivityPayload = {
encode(message: ActivityPayload, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.memoComment !== undefined) {
ActivityMemoCommentPayload.encode(message.memoComment, writer.uint32(10).fork()).ldelim();
}
if (message.versionUpdate !== undefined) {
ActivityVersionUpdatePayload.encode(message.versionUpdate, writer.uint32(18).fork()).ldelim();
}
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): ActivityPayload {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseActivityPayload();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.memoComment = ActivityMemoCommentPayload.decode(reader, reader.uint32());
continue;
case 2:
if (tag !== 18) {
break;
}
message.versionUpdate = ActivityVersionUpdatePayload.decode(reader, reader.uint32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
create(base?: DeepPartial<ActivityPayload>): ActivityPayload {
return ActivityPayload.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<ActivityPayload>): ActivityPayload {
const message = createBaseActivityPayload();
message.memoComment = (object.memoComment !== undefined && object.memoComment !== null)
? ActivityMemoCommentPayload.fromPartial(object.memoComment)
: undefined;
message.versionUpdate = (object.versionUpdate !== undefined && object.versionUpdate !== null)
? ActivityVersionUpdatePayload.fromPartial(object.versionUpdate)
: undefined;
return message;
},
};
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
export type DeepPartial<T> = T extends Builtin ? T
: T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
: T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
: Partial<T>;

View File

@ -0,0 +1,3 @@
/* eslint-disable */
export const protobufPackage = "memos.store";

View File

@ -0,0 +1,80 @@
/* eslint-disable */
import _m0 from "protobufjs/minimal";
export const protobufPackage = "memos.store";
export interface InboxMessage {
type: InboxMessage_Type;
activityId?: number | undefined;
}
export enum InboxMessage_Type {
TYPE_UNSPECIFIED = 0,
TYPE_MEMO_COMMENT = 1,
TYPE_VERSION_UPDATE = 2,
UNRECOGNIZED = -1,
}
function createBaseInboxMessage(): InboxMessage {
return { type: 0, activityId: undefined };
}
export const InboxMessage = {
encode(message: InboxMessage, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.type !== 0) {
writer.uint32(8).int32(message.type);
}
if (message.activityId !== undefined) {
writer.uint32(16).int32(message.activityId);
}
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): InboxMessage {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseInboxMessage();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 8) {
break;
}
message.type = reader.int32() as any;
continue;
case 2:
if (tag !== 16) {
break;
}
message.activityId = reader.int32();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
create(base?: DeepPartial<InboxMessage>): InboxMessage {
return InboxMessage.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<InboxMessage>): InboxMessage {
const message = createBaseInboxMessage();
message.type = object.type ?? 0;
message.activityId = object.activityId ?? undefined;
return message;
},
};
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
export type DeepPartial<T> = T extends Builtin ? T
: T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
: T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
: Partial<T>;

View File

@ -0,0 +1,95 @@
/* eslint-disable */
import _m0 from "protobufjs/minimal";
export const protobufPackage = "memos.store";
export enum SystemSettingKey {
SYSTEM_SETTING_KEY_UNSPECIFIED = 0,
/** BACKUP_CONFIG - BackupConfig is the key for auto-backup configuration. */
BACKUP_CONFIG = 1,
UNRECOGNIZED = -1,
}
export interface BackupConfig {
/** enabled indicates whether backup is enabled. */
enabled: boolean;
/** cron is the cron expression for backup. See https://godoc.org/github.com/robfig/cron#hdr-CRON_Expression_Format */
cron: string;
/** max_keep is the maximum number of backups to keep. */
maxKeep: number;
}
function createBaseBackupConfig(): BackupConfig {
return { enabled: false, cron: "", maxKeep: 0 };
}
export const BackupConfig = {
encode(message: BackupConfig, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.enabled === true) {
writer.uint32(8).bool(message.enabled);
}
if (message.cron !== "") {
writer.uint32(18).string(message.cron);
}
if (message.maxKeep !== 0) {
writer.uint32(24).int32(message.maxKeep);
}
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): BackupConfig {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseBackupConfig();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 8) {
break;
}
message.enabled = reader.bool();
continue;
case 2:
if (tag !== 18) {
break;
}
message.cron = reader.string();
continue;
case 3:
if (tag !== 24) {
break;
}
message.maxKeep = reader.int32();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
create(base?: DeepPartial<BackupConfig>): BackupConfig {
return BackupConfig.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<BackupConfig>): BackupConfig {
const message = createBaseBackupConfig();
message.enabled = object.enabled ?? false;
message.cron = object.cron ?? "";
message.maxKeep = object.maxKeep ?? 0;
return message;
},
};
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
export type DeepPartial<T> = T extends Builtin ? T
: T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
: T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
: Partial<T>;

View File

@ -0,0 +1,211 @@
/* eslint-disable */
import _m0 from "protobufjs/minimal";
export const protobufPackage = "memos.store";
export enum UserSettingKey {
USER_SETTING_KEY_UNSPECIFIED = 0,
/** USER_SETTING_ACCESS_TOKENS - Access tokens for the user. */
USER_SETTING_ACCESS_TOKENS = 1,
UNRECOGNIZED = -1,
}
export interface UserSetting {
userId: number;
key: UserSettingKey;
accessTokens?: AccessTokensUserSetting | undefined;
}
export interface AccessTokensUserSetting {
accessTokens: AccessTokensUserSetting_AccessToken[];
}
export interface AccessTokensUserSetting_AccessToken {
/**
* The access token is a JWT token.
* Including expiration time, issuer, etc.
*/
accessToken: string;
/** A description for the access token. */
description: string;
}
function createBaseUserSetting(): UserSetting {
return { userId: 0, key: 0, accessTokens: undefined };
}
export const UserSetting = {
encode(message: UserSetting, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.userId !== 0) {
writer.uint32(8).int32(message.userId);
}
if (message.key !== 0) {
writer.uint32(16).int32(message.key);
}
if (message.accessTokens !== undefined) {
AccessTokensUserSetting.encode(message.accessTokens, writer.uint32(26).fork()).ldelim();
}
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): UserSetting {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseUserSetting();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 8) {
break;
}
message.userId = reader.int32();
continue;
case 2:
if (tag !== 16) {
break;
}
message.key = reader.int32() as any;
continue;
case 3:
if (tag !== 26) {
break;
}
message.accessTokens = AccessTokensUserSetting.decode(reader, reader.uint32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
create(base?: DeepPartial<UserSetting>): UserSetting {
return UserSetting.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<UserSetting>): UserSetting {
const message = createBaseUserSetting();
message.userId = object.userId ?? 0;
message.key = object.key ?? 0;
message.accessTokens = (object.accessTokens !== undefined && object.accessTokens !== null)
? AccessTokensUserSetting.fromPartial(object.accessTokens)
: undefined;
return message;
},
};
function createBaseAccessTokensUserSetting(): AccessTokensUserSetting {
return { accessTokens: [] };
}
export const AccessTokensUserSetting = {
encode(message: AccessTokensUserSetting, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
for (const v of message.accessTokens) {
AccessTokensUserSetting_AccessToken.encode(v!, writer.uint32(10).fork()).ldelim();
}
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): AccessTokensUserSetting {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseAccessTokensUserSetting();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.accessTokens.push(AccessTokensUserSetting_AccessToken.decode(reader, reader.uint32()));
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
create(base?: DeepPartial<AccessTokensUserSetting>): AccessTokensUserSetting {
return AccessTokensUserSetting.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<AccessTokensUserSetting>): AccessTokensUserSetting {
const message = createBaseAccessTokensUserSetting();
message.accessTokens = object.accessTokens?.map((e) => AccessTokensUserSetting_AccessToken.fromPartial(e)) || [];
return message;
},
};
function createBaseAccessTokensUserSetting_AccessToken(): AccessTokensUserSetting_AccessToken {
return { accessToken: "", description: "" };
}
export const AccessTokensUserSetting_AccessToken = {
encode(message: AccessTokensUserSetting_AccessToken, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.accessToken !== "") {
writer.uint32(10).string(message.accessToken);
}
if (message.description !== "") {
writer.uint32(18).string(message.description);
}
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): AccessTokensUserSetting_AccessToken {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseAccessTokensUserSetting_AccessToken();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.accessToken = reader.string();
continue;
case 2:
if (tag !== 18) {
break;
}
message.description = reader.string();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
create(base?: DeepPartial<AccessTokensUserSetting_AccessToken>): AccessTokensUserSetting_AccessToken {
return AccessTokensUserSetting_AccessToken.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<AccessTokensUserSetting_AccessToken>): AccessTokensUserSetting_AccessToken {
const message = createBaseAccessTokensUserSetting_AccessToken();
message.accessToken = object.accessToken ?? "";
message.description = object.description ?? "";
return message;
},
};
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
export type DeepPartial<T> = T extends Builtin ? T
: T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
: T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
: Partial<T>;