From f65de7fb3b34c5e39e9085f69da1f55bfd507cd7 Mon Sep 17 00:00:00 2001 From: Anindya Mahajan <109207212+anindya-plivo@users.noreply.github.com> Date: Wed, 31 May 2023 14:38:08 +0530 Subject: [PATCH] Added new recording params and filter (#172) * Added params * Updated UTs * changed version * changes * response json fix * fixed filter names * removed add_time from recording filters * fixed limit and offset params for recording struct --- CHANGELOG.md | 5 +++ baseclient.go | 2 +- fixtures/recordingGetResponse.json | 6 ++- fixtures/recordingListResponse.json | 18 ++++++-- recordings.go | 64 ++++++++++++++++------------- 5 files changed, 62 insertions(+), 33 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 012ba339..ecf9dfe7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Change Log +## [7.29.0](https://github.com/plivo/plivo-java/tree/v7.29.0) (2023-05-29) +**Feature - Recording API changes** +- Added `monthly_recording_storage_amount`, `recording_storage_rate`, `rounded_recording_duration`, and `recording_storage_duration` parameters to the response for [get single recording API](https://www.plivo.com/docs/voice/api/recording#retrieve-a-recording) and [get all recordings API](https://www.plivo.com/docs/voice/api/recording#list-all-recordings) +- Added `recording_storage_duration` parameter as a filter option for [get all recordings API](https://www.plivo.com/docs/voice/api/recording#list-all-recordings) + ## [7.28.0](https://github.com/plivo/plivo-go/tree/v7.28.0) (2023-05-04) **Feature - Added New Param 'renewalDate' in Get Number and List Numbers APIs** - Add New Param `renewalDate` to the response of the [list all numbers API], [list single number API] diff --git a/baseclient.go b/baseclient.go index b10b3ba1..b0c98505 100644 --- a/baseclient.go +++ b/baseclient.go @@ -13,7 +13,7 @@ import ( "github.com/google/go-querystring/query" ) -const sdkVersion = "7.28.0" +const sdkVersion = "7.29.0" const lookupBaseUrl = "lookup.plivo.com" diff --git a/fixtures/recordingGetResponse.json b/fixtures/recordingGetResponse.json index 8bb70ce1..3870e5e4 100644 --- a/fixtures/recordingGetResponse.json +++ b/fixtures/recordingGetResponse.json @@ -10,5 +10,9 @@ "recording_start_ms": "1407235163907.00000", "recording_type": "conference", "recording_url": "http://s3.amazonaws.com/recordings_2013/c2186400-1c8c-11e4-a664-0026b945b52x.mp3", - "resource_uri": "/v1/Account/MANWVLYTK4ZWU1YTY4ZT/Recording/c2186400-1c8c-11e4-a664-0026b945b52x/" + "resource_uri": "/v1/Account/MANWVLYTK4ZWU1YTY4ZT/Recording/c2186400-1c8c-11e4-a664-0026b945b52x/", + "monthly_recording_storage_amount": 0.0008, + "rounded_recording_duration": 120, + "recording_storage_duration": 209, + "recording_storage_rate": 0.0004 } diff --git a/fixtures/recordingListResponse.json b/fixtures/recordingListResponse.json index 54ecd564..c6d29897 100644 --- a/fixtures/recordingListResponse.json +++ b/fixtures/recordingListResponse.json @@ -19,7 +19,11 @@ "recording_start_ms": "1407235163907.00000", "recording_type": "conference", "recording_url": "http://s3.amazonaws.com/recordings_2013/c2186400-1c8c-1124-a664-0026b945b522.mp3", - "resource_uri": "/v1/Account/MANWVLYTK4ZWU1YTY4ZT/Recording/c2186400-1c8c-1124-a664-0026b945b522/" + "resource_uri": "/v1/Account/MANWVLYTK4ZWU1YTY4ZT/Recording/c2186400-1c8c-1124-a664-0026b945b522/", + "monthly_recording_storage_amount": 0.0008, + "rounded_recording_duration": 120, + "recording_storage_duration": 209, + "recording_storage_rate": 0.0004 }, { "add_time": "2014-08-05 16:05:21.993853+05:30", @@ -32,7 +36,11 @@ "recording_start_ms": "1407234829553.00000", "recording_type": "conference", "recording_url": "http://s3.amazonaws.com/recordings_2013/fc2716b0-1c8b-11e4-bwad-842b2b17453e.mp3", - "resource_uri": "/v1/Account/MANWVLYTK4ZWU1YTY4ZT/Recording/fc2716b0-1c8b-11e4-bwad-842b2b17453e/" + "resource_uri": "/v1/Account/MANWVLYTK4ZWU1YTY4ZT/Recording/fc2716b0-1c8b-11e4-bwad-842b2b17453e/", + "monthly_recording_storage_amount": 0.0008, + "rounded_recording_duration": 120, + "recording_storage_duration": 209, + "recording_storage_rate": 0.0004 }, { "add_time": "2014-08-05 15:51:56.582492+05:30", @@ -45,7 +53,11 @@ "recording_start_ms": "1407234081443.00000", "recording_type": "conference", "recording_url": "http://s3.amazonaws.com/recordings_2013/3e701c9e-1c8a-11e4-bwad-842b2b17453e.mp3", - "resource_uri": "/v1/Account/MANWVLYTK4ZWU1YTY4ZT/Recording/3e701c9e-1c8a-11e4-bwad-842b2b17453e/" + "resource_uri": "/v1/Account/MANWVLYTK4ZWU1YTY4ZT/Recording/3e701c9e-1c8a-11e4-bwad-842b2b17453e/", + "monthly_recording_storage_amount": 0.0008, + "rounded_recording_duration": 120, + "recording_storage_duration": 209, + "recording_storage_rate": 0.0004 } ] } diff --git a/recordings.go b/recordings.go index abeb3755..8b8e4acc 100644 --- a/recordings.go +++ b/recordings.go @@ -5,38 +5,46 @@ type RecordingService struct { } type Recording struct { - AddTime string `json:"add_time,omitempty" url:"add_time,omitempty"` - CallUUID string `json:"call_uuid,omitempty" url:"call_uuid,omitempty"` - RecordingID string `json:"recording_id,omitempty" url:"recording_id,omitempty"` - RecordingType string `json:"recording_type,omitempty" url:"recording_type,omitempty"` - RecordingFormat string `json:"recording_format,omitempty" url:"recording_format,omitempty"` - ConferenceName string `json:"conference_name,omitempty" url:"conference_name,omitempty"` - RecordingURL string `json:"recording_url,omitempty" url:"recording_url,omitempty"` - ResourceURI string `json:"resource_uri,omitempty" url:"resource_uri,omitempty"` - RecordingStartMS string `json:"recording_start_ms,omitempty" url:"recording_start_ms,omitempty"` - RecordingEndMS string `json:"recording_end_ms,omitempty" url:"recording_end_ms,omitempty"` - RecordingDurationMS string `json:"recording_duration_ms,omitempty" url:"recording_duration_ms,omitempty"` - FromNumber string `json:"from_number,omitempty" url:"from_number,omitempty"` - ToNumber string `json:"to_number,omitempty" url:"to_number,omitempty"` + AddTime string `json:"add_time,omitempty" url:"add_time,omitempty"` + CallUUID string `json:"call_uuid,omitempty" url:"call_uuid,omitempty"` + MonthlyRecordingStorageAmount float64 `json:"monthly_recording_storage_amount,omitempty" url:"monthly_recording_storage_amount,omitempty"` + RecordingStorageDuration int64 `json:"recording_storage_duration,omitempty" url:"recording_storage_duration,omitempty"` + RecordingStorageRate float64 `json:"recording_storage_rate,omitempty" url:"recording_storage_rate,omitempty"` + RecordingID string `json:"recording_id,omitempty" url:"recording_id,omitempty"` + RecordingType string `json:"recording_type,omitempty" url:"recording_type,omitempty"` + RecordingFormat string `json:"recording_format,omitempty" url:"recording_format,omitempty"` + ConferenceName string `json:"conference_name,omitempty" url:"conference_name,omitempty"` + RecordingURL string `json:"recording_url,omitempty" url:"recording_url,omitempty"` + ResourceURI string `json:"resource_uri,omitempty" url:"resource_uri,omitempty"` + RecordingStartMS string `json:"recording_start_ms,omitempty" url:"recording_start_ms,omitempty"` + RecordingEndMS string `json:"recording_end_ms,omitempty" url:"recording_end_ms,omitempty"` + RecordingDurationMS string `json:"recording_duration_ms,omitempty" url:"recording_duration_ms,omitempty"` + RoundedRecordingDuration int64 `json:"rounded_recording_duration,omitempty" url:"rounded_recording_duration,omitempty"` + FromNumber string `json:"from_number,omitempty" url:"from_number,omitempty"` + ToNumber string `json:"to_number,omitempty" url:"to_number,omitempty"` } type RecordingListParams struct { // Query parameters. - Subaccount string `json:"subaccount,omitempty" url:"subaccount,omitempty"` - CallUUID string `json:"call_uuid,omitempty" url:"call_uuid,omitempty"` - AddTimeEquals string `json:"add_time,omitempty" url:"add_time,omitempty"` - AddTimeLessThan string `json:"add_time__lt,omitempty" url:"add_time__lt,omitempty"` - AddTimeGreaterThan string `json:"add_time__gt,omitempty" url:"add_time__gt,omitempty"` - AddTimeLessOrEqual string `json:"add_time__lte,omitempty" url:"add_time__lte,omitempty"` - AddTimeGreaterOrEqual string `json:"add_time__gte,omitempty" url:"add_time__gte,omitempty"` - Limit int64 `json:"limit:omitempty" url:"limit:omitempty"` - Offset int64 `json:"offset:omitempty" url:"offset:omitempty"` - FromNumber string `json:"from_number,omitempty" url:"from_number,omitempty"` - ToNumber string `json:"to_number,omitempty" url:"to_number,omitempty"` - ConferenceName string `json:"conference_name,omitempty" url:"conference_name,omitempty"` - MpcName string `json:"mpc_name,omitempty" url:"mpc_name,omitempty"` - ConferenceUuid string `json:"conference_uuid,omitempty" url:"conference_uuid,omitempty"` - MpcUuid string `json:"mpc_uuid,omitempty" url:"mpc_uuid,omitempty"` + Subaccount string `json:"subaccount,omitempty" url:"subaccount,omitempty"` + CallUUID string `json:"call_uuid,omitempty" url:"call_uuid,omitempty"` + AddTimeLessThan string `json:"add_time__lt,omitempty" url:"add_time__lt,omitempty"` + AddTimeGreaterThan string `json:"add_time__gt,omitempty" url:"add_time__gt,omitempty"` + AddTimeLessOrEqual string `json:"add_time__lte,omitempty" url:"add_time__lte,omitempty"` + AddTimeGreaterOrEqual string `json:"add_time__gte,omitempty" url:"add_time__gte,omitempty"` + Limit int64 `json:"limit,omitempty" url:"limit,omitempty"` + Offset int64 `json:"offset,omitempty" url:"offset,omitempty"` + FromNumber string `json:"from_number,omitempty" url:"from_number,omitempty"` + ToNumber string `json:"to_number,omitempty" url:"to_number,omitempty"` + ConferenceName string `json:"conference_name,omitempty" url:"conference_name,omitempty"` + MpcName string `json:"mpc_name,omitempty" url:"mpc_name,omitempty"` + ConferenceUuid string `json:"conference_uuid,omitempty" url:"conference_uuid,omitempty"` + MpcUuid string `json:"mpc_uuid,omitempty" url:"mpc_uuid,omitempty"` + RecordingStorageDurationEquals int64 `json:"recording_storage_duration,omitempty" url:"recording_storage_duration,omitempty"` + RecordingStorageDurationLessThan int64 `json:"recording_storage_duration__lt,omitempty" url:"recording_storage_duration__lt,omitempty"` + RecordingStorageDurationGreaterThan int64 `json:"recording_storage_duration__gt,omitempty" url:"recording_storage_duration__gt,omitempty"` + RecordingStorageDurationLessOrEqual int64 `json:"recording_storage_duration__lte,omitempty" url:"recording_storage_duration__lte,omitempty"` + RecordingStorageDurationGreaterOrEqual int64 `json:"recording_storage_duration__gte,omitempty" url:"recording_storage_duration__gte,omitempty"` } type RecordingListResponse struct {