github.com/twilio/twilio-go@v1.20.1/rest/content/v1/model_whatsapp_authentication.go (about)

     1  /*
     2   * This code was generated by
     3   * ___ _ _ _ _ _    _ ____    ____ ____ _    ____ ____ _  _ ____ ____ ____ ___ __   __
     4   *  |  | | | | |    | |  | __ |  | |__| | __ | __ |___ |\ | |___ |__/ |__|  | |  | |__/
     5   *  |  |_|_| | |___ | |__|    |__| |  | |    |__] |___ | \| |___ |  \ |  |  | |__| |  \
     6   *
     7   * Twilio - Content
     8   * This is the public Twilio REST API.
     9   *
    10   * NOTE: This class is auto generated by OpenAPI Generator.
    11   * https://openapi-generator.tech
    12   * Do not edit the class manually.
    13   */
    14  
    15  package openapi
    16  
    17  import (
    18  	"encoding/json"
    19  
    20  	"github.com/twilio/twilio-go/client"
    21  )
    22  
    23  // WhatsappAuthentication whatsApp/authentication templates let companies deliver WA approved one-time-password button.
    24  type WhatsappAuthentication struct {
    25  	AddSecurityRecommendation bool                   `json:"add_security_recommendation,omitempty"`
    26  	CodeExpirationMinutes     float32                `json:"code_expiration_minutes,omitempty"`
    27  	Actions                   []AuthenticationAction `json:"actions"`
    28  }
    29  
    30  func (response *WhatsappAuthentication) UnmarshalJSON(bytes []byte) (err error) {
    31  	raw := struct {
    32  		AddSecurityRecommendation bool                   `json:"add_security_recommendation"`
    33  		CodeExpirationMinutes     interface{}            `json:"code_expiration_minutes"`
    34  		Actions                   []AuthenticationAction `json:"actions"`
    35  	}{}
    36  
    37  	if err = json.Unmarshal(bytes, &raw); err != nil {
    38  		return err
    39  	}
    40  
    41  	*response = WhatsappAuthentication{
    42  		AddSecurityRecommendation: raw.AddSecurityRecommendation,
    43  		Actions:                   raw.Actions,
    44  	}
    45  
    46  	responseCodeExpirationMinutes, err := client.UnmarshalFloat32(&raw.CodeExpirationMinutes)
    47  	if err != nil {
    48  		return err
    49  	}
    50  	response.CodeExpirationMinutes = *responseCodeExpirationMinutes
    51  
    52  	return
    53  }