github.com/twilio/twilio-go@v1.20.1/rest/verify/v2/model_verify_v2_verification_attempts_summary.go (about)

     1  /*
     2   * This code was generated by
     3   * ___ _ _ _ _ _    _ ____    ____ ____ _    ____ ____ _  _ ____ ____ ____ ___ __   __
     4   *  |  | | | | |    | |  | __ |  | |__| | __ | __ |___ |\ | |___ |__/ |__|  | |  | |__/
     5   *  |  |_|_| | |___ | |__|    |__| |  | |    |__] |___ | \| |___ |  \ |  |  | |__| |  \
     6   *
     7   * Twilio - Verify
     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  // VerifyV2VerificationAttemptsSummary struct for VerifyV2VerificationAttemptsSummary
    24  type VerifyV2VerificationAttemptsSummary struct {
    25  	// Total of attempts made according to the provided filters
    26  	TotalAttempts *int `json:"total_attempts,omitempty"`
    27  	// Total of  attempts made that were confirmed by the end user, according to the provided filters.
    28  	TotalConverted *int `json:"total_converted,omitempty"`
    29  	// Total of attempts made that were not confirmed by the end user, according to the provided filters.
    30  	TotalUnconverted *int `json:"total_unconverted,omitempty"`
    31  	// Percentage of the confirmed messages over the total, defined by (total_converted/total_attempts)*100.
    32  	ConversionRatePercentage *float32 `json:"conversion_rate_percentage,omitempty"`
    33  	Url                      *string  `json:"url,omitempty"`
    34  }
    35  
    36  func (response *VerifyV2VerificationAttemptsSummary) UnmarshalJSON(bytes []byte) (err error) {
    37  	raw := struct {
    38  		TotalAttempts            *int         `json:"total_attempts"`
    39  		TotalConverted           *int         `json:"total_converted"`
    40  		TotalUnconverted         *int         `json:"total_unconverted"`
    41  		ConversionRatePercentage *interface{} `json:"conversion_rate_percentage"`
    42  		Url                      *string      `json:"url"`
    43  	}{}
    44  
    45  	if err = json.Unmarshal(bytes, &raw); err != nil {
    46  		return err
    47  	}
    48  
    49  	*response = VerifyV2VerificationAttemptsSummary{
    50  		TotalAttempts:    raw.TotalAttempts,
    51  		TotalConverted:   raw.TotalConverted,
    52  		TotalUnconverted: raw.TotalUnconverted,
    53  		Url:              raw.Url,
    54  	}
    55  
    56  	responseConversionRatePercentage, err := client.UnmarshalFloat32(raw.ConversionRatePercentage)
    57  	if err != nil {
    58  		return err
    59  	}
    60  	response.ConversionRatePercentage = responseConversionRatePercentage
    61  
    62  	return
    63  }