Skip to content

Commit

Permalink
separate files
Browse files Browse the repository at this point in the history
  • Loading branch information
Sagleft committed May 12, 2022
1 parent d72fe87 commit efc97e5
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 31 deletions.
31 changes: 0 additions & 31 deletions utopia.go → client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
19 changes: 19 additions & 0 deletions interface.go
Original file line number Diff line number Diff line change
@@ -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)
}
16 changes: 16 additions & 0 deletions structs.go
Original file line number Diff line number Diff line change
@@ -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"`
}

0 comments on commit efc97e5

Please sign in to comment.