From a4e34e92ea27211912136c010550806343e4daf6 Mon Sep 17 00:00:00 2001 From: Tobias Date: Thu, 29 Feb 2024 00:15:41 +0100 Subject: [PATCH] Revert "Bugfix/fix development environment (#590)" This reverts commit fe59e78033672a99ae002ad886fbf0db9377fb01. --- proto/proto/buildinfo.pb.go | 4 +- proto/proto/devices.pb.go | 4 +- proto/proto/devices_grpc.pb.go | 27 +- proto/proto/server.pb.go | 4 +- proto/proto/server_grpc.pb.go | 12 +- proto/proto/users.pb.go | 4 +- proto/proto/users_grpc.pb.go | 17 +- website/package.json | 3 +- website/src/sdk/buildinfo_pb.ts | 184 ++-- website/src/sdk/devices_pb.ts | 1807 +++++++++++++++---------------- website/src/sdk/server_pb.ts | 942 ++++++++-------- website/src/sdk/users_pb.ts | 715 ++++++------ website/vite.config.ts | 11 +- 13 files changed, 1820 insertions(+), 1914 deletions(-) diff --git a/proto/proto/buildinfo.pb.go b/proto/proto/buildinfo.pb.go index 3812f033..a6a48887 100644 --- a/proto/proto/buildinfo.pb.go +++ b/proto/proto/buildinfo.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.32.0 -// protoc v4.24.4 +// protoc-gen-go v1.28.0 +// protoc v3.21.9 // source: buildinfo.proto package proto diff --git a/proto/proto/devices.pb.go b/proto/proto/devices.pb.go index 923a9886..a067a95f 100644 --- a/proto/proto/devices.pb.go +++ b/proto/proto/devices.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.32.0 -// protoc v4.24.4 +// protoc-gen-go v1.28.0 +// protoc v3.21.9 // source: devices.proto package proto diff --git a/proto/proto/devices_grpc.pb.go b/proto/proto/devices_grpc.pb.go index a6491a1a..66aedfae 100644 --- a/proto/proto/devices_grpc.pb.go +++ b/proto/proto/devices_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.3.0 -// - protoc v4.24.4 +// - protoc-gen-go-grpc v1.2.0 +// - protoc v3.21.9 // source: devices.proto package proto @@ -19,13 +19,6 @@ import ( // Requires gRPC-Go v1.32.0 or later. const _ = grpc.SupportPackageIsVersion7 -const ( - Devices_AddDevice_FullMethodName = "/proto.Devices/AddDevice" - Devices_ListDevices_FullMethodName = "/proto.Devices/ListDevices" - Devices_DeleteDevice_FullMethodName = "/proto.Devices/DeleteDevice" - Devices_ListAllDevices_FullMethodName = "/proto.Devices/ListAllDevices" -) - // DevicesClient is the client API for Devices service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. @@ -47,7 +40,7 @@ func NewDevicesClient(cc grpc.ClientConnInterface) DevicesClient { func (c *devicesClient) AddDevice(ctx context.Context, in *AddDeviceReq, opts ...grpc.CallOption) (*Device, error) { out := new(Device) - err := c.cc.Invoke(ctx, Devices_AddDevice_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, "/proto.Devices/AddDevice", in, out, opts...) if err != nil { return nil, err } @@ -56,7 +49,7 @@ func (c *devicesClient) AddDevice(ctx context.Context, in *AddDeviceReq, opts .. func (c *devicesClient) ListDevices(ctx context.Context, in *ListDevicesReq, opts ...grpc.CallOption) (*ListDevicesRes, error) { out := new(ListDevicesRes) - err := c.cc.Invoke(ctx, Devices_ListDevices_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, "/proto.Devices/ListDevices", in, out, opts...) if err != nil { return nil, err } @@ -65,7 +58,7 @@ func (c *devicesClient) ListDevices(ctx context.Context, in *ListDevicesReq, opt func (c *devicesClient) DeleteDevice(ctx context.Context, in *DeleteDeviceReq, opts ...grpc.CallOption) (*emptypb.Empty, error) { out := new(emptypb.Empty) - err := c.cc.Invoke(ctx, Devices_DeleteDevice_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, "/proto.Devices/DeleteDevice", in, out, opts...) if err != nil { return nil, err } @@ -74,7 +67,7 @@ func (c *devicesClient) DeleteDevice(ctx context.Context, in *DeleteDeviceReq, o func (c *devicesClient) ListAllDevices(ctx context.Context, in *ListAllDevicesReq, opts ...grpc.CallOption) (*ListAllDevicesRes, error) { out := new(ListAllDevicesRes) - err := c.cc.Invoke(ctx, Devices_ListAllDevices_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, "/proto.Devices/ListAllDevices", in, out, opts...) if err != nil { return nil, err } @@ -132,7 +125,7 @@ func _Devices_AddDevice_Handler(srv interface{}, ctx context.Context, dec func(i } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: Devices_AddDevice_FullMethodName, + FullMethod: "/proto.Devices/AddDevice", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(DevicesServer).AddDevice(ctx, req.(*AddDeviceReq)) @@ -150,7 +143,7 @@ func _Devices_ListDevices_Handler(srv interface{}, ctx context.Context, dec func } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: Devices_ListDevices_FullMethodName, + FullMethod: "/proto.Devices/ListDevices", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(DevicesServer).ListDevices(ctx, req.(*ListDevicesReq)) @@ -168,7 +161,7 @@ func _Devices_DeleteDevice_Handler(srv interface{}, ctx context.Context, dec fun } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: Devices_DeleteDevice_FullMethodName, + FullMethod: "/proto.Devices/DeleteDevice", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(DevicesServer).DeleteDevice(ctx, req.(*DeleteDeviceReq)) @@ -186,7 +179,7 @@ func _Devices_ListAllDevices_Handler(srv interface{}, ctx context.Context, dec f } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: Devices_ListAllDevices_FullMethodName, + FullMethod: "/proto.Devices/ListAllDevices", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(DevicesServer).ListAllDevices(ctx, req.(*ListAllDevicesReq)) diff --git a/proto/proto/server.pb.go b/proto/proto/server.pb.go index 9d2b6947..a9383350 100644 --- a/proto/proto/server.pb.go +++ b/proto/proto/server.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.32.0 -// protoc v4.24.4 +// protoc-gen-go v1.28.0 +// protoc v3.21.9 // source: server.proto package proto diff --git a/proto/proto/server_grpc.pb.go b/proto/proto/server_grpc.pb.go index e08e082c..aa7494da 100644 --- a/proto/proto/server_grpc.pb.go +++ b/proto/proto/server_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.3.0 -// - protoc v4.24.4 +// - protoc-gen-go-grpc v1.2.0 +// - protoc v3.21.9 // source: server.proto package proto @@ -18,10 +18,6 @@ import ( // Requires gRPC-Go v1.32.0 or later. const _ = grpc.SupportPackageIsVersion7 -const ( - Server_Info_FullMethodName = "/proto.Server/Info" -) - // ServerClient is the client API for Server service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. @@ -39,7 +35,7 @@ func NewServerClient(cc grpc.ClientConnInterface) ServerClient { func (c *serverClient) Info(ctx context.Context, in *InfoReq, opts ...grpc.CallOption) (*InfoRes, error) { out := new(InfoRes) - err := c.cc.Invoke(ctx, Server_Info_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, "/proto.Server/Info", in, out, opts...) if err != nil { return nil, err } @@ -84,7 +80,7 @@ func _Server_Info_Handler(srv interface{}, ctx context.Context, dec func(interfa } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: Server_Info_FullMethodName, + FullMethod: "/proto.Server/Info", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ServerServer).Info(ctx, req.(*InfoReq)) diff --git a/proto/proto/users.pb.go b/proto/proto/users.pb.go index f1549ed8..b493a1f0 100644 --- a/proto/proto/users.pb.go +++ b/proto/proto/users.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.32.0 -// protoc v4.24.4 +// protoc-gen-go v1.28.0 +// protoc v3.21.9 // source: users.proto package proto diff --git a/proto/proto/users_grpc.pb.go b/proto/proto/users_grpc.pb.go index 76a9410a..04b7071d 100644 --- a/proto/proto/users_grpc.pb.go +++ b/proto/proto/users_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.3.0 -// - protoc v4.24.4 +// - protoc-gen-go-grpc v1.2.0 +// - protoc v3.21.9 // source: users.proto package proto @@ -19,11 +19,6 @@ import ( // Requires gRPC-Go v1.32.0 or later. const _ = grpc.SupportPackageIsVersion7 -const ( - Users_ListUsers_FullMethodName = "/proto.Users/ListUsers" - Users_DeleteUser_FullMethodName = "/proto.Users/DeleteUser" -) - // UsersClient is the client API for Users service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. @@ -43,7 +38,7 @@ func NewUsersClient(cc grpc.ClientConnInterface) UsersClient { func (c *usersClient) ListUsers(ctx context.Context, in *ListUsersReq, opts ...grpc.CallOption) (*ListUsersRes, error) { out := new(ListUsersRes) - err := c.cc.Invoke(ctx, Users_ListUsers_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, "/proto.Users/ListUsers", in, out, opts...) if err != nil { return nil, err } @@ -52,7 +47,7 @@ func (c *usersClient) ListUsers(ctx context.Context, in *ListUsersReq, opts ...g func (c *usersClient) DeleteUser(ctx context.Context, in *DeleteUserReq, opts ...grpc.CallOption) (*emptypb.Empty, error) { out := new(emptypb.Empty) - err := c.cc.Invoke(ctx, Users_DeleteUser_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, "/proto.Users/DeleteUser", in, out, opts...) if err != nil { return nil, err } @@ -102,7 +97,7 @@ func _Users_ListUsers_Handler(srv interface{}, ctx context.Context, dec func(int } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: Users_ListUsers_FullMethodName, + FullMethod: "/proto.Users/ListUsers", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(UsersServer).ListUsers(ctx, req.(*ListUsersReq)) @@ -120,7 +115,7 @@ func _Users_DeleteUser_Handler(srv interface{}, ctx context.Context, dec func(in } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: Users_DeleteUser_FullMethodName, + FullMethod: "/proto.Users/DeleteUser", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(UsersServer).DeleteUser(ctx, req.(*DeleteUserReq)) diff --git a/website/package.json b/website/package.json index cafc5f42..ac8635c3 100644 --- a/website/package.json +++ b/website/package.json @@ -2,7 +2,7 @@ "name": "wg-access-server-website", "scripts": { "codegen": "node_modules/.bin/grpc-ts-web -o src/sdk ../proto/*.proto", - "start": "vite --port 3000", + "start": "vite", "build": "tsc && vite build", "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0", "prettier": "prettier ./src/**/*.{ts,tsx} --write" @@ -50,6 +50,7 @@ "react": "^18.2.0", "react-dom": "^18.2.0" }, + "proxy": "http://localhost:8000/api", "browserslist": { "production": [ ">0.2%", diff --git a/website/src/sdk/buildinfo_pb.ts b/website/src/sdk/buildinfo_pb.ts index 9adbf45e..edc38d56 100644 --- a/website/src/sdk/buildinfo_pb.ts +++ b/website/src/sdk/buildinfo_pb.ts @@ -5,108 +5,98 @@ import * as jspb from 'google-protobuf'; import * as grpcWeb from 'grpc-web'; - - - - - export declare namespace BuildInfo { - export type AsObject = { - version: string, - commit: string, - } + export type AsObject = { + version: string; + commit: string; + }; } export class BuildInfo extends jspb.Message { - - private static repeatedFields_ = [ - - ]; - - constructor(data?: jspb.Message.MessageArray) { - super(); - jspb.Message.initialize(this, data || [], 0, -1, BuildInfo.repeatedFields_, null); - } - - - getVersion(): string {return jspb.Message.getFieldWithDefault(this, 1, ""); - } - - setVersion(value: string): void { - (jspb.Message as any).setProto3StringField(this, 1, value); - } - - getCommit(): string {return jspb.Message.getFieldWithDefault(this, 2, ""); - } - - setCommit(value: string): void { - (jspb.Message as any).setProto3StringField(this, 2, value); - } - - serializeBinary(): Uint8Array { - const writer = new jspb.BinaryWriter(); - BuildInfo.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); - } - - toObject(): BuildInfo.AsObject { - let f: any; - return { - version: this.getVersion(), - commit: this.getCommit(), - }; - } - - static serializeBinaryToWriter(message: BuildInfo, writer: jspb.BinaryWriter): void { - const field1 = message.getVersion(); - if (field1.length > 0) { - writer.writeString(1, field1); - } - const field2 = message.getCommit(); - if (field2.length > 0) { - writer.writeString(2, field2); - } - } - - static deserializeBinary(bytes: Uint8Array): BuildInfo { - var reader = new jspb.BinaryReader(bytes); - var message = new BuildInfo(); - return BuildInfo.deserializeBinaryFromReader(message, reader); - } - - static deserializeBinaryFromReader(message: BuildInfo, reader: jspb.BinaryReader): BuildInfo { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - const field = reader.getFieldNumber(); - switch (field) { - case 1: - const field1 = reader.readString() - message.setVersion(field1); - break; - case 2: - const field2 = reader.readString() - message.setCommit(field2); - break; - default: - reader.skipField(); - break; - } - } - return message; - } - + private static repeatedFields_ = []; + + constructor(data?: jspb.Message.MessageArray) { + super(); + jspb.Message.initialize(this, data || [], 0, -1, BuildInfo.repeatedFields_, null); + } + + getVersion(): string { + return jspb.Message.getFieldWithDefault(this, 1, ''); + } + + setVersion(value: string): void { + (jspb.Message as any).setProto3StringField(this, 1, value); + } + + getCommit(): string { + return jspb.Message.getFieldWithDefault(this, 2, ''); + } + + setCommit(value: string): void { + (jspb.Message as any).setProto3StringField(this, 2, value); + } + + serializeBinary(): Uint8Array { + const writer = new jspb.BinaryWriter(); + BuildInfo.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); + } + + toObject(): BuildInfo.AsObject { + let f: any; + return { + version: this.getVersion(), + commit: this.getCommit(), + }; + } + + static serializeBinaryToWriter(message: BuildInfo, writer: jspb.BinaryWriter): void { + const field1 = message.getVersion(); + if (field1.length > 0) { + writer.writeString(1, field1); + } + const field2 = message.getCommit(); + if (field2.length > 0) { + writer.writeString(2, field2); + } + } + + static deserializeBinary(bytes: Uint8Array): BuildInfo { + var reader = new jspb.BinaryReader(bytes); + var message = new BuildInfo(); + return BuildInfo.deserializeBinaryFromReader(message, reader); + } + + static deserializeBinaryFromReader(message: BuildInfo, reader: jspb.BinaryReader): BuildInfo { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + const field = reader.getFieldNumber(); + switch (field) { + case 1: + const field1 = reader.readString(); + message.setVersion(field1); + break; + case 2: + const field2 = reader.readString(); + message.setCommit(field2); + break; + default: + reader.skipField(); + break; + } + } + return message; + } } - function BuildInfoFromObject(obj: BuildInfo.AsObject | undefined): BuildInfo | undefined { - if (obj === undefined) { - return undefined; - } - const message = new BuildInfo(); - message.setVersion(obj.version); - message.setCommit(obj.commit); - return message; + if (obj === undefined) { + return undefined; + } + const message = new BuildInfo(); + message.setVersion(obj.version); + message.setCommit(obj.commit); + return message; } - diff --git a/website/src/sdk/devices_pb.ts b/website/src/sdk/devices_pb.ts index c1dd2ab1..fc378737 100644 --- a/website/src/sdk/devices_pb.ts +++ b/website/src/sdk/devices_pb.ts @@ -10,993 +10,964 @@ import * as googleProtobufTimestamp from 'google-protobuf/google/protobuf/timest import * as googleProtobufEmpty from 'google-protobuf/google/protobuf/empty_pb'; export class Devices { - - private client_ = new grpcWeb.GrpcWebClientBase({ - format: 'text', - }); - - private methodInfoAddDevice = new grpcWeb.MethodDescriptor( - "AddDevice", - null, - AddDeviceReq, - Device, - (req: AddDeviceReq) => req.serializeBinary(), - Device.deserializeBinary - ); - - private methodInfoListDevices = new grpcWeb.MethodDescriptor( - "ListDevices", - null, - ListDevicesReq, - ListDevicesRes, - (req: ListDevicesReq) => req.serializeBinary(), - ListDevicesRes.deserializeBinary - ); - - private methodInfoDeleteDevice = new grpcWeb.MethodDescriptor( - "DeleteDevice", - null, - DeleteDeviceReq, - googleProtobufEmpty.Empty, - (req: DeleteDeviceReq) => req.serializeBinary(), - googleProtobufEmpty.Empty.deserializeBinary - ); - - private methodInfoListAllDevices = new grpcWeb.MethodDescriptor( - "ListAllDevices", - null, - ListAllDevicesReq, - ListAllDevicesRes, - (req: ListAllDevicesReq) => req.serializeBinary(), - ListAllDevicesRes.deserializeBinary - ); - - constructor( - private hostname: string, - private defaultMetadata?: () => grpcWeb.Metadata, - ) { } - - addDevice(req: AddDeviceReq.AsObject, metadata?: grpcWeb.Metadata): Promise { - return new Promise((resolve, reject) => { - const message = AddDeviceReqFromObject(req); - this.client_.rpcCall( - this.hostname + '/proto.Devices/AddDevice', - message, - Object.assign({}, this.defaultMetadata ? this.defaultMetadata() : {}, metadata), - this.methodInfoAddDevice, - (err: grpcWeb.Error, res: Device) => { - if (err) { - reject(err); - } else { - resolve(res.toObject()); - } - }, - ); - }); - } - - listDevices(req: ListDevicesReq.AsObject, metadata?: grpcWeb.Metadata): Promise { - return new Promise((resolve, reject) => { - const message = ListDevicesReqFromObject(req); - this.client_.rpcCall( - this.hostname + '/proto.Devices/ListDevices', - message, - Object.assign({}, this.defaultMetadata ? this.defaultMetadata() : {}, metadata), - this.methodInfoListDevices, - (err: grpcWeb.Error, res: ListDevicesRes) => { - if (err) { - reject(err); - } else { - resolve(res.toObject()); - } - }, - ); - }); - } - - deleteDevice(req: DeleteDeviceReq.AsObject, metadata?: grpcWeb.Metadata): Promise { - return new Promise((resolve, reject) => { - const message = DeleteDeviceReqFromObject(req); - this.client_.rpcCall( - this.hostname + '/proto.Devices/DeleteDevice', - message, - Object.assign({}, this.defaultMetadata ? this.defaultMetadata() : {}, metadata), - this.methodInfoDeleteDevice, - (err: grpcWeb.Error, res: googleProtobufEmpty.Empty) => { - if (err) { - reject(err); - } else { - resolve(res.toObject()); - } - }, - ); - }); - } - - listAllDevices(req: ListAllDevicesReq.AsObject, metadata?: grpcWeb.Metadata): Promise { - return new Promise((resolve, reject) => { - const message = ListAllDevicesReqFromObject(req); - this.client_.rpcCall( - this.hostname + '/proto.Devices/ListAllDevices', - message, - Object.assign({}, this.defaultMetadata ? this.defaultMetadata() : {}, metadata), - this.methodInfoListAllDevices, - (err: grpcWeb.Error, res: ListAllDevicesRes) => { - if (err) { - reject(err); - } else { - resolve(res.toObject()); - } - }, - ); - }); - } - + private client_ = new grpcWeb.GrpcWebClientBase({ + format: 'text', + }); + + private methodInfoAddDevice = new grpcWeb.MethodDescriptor( + 'AddDevice', + null, + AddDeviceReq, + Device, + (req: AddDeviceReq) => req.serializeBinary(), + Device.deserializeBinary, + ); + + private methodInfoListDevices = new grpcWeb.MethodDescriptor( + 'ListDevices', + null, + ListDevicesReq, + ListDevicesRes, + (req: ListDevicesReq) => req.serializeBinary(), + ListDevicesRes.deserializeBinary, + ); + + private methodInfoDeleteDevice = new grpcWeb.MethodDescriptor( + 'DeleteDevice', + null, + DeleteDeviceReq, + googleProtobufEmpty.Empty, + (req: DeleteDeviceReq) => req.serializeBinary(), + googleProtobufEmpty.Empty.deserializeBinary, + ); + + private methodInfoListAllDevices = new grpcWeb.MethodDescriptor( + 'ListAllDevices', + null, + ListAllDevicesReq, + ListAllDevicesRes, + (req: ListAllDevicesReq) => req.serializeBinary(), + ListAllDevicesRes.deserializeBinary, + ); + + constructor( + private hostname: string, + private defaultMetadata?: () => grpcWeb.Metadata, + ) {} + + addDevice(req: AddDeviceReq.AsObject, metadata?: grpcWeb.Metadata): Promise { + return new Promise((resolve, reject) => { + const message = AddDeviceReqFromObject(req); + this.client_.rpcCall( + this.hostname + '/proto.Devices/AddDevice', + message, + Object.assign({}, this.defaultMetadata ? this.defaultMetadata() : {}, metadata), + this.methodInfoAddDevice, + (err: grpcWeb.Error, res: Device) => { + if (err) { + reject(err); + } else { + resolve(res.toObject()); + } + }, + ); + }); + } + + listDevices(req: ListDevicesReq.AsObject, metadata?: grpcWeb.Metadata): Promise { + return new Promise((resolve, reject) => { + const message = ListDevicesReqFromObject(req); + this.client_.rpcCall( + this.hostname + '/proto.Devices/ListDevices', + message, + Object.assign({}, this.defaultMetadata ? this.defaultMetadata() : {}, metadata), + this.methodInfoListDevices, + (err: grpcWeb.Error, res: ListDevicesRes) => { + if (err) { + reject(err); + } else { + resolve(res.toObject()); + } + }, + ); + }); + } + + deleteDevice( + req: DeleteDeviceReq.AsObject, + metadata?: grpcWeb.Metadata, + ): Promise { + return new Promise((resolve, reject) => { + const message = DeleteDeviceReqFromObject(req); + this.client_.rpcCall( + this.hostname + '/proto.Devices/DeleteDevice', + message, + Object.assign({}, this.defaultMetadata ? this.defaultMetadata() : {}, metadata), + this.methodInfoDeleteDevice, + (err: grpcWeb.Error, res: googleProtobufEmpty.Empty) => { + if (err) { + reject(err); + } else { + resolve(res.toObject()); + } + }, + ); + }); + } + + listAllDevices(req: ListAllDevicesReq.AsObject, metadata?: grpcWeb.Metadata): Promise { + return new Promise((resolve, reject) => { + const message = ListAllDevicesReqFromObject(req); + this.client_.rpcCall( + this.hostname + '/proto.Devices/ListAllDevices', + message, + Object.assign({}, this.defaultMetadata ? this.defaultMetadata() : {}, metadata), + this.methodInfoListAllDevices, + (err: grpcWeb.Error, res: ListAllDevicesRes) => { + if (err) { + reject(err); + } else { + resolve(res.toObject()); + } + }, + ); + }); + } } - - - export declare namespace Device { - export type AsObject = { - name: string, - owner: string, - publicKey: string, - address: string, - createdAt?: googleProtobufTimestamp.Timestamp.AsObject, - connected: boolean, - lastHandshakeTime?: googleProtobufTimestamp.Timestamp.AsObject, - receiveBytes: number, - transmitBytes: number, - endpoint: string, - ownerName: string, - ownerEmail: string, - ownerProvider: string, - presharedKey: string, - } + export type AsObject = { + name: string; + owner: string; + publicKey: string; + address: string; + createdAt?: googleProtobufTimestamp.Timestamp.AsObject; + connected: boolean; + lastHandshakeTime?: googleProtobufTimestamp.Timestamp.AsObject; + receiveBytes: number; + transmitBytes: number; + endpoint: string; + ownerName: string; + ownerEmail: string; + ownerProvider: string; + presharedKey: string; + }; } export class Device extends jspb.Message { + private static repeatedFields_ = []; - private static repeatedFields_ = [ - - ]; - - constructor(data?: jspb.Message.MessageArray) { - super(); - jspb.Message.initialize(this, data || [], 0, -1, Device.repeatedFields_, null); - } - + constructor(data?: jspb.Message.MessageArray) { + super(); + jspb.Message.initialize(this, data || [], 0, -1, Device.repeatedFields_, null); + } - getName(): string {return jspb.Message.getFieldWithDefault(this, 1, ""); - } + getName(): string { + return jspb.Message.getFieldWithDefault(this, 1, ''); + } - setName(value: string): void { - (jspb.Message as any).setProto3StringField(this, 1, value); - } + setName(value: string): void { + (jspb.Message as any).setProto3StringField(this, 1, value); + } - getOwner(): string {return jspb.Message.getFieldWithDefault(this, 2, ""); - } + getOwner(): string { + return jspb.Message.getFieldWithDefault(this, 2, ''); + } - setOwner(value: string): void { - (jspb.Message as any).setProto3StringField(this, 2, value); - } + setOwner(value: string): void { + (jspb.Message as any).setProto3StringField(this, 2, value); + } - getPublicKey(): string {return jspb.Message.getFieldWithDefault(this, 3, ""); - } - - setPublicKey(value: string): void { - (jspb.Message as any).setProto3StringField(this, 3, value); - } - - getAddress(): string {return jspb.Message.getFieldWithDefault(this, 4, ""); - } - - setAddress(value: string): void { - (jspb.Message as any).setProto3StringField(this, 4, value); - } - - getCreatedAt(): googleProtobufTimestamp.Timestamp { - return jspb.Message.getWrapperField(this, googleProtobufTimestamp.Timestamp, 5); - } - - setCreatedAt(value?: googleProtobufTimestamp.Timestamp): void { - (jspb.Message as any).setWrapperField(this, 5, value); - } - - getConnected(): boolean {return jspb.Message.getFieldWithDefault(this, 6, false); - } - - setConnected(value: boolean): void { - (jspb.Message as any).setProto3BooleanField(this, 6, value); - } - - getLastHandshakeTime(): googleProtobufTimestamp.Timestamp { - return jspb.Message.getWrapperField(this, googleProtobufTimestamp.Timestamp, 7); - } - - setLastHandshakeTime(value?: googleProtobufTimestamp.Timestamp): void { - (jspb.Message as any).setWrapperField(this, 7, value); - } - - getReceiveBytes(): number {return jspb.Message.getFieldWithDefault(this, 8, 0); - } - - setReceiveBytes(value: number): void { - (jspb.Message as any).setProto3IntField(this, 8, value); - } - - getTransmitBytes(): number {return jspb.Message.getFieldWithDefault(this, 9, 0); - } - - setTransmitBytes(value: number): void { - (jspb.Message as any).setProto3IntField(this, 9, value); - } - - getEndpoint(): string {return jspb.Message.getFieldWithDefault(this, 10, ""); - } - - setEndpoint(value: string): void { - (jspb.Message as any).setProto3StringField(this, 10, value); - } - - getOwnerName(): string {return jspb.Message.getFieldWithDefault(this, 11, ""); - } - - setOwnerName(value: string): void { - (jspb.Message as any).setProto3StringField(this, 11, value); - } - - getOwnerEmail(): string {return jspb.Message.getFieldWithDefault(this, 12, ""); - } - - setOwnerEmail(value: string): void { - (jspb.Message as any).setProto3StringField(this, 12, value); - } - - getOwnerProvider(): string {return jspb.Message.getFieldWithDefault(this, 13, ""); - } - - setOwnerProvider(value: string): void { - (jspb.Message as any).setProto3StringField(this, 13, value); - } - - getPresharedKey(): string {return jspb.Message.getFieldWithDefault(this, 14, ""); - } - - setPresharedKey(value: string): void { - (jspb.Message as any).setProto3StringField(this, 14, value); - } - - serializeBinary(): Uint8Array { - const writer = new jspb.BinaryWriter(); - Device.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); - } - - toObject(): Device.AsObject { - let f: any; - return { - name: this.getName(), - owner: this.getOwner(), - publicKey: this.getPublicKey(), - address: this.getAddress(), - createdAt: (f = this.getCreatedAt()) && f.toObject(), - connected: this.getConnected(), - lastHandshakeTime: (f = this.getLastHandshakeTime()) && f.toObject(), - receiveBytes: this.getReceiveBytes(), - transmitBytes: this.getTransmitBytes(), - endpoint: this.getEndpoint(), - ownerName: this.getOwnerName(), - ownerEmail: this.getOwnerEmail(), - ownerProvider: this.getOwnerProvider(), - presharedKey: this.getPresharedKey(), - }; - } - - static serializeBinaryToWriter(message: Device, writer: jspb.BinaryWriter): void { - const field1 = message.getName(); - if (field1.length > 0) { - writer.writeString(1, field1); - } - const field2 = message.getOwner(); - if (field2.length > 0) { - writer.writeString(2, field2); - } - const field3 = message.getPublicKey(); - if (field3.length > 0) { - writer.writeString(3, field3); - } - const field4 = message.getAddress(); - if (field4.length > 0) { - writer.writeString(4, field4); - } - const field5 = message.getCreatedAt(); - if (field5 != null) { - writer.writeMessage(5, field5, googleProtobufTimestamp.Timestamp.serializeBinaryToWriter); - } - const field6 = message.getConnected(); - if (field6 != false) { - writer.writeBool(6, field6); - } - const field7 = message.getLastHandshakeTime(); - if (field7 != null) { - writer.writeMessage(7, field7, googleProtobufTimestamp.Timestamp.serializeBinaryToWriter); - } - const field8 = message.getReceiveBytes(); - if (field8 != 0) { - writer.writeInt64(8, field8); - } - const field9 = message.getTransmitBytes(); - if (field9 != 0) { - writer.writeInt64(9, field9); - } - const field10 = message.getEndpoint(); - if (field10.length > 0) { - writer.writeString(10, field10); - } - const field11 = message.getOwnerName(); - if (field11.length > 0) { - writer.writeString(11, field11); - } - const field12 = message.getOwnerEmail(); - if (field12.length > 0) { - writer.writeString(12, field12); - } - const field13 = message.getOwnerProvider(); - if (field13.length > 0) { - writer.writeString(13, field13); - } - const field14 = message.getPresharedKey(); - if (field14.length > 0) { - writer.writeString(14, field14); - } - } - - static deserializeBinary(bytes: Uint8Array): Device { - var reader = new jspb.BinaryReader(bytes); - var message = new Device(); - return Device.deserializeBinaryFromReader(message, reader); - } - - static deserializeBinaryFromReader(message: Device, reader: jspb.BinaryReader): Device { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - const field = reader.getFieldNumber(); - switch (field) { - case 1: - const field1 = reader.readString() - message.setName(field1); - break; - case 2: - const field2 = reader.readString() - message.setOwner(field2); - break; - case 3: - const field3 = reader.readString() - message.setPublicKey(field3); - break; - case 4: - const field4 = reader.readString() - message.setAddress(field4); - break; - case 5: - const field5 = new googleProtobufTimestamp.Timestamp(); - reader.readMessage(field5, googleProtobufTimestamp.Timestamp.deserializeBinaryFromReader); - message.setCreatedAt(field5); - break; - case 6: - const field6 = reader.readBool() - message.setConnected(field6); - break; - case 7: - const field7 = new googleProtobufTimestamp.Timestamp(); - reader.readMessage(field7, googleProtobufTimestamp.Timestamp.deserializeBinaryFromReader); - message.setLastHandshakeTime(field7); - break; - case 8: - const field8 = reader.readInt64() - message.setReceiveBytes(field8); - break; - case 9: - const field9 = reader.readInt64() - message.setTransmitBytes(field9); - break; - case 10: - const field10 = reader.readString() - message.setEndpoint(field10); - break; - case 11: - const field11 = reader.readString() - message.setOwnerName(field11); - break; - case 12: - const field12 = reader.readString() - message.setOwnerEmail(field12); - break; - case 13: - const field13 = reader.readString() - message.setOwnerProvider(field13); - break; - case 14: - const field14 = reader.readString() - message.setPresharedKey(field14); - break; - default: - reader.skipField(); - break; - } - } - return message; - } + getPublicKey(): string { + return jspb.Message.getFieldWithDefault(this, 3, ''); + } + setPublicKey(value: string): void { + (jspb.Message as any).setProto3StringField(this, 3, value); + } + + getAddress(): string { + return jspb.Message.getFieldWithDefault(this, 4, ''); + } + + setAddress(value: string): void { + (jspb.Message as any).setProto3StringField(this, 4, value); + } + + getCreatedAt(): googleProtobufTimestamp.Timestamp { + return jspb.Message.getWrapperField(this, googleProtobufTimestamp.Timestamp, 5); + } + + setCreatedAt(value?: googleProtobufTimestamp.Timestamp): void { + (jspb.Message as any).setWrapperField(this, 5, value); + } + + getConnected(): boolean { + return jspb.Message.getFieldWithDefault(this, 6, false); + } + + setConnected(value: boolean): void { + (jspb.Message as any).setProto3BooleanField(this, 6, value); + } + + getLastHandshakeTime(): googleProtobufTimestamp.Timestamp { + return jspb.Message.getWrapperField(this, googleProtobufTimestamp.Timestamp, 7); + } + + setLastHandshakeTime(value?: googleProtobufTimestamp.Timestamp): void { + (jspb.Message as any).setWrapperField(this, 7, value); + } + + getReceiveBytes(): number { + return jspb.Message.getFieldWithDefault(this, 8, 0); + } + + setReceiveBytes(value: number): void { + (jspb.Message as any).setProto3IntField(this, 8, value); + } + + getTransmitBytes(): number { + return jspb.Message.getFieldWithDefault(this, 9, 0); + } + + setTransmitBytes(value: number): void { + (jspb.Message as any).setProto3IntField(this, 9, value); + } + + getEndpoint(): string { + return jspb.Message.getFieldWithDefault(this, 10, ''); + } + + setEndpoint(value: string): void { + (jspb.Message as any).setProto3StringField(this, 10, value); + } + + getOwnerName(): string { + return jspb.Message.getFieldWithDefault(this, 11, ''); + } + + setOwnerName(value: string): void { + (jspb.Message as any).setProto3StringField(this, 11, value); + } + + getOwnerEmail(): string { + return jspb.Message.getFieldWithDefault(this, 12, ''); + } + + setOwnerEmail(value: string): void { + (jspb.Message as any).setProto3StringField(this, 12, value); + } + + getOwnerProvider(): string { + return jspb.Message.getFieldWithDefault(this, 13, ''); + } + + setOwnerProvider(value: string): void { + (jspb.Message as any).setProto3StringField(this, 13, value); + } + + getPresharedKey(): string { + return jspb.Message.getFieldWithDefault(this, 14, ''); + } + + setPresharedKey(value: string): void { + (jspb.Message as any).setProto3StringField(this, 14, value); + } + + serializeBinary(): Uint8Array { + const writer = new jspb.BinaryWriter(); + Device.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); + } + + toObject(): Device.AsObject { + let f: any; + return { + name: this.getName(), + owner: this.getOwner(), + publicKey: this.getPublicKey(), + address: this.getAddress(), + createdAt: (f = this.getCreatedAt()) && f.toObject(), + connected: this.getConnected(), + lastHandshakeTime: (f = this.getLastHandshakeTime()) && f.toObject(), + receiveBytes: this.getReceiveBytes(), + transmitBytes: this.getTransmitBytes(), + endpoint: this.getEndpoint(), + ownerName: this.getOwnerName(), + ownerEmail: this.getOwnerEmail(), + ownerProvider: this.getOwnerProvider(), + presharedKey: this.getPresharedKey(), + }; + } + + static serializeBinaryToWriter(message: Device, writer: jspb.BinaryWriter): void { + const field1 = message.getName(); + if (field1.length > 0) { + writer.writeString(1, field1); + } + const field2 = message.getOwner(); + if (field2.length > 0) { + writer.writeString(2, field2); + } + const field3 = message.getPublicKey(); + if (field3.length > 0) { + writer.writeString(3, field3); + } + const field4 = message.getAddress(); + if (field4.length > 0) { + writer.writeString(4, field4); + } + const field5 = message.getCreatedAt(); + if (field5 != null) { + writer.writeMessage(5, field5, googleProtobufTimestamp.Timestamp.serializeBinaryToWriter); + } + const field6 = message.getConnected(); + if (field6 != false) { + writer.writeBool(6, field6); + } + const field7 = message.getLastHandshakeTime(); + if (field7 != null) { + writer.writeMessage(7, field7, googleProtobufTimestamp.Timestamp.serializeBinaryToWriter); + } + const field8 = message.getReceiveBytes(); + if (field8 != 0) { + writer.writeInt64(8, field8); + } + const field9 = message.getTransmitBytes(); + if (field9 != 0) { + writer.writeInt64(9, field9); + } + const field10 = message.getEndpoint(); + if (field10.length > 0) { + writer.writeString(10, field10); + } + const field11 = message.getOwnerName(); + if (field11.length > 0) { + writer.writeString(11, field11); + } + const field12 = message.getOwnerEmail(); + if (field12.length > 0) { + writer.writeString(12, field12); + } + const field13 = message.getOwnerProvider(); + if (field13.length > 0) { + writer.writeString(13, field13); + } + const field14 = message.getPresharedKey(); + if (field14.length > 0) { + writer.writeString(14, field14); + } + } + + static deserializeBinary(bytes: Uint8Array): Device { + var reader = new jspb.BinaryReader(bytes); + var message = new Device(); + return Device.deserializeBinaryFromReader(message, reader); + } + + static deserializeBinaryFromReader(message: Device, reader: jspb.BinaryReader): Device { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + const field = reader.getFieldNumber(); + switch (field) { + case 1: + const field1 = reader.readString(); + message.setName(field1); + break; + case 2: + const field2 = reader.readString(); + message.setOwner(field2); + break; + case 3: + const field3 = reader.readString(); + message.setPublicKey(field3); + break; + case 4: + const field4 = reader.readString(); + message.setAddress(field4); + break; + case 5: + const field5 = new googleProtobufTimestamp.Timestamp(); + reader.readMessage(field5, googleProtobufTimestamp.Timestamp.deserializeBinaryFromReader); + message.setCreatedAt(field5); + break; + case 6: + const field6 = reader.readBool(); + message.setConnected(field6); + break; + case 7: + const field7 = new googleProtobufTimestamp.Timestamp(); + reader.readMessage(field7, googleProtobufTimestamp.Timestamp.deserializeBinaryFromReader); + message.setLastHandshakeTime(field7); + break; + case 8: + const field8 = reader.readInt64(); + message.setReceiveBytes(field8); + break; + case 9: + const field9 = reader.readInt64(); + message.setTransmitBytes(field9); + break; + case 10: + const field10 = reader.readString(); + message.setEndpoint(field10); + break; + case 11: + const field11 = reader.readString(); + message.setOwnerName(field11); + break; + case 12: + const field12 = reader.readString(); + message.setOwnerEmail(field12); + break; + case 13: + const field13 = reader.readString(); + message.setOwnerProvider(field13); + break; + case 14: + const field14 = reader.readString(); + message.setPresharedKey(field14); + break; + default: + reader.skipField(); + break; + } + } + return message; + } } export declare namespace AddDeviceReq { - export type AsObject = { - name: string, - publicKey: string, - presharedKey: string, - } + export type AsObject = { + name: string; + publicKey: string; + presharedKey: string; + }; } export class AddDeviceReq extends jspb.Message { - - private static repeatedFields_ = [ - - ]; - - constructor(data?: jspb.Message.MessageArray) { - super(); - jspb.Message.initialize(this, data || [], 0, -1, AddDeviceReq.repeatedFields_, null); - } - - - getName(): string {return jspb.Message.getFieldWithDefault(this, 1, ""); - } - - setName(value: string): void { - (jspb.Message as any).setProto3StringField(this, 1, value); - } - - getPublicKey(): string {return jspb.Message.getFieldWithDefault(this, 2, ""); - } - - setPublicKey(value: string): void { - (jspb.Message as any).setProto3StringField(this, 2, value); - } - - getPresharedKey(): string {return jspb.Message.getFieldWithDefault(this, 3, ""); - } - - setPresharedKey(value: string): void { - (jspb.Message as any).setProto3StringField(this, 3, value); - } - - serializeBinary(): Uint8Array { - const writer = new jspb.BinaryWriter(); - AddDeviceReq.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); - } - - toObject(): AddDeviceReq.AsObject { - let f: any; - return { - name: this.getName(), - publicKey: this.getPublicKey(), - presharedKey: this.getPresharedKey(), - }; - } - - static serializeBinaryToWriter(message: AddDeviceReq, writer: jspb.BinaryWriter): void { - const field1 = message.getName(); - if (field1.length > 0) { - writer.writeString(1, field1); - } - const field2 = message.getPublicKey(); - if (field2.length > 0) { - writer.writeString(2, field2); - } - const field3 = message.getPresharedKey(); - if (field3.length > 0) { - writer.writeString(3, field3); - } - } - - static deserializeBinary(bytes: Uint8Array): AddDeviceReq { - var reader = new jspb.BinaryReader(bytes); - var message = new AddDeviceReq(); - return AddDeviceReq.deserializeBinaryFromReader(message, reader); - } - - static deserializeBinaryFromReader(message: AddDeviceReq, reader: jspb.BinaryReader): AddDeviceReq { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - const field = reader.getFieldNumber(); - switch (field) { - case 1: - const field1 = reader.readString() - message.setName(field1); - break; - case 2: - const field2 = reader.readString() - message.setPublicKey(field2); - break; - case 3: - const field3 = reader.readString() - message.setPresharedKey(field3); - break; - default: - reader.skipField(); - break; - } - } - return message; - } - + private static repeatedFields_ = []; + + constructor(data?: jspb.Message.MessageArray) { + super(); + jspb.Message.initialize(this, data || [], 0, -1, AddDeviceReq.repeatedFields_, null); + } + + getName(): string { + return jspb.Message.getFieldWithDefault(this, 1, ''); + } + + setName(value: string): void { + (jspb.Message as any).setProto3StringField(this, 1, value); + } + + getPublicKey(): string { + return jspb.Message.getFieldWithDefault(this, 2, ''); + } + + setPublicKey(value: string): void { + (jspb.Message as any).setProto3StringField(this, 2, value); + } + + getPresharedKey(): string { + return jspb.Message.getFieldWithDefault(this, 3, ''); + } + + setPresharedKey(value: string): void { + (jspb.Message as any).setProto3StringField(this, 3, value); + } + + serializeBinary(): Uint8Array { + const writer = new jspb.BinaryWriter(); + AddDeviceReq.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); + } + + toObject(): AddDeviceReq.AsObject { + let f: any; + return { + name: this.getName(), + publicKey: this.getPublicKey(), + presharedKey: this.getPresharedKey(), + }; + } + + static serializeBinaryToWriter(message: AddDeviceReq, writer: jspb.BinaryWriter): void { + const field1 = message.getName(); + if (field1.length > 0) { + writer.writeString(1, field1); + } + const field2 = message.getPublicKey(); + if (field2.length > 0) { + writer.writeString(2, field2); + } + const field3 = message.getPresharedKey(); + if (field3.length > 0) { + writer.writeString(3, field3); + } + } + + static deserializeBinary(bytes: Uint8Array): AddDeviceReq { + var reader = new jspb.BinaryReader(bytes); + var message = new AddDeviceReq(); + return AddDeviceReq.deserializeBinaryFromReader(message, reader); + } + + static deserializeBinaryFromReader(message: AddDeviceReq, reader: jspb.BinaryReader): AddDeviceReq { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + const field = reader.getFieldNumber(); + switch (field) { + case 1: + const field1 = reader.readString(); + message.setName(field1); + break; + case 2: + const field2 = reader.readString(); + message.setPublicKey(field2); + break; + case 3: + const field3 = reader.readString(); + message.setPresharedKey(field3); + break; + default: + reader.skipField(); + break; + } + } + return message; + } } export declare namespace ListDevicesReq { - export type AsObject = { - } + export type AsObject = {}; } export class ListDevicesReq extends jspb.Message { - - private static repeatedFields_ = [ - - ]; - - constructor(data?: jspb.Message.MessageArray) { - super(); - jspb.Message.initialize(this, data || [], 0, -1, ListDevicesReq.repeatedFields_, null); - } - - - serializeBinary(): Uint8Array { - const writer = new jspb.BinaryWriter(); - ListDevicesReq.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); - } - - toObject(): ListDevicesReq.AsObject { - let f: any; - return { - }; - } - - static serializeBinaryToWriter(message: ListDevicesReq, writer: jspb.BinaryWriter): void { - } - - static deserializeBinary(bytes: Uint8Array): ListDevicesReq { - var reader = new jspb.BinaryReader(bytes); - var message = new ListDevicesReq(); - return ListDevicesReq.deserializeBinaryFromReader(message, reader); - } - - static deserializeBinaryFromReader(message: ListDevicesReq, reader: jspb.BinaryReader): ListDevicesReq { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - const field = reader.getFieldNumber(); - switch (field) { - default: - reader.skipField(); - break; - } - } - return message; - } - + private static repeatedFields_ = []; + + constructor(data?: jspb.Message.MessageArray) { + super(); + jspb.Message.initialize(this, data || [], 0, -1, ListDevicesReq.repeatedFields_, null); + } + + serializeBinary(): Uint8Array { + const writer = new jspb.BinaryWriter(); + ListDevicesReq.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); + } + + toObject(): ListDevicesReq.AsObject { + let f: any; + return {}; + } + + static serializeBinaryToWriter(message: ListDevicesReq, writer: jspb.BinaryWriter): void {} + + static deserializeBinary(bytes: Uint8Array): ListDevicesReq { + var reader = new jspb.BinaryReader(bytes); + var message = new ListDevicesReq(); + return ListDevicesReq.deserializeBinaryFromReader(message, reader); + } + + static deserializeBinaryFromReader(message: ListDevicesReq, reader: jspb.BinaryReader): ListDevicesReq { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + const field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return message; + } } export declare namespace ListDevicesRes { - export type AsObject = { - items: Array, - } + export type AsObject = { + items: Array; + }; } export class ListDevicesRes extends jspb.Message { - - private static repeatedFields_ = [ - 1, - ]; - - constructor(data?: jspb.Message.MessageArray) { - super(); - jspb.Message.initialize(this, data || [], 0, -1, ListDevicesRes.repeatedFields_, null); - } - - - getItems(): Array { - return jspb.Message.getRepeatedWrapperField(this, Device, 1); - } - - setItems(value: Array): void { - (jspb.Message as any).setRepeatedWrapperField(this, 1, value); - } - - addItems(value?: Device, index?: number): Device { - return jspb.Message.addToRepeatedWrapperField(this, 1, value, Device, index); - } - - serializeBinary(): Uint8Array { - const writer = new jspb.BinaryWriter(); - ListDevicesRes.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); - } - - toObject(): ListDevicesRes.AsObject { - let f: any; - return { - items: this.getItems().map((item) => item.toObject()), - }; - } - - static serializeBinaryToWriter(message: ListDevicesRes, writer: jspb.BinaryWriter): void { - const field1 = message.getItems(); - if (field1.length > 0) { - writer.writeRepeatedMessage(1, field1, Device.serializeBinaryToWriter); - } - } - - static deserializeBinary(bytes: Uint8Array): ListDevicesRes { - var reader = new jspb.BinaryReader(bytes); - var message = new ListDevicesRes(); - return ListDevicesRes.deserializeBinaryFromReader(message, reader); - } - - static deserializeBinaryFromReader(message: ListDevicesRes, reader: jspb.BinaryReader): ListDevicesRes { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - const field = reader.getFieldNumber(); - switch (field) { - case 1: - const field1 = new Device(); - reader.readMessage(field1, Device.deserializeBinaryFromReader); - message.addItems(field1); - break; - default: - reader.skipField(); - break; - } - } - return message; - } - + private static repeatedFields_ = [1]; + + constructor(data?: jspb.Message.MessageArray) { + super(); + jspb.Message.initialize(this, data || [], 0, -1, ListDevicesRes.repeatedFields_, null); + } + + getItems(): Array { + return jspb.Message.getRepeatedWrapperField(this, Device, 1); + } + + setItems(value: Array): void { + (jspb.Message as any).setRepeatedWrapperField(this, 1, value); + } + + addItems(value?: Device, index?: number): Device { + return jspb.Message.addToRepeatedWrapperField(this, 1, value, Device, index); + } + + serializeBinary(): Uint8Array { + const writer = new jspb.BinaryWriter(); + ListDevicesRes.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); + } + + toObject(): ListDevicesRes.AsObject { + let f: any; + return { + items: this.getItems().map((item) => item.toObject()), + }; + } + + static serializeBinaryToWriter(message: ListDevicesRes, writer: jspb.BinaryWriter): void { + const field1 = message.getItems(); + if (field1.length > 0) { + writer.writeRepeatedMessage(1, field1, Device.serializeBinaryToWriter); + } + } + + static deserializeBinary(bytes: Uint8Array): ListDevicesRes { + var reader = new jspb.BinaryReader(bytes); + var message = new ListDevicesRes(); + return ListDevicesRes.deserializeBinaryFromReader(message, reader); + } + + static deserializeBinaryFromReader(message: ListDevicesRes, reader: jspb.BinaryReader): ListDevicesRes { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + const field = reader.getFieldNumber(); + switch (field) { + case 1: + const field1 = new Device(); + reader.readMessage(field1, Device.deserializeBinaryFromReader); + message.addItems(field1); + break; + default: + reader.skipField(); + break; + } + } + return message; + } } export declare namespace DeleteDeviceReq { - export type AsObject = { - name: string, - owner?: googleProtobufWrappers.StringValue.AsObject, - } + export type AsObject = { + name: string; + owner?: googleProtobufWrappers.StringValue.AsObject; + }; } export class DeleteDeviceReq extends jspb.Message { - - private static repeatedFields_ = [ - - ]; - - constructor(data?: jspb.Message.MessageArray) { - super(); - jspb.Message.initialize(this, data || [], 0, -1, DeleteDeviceReq.repeatedFields_, null); - } - - - getName(): string {return jspb.Message.getFieldWithDefault(this, 1, ""); - } - - setName(value: string): void { - (jspb.Message as any).setProto3StringField(this, 1, value); - } - - getOwner(): googleProtobufWrappers.StringValue { - return jspb.Message.getWrapperField(this, googleProtobufWrappers.StringValue, 2); - } - - setOwner(value?: googleProtobufWrappers.StringValue): void { - (jspb.Message as any).setWrapperField(this, 2, value); - } - - serializeBinary(): Uint8Array { - const writer = new jspb.BinaryWriter(); - DeleteDeviceReq.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); - } - - toObject(): DeleteDeviceReq.AsObject { - let f: any; - return { - name: this.getName(), - owner: (f = this.getOwner()) && f.toObject(), - }; - } - - static serializeBinaryToWriter(message: DeleteDeviceReq, writer: jspb.BinaryWriter): void { - const field1 = message.getName(); - if (field1.length > 0) { - writer.writeString(1, field1); - } - const field2 = message.getOwner(); - if (field2 != null) { - writer.writeMessage(2, field2, googleProtobufWrappers.StringValue.serializeBinaryToWriter); - } - } - - static deserializeBinary(bytes: Uint8Array): DeleteDeviceReq { - var reader = new jspb.BinaryReader(bytes); - var message = new DeleteDeviceReq(); - return DeleteDeviceReq.deserializeBinaryFromReader(message, reader); - } - - static deserializeBinaryFromReader(message: DeleteDeviceReq, reader: jspb.BinaryReader): DeleteDeviceReq { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - const field = reader.getFieldNumber(); - switch (field) { - case 1: - const field1 = reader.readString() - message.setName(field1); - break; - case 2: - const field2 = new googleProtobufWrappers.StringValue(); - reader.readMessage(field2, googleProtobufWrappers.StringValue.deserializeBinaryFromReader); - message.setOwner(field2); - break; - default: - reader.skipField(); - break; - } - } - return message; - } - + private static repeatedFields_ = []; + + constructor(data?: jspb.Message.MessageArray) { + super(); + jspb.Message.initialize(this, data || [], 0, -1, DeleteDeviceReq.repeatedFields_, null); + } + + getName(): string { + return jspb.Message.getFieldWithDefault(this, 1, ''); + } + + setName(value: string): void { + (jspb.Message as any).setProto3StringField(this, 1, value); + } + + getOwner(): googleProtobufWrappers.StringValue { + return jspb.Message.getWrapperField(this, googleProtobufWrappers.StringValue, 2); + } + + setOwner(value?: googleProtobufWrappers.StringValue): void { + (jspb.Message as any).setWrapperField(this, 2, value); + } + + serializeBinary(): Uint8Array { + const writer = new jspb.BinaryWriter(); + DeleteDeviceReq.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); + } + + toObject(): DeleteDeviceReq.AsObject { + let f: any; + return { + name: this.getName(), + owner: (f = this.getOwner()) && f.toObject(), + }; + } + + static serializeBinaryToWriter(message: DeleteDeviceReq, writer: jspb.BinaryWriter): void { + const field1 = message.getName(); + if (field1.length > 0) { + writer.writeString(1, field1); + } + const field2 = message.getOwner(); + if (field2 != null) { + writer.writeMessage(2, field2, googleProtobufWrappers.StringValue.serializeBinaryToWriter); + } + } + + static deserializeBinary(bytes: Uint8Array): DeleteDeviceReq { + var reader = new jspb.BinaryReader(bytes); + var message = new DeleteDeviceReq(); + return DeleteDeviceReq.deserializeBinaryFromReader(message, reader); + } + + static deserializeBinaryFromReader(message: DeleteDeviceReq, reader: jspb.BinaryReader): DeleteDeviceReq { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + const field = reader.getFieldNumber(); + switch (field) { + case 1: + const field1 = reader.readString(); + message.setName(field1); + break; + case 2: + const field2 = new googleProtobufWrappers.StringValue(); + reader.readMessage(field2, googleProtobufWrappers.StringValue.deserializeBinaryFromReader); + message.setOwner(field2); + break; + default: + reader.skipField(); + break; + } + } + return message; + } } export declare namespace ListAllDevicesReq { - export type AsObject = { - } + export type AsObject = {}; } export class ListAllDevicesReq extends jspb.Message { - - private static repeatedFields_ = [ - - ]; - - constructor(data?: jspb.Message.MessageArray) { - super(); - jspb.Message.initialize(this, data || [], 0, -1, ListAllDevicesReq.repeatedFields_, null); - } - - - serializeBinary(): Uint8Array { - const writer = new jspb.BinaryWriter(); - ListAllDevicesReq.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); - } - - toObject(): ListAllDevicesReq.AsObject { - let f: any; - return { - }; - } - - static serializeBinaryToWriter(message: ListAllDevicesReq, writer: jspb.BinaryWriter): void { - } - - static deserializeBinary(bytes: Uint8Array): ListAllDevicesReq { - var reader = new jspb.BinaryReader(bytes); - var message = new ListAllDevicesReq(); - return ListAllDevicesReq.deserializeBinaryFromReader(message, reader); - } - - static deserializeBinaryFromReader(message: ListAllDevicesReq, reader: jspb.BinaryReader): ListAllDevicesReq { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - const field = reader.getFieldNumber(); - switch (field) { - default: - reader.skipField(); - break; - } - } - return message; - } - + private static repeatedFields_ = []; + + constructor(data?: jspb.Message.MessageArray) { + super(); + jspb.Message.initialize(this, data || [], 0, -1, ListAllDevicesReq.repeatedFields_, null); + } + + serializeBinary(): Uint8Array { + const writer = new jspb.BinaryWriter(); + ListAllDevicesReq.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); + } + + toObject(): ListAllDevicesReq.AsObject { + let f: any; + return {}; + } + + static serializeBinaryToWriter(message: ListAllDevicesReq, writer: jspb.BinaryWriter): void {} + + static deserializeBinary(bytes: Uint8Array): ListAllDevicesReq { + var reader = new jspb.BinaryReader(bytes); + var message = new ListAllDevicesReq(); + return ListAllDevicesReq.deserializeBinaryFromReader(message, reader); + } + + static deserializeBinaryFromReader(message: ListAllDevicesReq, reader: jspb.BinaryReader): ListAllDevicesReq { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + const field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return message; + } } export declare namespace ListAllDevicesRes { - export type AsObject = { - items: Array, - } + export type AsObject = { + items: Array; + }; } export class ListAllDevicesRes extends jspb.Message { - - private static repeatedFields_ = [ - 1, - ]; - - constructor(data?: jspb.Message.MessageArray) { - super(); - jspb.Message.initialize(this, data || [], 0, -1, ListAllDevicesRes.repeatedFields_, null); - } - - - getItems(): Array { - return jspb.Message.getRepeatedWrapperField(this, Device, 1); - } - - setItems(value: Array): void { - (jspb.Message as any).setRepeatedWrapperField(this, 1, value); - } - - addItems(value?: Device, index?: number): Device { - return jspb.Message.addToRepeatedWrapperField(this, 1, value, Device, index); - } - - serializeBinary(): Uint8Array { - const writer = new jspb.BinaryWriter(); - ListAllDevicesRes.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); - } - - toObject(): ListAllDevicesRes.AsObject { - let f: any; - return { - items: this.getItems().map((item) => item.toObject()), - }; - } - - static serializeBinaryToWriter(message: ListAllDevicesRes, writer: jspb.BinaryWriter): void { - const field1 = message.getItems(); - if (field1.length > 0) { - writer.writeRepeatedMessage(1, field1, Device.serializeBinaryToWriter); - } - } - - static deserializeBinary(bytes: Uint8Array): ListAllDevicesRes { - var reader = new jspb.BinaryReader(bytes); - var message = new ListAllDevicesRes(); - return ListAllDevicesRes.deserializeBinaryFromReader(message, reader); - } - - static deserializeBinaryFromReader(message: ListAllDevicesRes, reader: jspb.BinaryReader): ListAllDevicesRes { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - const field = reader.getFieldNumber(); - switch (field) { - case 1: - const field1 = new Device(); - reader.readMessage(field1, Device.deserializeBinaryFromReader); - message.addItems(field1); - break; - default: - reader.skipField(); - break; - } - } - return message; - } - + private static repeatedFields_ = [1]; + + constructor(data?: jspb.Message.MessageArray) { + super(); + jspb.Message.initialize(this, data || [], 0, -1, ListAllDevicesRes.repeatedFields_, null); + } + + getItems(): Array { + return jspb.Message.getRepeatedWrapperField(this, Device, 1); + } + + setItems(value: Array): void { + (jspb.Message as any).setRepeatedWrapperField(this, 1, value); + } + + addItems(value?: Device, index?: number): Device { + return jspb.Message.addToRepeatedWrapperField(this, 1, value, Device, index); + } + + serializeBinary(): Uint8Array { + const writer = new jspb.BinaryWriter(); + ListAllDevicesRes.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); + } + + toObject(): ListAllDevicesRes.AsObject { + let f: any; + return { + items: this.getItems().map((item) => item.toObject()), + }; + } + + static serializeBinaryToWriter(message: ListAllDevicesRes, writer: jspb.BinaryWriter): void { + const field1 = message.getItems(); + if (field1.length > 0) { + writer.writeRepeatedMessage(1, field1, Device.serializeBinaryToWriter); + } + } + + static deserializeBinary(bytes: Uint8Array): ListAllDevicesRes { + var reader = new jspb.BinaryReader(bytes); + var message = new ListAllDevicesRes(); + return ListAllDevicesRes.deserializeBinaryFromReader(message, reader); + } + + static deserializeBinaryFromReader(message: ListAllDevicesRes, reader: jspb.BinaryReader): ListAllDevicesRes { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + const field = reader.getFieldNumber(); + switch (field) { + case 1: + const field1 = new Device(); + reader.readMessage(field1, Device.deserializeBinaryFromReader); + message.addItems(field1); + break; + default: + reader.skipField(); + break; + } + } + return message; + } } - function DeviceFromObject(obj: Device.AsObject | undefined): Device | undefined { - if (obj === undefined) { - return undefined; - } - const message = new Device(); - message.setName(obj.name); - message.setOwner(obj.owner); - message.setPublicKey(obj.publicKey); - message.setAddress(obj.address); - message.setCreatedAt(TimestampFromObject(obj.createdAt)); - message.setConnected(obj.connected); - message.setLastHandshakeTime(TimestampFromObject(obj.lastHandshakeTime)); - message.setReceiveBytes(obj.receiveBytes); - message.setTransmitBytes(obj.transmitBytes); - message.setEndpoint(obj.endpoint); - message.setOwnerName(obj.ownerName); - message.setOwnerEmail(obj.ownerEmail); - message.setOwnerProvider(obj.ownerProvider); - message.setPresharedKey(obj.presharedKey); - return message; + if (obj === undefined) { + return undefined; + } + const message = new Device(); + message.setName(obj.name); + message.setOwner(obj.owner); + message.setPublicKey(obj.publicKey); + message.setAddress(obj.address); + message.setCreatedAt(TimestampFromObject(obj.createdAt)); + message.setConnected(obj.connected); + message.setLastHandshakeTime(TimestampFromObject(obj.lastHandshakeTime)); + message.setReceiveBytes(obj.receiveBytes); + message.setTransmitBytes(obj.transmitBytes); + message.setEndpoint(obj.endpoint); + message.setOwnerName(obj.ownerName); + message.setOwnerEmail(obj.ownerEmail); + message.setOwnerProvider(obj.ownerProvider); + message.setPresharedKey(obj.presharedKey); + return message; } -function TimestampFromObject(obj: googleProtobufTimestamp.Timestamp.AsObject | undefined): googleProtobufTimestamp.Timestamp | undefined { - if (obj === undefined) { - return undefined; - } - const message = new googleProtobufTimestamp.Timestamp(); - message.setSeconds(obj.seconds); - message.setNanos(obj.nanos); - return message; +function TimestampFromObject( + obj: googleProtobufTimestamp.Timestamp.AsObject | undefined, +): googleProtobufTimestamp.Timestamp | undefined { + if (obj === undefined) { + return undefined; + } + const message = new googleProtobufTimestamp.Timestamp(); + message.setSeconds(obj.seconds); + message.setNanos(obj.nanos); + return message; } function AddDeviceReqFromObject(obj: AddDeviceReq.AsObject | undefined): AddDeviceReq | undefined { - if (obj === undefined) { - return undefined; - } - const message = new AddDeviceReq(); - message.setName(obj.name); - message.setPublicKey(obj.publicKey); - message.setPresharedKey(obj.presharedKey); - return message; + if (obj === undefined) { + return undefined; + } + const message = new AddDeviceReq(); + message.setName(obj.name); + message.setPublicKey(obj.publicKey); + message.setPresharedKey(obj.presharedKey); + return message; } function ListDevicesReqFromObject(obj: ListDevicesReq.AsObject | undefined): ListDevicesReq | undefined { - if (obj === undefined) { - return undefined; - } - const message = new ListDevicesReq(); - return message; + if (obj === undefined) { + return undefined; + } + const message = new ListDevicesReq(); + return message; } function ListDevicesResFromObject(obj: ListDevicesRes.AsObject | undefined): ListDevicesRes | undefined { - if (obj === undefined) { - return undefined; - } - const message = new ListDevicesRes(); - (obj.items || []) - .map((item) => DeviceFromObject(item)) - .forEach((item) => message.addItems(item)); - return message; + if (obj === undefined) { + return undefined; + } + const message = new ListDevicesRes(); + (obj.items || []).map((item) => DeviceFromObject(item)).forEach((item) => message.addItems(item)); + return message; } function DeleteDeviceReqFromObject(obj: DeleteDeviceReq.AsObject | undefined): DeleteDeviceReq | undefined { - if (obj === undefined) { - return undefined; - } - const message = new DeleteDeviceReq(); - message.setName(obj.name); - message.setOwner(StringValueFromObject(obj.owner)); - return message; + if (obj === undefined) { + return undefined; + } + const message = new DeleteDeviceReq(); + message.setName(obj.name); + message.setOwner(StringValueFromObject(obj.owner)); + return message; } -function StringValueFromObject(obj: googleProtobufWrappers.StringValue.AsObject | undefined): googleProtobufWrappers.StringValue | undefined { - if (obj === undefined) { - return undefined; - } - const message = new googleProtobufWrappers.StringValue(); - message.setValue(obj.value); - return message; +function StringValueFromObject( + obj: googleProtobufWrappers.StringValue.AsObject | undefined, +): googleProtobufWrappers.StringValue | undefined { + if (obj === undefined) { + return undefined; + } + const message = new googleProtobufWrappers.StringValue(); + message.setValue(obj.value); + return message; } function ListAllDevicesReqFromObject(obj: ListAllDevicesReq.AsObject | undefined): ListAllDevicesReq | undefined { - if (obj === undefined) { - return undefined; - } - const message = new ListAllDevicesReq(); - return message; + if (obj === undefined) { + return undefined; + } + const message = new ListAllDevicesReq(); + return message; } function ListAllDevicesResFromObject(obj: ListAllDevicesRes.AsObject | undefined): ListAllDevicesRes | undefined { - if (obj === undefined) { - return undefined; - } - const message = new ListAllDevicesRes(); - (obj.items || []) - .map((item) => DeviceFromObject(item)) - .forEach((item) => message.addItems(item)); - return message; + if (obj === undefined) { + return undefined; + } + const message = new ListAllDevicesRes(); + (obj.items || []).map((item) => DeviceFromObject(item)).forEach((item) => message.addItems(item)); + return message; } function EmptyFromObject(obj: googleProtobufEmpty.Empty.AsObject | undefined): googleProtobufEmpty.Empty | undefined { - if (obj === undefined) { - return undefined; - } - const message = new googleProtobufEmpty.Empty(); - return message; + if (obj === undefined) { + return undefined; + } + const message = new googleProtobufEmpty.Empty(); + return message; } - diff --git a/website/src/sdk/server_pb.ts b/website/src/sdk/server_pb.ts index 35e67e49..84b1bbcc 100644 --- a/website/src/sdk/server_pb.ts +++ b/website/src/sdk/server_pb.ts @@ -10,513 +10,511 @@ import * as googleProtobufDuration from 'google-protobuf/google/protobuf/duratio import * as buildinfo from './buildinfo_pb'; export class Server { - - private client_ = new grpcWeb.GrpcWebClientBase({ - format: 'text', - }); - - private methodInfoInfo = new grpcWeb.MethodDescriptor( - "Info", - null, - InfoReq, - InfoRes, - (req: InfoReq) => req.serializeBinary(), - InfoRes.deserializeBinary - ); - - constructor( - private hostname: string, - private defaultMetadata?: () => grpcWeb.Metadata, - ) { } - - info(req: InfoReq.AsObject, metadata?: grpcWeb.Metadata): Promise { - return new Promise((resolve, reject) => { - const message = InfoReqFromObject(req); - this.client_.rpcCall( - this.hostname + '/proto.Server/Info', - message, - Object.assign({}, this.defaultMetadata ? this.defaultMetadata() : {}, metadata), - this.methodInfoInfo, - (err: grpcWeb.Error, res: InfoRes) => { - if (err) { - reject(err); - } else { - resolve(res.toObject()); - } - }, - ); - }); - } - + private client_ = new grpcWeb.GrpcWebClientBase({ + format: 'text', + }); + + private methodInfoInfo = new grpcWeb.MethodDescriptor( + 'Info', + null, + InfoReq, + InfoRes, + (req: InfoReq) => req.serializeBinary(), + InfoRes.deserializeBinary, + ); + + constructor( + private hostname: string, + private defaultMetadata?: () => grpcWeb.Metadata, + ) {} + + info(req: InfoReq.AsObject, metadata?: grpcWeb.Metadata): Promise { + return new Promise((resolve, reject) => { + const message = InfoReqFromObject(req); + this.client_.rpcCall( + this.hostname + '/proto.Server/Info', + message, + Object.assign({}, this.defaultMetadata ? this.defaultMetadata() : {}, metadata), + this.methodInfoInfo, + (err: grpcWeb.Error, res: InfoRes) => { + if (err) { + reject(err); + } else { + resolve(res.toObject()); + } + }, + ); + }); + } } - - - export declare namespace InfoReq { - export type AsObject = { - } + export type AsObject = {}; } export class InfoReq extends jspb.Message { - - private static repeatedFields_ = [ - - ]; - - constructor(data?: jspb.Message.MessageArray) { - super(); - jspb.Message.initialize(this, data || [], 0, -1, InfoReq.repeatedFields_, null); - } - - - serializeBinary(): Uint8Array { - const writer = new jspb.BinaryWriter(); - InfoReq.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); - } - - toObject(): InfoReq.AsObject { - let f: any; - return { - }; - } - - static serializeBinaryToWriter(message: InfoReq, writer: jspb.BinaryWriter): void { - } - - static deserializeBinary(bytes: Uint8Array): InfoReq { - var reader = new jspb.BinaryReader(bytes); - var message = new InfoReq(); - return InfoReq.deserializeBinaryFromReader(message, reader); - } - - static deserializeBinaryFromReader(message: InfoReq, reader: jspb.BinaryReader): InfoReq { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - const field = reader.getFieldNumber(); - switch (field) { - default: - reader.skipField(); - break; - } - } - return message; - } - + private static repeatedFields_ = []; + + constructor(data?: jspb.Message.MessageArray) { + super(); + jspb.Message.initialize(this, data || [], 0, -1, InfoReq.repeatedFields_, null); + } + + serializeBinary(): Uint8Array { + const writer = new jspb.BinaryWriter(); + InfoReq.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); + } + + toObject(): InfoReq.AsObject { + let f: any; + return {}; + } + + static serializeBinaryToWriter(message: InfoReq, writer: jspb.BinaryWriter): void {} + + static deserializeBinary(bytes: Uint8Array): InfoReq { + var reader = new jspb.BinaryReader(bytes); + var message = new InfoReq(); + return InfoReq.deserializeBinaryFromReader(message, reader); + } + + static deserializeBinaryFromReader(message: InfoReq, reader: jspb.BinaryReader): InfoReq { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + const field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return message; + } } export declare namespace InfoRes { - export type AsObject = { - publicKey: string, - host?: googleProtobufWrappers.StringValue.AsObject, - port: number, - hostVpnIp: string, - metadataEnabled: boolean, - isAdmin: boolean, - allowedIps: string, - dnsEnabled: boolean, - dnsAddress: string, - filename: string, - inactiveDeviceDeletionEnabled: boolean, - inactiveDeviceGracePeriod?: googleProtobufDuration.Duration.AsObject, - clientConfigDnsServers: string, - clientConfigDnsSearchDomain: string, - clientConfigMtu: number, - buildInfo?: buildinfo.BuildInfo.AsObject, - mtu: number, - } + export type AsObject = { + publicKey: string; + host?: googleProtobufWrappers.StringValue.AsObject; + port: number; + hostVpnIp: string; + metadataEnabled: boolean; + isAdmin: boolean; + allowedIps: string; + dnsEnabled: boolean; + dnsAddress: string; + filename: string; + inactiveDeviceDeletionEnabled: boolean; + inactiveDeviceGracePeriod?: googleProtobufDuration.Duration.AsObject; + clientConfigDnsServers: string; + clientConfigDnsSearchDomain: string; + clientConfigMtu: number; + buildInfo?: buildinfo.BuildInfo.AsObject; + mtu: number; + }; } export class InfoRes extends jspb.Message { + private static repeatedFields_ = []; - private static repeatedFields_ = [ - - ]; + constructor(data?: jspb.Message.MessageArray) { + super(); + jspb.Message.initialize(this, data || [], 0, -1, InfoRes.repeatedFields_, null); + } - constructor(data?: jspb.Message.MessageArray) { - super(); - jspb.Message.initialize(this, data || [], 0, -1, InfoRes.repeatedFields_, null); - } + getPublicKey(): string { + return jspb.Message.getFieldWithDefault(this, 1, ''); + } + setPublicKey(value: string): void { + (jspb.Message as any).setProto3StringField(this, 1, value); + } - getPublicKey(): string {return jspb.Message.getFieldWithDefault(this, 1, ""); - } + getHost(): googleProtobufWrappers.StringValue { + return jspb.Message.getWrapperField(this, googleProtobufWrappers.StringValue, 2); + } - setPublicKey(value: string): void { - (jspb.Message as any).setProto3StringField(this, 1, value); - } + setHost(value?: googleProtobufWrappers.StringValue): void { + (jspb.Message as any).setWrapperField(this, 2, value); + } - getHost(): googleProtobufWrappers.StringValue { - return jspb.Message.getWrapperField(this, googleProtobufWrappers.StringValue, 2); - } + getPort(): number { + return jspb.Message.getFieldWithDefault(this, 3, 0); + } - setHost(value?: googleProtobufWrappers.StringValue): void { - (jspb.Message as any).setWrapperField(this, 2, value); - } + setPort(value: number): void { + (jspb.Message as any).setProto3IntField(this, 3, value); + } - getPort(): number {return jspb.Message.getFieldWithDefault(this, 3, 0); - } + getHostVpnIp(): string { + return jspb.Message.getFieldWithDefault(this, 4, ''); + } - setPort(value: number): void { - (jspb.Message as any).setProto3IntField(this, 3, value); - } + setHostVpnIp(value: string): void { + (jspb.Message as any).setProto3StringField(this, 4, value); + } - getHostVpnIp(): string {return jspb.Message.getFieldWithDefault(this, 4, ""); - } + getMetadataEnabled(): boolean { + return jspb.Message.getFieldWithDefault(this, 5, false); + } - setHostVpnIp(value: string): void { - (jspb.Message as any).setProto3StringField(this, 4, value); - } + setMetadataEnabled(value: boolean): void { + (jspb.Message as any).setProto3BooleanField(this, 5, value); + } - getMetadataEnabled(): boolean {return jspb.Message.getFieldWithDefault(this, 5, false); - } - - setMetadataEnabled(value: boolean): void { - (jspb.Message as any).setProto3BooleanField(this, 5, value); - } - - getIsAdmin(): boolean {return jspb.Message.getFieldWithDefault(this, 6, false); - } - - setIsAdmin(value: boolean): void { - (jspb.Message as any).setProto3BooleanField(this, 6, value); - } - - getAllowedIps(): string {return jspb.Message.getFieldWithDefault(this, 7, ""); - } - - setAllowedIps(value: string): void { - (jspb.Message as any).setProto3StringField(this, 7, value); - } - - getDnsEnabled(): boolean {return jspb.Message.getFieldWithDefault(this, 8, false); - } - - setDnsEnabled(value: boolean): void { - (jspb.Message as any).setProto3BooleanField(this, 8, value); - } - - getDnsAddress(): string {return jspb.Message.getFieldWithDefault(this, 9, ""); - } - - setDnsAddress(value: string): void { - (jspb.Message as any).setProto3StringField(this, 9, value); - } - - getFilename(): string {return jspb.Message.getFieldWithDefault(this, 10, ""); - } - - setFilename(value: string): void { - (jspb.Message as any).setProto3StringField(this, 10, value); - } - - getInactiveDeviceDeletionEnabled(): boolean {return jspb.Message.getFieldWithDefault(this, 11, false); - } - - setInactiveDeviceDeletionEnabled(value: boolean): void { - (jspb.Message as any).setProto3BooleanField(this, 11, value); - } - - getInactiveDeviceGracePeriod(): googleProtobufDuration.Duration { - return jspb.Message.getWrapperField(this, googleProtobufDuration.Duration, 12); - } - - setInactiveDeviceGracePeriod(value?: googleProtobufDuration.Duration): void { - (jspb.Message as any).setWrapperField(this, 12, value); - } - - getClientConfigDnsServers(): string {return jspb.Message.getFieldWithDefault(this, 13, ""); - } - - setClientConfigDnsServers(value: string): void { - (jspb.Message as any).setProto3StringField(this, 13, value); - } - - getClientConfigDnsSearchDomain(): string {return jspb.Message.getFieldWithDefault(this, 14, ""); - } - - setClientConfigDnsSearchDomain(value: string): void { - (jspb.Message as any).setProto3StringField(this, 14, value); - } - - getClientConfigMtu(): number {return jspb.Message.getFieldWithDefault(this, 15, 0); - } - - setClientConfigMtu(value: number): void { - (jspb.Message as any).setProto3IntField(this, 15, value); - } - - getBuildInfo(): buildinfo.BuildInfo { - return jspb.Message.getWrapperField(this, buildinfo.BuildInfo, 16); - } - - setBuildInfo(value?: buildinfo.BuildInfo): void { - (jspb.Message as any).setWrapperField(this, 16, value); - } - - getMtu(): number {return jspb.Message.getFieldWithDefault(this, 17, 0); - } - - setMtu(value: number): void { - (jspb.Message as any).setProto3IntField(this, 17, value); - } - - serializeBinary(): Uint8Array { - const writer = new jspb.BinaryWriter(); - InfoRes.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); - } - - toObject(): InfoRes.AsObject { - let f: any; - return { - publicKey: this.getPublicKey(), - host: (f = this.getHost()) && f.toObject(), - port: this.getPort(), - hostVpnIp: this.getHostVpnIp(), - metadataEnabled: this.getMetadataEnabled(), - isAdmin: this.getIsAdmin(), - allowedIps: this.getAllowedIps(), - dnsEnabled: this.getDnsEnabled(), - dnsAddress: this.getDnsAddress(), - filename: this.getFilename(), - inactiveDeviceDeletionEnabled: this.getInactiveDeviceDeletionEnabled(), - inactiveDeviceGracePeriod: (f = this.getInactiveDeviceGracePeriod()) && f.toObject(), - clientConfigDnsServers: this.getClientConfigDnsServers(), - clientConfigDnsSearchDomain: this.getClientConfigDnsSearchDomain(), - clientConfigMtu: this.getClientConfigMtu(), - buildInfo: (f = this.getBuildInfo()) && f.toObject(), - mtu: this.getMtu(), - }; - } - - static serializeBinaryToWriter(message: InfoRes, writer: jspb.BinaryWriter): void { - const field1 = message.getPublicKey(); - if (field1.length > 0) { - writer.writeString(1, field1); - } - const field2 = message.getHost(); - if (field2 != null) { - writer.writeMessage(2, field2, googleProtobufWrappers.StringValue.serializeBinaryToWriter); - } - const field3 = message.getPort(); - if (field3 != 0) { - writer.writeInt32(3, field3); - } - const field4 = message.getHostVpnIp(); - if (field4.length > 0) { - writer.writeString(4, field4); - } - const field5 = message.getMetadataEnabled(); - if (field5 != false) { - writer.writeBool(5, field5); - } - const field6 = message.getIsAdmin(); - if (field6 != false) { - writer.writeBool(6, field6); - } - const field7 = message.getAllowedIps(); - if (field7.length > 0) { - writer.writeString(7, field7); - } - const field8 = message.getDnsEnabled(); - if (field8 != false) { - writer.writeBool(8, field8); - } - const field9 = message.getDnsAddress(); - if (field9.length > 0) { - writer.writeString(9, field9); - } - const field10 = message.getFilename(); - if (field10.length > 0) { - writer.writeString(10, field10); - } - const field11 = message.getInactiveDeviceDeletionEnabled(); - if (field11 != false) { - writer.writeBool(11, field11); - } - const field12 = message.getInactiveDeviceGracePeriod(); - if (field12 != null) { - writer.writeMessage(12, field12, googleProtobufDuration.Duration.serializeBinaryToWriter); - } - const field13 = message.getClientConfigDnsServers(); - if (field13.length > 0) { - writer.writeString(13, field13); - } - const field14 = message.getClientConfigDnsSearchDomain(); - if (field14.length > 0) { - writer.writeString(14, field14); - } - const field15 = message.getClientConfigMtu(); - if (field15 != 0) { - writer.writeInt32(15, field15); - } - const field16 = message.getBuildInfo(); - if (field16 != null) { - writer.writeMessage(16, field16, buildinfo.BuildInfo.serializeBinaryToWriter); - } - const field17 = message.getMtu(); - if (field17 != 0) { - writer.writeInt32(17, field17); - } - } - - static deserializeBinary(bytes: Uint8Array): InfoRes { - var reader = new jspb.BinaryReader(bytes); - var message = new InfoRes(); - return InfoRes.deserializeBinaryFromReader(message, reader); - } - - static deserializeBinaryFromReader(message: InfoRes, reader: jspb.BinaryReader): InfoRes { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - const field = reader.getFieldNumber(); - switch (field) { - case 1: - const field1 = reader.readString() - message.setPublicKey(field1); - break; - case 2: - const field2 = new googleProtobufWrappers.StringValue(); - reader.readMessage(field2, googleProtobufWrappers.StringValue.deserializeBinaryFromReader); - message.setHost(field2); - break; - case 3: - const field3 = reader.readInt32() - message.setPort(field3); - break; - case 4: - const field4 = reader.readString() - message.setHostVpnIp(field4); - break; - case 5: - const field5 = reader.readBool() - message.setMetadataEnabled(field5); - break; - case 6: - const field6 = reader.readBool() - message.setIsAdmin(field6); - break; - case 7: - const field7 = reader.readString() - message.setAllowedIps(field7); - break; - case 8: - const field8 = reader.readBool() - message.setDnsEnabled(field8); - break; - case 9: - const field9 = reader.readString() - message.setDnsAddress(field9); - break; - case 10: - const field10 = reader.readString() - message.setFilename(field10); - break; - case 11: - const field11 = reader.readBool() - message.setInactiveDeviceDeletionEnabled(field11); - break; - case 12: - const field12 = new googleProtobufDuration.Duration(); - reader.readMessage(field12, googleProtobufDuration.Duration.deserializeBinaryFromReader); - message.setInactiveDeviceGracePeriod(field12); - break; - case 13: - const field13 = reader.readString() - message.setClientConfigDnsServers(field13); - break; - case 14: - const field14 = reader.readString() - message.setClientConfigDnsSearchDomain(field14); - break; - case 15: - const field15 = reader.readInt32() - message.setClientConfigMtu(field15); - break; - case 16: - const field16 = new buildinfo.BuildInfo(); - reader.readMessage(field16, buildinfo.BuildInfo.deserializeBinaryFromReader); - message.setBuildInfo(field16); - break; - case 17: - const field17 = reader.readInt32() - message.setMtu(field17); - break; - default: - reader.skipField(); - break; - } - } - return message; - } + getIsAdmin(): boolean { + return jspb.Message.getFieldWithDefault(this, 6, false); + } + setIsAdmin(value: boolean): void { + (jspb.Message as any).setProto3BooleanField(this, 6, value); + } + + getAllowedIps(): string { + return jspb.Message.getFieldWithDefault(this, 7, ''); + } + + setAllowedIps(value: string): void { + (jspb.Message as any).setProto3StringField(this, 7, value); + } + + getDnsEnabled(): boolean { + return jspb.Message.getFieldWithDefault(this, 8, false); + } + + setDnsEnabled(value: boolean): void { + (jspb.Message as any).setProto3BooleanField(this, 8, value); + } + + getDnsAddress(): string { + return jspb.Message.getFieldWithDefault(this, 9, ''); + } + + setDnsAddress(value: string): void { + (jspb.Message as any).setProto3StringField(this, 9, value); + } + + getFilename(): string { + return jspb.Message.getFieldWithDefault(this, 10, ''); + } + + setFilename(value: string): void { + (jspb.Message as any).setProto3StringField(this, 10, value); + } + + getInactiveDeviceDeletionEnabled(): boolean { + return jspb.Message.getFieldWithDefault(this, 11, false); + } + + setInactiveDeviceDeletionEnabled(value: boolean): void { + (jspb.Message as any).setProto3BooleanField(this, 11, value); + } + + getInactiveDeviceGracePeriod(): googleProtobufDuration.Duration { + return jspb.Message.getWrapperField(this, googleProtobufDuration.Duration, 12); + } + + setInactiveDeviceGracePeriod(value?: googleProtobufDuration.Duration): void { + (jspb.Message as any).setWrapperField(this, 12, value); + } + + getClientConfigDnsServers(): string { + return jspb.Message.getFieldWithDefault(this, 13, ''); + } + + setClientConfigDnsServers(value: string): void { + (jspb.Message as any).setProto3StringField(this, 13, value); + } + + getClientConfigDnsSearchDomain(): string { + return jspb.Message.getFieldWithDefault(this, 14, ''); + } + + setClientConfigDnsSearchDomain(value: string): void { + (jspb.Message as any).setProto3StringField(this, 14, value); + } + + getClientConfigMtu(): number { + return jspb.Message.getFieldWithDefault(this, 15, 0); + } + + setClientConfigMtu(value: number): void { + (jspb.Message as any).setProto3IntField(this, 15, value); + } + + getBuildInfo(): buildinfo.BuildInfo { + return jspb.Message.getWrapperField(this, buildinfo.BuildInfo, 16); + } + + setBuildInfo(value?: buildinfo.BuildInfo): void { + (jspb.Message as any).setWrapperField(this, 16, value); + } + + getMtu(): number { + return jspb.Message.getFieldWithDefault(this, 17, 0); + } + + setMtu(value: number): void { + (jspb.Message as any).setProto3IntField(this, 17, value); + } + + serializeBinary(): Uint8Array { + const writer = new jspb.BinaryWriter(); + InfoRes.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); + } + + toObject(): InfoRes.AsObject { + let f: any; + return { + publicKey: this.getPublicKey(), + host: (f = this.getHost()) && f.toObject(), + port: this.getPort(), + hostVpnIp: this.getHostVpnIp(), + metadataEnabled: this.getMetadataEnabled(), + isAdmin: this.getIsAdmin(), + allowedIps: this.getAllowedIps(), + dnsEnabled: this.getDnsEnabled(), + dnsAddress: this.getDnsAddress(), + filename: this.getFilename(), + inactiveDeviceDeletionEnabled: this.getInactiveDeviceDeletionEnabled(), + inactiveDeviceGracePeriod: (f = this.getInactiveDeviceGracePeriod()) && f.toObject(), + clientConfigDnsServers: this.getClientConfigDnsServers(), + clientConfigDnsSearchDomain: this.getClientConfigDnsSearchDomain(), + clientConfigMtu: this.getClientConfigMtu(), + buildInfo: (f = this.getBuildInfo()) && f.toObject(), + mtu: this.getMtu(), + }; + } + + static serializeBinaryToWriter(message: InfoRes, writer: jspb.BinaryWriter): void { + const field1 = message.getPublicKey(); + if (field1.length > 0) { + writer.writeString(1, field1); + } + const field2 = message.getHost(); + if (field2 != null) { + writer.writeMessage(2, field2, googleProtobufWrappers.StringValue.serializeBinaryToWriter); + } + const field3 = message.getPort(); + if (field3 != 0) { + writer.writeInt32(3, field3); + } + const field4 = message.getHostVpnIp(); + if (field4.length > 0) { + writer.writeString(4, field4); + } + const field5 = message.getMetadataEnabled(); + if (field5 != false) { + writer.writeBool(5, field5); + } + const field6 = message.getIsAdmin(); + if (field6 != false) { + writer.writeBool(6, field6); + } + const field7 = message.getAllowedIps(); + if (field7.length > 0) { + writer.writeString(7, field7); + } + const field8 = message.getDnsEnabled(); + if (field8 != false) { + writer.writeBool(8, field8); + } + const field9 = message.getDnsAddress(); + if (field9.length > 0) { + writer.writeString(9, field9); + } + const field10 = message.getFilename(); + if (field10.length > 0) { + writer.writeString(10, field10); + } + const field11 = message.getInactiveDeviceDeletionEnabled(); + if (field11 != false) { + writer.writeBool(11, field11); + } + const field12 = message.getInactiveDeviceGracePeriod(); + if (field12 != null) { + writer.writeMessage(12, field12, googleProtobufDuration.Duration.serializeBinaryToWriter); + } + const field13 = message.getClientConfigDnsServers(); + if (field13.length > 0) { + writer.writeString(13, field13); + } + const field14 = message.getClientConfigDnsSearchDomain(); + if (field14.length > 0) { + writer.writeString(14, field14); + } + const field15 = message.getClientConfigMtu(); + if (field15 != 0) { + writer.writeInt32(15, field15); + } + const field16 = message.getBuildInfo(); + if (field16 != null) { + writer.writeMessage(16, field16, buildinfo.BuildInfo.serializeBinaryToWriter); + } + const field17 = message.getMtu(); + if (field17 != 0) { + writer.writeInt32(17, field17); + } + } + + static deserializeBinary(bytes: Uint8Array): InfoRes { + var reader = new jspb.BinaryReader(bytes); + var message = new InfoRes(); + return InfoRes.deserializeBinaryFromReader(message, reader); + } + + static deserializeBinaryFromReader(message: InfoRes, reader: jspb.BinaryReader): InfoRes { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + const field = reader.getFieldNumber(); + switch (field) { + case 1: + const field1 = reader.readString(); + message.setPublicKey(field1); + break; + case 2: + const field2 = new googleProtobufWrappers.StringValue(); + reader.readMessage(field2, googleProtobufWrappers.StringValue.deserializeBinaryFromReader); + message.setHost(field2); + break; + case 3: + const field3 = reader.readInt32(); + message.setPort(field3); + break; + case 4: + const field4 = reader.readString(); + message.setHostVpnIp(field4); + break; + case 5: + const field5 = reader.readBool(); + message.setMetadataEnabled(field5); + break; + case 6: + const field6 = reader.readBool(); + message.setIsAdmin(field6); + break; + case 7: + const field7 = reader.readString(); + message.setAllowedIps(field7); + break; + case 8: + const field8 = reader.readBool(); + message.setDnsEnabled(field8); + break; + case 9: + const field9 = reader.readString(); + message.setDnsAddress(field9); + break; + case 10: + const field10 = reader.readString(); + message.setFilename(field10); + break; + case 11: + const field11 = reader.readBool(); + message.setInactiveDeviceDeletionEnabled(field11); + break; + case 12: + const field12 = new googleProtobufDuration.Duration(); + reader.readMessage(field12, googleProtobufDuration.Duration.deserializeBinaryFromReader); + message.setInactiveDeviceGracePeriod(field12); + break; + case 13: + const field13 = reader.readString(); + message.setClientConfigDnsServers(field13); + break; + case 14: + const field14 = reader.readString(); + message.setClientConfigDnsSearchDomain(field14); + break; + case 15: + const field15 = reader.readInt32(); + message.setClientConfigMtu(field15); + break; + case 16: + const field16 = new buildinfo.BuildInfo(); + reader.readMessage(field16, buildinfo.BuildInfo.deserializeBinaryFromReader); + message.setBuildInfo(field16); + break; + case 17: + const field17 = reader.readInt32(); + message.setMtu(field17); + break; + default: + reader.skipField(); + break; + } + } + return message; + } } - function InfoReqFromObject(obj: InfoReq.AsObject | undefined): InfoReq | undefined { - if (obj === undefined) { - return undefined; - } - const message = new InfoReq(); - return message; + if (obj === undefined) { + return undefined; + } + const message = new InfoReq(); + return message; } function InfoResFromObject(obj: InfoRes.AsObject | undefined): InfoRes | undefined { - if (obj === undefined) { - return undefined; - } - const message = new InfoRes(); - message.setPublicKey(obj.publicKey); - message.setHost(StringValueFromObject(obj.host)); - message.setPort(obj.port); - message.setHostVpnIp(obj.hostVpnIp); - message.setMetadataEnabled(obj.metadataEnabled); - message.setIsAdmin(obj.isAdmin); - message.setAllowedIps(obj.allowedIps); - message.setDnsEnabled(obj.dnsEnabled); - message.setDnsAddress(obj.dnsAddress); - message.setFilename(obj.filename); - message.setInactiveDeviceDeletionEnabled(obj.inactiveDeviceDeletionEnabled); - message.setInactiveDeviceGracePeriod(DurationFromObject(obj.inactiveDeviceGracePeriod)); - message.setClientConfigDnsServers(obj.clientConfigDnsServers); - message.setClientConfigDnsSearchDomain(obj.clientConfigDnsSearchDomain); - message.setClientConfigMtu(obj.clientConfigMtu); - message.setBuildInfo(BuildInfoFromObject(obj.buildInfo)); - message.setMtu(obj.mtu); - return message; + if (obj === undefined) { + return undefined; + } + const message = new InfoRes(); + message.setPublicKey(obj.publicKey); + message.setHost(StringValueFromObject(obj.host)); + message.setPort(obj.port); + message.setHostVpnIp(obj.hostVpnIp); + message.setMetadataEnabled(obj.metadataEnabled); + message.setIsAdmin(obj.isAdmin); + message.setAllowedIps(obj.allowedIps); + message.setDnsEnabled(obj.dnsEnabled); + message.setDnsAddress(obj.dnsAddress); + message.setFilename(obj.filename); + message.setInactiveDeviceDeletionEnabled(obj.inactiveDeviceDeletionEnabled); + message.setInactiveDeviceGracePeriod(DurationFromObject(obj.inactiveDeviceGracePeriod)); + message.setClientConfigDnsServers(obj.clientConfigDnsServers); + message.setClientConfigDnsSearchDomain(obj.clientConfigDnsSearchDomain); + message.setClientConfigMtu(obj.clientConfigMtu); + message.setBuildInfo(BuildInfoFromObject(obj.buildInfo)); + message.setMtu(obj.mtu); + return message; } -function StringValueFromObject(obj: googleProtobufWrappers.StringValue.AsObject | undefined): googleProtobufWrappers.StringValue | undefined { - if (obj === undefined) { - return undefined; - } - const message = new googleProtobufWrappers.StringValue(); - message.setValue(obj.value); - return message; +function StringValueFromObject( + obj: googleProtobufWrappers.StringValue.AsObject | undefined, +): googleProtobufWrappers.StringValue | undefined { + if (obj === undefined) { + return undefined; + } + const message = new googleProtobufWrappers.StringValue(); + message.setValue(obj.value); + return message; } -function DurationFromObject(obj: googleProtobufDuration.Duration.AsObject | undefined): googleProtobufDuration.Duration | undefined { - if (obj === undefined) { - return undefined; - } - const message = new googleProtobufDuration.Duration(); - message.setSeconds(obj.seconds); - message.setNanos(obj.nanos); - return message; +function DurationFromObject( + obj: googleProtobufDuration.Duration.AsObject | undefined, +): googleProtobufDuration.Duration | undefined { + if (obj === undefined) { + return undefined; + } + const message = new googleProtobufDuration.Duration(); + message.setSeconds(obj.seconds); + message.setNanos(obj.nanos); + return message; } function BuildInfoFromObject(obj: buildinfo.BuildInfo.AsObject | undefined): buildinfo.BuildInfo | undefined { - if (obj === undefined) { - return undefined; - } - const message = new buildinfo.BuildInfo(); - message.setVersion(obj.version); - message.setCommit(obj.commit); - return message; + if (obj === undefined) { + return undefined; + } + const message = new buildinfo.BuildInfo(); + message.setVersion(obj.version); + message.setCommit(obj.commit); + return message; } - diff --git a/website/src/sdk/users_pb.ts b/website/src/sdk/users_pb.ts index 26a2ddef..7c17c98d 100644 --- a/website/src/sdk/users_pb.ts +++ b/website/src/sdk/users_pb.ts @@ -8,412 +8,383 @@ import * as grpcWeb from 'grpc-web'; import * as googleProtobufEmpty from 'google-protobuf/google/protobuf/empty_pb'; export class Users { - - private client_ = new grpcWeb.GrpcWebClientBase({ - format: 'text', - }); - - private methodInfoListUsers = new grpcWeb.MethodDescriptor( - "ListUsers", - null, - ListUsersReq, - ListUsersRes, - (req: ListUsersReq) => req.serializeBinary(), - ListUsersRes.deserializeBinary - ); - - private methodInfoDeleteUser = new grpcWeb.MethodDescriptor( - "DeleteUser", - null, - DeleteUserReq, - googleProtobufEmpty.Empty, - (req: DeleteUserReq) => req.serializeBinary(), - googleProtobufEmpty.Empty.deserializeBinary - ); - - constructor( - private hostname: string, - private defaultMetadata?: () => grpcWeb.Metadata, - ) { } - - listUsers(req: ListUsersReq.AsObject, metadata?: grpcWeb.Metadata): Promise { - return new Promise((resolve, reject) => { - const message = ListUsersReqFromObject(req); - this.client_.rpcCall( - this.hostname + '/proto.Users/ListUsers', - message, - Object.assign({}, this.defaultMetadata ? this.defaultMetadata() : {}, metadata), - this.methodInfoListUsers, - (err: grpcWeb.Error, res: ListUsersRes) => { - if (err) { - reject(err); - } else { - resolve(res.toObject()); - } - }, - ); - }); - } - - deleteUser(req: DeleteUserReq.AsObject, metadata?: grpcWeb.Metadata): Promise { - return new Promise((resolve, reject) => { - const message = DeleteUserReqFromObject(req); - this.client_.rpcCall( - this.hostname + '/proto.Users/DeleteUser', - message, - Object.assign({}, this.defaultMetadata ? this.defaultMetadata() : {}, metadata), - this.methodInfoDeleteUser, - (err: grpcWeb.Error, res: googleProtobufEmpty.Empty) => { - if (err) { - reject(err); - } else { - resolve(res.toObject()); - } - }, - ); - }); - } - + private client_ = new grpcWeb.GrpcWebClientBase({ + format: 'text', + }); + + private methodInfoListUsers = new grpcWeb.MethodDescriptor( + 'ListUsers', + null, + ListUsersReq, + ListUsersRes, + (req: ListUsersReq) => req.serializeBinary(), + ListUsersRes.deserializeBinary, + ); + + private methodInfoDeleteUser = new grpcWeb.MethodDescriptor( + 'DeleteUser', + null, + DeleteUserReq, + googleProtobufEmpty.Empty, + (req: DeleteUserReq) => req.serializeBinary(), + googleProtobufEmpty.Empty.deserializeBinary, + ); + + constructor( + private hostname: string, + private defaultMetadata?: () => grpcWeb.Metadata, + ) {} + + listUsers(req: ListUsersReq.AsObject, metadata?: grpcWeb.Metadata): Promise { + return new Promise((resolve, reject) => { + const message = ListUsersReqFromObject(req); + this.client_.rpcCall( + this.hostname + '/proto.Users/ListUsers', + message, + Object.assign({}, this.defaultMetadata ? this.defaultMetadata() : {}, metadata), + this.methodInfoListUsers, + (err: grpcWeb.Error, res: ListUsersRes) => { + if (err) { + reject(err); + } else { + resolve(res.toObject()); + } + }, + ); + }); + } + + deleteUser(req: DeleteUserReq.AsObject, metadata?: grpcWeb.Metadata): Promise { + return new Promise((resolve, reject) => { + const message = DeleteUserReqFromObject(req); + this.client_.rpcCall( + this.hostname + '/proto.Users/DeleteUser', + message, + Object.assign({}, this.defaultMetadata ? this.defaultMetadata() : {}, metadata), + this.methodInfoDeleteUser, + (err: grpcWeb.Error, res: googleProtobufEmpty.Empty) => { + if (err) { + reject(err); + } else { + resolve(res.toObject()); + } + }, + ); + }); + } } - - - export declare namespace User { - export type AsObject = { - name: string, - displayName: string, - } + export type AsObject = { + name: string; + displayName: string; + }; } export class User extends jspb.Message { - - private static repeatedFields_ = [ - - ]; - - constructor(data?: jspb.Message.MessageArray) { - super(); - jspb.Message.initialize(this, data || [], 0, -1, User.repeatedFields_, null); - } - - - getName(): string {return jspb.Message.getFieldWithDefault(this, 1, ""); - } - - setName(value: string): void { - (jspb.Message as any).setProto3StringField(this, 1, value); - } - - getDisplayName(): string {return jspb.Message.getFieldWithDefault(this, 2, ""); - } - - setDisplayName(value: string): void { - (jspb.Message as any).setProto3StringField(this, 2, value); - } - - serializeBinary(): Uint8Array { - const writer = new jspb.BinaryWriter(); - User.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); - } - - toObject(): User.AsObject { - let f: any; - return { - name: this.getName(), - displayName: this.getDisplayName(), - }; - } - - static serializeBinaryToWriter(message: User, writer: jspb.BinaryWriter): void { - const field1 = message.getName(); - if (field1.length > 0) { - writer.writeString(1, field1); - } - const field2 = message.getDisplayName(); - if (field2.length > 0) { - writer.writeString(2, field2); - } - } - - static deserializeBinary(bytes: Uint8Array): User { - var reader = new jspb.BinaryReader(bytes); - var message = new User(); - return User.deserializeBinaryFromReader(message, reader); - } - - static deserializeBinaryFromReader(message: User, reader: jspb.BinaryReader): User { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - const field = reader.getFieldNumber(); - switch (field) { - case 1: - const field1 = reader.readString() - message.setName(field1); - break; - case 2: - const field2 = reader.readString() - message.setDisplayName(field2); - break; - default: - reader.skipField(); - break; - } - } - return message; - } - + private static repeatedFields_ = []; + + constructor(data?: jspb.Message.MessageArray) { + super(); + jspb.Message.initialize(this, data || [], 0, -1, User.repeatedFields_, null); + } + + getName(): string { + return jspb.Message.getFieldWithDefault(this, 1, ''); + } + + setName(value: string): void { + (jspb.Message as any).setProto3StringField(this, 1, value); + } + + getDisplayName(): string { + return jspb.Message.getFieldWithDefault(this, 2, ''); + } + + setDisplayName(value: string): void { + (jspb.Message as any).setProto3StringField(this, 2, value); + } + + serializeBinary(): Uint8Array { + const writer = new jspb.BinaryWriter(); + User.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); + } + + toObject(): User.AsObject { + let f: any; + return { + name: this.getName(), + displayName: this.getDisplayName(), + }; + } + + static serializeBinaryToWriter(message: User, writer: jspb.BinaryWriter): void { + const field1 = message.getName(); + if (field1.length > 0) { + writer.writeString(1, field1); + } + const field2 = message.getDisplayName(); + if (field2.length > 0) { + writer.writeString(2, field2); + } + } + + static deserializeBinary(bytes: Uint8Array): User { + var reader = new jspb.BinaryReader(bytes); + var message = new User(); + return User.deserializeBinaryFromReader(message, reader); + } + + static deserializeBinaryFromReader(message: User, reader: jspb.BinaryReader): User { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + const field = reader.getFieldNumber(); + switch (field) { + case 1: + const field1 = reader.readString(); + message.setName(field1); + break; + case 2: + const field2 = reader.readString(); + message.setDisplayName(field2); + break; + default: + reader.skipField(); + break; + } + } + return message; + } } export declare namespace ListUsersReq { - export type AsObject = { - } + export type AsObject = {}; } export class ListUsersReq extends jspb.Message { - - private static repeatedFields_ = [ - - ]; - - constructor(data?: jspb.Message.MessageArray) { - super(); - jspb.Message.initialize(this, data || [], 0, -1, ListUsersReq.repeatedFields_, null); - } - - - serializeBinary(): Uint8Array { - const writer = new jspb.BinaryWriter(); - ListUsersReq.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); - } - - toObject(): ListUsersReq.AsObject { - let f: any; - return { - }; - } - - static serializeBinaryToWriter(message: ListUsersReq, writer: jspb.BinaryWriter): void { - } - - static deserializeBinary(bytes: Uint8Array): ListUsersReq { - var reader = new jspb.BinaryReader(bytes); - var message = new ListUsersReq(); - return ListUsersReq.deserializeBinaryFromReader(message, reader); - } - - static deserializeBinaryFromReader(message: ListUsersReq, reader: jspb.BinaryReader): ListUsersReq { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - const field = reader.getFieldNumber(); - switch (field) { - default: - reader.skipField(); - break; - } - } - return message; - } - + private static repeatedFields_ = []; + + constructor(data?: jspb.Message.MessageArray) { + super(); + jspb.Message.initialize(this, data || [], 0, -1, ListUsersReq.repeatedFields_, null); + } + + serializeBinary(): Uint8Array { + const writer = new jspb.BinaryWriter(); + ListUsersReq.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); + } + + toObject(): ListUsersReq.AsObject { + let f: any; + return {}; + } + + static serializeBinaryToWriter(message: ListUsersReq, writer: jspb.BinaryWriter): void {} + + static deserializeBinary(bytes: Uint8Array): ListUsersReq { + var reader = new jspb.BinaryReader(bytes); + var message = new ListUsersReq(); + return ListUsersReq.deserializeBinaryFromReader(message, reader); + } + + static deserializeBinaryFromReader(message: ListUsersReq, reader: jspb.BinaryReader): ListUsersReq { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + const field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return message; + } } export declare namespace ListUsersRes { - export type AsObject = { - items: Array, - } + export type AsObject = { + items: Array; + }; } export class ListUsersRes extends jspb.Message { - - private static repeatedFields_ = [ - 1, - ]; - - constructor(data?: jspb.Message.MessageArray) { - super(); - jspb.Message.initialize(this, data || [], 0, -1, ListUsersRes.repeatedFields_, null); - } - - - getItems(): Array { - return jspb.Message.getRepeatedWrapperField(this, User, 1); - } - - setItems(value: Array): void { - (jspb.Message as any).setRepeatedWrapperField(this, 1, value); - } - - addItems(value?: User, index?: number): User { - return jspb.Message.addToRepeatedWrapperField(this, 1, value, User, index); - } - - serializeBinary(): Uint8Array { - const writer = new jspb.BinaryWriter(); - ListUsersRes.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); - } - - toObject(): ListUsersRes.AsObject { - let f: any; - return { - items: this.getItems().map((item) => item.toObject()), - }; - } - - static serializeBinaryToWriter(message: ListUsersRes, writer: jspb.BinaryWriter): void { - const field1 = message.getItems(); - if (field1.length > 0) { - writer.writeRepeatedMessage(1, field1, User.serializeBinaryToWriter); - } - } - - static deserializeBinary(bytes: Uint8Array): ListUsersRes { - var reader = new jspb.BinaryReader(bytes); - var message = new ListUsersRes(); - return ListUsersRes.deserializeBinaryFromReader(message, reader); - } - - static deserializeBinaryFromReader(message: ListUsersRes, reader: jspb.BinaryReader): ListUsersRes { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - const field = reader.getFieldNumber(); - switch (field) { - case 1: - const field1 = new User(); - reader.readMessage(field1, User.deserializeBinaryFromReader); - message.addItems(field1); - break; - default: - reader.skipField(); - break; - } - } - return message; - } - + private static repeatedFields_ = [1]; + + constructor(data?: jspb.Message.MessageArray) { + super(); + jspb.Message.initialize(this, data || [], 0, -1, ListUsersRes.repeatedFields_, null); + } + + getItems(): Array { + return jspb.Message.getRepeatedWrapperField(this, User, 1); + } + + setItems(value: Array): void { + (jspb.Message as any).setRepeatedWrapperField(this, 1, value); + } + + addItems(value?: User, index?: number): User { + return jspb.Message.addToRepeatedWrapperField(this, 1, value, User, index); + } + + serializeBinary(): Uint8Array { + const writer = new jspb.BinaryWriter(); + ListUsersRes.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); + } + + toObject(): ListUsersRes.AsObject { + let f: any; + return { + items: this.getItems().map((item) => item.toObject()), + }; + } + + static serializeBinaryToWriter(message: ListUsersRes, writer: jspb.BinaryWriter): void { + const field1 = message.getItems(); + if (field1.length > 0) { + writer.writeRepeatedMessage(1, field1, User.serializeBinaryToWriter); + } + } + + static deserializeBinary(bytes: Uint8Array): ListUsersRes { + var reader = new jspb.BinaryReader(bytes); + var message = new ListUsersRes(); + return ListUsersRes.deserializeBinaryFromReader(message, reader); + } + + static deserializeBinaryFromReader(message: ListUsersRes, reader: jspb.BinaryReader): ListUsersRes { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + const field = reader.getFieldNumber(); + switch (field) { + case 1: + const field1 = new User(); + reader.readMessage(field1, User.deserializeBinaryFromReader); + message.addItems(field1); + break; + default: + reader.skipField(); + break; + } + } + return message; + } } export declare namespace DeleteUserReq { - export type AsObject = { - name: string, - } + export type AsObject = { + name: string; + }; } export class DeleteUserReq extends jspb.Message { - - private static repeatedFields_ = [ - - ]; - - constructor(data?: jspb.Message.MessageArray) { - super(); - jspb.Message.initialize(this, data || [], 0, -1, DeleteUserReq.repeatedFields_, null); - } - - - getName(): string {return jspb.Message.getFieldWithDefault(this, 1, ""); - } - - setName(value: string): void { - (jspb.Message as any).setProto3StringField(this, 1, value); - } - - serializeBinary(): Uint8Array { - const writer = new jspb.BinaryWriter(); - DeleteUserReq.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); - } - - toObject(): DeleteUserReq.AsObject { - let f: any; - return { - name: this.getName(), - }; - } - - static serializeBinaryToWriter(message: DeleteUserReq, writer: jspb.BinaryWriter): void { - const field1 = message.getName(); - if (field1.length > 0) { - writer.writeString(1, field1); - } - } - - static deserializeBinary(bytes: Uint8Array): DeleteUserReq { - var reader = new jspb.BinaryReader(bytes); - var message = new DeleteUserReq(); - return DeleteUserReq.deserializeBinaryFromReader(message, reader); - } - - static deserializeBinaryFromReader(message: DeleteUserReq, reader: jspb.BinaryReader): DeleteUserReq { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - const field = reader.getFieldNumber(); - switch (field) { - case 1: - const field1 = reader.readString() - message.setName(field1); - break; - default: - reader.skipField(); - break; - } - } - return message; - } - + private static repeatedFields_ = []; + + constructor(data?: jspb.Message.MessageArray) { + super(); + jspb.Message.initialize(this, data || [], 0, -1, DeleteUserReq.repeatedFields_, null); + } + + getName(): string { + return jspb.Message.getFieldWithDefault(this, 1, ''); + } + + setName(value: string): void { + (jspb.Message as any).setProto3StringField(this, 1, value); + } + + serializeBinary(): Uint8Array { + const writer = new jspb.BinaryWriter(); + DeleteUserReq.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); + } + + toObject(): DeleteUserReq.AsObject { + let f: any; + return { + name: this.getName(), + }; + } + + static serializeBinaryToWriter(message: DeleteUserReq, writer: jspb.BinaryWriter): void { + const field1 = message.getName(); + if (field1.length > 0) { + writer.writeString(1, field1); + } + } + + static deserializeBinary(bytes: Uint8Array): DeleteUserReq { + var reader = new jspb.BinaryReader(bytes); + var message = new DeleteUserReq(); + return DeleteUserReq.deserializeBinaryFromReader(message, reader); + } + + static deserializeBinaryFromReader(message: DeleteUserReq, reader: jspb.BinaryReader): DeleteUserReq { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + const field = reader.getFieldNumber(); + switch (field) { + case 1: + const field1 = reader.readString(); + message.setName(field1); + break; + default: + reader.skipField(); + break; + } + } + return message; + } } - function UserFromObject(obj: User.AsObject | undefined): User | undefined { - if (obj === undefined) { - return undefined; - } - const message = new User(); - message.setName(obj.name); - message.setDisplayName(obj.displayName); - return message; + if (obj === undefined) { + return undefined; + } + const message = new User(); + message.setName(obj.name); + message.setDisplayName(obj.displayName); + return message; } function ListUsersReqFromObject(obj: ListUsersReq.AsObject | undefined): ListUsersReq | undefined { - if (obj === undefined) { - return undefined; - } - const message = new ListUsersReq(); - return message; + if (obj === undefined) { + return undefined; + } + const message = new ListUsersReq(); + return message; } function ListUsersResFromObject(obj: ListUsersRes.AsObject | undefined): ListUsersRes | undefined { - if (obj === undefined) { - return undefined; - } - const message = new ListUsersRes(); - (obj.items || []) - .map((item) => UserFromObject(item)) - .forEach((item) => message.addItems(item)); - return message; + if (obj === undefined) { + return undefined; + } + const message = new ListUsersRes(); + (obj.items || []).map((item) => UserFromObject(item)).forEach((item) => message.addItems(item)); + return message; } function DeleteUserReqFromObject(obj: DeleteUserReq.AsObject | undefined): DeleteUserReq | undefined { - if (obj === undefined) { - return undefined; - } - const message = new DeleteUserReq(); - message.setName(obj.name); - return message; + if (obj === undefined) { + return undefined; + } + const message = new DeleteUserReq(); + message.setName(obj.name); + return message; } function EmptyFromObject(obj: googleProtobufEmpty.Empty.AsObject | undefined): googleProtobufEmpty.Empty | undefined { - if (obj === undefined) { - return undefined; - } - const message = new googleProtobufEmpty.Empty(); - return message; + if (obj === undefined) { + return undefined; + } + const message = new googleProtobufEmpty.Empty(); + return message; } - diff --git a/website/vite.config.ts b/website/vite.config.ts index 461f47bb..fb105c41 100644 --- a/website/vite.config.ts +++ b/website/vite.config.ts @@ -9,13 +9,4 @@ export default defineConfig({ build: { outDir: "build", }, - server: { - proxy: { - '/api': { - target: 'http://localhost:8000', - changeOrigin: true, - secure: false - } - } - } - }); + }); \ No newline at end of file