// Code generated by gotdgen, DO NOT EDIT. package tg import ( "context" "errors" "fmt" "sort" "strings" "go.uber.org/multierr" "go.mau.fi/mautrix-telegram/pkg/gotd/bin" "go.mau.fi/mautrix-telegram/pkg/gotd/tdjson" "go.mau.fi/mautrix-telegram/pkg/gotd/tdp" "go.mau.fi/mautrix-telegram/pkg/gotd/tgerr" ) // No-op definition for keeping imports. var ( _ = bin.Buffer{} _ = context.Background() _ = fmt.Stringer(nil) _ = strings.Builder{} _ = errors.Is _ = multierr.AppendInto _ = sort.Ints _ = tdp.Format _ = tgerr.Error{} _ = tdjson.Encoder{} ) // ContactsGetBirthdaysRequest represents TL type `contacts.getBirthdays#daeda864`. // Fetch all users with birthdays that fall within +1/-1 days, relative to the current // day: this method should be invoked by clients every 6-8 hours, and if the result is // non-empty, it should be used to appropriately update locally cached birthday // information in user¹.birthday. // See here »¹ for more info. // // Links: // 1. https://core.telegram.org/constructor/user // 2. https://core.telegram.org/api/profile#birthday // // See https://core.telegram.org/method/contacts.getBirthdays for reference. type ContactsGetBirthdaysRequest struct { } // ContactsGetBirthdaysRequestTypeID is TL type id of ContactsGetBirthdaysRequest. const ContactsGetBirthdaysRequestTypeID = 0xdaeda864 // Ensuring interfaces in compile-time for ContactsGetBirthdaysRequest. var ( _ bin.Encoder = &ContactsGetBirthdaysRequest{} _ bin.Decoder = &ContactsGetBirthdaysRequest{} _ bin.BareEncoder = &ContactsGetBirthdaysRequest{} _ bin.BareDecoder = &ContactsGetBirthdaysRequest{} ) func (g *ContactsGetBirthdaysRequest) Zero() bool { if g == nil { return true } return true } // String implements fmt.Stringer. func (g *ContactsGetBirthdaysRequest) String() string { if g == nil { return "ContactsGetBirthdaysRequest(nil)" } type Alias ContactsGetBirthdaysRequest return fmt.Sprintf("ContactsGetBirthdaysRequest%+v", Alias(*g)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. func (*ContactsGetBirthdaysRequest) TypeID() uint32 { return ContactsGetBirthdaysRequestTypeID } // TypeName returns name of type in TL schema. func (*ContactsGetBirthdaysRequest) TypeName() string { return "contacts.getBirthdays" } // TypeInfo returns info about TL type. func (g *ContactsGetBirthdaysRequest) TypeInfo() tdp.Type { typ := tdp.Type{ Name: "contacts.getBirthdays", ID: ContactsGetBirthdaysRequestTypeID, } if g == nil { typ.Null = true return typ } typ.Fields = []tdp.Field{} return typ } // Encode implements bin.Encoder. func (g *ContactsGetBirthdaysRequest) Encode(b *bin.Buffer) error { if g == nil { return fmt.Errorf("can't encode contacts.getBirthdays#daeda864 as nil") } b.PutID(ContactsGetBirthdaysRequestTypeID) return g.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. func (g *ContactsGetBirthdaysRequest) EncodeBare(b *bin.Buffer) error { if g == nil { return fmt.Errorf("can't encode contacts.getBirthdays#daeda864 as nil") } return nil } // Decode implements bin.Decoder. func (g *ContactsGetBirthdaysRequest) Decode(b *bin.Buffer) error { if g == nil { return fmt.Errorf("can't decode contacts.getBirthdays#daeda864 to nil") } if err := b.ConsumeID(ContactsGetBirthdaysRequestTypeID); err != nil { return fmt.Errorf("unable to decode contacts.getBirthdays#daeda864: %w", err) } return g.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. func (g *ContactsGetBirthdaysRequest) DecodeBare(b *bin.Buffer) error { if g == nil { return fmt.Errorf("can't decode contacts.getBirthdays#daeda864 to nil") } return nil } // ContactsGetBirthdays invokes method contacts.getBirthdays#daeda864 returning error if any. // Fetch all users with birthdays that fall within +1/-1 days, relative to the current // day: this method should be invoked by clients every 6-8 hours, and if the result is // non-empty, it should be used to appropriately update locally cached birthday // information in user¹.birthday. // See here »¹ for more info. // // Links: // 1. https://core.telegram.org/constructor/user // 2. https://core.telegram.org/api/profile#birthday // // See https://core.telegram.org/method/contacts.getBirthdays for reference. func (c *Client) ContactsGetBirthdays(ctx context.Context) (*ContactsContactBirthdays, error) { var result ContactsContactBirthdays request := &ContactsGetBirthdaysRequest{} if err := c.rpc.Invoke(ctx, request, &result); err != nil { return nil, err } return &result, nil }