chore: update ts definition generator

This commit is contained in:
steven 2023-09-03 14:42:12 +08:00
parent 2fcd496fd2
commit 65e366fdf1
39 changed files with 2065 additions and 12002 deletions

View File

@ -3,7 +3,7 @@ import axios from "axios";
import copy from "copy-to-clipboard"; import copy from "copy-to-clipboard";
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import { toast } from "react-hot-toast"; import { toast } from "react-hot-toast";
import { ListUserAccessTokensResponse, UserAccessToken } from "@/types/proto/api/v2/user_service"; import { ListUserAccessTokensResponse, UserAccessToken } from "@/types/proto/api/v2/user_service_pb";
import useUserStore from "../../stores/v1/user"; import useUserStore from "../../stores/v1/user";
import { showCommonDialog } from "../Alert"; import { showCommonDialog } from "../Alert";
import CreateAccessTokenDialog from "../CreateAccessTokenDialog"; import CreateAccessTokenDialog from "../CreateAccessTokenDialog";

View File

@ -1,7 +1,7 @@
import { useEffect } from "react"; import { useEffect } from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { Outlet, useNavigate } from "react-router-dom"; import { Outlet, useNavigate } from "react-router-dom";
import { UserSetting_Locale } from "@/types/proto/api/v2/user_setting_service"; import { UserSetting_Locale } from "@/types/proto/api/v2/user_setting_service_pb";
import Header from "../components/Header"; import Header from "../components/Header";
import useUserStore from "../stores/v1/user"; import useUserStore from "../stores/v1/user";
@ -29,9 +29,9 @@ const Root: React.FC = () => {
return; return;
} }
if (currentUserSetting.locale === UserSetting_Locale.LOCALE_EN) { if (currentUserSetting.locale === UserSetting_Locale.EN) {
i18n.changeLanguage("en"); i18n.changeLanguage("en");
} else if (currentUserSetting.locale === UserSetting_Locale.LOCALE_ZH) { } else if (currentUserSetting.locale === UserSetting_Locale.ZH) {
i18n.changeLanguage("zh"); i18n.changeLanguage("zh");
} }
}, [currentUserSetting]); }, [currentUserSetting]);

View File

@ -1,6 +1,6 @@
import axios from "axios"; import axios from "axios";
import { create } from "zustand"; import { create } from "zustand";
import { GetUserSettingResponse, UserSetting } from "@/types/proto/api/v2/user_setting_service"; import { GetUserSettingResponse, UserSetting } from "@/types/proto/api/v2/user_setting_service_pb";
import * as api from "../../helpers/api"; import * as api from "../../helpers/api";
const convertResponseModelUser = (user: User): User => { const convertResponseModelUser = (user: User): User => {

View File

@ -1,42 +0,0 @@
/* eslint-disable */
export const protobufPackage = "slash.api.v2";
export enum RowStatus {
ROW_STATUS_UNSPECIFIED = 0,
NORMAL = 1,
ARCHIVED = 2,
UNRECOGNIZED = -1,
}
export function rowStatusFromJSON(object: any): RowStatus {
switch (object) {
case 0:
case "ROW_STATUS_UNSPECIFIED":
return RowStatus.ROW_STATUS_UNSPECIFIED;
case 1:
case "NORMAL":
return RowStatus.NORMAL;
case 2:
case "ARCHIVED":
return RowStatus.ARCHIVED;
case -1:
case "UNRECOGNIZED":
default:
return RowStatus.UNRECOGNIZED;
}
}
export function rowStatusToJSON(object: RowStatus): string {
switch (object) {
case RowStatus.ROW_STATUS_UNSPECIFIED:
return "ROW_STATUS_UNSPECIFIED";
case RowStatus.NORMAL:
return "NORMAL";
case RowStatus.ARCHIVED:
return "ARCHIVED";
case RowStatus.UNRECOGNIZED:
default:
return "UNRECOGNIZED";
}
}

View File

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

View File

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

View File

@ -1,885 +0,0 @@
/* eslint-disable */
import Long from "long";
import _m0 from "protobufjs/minimal";
import { RowStatus, rowStatusFromJSON, rowStatusToJSON } from "./common";
export const protobufPackage = "slash.api.v2";
export enum Visibility {
VISIBILITY_UNSPECIFIED = 0,
PRIVATE = 1,
WORKSPACE = 2,
PUBLIC = 3,
UNRECOGNIZED = -1,
}
export function visibilityFromJSON(object: any): Visibility {
switch (object) {
case 0:
case "VISIBILITY_UNSPECIFIED":
return Visibility.VISIBILITY_UNSPECIFIED;
case 1:
case "PRIVATE":
return Visibility.PRIVATE;
case 2:
case "WORKSPACE":
return Visibility.WORKSPACE;
case 3:
case "PUBLIC":
return Visibility.PUBLIC;
case -1:
case "UNRECOGNIZED":
default:
return Visibility.UNRECOGNIZED;
}
}
export function visibilityToJSON(object: Visibility): string {
switch (object) {
case Visibility.VISIBILITY_UNSPECIFIED:
return "VISIBILITY_UNSPECIFIED";
case Visibility.PRIVATE:
return "PRIVATE";
case Visibility.WORKSPACE:
return "WORKSPACE";
case Visibility.PUBLIC:
return "PUBLIC";
case Visibility.UNRECOGNIZED:
default:
return "UNRECOGNIZED";
}
}
export interface Shortcut {
id: number;
creatorId: number;
createdTs: number;
updatedTs: number;
rowStatus: RowStatus;
name: string;
link: string;
title: string;
tags: string[];
description: string;
visibility: Visibility;
ogMetadata?: OpenGraphMetadata | undefined;
}
export interface OpenGraphMetadata {
title: string;
description: string;
image: string;
}
export interface ListShortcutsRequest {
}
export interface ListShortcutsResponse {
shortcuts: Shortcut[];
}
export interface GetShortcutRequest {
name: string;
}
export interface GetShortcutResponse {
shortcut?: Shortcut | undefined;
}
export interface CreateShortcutRequest {
shortcut?: Shortcut | undefined;
}
export interface CreateShortcutResponse {
shortcut?: Shortcut | undefined;
}
export interface DeleteShortcutRequest {
name: string;
}
export interface DeleteShortcutResponse {
}
function createBaseShortcut(): Shortcut {
return {
id: 0,
creatorId: 0,
createdTs: 0,
updatedTs: 0,
rowStatus: 0,
name: "",
link: "",
title: "",
tags: [],
description: "",
visibility: 0,
ogMetadata: undefined,
};
}
export const Shortcut = {
encode(message: Shortcut, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.id !== 0) {
writer.uint32(8).int32(message.id);
}
if (message.creatorId !== 0) {
writer.uint32(16).int32(message.creatorId);
}
if (message.createdTs !== 0) {
writer.uint32(24).int64(message.createdTs);
}
if (message.updatedTs !== 0) {
writer.uint32(32).int64(message.updatedTs);
}
if (message.rowStatus !== 0) {
writer.uint32(40).int32(message.rowStatus);
}
if (message.name !== "") {
writer.uint32(50).string(message.name);
}
if (message.link !== "") {
writer.uint32(58).string(message.link);
}
if (message.title !== "") {
writer.uint32(66).string(message.title);
}
for (const v of message.tags) {
writer.uint32(74).string(v!);
}
if (message.description !== "") {
writer.uint32(82).string(message.description);
}
if (message.visibility !== 0) {
writer.uint32(88).int32(message.visibility);
}
if (message.ogMetadata !== undefined) {
OpenGraphMetadata.encode(message.ogMetadata, writer.uint32(98).fork()).ldelim();
}
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): Shortcut {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseShortcut();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 8) {
break;
}
message.id = reader.int32();
continue;
case 2:
if (tag !== 16) {
break;
}
message.creatorId = reader.int32();
continue;
case 3:
if (tag !== 24) {
break;
}
message.createdTs = longToNumber(reader.int64() as Long);
continue;
case 4:
if (tag !== 32) {
break;
}
message.updatedTs = longToNumber(reader.int64() as Long);
continue;
case 5:
if (tag !== 40) {
break;
}
message.rowStatus = reader.int32() as any;
continue;
case 6:
if (tag !== 50) {
break;
}
message.name = reader.string();
continue;
case 7:
if (tag !== 58) {
break;
}
message.link = reader.string();
continue;
case 8:
if (tag !== 66) {
break;
}
message.title = reader.string();
continue;
case 9:
if (tag !== 74) {
break;
}
message.tags.push(reader.string());
continue;
case 10:
if (tag !== 82) {
break;
}
message.description = reader.string();
continue;
case 11:
if (tag !== 88) {
break;
}
message.visibility = reader.int32() as any;
continue;
case 12:
if (tag !== 98) {
break;
}
message.ogMetadata = OpenGraphMetadata.decode(reader, reader.uint32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object: any): Shortcut {
return {
id: isSet(object.id) ? Number(object.id) : 0,
creatorId: isSet(object.creatorId) ? Number(object.creatorId) : 0,
createdTs: isSet(object.createdTs) ? Number(object.createdTs) : 0,
updatedTs: isSet(object.updatedTs) ? Number(object.updatedTs) : 0,
rowStatus: isSet(object.rowStatus) ? rowStatusFromJSON(object.rowStatus) : 0,
name: isSet(object.name) ? String(object.name) : "",
link: isSet(object.link) ? String(object.link) : "",
title: isSet(object.title) ? String(object.title) : "",
tags: Array.isArray(object?.tags) ? object.tags.map((e: any) => String(e)) : [],
description: isSet(object.description) ? String(object.description) : "",
visibility: isSet(object.visibility) ? visibilityFromJSON(object.visibility) : 0,
ogMetadata: isSet(object.ogMetadata) ? OpenGraphMetadata.fromJSON(object.ogMetadata) : undefined,
};
},
toJSON(message: Shortcut): unknown {
const obj: any = {};
message.id !== undefined && (obj.id = Math.round(message.id));
message.creatorId !== undefined && (obj.creatorId = Math.round(message.creatorId));
message.createdTs !== undefined && (obj.createdTs = Math.round(message.createdTs));
message.updatedTs !== undefined && (obj.updatedTs = Math.round(message.updatedTs));
message.rowStatus !== undefined && (obj.rowStatus = rowStatusToJSON(message.rowStatus));
message.name !== undefined && (obj.name = message.name);
message.link !== undefined && (obj.link = message.link);
message.title !== undefined && (obj.title = message.title);
if (message.tags) {
obj.tags = message.tags.map((e) => e);
} else {
obj.tags = [];
}
message.description !== undefined && (obj.description = message.description);
message.visibility !== undefined && (obj.visibility = visibilityToJSON(message.visibility));
message.ogMetadata !== undefined &&
(obj.ogMetadata = message.ogMetadata ? OpenGraphMetadata.toJSON(message.ogMetadata) : undefined);
return obj;
},
create(base?: DeepPartial<Shortcut>): Shortcut {
return Shortcut.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<Shortcut>): Shortcut {
const message = createBaseShortcut();
message.id = object.id ?? 0;
message.creatorId = object.creatorId ?? 0;
message.createdTs = object.createdTs ?? 0;
message.updatedTs = object.updatedTs ?? 0;
message.rowStatus = object.rowStatus ?? 0;
message.name = object.name ?? "";
message.link = object.link ?? "";
message.title = object.title ?? "";
message.tags = object.tags?.map((e) => e) || [];
message.description = object.description ?? "";
message.visibility = object.visibility ?? 0;
message.ogMetadata = (object.ogMetadata !== undefined && object.ogMetadata !== null)
? OpenGraphMetadata.fromPartial(object.ogMetadata)
: undefined;
return message;
},
};
function createBaseOpenGraphMetadata(): OpenGraphMetadata {
return { title: "", description: "", image: "" };
}
export const OpenGraphMetadata = {
encode(message: OpenGraphMetadata, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.title !== "") {
writer.uint32(10).string(message.title);
}
if (message.description !== "") {
writer.uint32(18).string(message.description);
}
if (message.image !== "") {
writer.uint32(26).string(message.image);
}
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): OpenGraphMetadata {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseOpenGraphMetadata();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.title = reader.string();
continue;
case 2:
if (tag !== 18) {
break;
}
message.description = reader.string();
continue;
case 3:
if (tag !== 26) {
break;
}
message.image = reader.string();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object: any): OpenGraphMetadata {
return {
title: isSet(object.title) ? String(object.title) : "",
description: isSet(object.description) ? String(object.description) : "",
image: isSet(object.image) ? String(object.image) : "",
};
},
toJSON(message: OpenGraphMetadata): unknown {
const obj: any = {};
message.title !== undefined && (obj.title = message.title);
message.description !== undefined && (obj.description = message.description);
message.image !== undefined && (obj.image = message.image);
return obj;
},
create(base?: DeepPartial<OpenGraphMetadata>): OpenGraphMetadata {
return OpenGraphMetadata.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<OpenGraphMetadata>): OpenGraphMetadata {
const message = createBaseOpenGraphMetadata();
message.title = object.title ?? "";
message.description = object.description ?? "";
message.image = object.image ?? "";
return message;
},
};
function createBaseListShortcutsRequest(): ListShortcutsRequest {
return {};
}
export const ListShortcutsRequest = {
encode(_: ListShortcutsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): ListShortcutsRequest {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseListShortcutsRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(_: any): ListShortcutsRequest {
return {};
},
toJSON(_: ListShortcutsRequest): unknown {
const obj: any = {};
return obj;
},
create(base?: DeepPartial<ListShortcutsRequest>): ListShortcutsRequest {
return ListShortcutsRequest.fromPartial(base ?? {});
},
fromPartial(_: DeepPartial<ListShortcutsRequest>): ListShortcutsRequest {
const message = createBaseListShortcutsRequest();
return message;
},
};
function createBaseListShortcutsResponse(): ListShortcutsResponse {
return { shortcuts: [] };
}
export const ListShortcutsResponse = {
encode(message: ListShortcutsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
for (const v of message.shortcuts) {
Shortcut.encode(v!, writer.uint32(10).fork()).ldelim();
}
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): ListShortcutsResponse {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseListShortcutsResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.shortcuts.push(Shortcut.decode(reader, reader.uint32()));
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object: any): ListShortcutsResponse {
return {
shortcuts: Array.isArray(object?.shortcuts) ? object.shortcuts.map((e: any) => Shortcut.fromJSON(e)) : [],
};
},
toJSON(message: ListShortcutsResponse): unknown {
const obj: any = {};
if (message.shortcuts) {
obj.shortcuts = message.shortcuts.map((e) => e ? Shortcut.toJSON(e) : undefined);
} else {
obj.shortcuts = [];
}
return obj;
},
create(base?: DeepPartial<ListShortcutsResponse>): ListShortcutsResponse {
return ListShortcutsResponse.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<ListShortcutsResponse>): ListShortcutsResponse {
const message = createBaseListShortcutsResponse();
message.shortcuts = object.shortcuts?.map((e) => Shortcut.fromPartial(e)) || [];
return message;
},
};
function createBaseGetShortcutRequest(): GetShortcutRequest {
return { name: "" };
}
export const GetShortcutRequest = {
encode(message: GetShortcutRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.name !== "") {
writer.uint32(10).string(message.name);
}
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): GetShortcutRequest {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseGetShortcutRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.name = reader.string();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object: any): GetShortcutRequest {
return { name: isSet(object.name) ? String(object.name) : "" };
},
toJSON(message: GetShortcutRequest): unknown {
const obj: any = {};
message.name !== undefined && (obj.name = message.name);
return obj;
},
create(base?: DeepPartial<GetShortcutRequest>): GetShortcutRequest {
return GetShortcutRequest.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<GetShortcutRequest>): GetShortcutRequest {
const message = createBaseGetShortcutRequest();
message.name = object.name ?? "";
return message;
},
};
function createBaseGetShortcutResponse(): GetShortcutResponse {
return { shortcut: undefined };
}
export const GetShortcutResponse = {
encode(message: GetShortcutResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.shortcut !== undefined) {
Shortcut.encode(message.shortcut, writer.uint32(10).fork()).ldelim();
}
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): GetShortcutResponse {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseGetShortcutResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.shortcut = Shortcut.decode(reader, reader.uint32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object: any): GetShortcutResponse {
return { shortcut: isSet(object.shortcut) ? Shortcut.fromJSON(object.shortcut) : undefined };
},
toJSON(message: GetShortcutResponse): unknown {
const obj: any = {};
message.shortcut !== undefined && (obj.shortcut = message.shortcut ? Shortcut.toJSON(message.shortcut) : undefined);
return obj;
},
create(base?: DeepPartial<GetShortcutResponse>): GetShortcutResponse {
return GetShortcutResponse.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<GetShortcutResponse>): GetShortcutResponse {
const message = createBaseGetShortcutResponse();
message.shortcut = (object.shortcut !== undefined && object.shortcut !== null)
? Shortcut.fromPartial(object.shortcut)
: undefined;
return message;
},
};
function createBaseCreateShortcutRequest(): CreateShortcutRequest {
return { shortcut: undefined };
}
export const CreateShortcutRequest = {
encode(message: CreateShortcutRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.shortcut !== undefined) {
Shortcut.encode(message.shortcut, writer.uint32(10).fork()).ldelim();
}
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): CreateShortcutRequest {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseCreateShortcutRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.shortcut = Shortcut.decode(reader, reader.uint32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object: any): CreateShortcutRequest {
return { shortcut: isSet(object.shortcut) ? Shortcut.fromJSON(object.shortcut) : undefined };
},
toJSON(message: CreateShortcutRequest): unknown {
const obj: any = {};
message.shortcut !== undefined && (obj.shortcut = message.shortcut ? Shortcut.toJSON(message.shortcut) : undefined);
return obj;
},
create(base?: DeepPartial<CreateShortcutRequest>): CreateShortcutRequest {
return CreateShortcutRequest.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<CreateShortcutRequest>): CreateShortcutRequest {
const message = createBaseCreateShortcutRequest();
message.shortcut = (object.shortcut !== undefined && object.shortcut !== null)
? Shortcut.fromPartial(object.shortcut)
: undefined;
return message;
},
};
function createBaseCreateShortcutResponse(): CreateShortcutResponse {
return { shortcut: undefined };
}
export const CreateShortcutResponse = {
encode(message: CreateShortcutResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.shortcut !== undefined) {
Shortcut.encode(message.shortcut, writer.uint32(10).fork()).ldelim();
}
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): CreateShortcutResponse {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseCreateShortcutResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.shortcut = Shortcut.decode(reader, reader.uint32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object: any): CreateShortcutResponse {
return { shortcut: isSet(object.shortcut) ? Shortcut.fromJSON(object.shortcut) : undefined };
},
toJSON(message: CreateShortcutResponse): unknown {
const obj: any = {};
message.shortcut !== undefined && (obj.shortcut = message.shortcut ? Shortcut.toJSON(message.shortcut) : undefined);
return obj;
},
create(base?: DeepPartial<CreateShortcutResponse>): CreateShortcutResponse {
return CreateShortcutResponse.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<CreateShortcutResponse>): CreateShortcutResponse {
const message = createBaseCreateShortcutResponse();
message.shortcut = (object.shortcut !== undefined && object.shortcut !== null)
? Shortcut.fromPartial(object.shortcut)
: undefined;
return message;
},
};
function createBaseDeleteShortcutRequest(): DeleteShortcutRequest {
return { name: "" };
}
export const DeleteShortcutRequest = {
encode(message: DeleteShortcutRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.name !== "") {
writer.uint32(10).string(message.name);
}
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): DeleteShortcutRequest {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseDeleteShortcutRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.name = reader.string();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object: any): DeleteShortcutRequest {
return { name: isSet(object.name) ? String(object.name) : "" };
},
toJSON(message: DeleteShortcutRequest): unknown {
const obj: any = {};
message.name !== undefined && (obj.name = message.name);
return obj;
},
create(base?: DeepPartial<DeleteShortcutRequest>): DeleteShortcutRequest {
return DeleteShortcutRequest.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<DeleteShortcutRequest>): DeleteShortcutRequest {
const message = createBaseDeleteShortcutRequest();
message.name = object.name ?? "";
return message;
},
};
function createBaseDeleteShortcutResponse(): DeleteShortcutResponse {
return {};
}
export const DeleteShortcutResponse = {
encode(_: DeleteShortcutResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): DeleteShortcutResponse {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseDeleteShortcutResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(_: any): DeleteShortcutResponse {
return {};
},
toJSON(_: DeleteShortcutResponse): unknown {
const obj: any = {};
return obj;
},
create(base?: DeepPartial<DeleteShortcutResponse>): DeleteShortcutResponse {
return DeleteShortcutResponse.fromPartial(base ?? {});
},
fromPartial(_: DeepPartial<DeleteShortcutResponse>): DeleteShortcutResponse {
const message = createBaseDeleteShortcutResponse();
return message;
},
};
declare const self: any | undefined;
declare const window: any | undefined;
declare const global: any | undefined;
const tsProtoGlobalThis: any = (() => {
if (typeof globalThis !== "undefined") {
return globalThis;
}
if (typeof self !== "undefined") {
return self;
}
if (typeof window !== "undefined") {
return window;
}
if (typeof global !== "undefined") {
return global;
}
throw "Unable to locate global object";
})();
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
export type DeepPartial<T> = T extends Builtin ? T
: T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
: T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
: Partial<T>;
function longToNumber(long: Long): number {
if (long.gt(Number.MAX_SAFE_INTEGER)) {
throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
}
return long.toNumber();
}
if (_m0.util.Long !== Long) {
_m0.util.Long = Long as any;
_m0.configure();
}
function isSet(value: any): boolean {
return value !== null && value !== undefined;
}

View File

@ -0,0 +1,329 @@
// @generated by protoc-gen-es v1.3.0
// @generated from file api/v2/shortcut_service.proto (package slash.api.v2, syntax proto3)
/* eslint-disable */
// @ts-nocheck
import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf";
import { Message, proto3 } from "@bufbuild/protobuf";
import type { RowStatus } from "./common_pb.js";
/**
* @generated from enum slash.api.v2.Visibility
*/
export declare enum Visibility {
/**
* @generated from enum value: VISIBILITY_UNSPECIFIED = 0;
*/
VISIBILITY_UNSPECIFIED = 0,
/**
* @generated from enum value: PRIVATE = 1;
*/
PRIVATE = 1,
/**
* @generated from enum value: WORKSPACE = 2;
*/
WORKSPACE = 2,
/**
* @generated from enum value: PUBLIC = 3;
*/
PUBLIC = 3,
}
/**
* @generated from message slash.api.v2.Shortcut
*/
export declare class Shortcut extends Message<Shortcut> {
/**
* @generated from field: int32 id = 1;
*/
id: number;
/**
* @generated from field: int32 creator_id = 2;
*/
creatorId: number;
/**
* @generated from field: int64 created_ts = 3;
*/
createdTs: bigint;
/**
* @generated from field: int64 updated_ts = 4;
*/
updatedTs: bigint;
/**
* @generated from field: slash.api.v2.RowStatus row_status = 5;
*/
rowStatus: RowStatus;
/**
* @generated from field: string name = 6;
*/
name: string;
/**
* @generated from field: string link = 7;
*/
link: string;
/**
* @generated from field: string title = 8;
*/
title: string;
/**
* @generated from field: repeated string tags = 9;
*/
tags: string[];
/**
* @generated from field: string description = 10;
*/
description: string;
/**
* @generated from field: slash.api.v2.Visibility visibility = 11;
*/
visibility: Visibility;
/**
* @generated from field: slash.api.v2.OpenGraphMetadata og_metadata = 12;
*/
ogMetadata?: OpenGraphMetadata;
constructor(data?: PartialMessage<Shortcut>);
static readonly runtime: typeof proto3;
static readonly typeName = "slash.api.v2.Shortcut";
static readonly fields: FieldList;
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): Shortcut;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): Shortcut;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): Shortcut;
static equals(a: Shortcut | PlainMessage<Shortcut> | undefined, b: Shortcut | PlainMessage<Shortcut> | undefined): boolean;
}
/**
* @generated from message slash.api.v2.OpenGraphMetadata
*/
export declare class OpenGraphMetadata extends Message<OpenGraphMetadata> {
/**
* @generated from field: string title = 1;
*/
title: string;
/**
* @generated from field: string description = 2;
*/
description: string;
/**
* @generated from field: string image = 3;
*/
image: string;
constructor(data?: PartialMessage<OpenGraphMetadata>);
static readonly runtime: typeof proto3;
static readonly typeName = "slash.api.v2.OpenGraphMetadata";
static readonly fields: FieldList;
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): OpenGraphMetadata;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): OpenGraphMetadata;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): OpenGraphMetadata;
static equals(a: OpenGraphMetadata | PlainMessage<OpenGraphMetadata> | undefined, b: OpenGraphMetadata | PlainMessage<OpenGraphMetadata> | undefined): boolean;
}
/**
* @generated from message slash.api.v2.ListShortcutsRequest
*/
export declare class ListShortcutsRequest extends Message<ListShortcutsRequest> {
constructor(data?: PartialMessage<ListShortcutsRequest>);
static readonly runtime: typeof proto3;
static readonly typeName = "slash.api.v2.ListShortcutsRequest";
static readonly fields: FieldList;
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): ListShortcutsRequest;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): ListShortcutsRequest;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): ListShortcutsRequest;
static equals(a: ListShortcutsRequest | PlainMessage<ListShortcutsRequest> | undefined, b: ListShortcutsRequest | PlainMessage<ListShortcutsRequest> | undefined): boolean;
}
/**
* @generated from message slash.api.v2.ListShortcutsResponse
*/
export declare class ListShortcutsResponse extends Message<ListShortcutsResponse> {
/**
* @generated from field: repeated slash.api.v2.Shortcut shortcuts = 1;
*/
shortcuts: Shortcut[];
constructor(data?: PartialMessage<ListShortcutsResponse>);
static readonly runtime: typeof proto3;
static readonly typeName = "slash.api.v2.ListShortcutsResponse";
static readonly fields: FieldList;
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): ListShortcutsResponse;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): ListShortcutsResponse;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): ListShortcutsResponse;
static equals(a: ListShortcutsResponse | PlainMessage<ListShortcutsResponse> | undefined, b: ListShortcutsResponse | PlainMessage<ListShortcutsResponse> | undefined): boolean;
}
/**
* @generated from message slash.api.v2.GetShortcutRequest
*/
export declare class GetShortcutRequest extends Message<GetShortcutRequest> {
/**
* @generated from field: string name = 1;
*/
name: string;
constructor(data?: PartialMessage<GetShortcutRequest>);
static readonly runtime: typeof proto3;
static readonly typeName = "slash.api.v2.GetShortcutRequest";
static readonly fields: FieldList;
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): GetShortcutRequest;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): GetShortcutRequest;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): GetShortcutRequest;
static equals(a: GetShortcutRequest | PlainMessage<GetShortcutRequest> | undefined, b: GetShortcutRequest | PlainMessage<GetShortcutRequest> | undefined): boolean;
}
/**
* @generated from message slash.api.v2.GetShortcutResponse
*/
export declare class GetShortcutResponse extends Message<GetShortcutResponse> {
/**
* @generated from field: slash.api.v2.Shortcut shortcut = 1;
*/
shortcut?: Shortcut;
constructor(data?: PartialMessage<GetShortcutResponse>);
static readonly runtime: typeof proto3;
static readonly typeName = "slash.api.v2.GetShortcutResponse";
static readonly fields: FieldList;
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): GetShortcutResponse;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): GetShortcutResponse;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): GetShortcutResponse;
static equals(a: GetShortcutResponse | PlainMessage<GetShortcutResponse> | undefined, b: GetShortcutResponse | PlainMessage<GetShortcutResponse> | undefined): boolean;
}
/**
* @generated from message slash.api.v2.CreateShortcutRequest
*/
export declare class CreateShortcutRequest extends Message<CreateShortcutRequest> {
/**
* @generated from field: slash.api.v2.Shortcut shortcut = 1;
*/
shortcut?: Shortcut;
constructor(data?: PartialMessage<CreateShortcutRequest>);
static readonly runtime: typeof proto3;
static readonly typeName = "slash.api.v2.CreateShortcutRequest";
static readonly fields: FieldList;
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): CreateShortcutRequest;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): CreateShortcutRequest;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): CreateShortcutRequest;
static equals(a: CreateShortcutRequest | PlainMessage<CreateShortcutRequest> | undefined, b: CreateShortcutRequest | PlainMessage<CreateShortcutRequest> | undefined): boolean;
}
/**
* @generated from message slash.api.v2.CreateShortcutResponse
*/
export declare class CreateShortcutResponse extends Message<CreateShortcutResponse> {
/**
* @generated from field: slash.api.v2.Shortcut shortcut = 1;
*/
shortcut?: Shortcut;
constructor(data?: PartialMessage<CreateShortcutResponse>);
static readonly runtime: typeof proto3;
static readonly typeName = "slash.api.v2.CreateShortcutResponse";
static readonly fields: FieldList;
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): CreateShortcutResponse;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): CreateShortcutResponse;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): CreateShortcutResponse;
static equals(a: CreateShortcutResponse | PlainMessage<CreateShortcutResponse> | undefined, b: CreateShortcutResponse | PlainMessage<CreateShortcutResponse> | undefined): boolean;
}
/**
* @generated from message slash.api.v2.DeleteShortcutRequest
*/
export declare class DeleteShortcutRequest extends Message<DeleteShortcutRequest> {
/**
* @generated from field: string name = 1;
*/
name: string;
constructor(data?: PartialMessage<DeleteShortcutRequest>);
static readonly runtime: typeof proto3;
static readonly typeName = "slash.api.v2.DeleteShortcutRequest";
static readonly fields: FieldList;
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): DeleteShortcutRequest;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): DeleteShortcutRequest;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): DeleteShortcutRequest;
static equals(a: DeleteShortcutRequest | PlainMessage<DeleteShortcutRequest> | undefined, b: DeleteShortcutRequest | PlainMessage<DeleteShortcutRequest> | undefined): boolean;
}
/**
* @generated from message slash.api.v2.DeleteShortcutResponse
*/
export declare class DeleteShortcutResponse extends Message<DeleteShortcutResponse> {
constructor(data?: PartialMessage<DeleteShortcutResponse>);
static readonly runtime: typeof proto3;
static readonly typeName = "slash.api.v2.DeleteShortcutResponse";
static readonly fields: FieldList;
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): DeleteShortcutResponse;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): DeleteShortcutResponse;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): DeleteShortcutResponse;
static equals(a: DeleteShortcutResponse | PlainMessage<DeleteShortcutResponse> | undefined, b: DeleteShortcutResponse | PlainMessage<DeleteShortcutResponse> | undefined): boolean;
}

View File

@ -0,0 +1,130 @@
// @generated by protoc-gen-es v1.3.0
// @generated from file api/v2/shortcut_service.proto (package slash.api.v2, syntax proto3)
/* eslint-disable */
// @ts-nocheck
import { proto3 } from "@bufbuild/protobuf";
import { RowStatus } from "./common_pb.js";
/**
* @generated from enum slash.api.v2.Visibility
*/
export const Visibility = proto3.makeEnum(
"slash.api.v2.Visibility",
[
{no: 0, name: "VISIBILITY_UNSPECIFIED"},
{no: 1, name: "PRIVATE"},
{no: 2, name: "WORKSPACE"},
{no: 3, name: "PUBLIC"},
],
);
/**
* @generated from message slash.api.v2.Shortcut
*/
export const Shortcut = proto3.makeMessageType(
"slash.api.v2.Shortcut",
() => [
{ no: 1, name: "id", kind: "scalar", T: 5 /* ScalarType.INT32 */ },
{ no: 2, name: "creator_id", kind: "scalar", T: 5 /* ScalarType.INT32 */ },
{ no: 3, name: "created_ts", kind: "scalar", T: 3 /* ScalarType.INT64 */ },
{ no: 4, name: "updated_ts", kind: "scalar", T: 3 /* ScalarType.INT64 */ },
{ no: 5, name: "row_status", kind: "enum", T: proto3.getEnumType(RowStatus) },
{ no: 6, name: "name", kind: "scalar", T: 9 /* ScalarType.STRING */ },
{ no: 7, name: "link", kind: "scalar", T: 9 /* ScalarType.STRING */ },
{ no: 8, name: "title", kind: "scalar", T: 9 /* ScalarType.STRING */ },
{ no: 9, name: "tags", kind: "scalar", T: 9 /* ScalarType.STRING */, repeated: true },
{ no: 10, name: "description", kind: "scalar", T: 9 /* ScalarType.STRING */ },
{ no: 11, name: "visibility", kind: "enum", T: proto3.getEnumType(Visibility) },
{ no: 12, name: "og_metadata", kind: "message", T: OpenGraphMetadata },
],
);
/**
* @generated from message slash.api.v2.OpenGraphMetadata
*/
export const OpenGraphMetadata = proto3.makeMessageType(
"slash.api.v2.OpenGraphMetadata",
() => [
{ no: 1, name: "title", kind: "scalar", T: 9 /* ScalarType.STRING */ },
{ no: 2, name: "description", kind: "scalar", T: 9 /* ScalarType.STRING */ },
{ no: 3, name: "image", kind: "scalar", T: 9 /* ScalarType.STRING */ },
],
);
/**
* @generated from message slash.api.v2.ListShortcutsRequest
*/
export const ListShortcutsRequest = proto3.makeMessageType(
"slash.api.v2.ListShortcutsRequest",
[],
);
/**
* @generated from message slash.api.v2.ListShortcutsResponse
*/
export const ListShortcutsResponse = proto3.makeMessageType(
"slash.api.v2.ListShortcutsResponse",
() => [
{ no: 1, name: "shortcuts", kind: "message", T: Shortcut, repeated: true },
],
);
/**
* @generated from message slash.api.v2.GetShortcutRequest
*/
export const GetShortcutRequest = proto3.makeMessageType(
"slash.api.v2.GetShortcutRequest",
() => [
{ no: 1, name: "name", kind: "scalar", T: 9 /* ScalarType.STRING */ },
],
);
/**
* @generated from message slash.api.v2.GetShortcutResponse
*/
export const GetShortcutResponse = proto3.makeMessageType(
"slash.api.v2.GetShortcutResponse",
() => [
{ no: 1, name: "shortcut", kind: "message", T: Shortcut },
],
);
/**
* @generated from message slash.api.v2.CreateShortcutRequest
*/
export const CreateShortcutRequest = proto3.makeMessageType(
"slash.api.v2.CreateShortcutRequest",
() => [
{ no: 1, name: "shortcut", kind: "message", T: Shortcut },
],
);
/**
* @generated from message slash.api.v2.CreateShortcutResponse
*/
export const CreateShortcutResponse = proto3.makeMessageType(
"slash.api.v2.CreateShortcutResponse",
() => [
{ no: 1, name: "shortcut", kind: "message", T: Shortcut },
],
);
/**
* @generated from message slash.api.v2.DeleteShortcutRequest
*/
export const DeleteShortcutRequest = proto3.makeMessageType(
"slash.api.v2.DeleteShortcutRequest",
() => [
{ no: 1, name: "name", kind: "scalar", T: 9 /* ScalarType.STRING */ },
],
);
/**
* @generated from message slash.api.v2.DeleteShortcutResponse
*/
export const DeleteShortcutResponse = proto3.makeMessageType(
"slash.api.v2.DeleteShortcutResponse",
[],
);

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,466 @@
// @generated by protoc-gen-es v1.3.0
// @generated from file api/v2/user_service.proto (package slash.api.v2, syntax proto3)
/* eslint-disable */
// @ts-nocheck
import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage, Timestamp } from "@bufbuild/protobuf";
import { Message, proto3 } from "@bufbuild/protobuf";
import type { RowStatus } from "./common_pb.js";
/**
* @generated from enum slash.api.v2.Role
*/
export declare enum Role {
/**
* @generated from enum value: ROLE_UNSPECIFIED = 0;
*/
ROLE_UNSPECIFIED = 0,
/**
* @generated from enum value: ADMIN = 1;
*/
ADMIN = 1,
/**
* @generated from enum value: USER = 2;
*/
USER = 2,
}
/**
* @generated from message slash.api.v2.User
*/
export declare class User extends Message<User> {
/**
* @generated from field: int32 id = 1;
*/
id: number;
/**
* @generated from field: slash.api.v2.RowStatus row_status = 2;
*/
rowStatus: RowStatus;
/**
* @generated from field: int64 created_ts = 3;
*/
createdTs: bigint;
/**
* @generated from field: int64 updated_ts = 4;
*/
updatedTs: bigint;
/**
* @generated from field: slash.api.v2.Role role = 6;
*/
role: Role;
/**
* @generated from field: string email = 7;
*/
email: string;
/**
* @generated from field: string nickname = 8;
*/
nickname: string;
/**
* @generated from field: string password = 9;
*/
password: string;
constructor(data?: PartialMessage<User>);
static readonly runtime: typeof proto3;
static readonly typeName = "slash.api.v2.User";
static readonly fields: FieldList;
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): User;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): User;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): User;
static equals(a: User | PlainMessage<User> | undefined, b: User | PlainMessage<User> | undefined): boolean;
}
/**
* @generated from message slash.api.v2.ListUsersRequest
*/
export declare class ListUsersRequest extends Message<ListUsersRequest> {
constructor(data?: PartialMessage<ListUsersRequest>);
static readonly runtime: typeof proto3;
static readonly typeName = "slash.api.v2.ListUsersRequest";
static readonly fields: FieldList;
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): ListUsersRequest;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): ListUsersRequest;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): ListUsersRequest;
static equals(a: ListUsersRequest | PlainMessage<ListUsersRequest> | undefined, b: ListUsersRequest | PlainMessage<ListUsersRequest> | undefined): boolean;
}
/**
* @generated from message slash.api.v2.ListUsersResponse
*/
export declare class ListUsersResponse extends Message<ListUsersResponse> {
/**
* @generated from field: repeated slash.api.v2.User users = 1;
*/
users: User[];
constructor(data?: PartialMessage<ListUsersResponse>);
static readonly runtime: typeof proto3;
static readonly typeName = "slash.api.v2.ListUsersResponse";
static readonly fields: FieldList;
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): ListUsersResponse;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): ListUsersResponse;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): ListUsersResponse;
static equals(a: ListUsersResponse | PlainMessage<ListUsersResponse> | undefined, b: ListUsersResponse | PlainMessage<ListUsersResponse> | undefined): boolean;
}
/**
* @generated from message slash.api.v2.GetUserRequest
*/
export declare class GetUserRequest extends Message<GetUserRequest> {
/**
* @generated from field: int32 id = 1;
*/
id: number;
constructor(data?: PartialMessage<GetUserRequest>);
static readonly runtime: typeof proto3;
static readonly typeName = "slash.api.v2.GetUserRequest";
static readonly fields: FieldList;
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): GetUserRequest;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): GetUserRequest;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): GetUserRequest;
static equals(a: GetUserRequest | PlainMessage<GetUserRequest> | undefined, b: GetUserRequest | PlainMessage<GetUserRequest> | undefined): boolean;
}
/**
* @generated from message slash.api.v2.GetUserResponse
*/
export declare class GetUserResponse extends Message<GetUserResponse> {
/**
* @generated from field: slash.api.v2.User user = 1;
*/
user?: User;
constructor(data?: PartialMessage<GetUserResponse>);
static readonly runtime: typeof proto3;
static readonly typeName = "slash.api.v2.GetUserResponse";
static readonly fields: FieldList;
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): GetUserResponse;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): GetUserResponse;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): GetUserResponse;
static equals(a: GetUserResponse | PlainMessage<GetUserResponse> | undefined, b: GetUserResponse | PlainMessage<GetUserResponse> | undefined): boolean;
}
/**
* @generated from message slash.api.v2.CreateUserRequest
*/
export declare class CreateUserRequest extends Message<CreateUserRequest> {
/**
* @generated from field: slash.api.v2.User user = 1;
*/
user?: User;
constructor(data?: PartialMessage<CreateUserRequest>);
static readonly runtime: typeof proto3;
static readonly typeName = "slash.api.v2.CreateUserRequest";
static readonly fields: FieldList;
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): CreateUserRequest;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): CreateUserRequest;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): CreateUserRequest;
static equals(a: CreateUserRequest | PlainMessage<CreateUserRequest> | undefined, b: CreateUserRequest | PlainMessage<CreateUserRequest> | undefined): boolean;
}
/**
* @generated from message slash.api.v2.CreateUserResponse
*/
export declare class CreateUserResponse extends Message<CreateUserResponse> {
/**
* @generated from field: slash.api.v2.User user = 1;
*/
user?: User;
constructor(data?: PartialMessage<CreateUserResponse>);
static readonly runtime: typeof proto3;
static readonly typeName = "slash.api.v2.CreateUserResponse";
static readonly fields: FieldList;
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): CreateUserResponse;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): CreateUserResponse;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): CreateUserResponse;
static equals(a: CreateUserResponse | PlainMessage<CreateUserResponse> | undefined, b: CreateUserResponse | PlainMessage<CreateUserResponse> | undefined): boolean;
}
/**
* @generated from message slash.api.v2.DeleteUserRequest
*/
export declare class DeleteUserRequest extends Message<DeleteUserRequest> {
/**
* @generated from field: int32 id = 1;
*/
id: number;
constructor(data?: PartialMessage<DeleteUserRequest>);
static readonly runtime: typeof proto3;
static readonly typeName = "slash.api.v2.DeleteUserRequest";
static readonly fields: FieldList;
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): DeleteUserRequest;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): DeleteUserRequest;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): DeleteUserRequest;
static equals(a: DeleteUserRequest | PlainMessage<DeleteUserRequest> | undefined, b: DeleteUserRequest | PlainMessage<DeleteUserRequest> | undefined): boolean;
}
/**
* @generated from message slash.api.v2.DeleteUserResponse
*/
export declare class DeleteUserResponse extends Message<DeleteUserResponse> {
constructor(data?: PartialMessage<DeleteUserResponse>);
static readonly runtime: typeof proto3;
static readonly typeName = "slash.api.v2.DeleteUserResponse";
static readonly fields: FieldList;
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): DeleteUserResponse;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): DeleteUserResponse;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): DeleteUserResponse;
static equals(a: DeleteUserResponse | PlainMessage<DeleteUserResponse> | undefined, b: DeleteUserResponse | PlainMessage<DeleteUserResponse> | undefined): boolean;
}
/**
* @generated from message slash.api.v2.ListUserAccessTokensRequest
*/
export declare class ListUserAccessTokensRequest extends Message<ListUserAccessTokensRequest> {
/**
* id is the user id.
*
* @generated from field: int32 id = 1;
*/
id: number;
constructor(data?: PartialMessage<ListUserAccessTokensRequest>);
static readonly runtime: typeof proto3;
static readonly typeName = "slash.api.v2.ListUserAccessTokensRequest";
static readonly fields: FieldList;
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): ListUserAccessTokensRequest;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): ListUserAccessTokensRequest;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): ListUserAccessTokensRequest;
static equals(a: ListUserAccessTokensRequest | PlainMessage<ListUserAccessTokensRequest> | undefined, b: ListUserAccessTokensRequest | PlainMessage<ListUserAccessTokensRequest> | undefined): boolean;
}
/**
* @generated from message slash.api.v2.ListUserAccessTokensResponse
*/
export declare class ListUserAccessTokensResponse extends Message<ListUserAccessTokensResponse> {
/**
* @generated from field: repeated slash.api.v2.UserAccessToken access_tokens = 1;
*/
accessTokens: UserAccessToken[];
constructor(data?: PartialMessage<ListUserAccessTokensResponse>);
static readonly runtime: typeof proto3;
static readonly typeName = "slash.api.v2.ListUserAccessTokensResponse";
static readonly fields: FieldList;
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): ListUserAccessTokensResponse;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): ListUserAccessTokensResponse;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): ListUserAccessTokensResponse;
static equals(a: ListUserAccessTokensResponse | PlainMessage<ListUserAccessTokensResponse> | undefined, b: ListUserAccessTokensResponse | PlainMessage<ListUserAccessTokensResponse> | undefined): boolean;
}
/**
* @generated from message slash.api.v2.CreateUserAccessTokenRequest
*/
export declare class CreateUserAccessTokenRequest extends Message<CreateUserAccessTokenRequest> {
/**
* id is the user id.
*
* @generated from field: int32 id = 1;
*/
id: number;
/**
* @generated from field: slash.api.v2.UserAccessToken user_access_token = 2;
*/
userAccessToken?: UserAccessToken;
constructor(data?: PartialMessage<CreateUserAccessTokenRequest>);
static readonly runtime: typeof proto3;
static readonly typeName = "slash.api.v2.CreateUserAccessTokenRequest";
static readonly fields: FieldList;
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): CreateUserAccessTokenRequest;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): CreateUserAccessTokenRequest;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): CreateUserAccessTokenRequest;
static equals(a: CreateUserAccessTokenRequest | PlainMessage<CreateUserAccessTokenRequest> | undefined, b: CreateUserAccessTokenRequest | PlainMessage<CreateUserAccessTokenRequest> | undefined): boolean;
}
/**
* @generated from message slash.api.v2.CreateUserAccessTokenResponse
*/
export declare class CreateUserAccessTokenResponse extends Message<CreateUserAccessTokenResponse> {
/**
* @generated from field: slash.api.v2.UserAccessToken access_token = 1;
*/
accessToken?: UserAccessToken;
constructor(data?: PartialMessage<CreateUserAccessTokenResponse>);
static readonly runtime: typeof proto3;
static readonly typeName = "slash.api.v2.CreateUserAccessTokenResponse";
static readonly fields: FieldList;
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): CreateUserAccessTokenResponse;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): CreateUserAccessTokenResponse;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): CreateUserAccessTokenResponse;
static equals(a: CreateUserAccessTokenResponse | PlainMessage<CreateUserAccessTokenResponse> | undefined, b: CreateUserAccessTokenResponse | PlainMessage<CreateUserAccessTokenResponse> | undefined): boolean;
}
/**
* @generated from message slash.api.v2.DeleteUserAccessTokenRequest
*/
export declare class DeleteUserAccessTokenRequest extends Message<DeleteUserAccessTokenRequest> {
/**
* id is the user id.
*
* @generated from field: int32 id = 1;
*/
id: number;
/**
* access_token is the access token to delete.
*
* @generated from field: string access_token = 2;
*/
accessToken: string;
constructor(data?: PartialMessage<DeleteUserAccessTokenRequest>);
static readonly runtime: typeof proto3;
static readonly typeName = "slash.api.v2.DeleteUserAccessTokenRequest";
static readonly fields: FieldList;
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): DeleteUserAccessTokenRequest;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): DeleteUserAccessTokenRequest;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): DeleteUserAccessTokenRequest;
static equals(a: DeleteUserAccessTokenRequest | PlainMessage<DeleteUserAccessTokenRequest> | undefined, b: DeleteUserAccessTokenRequest | PlainMessage<DeleteUserAccessTokenRequest> | undefined): boolean;
}
/**
* @generated from message slash.api.v2.DeleteUserAccessTokenResponse
*/
export declare class DeleteUserAccessTokenResponse extends Message<DeleteUserAccessTokenResponse> {
constructor(data?: PartialMessage<DeleteUserAccessTokenResponse>);
static readonly runtime: typeof proto3;
static readonly typeName = "slash.api.v2.DeleteUserAccessTokenResponse";
static readonly fields: FieldList;
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): DeleteUserAccessTokenResponse;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): DeleteUserAccessTokenResponse;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): DeleteUserAccessTokenResponse;
static equals(a: DeleteUserAccessTokenResponse | PlainMessage<DeleteUserAccessTokenResponse> | undefined, b: DeleteUserAccessTokenResponse | PlainMessage<DeleteUserAccessTokenResponse> | undefined): boolean;
}
/**
* @generated from message slash.api.v2.UserAccessToken
*/
export declare class UserAccessToken extends Message<UserAccessToken> {
/**
* @generated from field: string access_token = 1;
*/
accessToken: string;
/**
* @generated from field: string description = 2;
*/
description: string;
/**
* @generated from field: google.protobuf.Timestamp issued_at = 3;
*/
issuedAt?: Timestamp;
/**
* @generated from field: google.protobuf.Timestamp expires_at = 4;
*/
expiresAt?: Timestamp;
constructor(data?: PartialMessage<UserAccessToken>);
static readonly runtime: typeof proto3;
static readonly typeName = "slash.api.v2.UserAccessToken";
static readonly fields: FieldList;
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): UserAccessToken;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): UserAccessToken;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): UserAccessToken;
static equals(a: UserAccessToken | PlainMessage<UserAccessToken> | undefined, b: UserAccessToken | PlainMessage<UserAccessToken> | undefined): boolean;
}

View File

@ -0,0 +1,186 @@
// @generated by protoc-gen-es v1.3.0
// @generated from file api/v2/user_service.proto (package slash.api.v2, syntax proto3)
/* eslint-disable */
// @ts-nocheck
import { proto3, Timestamp } from "@bufbuild/protobuf";
import { RowStatus } from "./common_pb.js";
/**
* @generated from enum slash.api.v2.Role
*/
export const Role = proto3.makeEnum(
"slash.api.v2.Role",
[
{no: 0, name: "ROLE_UNSPECIFIED"},
{no: 1, name: "ADMIN"},
{no: 2, name: "USER"},
],
);
/**
* @generated from message slash.api.v2.User
*/
export const User = proto3.makeMessageType(
"slash.api.v2.User",
() => [
{ no: 1, name: "id", kind: "scalar", T: 5 /* ScalarType.INT32 */ },
{ no: 2, name: "row_status", kind: "enum", T: proto3.getEnumType(RowStatus) },
{ no: 3, name: "created_ts", kind: "scalar", T: 3 /* ScalarType.INT64 */ },
{ no: 4, name: "updated_ts", kind: "scalar", T: 3 /* ScalarType.INT64 */ },
{ no: 6, name: "role", kind: "enum", T: proto3.getEnumType(Role) },
{ no: 7, name: "email", kind: "scalar", T: 9 /* ScalarType.STRING */ },
{ no: 8, name: "nickname", kind: "scalar", T: 9 /* ScalarType.STRING */ },
{ no: 9, name: "password", kind: "scalar", T: 9 /* ScalarType.STRING */ },
],
);
/**
* @generated from message slash.api.v2.ListUsersRequest
*/
export const ListUsersRequest = proto3.makeMessageType(
"slash.api.v2.ListUsersRequest",
[],
);
/**
* @generated from message slash.api.v2.ListUsersResponse
*/
export const ListUsersResponse = proto3.makeMessageType(
"slash.api.v2.ListUsersResponse",
() => [
{ no: 1, name: "users", kind: "message", T: User, repeated: true },
],
);
/**
* @generated from message slash.api.v2.GetUserRequest
*/
export const GetUserRequest = proto3.makeMessageType(
"slash.api.v2.GetUserRequest",
() => [
{ no: 1, name: "id", kind: "scalar", T: 5 /* ScalarType.INT32 */ },
],
);
/**
* @generated from message slash.api.v2.GetUserResponse
*/
export const GetUserResponse = proto3.makeMessageType(
"slash.api.v2.GetUserResponse",
() => [
{ no: 1, name: "user", kind: "message", T: User },
],
);
/**
* @generated from message slash.api.v2.CreateUserRequest
*/
export const CreateUserRequest = proto3.makeMessageType(
"slash.api.v2.CreateUserRequest",
() => [
{ no: 1, name: "user", kind: "message", T: User },
],
);
/**
* @generated from message slash.api.v2.CreateUserResponse
*/
export const CreateUserResponse = proto3.makeMessageType(
"slash.api.v2.CreateUserResponse",
() => [
{ no: 1, name: "user", kind: "message", T: User },
],
);
/**
* @generated from message slash.api.v2.DeleteUserRequest
*/
export const DeleteUserRequest = proto3.makeMessageType(
"slash.api.v2.DeleteUserRequest",
() => [
{ no: 1, name: "id", kind: "scalar", T: 5 /* ScalarType.INT32 */ },
],
);
/**
* @generated from message slash.api.v2.DeleteUserResponse
*/
export const DeleteUserResponse = proto3.makeMessageType(
"slash.api.v2.DeleteUserResponse",
[],
);
/**
* @generated from message slash.api.v2.ListUserAccessTokensRequest
*/
export const ListUserAccessTokensRequest = proto3.makeMessageType(
"slash.api.v2.ListUserAccessTokensRequest",
() => [
{ no: 1, name: "id", kind: "scalar", T: 5 /* ScalarType.INT32 */ },
],
);
/**
* @generated from message slash.api.v2.ListUserAccessTokensResponse
*/
export const ListUserAccessTokensResponse = proto3.makeMessageType(
"slash.api.v2.ListUserAccessTokensResponse",
() => [
{ no: 1, name: "access_tokens", kind: "message", T: UserAccessToken, repeated: true },
],
);
/**
* @generated from message slash.api.v2.CreateUserAccessTokenRequest
*/
export const CreateUserAccessTokenRequest = proto3.makeMessageType(
"slash.api.v2.CreateUserAccessTokenRequest",
() => [
{ no: 1, name: "id", kind: "scalar", T: 5 /* ScalarType.INT32 */ },
{ no: 2, name: "user_access_token", kind: "message", T: UserAccessToken },
],
);
/**
* @generated from message slash.api.v2.CreateUserAccessTokenResponse
*/
export const CreateUserAccessTokenResponse = proto3.makeMessageType(
"slash.api.v2.CreateUserAccessTokenResponse",
() => [
{ no: 1, name: "access_token", kind: "message", T: UserAccessToken },
],
);
/**
* @generated from message slash.api.v2.DeleteUserAccessTokenRequest
*/
export const DeleteUserAccessTokenRequest = proto3.makeMessageType(
"slash.api.v2.DeleteUserAccessTokenRequest",
() => [
{ no: 1, name: "id", kind: "scalar", T: 5 /* ScalarType.INT32 */ },
{ no: 2, name: "access_token", kind: "scalar", T: 9 /* ScalarType.STRING */ },
],
);
/**
* @generated from message slash.api.v2.DeleteUserAccessTokenResponse
*/
export const DeleteUserAccessTokenResponse = proto3.makeMessageType(
"slash.api.v2.DeleteUserAccessTokenResponse",
[],
);
/**
* @generated from message slash.api.v2.UserAccessToken
*/
export const UserAccessToken = proto3.makeMessageType(
"slash.api.v2.UserAccessToken",
() => [
{ no: 1, name: "access_token", kind: "scalar", T: 9 /* ScalarType.STRING */ },
{ no: 2, name: "description", kind: "scalar", T: 9 /* ScalarType.STRING */ },
{ no: 3, name: "issued_at", kind: "message", T: Timestamp },
{ no: 4, name: "expires_at", kind: "message", T: Timestamp },
],
);

View File

@ -1,418 +0,0 @@
/* eslint-disable */
import _m0 from "protobufjs/minimal";
import { FieldMask } from "../../google/protobuf/field_mask";
export const protobufPackage = "slash.api.v2";
export interface UserSetting {
/** id is the user id. */
id: number;
/** locale is the user locale. */
locale: UserSetting_Locale;
}
export enum UserSetting_Locale {
LOCALE_UNSPECIFIED = 0,
LOCALE_EN = 1,
LOCALE_ZH = 2,
UNRECOGNIZED = -1,
}
export function userSetting_LocaleFromJSON(object: any): UserSetting_Locale {
switch (object) {
case 0:
case "LOCALE_UNSPECIFIED":
return UserSetting_Locale.LOCALE_UNSPECIFIED;
case 1:
case "LOCALE_EN":
return UserSetting_Locale.LOCALE_EN;
case 2:
case "LOCALE_ZH":
return UserSetting_Locale.LOCALE_ZH;
case -1:
case "UNRECOGNIZED":
default:
return UserSetting_Locale.UNRECOGNIZED;
}
}
export function userSetting_LocaleToJSON(object: UserSetting_Locale): string {
switch (object) {
case UserSetting_Locale.LOCALE_UNSPECIFIED:
return "LOCALE_UNSPECIFIED";
case UserSetting_Locale.LOCALE_EN:
return "LOCALE_EN";
case UserSetting_Locale.LOCALE_ZH:
return "LOCALE_ZH";
case UserSetting_Locale.UNRECOGNIZED:
default:
return "UNRECOGNIZED";
}
}
export interface GetUserSettingRequest {
/** id is the user id. */
id: number;
}
export interface GetUserSettingResponse {
userSetting?: UserSetting | undefined;
}
export interface UpdateUserSettingRequest {
/** id is the user id. */
id: number;
/** user_setting is the user setting to update. */
userSetting?:
| UserSetting
| undefined;
/** update_mask is the field mask to update the user setting. */
updateMask?: string[] | undefined;
}
export interface UpdateUserSettingResponse {
userSetting?: UserSetting | undefined;
}
function createBaseUserSetting(): UserSetting {
return { id: 0, locale: 0 };
}
export const UserSetting = {
encode(message: UserSetting, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.id !== 0) {
writer.uint32(8).int32(message.id);
}
if (message.locale !== 0) {
writer.uint32(16).int32(message.locale);
}
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): UserSetting {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseUserSetting();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 8) {
break;
}
message.id = reader.int32();
continue;
case 2:
if (tag !== 16) {
break;
}
message.locale = reader.int32() as any;
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object: any): UserSetting {
return {
id: isSet(object.id) ? Number(object.id) : 0,
locale: isSet(object.locale) ? userSetting_LocaleFromJSON(object.locale) : 0,
};
},
toJSON(message: UserSetting): unknown {
const obj: any = {};
message.id !== undefined && (obj.id = Math.round(message.id));
message.locale !== undefined && (obj.locale = userSetting_LocaleToJSON(message.locale));
return obj;
},
create(base?: DeepPartial<UserSetting>): UserSetting {
return UserSetting.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<UserSetting>): UserSetting {
const message = createBaseUserSetting();
message.id = object.id ?? 0;
message.locale = object.locale ?? 0;
return message;
},
};
function createBaseGetUserSettingRequest(): GetUserSettingRequest {
return { id: 0 };
}
export const GetUserSettingRequest = {
encode(message: GetUserSettingRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.id !== 0) {
writer.uint32(8).int32(message.id);
}
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): GetUserSettingRequest {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseGetUserSettingRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 8) {
break;
}
message.id = reader.int32();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object: any): GetUserSettingRequest {
return { id: isSet(object.id) ? Number(object.id) : 0 };
},
toJSON(message: GetUserSettingRequest): unknown {
const obj: any = {};
message.id !== undefined && (obj.id = Math.round(message.id));
return obj;
},
create(base?: DeepPartial<GetUserSettingRequest>): GetUserSettingRequest {
return GetUserSettingRequest.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<GetUserSettingRequest>): GetUserSettingRequest {
const message = createBaseGetUserSettingRequest();
message.id = object.id ?? 0;
return message;
},
};
function createBaseGetUserSettingResponse(): GetUserSettingResponse {
return { userSetting: undefined };
}
export const GetUserSettingResponse = {
encode(message: GetUserSettingResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.userSetting !== undefined) {
UserSetting.encode(message.userSetting, writer.uint32(10).fork()).ldelim();
}
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): GetUserSettingResponse {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseGetUserSettingResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.userSetting = UserSetting.decode(reader, reader.uint32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object: any): GetUserSettingResponse {
return { userSetting: isSet(object.userSetting) ? UserSetting.fromJSON(object.userSetting) : undefined };
},
toJSON(message: GetUserSettingResponse): unknown {
const obj: any = {};
message.userSetting !== undefined &&
(obj.userSetting = message.userSetting ? UserSetting.toJSON(message.userSetting) : undefined);
return obj;
},
create(base?: DeepPartial<GetUserSettingResponse>): GetUserSettingResponse {
return GetUserSettingResponse.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<GetUserSettingResponse>): GetUserSettingResponse {
const message = createBaseGetUserSettingResponse();
message.userSetting = (object.userSetting !== undefined && object.userSetting !== null)
? UserSetting.fromPartial(object.userSetting)
: undefined;
return message;
},
};
function createBaseUpdateUserSettingRequest(): UpdateUserSettingRequest {
return { id: 0, userSetting: undefined, updateMask: undefined };
}
export const UpdateUserSettingRequest = {
encode(message: UpdateUserSettingRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.id !== 0) {
writer.uint32(8).int32(message.id);
}
if (message.userSetting !== undefined) {
UserSetting.encode(message.userSetting, writer.uint32(18).fork()).ldelim();
}
if (message.updateMask !== undefined) {
FieldMask.encode(FieldMask.wrap(message.updateMask), writer.uint32(26).fork()).ldelim();
}
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): UpdateUserSettingRequest {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseUpdateUserSettingRequest();
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.userSetting = UserSetting.decode(reader, reader.uint32());
continue;
case 3:
if (tag !== 26) {
break;
}
message.updateMask = FieldMask.unwrap(FieldMask.decode(reader, reader.uint32()));
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object: any): UpdateUserSettingRequest {
return {
id: isSet(object.id) ? Number(object.id) : 0,
userSetting: isSet(object.userSetting) ? UserSetting.fromJSON(object.userSetting) : undefined,
updateMask: isSet(object.updateMask) ? FieldMask.unwrap(FieldMask.fromJSON(object.updateMask)) : undefined,
};
},
toJSON(message: UpdateUserSettingRequest): unknown {
const obj: any = {};
message.id !== undefined && (obj.id = Math.round(message.id));
message.userSetting !== undefined &&
(obj.userSetting = message.userSetting ? UserSetting.toJSON(message.userSetting) : undefined);
message.updateMask !== undefined && (obj.updateMask = FieldMask.toJSON(FieldMask.wrap(message.updateMask)));
return obj;
},
create(base?: DeepPartial<UpdateUserSettingRequest>): UpdateUserSettingRequest {
return UpdateUserSettingRequest.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<UpdateUserSettingRequest>): UpdateUserSettingRequest {
const message = createBaseUpdateUserSettingRequest();
message.id = object.id ?? 0;
message.userSetting = (object.userSetting !== undefined && object.userSetting !== null)
? UserSetting.fromPartial(object.userSetting)
: undefined;
message.updateMask = object.updateMask ?? undefined;
return message;
},
};
function createBaseUpdateUserSettingResponse(): UpdateUserSettingResponse {
return { userSetting: undefined };
}
export const UpdateUserSettingResponse = {
encode(message: UpdateUserSettingResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.userSetting !== undefined) {
UserSetting.encode(message.userSetting, writer.uint32(10).fork()).ldelim();
}
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): UpdateUserSettingResponse {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseUpdateUserSettingResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.userSetting = UserSetting.decode(reader, reader.uint32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object: any): UpdateUserSettingResponse {
return { userSetting: isSet(object.userSetting) ? UserSetting.fromJSON(object.userSetting) : undefined };
},
toJSON(message: UpdateUserSettingResponse): unknown {
const obj: any = {};
message.userSetting !== undefined &&
(obj.userSetting = message.userSetting ? UserSetting.toJSON(message.userSetting) : undefined);
return obj;
},
create(base?: DeepPartial<UpdateUserSettingResponse>): UpdateUserSettingResponse {
return UpdateUserSettingResponse.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<UpdateUserSettingResponse>): UpdateUserSettingResponse {
const message = createBaseUpdateUserSettingResponse();
message.userSetting = (object.userSetting !== undefined && object.userSetting !== null)
? UserSetting.fromPartial(object.userSetting)
: undefined;
return message;
},
};
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
export type DeepPartial<T> = T extends Builtin ? T
: T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
: T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
: Partial<T>;
function isSet(value: any): boolean {
return value !== null && value !== undefined;
}

View File

@ -0,0 +1,175 @@
// @generated by protoc-gen-es v1.3.0
// @generated from file api/v2/user_setting_service.proto (package slash.api.v2, syntax proto3)
/* eslint-disable */
// @ts-nocheck
import type { BinaryReadOptions, FieldList, FieldMask, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf";
import { Message, proto3 } from "@bufbuild/protobuf";
/**
* @generated from message slash.api.v2.UserSetting
*/
export declare class UserSetting extends Message<UserSetting> {
/**
* id is the user id.
*
* @generated from field: int32 id = 1;
*/
id: number;
/**
* locale is the user locale.
*
* @generated from field: slash.api.v2.UserSetting.Locale locale = 2;
*/
locale: UserSetting_Locale;
constructor(data?: PartialMessage<UserSetting>);
static readonly runtime: typeof proto3;
static readonly typeName = "slash.api.v2.UserSetting";
static readonly fields: FieldList;
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): UserSetting;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): UserSetting;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): UserSetting;
static equals(a: UserSetting | PlainMessage<UserSetting> | undefined, b: UserSetting | PlainMessage<UserSetting> | undefined): boolean;
}
/**
* @generated from enum slash.api.v2.UserSetting.Locale
*/
export declare enum UserSetting_Locale {
/**
* @generated from enum value: LOCALE_UNSPECIFIED = 0;
*/
UNSPECIFIED = 0,
/**
* @generated from enum value: LOCALE_EN = 1;
*/
EN = 1,
/**
* @generated from enum value: LOCALE_ZH = 2;
*/
ZH = 2,
}
/**
* @generated from message slash.api.v2.GetUserSettingRequest
*/
export declare class GetUserSettingRequest extends Message<GetUserSettingRequest> {
/**
* id is the user id.
*
* @generated from field: int32 id = 1;
*/
id: number;
constructor(data?: PartialMessage<GetUserSettingRequest>);
static readonly runtime: typeof proto3;
static readonly typeName = "slash.api.v2.GetUserSettingRequest";
static readonly fields: FieldList;
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): GetUserSettingRequest;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): GetUserSettingRequest;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): GetUserSettingRequest;
static equals(a: GetUserSettingRequest | PlainMessage<GetUserSettingRequest> | undefined, b: GetUserSettingRequest | PlainMessage<GetUserSettingRequest> | undefined): boolean;
}
/**
* @generated from message slash.api.v2.GetUserSettingResponse
*/
export declare class GetUserSettingResponse extends Message<GetUserSettingResponse> {
/**
* @generated from field: slash.api.v2.UserSetting user_setting = 1;
*/
userSetting?: UserSetting;
constructor(data?: PartialMessage<GetUserSettingResponse>);
static readonly runtime: typeof proto3;
static readonly typeName = "slash.api.v2.GetUserSettingResponse";
static readonly fields: FieldList;
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): GetUserSettingResponse;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): GetUserSettingResponse;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): GetUserSettingResponse;
static equals(a: GetUserSettingResponse | PlainMessage<GetUserSettingResponse> | undefined, b: GetUserSettingResponse | PlainMessage<GetUserSettingResponse> | undefined): boolean;
}
/**
* @generated from message slash.api.v2.UpdateUserSettingRequest
*/
export declare class UpdateUserSettingRequest extends Message<UpdateUserSettingRequest> {
/**
* id is the user id.
*
* @generated from field: int32 id = 1;
*/
id: number;
/**
* user_setting is the user setting to update.
*
* @generated from field: slash.api.v2.UserSetting user_setting = 2;
*/
userSetting?: UserSetting;
/**
* update_mask is the field mask to update the user setting.
*
* @generated from field: google.protobuf.FieldMask update_mask = 3;
*/
updateMask?: FieldMask;
constructor(data?: PartialMessage<UpdateUserSettingRequest>);
static readonly runtime: typeof proto3;
static readonly typeName = "slash.api.v2.UpdateUserSettingRequest";
static readonly fields: FieldList;
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): UpdateUserSettingRequest;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): UpdateUserSettingRequest;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): UpdateUserSettingRequest;
static equals(a: UpdateUserSettingRequest | PlainMessage<UpdateUserSettingRequest> | undefined, b: UpdateUserSettingRequest | PlainMessage<UpdateUserSettingRequest> | undefined): boolean;
}
/**
* @generated from message slash.api.v2.UpdateUserSettingResponse
*/
export declare class UpdateUserSettingResponse extends Message<UpdateUserSettingResponse> {
/**
* @generated from field: slash.api.v2.UserSetting user_setting = 1;
*/
userSetting?: UserSetting;
constructor(data?: PartialMessage<UpdateUserSettingResponse>);
static readonly runtime: typeof proto3;
static readonly typeName = "slash.api.v2.UpdateUserSettingResponse";
static readonly fields: FieldList;
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): UpdateUserSettingResponse;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): UpdateUserSettingResponse;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): UpdateUserSettingResponse;
static equals(a: UpdateUserSettingResponse | PlainMessage<UpdateUserSettingResponse> | undefined, b: UpdateUserSettingResponse | PlainMessage<UpdateUserSettingResponse> | undefined): boolean;
}

View File

@ -0,0 +1,72 @@
// @generated by protoc-gen-es v1.3.0
// @generated from file api/v2/user_setting_service.proto (package slash.api.v2, syntax proto3)
/* eslint-disable */
// @ts-nocheck
import { FieldMask, proto3 } from "@bufbuild/protobuf";
/**
* @generated from message slash.api.v2.UserSetting
*/
export const UserSetting = proto3.makeMessageType(
"slash.api.v2.UserSetting",
() => [
{ no: 1, name: "id", kind: "scalar", T: 5 /* ScalarType.INT32 */ },
{ no: 2, name: "locale", kind: "enum", T: proto3.getEnumType(UserSetting_Locale) },
],
);
/**
* @generated from enum slash.api.v2.UserSetting.Locale
*/
export const UserSetting_Locale = proto3.makeEnum(
"slash.api.v2.UserSetting.Locale",
[
{no: 0, name: "LOCALE_UNSPECIFIED", localName: "UNSPECIFIED"},
{no: 1, name: "LOCALE_EN", localName: "EN"},
{no: 2, name: "LOCALE_ZH", localName: "ZH"},
],
);
/**
* @generated from message slash.api.v2.GetUserSettingRequest
*/
export const GetUserSettingRequest = proto3.makeMessageType(
"slash.api.v2.GetUserSettingRequest",
() => [
{ no: 1, name: "id", kind: "scalar", T: 5 /* ScalarType.INT32 */ },
],
);
/**
* @generated from message slash.api.v2.GetUserSettingResponse
*/
export const GetUserSettingResponse = proto3.makeMessageType(
"slash.api.v2.GetUserSettingResponse",
() => [
{ no: 1, name: "user_setting", kind: "message", T: UserSetting },
],
);
/**
* @generated from message slash.api.v2.UpdateUserSettingRequest
*/
export const UpdateUserSettingRequest = proto3.makeMessageType(
"slash.api.v2.UpdateUserSettingRequest",
() => [
{ no: 1, name: "id", kind: "scalar", T: 5 /* ScalarType.INT32 */ },
{ no: 2, name: "user_setting", kind: "message", T: UserSetting },
{ no: 3, name: "update_mask", kind: "message", T: FieldMask },
],
);
/**
* @generated from message slash.api.v2.UpdateUserSettingResponse
*/
export const UpdateUserSettingResponse = proto3.makeMessageType(
"slash.api.v2.UpdateUserSettingResponse",
() => [
{ no: 1, name: "user_setting", kind: "message", T: UserSetting },
],
);

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

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

View File

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

View File

@ -1,75 +0,0 @@
/* eslint-disable */
import _m0 from "protobufjs/minimal";
export const protobufPackage = "slash.store";
export interface ActivityShorcutCreatePayload {
shortcutId: number;
}
function createBaseActivityShorcutCreatePayload(): ActivityShorcutCreatePayload {
return { shortcutId: 0 };
}
export const ActivityShorcutCreatePayload = {
encode(message: ActivityShorcutCreatePayload, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.shortcutId !== 0) {
writer.uint32(8).int32(message.shortcutId);
}
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): ActivityShorcutCreatePayload {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseActivityShorcutCreatePayload();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 8) {
break;
}
message.shortcutId = reader.int32();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object: any): ActivityShorcutCreatePayload {
return { shortcutId: isSet(object.shortcutId) ? Number(object.shortcutId) : 0 };
},
toJSON(message: ActivityShorcutCreatePayload): unknown {
const obj: any = {};
message.shortcutId !== undefined && (obj.shortcutId = Math.round(message.shortcutId));
return obj;
},
create(base?: DeepPartial<ActivityShorcutCreatePayload>): ActivityShorcutCreatePayload {
return ActivityShorcutCreatePayload.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<ActivityShorcutCreatePayload>): ActivityShorcutCreatePayload {
const message = createBaseActivityShorcutCreatePayload();
message.shortcutId = object.shortcutId ?? 0;
return message;
},
};
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
export type DeepPartial<T> = T extends Builtin ? T
: T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
: T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
: Partial<T>;
function isSet(value: any): boolean {
return value !== null && value !== undefined;
}

View File

@ -0,0 +1,32 @@
// @generated by protoc-gen-es v1.3.0
// @generated from file store/activity.proto (package slash.store, syntax proto3)
/* eslint-disable */
// @ts-nocheck
import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf";
import { Message, proto3 } from "@bufbuild/protobuf";
/**
* @generated from message slash.store.ActivityShorcutCreatePayload
*/
export declare class ActivityShorcutCreatePayload extends Message<ActivityShorcutCreatePayload> {
/**
* @generated from field: int32 shortcut_id = 1;
*/
shortcutId: number;
constructor(data?: PartialMessage<ActivityShorcutCreatePayload>);
static readonly runtime: typeof proto3;
static readonly typeName = "slash.store.ActivityShorcutCreatePayload";
static readonly fields: FieldList;
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): ActivityShorcutCreatePayload;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): ActivityShorcutCreatePayload;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): ActivityShorcutCreatePayload;
static equals(a: ActivityShorcutCreatePayload | PlainMessage<ActivityShorcutCreatePayload> | undefined, b: ActivityShorcutCreatePayload | PlainMessage<ActivityShorcutCreatePayload> | undefined): boolean;
}

View File

@ -0,0 +1,17 @@
// @generated by protoc-gen-es v1.3.0
// @generated from file store/activity.proto (package slash.store, syntax proto3)
/* eslint-disable */
// @ts-nocheck
import { proto3 } from "@bufbuild/protobuf";
/**
* @generated from message slash.store.ActivityShorcutCreatePayload
*/
export const ActivityShorcutCreatePayload = proto3.makeMessageType(
"slash.store.ActivityShorcutCreatePayload",
() => [
{ no: 1, name: "shortcut_id", kind: "scalar", T: 5 /* ScalarType.INT32 */ },
],
);

View File

@ -1,42 +0,0 @@
/* eslint-disable */
export const protobufPackage = "slash.store";
export enum RowStatus {
ROW_STATUS_UNSPECIFIED = 0,
NORMAL = 1,
ARCHIVED = 2,
UNRECOGNIZED = -1,
}
export function rowStatusFromJSON(object: any): RowStatus {
switch (object) {
case 0:
case "ROW_STATUS_UNSPECIFIED":
return RowStatus.ROW_STATUS_UNSPECIFIED;
case 1:
case "NORMAL":
return RowStatus.NORMAL;
case 2:
case "ARCHIVED":
return RowStatus.ARCHIVED;
case -1:
case "UNRECOGNIZED":
default:
return RowStatus.UNRECOGNIZED;
}
}
export function rowStatusToJSON(object: RowStatus): string {
switch (object) {
case RowStatus.ROW_STATUS_UNSPECIFIED:
return "ROW_STATUS_UNSPECIFIED";
case RowStatus.NORMAL:
return "NORMAL";
case RowStatus.ARCHIVED:
return "ARCHIVED";
case RowStatus.UNRECOGNIZED:
default:
return "UNRECOGNIZED";
}
}

View File

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

View File

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

View File

@ -1,419 +0,0 @@
/* eslint-disable */
import Long from "long";
import _m0 from "protobufjs/minimal";
import { RowStatus, rowStatusFromJSON, rowStatusToJSON } from "./common";
export const protobufPackage = "slash.store";
export enum Visibility {
VISIBILITY_UNSPECIFIED = 0,
PRIVATE = 1,
WORKSPACE = 2,
PUBLIC = 3,
UNRECOGNIZED = -1,
}
export function visibilityFromJSON(object: any): Visibility {
switch (object) {
case 0:
case "VISIBILITY_UNSPECIFIED":
return Visibility.VISIBILITY_UNSPECIFIED;
case 1:
case "PRIVATE":
return Visibility.PRIVATE;
case 2:
case "WORKSPACE":
return Visibility.WORKSPACE;
case 3:
case "PUBLIC":
return Visibility.PUBLIC;
case -1:
case "UNRECOGNIZED":
default:
return Visibility.UNRECOGNIZED;
}
}
export function visibilityToJSON(object: Visibility): string {
switch (object) {
case Visibility.VISIBILITY_UNSPECIFIED:
return "VISIBILITY_UNSPECIFIED";
case Visibility.PRIVATE:
return "PRIVATE";
case Visibility.WORKSPACE:
return "WORKSPACE";
case Visibility.PUBLIC:
return "PUBLIC";
case Visibility.UNRECOGNIZED:
default:
return "UNRECOGNIZED";
}
}
export interface Shortcut {
id: number;
creatorId: number;
createdTs: number;
updatedTs: number;
rowStatus: RowStatus;
name: string;
link: string;
title: string;
tags: string[];
description: string;
visibility: Visibility;
ogMetadata?: OpenGraphMetadata | undefined;
}
export interface OpenGraphMetadata {
title: string;
description: string;
image: string;
}
function createBaseShortcut(): Shortcut {
return {
id: 0,
creatorId: 0,
createdTs: 0,
updatedTs: 0,
rowStatus: 0,
name: "",
link: "",
title: "",
tags: [],
description: "",
visibility: 0,
ogMetadata: undefined,
};
}
export const Shortcut = {
encode(message: Shortcut, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.id !== 0) {
writer.uint32(8).int32(message.id);
}
if (message.creatorId !== 0) {
writer.uint32(16).int32(message.creatorId);
}
if (message.createdTs !== 0) {
writer.uint32(24).int64(message.createdTs);
}
if (message.updatedTs !== 0) {
writer.uint32(32).int64(message.updatedTs);
}
if (message.rowStatus !== 0) {
writer.uint32(40).int32(message.rowStatus);
}
if (message.name !== "") {
writer.uint32(50).string(message.name);
}
if (message.link !== "") {
writer.uint32(58).string(message.link);
}
if (message.title !== "") {
writer.uint32(66).string(message.title);
}
for (const v of message.tags) {
writer.uint32(74).string(v!);
}
if (message.description !== "") {
writer.uint32(82).string(message.description);
}
if (message.visibility !== 0) {
writer.uint32(88).int32(message.visibility);
}
if (message.ogMetadata !== undefined) {
OpenGraphMetadata.encode(message.ogMetadata, writer.uint32(98).fork()).ldelim();
}
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): Shortcut {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseShortcut();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 8) {
break;
}
message.id = reader.int32();
continue;
case 2:
if (tag !== 16) {
break;
}
message.creatorId = reader.int32();
continue;
case 3:
if (tag !== 24) {
break;
}
message.createdTs = longToNumber(reader.int64() as Long);
continue;
case 4:
if (tag !== 32) {
break;
}
message.updatedTs = longToNumber(reader.int64() as Long);
continue;
case 5:
if (tag !== 40) {
break;
}
message.rowStatus = reader.int32() as any;
continue;
case 6:
if (tag !== 50) {
break;
}
message.name = reader.string();
continue;
case 7:
if (tag !== 58) {
break;
}
message.link = reader.string();
continue;
case 8:
if (tag !== 66) {
break;
}
message.title = reader.string();
continue;
case 9:
if (tag !== 74) {
break;
}
message.tags.push(reader.string());
continue;
case 10:
if (tag !== 82) {
break;
}
message.description = reader.string();
continue;
case 11:
if (tag !== 88) {
break;
}
message.visibility = reader.int32() as any;
continue;
case 12:
if (tag !== 98) {
break;
}
message.ogMetadata = OpenGraphMetadata.decode(reader, reader.uint32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object: any): Shortcut {
return {
id: isSet(object.id) ? Number(object.id) : 0,
creatorId: isSet(object.creatorId) ? Number(object.creatorId) : 0,
createdTs: isSet(object.createdTs) ? Number(object.createdTs) : 0,
updatedTs: isSet(object.updatedTs) ? Number(object.updatedTs) : 0,
rowStatus: isSet(object.rowStatus) ? rowStatusFromJSON(object.rowStatus) : 0,
name: isSet(object.name) ? String(object.name) : "",
link: isSet(object.link) ? String(object.link) : "",
title: isSet(object.title) ? String(object.title) : "",
tags: Array.isArray(object?.tags) ? object.tags.map((e: any) => String(e)) : [],
description: isSet(object.description) ? String(object.description) : "",
visibility: isSet(object.visibility) ? visibilityFromJSON(object.visibility) : 0,
ogMetadata: isSet(object.ogMetadata) ? OpenGraphMetadata.fromJSON(object.ogMetadata) : undefined,
};
},
toJSON(message: Shortcut): unknown {
const obj: any = {};
message.id !== undefined && (obj.id = Math.round(message.id));
message.creatorId !== undefined && (obj.creatorId = Math.round(message.creatorId));
message.createdTs !== undefined && (obj.createdTs = Math.round(message.createdTs));
message.updatedTs !== undefined && (obj.updatedTs = Math.round(message.updatedTs));
message.rowStatus !== undefined && (obj.rowStatus = rowStatusToJSON(message.rowStatus));
message.name !== undefined && (obj.name = message.name);
message.link !== undefined && (obj.link = message.link);
message.title !== undefined && (obj.title = message.title);
if (message.tags) {
obj.tags = message.tags.map((e) => e);
} else {
obj.tags = [];
}
message.description !== undefined && (obj.description = message.description);
message.visibility !== undefined && (obj.visibility = visibilityToJSON(message.visibility));
message.ogMetadata !== undefined &&
(obj.ogMetadata = message.ogMetadata ? OpenGraphMetadata.toJSON(message.ogMetadata) : undefined);
return obj;
},
create(base?: DeepPartial<Shortcut>): Shortcut {
return Shortcut.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<Shortcut>): Shortcut {
const message = createBaseShortcut();
message.id = object.id ?? 0;
message.creatorId = object.creatorId ?? 0;
message.createdTs = object.createdTs ?? 0;
message.updatedTs = object.updatedTs ?? 0;
message.rowStatus = object.rowStatus ?? 0;
message.name = object.name ?? "";
message.link = object.link ?? "";
message.title = object.title ?? "";
message.tags = object.tags?.map((e) => e) || [];
message.description = object.description ?? "";
message.visibility = object.visibility ?? 0;
message.ogMetadata = (object.ogMetadata !== undefined && object.ogMetadata !== null)
? OpenGraphMetadata.fromPartial(object.ogMetadata)
: undefined;
return message;
},
};
function createBaseOpenGraphMetadata(): OpenGraphMetadata {
return { title: "", description: "", image: "" };
}
export const OpenGraphMetadata = {
encode(message: OpenGraphMetadata, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.title !== "") {
writer.uint32(10).string(message.title);
}
if (message.description !== "") {
writer.uint32(18).string(message.description);
}
if (message.image !== "") {
writer.uint32(26).string(message.image);
}
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): OpenGraphMetadata {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseOpenGraphMetadata();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.title = reader.string();
continue;
case 2:
if (tag !== 18) {
break;
}
message.description = reader.string();
continue;
case 3:
if (tag !== 26) {
break;
}
message.image = reader.string();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object: any): OpenGraphMetadata {
return {
title: isSet(object.title) ? String(object.title) : "",
description: isSet(object.description) ? String(object.description) : "",
image: isSet(object.image) ? String(object.image) : "",
};
},
toJSON(message: OpenGraphMetadata): unknown {
const obj: any = {};
message.title !== undefined && (obj.title = message.title);
message.description !== undefined && (obj.description = message.description);
message.image !== undefined && (obj.image = message.image);
return obj;
},
create(base?: DeepPartial<OpenGraphMetadata>): OpenGraphMetadata {
return OpenGraphMetadata.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<OpenGraphMetadata>): OpenGraphMetadata {
const message = createBaseOpenGraphMetadata();
message.title = object.title ?? "";
message.description = object.description ?? "";
message.image = object.image ?? "";
return message;
},
};
declare const self: any | undefined;
declare const window: any | undefined;
declare const global: any | undefined;
const tsProtoGlobalThis: any = (() => {
if (typeof globalThis !== "undefined") {
return globalThis;
}
if (typeof self !== "undefined") {
return self;
}
if (typeof window !== "undefined") {
return window;
}
if (typeof global !== "undefined") {
return global;
}
throw "Unable to locate global object";
})();
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
export type DeepPartial<T> = T extends Builtin ? T
: T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
: T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
: Partial<T>;
function longToNumber(long: Long): number {
if (long.gt(Number.MAX_SAFE_INTEGER)) {
throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
}
return long.toNumber();
}
if (_m0.util.Long !== Long) {
_m0.util.Long = Long as any;
_m0.configure();
}
function isSet(value: any): boolean {
return value !== null && value !== undefined;
}

View File

@ -0,0 +1,147 @@
// @generated by protoc-gen-es v1.3.0
// @generated from file store/shortcut.proto (package slash.store, syntax proto3)
/* eslint-disable */
// @ts-nocheck
import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf";
import { Message, proto3 } from "@bufbuild/protobuf";
import type { RowStatus } from "./common_pb.js";
/**
* @generated from enum slash.store.Visibility
*/
export declare enum Visibility {
/**
* @generated from enum value: VISIBILITY_UNSPECIFIED = 0;
*/
VISIBILITY_UNSPECIFIED = 0,
/**
* @generated from enum value: PRIVATE = 1;
*/
PRIVATE = 1,
/**
* @generated from enum value: WORKSPACE = 2;
*/
WORKSPACE = 2,
/**
* @generated from enum value: PUBLIC = 3;
*/
PUBLIC = 3,
}
/**
* @generated from message slash.store.Shortcut
*/
export declare class Shortcut extends Message<Shortcut> {
/**
* @generated from field: int32 id = 1;
*/
id: number;
/**
* @generated from field: int32 creator_id = 2;
*/
creatorId: number;
/**
* @generated from field: int64 created_ts = 3;
*/
createdTs: bigint;
/**
* @generated from field: int64 updated_ts = 4;
*/
updatedTs: bigint;
/**
* @generated from field: slash.store.RowStatus row_status = 5;
*/
rowStatus: RowStatus;
/**
* @generated from field: string name = 6;
*/
name: string;
/**
* @generated from field: string link = 7;
*/
link: string;
/**
* @generated from field: string title = 8;
*/
title: string;
/**
* @generated from field: repeated string tags = 9;
*/
tags: string[];
/**
* @generated from field: string description = 10;
*/
description: string;
/**
* @generated from field: slash.store.Visibility visibility = 11;
*/
visibility: Visibility;
/**
* @generated from field: slash.store.OpenGraphMetadata og_metadata = 12;
*/
ogMetadata?: OpenGraphMetadata;
constructor(data?: PartialMessage<Shortcut>);
static readonly runtime: typeof proto3;
static readonly typeName = "slash.store.Shortcut";
static readonly fields: FieldList;
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): Shortcut;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): Shortcut;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): Shortcut;
static equals(a: Shortcut | PlainMessage<Shortcut> | undefined, b: Shortcut | PlainMessage<Shortcut> | undefined): boolean;
}
/**
* @generated from message slash.store.OpenGraphMetadata
*/
export declare class OpenGraphMetadata extends Message<OpenGraphMetadata> {
/**
* @generated from field: string title = 1;
*/
title: string;
/**
* @generated from field: string description = 2;
*/
description: string;
/**
* @generated from field: string image = 3;
*/
image: string;
constructor(data?: PartialMessage<OpenGraphMetadata>);
static readonly runtime: typeof proto3;
static readonly typeName = "slash.store.OpenGraphMetadata";
static readonly fields: FieldList;
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): OpenGraphMetadata;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): OpenGraphMetadata;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): OpenGraphMetadata;
static equals(a: OpenGraphMetadata | PlainMessage<OpenGraphMetadata> | undefined, b: OpenGraphMetadata | PlainMessage<OpenGraphMetadata> | undefined): boolean;
}

View File

@ -0,0 +1,54 @@
// @generated by protoc-gen-es v1.3.0
// @generated from file store/shortcut.proto (package slash.store, syntax proto3)
/* eslint-disable */
// @ts-nocheck
import { proto3 } from "@bufbuild/protobuf";
import { RowStatus } from "./common_pb.js";
/**
* @generated from enum slash.store.Visibility
*/
export const Visibility = proto3.makeEnum(
"slash.store.Visibility",
[
{no: 0, name: "VISIBILITY_UNSPECIFIED"},
{no: 1, name: "PRIVATE"},
{no: 2, name: "WORKSPACE"},
{no: 3, name: "PUBLIC"},
],
);
/**
* @generated from message slash.store.Shortcut
*/
export const Shortcut = proto3.makeMessageType(
"slash.store.Shortcut",
() => [
{ no: 1, name: "id", kind: "scalar", T: 5 /* ScalarType.INT32 */ },
{ no: 2, name: "creator_id", kind: "scalar", T: 5 /* ScalarType.INT32 */ },
{ no: 3, name: "created_ts", kind: "scalar", T: 3 /* ScalarType.INT64 */ },
{ no: 4, name: "updated_ts", kind: "scalar", T: 3 /* ScalarType.INT64 */ },
{ no: 5, name: "row_status", kind: "enum", T: proto3.getEnumType(RowStatus) },
{ no: 6, name: "name", kind: "scalar", T: 9 /* ScalarType.STRING */ },
{ no: 7, name: "link", kind: "scalar", T: 9 /* ScalarType.STRING */ },
{ no: 8, name: "title", kind: "scalar", T: 9 /* ScalarType.STRING */ },
{ no: 9, name: "tags", kind: "scalar", T: 9 /* ScalarType.STRING */, repeated: true },
{ no: 10, name: "description", kind: "scalar", T: 9 /* ScalarType.STRING */ },
{ no: 11, name: "visibility", kind: "enum", T: proto3.getEnumType(Visibility) },
{ no: 12, name: "og_metadata", kind: "message", T: OpenGraphMetadata },
],
);
/**
* @generated from message slash.store.OpenGraphMetadata
*/
export const OpenGraphMetadata = proto3.makeMessageType(
"slash.store.OpenGraphMetadata",
() => [
{ no: 1, name: "title", kind: "scalar", T: 9 /* ScalarType.STRING */ },
{ no: 2, name: "description", kind: "scalar", T: 9 /* ScalarType.STRING */ },
{ no: 3, name: "image", kind: "scalar", T: 9 /* ScalarType.STRING */ },
],
);

View File

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

View File

@ -0,0 +1,156 @@
// @generated by protoc-gen-es v1.3.0
// @generated from file store/user_setting.proto (package slash.store, syntax proto3)
/* eslint-disable */
// @ts-nocheck
import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf";
import { Message, proto3 } from "@bufbuild/protobuf";
/**
* @generated from enum slash.store.UserSettingKey
*/
export declare enum UserSettingKey {
/**
* @generated from enum value: USER_SETTING_KEY_UNSPECIFIED = 0;
*/
USER_SETTING_KEY_UNSPECIFIED = 0,
/**
* Access tokens for the user.
*
* @generated from enum value: USER_SETTING_ACCESS_TOKENS = 1;
*/
USER_SETTING_ACCESS_TOKENS = 1,
/**
* Locale for the user.
*
* @generated from enum value: USER_SETTING_LOCALE = 2;
*/
USER_SETTING_LOCALE = 2,
}
/**
* @generated from enum slash.store.LocaleUserSetting
*/
export declare enum LocaleUserSetting {
/**
* @generated from enum value: LOCALE_USER_SETTING_UNSPECIFIED = 0;
*/
UNSPECIFIED = 0,
/**
* @generated from enum value: LOCALE_USER_SETTING_EN = 1;
*/
EN = 1,
/**
* @generated from enum value: LOCALE_USER_SETTING_ZH = 2;
*/
ZH = 2,
}
/**
* @generated from message slash.store.UserSetting
*/
export declare class UserSetting extends Message<UserSetting> {
/**
* @generated from field: int32 user_id = 1;
*/
userId: number;
/**
* @generated from field: slash.store.UserSettingKey key = 2;
*/
key: UserSettingKey;
/**
* @generated from oneof slash.store.UserSetting.value
*/
value: {
/**
* @generated from field: slash.store.AccessTokensUserSetting access_tokens = 3;
*/
value: AccessTokensUserSetting;
case: "accessTokens";
} | {
/**
* @generated from field: slash.store.LocaleUserSetting locale = 4;
*/
value: LocaleUserSetting;
case: "locale";
} | { case: undefined; value?: undefined };
constructor(data?: PartialMessage<UserSetting>);
static readonly runtime: typeof proto3;
static readonly typeName = "slash.store.UserSetting";
static readonly fields: FieldList;
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): UserSetting;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): UserSetting;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): UserSetting;
static equals(a: UserSetting | PlainMessage<UserSetting> | undefined, b: UserSetting | PlainMessage<UserSetting> | undefined): boolean;
}
/**
* @generated from message slash.store.AccessTokensUserSetting
*/
export declare class AccessTokensUserSetting extends Message<AccessTokensUserSetting> {
/**
* @generated from field: repeated slash.store.AccessTokensUserSetting.AccessToken access_tokens = 1;
*/
accessTokens: AccessTokensUserSetting_AccessToken[];
constructor(data?: PartialMessage<AccessTokensUserSetting>);
static readonly runtime: typeof proto3;
static readonly typeName = "slash.store.AccessTokensUserSetting";
static readonly fields: FieldList;
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): AccessTokensUserSetting;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): AccessTokensUserSetting;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): AccessTokensUserSetting;
static equals(a: AccessTokensUserSetting | PlainMessage<AccessTokensUserSetting> | undefined, b: AccessTokensUserSetting | PlainMessage<AccessTokensUserSetting> | undefined): boolean;
}
/**
* @generated from message slash.store.AccessTokensUserSetting.AccessToken
*/
export declare class AccessTokensUserSetting_AccessToken extends Message<AccessTokensUserSetting_AccessToken> {
/**
* The access token is a JWT token.
* Including expiration time, issuer, etc.
*
* @generated from field: string access_token = 1;
*/
accessToken: string;
/**
* A description for the access token.
*
* @generated from field: string description = 2;
*/
description: string;
constructor(data?: PartialMessage<AccessTokensUserSetting_AccessToken>);
static readonly runtime: typeof proto3;
static readonly typeName = "slash.store.AccessTokensUserSetting.AccessToken";
static readonly fields: FieldList;
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): AccessTokensUserSetting_AccessToken;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): AccessTokensUserSetting_AccessToken;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): AccessTokensUserSetting_AccessToken;
static equals(a: AccessTokensUserSetting_AccessToken | PlainMessage<AccessTokensUserSetting_AccessToken> | undefined, b: AccessTokensUserSetting_AccessToken | PlainMessage<AccessTokensUserSetting_AccessToken> | undefined): boolean;
}

View File

@ -0,0 +1,66 @@
// @generated by protoc-gen-es v1.3.0
// @generated from file store/user_setting.proto (package slash.store, syntax proto3)
/* eslint-disable */
// @ts-nocheck
import { proto3 } from "@bufbuild/protobuf";
/**
* @generated from enum slash.store.UserSettingKey
*/
export const UserSettingKey = proto3.makeEnum(
"slash.store.UserSettingKey",
[
{no: 0, name: "USER_SETTING_KEY_UNSPECIFIED"},
{no: 1, name: "USER_SETTING_ACCESS_TOKENS"},
{no: 2, name: "USER_SETTING_LOCALE"},
],
);
/**
* @generated from enum slash.store.LocaleUserSetting
*/
export const LocaleUserSetting = proto3.makeEnum(
"slash.store.LocaleUserSetting",
[
{no: 0, name: "LOCALE_USER_SETTING_UNSPECIFIED", localName: "UNSPECIFIED"},
{no: 1, name: "LOCALE_USER_SETTING_EN", localName: "EN"},
{no: 2, name: "LOCALE_USER_SETTING_ZH", localName: "ZH"},
],
);
/**
* @generated from message slash.store.UserSetting
*/
export const UserSetting = proto3.makeMessageType(
"slash.store.UserSetting",
() => [
{ no: 1, name: "user_id", kind: "scalar", T: 5 /* ScalarType.INT32 */ },
{ no: 2, name: "key", kind: "enum", T: proto3.getEnumType(UserSettingKey) },
{ no: 3, name: "access_tokens", kind: "message", T: AccessTokensUserSetting, oneof: "value" },
{ no: 4, name: "locale", kind: "enum", T: proto3.getEnumType(LocaleUserSetting), oneof: "value" },
],
);
/**
* @generated from message slash.store.AccessTokensUserSetting
*/
export const AccessTokensUserSetting = proto3.makeMessageType(
"slash.store.AccessTokensUserSetting",
() => [
{ no: 1, name: "access_tokens", kind: "message", T: AccessTokensUserSetting_AccessToken, repeated: true },
],
);
/**
* @generated from message slash.store.AccessTokensUserSetting.AccessToken
*/
export const AccessTokensUserSetting_AccessToken = proto3.makeMessageType(
"slash.store.AccessTokensUserSetting.AccessToken",
() => [
{ no: 1, name: "access_token", kind: "scalar", T: 9 /* ScalarType.STRING */ },
{ no: 2, name: "description", kind: "scalar", T: 9 /* ScalarType.STRING */ },
],
{localName: "AccessTokensUserSetting_AccessToken"},
);

View File

@ -1,224 +0,0 @@
/* eslint-disable */
import _m0 from "protobufjs/minimal";
export const protobufPackage = "slash.store";
export enum WorkspaceSettingKey {
WORKSPACE_SETTING_KEY_UNSPECIFIED = 0,
WORKSPACE_SETTING_AUTO_BACKUP = 1,
UNRECOGNIZED = -1,
}
export function workspaceSettingKeyFromJSON(object: any): WorkspaceSettingKey {
switch (object) {
case 0:
case "WORKSPACE_SETTING_KEY_UNSPECIFIED":
return WorkspaceSettingKey.WORKSPACE_SETTING_KEY_UNSPECIFIED;
case 1:
case "WORKSPACE_SETTING_AUTO_BACKUP":
return WorkspaceSettingKey.WORKSPACE_SETTING_AUTO_BACKUP;
case -1:
case "UNRECOGNIZED":
default:
return WorkspaceSettingKey.UNRECOGNIZED;
}
}
export function workspaceSettingKeyToJSON(object: WorkspaceSettingKey): string {
switch (object) {
case WorkspaceSettingKey.WORKSPACE_SETTING_KEY_UNSPECIFIED:
return "WORKSPACE_SETTING_KEY_UNSPECIFIED";
case WorkspaceSettingKey.WORKSPACE_SETTING_AUTO_BACKUP:
return "WORKSPACE_SETTING_AUTO_BACKUP";
case WorkspaceSettingKey.UNRECOGNIZED:
default:
return "UNRECOGNIZED";
}
}
export interface WorkspaceSetting {
key: WorkspaceSettingKey;
autoBackup?: AutoBackupWorkspaceSetting | undefined;
}
export interface AutoBackupWorkspaceSetting {
/** Whether auto backup is enabled. */
enabled: boolean;
/**
* The cron expression for auto backup.
* For example, "0 0 0 * * *" means backup at 00:00:00 every day.
* See https://en.wikipedia.org/wiki/Cron for more details.
*/
cronExpression: string;
/** The maximum number of backups to keep. */
maxKeep: number;
}
function createBaseWorkspaceSetting(): WorkspaceSetting {
return { key: 0, autoBackup: undefined };
}
export const WorkspaceSetting = {
encode(message: WorkspaceSetting, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.key !== 0) {
writer.uint32(8).int32(message.key);
}
if (message.autoBackup !== undefined) {
AutoBackupWorkspaceSetting.encode(message.autoBackup, writer.uint32(18).fork()).ldelim();
}
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): WorkspaceSetting {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseWorkspaceSetting();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 8) {
break;
}
message.key = reader.int32() as any;
continue;
case 2:
if (tag !== 18) {
break;
}
message.autoBackup = AutoBackupWorkspaceSetting.decode(reader, reader.uint32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object: any): WorkspaceSetting {
return {
key: isSet(object.key) ? workspaceSettingKeyFromJSON(object.key) : 0,
autoBackup: isSet(object.autoBackup) ? AutoBackupWorkspaceSetting.fromJSON(object.autoBackup) : undefined,
};
},
toJSON(message: WorkspaceSetting): unknown {
const obj: any = {};
message.key !== undefined && (obj.key = workspaceSettingKeyToJSON(message.key));
message.autoBackup !== undefined &&
(obj.autoBackup = message.autoBackup ? AutoBackupWorkspaceSetting.toJSON(message.autoBackup) : undefined);
return obj;
},
create(base?: DeepPartial<WorkspaceSetting>): WorkspaceSetting {
return WorkspaceSetting.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<WorkspaceSetting>): WorkspaceSetting {
const message = createBaseWorkspaceSetting();
message.key = object.key ?? 0;
message.autoBackup = (object.autoBackup !== undefined && object.autoBackup !== null)
? AutoBackupWorkspaceSetting.fromPartial(object.autoBackup)
: undefined;
return message;
},
};
function createBaseAutoBackupWorkspaceSetting(): AutoBackupWorkspaceSetting {
return { enabled: false, cronExpression: "", maxKeep: 0 };
}
export const AutoBackupWorkspaceSetting = {
encode(message: AutoBackupWorkspaceSetting, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.enabled === true) {
writer.uint32(8).bool(message.enabled);
}
if (message.cronExpression !== "") {
writer.uint32(18).string(message.cronExpression);
}
if (message.maxKeep !== 0) {
writer.uint32(24).int32(message.maxKeep);
}
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): AutoBackupWorkspaceSetting {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseAutoBackupWorkspaceSetting();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 8) {
break;
}
message.enabled = reader.bool();
continue;
case 2:
if (tag !== 18) {
break;
}
message.cronExpression = reader.string();
continue;
case 3:
if (tag !== 24) {
break;
}
message.maxKeep = reader.int32();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object: any): AutoBackupWorkspaceSetting {
return {
enabled: isSet(object.enabled) ? Boolean(object.enabled) : false,
cronExpression: isSet(object.cronExpression) ? String(object.cronExpression) : "",
maxKeep: isSet(object.maxKeep) ? Number(object.maxKeep) : 0,
};
},
toJSON(message: AutoBackupWorkspaceSetting): unknown {
const obj: any = {};
message.enabled !== undefined && (obj.enabled = message.enabled);
message.cronExpression !== undefined && (obj.cronExpression = message.cronExpression);
message.maxKeep !== undefined && (obj.maxKeep = Math.round(message.maxKeep));
return obj;
},
create(base?: DeepPartial<AutoBackupWorkspaceSetting>): AutoBackupWorkspaceSetting {
return AutoBackupWorkspaceSetting.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<AutoBackupWorkspaceSetting>): AutoBackupWorkspaceSetting {
const message = createBaseAutoBackupWorkspaceSetting();
message.enabled = object.enabled ?? false;
message.cronExpression = object.cronExpression ?? "";
message.maxKeep = object.maxKeep ?? 0;
return message;
},
};
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
export type DeepPartial<T> = T extends Builtin ? T
: T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
: T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
: Partial<T>;
function isSet(value: any): boolean {
return value !== null && value !== undefined;
}

View File

@ -0,0 +1,100 @@
// @generated by protoc-gen-es v1.3.0
// @generated from file store/workspace_setting.proto (package slash.store, syntax proto3)
/* eslint-disable */
// @ts-nocheck
import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf";
import { Message, proto3 } from "@bufbuild/protobuf";
/**
* @generated from enum slash.store.WorkspaceSettingKey
*/
export declare enum WorkspaceSettingKey {
/**
* @generated from enum value: WORKSPACE_SETTING_KEY_UNSPECIFIED = 0;
*/
WORKSPACE_SETTING_KEY_UNSPECIFIED = 0,
/**
* @generated from enum value: WORKSPACE_SETTING_AUTO_BACKUP = 1;
*/
WORKSPACE_SETTING_AUTO_BACKUP = 1,
}
/**
* @generated from message slash.store.WorkspaceSetting
*/
export declare class WorkspaceSetting extends Message<WorkspaceSetting> {
/**
* @generated from field: slash.store.WorkspaceSettingKey key = 1;
*/
key: WorkspaceSettingKey;
/**
* @generated from oneof slash.store.WorkspaceSetting.value
*/
value: {
/**
* @generated from field: slash.store.AutoBackupWorkspaceSetting auto_backup = 2;
*/
value: AutoBackupWorkspaceSetting;
case: "autoBackup";
} | { case: undefined; value?: undefined };
constructor(data?: PartialMessage<WorkspaceSetting>);
static readonly runtime: typeof proto3;
static readonly typeName = "slash.store.WorkspaceSetting";
static readonly fields: FieldList;
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): WorkspaceSetting;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): WorkspaceSetting;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): WorkspaceSetting;
static equals(a: WorkspaceSetting | PlainMessage<WorkspaceSetting> | undefined, b: WorkspaceSetting | PlainMessage<WorkspaceSetting> | undefined): boolean;
}
/**
* @generated from message slash.store.AutoBackupWorkspaceSetting
*/
export declare class AutoBackupWorkspaceSetting extends Message<AutoBackupWorkspaceSetting> {
/**
* Whether auto backup is enabled.
*
* @generated from field: bool enabled = 1;
*/
enabled: boolean;
/**
* The cron expression for auto backup.
* For example, "0 0 0 * * *" means backup at 00:00:00 every day.
* See https://en.wikipedia.org/wiki/Cron for more details.
*
* @generated from field: string cron_expression = 2;
*/
cronExpression: string;
/**
* The maximum number of backups to keep.
*
* @generated from field: int32 max_keep = 3;
*/
maxKeep: number;
constructor(data?: PartialMessage<AutoBackupWorkspaceSetting>);
static readonly runtime: typeof proto3;
static readonly typeName = "slash.store.AutoBackupWorkspaceSetting";
static readonly fields: FieldList;
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): AutoBackupWorkspaceSetting;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): AutoBackupWorkspaceSetting;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): AutoBackupWorkspaceSetting;
static equals(a: AutoBackupWorkspaceSetting | PlainMessage<AutoBackupWorkspaceSetting> | undefined, b: AutoBackupWorkspaceSetting | PlainMessage<AutoBackupWorkspaceSetting> | undefined): boolean;
}

View File

@ -0,0 +1,41 @@
// @generated by protoc-gen-es v1.3.0
// @generated from file store/workspace_setting.proto (package slash.store, syntax proto3)
/* eslint-disable */
// @ts-nocheck
import { proto3 } from "@bufbuild/protobuf";
/**
* @generated from enum slash.store.WorkspaceSettingKey
*/
export const WorkspaceSettingKey = proto3.makeEnum(
"slash.store.WorkspaceSettingKey",
[
{no: 0, name: "WORKSPACE_SETTING_KEY_UNSPECIFIED"},
{no: 1, name: "WORKSPACE_SETTING_AUTO_BACKUP"},
],
);
/**
* @generated from message slash.store.WorkspaceSetting
*/
export const WorkspaceSetting = proto3.makeMessageType(
"slash.store.WorkspaceSetting",
() => [
{ no: 1, name: "key", kind: "enum", T: proto3.getEnumType(WorkspaceSettingKey) },
{ no: 2, name: "auto_backup", kind: "message", T: AutoBackupWorkspaceSetting, oneof: "value" },
],
);
/**
* @generated from message slash.store.AutoBackupWorkspaceSetting
*/
export const AutoBackupWorkspaceSetting = proto3.makeMessageType(
"slash.store.AutoBackupWorkspaceSetting",
() => [
{ no: 1, name: "enabled", kind: "scalar", T: 8 /* ScalarType.BOOL */ },
{ no: 2, name: "cron_expression", kind: "scalar", T: 9 /* ScalarType.STRING */ },
{ no: 3, name: "max_keep", kind: "scalar", T: 5 /* ScalarType.INT32 */ },
],
);

View File

@ -20,10 +20,8 @@ plugins:
- paths=source_relative - paths=source_relative
- plugin: buf.build/bufbuild/es:v1.3.0 - plugin: buf.build/bufbuild/es:v1.3.0
out: ../frontend/types/proto out: ../frontend/types/proto
- plugin: buf.build/community/stephenh-ts-proto:v1.152.1 - plugin: buf.build/bufbuild/es:v1.3.0
out: ../frontend/web/src/types/proto out: ../frontend/web/src/types/proto
# reference: https://github.com/deeplay-io/nice-grpc/blob/master/packages/nice-grpc-web/README.md#using-ts-proto
opt: env=browser,useOptionals=messages,outputServices=false,useExactTypes=false,esModuleInterop=true
- plugin: buf.build/community/pseudomuto-doc:v1.5.1 - plugin: buf.build/community/pseudomuto-doc:v1.5.1
out: gen out: gen
opt: opt: