github.com/twilio/twilio-go@v1.20.1/rest/api/v2010/model_api_v2010_call_recording.go (about)

     1  /*
     2   * This code was generated by
     3   * ___ _ _ _ _ _    _ ____    ____ ____ _    ____ ____ _  _ ____ ____ ____ ___ __   __
     4   *  |  | | | | |    | |  | __ |  | |__| | __ | __ |___ |\ | |___ |__/ |__|  | |  | |__/
     5   *  |  |_|_| | |___ | |__|    |__| |  | |    |__] |___ | \| |___ |  \ |  |  | |__| |  \
     6   *
     7   * Twilio - Api
     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  // ApiV2010CallRecording struct for ApiV2010CallRecording
    24  type ApiV2010CallRecording struct {
    25  	// The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Recording resource.
    26  	AccountSid *string `json:"account_sid,omitempty"`
    27  	// The API version used to make the recording.
    28  	ApiVersion *string `json:"api_version,omitempty"`
    29  	// The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the Recording resource is associated with.
    30  	CallSid *string `json:"call_sid,omitempty"`
    31  	// The Conference SID that identifies the conference associated with the recording, if a conference recording.
    32  	ConferenceSid *string `json:"conference_sid,omitempty"`
    33  	// The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format.
    34  	DateCreated *string `json:"date_created,omitempty"`
    35  	// The date and time in GMT that the resource was last updated, specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format.
    36  	DateUpdated *string `json:"date_updated,omitempty"`
    37  	// The start time of the recording in GMT and in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format.
    38  	StartTime *string `json:"start_time,omitempty"`
    39  	// The length of the recording in seconds.
    40  	Duration *string `json:"duration,omitempty"`
    41  	// The unique string that that we created to identify the Recording resource.
    42  	Sid *string `json:"sid,omitempty"`
    43  	// The one-time cost of creating the recording in the `price_unit` currency.
    44  	Price *float32 `json:"price,omitempty"`
    45  	// The URI of the resource, relative to `https://api.twilio.com`.
    46  	Uri *string `json:"uri,omitempty"`
    47  	// How to decrypt the recording if it was encrypted using [Call Recording Encryption](https://www.twilio.com/docs/voice/tutorials/voice-recording-encryption) feature.
    48  	EncryptionDetails *interface{} `json:"encryption_details,omitempty"`
    49  	// The currency used in the `price` property. Example: `USD`.
    50  	PriceUnit *string `json:"price_unit,omitempty"`
    51  	Status    *string `json:"status,omitempty"`
    52  	// The number of channels in the final recording file.  Can be: `1`, or `2`. Separating a two leg call into two separate channels of the recording file is supported in [Dial](https://www.twilio.com/docs/voice/twiml/dial#attributes-record) and [Outbound Rest API](https://www.twilio.com/docs/voice/make-calls) record options.
    53  	Channels *int    `json:"channels,omitempty"`
    54  	Source   *string `json:"source,omitempty"`
    55  	// The error code that describes why the recording is `absent`. The error code is described in our [Error Dictionary](https://www.twilio.com/docs/api/errors). This value is null if the recording `status` is not `absent`.
    56  	ErrorCode *int `json:"error_code,omitempty"`
    57  	// The recorded track. Can be: `inbound`, `outbound`, or `both`.
    58  	Track *string `json:"track,omitempty"`
    59  }
    60  
    61  func (response *ApiV2010CallRecording) UnmarshalJSON(bytes []byte) (err error) {
    62  	raw := struct {
    63  		AccountSid        *string      `json:"account_sid"`
    64  		ApiVersion        *string      `json:"api_version"`
    65  		CallSid           *string      `json:"call_sid"`
    66  		ConferenceSid     *string      `json:"conference_sid"`
    67  		DateCreated       *string      `json:"date_created"`
    68  		DateUpdated       *string      `json:"date_updated"`
    69  		StartTime         *string      `json:"start_time"`
    70  		Duration          *string      `json:"duration"`
    71  		Sid               *string      `json:"sid"`
    72  		Price             *interface{} `json:"price"`
    73  		Uri               *string      `json:"uri"`
    74  		EncryptionDetails *interface{} `json:"encryption_details"`
    75  		PriceUnit         *string      `json:"price_unit"`
    76  		Status            *string      `json:"status"`
    77  		Channels          *int         `json:"channels"`
    78  		Source            *string      `json:"source"`
    79  		ErrorCode         *int         `json:"error_code"`
    80  		Track             *string      `json:"track"`
    81  	}{}
    82  
    83  	if err = json.Unmarshal(bytes, &raw); err != nil {
    84  		return err
    85  	}
    86  
    87  	*response = ApiV2010CallRecording{
    88  		AccountSid:        raw.AccountSid,
    89  		ApiVersion:        raw.ApiVersion,
    90  		CallSid:           raw.CallSid,
    91  		ConferenceSid:     raw.ConferenceSid,
    92  		DateCreated:       raw.DateCreated,
    93  		DateUpdated:       raw.DateUpdated,
    94  		StartTime:         raw.StartTime,
    95  		Duration:          raw.Duration,
    96  		Sid:               raw.Sid,
    97  		Uri:               raw.Uri,
    98  		EncryptionDetails: raw.EncryptionDetails,
    99  		PriceUnit:         raw.PriceUnit,
   100  		Status:            raw.Status,
   101  		Channels:          raw.Channels,
   102  		Source:            raw.Source,
   103  		ErrorCode:         raw.ErrorCode,
   104  		Track:             raw.Track,
   105  	}
   106  
   107  	responsePrice, err := client.UnmarshalFloat32(raw.Price)
   108  	if err != nil {
   109  		return err
   110  	}
   111  	response.Price = responsePrice
   112  
   113  	return
   114  }