github.com/tada-team/tdproto@v1.51.57/integrations.go (about)

     1  package tdproto
     2  
     3  // Integration form field
     4  type IntegrationField struct {
     5  	// Label
     6  	Label string `json:"label"`
     7  
     8  	// Is field readonly
     9  	Readonly bool `json:"readonly"`
    10  
    11  	// Current value
    12  	Value string `json:"value"`
    13  }
    14  
    15  // Integration form
    16  type IntegrationForm struct {
    17  	// Api key field, if any
    18  	ApiKey *IntegrationField `json:"api_key,omitempty"`
    19  
    20  	// Webhook url, if any
    21  	WebhookUrl *IntegrationField `json:"webhook_url,omitempty"`
    22  
    23  	// Url, if any
    24  	Url *IntegrationField `json:"url,omitempty"`
    25  }
    26  
    27  // Integration for concrete chat
    28  type Integration struct {
    29  	// Id
    30  	Uid string `json:"uid,omitempty"`
    31  
    32  	// Comment, if any
    33  	Comment string `json:"comment"`
    34  
    35  	// Creation datetime, iso
    36  	Created ISODateTimeString `json:"created,omitempty"`
    37  
    38  	// Integration enabled
    39  	Enabled bool `json:"enabled"`
    40  
    41  	// Integration form
    42  	Form IntegrationForm `json:"form"`
    43  
    44  	// Chat id
    45  	Group JID `json:"group"`
    46  
    47  	// Full description
    48  	Help string `json:"help,omitempty"`
    49  
    50  	// Unique integration name
    51  	Kind string `json:"kind"`
    52  
    53  	Title string `json:"-"`
    54  }
    55  
    56  // Integration kind
    57  type IntegrationKind struct {
    58  	// Integration unique name
    59  	Kind string `json:"kind"`
    60  
    61  	// Plugin title
    62  	Title string `json:"title"`
    63  
    64  	// Integration template
    65  	Template Integration `json:"template"`
    66  
    67  	// Path to icon
    68  	Icon string `json:"icon"`
    69  
    70  	// Plugin description
    71  	Description string `json:"description"`
    72  }
    73  
    74  // Complete integrations data, as received from server
    75  type Integrations struct {
    76  	// Currently existing integrations
    77  	Integrations []Integration `json:"integrations"`
    78  	// Types of integrations available for setup
    79  	Kinds []IntegrationKind `json:"kinds"`
    80  }