device

package
v0.0.0-...-a0d1ad3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 25, 2022 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package device is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var Devices_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "hvx.api.v1alpha1.device.proto.Devices",
	HandlerType: (*DevicesServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "IsExist",
			Handler:    _Devices_IsExist_Handler,
		},
		{
			MethodName: "Create",
			Handler:    _Devices_Create_Handler,
		},
		{
			MethodName: "Get",
			Handler:    _Devices_Get_Handler,
		},
		{
			MethodName: "GetDevices",
			Handler:    _Devices_GetDevices_Handler,
		},
		{
			MethodName: "Delete",
			Handler:    _Devices_Delete_Handler,
		},
		{
			MethodName: "DeleteDevices",
			Handler:    _Devices_DeleteDevices_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "proto/v1alpha1/device/device.proto",
}

Devices_ServiceDesc is the grpc.ServiceDesc for Devices service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

View Source
var File_proto_v1alpha1_device_device_proto protoreflect.FileDescriptor

Functions

func RegisterDevicesHandler

func RegisterDevicesHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterDevicesHandler registers the http handlers for service Devices to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterDevicesHandlerClient

func RegisterDevicesHandlerClient(ctx context.Context, mux *runtime.ServeMux, client DevicesClient) error

RegisterDevicesHandlerClient registers the http handlers for service Devices to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "DevicesClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "DevicesClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "DevicesClient" to call the correct interceptors.

func RegisterDevicesHandlerFromEndpoint

func RegisterDevicesHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterDevicesHandlerFromEndpoint is same as RegisterDevicesHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterDevicesHandlerServer

func RegisterDevicesHandlerServer(ctx context.Context, mux *runtime.ServeMux, server DevicesServer) error

RegisterDevicesHandlerServer registers the http handlers for service Devices to "mux". UnaryRPC :call DevicesServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterDevicesHandlerFromEndpoint instead.

func RegisterDevicesServer

func RegisterDevicesServer(s grpc.ServiceRegistrar, srv DevicesServer)

Types

type CreateRequest

type CreateRequest struct {
	AccountId int64  `protobuf:"varint,1,opt,name=accountId,proto3" json:"accountId,omitempty"`
	Ua        string `protobuf:"bytes,2,opt,name=ua,proto3" json:"ua,omitempty"`
	// contains filtered or unexported fields
}

func (*CreateRequest) Descriptor deprecated

func (*CreateRequest) Descriptor() ([]byte, []int)

Deprecated: Use CreateRequest.ProtoReflect.Descriptor instead.

func (*CreateRequest) GetAccountId

func (x *CreateRequest) GetAccountId() int64

func (*CreateRequest) GetUa

func (x *CreateRequest) GetUa() string

func (*CreateRequest) ProtoMessage

func (*CreateRequest) ProtoMessage()

func (*CreateRequest) ProtoReflect

func (x *CreateRequest) ProtoReflect() protoreflect.Message

func (*CreateRequest) Reset

func (x *CreateRequest) Reset()

func (*CreateRequest) String

func (x *CreateRequest) String() string

type CreateResponse

type CreateResponse struct {
	DeviceId int64 `protobuf:"varint,1,opt,name=deviceId,proto3" json:"deviceId,omitempty"`
	// contains filtered or unexported fields
}

func (*CreateResponse) Descriptor deprecated

func (*CreateResponse) Descriptor() ([]byte, []int)

Deprecated: Use CreateResponse.ProtoReflect.Descriptor instead.

func (*CreateResponse) GetDeviceId

func (x *CreateResponse) GetDeviceId() int64

func (*CreateResponse) ProtoMessage

func (*CreateResponse) ProtoMessage()

func (*CreateResponse) ProtoReflect

func (x *CreateResponse) ProtoReflect() protoreflect.Message

func (*CreateResponse) Reset

func (x *CreateResponse) Reset()

func (*CreateResponse) String

func (x *CreateResponse) String() string

type DeleteDevicesRequest

type DeleteDevicesRequest struct {
	AccountId int64 `protobuf:"varint,1,opt,name=accountId,proto3" json:"accountId,omitempty"`
	// contains filtered or unexported fields
}

func (*DeleteDevicesRequest) Descriptor deprecated

func (*DeleteDevicesRequest) Descriptor() ([]byte, []int)

Deprecated: Use DeleteDevicesRequest.ProtoReflect.Descriptor instead.

func (*DeleteDevicesRequest) GetAccountId

func (x *DeleteDevicesRequest) GetAccountId() int64

func (*DeleteDevicesRequest) ProtoMessage

func (*DeleteDevicesRequest) ProtoMessage()

func (*DeleteDevicesRequest) ProtoReflect

func (x *DeleteDevicesRequest) ProtoReflect() protoreflect.Message

func (*DeleteDevicesRequest) Reset

func (x *DeleteDevicesRequest) Reset()

func (*DeleteDevicesRequest) String

func (x *DeleteDevicesRequest) String() string

type DeleteDevicesResponse

type DeleteDevicesResponse struct {
	Code   string `protobuf:"bytes,1,opt,name=code,proto3" json:"code,omitempty"`
	Status string `protobuf:"bytes,2,opt,name=status,proto3" json:"status,omitempty"`
	// contains filtered or unexported fields
}

func (*DeleteDevicesResponse) Descriptor deprecated

func (*DeleteDevicesResponse) Descriptor() ([]byte, []int)

Deprecated: Use DeleteDevicesResponse.ProtoReflect.Descriptor instead.

func (*DeleteDevicesResponse) GetCode

func (x *DeleteDevicesResponse) GetCode() string

func (*DeleteDevicesResponse) GetStatus

func (x *DeleteDevicesResponse) GetStatus() string

func (*DeleteDevicesResponse) ProtoMessage

func (*DeleteDevicesResponse) ProtoMessage()

func (*DeleteDevicesResponse) ProtoReflect

func (x *DeleteDevicesResponse) ProtoReflect() protoreflect.Message

func (*DeleteDevicesResponse) Reset

func (x *DeleteDevicesResponse) Reset()

func (*DeleteDevicesResponse) String

func (x *DeleteDevicesResponse) String() string

type DeleteRequest

type DeleteRequest struct {
	DeviceId int64 `protobuf:"varint,1,opt,name=deviceId,proto3" json:"deviceId,omitempty"`
	// contains filtered or unexported fields
}

func (*DeleteRequest) Descriptor deprecated

func (*DeleteRequest) Descriptor() ([]byte, []int)

Deprecated: Use DeleteRequest.ProtoReflect.Descriptor instead.

func (*DeleteRequest) GetDeviceId

func (x *DeleteRequest) GetDeviceId() int64

func (*DeleteRequest) ProtoMessage

func (*DeleteRequest) ProtoMessage()

func (*DeleteRequest) ProtoReflect

func (x *DeleteRequest) ProtoReflect() protoreflect.Message

func (*DeleteRequest) Reset

func (x *DeleteRequest) Reset()

func (*DeleteRequest) String

func (x *DeleteRequest) String() string

type DeleteResponse

type DeleteResponse struct {
	Code   string `protobuf:"bytes,1,opt,name=code,proto3" json:"code,omitempty"`
	Status string `protobuf:"bytes,2,opt,name=status,proto3" json:"status,omitempty"`
	// contains filtered or unexported fields
}

func (*DeleteResponse) Descriptor deprecated

func (*DeleteResponse) Descriptor() ([]byte, []int)

Deprecated: Use DeleteResponse.ProtoReflect.Descriptor instead.

func (*DeleteResponse) GetCode

func (x *DeleteResponse) GetCode() string

func (*DeleteResponse) GetStatus

func (x *DeleteResponse) GetStatus() string

func (*DeleteResponse) ProtoMessage

func (*DeleteResponse) ProtoMessage()

func (*DeleteResponse) ProtoReflect

func (x *DeleteResponse) ProtoReflect() protoreflect.Message

func (*DeleteResponse) Reset

func (x *DeleteResponse) Reset()

func (*DeleteResponse) String

func (x *DeleteResponse) String() string

type Device

type Device struct {
	Id        int64  `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	AccountId int64  `protobuf:"varint,2,opt,name=accountId,proto3" json:"accountId,omitempty"`
	Device    string `protobuf:"bytes,3,opt,name=device,proto3" json:"device,omitempty"`
	CreatedAt string `protobuf:"bytes,4,opt,name=createdAt,proto3" json:"createdAt,omitempty"`
	// contains filtered or unexported fields
}

func (*Device) Descriptor deprecated

func (*Device) Descriptor() ([]byte, []int)

Deprecated: Use Device.ProtoReflect.Descriptor instead.

func (*Device) GetAccountId

func (x *Device) GetAccountId() int64

func (*Device) GetCreatedAt

func (x *Device) GetCreatedAt() string

func (*Device) GetDevice

func (x *Device) GetDevice() string

func (*Device) GetId

func (x *Device) GetId() int64

func (*Device) ProtoMessage

func (*Device) ProtoMessage()

func (*Device) ProtoReflect

func (x *Device) ProtoReflect() protoreflect.Message

func (*Device) Reset

func (x *Device) Reset()

func (*Device) String

func (x *Device) String() string

type DevicesClient

type DevicesClient interface {
	// IsExist Gets whether the device is authenticated by the device id.
	// This method returns a boolean value. Returns true if it does not exist
	// Otherwise returns false.
	IsExist(ctx context.Context, in *IsExistRequest, opts ...grpc.CallOption) (*IsExistResponse, error)
	// Create To create the logged-in device data, pass the account id
	// and user agent and generate a hash as a unique identifier
	// for the device.
	Create(ctx context.Context, in *CreateRequest, opts ...grpc.CallOption) (*CreateResponse, error)
	// Get Get detailed data about the device by its unique device ID.
	Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*Device, error)
	// Get a list of all logged-in devices by account ID.
	GetDevices(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*GetDevicesResponse, error)
	// Delete a device by its device id.
	Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error)
	// DeleteDeviceByWithAccountID Delete all login devices by account id.
	DeleteDevices(ctx context.Context, in *DeleteDevicesRequest, opts ...grpc.CallOption) (*DeleteDevicesResponse, error)
}

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.

func NewDevicesClient

func NewDevicesClient(cc grpc.ClientConnInterface) DevicesClient

type DevicesServer

type DevicesServer interface {
	// IsExist Gets whether the device is authenticated by the device id.
	// This method returns a boolean value. Returns true if it does not exist
	// Otherwise returns false.
	IsExist(context.Context, *IsExistRequest) (*IsExistResponse, error)
	// Create To create the logged-in device data, pass the account id
	// and user agent and generate a hash as a unique identifier
	// for the device.
	Create(context.Context, *CreateRequest) (*CreateResponse, error)
	// Get Get detailed data about the device by its unique device ID.
	Get(context.Context, *GetRequest) (*Device, error)
	// Get a list of all logged-in devices by account ID.
	GetDevices(context.Context, *emptypb.Empty) (*GetDevicesResponse, error)
	// Delete a device by its device id.
	Delete(context.Context, *DeleteRequest) (*DeleteResponse, error)
	// DeleteDeviceByWithAccountID Delete all login devices by account id.
	DeleteDevices(context.Context, *DeleteDevicesRequest) (*DeleteDevicesResponse, error)
}

DevicesServer is the server API for Devices service. All implementations should embed UnimplementedDevicesServer for forward compatibility

type GetDevicesResponse

type GetDevicesResponse struct {
	Code    string    `protobuf:"bytes,1,opt,name=code,proto3" json:"code,omitempty"`
	Devices []*Device `protobuf:"bytes,2,rep,name=devices,proto3" json:"devices,omitempty"`
	// contains filtered or unexported fields
}

func (*GetDevicesResponse) Descriptor deprecated

func (*GetDevicesResponse) Descriptor() ([]byte, []int)

Deprecated: Use GetDevicesResponse.ProtoReflect.Descriptor instead.

func (*GetDevicesResponse) GetCode

func (x *GetDevicesResponse) GetCode() string

func (*GetDevicesResponse) GetDevices

func (x *GetDevicesResponse) GetDevices() []*Device

func (*GetDevicesResponse) ProtoMessage

func (*GetDevicesResponse) ProtoMessage()

func (*GetDevicesResponse) ProtoReflect

func (x *GetDevicesResponse) ProtoReflect() protoreflect.Message

func (*GetDevicesResponse) Reset

func (x *GetDevicesResponse) Reset()

func (*GetDevicesResponse) String

func (x *GetDevicesResponse) String() string

type GetRequest

type GetRequest struct {
	DeviceId int64 `protobuf:"varint,1,opt,name=deviceId,proto3" json:"deviceId,omitempty"`
	// contains filtered or unexported fields
}

func (*GetRequest) Descriptor deprecated

func (*GetRequest) Descriptor() ([]byte, []int)

Deprecated: Use GetRequest.ProtoReflect.Descriptor instead.

func (*GetRequest) GetDeviceId

func (x *GetRequest) GetDeviceId() int64

func (*GetRequest) ProtoMessage

func (*GetRequest) ProtoMessage()

func (*GetRequest) ProtoReflect

func (x *GetRequest) ProtoReflect() protoreflect.Message

func (*GetRequest) Reset

func (x *GetRequest) Reset()

func (*GetRequest) String

func (x *GetRequest) String() string

type IsExistRequest

type IsExistRequest struct {
	Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	// contains filtered or unexported fields
}

func (*IsExistRequest) Descriptor deprecated

func (*IsExistRequest) Descriptor() ([]byte, []int)

Deprecated: Use IsExistRequest.ProtoReflect.Descriptor instead.

func (*IsExistRequest) GetId

func (x *IsExistRequest) GetId() int64

func (*IsExistRequest) ProtoMessage

func (*IsExistRequest) ProtoMessage()

func (*IsExistRequest) ProtoReflect

func (x *IsExistRequest) ProtoReflect() protoreflect.Message

func (*IsExistRequest) Reset

func (x *IsExistRequest) Reset()

func (*IsExistRequest) String

func (x *IsExistRequest) String() string

type IsExistResponse

type IsExistResponse struct {
	IsExist bool `protobuf:"varint,1,opt,name=isExist,proto3" json:"isExist,omitempty"`
	// contains filtered or unexported fields
}

func (*IsExistResponse) Descriptor deprecated

func (*IsExistResponse) Descriptor() ([]byte, []int)

Deprecated: Use IsExistResponse.ProtoReflect.Descriptor instead.

func (*IsExistResponse) GetIsExist

func (x *IsExistResponse) GetIsExist() bool

func (*IsExistResponse) ProtoMessage

func (*IsExistResponse) ProtoMessage()

func (*IsExistResponse) ProtoReflect

func (x *IsExistResponse) ProtoReflect() protoreflect.Message

func (*IsExistResponse) Reset

func (x *IsExistResponse) Reset()

func (*IsExistResponse) String

func (x *IsExistResponse) String() string

type UnimplementedDevicesServer

type UnimplementedDevicesServer struct {
}

UnimplementedDevicesServer should be embedded to have forward compatible implementations.

func (UnimplementedDevicesServer) Create

func (UnimplementedDevicesServer) Delete

func (UnimplementedDevicesServer) DeleteDevices

func (UnimplementedDevicesServer) Get

func (UnimplementedDevicesServer) GetDevices

func (UnimplementedDevicesServer) IsExist

type UnsafeDevicesServer

type UnsafeDevicesServer interface {
	// contains filtered or unexported methods
}

UnsafeDevicesServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to DevicesServer will result in compilation errors.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL