diff --git a/CHANGELOG.md b/CHANGELOG.md index ee65212..4a63985 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Change Log +## [4.4.0](https://github.com/plivo/plivo-go/tree/v4.4.0) (2020-03-31) +- Add application cascade delete support. + ## [4.3.0](https://github.com/plivo/plivo-go/tree/v4.3.0) (2020-03-30) - Add Tollfree support for Powerpack diff --git a/applications.go b/applications.go index 68d9156..5598184 100644 --- a/applications.go +++ b/applications.go @@ -71,6 +71,11 @@ type ApplicationList struct { Objects []Application `json:"objects" url:"objects"` } +type ApplicationDeleteParams struct { + Cascade bool `json:"cascade" url:"cascade"` // Specify if the Application should be cascade deleted or not. Takes a value of True or False + NewEndpointApplication string `json:"new_endpoint_application,omitempty" url:"new_endpoint_application,omitempty"` +} + type ApplicationUpdateResponse BaseResponse func (service *ApplicationService) Create(params ApplicationCreateParams) (response *ApplicationCreateResponseBody, err error) { @@ -113,8 +118,12 @@ func (service *ApplicationService) Update(appId string, params ApplicationUpdate return } -func (service *ApplicationService) Delete(appId string) (err error) { - request, err := service.client.NewRequest("DELETE", nil, "Application/%s", appId) +func (service *ApplicationService) Delete(appId string, data ...ApplicationDeleteParams) (err error) { + var optionalParams interface{} + if data != nil { + optionalParams = data[0] + } + request, err := service.client.NewRequest("DELETE", optionalParams, "Application/%s", appId) if err != nil { return } diff --git a/baseclient.go b/baseclient.go index 9433c0e..da0fc65 100644 --- a/baseclient.go +++ b/baseclient.go @@ -13,7 +13,7 @@ import ( "github.com/google/go-querystring/query" ) -const sdkVersion = "4.3.0" +const sdkVersion = "4.4.0" type ClientOptions struct { HttpClient *http.Client