Gift Bound Methods ​
When a *types.Gift is obtained from the client, it has bound convenience methods for managing that gift.
go
gifts, _ := client.GetGifts(ctx)
gift := gifts[0]
gift.Show() // unhide the gift
gift.Transfer(toID) // transfer to another userAll methods return ErrNoBinder if the Gift was not created by a client.
Show ​
Make this gift visible in the chat.
go
func (g *Gift) Show() errorExample:
go
err := gift.Show()Hide ​
Hide this gift from the chat.
go
func (g *Gift) Hide() errorConvert ​
Convert this star gift to stars.
go
func (g *Gift) Convert() errorExample:
go
err := gift.Convert()Upgrade ​
Upgrade this gift (e.g. to a unique gift).
go
func (g *Gift) Upgrade(keepOriginalDetails bool) errorParameters:
| Parameter | Type | Description |
|---|---|---|
| keepOriginalDetails | bool | Whether to preserve original gift details |
Example:
go
err := gift.Upgrade(true)Transfer ​
Transfer this gift to another user.
go
func (g *Gift) Transfer(toID int64) errorParameters:
| Parameter | Type | Description |
|---|---|---|
| toID | int64 | The user ID to transfer the gift to |
Example:
go
err := gift.Transfer(targetUserID)