account.toggleUsername
Activate or deactivate a purchased fragment.com username associated to the currently logged-in user.
func (c *Client) AccountToggleUsername(ctx context.Context, request *AccountToggleUsernameRequest) (bool, error)
Calling this method
client.Run(ctx, func(ctx context.Context) error {
api := client.API()
res, err := api.AccountToggleUsername(ctx, &tg.AccountToggleUsernameRequest{
// see Parameters
})
if err != nil {
return err
}
_ = res // bool
return nil
})
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
Username | string | yes | Username |
Active | bool | yes | Whether to activate or deactivate it |
Returns
bool
Possible errors
| Code | Type | Description |
|---|---|---|
| 400 | USERNAMES_ACTIVE_TOO_MUCH | The maximum number of active usernames was reached. |
| 400 | USERNAME_INVALID | The provided username is not valid. |
| 400 | USERNAME_NOT_MODIFIED | The username was not modified. |
References
- Official documentation
- Generated Go reference
- TL definition:
account.toggleUsername#58d6b376