github.com/twilio/twilio-go@v1.20.1/rest/supersim/v1/model_supersim_v1_usage_record.go (about) 1 /* 2 * This code was generated by 3 * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ 4 * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ 5 * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ 6 * 7 * Twilio - Supersim 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 // SupersimV1UsageRecord struct for SupersimV1UsageRecord 24 type SupersimV1UsageRecord struct { 25 // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that incurred the usage. 26 AccountSid *string `json:"account_sid,omitempty"` 27 // SID of a Sim resource to which the UsageRecord belongs. Value will only be present when either a value for the `Sim` query parameter is provided or when UsageRecords are grouped by `sim`. Otherwise, the value will be `null`. 28 SimSid *string `json:"sim_sid,omitempty"` 29 // SID of the Network resource the usage occurred on. Value will only be present when either a value for the `Network` query parameter is provided or when UsageRecords are grouped by `network`. Otherwise, the value will be `null`. 30 NetworkSid *string `json:"network_sid,omitempty"` 31 // SID of the Fleet resource the usage occurred on. Value will only be present when either a value for the `Fleet` query parameter is provided or when UsageRecords are grouped by `fleet`. Otherwise, the value will be `null`. 32 FleetSid *string `json:"fleet_sid,omitempty"` 33 // Alpha-2 ISO Country Code that the usage occurred in. Value will only be present when either a value for the `IsoCountry` query parameter is provided or when UsageRecords are grouped by `isoCountry`. Otherwise, the value will be `null`. 34 IsoCountry *string `json:"iso_country,omitempty"` 35 // The time period for which the usage is reported. The period is represented as a pair of `start_time` and `end_time` timestamps specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. 36 Period *interface{} `json:"period,omitempty"` 37 // Total data uploaded in bytes, aggregated by the query parameters. 38 DataUpload *int64 `json:"data_upload,omitempty"` 39 // Total data downloaded in bytes, aggregated by the query parameters. 40 DataDownload *int64 `json:"data_download,omitempty"` 41 // Total of data_upload and data_download. 42 DataTotal *int64 `json:"data_total,omitempty"` 43 // Total amount in the `billed_unit` that was charged for the data uploaded or downloaded. Will return 0 for usage prior to February 1, 2022. Value may be 0 despite `data_total` being greater than 0 if the data usage is still being processed by Twilio's billing system. Refer to [Data Usage Processing](https://www.twilio.com/docs/iot/supersim/api/usage-record-resource#data-usage-processing) for more details. 44 DataTotalBilled *float32 `json:"data_total_billed,omitempty"` 45 // The currency in which the billed amounts are measured, specified in the 3 letter ISO 4127 format (e.g. `USD`, `EUR`, `JPY`). This can be null when data_toal_billed is 0 and we do not yet have billing information for the corresponding data usage. Refer to [Data Usage Processing](https://www.twilio.com/docs/iot/supersim/api/usage-record-resource#data-usage-processing) for more details. 46 BilledUnit *string `json:"billed_unit,omitempty"` 47 } 48 49 func (response *SupersimV1UsageRecord) UnmarshalJSON(bytes []byte) (err error) { 50 raw := struct { 51 AccountSid *string `json:"account_sid"` 52 SimSid *string `json:"sim_sid"` 53 NetworkSid *string `json:"network_sid"` 54 FleetSid *string `json:"fleet_sid"` 55 IsoCountry *string `json:"iso_country"` 56 Period *interface{} `json:"period"` 57 DataUpload *int64 `json:"data_upload"` 58 DataDownload *int64 `json:"data_download"` 59 DataTotal *int64 `json:"data_total"` 60 DataTotalBilled *interface{} `json:"data_total_billed"` 61 BilledUnit *string `json:"billed_unit"` 62 }{} 63 64 if err = json.Unmarshal(bytes, &raw); err != nil { 65 return err 66 } 67 68 *response = SupersimV1UsageRecord{ 69 AccountSid: raw.AccountSid, 70 SimSid: raw.SimSid, 71 NetworkSid: raw.NetworkSid, 72 FleetSid: raw.FleetSid, 73 IsoCountry: raw.IsoCountry, 74 Period: raw.Period, 75 DataUpload: raw.DataUpload, 76 DataDownload: raw.DataDownload, 77 DataTotal: raw.DataTotal, 78 BilledUnit: raw.BilledUnit, 79 } 80 81 responseDataTotalBilled, err := client.UnmarshalFloat32(raw.DataTotalBilled) 82 if err != nil { 83 return err 84 } 85 response.DataTotalBilled = responseDataTotalBilled 86 87 return 88 }