mirror of
https://github.com/mautrix/signal.git
synced 2026-09-17 08:12:05 -04:00
349 lines
14 KiB
Go
349 lines
14 KiB
Go
|
|
//
|
||
|
|
// Copyright 2023 Signal Messenger, LLC
|
||
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||
|
|
|
||
|
|
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||
|
|
// versions:
|
||
|
|
// - protoc-gen-go-grpc v1.6.2
|
||
|
|
// - protoc v7.34.1
|
||
|
|
// source: org/signal/chat/device.proto
|
||
|
|
|
||
|
|
package device
|
||
|
|
|
||
|
|
import (
|
||
|
|
context "context"
|
||
|
|
grpc "google.golang.org/grpc"
|
||
|
|
codes "google.golang.org/grpc/codes"
|
||
|
|
status "google.golang.org/grpc/status"
|
||
|
|
)
|
||
|
|
|
||
|
|
// This is a compile-time assertion to ensure that this generated file
|
||
|
|
// is compatible with the grpc package it is being compiled against.
|
||
|
|
// Requires gRPC-Go v1.64.0 or later.
|
||
|
|
const _ = grpc.SupportPackageIsVersion9
|
||
|
|
|
||
|
|
const (
|
||
|
|
Devices_GetDevices_FullMethodName = "/org.signal.chat.device.Devices/GetDevices"
|
||
|
|
Devices_RemoveDevice_FullMethodName = "/org.signal.chat.device.Devices/RemoveDevice"
|
||
|
|
Devices_SetDeviceName_FullMethodName = "/org.signal.chat.device.Devices/SetDeviceName"
|
||
|
|
Devices_SetPushToken_FullMethodName = "/org.signal.chat.device.Devices/SetPushToken"
|
||
|
|
Devices_ClearPushToken_FullMethodName = "/org.signal.chat.device.Devices/ClearPushToken"
|
||
|
|
Devices_SetCapabilities_FullMethodName = "/org.signal.chat.device.Devices/SetCapabilities"
|
||
|
|
)
|
||
|
|
|
||
|
|
// 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.
|
||
|
|
//
|
||
|
|
// Provides methods for working with devices attached to a Signal account.
|
||
|
|
type DevicesClient interface {
|
||
|
|
// Returns a list of devices associated with the caller's account.
|
||
|
|
GetDevices(ctx context.Context, in *GetDevicesRequest, opts ...grpc.CallOption) (*GetDevicesResponse, error)
|
||
|
|
// Removes a linked device from the caller's account.
|
||
|
|
//
|
||
|
|
// Linked devices may only remove themselves. Primary devices may remove
|
||
|
|
// any device other than themselves.
|
||
|
|
RemoveDevice(ctx context.Context, in *RemoveDeviceRequest, opts ...grpc.CallOption) (*RemoveDeviceResponse, error)
|
||
|
|
// Sets the encrypted human-readable name for a specific devices. Primary
|
||
|
|
// devices may change the name of any device associated with their account,
|
||
|
|
// but linked devices may only change their own name. The response will
|
||
|
|
// indicate if the target device was not found.
|
||
|
|
SetDeviceName(ctx context.Context, in *SetDeviceNameRequest, opts ...grpc.CallOption) (*SetDeviceNameResponse, error)
|
||
|
|
// Sets the token(s) the server should use to send new message notifications
|
||
|
|
// to the authenticated device.
|
||
|
|
SetPushToken(ctx context.Context, in *SetPushTokenRequest, opts ...grpc.CallOption) (*SetPushTokenResponse, error)
|
||
|
|
// Removes any push tokens associated with the authenticated device. After
|
||
|
|
// calling this method, the server will assume that the authenticated device
|
||
|
|
// will periodically poll for new messages.
|
||
|
|
ClearPushToken(ctx context.Context, in *ClearPushTokenRequest, opts ...grpc.CallOption) (*ClearPushTokenResponse, error)
|
||
|
|
// Declares that the authenticated device supports certain features.
|
||
|
|
SetCapabilities(ctx context.Context, in *SetCapabilitiesRequest, opts ...grpc.CallOption) (*SetCapabilitiesResponse, error)
|
||
|
|
}
|
||
|
|
|
||
|
|
type devicesClient struct {
|
||
|
|
cc grpc.ClientConnInterface
|
||
|
|
}
|
||
|
|
|
||
|
|
func NewDevicesClient(cc grpc.ClientConnInterface) DevicesClient {
|
||
|
|
return &devicesClient{cc}
|
||
|
|
}
|
||
|
|
|
||
|
|
func (c *devicesClient) GetDevices(ctx context.Context, in *GetDevicesRequest, opts ...grpc.CallOption) (*GetDevicesResponse, error) {
|
||
|
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||
|
|
out := new(GetDevicesResponse)
|
||
|
|
err := c.cc.Invoke(ctx, Devices_GetDevices_FullMethodName, in, out, cOpts...)
|
||
|
|
if err != nil {
|
||
|
|
return nil, err
|
||
|
|
}
|
||
|
|
return out, nil
|
||
|
|
}
|
||
|
|
|
||
|
|
func (c *devicesClient) RemoveDevice(ctx context.Context, in *RemoveDeviceRequest, opts ...grpc.CallOption) (*RemoveDeviceResponse, error) {
|
||
|
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||
|
|
out := new(RemoveDeviceResponse)
|
||
|
|
err := c.cc.Invoke(ctx, Devices_RemoveDevice_FullMethodName, in, out, cOpts...)
|
||
|
|
if err != nil {
|
||
|
|
return nil, err
|
||
|
|
}
|
||
|
|
return out, nil
|
||
|
|
}
|
||
|
|
|
||
|
|
func (c *devicesClient) SetDeviceName(ctx context.Context, in *SetDeviceNameRequest, opts ...grpc.CallOption) (*SetDeviceNameResponse, error) {
|
||
|
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||
|
|
out := new(SetDeviceNameResponse)
|
||
|
|
err := c.cc.Invoke(ctx, Devices_SetDeviceName_FullMethodName, in, out, cOpts...)
|
||
|
|
if err != nil {
|
||
|
|
return nil, err
|
||
|
|
}
|
||
|
|
return out, nil
|
||
|
|
}
|
||
|
|
|
||
|
|
func (c *devicesClient) SetPushToken(ctx context.Context, in *SetPushTokenRequest, opts ...grpc.CallOption) (*SetPushTokenResponse, error) {
|
||
|
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||
|
|
out := new(SetPushTokenResponse)
|
||
|
|
err := c.cc.Invoke(ctx, Devices_SetPushToken_FullMethodName, in, out, cOpts...)
|
||
|
|
if err != nil {
|
||
|
|
return nil, err
|
||
|
|
}
|
||
|
|
return out, nil
|
||
|
|
}
|
||
|
|
|
||
|
|
func (c *devicesClient) ClearPushToken(ctx context.Context, in *ClearPushTokenRequest, opts ...grpc.CallOption) (*ClearPushTokenResponse, error) {
|
||
|
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||
|
|
out := new(ClearPushTokenResponse)
|
||
|
|
err := c.cc.Invoke(ctx, Devices_ClearPushToken_FullMethodName, in, out, cOpts...)
|
||
|
|
if err != nil {
|
||
|
|
return nil, err
|
||
|
|
}
|
||
|
|
return out, nil
|
||
|
|
}
|
||
|
|
|
||
|
|
func (c *devicesClient) SetCapabilities(ctx context.Context, in *SetCapabilitiesRequest, opts ...grpc.CallOption) (*SetCapabilitiesResponse, error) {
|
||
|
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||
|
|
out := new(SetCapabilitiesResponse)
|
||
|
|
err := c.cc.Invoke(ctx, Devices_SetCapabilities_FullMethodName, in, out, cOpts...)
|
||
|
|
if err != nil {
|
||
|
|
return nil, err
|
||
|
|
}
|
||
|
|
return out, nil
|
||
|
|
}
|
||
|
|
|
||
|
|
// DevicesServer is the server API for Devices service.
|
||
|
|
// All implementations must embed UnimplementedDevicesServer
|
||
|
|
// for forward compatibility.
|
||
|
|
//
|
||
|
|
// Provides methods for working with devices attached to a Signal account.
|
||
|
|
type DevicesServer interface {
|
||
|
|
// Returns a list of devices associated with the caller's account.
|
||
|
|
GetDevices(context.Context, *GetDevicesRequest) (*GetDevicesResponse, error)
|
||
|
|
// Removes a linked device from the caller's account.
|
||
|
|
//
|
||
|
|
// Linked devices may only remove themselves. Primary devices may remove
|
||
|
|
// any device other than themselves.
|
||
|
|
RemoveDevice(context.Context, *RemoveDeviceRequest) (*RemoveDeviceResponse, error)
|
||
|
|
// Sets the encrypted human-readable name for a specific devices. Primary
|
||
|
|
// devices may change the name of any device associated with their account,
|
||
|
|
// but linked devices may only change their own name. The response will
|
||
|
|
// indicate if the target device was not found.
|
||
|
|
SetDeviceName(context.Context, *SetDeviceNameRequest) (*SetDeviceNameResponse, error)
|
||
|
|
// Sets the token(s) the server should use to send new message notifications
|
||
|
|
// to the authenticated device.
|
||
|
|
SetPushToken(context.Context, *SetPushTokenRequest) (*SetPushTokenResponse, error)
|
||
|
|
// Removes any push tokens associated with the authenticated device. After
|
||
|
|
// calling this method, the server will assume that the authenticated device
|
||
|
|
// will periodically poll for new messages.
|
||
|
|
ClearPushToken(context.Context, *ClearPushTokenRequest) (*ClearPushTokenResponse, error)
|
||
|
|
// Declares that the authenticated device supports certain features.
|
||
|
|
SetCapabilities(context.Context, *SetCapabilitiesRequest) (*SetCapabilitiesResponse, error)
|
||
|
|
mustEmbedUnimplementedDevicesServer()
|
||
|
|
}
|
||
|
|
|
||
|
|
// UnimplementedDevicesServer must be embedded to have
|
||
|
|
// forward compatible implementations.
|
||
|
|
//
|
||
|
|
// NOTE: this should be embedded by value instead of pointer to avoid a nil
|
||
|
|
// pointer dereference when methods are called.
|
||
|
|
type UnimplementedDevicesServer struct{}
|
||
|
|
|
||
|
|
func (UnimplementedDevicesServer) GetDevices(context.Context, *GetDevicesRequest) (*GetDevicesResponse, error) {
|
||
|
|
return nil, status.Error(codes.Unimplemented, "method GetDevices not implemented")
|
||
|
|
}
|
||
|
|
func (UnimplementedDevicesServer) RemoveDevice(context.Context, *RemoveDeviceRequest) (*RemoveDeviceResponse, error) {
|
||
|
|
return nil, status.Error(codes.Unimplemented, "method RemoveDevice not implemented")
|
||
|
|
}
|
||
|
|
func (UnimplementedDevicesServer) SetDeviceName(context.Context, *SetDeviceNameRequest) (*SetDeviceNameResponse, error) {
|
||
|
|
return nil, status.Error(codes.Unimplemented, "method SetDeviceName not implemented")
|
||
|
|
}
|
||
|
|
func (UnimplementedDevicesServer) SetPushToken(context.Context, *SetPushTokenRequest) (*SetPushTokenResponse, error) {
|
||
|
|
return nil, status.Error(codes.Unimplemented, "method SetPushToken not implemented")
|
||
|
|
}
|
||
|
|
func (UnimplementedDevicesServer) ClearPushToken(context.Context, *ClearPushTokenRequest) (*ClearPushTokenResponse, error) {
|
||
|
|
return nil, status.Error(codes.Unimplemented, "method ClearPushToken not implemented")
|
||
|
|
}
|
||
|
|
func (UnimplementedDevicesServer) SetCapabilities(context.Context, *SetCapabilitiesRequest) (*SetCapabilitiesResponse, error) {
|
||
|
|
return nil, status.Error(codes.Unimplemented, "method SetCapabilities not implemented")
|
||
|
|
}
|
||
|
|
func (UnimplementedDevicesServer) mustEmbedUnimplementedDevicesServer() {}
|
||
|
|
func (UnimplementedDevicesServer) testEmbeddedByValue() {}
|
||
|
|
|
||
|
|
// 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.
|
||
|
|
type UnsafeDevicesServer interface {
|
||
|
|
mustEmbedUnimplementedDevicesServer()
|
||
|
|
}
|
||
|
|
|
||
|
|
func RegisterDevicesServer(s grpc.ServiceRegistrar, srv DevicesServer) {
|
||
|
|
// If the following call panics, it indicates UnimplementedDevicesServer was
|
||
|
|
// embedded by pointer and is nil. This will cause panics if an
|
||
|
|
// unimplemented method is ever invoked, so we test this at initialization
|
||
|
|
// time to prevent it from happening at runtime later due to I/O.
|
||
|
|
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
|
||
|
|
t.testEmbeddedByValue()
|
||
|
|
}
|
||
|
|
s.RegisterService(&Devices_ServiceDesc, srv)
|
||
|
|
}
|
||
|
|
|
||
|
|
func _Devices_GetDevices_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||
|
|
in := new(GetDevicesRequest)
|
||
|
|
if err := dec(in); err != nil {
|
||
|
|
return nil, err
|
||
|
|
}
|
||
|
|
if interceptor == nil {
|
||
|
|
return srv.(DevicesServer).GetDevices(ctx, in)
|
||
|
|
}
|
||
|
|
info := &grpc.UnaryServerInfo{
|
||
|
|
Server: srv,
|
||
|
|
FullMethod: Devices_GetDevices_FullMethodName,
|
||
|
|
}
|
||
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||
|
|
return srv.(DevicesServer).GetDevices(ctx, req.(*GetDevicesRequest))
|
||
|
|
}
|
||
|
|
return interceptor(ctx, in, info, handler)
|
||
|
|
}
|
||
|
|
|
||
|
|
func _Devices_RemoveDevice_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||
|
|
in := new(RemoveDeviceRequest)
|
||
|
|
if err := dec(in); err != nil {
|
||
|
|
return nil, err
|
||
|
|
}
|
||
|
|
if interceptor == nil {
|
||
|
|
return srv.(DevicesServer).RemoveDevice(ctx, in)
|
||
|
|
}
|
||
|
|
info := &grpc.UnaryServerInfo{
|
||
|
|
Server: srv,
|
||
|
|
FullMethod: Devices_RemoveDevice_FullMethodName,
|
||
|
|
}
|
||
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||
|
|
return srv.(DevicesServer).RemoveDevice(ctx, req.(*RemoveDeviceRequest))
|
||
|
|
}
|
||
|
|
return interceptor(ctx, in, info, handler)
|
||
|
|
}
|
||
|
|
|
||
|
|
func _Devices_SetDeviceName_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||
|
|
in := new(SetDeviceNameRequest)
|
||
|
|
if err := dec(in); err != nil {
|
||
|
|
return nil, err
|
||
|
|
}
|
||
|
|
if interceptor == nil {
|
||
|
|
return srv.(DevicesServer).SetDeviceName(ctx, in)
|
||
|
|
}
|
||
|
|
info := &grpc.UnaryServerInfo{
|
||
|
|
Server: srv,
|
||
|
|
FullMethod: Devices_SetDeviceName_FullMethodName,
|
||
|
|
}
|
||
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||
|
|
return srv.(DevicesServer).SetDeviceName(ctx, req.(*SetDeviceNameRequest))
|
||
|
|
}
|
||
|
|
return interceptor(ctx, in, info, handler)
|
||
|
|
}
|
||
|
|
|
||
|
|
func _Devices_SetPushToken_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||
|
|
in := new(SetPushTokenRequest)
|
||
|
|
if err := dec(in); err != nil {
|
||
|
|
return nil, err
|
||
|
|
}
|
||
|
|
if interceptor == nil {
|
||
|
|
return srv.(DevicesServer).SetPushToken(ctx, in)
|
||
|
|
}
|
||
|
|
info := &grpc.UnaryServerInfo{
|
||
|
|
Server: srv,
|
||
|
|
FullMethod: Devices_SetPushToken_FullMethodName,
|
||
|
|
}
|
||
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||
|
|
return srv.(DevicesServer).SetPushToken(ctx, req.(*SetPushTokenRequest))
|
||
|
|
}
|
||
|
|
return interceptor(ctx, in, info, handler)
|
||
|
|
}
|
||
|
|
|
||
|
|
func _Devices_ClearPushToken_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||
|
|
in := new(ClearPushTokenRequest)
|
||
|
|
if err := dec(in); err != nil {
|
||
|
|
return nil, err
|
||
|
|
}
|
||
|
|
if interceptor == nil {
|
||
|
|
return srv.(DevicesServer).ClearPushToken(ctx, in)
|
||
|
|
}
|
||
|
|
info := &grpc.UnaryServerInfo{
|
||
|
|
Server: srv,
|
||
|
|
FullMethod: Devices_ClearPushToken_FullMethodName,
|
||
|
|
}
|
||
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||
|
|
return srv.(DevicesServer).ClearPushToken(ctx, req.(*ClearPushTokenRequest))
|
||
|
|
}
|
||
|
|
return interceptor(ctx, in, info, handler)
|
||
|
|
}
|
||
|
|
|
||
|
|
func _Devices_SetCapabilities_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||
|
|
in := new(SetCapabilitiesRequest)
|
||
|
|
if err := dec(in); err != nil {
|
||
|
|
return nil, err
|
||
|
|
}
|
||
|
|
if interceptor == nil {
|
||
|
|
return srv.(DevicesServer).SetCapabilities(ctx, in)
|
||
|
|
}
|
||
|
|
info := &grpc.UnaryServerInfo{
|
||
|
|
Server: srv,
|
||
|
|
FullMethod: Devices_SetCapabilities_FullMethodName,
|
||
|
|
}
|
||
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||
|
|
return srv.(DevicesServer).SetCapabilities(ctx, req.(*SetCapabilitiesRequest))
|
||
|
|
}
|
||
|
|
return interceptor(ctx, in, info, handler)
|
||
|
|
}
|
||
|
|
|
||
|
|
// 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)
|
||
|
|
var Devices_ServiceDesc = grpc.ServiceDesc{
|
||
|
|
ServiceName: "org.signal.chat.device.Devices",
|
||
|
|
HandlerType: (*DevicesServer)(nil),
|
||
|
|
Methods: []grpc.MethodDesc{
|
||
|
|
{
|
||
|
|
MethodName: "GetDevices",
|
||
|
|
Handler: _Devices_GetDevices_Handler,
|
||
|
|
},
|
||
|
|
{
|
||
|
|
MethodName: "RemoveDevice",
|
||
|
|
Handler: _Devices_RemoveDevice_Handler,
|
||
|
|
},
|
||
|
|
{
|
||
|
|
MethodName: "SetDeviceName",
|
||
|
|
Handler: _Devices_SetDeviceName_Handler,
|
||
|
|
},
|
||
|
|
{
|
||
|
|
MethodName: "SetPushToken",
|
||
|
|
Handler: _Devices_SetPushToken_Handler,
|
||
|
|
},
|
||
|
|
{
|
||
|
|
MethodName: "ClearPushToken",
|
||
|
|
Handler: _Devices_ClearPushToken_Handler,
|
||
|
|
},
|
||
|
|
{
|
||
|
|
MethodName: "SetCapabilities",
|
||
|
|
Handler: _Devices_SetCapabilities_Handler,
|
||
|
|
},
|
||
|
|
},
|
||
|
|
Streams: []grpc.StreamDesc{},
|
||
|
|
Metadata: "org/signal/chat/device.proto",
|
||
|
|
}
|