mirror of https://github.com/usememos/memos
chore: update gitignore
parent
76ed1b5cc5
commit
1a121e350b
@ -0,0 +1,399 @@
|
||||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.6.1
|
||||
// protoc unknown
|
||||
// source: api/v1/activity_service.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
import { Timestamp } from "../../google/protobuf/timestamp";
|
||||
|
||||
export const protobufPackage = "memos.api.v1";
|
||||
|
||||
export interface Activity {
|
||||
/**
|
||||
* The name of the activity.
|
||||
* Format: activities/{id}
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* The name of the creator.
|
||||
* Format: users/{user}
|
||||
*/
|
||||
creator: string;
|
||||
/** The type of the activity. */
|
||||
type: string;
|
||||
/** The level of the activity. */
|
||||
level: string;
|
||||
/** The create time of the activity. */
|
||||
createTime?:
|
||||
| Date
|
||||
| undefined;
|
||||
/** The payload of the activity. */
|
||||
payload?: ActivityPayload | undefined;
|
||||
}
|
||||
|
||||
export interface ActivityPayload {
|
||||
memoComment?: ActivityMemoCommentPayload | undefined;
|
||||
}
|
||||
|
||||
/** ActivityMemoCommentPayload represents the payload of a memo comment activity. */
|
||||
export interface ActivityMemoCommentPayload {
|
||||
/**
|
||||
* The memo name of comment.
|
||||
* Refer to `Memo.name`.
|
||||
*/
|
||||
memo: string;
|
||||
/** The name of related memo. */
|
||||
relatedMemo: string;
|
||||
}
|
||||
|
||||
export interface GetActivityRequest {
|
||||
/**
|
||||
* The name of the activity.
|
||||
* Format: activities/{id}, id is the system generated auto-incremented id.
|
||||
*/
|
||||
name: string;
|
||||
}
|
||||
|
||||
function createBaseActivity(): Activity {
|
||||
return { name: "", creator: "", type: "", level: "", createTime: undefined, payload: undefined };
|
||||
}
|
||||
|
||||
export const Activity: MessageFns<Activity> = {
|
||||
encode(message: Activity, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.name !== "") {
|
||||
writer.uint32(10).string(message.name);
|
||||
}
|
||||
if (message.creator !== "") {
|
||||
writer.uint32(18).string(message.creator);
|
||||
}
|
||||
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()).join();
|
||||
}
|
||||
if (message.payload !== undefined) {
|
||||
ActivityPayload.encode(message.payload, writer.uint32(50).fork()).join();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Activity {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(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 !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.name = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.creator = reader.string();
|
||||
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.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<Activity>): Activity {
|
||||
return Activity.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<Activity>): Activity {
|
||||
const message = createBaseActivity();
|
||||
message.name = object.name ?? "";
|
||||
message.creator = object.creator ?? "";
|
||||
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 createBaseActivityPayload(): ActivityPayload {
|
||||
return { memoComment: undefined };
|
||||
}
|
||||
|
||||
export const ActivityPayload: MessageFns<ActivityPayload> = {
|
||||
encode(message: ActivityPayload, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.memoComment !== undefined) {
|
||||
ActivityMemoCommentPayload.encode(message.memoComment, writer.uint32(10).fork()).join();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): ActivityPayload {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(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.skip(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 createBaseActivityMemoCommentPayload(): ActivityMemoCommentPayload {
|
||||
return { memo: "", relatedMemo: "" };
|
||||
}
|
||||
|
||||
export const ActivityMemoCommentPayload: MessageFns<ActivityMemoCommentPayload> = {
|
||||
encode(message: ActivityMemoCommentPayload, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.memo !== "") {
|
||||
writer.uint32(10).string(message.memo);
|
||||
}
|
||||
if (message.relatedMemo !== "") {
|
||||
writer.uint32(18).string(message.relatedMemo);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): ActivityMemoCommentPayload {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(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 !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.memo = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.relatedMemo = reader.string();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<ActivityMemoCommentPayload>): ActivityMemoCommentPayload {
|
||||
return ActivityMemoCommentPayload.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<ActivityMemoCommentPayload>): ActivityMemoCommentPayload {
|
||||
const message = createBaseActivityMemoCommentPayload();
|
||||
message.memo = object.memo ?? "";
|
||||
message.relatedMemo = object.relatedMemo ?? "";
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseGetActivityRequest(): GetActivityRequest {
|
||||
return { name: "" };
|
||||
}
|
||||
|
||||
export const GetActivityRequest: MessageFns<GetActivityRequest> = {
|
||||
encode(message: GetActivityRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.name !== "") {
|
||||
writer.uint32(10).string(message.name);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): GetActivityRequest {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(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 !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.name = reader.string();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<GetActivityRequest>): GetActivityRequest {
|
||||
return GetActivityRequest.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<GetActivityRequest>): GetActivityRequest {
|
||||
const message = createBaseGetActivityRequest();
|
||||
message.name = object.name ?? "";
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
export type ActivityServiceDefinition = typeof ActivityServiceDefinition;
|
||||
export const ActivityServiceDefinition = {
|
||||
name: "ActivityService",
|
||||
fullName: "memos.api.v1.ActivityService",
|
||||
methods: {
|
||||
/** GetActivity returns the activity with the given id. */
|
||||
getActivity: {
|
||||
name: "GetActivity",
|
||||
requestType: GetActivityRequest,
|
||||
requestStream: false,
|
||||
responseType: Activity,
|
||||
responseStream: false,
|
||||
options: {
|
||||
_unknownFields: {
|
||||
8410: [new Uint8Array([4, 110, 97, 109, 101])],
|
||||
578365826: [
|
||||
new Uint8Array([
|
||||
29,
|
||||
18,
|
||||
27,
|
||||
47,
|
||||
97,
|
||||
112,
|
||||
105,
|
||||
47,
|
||||
118,
|
||||
49,
|
||||
47,
|
||||
123,
|
||||
110,
|
||||
97,
|
||||
109,
|
||||
101,
|
||||
61,
|
||||
97,
|
||||
99,
|
||||
116,
|
||||
105,
|
||||
118,
|
||||
105,
|
||||
116,
|
||||
105,
|
||||
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 globalThis.Array<infer U> ? globalThis.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 = Math.trunc(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 globalThis.Date(millis);
|
||||
}
|
||||
|
||||
export interface MessageFns<T> {
|
||||
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
||||
create(base?: DeepPartial<T>): T;
|
||||
fromPartial(object: DeepPartial<T>): T;
|
||||
}
|
@ -0,0 +1,577 @@
|
||||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.6.1
|
||||
// protoc unknown
|
||||
// source: api/v1/auth_service.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
import { Empty } from "../../google/protobuf/empty";
|
||||
import { User } from "./user_service";
|
||||
|
||||
export const protobufPackage = "memos.api.v1";
|
||||
|
||||
export interface GetAuthStatusRequest {
|
||||
}
|
||||
|
||||
export interface GetAuthStatusResponse {
|
||||
user?: User | undefined;
|
||||
}
|
||||
|
||||
export interface SignInRequest {
|
||||
/** The username to sign in with. */
|
||||
username: string;
|
||||
/** The password to sign in with. */
|
||||
password: string;
|
||||
/** Whether the session should never expire. */
|
||||
neverExpire: boolean;
|
||||
}
|
||||
|
||||
export interface SignInWithSSORequest {
|
||||
/** The ID of the SSO provider. */
|
||||
idpId: number;
|
||||
/** The code to sign in with. */
|
||||
code: string;
|
||||
/** The redirect URI. */
|
||||
redirectUri: string;
|
||||
}
|
||||
|
||||
export interface SignUpRequest {
|
||||
/** The username to sign up with. */
|
||||
username: string;
|
||||
/** The password to sign up with. */
|
||||
password: string;
|
||||
}
|
||||
|
||||
export interface SignOutRequest {
|
||||
}
|
||||
|
||||
function createBaseGetAuthStatusRequest(): GetAuthStatusRequest {
|
||||
return {};
|
||||
}
|
||||
|
||||
export const GetAuthStatusRequest: MessageFns<GetAuthStatusRequest> = {
|
||||
encode(_: GetAuthStatusRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): GetAuthStatusRequest {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseGetAuthStatusRequest();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<GetAuthStatusRequest>): GetAuthStatusRequest {
|
||||
return GetAuthStatusRequest.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(_: DeepPartial<GetAuthStatusRequest>): GetAuthStatusRequest {
|
||||
const message = createBaseGetAuthStatusRequest();
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseGetAuthStatusResponse(): GetAuthStatusResponse {
|
||||
return { user: undefined };
|
||||
}
|
||||
|
||||
export const GetAuthStatusResponse: MessageFns<GetAuthStatusResponse> = {
|
||||
encode(message: GetAuthStatusResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.user !== undefined) {
|
||||
User.encode(message.user, writer.uint32(10).fork()).join();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): GetAuthStatusResponse {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseGetAuthStatusResponse();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.user = User.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<GetAuthStatusResponse>): GetAuthStatusResponse {
|
||||
return GetAuthStatusResponse.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<GetAuthStatusResponse>): GetAuthStatusResponse {
|
||||
const message = createBaseGetAuthStatusResponse();
|
||||
message.user = (object.user !== undefined && object.user !== null) ? User.fromPartial(object.user) : undefined;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseSignInRequest(): SignInRequest {
|
||||
return { username: "", password: "", neverExpire: false };
|
||||
}
|
||||
|
||||
export const SignInRequest: MessageFns<SignInRequest> = {
|
||||
encode(message: SignInRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.username !== "") {
|
||||
writer.uint32(10).string(message.username);
|
||||
}
|
||||
if (message.password !== "") {
|
||||
writer.uint32(18).string(message.password);
|
||||
}
|
||||
if (message.neverExpire !== false) {
|
||||
writer.uint32(24).bool(message.neverExpire);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): SignInRequest {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseSignInRequest();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.username = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.password = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 3: {
|
||||
if (tag !== 24) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.neverExpire = reader.bool();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<SignInRequest>): SignInRequest {
|
||||
return SignInRequest.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<SignInRequest>): SignInRequest {
|
||||
const message = createBaseSignInRequest();
|
||||
message.username = object.username ?? "";
|
||||
message.password = object.password ?? "";
|
||||
message.neverExpire = object.neverExpire ?? false;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseSignInWithSSORequest(): SignInWithSSORequest {
|
||||
return { idpId: 0, code: "", redirectUri: "" };
|
||||
}
|
||||
|
||||
export const SignInWithSSORequest: MessageFns<SignInWithSSORequest> = {
|
||||
encode(message: SignInWithSSORequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.idpId !== 0) {
|
||||
writer.uint32(8).int32(message.idpId);
|
||||
}
|
||||
if (message.code !== "") {
|
||||
writer.uint32(18).string(message.code);
|
||||
}
|
||||
if (message.redirectUri !== "") {
|
||||
writer.uint32(26).string(message.redirectUri);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): SignInWithSSORequest {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseSignInWithSSORequest();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 8) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.idpId = reader.int32();
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.code = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 3: {
|
||||
if (tag !== 26) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.redirectUri = reader.string();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<SignInWithSSORequest>): SignInWithSSORequest {
|
||||
return SignInWithSSORequest.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<SignInWithSSORequest>): SignInWithSSORequest {
|
||||
const message = createBaseSignInWithSSORequest();
|
||||
message.idpId = object.idpId ?? 0;
|
||||
message.code = object.code ?? "";
|
||||
message.redirectUri = object.redirectUri ?? "";
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseSignUpRequest(): SignUpRequest {
|
||||
return { username: "", password: "" };
|
||||
}
|
||||
|
||||
export const SignUpRequest: MessageFns<SignUpRequest> = {
|
||||
encode(message: SignUpRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.username !== "") {
|
||||
writer.uint32(10).string(message.username);
|
||||
}
|
||||
if (message.password !== "") {
|
||||
writer.uint32(18).string(message.password);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): SignUpRequest {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseSignUpRequest();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.username = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.password = reader.string();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<SignUpRequest>): SignUpRequest {
|
||||
return SignUpRequest.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<SignUpRequest>): SignUpRequest {
|
||||
const message = createBaseSignUpRequest();
|
||||
message.username = object.username ?? "";
|
||||
message.password = object.password ?? "";
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseSignOutRequest(): SignOutRequest {
|
||||
return {};
|
||||
}
|
||||
|
||||
export const SignOutRequest: MessageFns<SignOutRequest> = {
|
||||
encode(_: SignOutRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): SignOutRequest {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseSignOutRequest();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<SignOutRequest>): SignOutRequest {
|
||||
return SignOutRequest.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(_: DeepPartial<SignOutRequest>): SignOutRequest {
|
||||
const message = createBaseSignOutRequest();
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
export type AuthServiceDefinition = typeof AuthServiceDefinition;
|
||||
export const AuthServiceDefinition = {
|
||||
name: "AuthService",
|
||||
fullName: "memos.api.v1.AuthService",
|
||||
methods: {
|
||||
/** GetAuthStatus returns the current auth status of the user. */
|
||||
getAuthStatus: {
|
||||
name: "GetAuthStatus",
|
||||
requestType: GetAuthStatusRequest,
|
||||
requestStream: false,
|
||||
responseType: User,
|
||||
responseStream: false,
|
||||
options: {
|
||||
_unknownFields: {
|
||||
578365826: [
|
||||
new Uint8Array([
|
||||
21,
|
||||
34,
|
||||
19,
|
||||
47,
|
||||
97,
|
||||
112,
|
||||
105,
|
||||
47,
|
||||
118,
|
||||
49,
|
||||
47,
|
||||
97,
|
||||
117,
|
||||
116,
|
||||
104,
|
||||
47,
|
||||
115,
|
||||
116,
|
||||
97,
|
||||
116,
|
||||
117,
|
||||
115,
|
||||
]),
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
/** SignIn signs in the user with the given username and password. */
|
||||
signIn: {
|
||||
name: "SignIn",
|
||||
requestType: SignInRequest,
|
||||
requestStream: false,
|
||||
responseType: User,
|
||||
responseStream: false,
|
||||
options: {
|
||||
_unknownFields: {
|
||||
578365826: [
|
||||
new Uint8Array([
|
||||
21,
|
||||
34,
|
||||
19,
|
||||
47,
|
||||
97,
|
||||
112,
|
||||
105,
|
||||
47,
|
||||
118,
|
||||
49,
|
||||
47,
|
||||
97,
|
||||
117,
|
||||
116,
|
||||
104,
|
||||
47,
|
||||
115,
|
||||
105,
|
||||
103,
|
||||
110,
|
||||
105,
|
||||
110,
|
||||
]),
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
/** SignInWithSSO signs in the user with the given SSO code. */
|
||||
signInWithSSO: {
|
||||
name: "SignInWithSSO",
|
||||
requestType: SignInWithSSORequest,
|
||||
requestStream: false,
|
||||
responseType: User,
|
||||
responseStream: false,
|
||||
options: {
|
||||
_unknownFields: {
|
||||
578365826: [
|
||||
new Uint8Array([
|
||||
25,
|
||||
34,
|
||||
23,
|
||||
47,
|
||||
97,
|
||||
112,
|
||||
105,
|
||||
47,
|
||||
118,
|
||||
49,
|
||||
47,
|
||||
97,
|
||||
117,
|
||||
116,
|
||||
104,
|
||||
47,
|
||||
115,
|
||||
105,
|
||||
103,
|
||||
110,
|
||||
105,
|
||||
110,
|
||||
47,
|
||||
115,
|
||||
115,
|
||||
111,
|
||||
]),
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
/** SignUp signs up the user with the given username and password. */
|
||||
signUp: {
|
||||
name: "SignUp",
|
||||
requestType: SignUpRequest,
|
||||
requestStream: false,
|
||||
responseType: User,
|
||||
responseStream: false,
|
||||
options: {
|
||||
_unknownFields: {
|
||||
578365826: [
|
||||
new Uint8Array([
|
||||
21,
|
||||
34,
|
||||
19,
|
||||
47,
|
||||
97,
|
||||
112,
|
||||
105,
|
||||
47,
|
||||
118,
|
||||
49,
|
||||
47,
|
||||
97,
|
||||
117,
|
||||
116,
|
||||
104,
|
||||
47,
|
||||
115,
|
||||
105,
|
||||
103,
|
||||
110,
|
||||
117,
|
||||
112,
|
||||
]),
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
/** SignOut signs out the user. */
|
||||
signOut: {
|
||||
name: "SignOut",
|
||||
requestType: SignOutRequest,
|
||||
requestStream: false,
|
||||
responseType: Empty,
|
||||
responseStream: false,
|
||||
options: {
|
||||
_unknownFields: {
|
||||
578365826: [
|
||||
new Uint8Array([
|
||||
22,
|
||||
34,
|
||||
20,
|
||||
47,
|
||||
97,
|
||||
112,
|
||||
105,
|
||||
47,
|
||||
118,
|
||||
49,
|
||||
47,
|
||||
97,
|
||||
117,
|
||||
116,
|
||||
104,
|
||||
47,
|
||||
115,
|
||||
105,
|
||||
103,
|
||||
110,
|
||||
111,
|
||||
117,
|
||||
116,
|
||||
]),
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
} as const;
|
||||
|
||||
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin ? T
|
||||
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
|
||||
: Partial<T>;
|
||||
|
||||
export interface MessageFns<T> {
|
||||
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
||||
create(base?: DeepPartial<T>): T;
|
||||
fromPartial(object: DeepPartial<T>): T;
|
||||
}
|
@ -0,0 +1,167 @@
|
||||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.6.1
|
||||
// protoc unknown
|
||||
// source: api/v1/common.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
|
||||
export const protobufPackage = "memos.api.v1";
|
||||
|
||||
export enum State {
|
||||
STATE_UNSPECIFIED = "STATE_UNSPECIFIED",
|
||||
NORMAL = "NORMAL",
|
||||
ARCHIVED = "ARCHIVED",
|
||||
UNRECOGNIZED = "UNRECOGNIZED",
|
||||
}
|
||||
|
||||
export function stateFromJSON(object: any): State {
|
||||
switch (object) {
|
||||
case 0:
|
||||
case "STATE_UNSPECIFIED":
|
||||
return State.STATE_UNSPECIFIED;
|
||||
case 1:
|
||||
case "NORMAL":
|
||||
return State.NORMAL;
|
||||
case 2:
|
||||
case "ARCHIVED":
|
||||
return State.ARCHIVED;
|
||||
case -1:
|
||||
case "UNRECOGNIZED":
|
||||
default:
|
||||
return State.UNRECOGNIZED;
|
||||
}
|
||||
}
|
||||
|
||||
export function stateToNumber(object: State): number {
|
||||
switch (object) {
|
||||
case State.STATE_UNSPECIFIED:
|
||||
return 0;
|
||||
case State.NORMAL:
|
||||
return 1;
|
||||
case State.ARCHIVED:
|
||||
return 2;
|
||||
case State.UNRECOGNIZED:
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
export enum Direction {
|
||||
DIRECTION_UNSPECIFIED = "DIRECTION_UNSPECIFIED",
|
||||
ASC = "ASC",
|
||||
DESC = "DESC",
|
||||
UNRECOGNIZED = "UNRECOGNIZED",
|
||||
}
|
||||
|
||||
export function directionFromJSON(object: any): Direction {
|
||||
switch (object) {
|
||||
case 0:
|
||||
case "DIRECTION_UNSPECIFIED":
|
||||
return Direction.DIRECTION_UNSPECIFIED;
|
||||
case 1:
|
||||
case "ASC":
|
||||
return Direction.ASC;
|
||||
case 2:
|
||||
case "DESC":
|
||||
return Direction.DESC;
|
||||
case -1:
|
||||
case "UNRECOGNIZED":
|
||||
default:
|
||||
return Direction.UNRECOGNIZED;
|
||||
}
|
||||
}
|
||||
|
||||
export function directionToNumber(object: Direction): number {
|
||||
switch (object) {
|
||||
case Direction.DIRECTION_UNSPECIFIED:
|
||||
return 0;
|
||||
case Direction.ASC:
|
||||
return 1;
|
||||
case Direction.DESC:
|
||||
return 2;
|
||||
case Direction.UNRECOGNIZED:
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/** Used internally for obfuscating the page token. */
|
||||
export interface PageToken {
|
||||
limit: number;
|
||||
offset: number;
|
||||
}
|
||||
|
||||
function createBasePageToken(): PageToken {
|
||||
return { limit: 0, offset: 0 };
|
||||
}
|
||||
|
||||
export const PageToken: MessageFns<PageToken> = {
|
||||
encode(message: PageToken, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.limit !== 0) {
|
||||
writer.uint32(8).int32(message.limit);
|
||||
}
|
||||
if (message.offset !== 0) {
|
||||
writer.uint32(16).int32(message.offset);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): PageToken {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBasePageToken();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 8) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.limit = reader.int32();
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 16) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.offset = reader.int32();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<PageToken>): PageToken {
|
||||
return PageToken.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<PageToken>): PageToken {
|
||||
const message = createBasePageToken();
|
||||
message.limit = object.limit ?? 0;
|
||||
message.offset = object.offset ?? 0;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin ? T
|
||||
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
|
||||
: Partial<T>;
|
||||
|
||||
export interface MessageFns<T> {
|
||||
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
||||
create(base?: DeepPartial<T>): T;
|
||||
fromPartial(object: DeepPartial<T>): T;
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,644 @@
|
||||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.6.1
|
||||
// protoc unknown
|
||||
// source: api/v1/inbox_service.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
import { Empty } from "../../google/protobuf/empty";
|
||||
import { FieldMask } from "../../google/protobuf/field_mask";
|
||||
import { Timestamp } from "../../google/protobuf/timestamp";
|
||||
|
||||
export const protobufPackage = "memos.api.v1";
|
||||
|
||||
export interface Inbox {
|
||||
/**
|
||||
* The name of the inbox.
|
||||
* Format: inboxes/{id}, id is the system generated auto-incremented id.
|
||||
*/
|
||||
name: string;
|
||||
/** Format: users/{user} */
|
||||
sender: string;
|
||||
/** Format: users/{user} */
|
||||
receiver: string;
|
||||
status: Inbox_Status;
|
||||
createTime?: Date | undefined;
|
||||
type: Inbox_Type;
|
||||
activityId?: number | undefined;
|
||||
}
|
||||
|
||||
export enum Inbox_Status {
|
||||
STATUS_UNSPECIFIED = "STATUS_UNSPECIFIED",
|
||||
UNREAD = "UNREAD",
|
||||
ARCHIVED = "ARCHIVED",
|
||||
UNRECOGNIZED = "UNRECOGNIZED",
|
||||
}
|
||||
|
||||
export function inbox_StatusFromJSON(object: any): Inbox_Status {
|
||||
switch (object) {
|
||||
case 0:
|
||||
case "STATUS_UNSPECIFIED":
|
||||
return Inbox_Status.STATUS_UNSPECIFIED;
|
||||
case 1:
|
||||
case "UNREAD":
|
||||
return Inbox_Status.UNREAD;
|
||||
case 2:
|
||||
case "ARCHIVED":
|
||||
return Inbox_Status.ARCHIVED;
|
||||
case -1:
|
||||
case "UNRECOGNIZED":
|
||||
default:
|
||||
return Inbox_Status.UNRECOGNIZED;
|
||||
}
|
||||
}
|
||||
|
||||
export function inbox_StatusToNumber(object: Inbox_Status): number {
|
||||
switch (object) {
|
||||
case Inbox_Status.STATUS_UNSPECIFIED:
|
||||
return 0;
|
||||
case Inbox_Status.UNREAD:
|
||||
return 1;
|
||||
case Inbox_Status.ARCHIVED:
|
||||
return 2;
|
||||
case Inbox_Status.UNRECOGNIZED:
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
export enum Inbox_Type {
|
||||
TYPE_UNSPECIFIED = "TYPE_UNSPECIFIED",
|
||||
MEMO_COMMENT = "MEMO_COMMENT",
|
||||
VERSION_UPDATE = "VERSION_UPDATE",
|
||||
UNRECOGNIZED = "UNRECOGNIZED",
|
||||
}
|
||||
|
||||
export function inbox_TypeFromJSON(object: any): Inbox_Type {
|
||||
switch (object) {
|
||||
case 0:
|
||||
case "TYPE_UNSPECIFIED":
|
||||
return Inbox_Type.TYPE_UNSPECIFIED;
|
||||
case 1:
|
||||
case "MEMO_COMMENT":
|
||||
return Inbox_Type.MEMO_COMMENT;
|
||||
case 2:
|
||||
case "VERSION_UPDATE":
|
||||
return Inbox_Type.VERSION_UPDATE;
|
||||
case -1:
|
||||
case "UNRECOGNIZED":
|
||||
default:
|
||||
return Inbox_Type.UNRECOGNIZED;
|
||||
}
|
||||
}
|
||||
|
||||
export function inbox_TypeToNumber(object: Inbox_Type): number {
|
||||
switch (object) {
|
||||
case Inbox_Type.TYPE_UNSPECIFIED:
|
||||
return 0;
|
||||
case Inbox_Type.MEMO_COMMENT:
|
||||
return 1;
|
||||
case Inbox_Type.VERSION_UPDATE:
|
||||
return 2;
|
||||
case Inbox_Type.UNRECOGNIZED:
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
export interface ListInboxesRequest {
|
||||
/** Format: users/{user} */
|
||||
user: string;
|
||||
/** The maximum number of inbox to return. */
|
||||
pageSize: number;
|
||||
/** Provide this to retrieve the subsequent page. */
|
||||
pageToken: string;
|
||||
}
|
||||
|
||||
export interface ListInboxesResponse {
|
||||
inboxes: Inbox[];
|
||||
/**
|
||||
* A token, which can be sent as `page_token` to retrieve the next page.
|
||||
* If this field is omitted, there are no subsequent pages.
|
||||
*/
|
||||
nextPageToken: string;
|
||||
}
|
||||
|
||||
export interface UpdateInboxRequest {
|
||||
inbox?: Inbox | undefined;
|
||||
updateMask?: string[] | undefined;
|
||||
}
|
||||
|
||||
export interface DeleteInboxRequest {
|
||||
/** The name of the inbox to delete. */
|
||||
name: string;
|
||||
}
|
||||
|
||||
function createBaseInbox(): Inbox {
|
||||
return {
|
||||
name: "",
|
||||
sender: "",
|
||||
receiver: "",
|
||||
status: Inbox_Status.STATUS_UNSPECIFIED,
|
||||
createTime: undefined,
|
||||
type: Inbox_Type.TYPE_UNSPECIFIED,
|
||||
activityId: undefined,
|
||||
};
|
||||
}
|
||||
|
||||
export const Inbox: MessageFns<Inbox> = {
|
||||
encode(message: Inbox, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
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 !== Inbox_Status.STATUS_UNSPECIFIED) {
|
||||
writer.uint32(32).int32(inbox_StatusToNumber(message.status));
|
||||
}
|
||||
if (message.createTime !== undefined) {
|
||||
Timestamp.encode(toTimestamp(message.createTime), writer.uint32(42).fork()).join();
|
||||
}
|
||||
if (message.type !== Inbox_Type.TYPE_UNSPECIFIED) {
|
||||
writer.uint32(48).int32(inbox_TypeToNumber(message.type));
|
||||
}
|
||||
if (message.activityId !== undefined) {
|
||||
writer.uint32(56).int32(message.activityId);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Inbox {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(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 = inbox_StatusFromJSON(reader.int32());
|
||||
continue;
|
||||
}
|
||||
case 5: {
|
||||
if (tag !== 42) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.createTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
|
||||
continue;
|
||||
}
|
||||
case 6: {
|
||||
if (tag !== 48) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.type = inbox_TypeFromJSON(reader.int32());
|
||||
continue;
|
||||
}
|
||||
case 7: {
|
||||
if (tag !== 56) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.activityId = reader.int32();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(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 ?? Inbox_Status.STATUS_UNSPECIFIED;
|
||||
message.createTime = object.createTime ?? undefined;
|
||||
message.type = object.type ?? Inbox_Type.TYPE_UNSPECIFIED;
|
||||
message.activityId = object.activityId ?? undefined;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseListInboxesRequest(): ListInboxesRequest {
|
||||
return { user: "", pageSize: 0, pageToken: "" };
|
||||
}
|
||||
|
||||
export const ListInboxesRequest: MessageFns<ListInboxesRequest> = {
|
||||
encode(message: ListInboxesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.user !== "") {
|
||||
writer.uint32(10).string(message.user);
|
||||
}
|
||||
if (message.pageSize !== 0) {
|
||||
writer.uint32(16).int32(message.pageSize);
|
||||
}
|
||||
if (message.pageToken !== "") {
|
||||
writer.uint32(26).string(message.pageToken);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): ListInboxesRequest {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(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;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 16) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.pageSize = reader.int32();
|
||||
continue;
|
||||
}
|
||||
case 3: {
|
||||
if (tag !== 26) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.pageToken = reader.string();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(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 ?? "";
|
||||
message.pageSize = object.pageSize ?? 0;
|
||||
message.pageToken = object.pageToken ?? "";
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseListInboxesResponse(): ListInboxesResponse {
|
||||
return { inboxes: [], nextPageToken: "" };
|
||||
}
|
||||
|
||||
export const ListInboxesResponse: MessageFns<ListInboxesResponse> = {
|
||||
encode(message: ListInboxesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
for (const v of message.inboxes) {
|
||||
Inbox.encode(v!, writer.uint32(10).fork()).join();
|
||||
}
|
||||
if (message.nextPageToken !== "") {
|
||||
writer.uint32(18).string(message.nextPageToken);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): ListInboxesResponse {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(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;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.nextPageToken = reader.string();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(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)) || [];
|
||||
message.nextPageToken = object.nextPageToken ?? "";
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseUpdateInboxRequest(): UpdateInboxRequest {
|
||||
return { inbox: undefined, updateMask: undefined };
|
||||
}
|
||||
|
||||
export const UpdateInboxRequest: MessageFns<UpdateInboxRequest> = {
|
||||
encode(message: UpdateInboxRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.inbox !== undefined) {
|
||||
Inbox.encode(message.inbox, writer.uint32(10).fork()).join();
|
||||
}
|
||||
if (message.updateMask !== undefined) {
|
||||
FieldMask.encode(FieldMask.wrap(message.updateMask), writer.uint32(18).fork()).join();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): UpdateInboxRequest {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(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.skip(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 createBaseDeleteInboxRequest(): DeleteInboxRequest {
|
||||
return { name: "" };
|
||||
}
|
||||
|
||||
export const DeleteInboxRequest: MessageFns<DeleteInboxRequest> = {
|
||||
encode(message: DeleteInboxRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.name !== "") {
|
||||
writer.uint32(10).string(message.name);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): DeleteInboxRequest {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(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.skip(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;
|
||||
},
|
||||
};
|
||||
|
||||
export type InboxServiceDefinition = typeof InboxServiceDefinition;
|
||||
export const InboxServiceDefinition = {
|
||||
name: "InboxService",
|
||||
fullName: "memos.api.v1.InboxService",
|
||||
methods: {
|
||||
/** ListInboxes lists inboxes for a user. */
|
||||
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, 49, 47, 105, 110, 98, 111, 120, 101, 115]),
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
/** UpdateInbox updates an inbox. */
|
||||
updateInbox: {
|
||||
name: "UpdateInbox",
|
||||
requestType: UpdateInboxRequest,
|
||||
requestStream: false,
|
||||
responseType: Inbox,
|
||||
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([
|
||||
39,
|
||||
58,
|
||||
5,
|
||||
105,
|
||||
110,
|
||||
98,
|
||||
111,
|
||||
120,
|
||||
50,
|
||||
30,
|
||||
47,
|
||||
97,
|
||||
112,
|
||||
105,
|
||||
47,
|
||||
118,
|
||||
49,
|
||||
47,
|
||||
123,
|
||||
105,
|
||||
110,
|
||||
98,
|
||||
111,
|
||||
120,
|
||||
46,
|
||||
110,
|
||||
97,
|
||||
109,
|
||||
101,
|
||||
61,
|
||||
105,
|
||||
110,
|
||||
98,
|
||||
111,
|
||||
120,
|
||||
101,
|
||||
115,
|
||||
47,
|
||||
42,
|
||||
125,
|
||||
]),
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
/** DeleteInbox deletes an inbox. */
|
||||
deleteInbox: {
|
||||
name: "DeleteInbox",
|
||||
requestType: DeleteInboxRequest,
|
||||
requestStream: false,
|
||||
responseType: Empty,
|
||||
responseStream: false,
|
||||
options: {
|
||||
_unknownFields: {
|
||||
8410: [new Uint8Array([4, 110, 97, 109, 101])],
|
||||
578365826: [
|
||||
new Uint8Array([
|
||||
26,
|
||||
42,
|
||||
24,
|
||||
47,
|
||||
97,
|
||||
112,
|
||||
105,
|
||||
47,
|
||||
118,
|
||||
49,
|
||||
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 globalThis.Array<infer U> ? globalThis.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 = Math.trunc(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 globalThis.Date(millis);
|
||||
}
|
||||
|
||||
export interface MessageFns<T> {
|
||||
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
||||
create(base?: DeepPartial<T>): T;
|
||||
fromPartial(object: DeepPartial<T>): T;
|
||||
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,122 @@
|
||||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.6.1
|
||||
// protoc unknown
|
||||
// source: api/v1/reaction_service.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
|
||||
export const protobufPackage = "memos.api.v1";
|
||||
|
||||
export interface Reaction {
|
||||
id: number;
|
||||
/**
|
||||
* The name of the creator.
|
||||
* Format: users/{user}
|
||||
*/
|
||||
creator: string;
|
||||
/**
|
||||
* The content identifier.
|
||||
* For memo, it should be the `Memo.name`.
|
||||
*/
|
||||
contentId: string;
|
||||
reactionType: string;
|
||||
}
|
||||
|
||||
function createBaseReaction(): Reaction {
|
||||
return { id: 0, creator: "", contentId: "", reactionType: "" };
|
||||
}
|
||||
|
||||
export const Reaction: MessageFns<Reaction> = {
|
||||
encode(message: Reaction, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.id !== 0) {
|
||||
writer.uint32(8).int32(message.id);
|
||||
}
|
||||
if (message.creator !== "") {
|
||||
writer.uint32(18).string(message.creator);
|
||||
}
|
||||
if (message.contentId !== "") {
|
||||
writer.uint32(26).string(message.contentId);
|
||||
}
|
||||
if (message.reactionType !== "") {
|
||||
writer.uint32(34).string(message.reactionType);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Reaction {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseReaction();
|
||||
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.creator = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 3: {
|
||||
if (tag !== 26) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.contentId = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 4: {
|
||||
if (tag !== 34) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.reactionType = reader.string();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<Reaction>): Reaction {
|
||||
return Reaction.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<Reaction>): Reaction {
|
||||
const message = createBaseReaction();
|
||||
message.id = object.id ?? 0;
|
||||
message.creator = object.creator ?? "";
|
||||
message.contentId = object.contentId ?? "";
|
||||
message.reactionType = object.reactionType ?? "";
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin ? T
|
||||
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
|
||||
: Partial<T>;
|
||||
|
||||
export interface MessageFns<T> {
|
||||
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
||||
create(base?: DeepPartial<T>): T;
|
||||
fromPartial(object: DeepPartial<T>): T;
|
||||
}
|
@ -0,0 +1,897 @@
|
||||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.6.1
|
||||
// protoc unknown
|
||||
// source: api/v1/resource_service.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
import { HttpBody } from "../../google/api/httpbody";
|
||||
import { Empty } from "../../google/protobuf/empty";
|
||||
import { FieldMask } from "../../google/protobuf/field_mask";
|
||||
import { Timestamp } from "../../google/protobuf/timestamp";
|
||||
|
||||
export const protobufPackage = "memos.api.v1";
|
||||
|
||||
export interface Resource {
|
||||
/**
|
||||
* The name of the resource.
|
||||
* Format: resources/{resource}, resource is the user defined if or uuid.
|
||||
*/
|
||||
name: string;
|
||||
createTime?: Date | undefined;
|
||||
filename: string;
|
||||
content: Uint8Array;
|
||||
externalLink: string;
|
||||
type: string;
|
||||
size: number;
|
||||
/** The related memo. Refer to `Memo.name`. */
|
||||
memo?: string | undefined;
|
||||
}
|
||||
|
||||
export interface CreateResourceRequest {
|
||||
resource?: Resource | undefined;
|
||||
}
|
||||
|
||||
export interface ListResourcesRequest {
|
||||
}
|
||||
|
||||
export interface ListResourcesResponse {
|
||||
resources: Resource[];
|
||||
}
|
||||
|
||||
export interface GetResourceRequest {
|
||||
/** The name of the resource. */
|
||||
name: string;
|
||||
}
|
||||
|
||||
export interface GetResourceBinaryRequest {
|
||||
/** The name of the resource. */
|
||||
name: string;
|
||||
/** The filename of the resource. Mainly used for downloading. */
|
||||
filename: string;
|
||||
/** A flag indicating if the thumbnail version of the resource should be returned */
|
||||
thumbnail: boolean;
|
||||
}
|
||||
|
||||
export interface UpdateResourceRequest {
|
||||
resource?: Resource | undefined;
|
||||
updateMask?: string[] | undefined;
|
||||
}
|
||||
|
||||
export interface DeleteResourceRequest {
|
||||
/** The name of the resource. */
|
||||
name: string;
|
||||
}
|
||||
|
||||
function createBaseResource(): Resource {
|
||||
return {
|
||||
name: "",
|
||||
createTime: undefined,
|
||||
filename: "",
|
||||
content: new Uint8Array(0),
|
||||
externalLink: "",
|
||||
type: "",
|
||||
size: 0,
|
||||
memo: undefined,
|
||||
};
|
||||
}
|
||||
|
||||
export const Resource: MessageFns<Resource> = {
|
||||
encode(message: Resource, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.name !== "") {
|
||||
writer.uint32(10).string(message.name);
|
||||
}
|
||||
if (message.createTime !== undefined) {
|
||||
Timestamp.encode(toTimestamp(message.createTime), writer.uint32(26).fork()).join();
|
||||
}
|
||||
if (message.filename !== "") {
|
||||
writer.uint32(34).string(message.filename);
|
||||
}
|
||||
if (message.content.length !== 0) {
|
||||
writer.uint32(42).bytes(message.content);
|
||||
}
|
||||
if (message.externalLink !== "") {
|
||||
writer.uint32(50).string(message.externalLink);
|
||||
}
|
||||
if (message.type !== "") {
|
||||
writer.uint32(58).string(message.type);
|
||||
}
|
||||
if (message.size !== 0) {
|
||||
writer.uint32(64).int64(message.size);
|
||||
}
|
||||
if (message.memo !== undefined) {
|
||||
writer.uint32(74).string(message.memo);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Resource {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(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 !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.name = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 3: {
|
||||
if (tag !== 26) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.createTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
|
||||
continue;
|
||||
}
|
||||
case 4: {
|
||||
if (tag !== 34) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.filename = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 5: {
|
||||
if (tag !== 42) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.content = reader.bytes();
|
||||
continue;
|
||||
}
|
||||
case 6: {
|
||||
if (tag !== 50) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.externalLink = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 7: {
|
||||
if (tag !== 58) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.type = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 8: {
|
||||
if (tag !== 64) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.size = longToNumber(reader.int64());
|
||||
continue;
|
||||
}
|
||||
case 9: {
|
||||
if (tag !== 74) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.memo = reader.string();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<Resource>): Resource {
|
||||
return Resource.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<Resource>): Resource {
|
||||
const message = createBaseResource();
|
||||
message.name = object.name ?? "";
|
||||
message.createTime = object.createTime ?? undefined;
|
||||
message.filename = object.filename ?? "";
|
||||
message.content = object.content ?? new Uint8Array(0);
|
||||
message.externalLink = object.externalLink ?? "";
|
||||
message.type = object.type ?? "";
|
||||
message.size = object.size ?? 0;
|
||||
message.memo = object.memo ?? undefined;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseCreateResourceRequest(): CreateResourceRequest {
|
||||
return { resource: undefined };
|
||||
}
|
||||
|
||||
export const CreateResourceRequest: MessageFns<CreateResourceRequest> = {
|
||||
encode(message: CreateResourceRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.resource !== undefined) {
|
||||
Resource.encode(message.resource, writer.uint32(10).fork()).join();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): CreateResourceRequest {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(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.resource = Resource.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<CreateResourceRequest>): CreateResourceRequest {
|
||||
return CreateResourceRequest.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<CreateResourceRequest>): CreateResourceRequest {
|
||||
const message = createBaseCreateResourceRequest();
|
||||
message.resource = (object.resource !== undefined && object.resource !== null)
|
||||
? Resource.fromPartial(object.resource)
|
||||
: undefined;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseListResourcesRequest(): ListResourcesRequest {
|
||||
return {};
|
||||
}
|
||||
|
||||
export const ListResourcesRequest: MessageFns<ListResourcesRequest> = {
|
||||
encode(_: ListResourcesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): ListResourcesRequest {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(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.skip(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: MessageFns<ListResourcesResponse> = {
|
||||
encode(message: ListResourcesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
for (const v of message.resources) {
|
||||
Resource.encode(v!, writer.uint32(10).fork()).join();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): ListResourcesResponse {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(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.skip(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 createBaseGetResourceRequest(): GetResourceRequest {
|
||||
return { name: "" };
|
||||
}
|
||||
|
||||
export const GetResourceRequest: MessageFns<GetResourceRequest> = {
|
||||
encode(message: GetResourceRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.name !== "") {
|
||||
writer.uint32(10).string(message.name);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): GetResourceRequest {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseGetResourceRequest();
|
||||
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.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<GetResourceRequest>): GetResourceRequest {
|
||||
return GetResourceRequest.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<GetResourceRequest>): GetResourceRequest {
|
||||
const message = createBaseGetResourceRequest();
|
||||
message.name = object.name ?? "";
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseGetResourceBinaryRequest(): GetResourceBinaryRequest {
|
||||
return { name: "", filename: "", thumbnail: false };
|
||||
}
|
||||
|
||||
export const GetResourceBinaryRequest: MessageFns<GetResourceBinaryRequest> = {
|
||||
encode(message: GetResourceBinaryRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.name !== "") {
|
||||
writer.uint32(10).string(message.name);
|
||||
}
|
||||
if (message.filename !== "") {
|
||||
writer.uint32(18).string(message.filename);
|
||||
}
|
||||
if (message.thumbnail !== false) {
|
||||
writer.uint32(24).bool(message.thumbnail);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): GetResourceBinaryRequest {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseGetResourceBinaryRequest();
|
||||
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.filename = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 3: {
|
||||
if (tag !== 24) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.thumbnail = reader.bool();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<GetResourceBinaryRequest>): GetResourceBinaryRequest {
|
||||
return GetResourceBinaryRequest.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<GetResourceBinaryRequest>): GetResourceBinaryRequest {
|
||||
const message = createBaseGetResourceBinaryRequest();
|
||||
message.name = object.name ?? "";
|
||||
message.filename = object.filename ?? "";
|
||||
message.thumbnail = object.thumbnail ?? false;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseUpdateResourceRequest(): UpdateResourceRequest {
|
||||
return { resource: undefined, updateMask: undefined };
|
||||
}
|
||||
|
||||
export const UpdateResourceRequest: MessageFns<UpdateResourceRequest> = {
|
||||
encode(message: UpdateResourceRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.resource !== undefined) {
|
||||
Resource.encode(message.resource, writer.uint32(10).fork()).join();
|
||||
}
|
||||
if (message.updateMask !== undefined) {
|
||||
FieldMask.encode(FieldMask.wrap(message.updateMask), writer.uint32(18).fork()).join();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): UpdateResourceRequest {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(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.skip(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 createBaseDeleteResourceRequest(): DeleteResourceRequest {
|
||||
return { name: "" };
|
||||
}
|
||||
|
||||
export const DeleteResourceRequest: MessageFns<DeleteResourceRequest> = {
|
||||
encode(message: DeleteResourceRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.name !== "") {
|
||||
writer.uint32(10).string(message.name);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): DeleteResourceRequest {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(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 !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.name = reader.string();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<DeleteResourceRequest>): DeleteResourceRequest {
|
||||
return DeleteResourceRequest.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<DeleteResourceRequest>): DeleteResourceRequest {
|
||||
const message = createBaseDeleteResourceRequest();
|
||||
message.name = object.name ?? "";
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
export type ResourceServiceDefinition = typeof ResourceServiceDefinition;
|
||||
export const ResourceServiceDefinition = {
|
||||
name: "ResourceService",
|
||||
fullName: "memos.api.v1.ResourceService",
|
||||
methods: {
|
||||
/** CreateResource creates a new resource. */
|
||||
createResource: {
|
||||
name: "CreateResource",
|
||||
requestType: CreateResourceRequest,
|
||||
requestStream: false,
|
||||
responseType: Resource,
|
||||
responseStream: false,
|
||||
options: {
|
||||
_unknownFields: {
|
||||
578365826: [
|
||||
new Uint8Array([
|
||||
29,
|
||||
58,
|
||||
8,
|
||||
114,
|
||||
101,
|
||||
115,
|
||||
111,
|
||||
117,
|
||||
114,
|
||||
99,
|
||||
101,
|
||||
34,
|
||||
17,
|
||||
47,
|
||||
97,
|
||||
112,
|
||||
105,
|
||||
47,
|
||||
118,
|
||||
49,
|
||||
47,
|
||||
114,
|
||||
101,
|
||||
115,
|
||||
111,
|
||||
117,
|
||||
114,
|
||||
99,
|
||||
101,
|
||||
115,
|
||||
]),
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
/** ListResources lists all resources. */
|
||||
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, 49, 47, 114, 101, 115, 111, 117, 114, 99, 101, 115]),
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
/** GetResource returns a resource by name. */
|
||||
getResource: {
|
||||
name: "GetResource",
|
||||
requestType: GetResourceRequest,
|
||||
requestStream: false,
|
||||
responseType: Resource,
|
||||
responseStream: false,
|
||||
options: {
|
||||
_unknownFields: {
|
||||
8410: [new Uint8Array([4, 110, 97, 109, 101])],
|
||||
578365826: [
|
||||
new Uint8Array([
|
||||
28,
|
||||
18,
|
||||
26,
|
||||
47,
|
||||
97,
|
||||
112,
|
||||
105,
|
||||
47,
|
||||
118,
|
||||
49,
|
||||
47,
|
||||
123,
|
||||
110,
|
||||
97,
|
||||
109,
|
||||
101,
|
||||
61,
|
||||
114,
|
||||
101,
|
||||
115,
|
||||
111,
|
||||
117,
|
||||
114,
|
||||
99,
|
||||
101,
|
||||
115,
|
||||
47,
|
||||
42,
|
||||
125,
|
||||
]),
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
/** GetResourceBinary returns a resource binary by name. */
|
||||
getResourceBinary: {
|
||||
name: "GetResourceBinary",
|
||||
requestType: GetResourceBinaryRequest,
|
||||
requestStream: false,
|
||||
responseType: HttpBody,
|
||||
responseStream: false,
|
||||
options: {
|
||||
_unknownFields: {
|
||||
8410: [new Uint8Array([13, 110, 97, 109, 101, 44, 102, 105, 108, 101, 110, 97, 109, 101])],
|
||||
578365826: [
|
||||
new Uint8Array([
|
||||
37,
|
||||
18,
|
||||
35,
|
||||
47,
|
||||
102,
|
||||
105,
|
||||
108,
|
||||
101,
|
||||
47,
|
||||
123,
|
||||
110,
|
||||
97,
|
||||
109,
|
||||
101,
|
||||
61,
|
||||
114,
|
||||
101,
|
||||
115,
|
||||
111,
|
||||
117,
|
||||
114,
|
||||
99,
|
||||
101,
|
||||
115,
|
||||
47,
|
||||
42,
|
||||
125,
|
||||
47,
|
||||
123,
|
||||
102,
|
||||
105,
|
||||
108,
|
||||
101,
|
||||
110,
|
||||
97,
|
||||
109,
|
||||
101,
|
||||
125,
|
||||
]),
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
/** UpdateResource updates a resource. */
|
||||
updateResource: {
|
||||
name: "UpdateResource",
|
||||
requestType: UpdateResourceRequest,
|
||||
requestStream: false,
|
||||
responseType: Resource,
|
||||
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([
|
||||
47,
|
||||
58,
|
||||
8,
|
||||
114,
|
||||
101,
|
||||
115,
|
||||
111,
|
||||
117,
|
||||
114,
|
||||
99,
|
||||
101,
|
||||
50,
|
||||
35,
|
||||
47,
|
||||
97,
|
||||
112,
|
||||
105,
|
||||
47,
|
||||
118,
|
||||
49,
|
||||
47,
|
||||
123,
|
||||
114,
|
||||
101,
|
||||
115,
|
||||
111,
|
||||
117,
|
||||
114,
|
||||
99,
|
||||
101,
|
||||
46,
|
||||
110,
|
||||
97,
|
||||
109,
|
||||
101,
|
||||
61,
|
||||
114,
|
||||
101,
|
||||
115,
|
||||
111,
|
||||
117,
|
||||
114,
|
||||
99,
|
||||
101,
|
||||
115,
|
||||
47,
|
||||
42,
|
||||
125,
|
||||
]),
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
/** DeleteResource deletes a resource by name. */
|
||||
deleteResource: {
|
||||
name: "DeleteResource",
|
||||
requestType: DeleteResourceRequest,
|
||||
requestStream: false,
|
||||
responseType: Empty,
|
||||
responseStream: false,
|
||||
options: {
|
||||
_unknownFields: {
|
||||
8410: [new Uint8Array([4, 110, 97, 109, 101])],
|
||||
578365826: [
|
||||
new Uint8Array([
|
||||
28,
|
||||
42,
|
||||
26,
|
||||
47,
|
||||
97,
|
||||
112,
|
||||
105,
|
||||
47,
|
||||
118,
|
||||
49,
|
||||
47,
|
||||
123,
|
||||
110,
|
||||
97,
|
||||
109,
|
||||
101,
|
||||
61,
|
||||
114,
|
||||
101,
|
||||
115,
|
||||
111,
|
||||
117,
|
||||
114,
|
||||
99,
|
||||
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 globalThis.Array<infer U> ? globalThis.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 = Math.trunc(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 globalThis.Date(millis);
|
||||
}
|
||||
|
||||
function longToNumber(int64: { toString(): string }): number {
|
||||
const num = globalThis.Number(int64.toString());
|
||||
if (num > globalThis.Number.MAX_SAFE_INTEGER) {
|
||||
throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
|
||||
}
|
||||
if (num < globalThis.Number.MIN_SAFE_INTEGER) {
|
||||
throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER");
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
export interface MessageFns<T> {
|
||||
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
||||
create(base?: DeepPartial<T>): T;
|
||||
fromPartial(object: DeepPartial<T>): T;
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,816 @@
|
||||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.6.1
|
||||
// protoc unknown
|
||||
// source: api/v1/webhook_service.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
import { Empty } from "../../google/protobuf/empty";
|
||||
import { FieldMask } from "../../google/protobuf/field_mask";
|
||||
import { Timestamp } from "../../google/protobuf/timestamp";
|
||||
import { Memo } from "./memo_service";
|
||||
|
||||
export const protobufPackage = "memos.api.v1";
|
||||
|
||||
export interface Webhook {
|
||||
id: number;
|
||||
/** The name of the creator. */
|
||||
creator: string;
|
||||
createTime?: Date | undefined;
|
||||
updateTime?: Date | undefined;
|
||||
name: string;
|
||||
url: string;
|
||||
}
|
||||
|
||||
export interface CreateWebhookRequest {
|
||||
name: string;
|
||||
url: string;
|
||||
}
|
||||
|
||||
export interface GetWebhookRequest {
|
||||
id: number;
|
||||
}
|
||||
|
||||
export interface ListWebhooksRequest {
|
||||
/** The name of the creator. */
|
||||
creator: string;
|
||||
}
|
||||
|
||||
export interface ListWebhooksResponse {
|
||||
webhooks: Webhook[];
|
||||
}
|
||||
|
||||
export interface UpdateWebhookRequest {
|
||||
webhook?: Webhook | undefined;
|
||||
updateMask?: string[] | undefined;
|
||||
}
|
||||
|
||||
export interface DeleteWebhookRequest {
|
||||
id: number;
|
||||
}
|
||||
|
||||
export interface WebhookRequestPayload {
|
||||
url: string;
|
||||
activityType: string;
|
||||
/**
|
||||
* The name of the creator.
|
||||
* Format: users/{user}
|
||||
*/
|
||||
creator: string;
|
||||
createTime?: Date | undefined;
|
||||
memo?: Memo | undefined;
|
||||
}
|
||||
|
||||
function createBaseWebhook(): Webhook {
|
||||
return { id: 0, creator: "", createTime: undefined, updateTime: undefined, name: "", url: "" };
|
||||
}
|
||||
|
||||
export const Webhook: MessageFns<Webhook> = {
|
||||
encode(message: Webhook, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.id !== 0) {
|
||||
writer.uint32(8).int32(message.id);
|
||||
}
|
||||
if (message.creator !== "") {
|
||||
writer.uint32(18).string(message.creator);
|
||||
}
|
||||
if (message.createTime !== undefined) {
|
||||
Timestamp.encode(toTimestamp(message.createTime), writer.uint32(26).fork()).join();
|
||||
}
|
||||
if (message.updateTime !== undefined) {
|
||||
Timestamp.encode(toTimestamp(message.updateTime), writer.uint32(34).fork()).join();
|
||||
}
|
||||
if (message.name !== "") {
|
||||
writer.uint32(42).string(message.name);
|
||||
}
|
||||
if (message.url !== "") {
|
||||
writer.uint32(50).string(message.url);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Webhook {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseWebhook();
|
||||
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.creator = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 3: {
|
||||
if (tag !== 26) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.createTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
|
||||
continue;
|
||||
}
|
||||
case 4: {
|
||||
if (tag !== 34) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.updateTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
|
||||
continue;
|
||||
}
|
||||
case 5: {
|
||||
if (tag !== 42) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.name = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 6: {
|
||||
if (tag !== 50) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.url = reader.string();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<Webhook>): Webhook {
|
||||
return Webhook.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<Webhook>): Webhook {
|
||||
const message = createBaseWebhook();
|
||||
message.id = object.id ?? 0;
|
||||
message.creator = object.creator ?? "";
|
||||
message.createTime = object.createTime ?? undefined;
|
||||
message.updateTime = object.updateTime ?? undefined;
|
||||
message.name = object.name ?? "";
|
||||
message.url = object.url ?? "";
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseCreateWebhookRequest(): CreateWebhookRequest {
|
||||
return { name: "", url: "" };
|
||||
}
|
||||
|
||||
export const CreateWebhookRequest: MessageFns<CreateWebhookRequest> = {
|
||||
encode(message: CreateWebhookRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.name !== "") {
|
||||
writer.uint32(10).string(message.name);
|
||||
}
|
||||
if (message.url !== "") {
|
||||
writer.uint32(18).string(message.url);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): CreateWebhookRequest {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseCreateWebhookRequest();
|
||||
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.url = reader.string();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<CreateWebhookRequest>): CreateWebhookRequest {
|
||||
return CreateWebhookRequest.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<CreateWebhookRequest>): CreateWebhookRequest {
|
||||
const message = createBaseCreateWebhookRequest();
|
||||
message.name = object.name ?? "";
|
||||
message.url = object.url ?? "";
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseGetWebhookRequest(): GetWebhookRequest {
|
||||
return { id: 0 };
|
||||
}
|
||||
|
||||
export const GetWebhookRequest: MessageFns<GetWebhookRequest> = {
|
||||
encode(message: GetWebhookRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.id !== 0) {
|
||||
writer.uint32(8).int32(message.id);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): GetWebhookRequest {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseGetWebhookRequest();
|
||||
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.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<GetWebhookRequest>): GetWebhookRequest {
|
||||
return GetWebhookRequest.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<GetWebhookRequest>): GetWebhookRequest {
|
||||
const message = createBaseGetWebhookRequest();
|
||||
message.id = object.id ?? 0;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseListWebhooksRequest(): ListWebhooksRequest {
|
||||
return { creator: "" };
|
||||
}
|
||||
|
||||
export const ListWebhooksRequest: MessageFns<ListWebhooksRequest> = {
|
||||
encode(message: ListWebhooksRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.creator !== "") {
|
||||
writer.uint32(18).string(message.creator);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): ListWebhooksRequest {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseListWebhooksRequest();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.creator = reader.string();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<ListWebhooksRequest>): ListWebhooksRequest {
|
||||
return ListWebhooksRequest.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<ListWebhooksRequest>): ListWebhooksRequest {
|
||||
const message = createBaseListWebhooksRequest();
|
||||
message.creator = object.creator ?? "";
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseListWebhooksResponse(): ListWebhooksResponse {
|
||||
return { webhooks: [] };
|
||||
}
|
||||
|
||||
export const ListWebhooksResponse: MessageFns<ListWebhooksResponse> = {
|
||||
encode(message: ListWebhooksResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
for (const v of message.webhooks) {
|
||||
Webhook.encode(v!, writer.uint32(10).fork()).join();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): ListWebhooksResponse {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseListWebhooksResponse();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.webhooks.push(Webhook.decode(reader, reader.uint32()));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<ListWebhooksResponse>): ListWebhooksResponse {
|
||||
return ListWebhooksResponse.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<ListWebhooksResponse>): ListWebhooksResponse {
|
||||
const message = createBaseListWebhooksResponse();
|
||||
message.webhooks = object.webhooks?.map((e) => Webhook.fromPartial(e)) || [];
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseUpdateWebhookRequest(): UpdateWebhookRequest {
|
||||
return { webhook: undefined, updateMask: undefined };
|
||||
}
|
||||
|
||||
export const UpdateWebhookRequest: MessageFns<UpdateWebhookRequest> = {
|
||||
encode(message: UpdateWebhookRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.webhook !== undefined) {
|
||||
Webhook.encode(message.webhook, writer.uint32(10).fork()).join();
|
||||
}
|
||||
if (message.updateMask !== undefined) {
|
||||
FieldMask.encode(FieldMask.wrap(message.updateMask), writer.uint32(18).fork()).join();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): UpdateWebhookRequest {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseUpdateWebhookRequest();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.webhook = Webhook.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.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<UpdateWebhookRequest>): UpdateWebhookRequest {
|
||||
return UpdateWebhookRequest.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<UpdateWebhookRequest>): UpdateWebhookRequest {
|
||||
const message = createBaseUpdateWebhookRequest();
|
||||
message.webhook = (object.webhook !== undefined && object.webhook !== null)
|
||||
? Webhook.fromPartial(object.webhook)
|
||||
: undefined;
|
||||
message.updateMask = object.updateMask ?? undefined;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseDeleteWebhookRequest(): DeleteWebhookRequest {
|
||||
return { id: 0 };
|
||||
}
|
||||
|
||||
export const DeleteWebhookRequest: MessageFns<DeleteWebhookRequest> = {
|
||||
encode(message: DeleteWebhookRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.id !== 0) {
|
||||
writer.uint32(8).int32(message.id);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): DeleteWebhookRequest {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseDeleteWebhookRequest();
|
||||
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.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<DeleteWebhookRequest>): DeleteWebhookRequest {
|
||||
return DeleteWebhookRequest.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<DeleteWebhookRequest>): DeleteWebhookRequest {
|
||||
const message = createBaseDeleteWebhookRequest();
|
||||
message.id = object.id ?? 0;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseWebhookRequestPayload(): WebhookRequestPayload {
|
||||
return { url: "", activityType: "", creator: "", createTime: undefined, memo: undefined };
|
||||
}
|
||||
|
||||
export const WebhookRequestPayload: MessageFns<WebhookRequestPayload> = {
|
||||
encode(message: WebhookRequestPayload, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.url !== "") {
|
||||
writer.uint32(10).string(message.url);
|
||||
}
|
||||
if (message.activityType !== "") {
|
||||
writer.uint32(18).string(message.activityType);
|
||||
}
|
||||
if (message.creator !== "") {
|
||||
writer.uint32(26).string(message.creator);
|
||||
}
|
||||
if (message.createTime !== undefined) {
|
||||
Timestamp.encode(toTimestamp(message.createTime), writer.uint32(34).fork()).join();
|
||||
}
|
||||
if (message.memo !== undefined) {
|
||||
Memo.encode(message.memo, writer.uint32(42).fork()).join();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): WebhookRequestPayload {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseWebhookRequestPayload();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.url = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.activityType = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 3: {
|
||||
if (tag !== 26) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.creator = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 4: {
|
||||
if (tag !== 34) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.createTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
|
||||
continue;
|
||||
}
|
||||
case 5: {
|
||||
if (tag !== 42) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.memo = Memo.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<WebhookRequestPayload>): WebhookRequestPayload {
|
||||
return WebhookRequestPayload.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<WebhookRequestPayload>): WebhookRequestPayload {
|
||||
const message = createBaseWebhookRequestPayload();
|
||||
message.url = object.url ?? "";
|
||||
message.activityType = object.activityType ?? "";
|
||||
message.creator = object.creator ?? "";
|
||||
message.createTime = object.createTime ?? undefined;
|
||||
message.memo = (object.memo !== undefined && object.memo !== null) ? Memo.fromPartial(object.memo) : undefined;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
export type WebhookServiceDefinition = typeof WebhookServiceDefinition;
|
||||
export const WebhookServiceDefinition = {
|
||||
name: "WebhookService",
|
||||
fullName: "memos.api.v1.WebhookService",
|
||||
methods: {
|
||||
/** CreateWebhook creates a new webhook. */
|
||||
createWebhook: {
|
||||
name: "CreateWebhook",
|
||||
requestType: CreateWebhookRequest,
|
||||
requestStream: false,
|
||||
responseType: Webhook,
|
||||
responseStream: false,
|
||||
options: {
|
||||
_unknownFields: {
|
||||
578365826: [
|
||||
new Uint8Array([
|
||||
21,
|
||||
58,
|
||||
1,
|
||||
42,
|
||||
34,
|
||||
16,
|
||||
47,
|
||||
97,
|
||||
112,
|
||||
105,
|
||||
47,
|
||||
118,
|
||||
49,
|
||||
47,
|
||||
119,
|
||||
101,
|
||||
98,
|
||||
104,
|
||||
111,
|
||||
111,
|
||||
107,
|
||||
115,
|
||||
]),
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
/** GetWebhook returns a webhook by id. */
|
||||
getWebhook: {
|
||||
name: "GetWebhook",
|
||||
requestType: GetWebhookRequest,
|
||||
requestStream: false,
|
||||
responseType: Webhook,
|
||||
responseStream: false,
|
||||
options: {
|
||||
_unknownFields: {
|
||||
8410: [new Uint8Array([2, 105, 100])],
|
||||
578365826: [
|
||||
new Uint8Array([
|
||||
23,
|
||||
18,
|
||||
21,
|
||||
47,
|
||||
97,
|
||||
112,
|
||||
105,
|
||||
47,
|
||||
118,
|
||||
49,
|
||||
47,
|
||||
119,
|
||||
101,
|
||||
98,
|
||||
104,
|
||||
111,
|
||||
111,
|
||||
107,
|
||||
115,
|
||||
47,
|
||||
123,
|
||||
105,
|
||||
100,
|
||||
125,
|
||||
]),
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
/** ListWebhooks returns a list of webhooks. */
|
||||
listWebhooks: {
|
||||
name: "ListWebhooks",
|
||||
requestType: ListWebhooksRequest,
|
||||
requestStream: false,
|
||||
responseType: ListWebhooksResponse,
|
||||
responseStream: false,
|
||||
options: {
|
||||
_unknownFields: {
|
||||
578365826: [
|
||||
new Uint8Array([18, 18, 16, 47, 97, 112, 105, 47, 118, 49, 47, 119, 101, 98, 104, 111, 111, 107, 115]),
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
/** UpdateWebhook updates a webhook. */
|
||||
updateWebhook: {
|
||||
name: "UpdateWebhook",
|
||||
requestType: UpdateWebhookRequest,
|
||||
requestStream: false,
|
||||
responseType: Webhook,
|
||||
responseStream: false,
|
||||
options: {
|
||||
_unknownFields: {
|
||||
8410: [
|
||||
new Uint8Array([
|
||||
19,
|
||||
119,
|
||||
101,
|
||||
98,
|
||||
104,
|
||||
111,
|
||||
111,
|
||||
107,
|
||||
44,
|
||||
117,
|
||||
112,
|
||||
100,
|
||||
97,
|
||||
116,
|
||||
101,
|
||||
95,
|
||||
109,
|
||||
97,
|
||||
115,
|
||||
107,
|
||||
]),
|
||||
],
|
||||
578365826: [
|
||||
new Uint8Array([
|
||||
40,
|
||||
58,
|
||||
7,
|
||||
119,
|
||||
101,
|
||||
98,
|
||||
104,
|
||||
111,
|
||||
111,
|
||||
107,
|
||||
50,
|
||||
29,
|
||||
47,
|
||||
97,
|
||||
112,
|
||||
105,
|
||||
47,
|
||||
118,
|
||||
49,
|
||||
47,
|
||||
119,
|
||||
101,
|
||||
98,
|
||||
104,
|
||||
111,
|
||||
111,
|
||||
107,
|
||||
115,
|
||||
47,
|
||||
123,
|
||||
119,
|
||||
101,
|
||||
98,
|
||||
104,
|
||||
111,
|
||||
111,
|
||||
107,
|
||||
46,
|
||||
105,
|
||||
100,
|
||||
125,
|
||||
]),
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
/** DeleteWebhook deletes a webhook by id. */
|
||||
deleteWebhook: {
|
||||
name: "DeleteWebhook",
|
||||
requestType: DeleteWebhookRequest,
|
||||
requestStream: false,
|
||||
responseType: Empty,
|
||||
responseStream: false,
|
||||
options: {
|
||||
_unknownFields: {
|
||||
8410: [new Uint8Array([2, 105, 100])],
|
||||
578365826: [
|
||||
new Uint8Array([
|
||||
23,
|
||||
42,
|
||||
21,
|
||||
47,
|
||||
97,
|
||||
112,
|
||||
105,
|
||||
47,
|
||||
118,
|
||||
49,
|
||||
47,
|
||||
119,
|
||||
101,
|
||||
98,
|
||||
104,
|
||||
111,
|
||||
111,
|
||||
107,
|
||||
115,
|
||||
47,
|
||||
123,
|
||||
105,
|
||||
100,
|
||||
125,
|
||||
]),
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
} as const;
|
||||
|
||||
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin ? T
|
||||
: T extends globalThis.Array<infer U> ? globalThis.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 = Math.trunc(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 globalThis.Date(millis);
|
||||
}
|
||||
|
||||
export interface MessageFns<T> {
|
||||
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
||||
create(base?: DeepPartial<T>): T;
|
||||
fromPartial(object: DeepPartial<T>): T;
|
||||
}
|
@ -0,0 +1,210 @@
|
||||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.6.1
|
||||
// protoc unknown
|
||||
// source: api/v1/workspace_service.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
|
||||
export const protobufPackage = "memos.api.v1";
|
||||
|
||||
export interface WorkspaceProfile {
|
||||
/**
|
||||
* The name of instance owner.
|
||||
* Format: users/{user}
|
||||
*/
|
||||
owner: string;
|
||||
/** version is the current version of instance */
|
||||
version: string;
|
||||
/** mode is the instance mode (e.g. "prod", "dev" or "demo"). */
|
||||
mode: string;
|
||||
/** instance_url is the URL of the instance. */
|
||||
instanceUrl: string;
|
||||
}
|
||||
|
||||
export interface GetWorkspaceProfileRequest {
|
||||
}
|
||||
|
||||
function createBaseWorkspaceProfile(): WorkspaceProfile {
|
||||
return { owner: "", version: "", mode: "", instanceUrl: "" };
|
||||
}
|
||||
|
||||
export const WorkspaceProfile: MessageFns<WorkspaceProfile> = {
|
||||
encode(message: WorkspaceProfile, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.owner !== "") {
|
||||
writer.uint32(10).string(message.owner);
|
||||
}
|
||||
if (message.version !== "") {
|
||||
writer.uint32(18).string(message.version);
|
||||
}
|
||||
if (message.mode !== "") {
|
||||
writer.uint32(26).string(message.mode);
|
||||
}
|
||||
if (message.instanceUrl !== "") {
|
||||
writer.uint32(50).string(message.instanceUrl);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): WorkspaceProfile {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseWorkspaceProfile();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.owner = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.version = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 3: {
|
||||
if (tag !== 26) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.mode = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 6: {
|
||||
if (tag !== 50) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.instanceUrl = reader.string();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<WorkspaceProfile>): WorkspaceProfile {
|
||||
return WorkspaceProfile.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<WorkspaceProfile>): WorkspaceProfile {
|
||||
const message = createBaseWorkspaceProfile();
|
||||
message.owner = object.owner ?? "";
|
||||
message.version = object.version ?? "";
|
||||
message.mode = object.mode ?? "";
|
||||
message.instanceUrl = object.instanceUrl ?? "";
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseGetWorkspaceProfileRequest(): GetWorkspaceProfileRequest {
|
||||
return {};
|
||||
}
|
||||
|
||||
export const GetWorkspaceProfileRequest: MessageFns<GetWorkspaceProfileRequest> = {
|
||||
encode(_: GetWorkspaceProfileRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): GetWorkspaceProfileRequest {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseGetWorkspaceProfileRequest();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<GetWorkspaceProfileRequest>): GetWorkspaceProfileRequest {
|
||||
return GetWorkspaceProfileRequest.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(_: DeepPartial<GetWorkspaceProfileRequest>): GetWorkspaceProfileRequest {
|
||||
const message = createBaseGetWorkspaceProfileRequest();
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
export type WorkspaceServiceDefinition = typeof WorkspaceServiceDefinition;
|
||||
export const WorkspaceServiceDefinition = {
|
||||
name: "WorkspaceService",
|
||||
fullName: "memos.api.v1.WorkspaceService",
|
||||
methods: {
|
||||
/** GetWorkspaceProfile returns the workspace profile. */
|
||||
getWorkspaceProfile: {
|
||||
name: "GetWorkspaceProfile",
|
||||
requestType: GetWorkspaceProfileRequest,
|
||||
requestStream: false,
|
||||
responseType: WorkspaceProfile,
|
||||
responseStream: false,
|
||||
options: {
|
||||
_unknownFields: {
|
||||
578365826: [
|
||||
new Uint8Array([
|
||||
27,
|
||||
18,
|
||||
25,
|
||||
47,
|
||||
97,
|
||||
112,
|
||||
105,
|
||||
47,
|
||||
118,
|
||||
49,
|
||||
47,
|
||||
119,
|
||||
111,
|
||||
114,
|
||||
107,
|
||||
115,
|
||||
112,
|
||||
97,
|
||||
99,
|
||||
101,
|
||||
47,
|
||||
112,
|
||||
114,
|
||||
111,
|
||||
102,
|
||||
105,
|
||||
108,
|
||||
101,
|
||||
]),
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
} as const;
|
||||
|
||||
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin ? T
|
||||
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
|
||||
: Partial<T>;
|
||||
|
||||
export interface MessageFns<T> {
|
||||
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
||||
create(base?: DeepPartial<T>): T;
|
||||
fromPartial(object: DeepPartial<T>): T;
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,9 @@
|
||||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.6.1
|
||||
// protoc unknown
|
||||
// source: google/api/annotations.proto
|
||||
|
||||
/* eslint-disable */
|
||||
|
||||
export const protobufPackage = "google.api";
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,145 @@
|
||||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.6.1
|
||||
// protoc unknown
|
||||
// source: google/api/field_behavior.proto
|
||||
|
||||
/* 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 = "FIELD_BEHAVIOR_UNSPECIFIED",
|
||||
/**
|
||||
* OPTIONAL - Specifically denotes a field as optional.
|
||||
* While all fields in protocol buffers are optional, this may be specified
|
||||
* for emphasis if appropriate.
|
||||
*/
|
||||
OPTIONAL = "OPTIONAL",
|
||||
/**
|
||||
* 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 = "REQUIRED",
|
||||
/**
|
||||
* 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 = "OUTPUT_ONLY",
|
||||
/**
|
||||
* 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 = "INPUT_ONLY",
|
||||
/**
|
||||
* 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 = "IMMUTABLE",
|
||||
/**
|
||||
* 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 = "UNORDERED_LIST",
|
||||
/**
|
||||
* 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 = "NON_EMPTY_DEFAULT",
|
||||
/**
|
||||
* IDENTIFIER - Denotes that the field in a resource (a message annotated with
|
||||
* google.api.resource) is used in the resource name to uniquely identify the
|
||||
* resource. For AIP-compliant APIs, this should only be applied to the
|
||||
* `name` field on the resource.
|
||||
*
|
||||
* This behavior should not be applied to references to other resources within
|
||||
* the message.
|
||||
*
|
||||
* The identifier field of resources often have different field behavior
|
||||
* depending on the request it is embedded in (e.g. for Create methods name
|
||||
* is optional and unused, while for Update methods it is required). Instead
|
||||
* of method-specific annotations, only `IDENTIFIER` is required.
|
||||
*/
|
||||
IDENTIFIER = "IDENTIFIER",
|
||||
UNRECOGNIZED = "UNRECOGNIZED",
|
||||
}
|
||||
|
||||
export function fieldBehaviorFromJSON(object: any): FieldBehavior {
|
||||
switch (object) {
|
||||
case 0:
|
||||
case "FIELD_BEHAVIOR_UNSPECIFIED":
|
||||
return FieldBehavior.FIELD_BEHAVIOR_UNSPECIFIED;
|
||||
case 1:
|
||||
case "OPTIONAL":
|
||||
return FieldBehavior.OPTIONAL;
|
||||
case 2:
|
||||
case "REQUIRED":
|
||||
return FieldBehavior.REQUIRED;
|
||||
case 3:
|
||||
case "OUTPUT_ONLY":
|
||||
return FieldBehavior.OUTPUT_ONLY;
|
||||
case 4:
|
||||
case "INPUT_ONLY":
|
||||
return FieldBehavior.INPUT_ONLY;
|
||||
case 5:
|
||||
case "IMMUTABLE":
|
||||
return FieldBehavior.IMMUTABLE;
|
||||
case 6:
|
||||
case "UNORDERED_LIST":
|
||||
return FieldBehavior.UNORDERED_LIST;
|
||||
case 7:
|
||||
case "NON_EMPTY_DEFAULT":
|
||||
return FieldBehavior.NON_EMPTY_DEFAULT;
|
||||
case 8:
|
||||
case "IDENTIFIER":
|
||||
return FieldBehavior.IDENTIFIER;
|
||||
case -1:
|
||||
case "UNRECOGNIZED":
|
||||
default:
|
||||
return FieldBehavior.UNRECOGNIZED;
|
||||
}
|
||||
}
|
||||
|
||||
export function fieldBehaviorToNumber(object: FieldBehavior): number {
|
||||
switch (object) {
|
||||
case FieldBehavior.FIELD_BEHAVIOR_UNSPECIFIED:
|
||||
return 0;
|
||||
case FieldBehavior.OPTIONAL:
|
||||
return 1;
|
||||
case FieldBehavior.REQUIRED:
|
||||
return 2;
|
||||
case FieldBehavior.OUTPUT_ONLY:
|
||||
return 3;
|
||||
case FieldBehavior.INPUT_ONLY:
|
||||
return 4;
|
||||
case FieldBehavior.IMMUTABLE:
|
||||
return 5;
|
||||
case FieldBehavior.UNORDERED_LIST:
|
||||
return 6;
|
||||
case FieldBehavior.NON_EMPTY_DEFAULT:
|
||||
return 7;
|
||||
case FieldBehavior.IDENTIFIER:
|
||||
return 8;
|
||||
case FieldBehavior.UNRECOGNIZED:
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
}
|
@ -0,0 +1,670 @@
|
||||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.6.1
|
||||
// protoc unknown
|
||||
// source: google/api/http.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
|
||||
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: `GET /v1/messages/123456`
|
||||
* - gRPC: `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: `GET /v1/messages/123456?revision=2&sub.subfield=foo`
|
||||
* - gRPC: `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¶m=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: `PATCH /v1/messages/123456 { "text": "Hi!" }`
|
||||
* - gRPC: `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: `PATCH /v1/messages/123456 { "text": "Hi!" }`
|
||||
* - gRPC: `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: `GET /v1/messages/123456`
|
||||
* - gRPC: `GetMessage(message_id: "123456")`
|
||||
*
|
||||
* - HTTP: `GET /v1/users/me/messages/123456`
|
||||
* - gRPC: `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.
|
||||
*
|
||||
* The following example selects a gRPC method and applies an `HttpRule` to it:
|
||||
*
|
||||
* http:
|
||||
* rules:
|
||||
* - 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: MessageFns<Http> = {
|
||||
encode(message: Http, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
for (const v of message.rules) {
|
||||
HttpRule.encode(v!, writer.uint32(10).fork()).join();
|
||||
}
|
||||
if (message.fullyDecodeReservedExpansion !== false) {
|
||||
writer.uint32(16).bool(message.fullyDecodeReservedExpansion);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Http {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(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.skip(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: MessageFns<HttpRule> = {
|
||||
encode(message: HttpRule, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
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()).join();
|
||||
}
|
||||
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()).join();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): HttpRule {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(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.skip(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: MessageFns<CustomHttpPattern> = {
|
||||
encode(message: CustomHttpPattern, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.kind !== "") {
|
||||
writer.uint32(10).string(message.kind);
|
||||
}
|
||||
if (message.path !== "") {
|
||||
writer.uint32(18).string(message.path);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): CustomHttpPattern {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(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.skip(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 globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
|
||||
: Partial<T>;
|
||||
|
||||
export interface MessageFns<T> {
|
||||
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
||||
create(base?: DeepPartial<T>): T;
|
||||
fromPartial(object: DeepPartial<T>): T;
|
||||
}
|
@ -0,0 +1,152 @@
|
||||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.6.1
|
||||
// protoc unknown
|
||||
// source: google/api/httpbody.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
import { Any } from "../protobuf/any";
|
||||
|
||||
export const protobufPackage = "google.api";
|
||||
|
||||
/**
|
||||
* Message that represents an arbitrary HTTP body. It should only be used for
|
||||
* payload formats that can't be represented as JSON, such as raw binary or
|
||||
* an HTML page.
|
||||
*
|
||||
* This message can be used both in streaming and non-streaming API methods in
|
||||
* the request as well as the response.
|
||||
*
|
||||
* It can be used as a top-level request field, which is convenient if one
|
||||
* wants to extract parameters from either the URL or HTTP template into the
|
||||
* request fields and also want access to the raw HTTP body.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* message GetResourceRequest {
|
||||
* // A unique request id.
|
||||
* string request_id = 1;
|
||||
*
|
||||
* // The raw HTTP body is bound to this field.
|
||||
* google.api.HttpBody http_body = 2;
|
||||
*
|
||||
* }
|
||||
*
|
||||
* service ResourceService {
|
||||
* rpc GetResource(GetResourceRequest)
|
||||
* returns (google.api.HttpBody);
|
||||
* rpc UpdateResource(google.api.HttpBody)
|
||||
* returns (google.protobuf.Empty);
|
||||
*
|
||||
* }
|
||||
*
|
||||
* Example with streaming methods:
|
||||
*
|
||||
* service CaldavService {
|
||||
* rpc GetCalendar(stream google.api.HttpBody)
|
||||
* returns (stream google.api.HttpBody);
|
||||
* rpc UpdateCalendar(stream google.api.HttpBody)
|
||||
* returns (stream google.api.HttpBody);
|
||||
*
|
||||
* }
|
||||
*
|
||||
* Use of this type only changes how the request and response bodies are
|
||||
* handled, all other features will continue to work unchanged.
|
||||
*/
|
||||
export interface HttpBody {
|
||||
/** The HTTP Content-Type header value specifying the content type of the body. */
|
||||
contentType: string;
|
||||
/** The HTTP request/response body as raw binary. */
|
||||
data: Uint8Array;
|
||||
/**
|
||||
* Application specific response metadata. Must be set in the first response
|
||||
* for streaming APIs.
|
||||
*/
|
||||
extensions: Any[];
|
||||
}
|
||||
|
||||
function createBaseHttpBody(): HttpBody {
|
||||
return { contentType: "", data: new Uint8Array(0), extensions: [] };
|
||||
}
|
||||
|
||||
export const HttpBody: MessageFns<HttpBody> = {
|
||||
encode(message: HttpBody, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.contentType !== "") {
|
||||
writer.uint32(10).string(message.contentType);
|
||||
}
|
||||
if (message.data.length !== 0) {
|
||||
writer.uint32(18).bytes(message.data);
|
||||
}
|
||||
for (const v of message.extensions) {
|
||||
Any.encode(v!, writer.uint32(26).fork()).join();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): HttpBody {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseHttpBody();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.contentType = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.data = reader.bytes();
|
||||
continue;
|
||||
}
|
||||
case 3: {
|
||||
if (tag !== 26) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.extensions.push(Any.decode(reader, reader.uint32()));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<HttpBody>): HttpBody {
|
||||
return HttpBody.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<HttpBody>): HttpBody {
|
||||
const message = createBaseHttpBody();
|
||||
message.contentType = object.contentType ?? "";
|
||||
message.data = object.data ?? new Uint8Array(0);
|
||||
message.extensions = object.extensions?.map((e) => Any.fromPartial(e)) || [];
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin ? T
|
||||
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
|
||||
: Partial<T>;
|
||||
|
||||
export interface MessageFns<T> {
|
||||
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
||||
create(base?: DeepPartial<T>): T;
|
||||
fromPartial(object: DeepPartial<T>): T;
|
||||
}
|
@ -0,0 +1,121 @@
|
||||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.6.1
|
||||
// protoc unknown
|
||||
// source: google/api/launch_stage.proto
|
||||
|
||||
/* 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 = "LAUNCH_STAGE_UNSPECIFIED",
|
||||
/** UNIMPLEMENTED - The feature is not yet implemented. Users can not use it. */
|
||||
UNIMPLEMENTED = "UNIMPLEMENTED",
|
||||
/** PRELAUNCH - Prelaunch features are hidden from users and are only visible internally. */
|
||||
PRELAUNCH = "PRELAUNCH",
|
||||
/**
|
||||
* 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 = "EARLY_ACCESS",
|
||||
/**
|
||||
* 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 = "ALPHA",
|
||||
/**
|
||||
* 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 = "BETA",
|
||||
/**
|
||||
* GA - GA features are open to all developers and are considered stable and
|
||||
* fully qualified for production use.
|
||||
*/
|
||||
GA = "GA",
|
||||
/**
|
||||
* 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 = "DEPRECATED",
|
||||
UNRECOGNIZED = "UNRECOGNIZED",
|
||||
}
|
||||
|
||||
export function launchStageFromJSON(object: any): LaunchStage {
|
||||
switch (object) {
|
||||
case 0:
|
||||
case "LAUNCH_STAGE_UNSPECIFIED":
|
||||
return LaunchStage.LAUNCH_STAGE_UNSPECIFIED;
|
||||
case 6:
|
||||
case "UNIMPLEMENTED":
|
||||
return LaunchStage.UNIMPLEMENTED;
|
||||
case 7:
|
||||
case "PRELAUNCH":
|
||||
return LaunchStage.PRELAUNCH;
|
||||
case 1:
|
||||
case "EARLY_ACCESS":
|
||||
return LaunchStage.EARLY_ACCESS;
|
||||
case 2:
|
||||
case "ALPHA":
|
||||
return LaunchStage.ALPHA;
|
||||
case 3:
|
||||
case "BETA":
|
||||
return LaunchStage.BETA;
|
||||
case 4:
|
||||
case "GA":
|
||||
return LaunchStage.GA;
|
||||
case 5:
|
||||
case "DEPRECATED":
|
||||
return LaunchStage.DEPRECATED;
|
||||
case -1:
|
||||
case "UNRECOGNIZED":
|
||||
default:
|
||||
return LaunchStage.UNRECOGNIZED;
|
||||
}
|
||||
}
|
||||
|
||||
export function launchStageToNumber(object: LaunchStage): number {
|
||||
switch (object) {
|
||||
case LaunchStage.LAUNCH_STAGE_UNSPECIFIED:
|
||||
return 0;
|
||||
case LaunchStage.UNIMPLEMENTED:
|
||||
return 6;
|
||||
case LaunchStage.PRELAUNCH:
|
||||
return 7;
|
||||
case LaunchStage.EARLY_ACCESS:
|
||||
return 1;
|
||||
case LaunchStage.ALPHA:
|
||||
return 2;
|
||||
case LaunchStage.BETA:
|
||||
return 3;
|
||||
case LaunchStage.GA:
|
||||
return 4;
|
||||
case LaunchStage.DEPRECATED:
|
||||
return 5;
|
||||
case LaunchStage.UNRECOGNIZED:
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
}
|
@ -0,0 +1,206 @@
|
||||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.6.1
|
||||
// protoc unknown
|
||||
// source: google/protobuf/any.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
|
||||
export const protobufPackage = "google.protobuf";
|
||||
|
||||
/**
|
||||
* `Any` contains an arbitrary serialized protocol buffer message along with a
|
||||
* URL that describes the type of the serialized message.
|
||||
*
|
||||
* Protobuf library provides support to pack/unpack Any values in the form
|
||||
* of utility functions or additional generated methods of the Any type.
|
||||
*
|
||||
* Example 1: Pack and unpack a message in C++.
|
||||
*
|
||||
* Foo foo = ...;
|
||||
* Any any;
|
||||
* any.PackFrom(foo);
|
||||
* ...
|
||||
* if (any.UnpackTo(&foo)) {
|
||||
* ...
|
||||
* }
|
||||
*
|
||||
* Example 2: Pack and unpack a message in Java.
|
||||
*
|
||||
* Foo foo = ...;
|
||||
* Any any = Any.pack(foo);
|
||||
* ...
|
||||
* if (any.is(Foo.class)) {
|
||||
* foo = any.unpack(Foo.class);
|
||||
* }
|
||||
* // or ...
|
||||
* if (any.isSameTypeAs(Foo.getDefaultInstance())) {
|
||||
* foo = any.unpack(Foo.getDefaultInstance());
|
||||
* }
|
||||
*
|
||||
* Example 3: Pack and unpack a message in Python.
|
||||
*
|
||||
* foo = Foo(...)
|
||||
* any = Any()
|
||||
* any.Pack(foo)
|
||||
* ...
|
||||
* if any.Is(Foo.DESCRIPTOR):
|
||||
* any.Unpack(foo)
|
||||
* ...
|
||||
*
|
||||
* Example 4: Pack and unpack a message in Go
|
||||
*
|
||||
* foo := &pb.Foo{...}
|
||||
* any, err := anypb.New(foo)
|
||||
* if err != nil {
|
||||
* ...
|
||||
* }
|
||||
* ...
|
||||
* foo := &pb.Foo{}
|
||||
* if err := any.UnmarshalTo(foo); err != nil {
|
||||
* ...
|
||||
* }
|
||||
*
|
||||
* The pack methods provided by protobuf library will by default use
|
||||
* 'type.googleapis.com/full.type.name' as the type URL and the unpack
|
||||
* methods only use the fully qualified type name after the last '/'
|
||||
* in the type URL, for example "foo.bar.com/x/y.z" will yield type
|
||||
* name "y.z".
|
||||
*
|
||||
* JSON
|
||||
* ====
|
||||
* The JSON representation of an `Any` value uses the regular
|
||||
* representation of the deserialized, embedded message, with an
|
||||
* additional field `@type` which contains the type URL. Example:
|
||||
*
|
||||
* package google.profile;
|
||||
* message Person {
|
||||
* string first_name = 1;
|
||||
* string last_name = 2;
|
||||
* }
|
||||
*
|
||||
* {
|
||||
* "@type": "type.googleapis.com/google.profile.Person",
|
||||
* "firstName": <string>,
|
||||
* "lastName": <string>
|
||||
* }
|
||||
*
|
||||
* If the embedded message type is well-known and has a custom JSON
|
||||
* representation, that representation will be embedded adding a field
|
||||
* `value` which holds the custom JSON in addition to the `@type`
|
||||
* field. Example (for message [google.protobuf.Duration][]):
|
||||
*
|
||||
* {
|
||||
* "@type": "type.googleapis.com/google.protobuf.Duration",
|
||||
* "value": "1.212s"
|
||||
* }
|
||||
*/
|
||||
export interface Any {
|
||||
/**
|
||||
* A URL/resource name that uniquely identifies the type of the serialized
|
||||
* protocol buffer message. This string must contain at least
|
||||
* one "/" character. The last segment of the URL's path must represent
|
||||
* the fully qualified name of the type (as in
|
||||
* `path/google.protobuf.Duration`). The name should be in a canonical form
|
||||
* (e.g., leading "." is not accepted).
|
||||
*
|
||||
* In practice, teams usually precompile into the binary all types that they
|
||||
* expect it to use in the context of Any. However, for URLs which use the
|
||||
* scheme `http`, `https`, or no scheme, one can optionally set up a type
|
||||
* server that maps type URLs to message definitions as follows:
|
||||
*
|
||||
* * If no scheme is provided, `https` is assumed.
|
||||
* * An HTTP GET on the URL must yield a [google.protobuf.Type][]
|
||||
* value in binary format, or produce an error.
|
||||
* * Applications are allowed to cache lookup results based on the
|
||||
* URL, or have them precompiled into a binary to avoid any
|
||||
* lookup. Therefore, binary compatibility needs to be preserved
|
||||
* on changes to types. (Use versioned type names to manage
|
||||
* breaking changes.)
|
||||
*
|
||||
* Note: this functionality is not currently available in the official
|
||||
* protobuf release, and it is not used for type URLs beginning with
|
||||
* type.googleapis.com. As of May 2023, there are no widely used type server
|
||||
* implementations and no plans to implement one.
|
||||
*
|
||||
* Schemes other than `http`, `https` (or the empty scheme) might be
|
||||
* used with implementation specific semantics.
|
||||
*/
|
||||
typeUrl: string;
|
||||
/** Must be a valid serialized protocol buffer of the above specified type. */
|
||||
value: Uint8Array;
|
||||
}
|
||||
|
||||
function createBaseAny(): Any {
|
||||
return { typeUrl: "", value: new Uint8Array(0) };
|
||||
}
|
||||
|
||||
export const Any: MessageFns<Any> = {
|
||||
encode(message: Any, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.typeUrl !== "") {
|
||||
writer.uint32(10).string(message.typeUrl);
|
||||
}
|
||||
if (message.value.length !== 0) {
|
||||
writer.uint32(18).bytes(message.value);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Any {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseAny();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.typeUrl = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.value = reader.bytes();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<Any>): Any {
|
||||
return Any.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(object: DeepPartial<Any>): Any {
|
||||
const message = createBaseAny();
|
||||
message.typeUrl = object.typeUrl ?? "";
|
||||
message.value = object.value ?? new Uint8Array(0);
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin ? T
|
||||
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
|
||||
: Partial<T>;
|
||||
|
||||
export interface MessageFns<T> {
|
||||
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
||||
create(base?: DeepPartial<T>): T;
|
||||
fromPartial(object: DeepPartial<T>): T;
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,172 @@
|
||||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.6.1
|
||||
// protoc unknown
|
||||
// source: google/protobuf/duration.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
|
||||
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: MessageFns<Duration> = {
|
||||
encode(message: Duration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.seconds !== 0) {
|
||||
writer.uint32(8).int64(message.seconds);
|
||||
}
|
||||
if (message.nanos !== 0) {
|
||||
writer.uint32(16).int32(message.nanos);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Duration {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(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());
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 16) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.nanos = reader.int32();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(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;
|
||||
},
|
||||
};
|
||||
|
||||
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin ? T
|
||||
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
|
||||
: Partial<T>;
|
||||
|
||||
function longToNumber(int64: { toString(): string }): number {
|
||||
const num = globalThis.Number(int64.toString());
|
||||
if (num > globalThis.Number.MAX_SAFE_INTEGER) {
|
||||
throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
|
||||
}
|
||||
if (num < globalThis.Number.MIN_SAFE_INTEGER) {
|
||||
throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER");
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
export interface MessageFns<T> {
|
||||
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
||||
create(base?: DeepPartial<T>): T;
|
||||
fromPartial(object: DeepPartial<T>): T;
|
||||
}
|
@ -0,0 +1,71 @@
|
||||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.6.1
|
||||
// protoc unknown
|
||||
// source: google/protobuf/empty.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
|
||||
export const protobufPackage = "google.protobuf";
|
||||
|
||||
/**
|
||||
* A generic empty message that you can re-use to avoid defining duplicated
|
||||
* empty messages in your APIs. A typical example is to use it as the request
|
||||
* or the response type of an API method. For instance:
|
||||
*
|
||||
* service Foo {
|
||||
* rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);
|
||||
* }
|
||||
*/
|
||||
export interface Empty {
|
||||
}
|
||||
|
||||
function createBaseEmpty(): Empty {
|
||||
return {};
|
||||
}
|
||||
|
||||
export const Empty: MessageFns<Empty> = {
|
||||
encode(_: Empty, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Empty {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseEmpty();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
create(base?: DeepPartial<Empty>): Empty {
|
||||
return Empty.fromPartial(base ?? {});
|
||||
},
|
||||
fromPartial(_: DeepPartial<Empty>): Empty {
|
||||
const message = createBaseEmpty();
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin ? T
|
||||
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
|
||||
: Partial<T>;
|
||||
|
||||
export interface MessageFns<T> {
|
||||
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
||||
create(base?: DeepPartial<T>): T;
|
||||
fromPartial(object: DeepPartial<T>): T;
|
||||
}
|
@ -0,0 +1,291 @@
|
||||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.6.1
|
||||
// protoc unknown
|
||||
// source: google/protobuf/field_mask.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
|
||||
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: MessageFns<FieldMask> & FieldMaskWrapperFns = {
|
||||
encode(message: FieldMask, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
for (const v of message.paths) {
|
||||
writer.uint32(10).string(v!);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): FieldMask {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(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.skip(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 globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
|
||||
: Partial<T>;
|
||||
|
||||
export interface MessageFns<T> {
|
||||
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
||||
create(base?: DeepPartial<T>): T;
|
||||
fromPartial(object: DeepPartial<T>): T;
|
||||
}
|
||||
|
||||
export interface FieldMaskWrapperFns {
|
||||
wrap(paths: string[]): FieldMask;
|
||||
unwrap(message: FieldMask): string[];
|
||||
}
|
@ -0,0 +1,201 @@
|
||||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.6.1
|
||||
// protoc unknown
|
||||
// source: google/protobuf/timestamp.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
|
||||
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://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime()
|
||||
* ) 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: MessageFns<Timestamp> = {
|
||||
encode(message: Timestamp, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.seconds !== 0) {
|
||||
writer.uint32(8).int64(message.seconds);
|
||||
}
|
||||
if (message.nanos !== 0) {
|
||||
writer.uint32(16).int32(message.nanos);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Timestamp {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(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());
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 16) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.nanos = reader.int32();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(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;
|
||||
},
|
||||
};
|
||||
|
||||
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin ? T
|
||||
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
|
||||
: Partial<T>;
|
||||
|
||||
function longToNumber(int64: { toString(): string }): number {
|
||||
const num = globalThis.Number(int64.toString());
|
||||
if (num > globalThis.Number.MAX_SAFE_INTEGER) {
|
||||
throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
|
||||
}
|
||||
if (num < globalThis.Number.MIN_SAFE_INTEGER) {
|
||||
throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER");
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
export interface MessageFns<T> {
|
||||
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
||||
create(base?: DeepPartial<T>): T;
|
||||
fromPartial(object: DeepPartial<T>): T;
|
||||
}
|
Loading…
Reference in New Issue