-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
dezhiShen
authored and
dezhiShen
committed
Oct 22, 2023
1 parent
0bbc7c9
commit cde4188
Showing
18 changed files
with
156 additions
and
157 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
package api | ||
|
||
import ( | ||
"github.com/dezhishen/satori-sdk-go/pkg/client" | ||
"github.com/dezhishen/satori-sdk-go/pkg/config" | ||
) | ||
|
||
type SatoriApi interface { | ||
SatoriChannelApi | ||
SatoriGuildApi | ||
SatoriGuildMemberApi | ||
SatoriGuildRoleApi | ||
SatoriLoginApi | ||
SatoriMessageApi | ||
SatoriReactionApi | ||
SatoriUserApi | ||
} | ||
|
||
type SatoriApiImpl struct { | ||
SatoriChannelApi | ||
SatoriGuildApi | ||
SatoriGuildMemberApi | ||
SatoriGuildRoleApi | ||
SatoriLoginApi | ||
SatoriMessageApi | ||
SatoriReactionApi | ||
SatoriUserApi | ||
} | ||
|
||
func NewSatorApiByConfig(conf config.SatoriConfig) (SatoriApi, error) { | ||
client, err := client.NewApiTemplate(conf.Api) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
channelApi, err := newSatoriChannelApi(client) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
guildApi, err := newSatoriGuildApi(client) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
guildMemberApi, err := newSatoriGuildMemberApi(client) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
guildRoleApi, err := newSatoriGuildRoleApi(client) | ||
if err != nil { | ||
return nil, err | ||
} | ||
loginApi, err := newSatoriLoginApi(client) | ||
if err != nil { | ||
return nil, err | ||
} | ||
messageApi, err := newSatoriMessageApi(client) | ||
if err != nil { | ||
return nil, err | ||
} | ||
reactionApi, err := newSatoriReactionApi(client) | ||
if err != nil { | ||
return nil, err | ||
} | ||
userApi, err := newSatoriUserApi(client) | ||
if err != nil { | ||
return nil, err | ||
} | ||
return &SatoriApiImpl{ | ||
channelApi, | ||
guildApi, | ||
guildMemberApi, | ||
guildRoleApi, | ||
loginApi, | ||
messageApi, | ||
reactionApi, | ||
userApi, | ||
}, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.