// Code generated by gotdgen, DO NOT EDIT.

package tg

import (
	
	
	
	
	

	

	
	
	
	
)

// 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{}
)

// PaymentsGetStarsRevenueAdsAccountURLRequest represents TL type `payments.getStarsRevenueAdsAccountUrl#d1d7efc5`.
// Returns a URL for a Telegram Ad platform account that can be used to set up
// advertisements for channel/bot in peer, paid using the Telegram Stars owned by the
// specified peer, see here »¹ for more info.
//
// Links:
//  1. https://core.telegram.org/api/stars#paying-for-ads
//
// See https://core.telegram.org/method/payments.getStarsRevenueAdsAccountUrl for reference.
type PaymentsGetStarsRevenueAdsAccountURLRequest struct {
	// Channel or bot that owns the stars.
	Peer InputPeerClass
}

// PaymentsGetStarsRevenueAdsAccountURLRequestTypeID is TL type id of PaymentsGetStarsRevenueAdsAccountURLRequest.
const PaymentsGetStarsRevenueAdsAccountURLRequestTypeID = 0xd1d7efc5

// Ensuring interfaces in compile-time for PaymentsGetStarsRevenueAdsAccountURLRequest.
var (
	_ bin.Encoder     = &PaymentsGetStarsRevenueAdsAccountURLRequest{}
	_ bin.Decoder     = &PaymentsGetStarsRevenueAdsAccountURLRequest{}
	_ bin.BareEncoder = &PaymentsGetStarsRevenueAdsAccountURLRequest{}
	_ bin.BareDecoder = &PaymentsGetStarsRevenueAdsAccountURLRequest{}
)

func ( *PaymentsGetStarsRevenueAdsAccountURLRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Peer == nil) {
		return false
	}

	return true
}

// String implements fmt.Stringer.
func ( *PaymentsGetStarsRevenueAdsAccountURLRequest) () string {
	if  == nil {
		return "PaymentsGetStarsRevenueAdsAccountURLRequest(nil)"
	}
	type  PaymentsGetStarsRevenueAdsAccountURLRequest
	return fmt.Sprintf("PaymentsGetStarsRevenueAdsAccountURLRequest%+v", (*))
}

// FillFrom fills PaymentsGetStarsRevenueAdsAccountURLRequest from given interface.
func ( *PaymentsGetStarsRevenueAdsAccountURLRequest) ( interface {
	() ( InputPeerClass)
}) {
	.Peer = .()
}

// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*PaymentsGetStarsRevenueAdsAccountURLRequest) () uint32 {
	return PaymentsGetStarsRevenueAdsAccountURLRequestTypeID
}

// TypeName returns name of type in TL schema.
func (*PaymentsGetStarsRevenueAdsAccountURLRequest) () string {
	return "payments.getStarsRevenueAdsAccountUrl"
}

// TypeInfo returns info about TL type.
func ( *PaymentsGetStarsRevenueAdsAccountURLRequest) () tdp.Type {
	 := tdp.Type{
		Name: "payments.getStarsRevenueAdsAccountUrl",
		ID:   PaymentsGetStarsRevenueAdsAccountURLRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Peer",
			SchemaName: "peer",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *PaymentsGetStarsRevenueAdsAccountURLRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode payments.getStarsRevenueAdsAccountUrl#d1d7efc5 as nil")
	}
	.PutID(PaymentsGetStarsRevenueAdsAccountURLRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *PaymentsGetStarsRevenueAdsAccountURLRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode payments.getStarsRevenueAdsAccountUrl#d1d7efc5 as nil")
	}
	if .Peer == nil {
		return fmt.Errorf("unable to encode payments.getStarsRevenueAdsAccountUrl#d1d7efc5: field peer is nil")
	}
	if  := .Peer.Encode();  != nil {
		return fmt.Errorf("unable to encode payments.getStarsRevenueAdsAccountUrl#d1d7efc5: field peer: %w", )
	}
	return nil
}

// Decode implements bin.Decoder.
func ( *PaymentsGetStarsRevenueAdsAccountURLRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode payments.getStarsRevenueAdsAccountUrl#d1d7efc5 to nil")
	}
	if  := .ConsumeID(PaymentsGetStarsRevenueAdsAccountURLRequestTypeID);  != nil {
		return fmt.Errorf("unable to decode payments.getStarsRevenueAdsAccountUrl#d1d7efc5: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *PaymentsGetStarsRevenueAdsAccountURLRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode payments.getStarsRevenueAdsAccountUrl#d1d7efc5 to nil")
	}
	{
		,  := DecodeInputPeer()
		if  != nil {
			return fmt.Errorf("unable to decode payments.getStarsRevenueAdsAccountUrl#d1d7efc5: field peer: %w", )
		}
		.Peer = 
	}
	return nil
}

// GetPeer returns value of Peer field.
func ( *PaymentsGetStarsRevenueAdsAccountURLRequest) () ( InputPeerClass) {
	if  == nil {
		return
	}
	return .Peer
}

// PaymentsGetStarsRevenueAdsAccountURL invokes method payments.getStarsRevenueAdsAccountUrl#d1d7efc5 returning error if any.
// Returns a URL for a Telegram Ad platform account that can be used to set up
// advertisements for channel/bot in peer, paid using the Telegram Stars owned by the
// specified peer, see here »¹ for more info.
//
// Links:
//  1. https://core.telegram.org/api/stars#paying-for-ads
//
// Possible errors:
//
//	403 CHAT_WRITE_FORBIDDEN: You can't write in this chat.
//	400 PEER_ID_INVALID: The provided peer id is invalid.
//
// See https://core.telegram.org/method/payments.getStarsRevenueAdsAccountUrl for reference.
func ( *Client) ( context.Context,  InputPeerClass) (*PaymentsStarsRevenueAdsAccountURL, error) {
	var  PaymentsStarsRevenueAdsAccountURL

	 := &PaymentsGetStarsRevenueAdsAccountURLRequest{
		Peer: ,
	}
	if  := .rpc.Invoke(, , &);  != nil {
		return nil, 
	}
	return &, nil
}