Documentation ¶
Index ¶
- Variables
- func DefaultCurrencies() map[string]string
- func FormatCurrencyValue(value float32) string
- func GetCurrencySymbol(code string) string
- func GetEntitySHA1(v interface{}) (hash string, err error)
- func GetMGItemData(client *v1.MgClient, url string, caption string) (v1.Item, int, error)
- func ReplaceMarkdownSymbols(s string) string
- type Utils
- func (u *Utils) GenerateToken() string
- func (u *Utils) GetAPIClient(url, key string, scopes []string, credentials ...[]string) (*retailcrm.Client, int, error)
- func (u *Utils) RemoveTrailingSlash(crmURL string) string
- func (u *Utils) ResetUtils(awsConfig config.AWS, debug bool, tokenCounter uint32)
- func (u *Utils) UploadUserAvatar(url string) (picURLs3 string, err error)
Constants ¶
This section is empty.
Variables ¶
var ( DefaultScopes = []string{ "integration_read", "integration_write", } DefaultCredentials = []string{ "/api/integration-modules/{code}", "/api/integration-modules/{code}/edit", } )
Functions ¶
func DefaultCurrencies ¶
DefaultCurrencies will return default currencies list for all bots.
func FormatCurrencyValue ¶
func GetCurrencySymbol ¶
GetCurrencySymbol returns currency symbol by it's ISO 4127 code. It returns provided currency code in uppercase if currency symbol cannot be found.
func GetEntitySHA1 ¶
GetEntitySHA1 will serialize any value to JSON and return SHA1 hash of this JSON.
func GetMGItemData ¶
GetMGItemData will upload file to MG by URL and return information about attachable item.
func ReplaceMarkdownSymbols ¶
ReplaceMarkdownSymbols will remove markdown symbols from text.
Types ¶
type Utils ¶
type Utils struct { Logger logger.Logger AWS config.AWS TokenCounter uint32 IsDebug bool // contains filtered or unexported fields }
Utils service object.
func (*Utils) GenerateToken ¶
GenerateToken will generate long pseudo-random string.
func (*Utils) GetAPIClient ¶
func (u *Utils) GetAPIClient( url, key string, scopes []string, credentials ...[]string) (*retailcrm.Client, int, error)
GetAPIClient will initialize RetailCRM api client from url and key. Scopes will be used to determine if client is valid. If there are no scopes - credentials will be used instead.
func (*Utils) RemoveTrailingSlash ¶
RemoveTrailingSlash will remove slash at the end of any string.
func (*Utils) ResetUtils ¶
ResetUtils resets the utils inner state.