You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.3 KiB
46 lines
1.3 KiB
|
3 years ago
|
package api
|
||
|
|
|
||
|
|
func (ac *AccountClient) GetCharLimit() int {
|
||
|
|
if ac.Instance != nil {
|
||
|
|
return ac.Instance.Configuration.Statuses.MaxCharacters
|
||
|
|
}
|
||
|
|
if ac.InstanceOld == nil || ac.InstanceOld.Configuration == nil || ac.InstanceOld.Configuration.Statuses == nil {
|
||
|
|
return 500
|
||
|
|
}
|
||
|
|
s := ac.InstanceOld.Configuration.Statuses
|
||
|
|
if val, ok := (*s)["max_characters"]; ok {
|
||
|
|
return val
|
||
|
|
}
|
||
|
|
return 500
|
||
|
|
}
|
||
|
|
|
||
|
|
func (ac *AccountClient) GetLengthURL() int {
|
||
|
|
if ac.Instance != nil {
|
||
|
|
return ac.Instance.Configuration.Statuses.CharactersReservedPerURL
|
||
|
|
}
|
||
|
|
if ac.InstanceOld == nil || ac.InstanceOld.Configuration == nil || ac.InstanceOld.Configuration.Statuses == nil {
|
||
|
|
return 23
|
||
|
|
}
|
||
|
|
s := ac.InstanceOld.Configuration.Statuses
|
||
|
|
if val, ok := (*s)["characters_reserved_per_url"]; ok {
|
||
|
|
return val
|
||
|
|
}
|
||
|
|
return 23
|
||
|
|
}
|
||
|
|
|
||
|
|
func (ac *AccountClient) GetPollOptions() (options, chars int) {
|
||
|
|
if ac.Instance != nil {
|
||
|
|
return ac.Instance.Configuration.Polls.MaxOptions, ac.Instance.Configuration.Polls.MaxCharactersPerOption
|
||
|
|
}
|
||
|
|
if ac.InstanceOld == nil || ac.InstanceOld.Configuration == nil || ac.InstanceOld.Configuration.Polls == nil {
|
||
|
|
return 4, 50
|
||
|
|
}
|
||
|
|
s := ac.InstanceOld.Configuration.Polls
|
||
|
|
opts, okOne := (*s)["max_options"]
|
||
|
|
c, okTwo := (*s)["max_characters_per_option"]
|
||
|
|
if okOne && okTwo {
|
||
|
|
return opts, c
|
||
|
|
}
|
||
|
|
return 4, 50
|
||
|
|
}
|