github.com/twilio/twilio-go@v1.20.1/rest/intelligence/v2/model_intelligence_v2_sentence.go (about)

     1  /*
     2   * This code was generated by
     3   * ___ _ _ _ _ _    _ ____    ____ ____ _    ____ ____ _  _ ____ ____ ____ ___ __   __
     4   *  |  | | | | |    | |  | __ |  | |__| | __ | __ |___ |\ | |___ |__/ |__|  | |  | |__/
     5   *  |  |_|_| | |___ | |__|    |__| |  | |    |__] |___ | \| |___ |  \ |  |  | |__| |  \
     6   *
     7   * Twilio - Intelligence
     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  // IntelligenceV2Sentence struct for IntelligenceV2Sentence
    24  type IntelligenceV2Sentence struct {
    25  	// The channel number.
    26  	MediaChannel *int `json:"media_channel,omitempty"`
    27  	// The index of the sentence in the transcript.
    28  	SentenceIndex *int `json:"sentence_index,omitempty"`
    29  	// Offset from the beginning of the transcript when this sentence starts.
    30  	StartTime *float32 `json:"start_time,omitempty"`
    31  	// Offset from the beginning of the transcript when this sentence ends.
    32  	EndTime *float32 `json:"end_time,omitempty"`
    33  	// Transcript text.
    34  	Transcript *string `json:"transcript,omitempty"`
    35  	// A 34 character string that uniquely identifies this Sentence.
    36  	Sid        *string  `json:"sid,omitempty"`
    37  	Confidence *float32 `json:"confidence,omitempty"`
    38  }
    39  
    40  func (response *IntelligenceV2Sentence) UnmarshalJSON(bytes []byte) (err error) {
    41  	raw := struct {
    42  		MediaChannel  *int         `json:"media_channel"`
    43  		SentenceIndex *int         `json:"sentence_index"`
    44  		StartTime     *interface{} `json:"start_time"`
    45  		EndTime       *interface{} `json:"end_time"`
    46  		Transcript    *string      `json:"transcript"`
    47  		Sid           *string      `json:"sid"`
    48  		Confidence    *interface{} `json:"confidence"`
    49  	}{}
    50  
    51  	if err = json.Unmarshal(bytes, &raw); err != nil {
    52  		return err
    53  	}
    54  
    55  	*response = IntelligenceV2Sentence{
    56  		MediaChannel:  raw.MediaChannel,
    57  		SentenceIndex: raw.SentenceIndex,
    58  		Transcript:    raw.Transcript,
    59  		Sid:           raw.Sid,
    60  	}
    61  
    62  	responseStartTime, err := client.UnmarshalFloat32(raw.StartTime)
    63  	if err != nil {
    64  		return err
    65  	}
    66  	response.StartTime = responseStartTime
    67  
    68  	responseEndTime, err := client.UnmarshalFloat32(raw.EndTime)
    69  	if err != nil {
    70  		return err
    71  	}
    72  	response.EndTime = responseEndTime
    73  
    74  	responseConfidence, err := client.UnmarshalFloat32(raw.Confidence)
    75  	if err != nil {
    76  		return err
    77  	}
    78  	response.Confidence = responseConfidence
    79  
    80  	return
    81  }