From efc97e5960209ac895589460b1e20867f633d980 Mon Sep 17 00:00:00 2001 From: Sagleft Date: Fri, 13 May 2022 01:53:00 +0300 Subject: [PATCH] separate files --- utopia.go => client.go | 31 ------------------------------- interface.go | 19 +++++++++++++++++++ structs.go | 16 ++++++++++++++++ 3 files changed, 35 insertions(+), 31 deletions(-) rename utopia.go => client.go (85%) create mode 100644 interface.go create mode 100644 structs.go diff --git a/utopia.go b/client.go similarity index 85% rename from utopia.go rename to client.go index 7d057aa..f3ecdf8 100644 --- a/utopia.go +++ b/client.go @@ -4,37 +4,6 @@ import ( "errors" ) -// Query is a filter for API requests -type Query struct { - Method string `json:"method"` - Token string `json:"token"` - Params map[string]interface{} `json:"params"` -} - -// UtopiaClient lets you connect to Utopia Client -type UtopiaClient struct { - Protocol, Host, Token string - Port int -} - -// UtopiaClientInterface contains an enumeration of methods -type UtopiaClientInterface interface { - apiQuery(methodName string) map[string]interface{} - // profile - GetProfileStatus() map[string]interface{} - GetSystemInfo() map[string]interface{} - GetOwnContact() map[string]interface{} - // crypton - GetBalance() (float64, error) - UseVoucher(voucherCode string) error - GetFinanceHistory() map[string]interface{} - CheckClientConnection() bool - CreateVoucher(amount float64) error - // channels - SendChannelMessage(channelID, message string) (string, error) - SendChannelPicture(channelID, base64Image, comment, filenameForImage string) (string, error) -} - // GetProfileStatus gets data about the status of the current account func (c *UtopiaClient) GetProfileStatus() (map[string]interface{}, error) { return c.apiQuery("getProfileStatus", nil) diff --git a/interface.go b/interface.go new file mode 100644 index 0000000..94c9841 --- /dev/null +++ b/interface.go @@ -0,0 +1,19 @@ +package utopiago + +// UtopiaClientInterface contains an enumeration of methods +type UtopiaClientInterface interface { + apiQuery(methodName string) map[string]interface{} + // profile + GetProfileStatus() map[string]interface{} + GetSystemInfo() map[string]interface{} + GetOwnContact() map[string]interface{} + // crypton + GetBalance() (float64, error) + UseVoucher(voucherCode string) error + GetFinanceHistory() map[string]interface{} + CheckClientConnection() bool + CreateVoucher(amount float64) error + // channels + SendChannelMessage(channelID, message string) (string, error) + SendChannelPicture(channelID, base64Image, comment, filenameForImage string) (string, error) +} diff --git a/structs.go b/structs.go new file mode 100644 index 0000000..62a709d --- /dev/null +++ b/structs.go @@ -0,0 +1,16 @@ +package utopiago + +// Query is a filter for API requests +type Query struct { + Method string `json:"method"` + Token string `json:"token"` + Params map[string]interface{} `json:"params"` +} + +// UtopiaClient lets you connect to Utopia Client +type UtopiaClient struct { + Protocol string `json:"protocol"` + Host string `json:"host"` + Token string `json:"token"` + Port int `json:"port"` +}