@@ -3,61 +3,61 @@ package botsfwmodels
3
3
// BotRecordsMaker is an interface for making bot records
4
4
// This should be implemented by platform adapters
5
5
// (for example, by https://github.com/bots-go-framework/bots-fw-telegram)
6
- type BotRecordsMaker interface {
7
- Platform () string
8
-
9
- // MakeAppUserDto makes app user DTO for a given request sender
10
- MakeAppUserDto (botID string ) (AppUserData , error )
11
-
12
- // MakeBotUserDto makes bot user DTO for a given request sender
13
- MakeBotUserDto (botID string ) (PlatformUserData , error )
14
-
15
- // MakeBotChatDto makes bot chat DTO for a given request
16
- MakeBotChatDto (botID string ) (BotChatData , error )
17
- }
18
-
19
- func NewBotRecordsMaker (
20
- platform string ,
21
- makeAppUserDto func (botID string ) (appUser AppUserData , err error ),
22
- makeBotUserDto func (botID string ) (botUser PlatformUserData , err error ),
23
- makeBotChatDto func (botID string ) (botChat BotChatData , err error ),
24
- ) BotRecordsMaker {
25
- if makeAppUserDto == nil {
26
- panic ("makeAppUserDto is nil" )
27
- }
28
- if makeBotUserDto == nil {
29
- panic ("makeBotUserDto is nil" )
30
- }
31
- if makeBotChatDto == nil {
32
- panic ("makeBotChatDto is nil" )
33
- }
34
- return botRecordsMaker {
35
- platform : platform ,
36
- makeAppUserDto : makeAppUserDto ,
37
- makeBotUserDto : makeBotUserDto ,
38
- makeBotChatDto : makeBotChatDto ,
39
- }
40
- }
41
-
42
- type botRecordsMaker struct {
43
- platform string
44
- makeAppUserDto func (botID string ) (AppUserData , error )
45
- makeBotUserDto func (botID string ) (PlatformUserData , error )
46
- makeBotChatDto func (botID string ) (botChat BotChatData , err error )
47
- }
48
-
49
- func (b botRecordsMaker ) Platform () string {
50
- return b .platform
51
- }
52
-
53
- func (b botRecordsMaker ) MakeAppUserDto (botID string ) (AppUserData , error ) {
54
- return b .makeAppUserDto (botID )
55
- }
56
-
57
- func (b botRecordsMaker ) MakeBotUserDto (botID string ) (PlatformUserData , error ) {
58
- return b .makeBotUserDto (botID )
59
- }
60
-
61
- func (b botRecordsMaker ) MakeBotChatDto (botID string ) (botChat BotChatData , err error ) {
62
- return b .makeBotChatDto (botID )
63
- }
6
+ // type BotRecordsMaker interface {
7
+ // Platform() string
8
+ //
9
+ // // MakeAppUserDto makes app user DTO for a given request sender
10
+ // MakeAppUserDto(botID string) (AppUserData, error)
11
+ //
12
+ // // MakeBotUserDto makes bot user DTO for a given request sender
13
+ // MakeBotUserDto(botID string) (PlatformUserData, error)
14
+ //
15
+ // // MakeBotChatDto makes bot chat DTO for a given request
16
+ // MakeBotChatDto(botID string) (BotChatData, error)
17
+ // }
18
+ //
19
+ // func NewBotRecordsMaker(
20
+ // platform string,
21
+ // makeAppUserDto func(botID string) (appUser AppUserData, err error),
22
+ // makeBotUserDto func(botID string) (botUser PlatformUserData, err error),
23
+ // makeBotChatDto func(botID string) (botChat BotChatData, err error),
24
+ // ) BotRecordsMaker {
25
+ // if makeAppUserDto == nil {
26
+ // panic("makeAppUserDto is nil")
27
+ // }
28
+ // if makeBotUserDto == nil {
29
+ // panic("makeBotUserDto is nil")
30
+ // }
31
+ // if makeBotChatDto == nil {
32
+ // panic("makeBotChatDto is nil")
33
+ // }
34
+ // return botRecordsMaker{
35
+ // platform: platform,
36
+ // makeAppUserDto: makeAppUserDto,
37
+ // makeBotUserDto: makeBotUserDto,
38
+ // makeBotChatDto: makeBotChatDto,
39
+ // }
40
+ // }
41
+ //
42
+ // type botRecordsMaker struct {
43
+ // platform string
44
+ // makeAppUserDto func(botID string) (AppUserData, error)
45
+ // makeBotUserDto func(botID string) (PlatformUserData, error)
46
+ // makeBotChatDto func(botID string) (botChat BotChatData, err error)
47
+ // }
48
+ //
49
+ // func (b botRecordsMaker) Platform() string {
50
+ // return b.platform
51
+ // }
52
+ //
53
+ // func (b botRecordsMaker) MakeAppUserDto(botID string) (AppUserData, error) {
54
+ // return b.makeAppUserDto(botID)
55
+ // }
56
+ //
57
+ // func (b botRecordsMaker) MakeBotUserDto(botID string) (PlatformUserData, error) {
58
+ // return b.makeBotUserDto(botID)
59
+ // }
60
+ //
61
+ // func (b botRecordsMaker) MakeBotChatDto(botID string) (botChat BotChatData, err error) {
62
+ // return b.makeBotChatDto(botID)
63
+ // }
0 commit comments