-
Notifications
You must be signed in to change notification settings - Fork 349
/
rpc_client_registers.go
58 lines (48 loc) · 2.41 KB
/
rpc_client_registers.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*
* WARNING! All changes made in this file will be lost!
* Created from 'scheme.tl' by 'mtprotoc'
*
* Copyright (c) 2023-present, Teamgram Authors.
* All rights reserved.
*
* Author: Benqi (wubenqi@gmail.com)
*/
package dfs
import (
"reflect"
"github.com/teamgram/proto/mtproto"
)
var _ *mtproto.Bool
type newRPCReplyFunc func() interface{}
type RPCContextTuple struct {
Method string
NewReplyFunc newRPCReplyFunc
}
var rpcContextRegisters = map[string]RPCContextTuple{
"TLDfsWriteFilePartData": RPCContextTuple{"/mtproto.RPCDfs/dfs_writeFilePartData", func() interface{} { return new(mtproto.Bool) }},
"TLDfsUploadPhotoFileV2": RPCContextTuple{"/mtproto.RPCDfs/dfs_uploadPhotoFileV2", func() interface{} { return new(mtproto.Photo) }},
"TLDfsUploadProfilePhotoFileV2": RPCContextTuple{"/mtproto.RPCDfs/dfs_uploadProfilePhotoFileV2", func() interface{} { return new(mtproto.Photo) }},
"TLDfsUploadEncryptedFileV2": RPCContextTuple{"/mtproto.RPCDfs/dfs_uploadEncryptedFileV2", func() interface{} { return new(mtproto.EncryptedFile) }},
"TLDfsDownloadFile": RPCContextTuple{"/mtproto.RPCDfs/dfs_downloadFile", func() interface{} { return new(mtproto.Upload_File) }},
"TLDfsUploadDocumentFileV2": RPCContextTuple{"/mtproto.RPCDfs/dfs_uploadDocumentFileV2", func() interface{} { return new(mtproto.Document) }},
"TLDfsUploadGifDocumentMedia": RPCContextTuple{"/mtproto.RPCDfs/dfs_uploadGifDocumentMedia", func() interface{} { return new(mtproto.Document) }},
"TLDfsUploadMp4DocumentMedia": RPCContextTuple{"/mtproto.RPCDfs/dfs_uploadMp4DocumentMedia", func() interface{} { return new(mtproto.Document) }},
"TLDfsUploadWallPaperFile": RPCContextTuple{"/mtproto.RPCDfs/dfs_uploadWallPaperFile", func() interface{} { return new(mtproto.Document) }},
"TLDfsUploadThemeFile": RPCContextTuple{"/mtproto.RPCDfs/dfs_uploadThemeFile", func() interface{} { return new(mtproto.Document) }},
"TLDfsUploadRingtoneFile": RPCContextTuple{"/mtproto.RPCDfs/dfs_uploadRingtoneFile", func() interface{} { return new(mtproto.Document) }},
}
func FindRPCContextTuple(t interface{}) *RPCContextTuple {
rt := reflect.TypeOf(t)
if rt.Kind() == reflect.Ptr {
rt = rt.Elem()
}
m, ok := rpcContextRegisters[rt.Name()]
if !ok {
// log.Errorf("Can't find name: %s", rt.Name())
return nil
}
return &m
}
func GetRPCContextRegisters() map[string]RPCContextTuple {
return rpcContextRegisters
}