Skip to content

Commit

Permalink
Merge pull request #57 from plivo/VT-1641-app-cascade-delete
Browse files Browse the repository at this point in the history
adds cascade option for delete application api
  • Loading branch information
nixonsam authored Mar 31, 2020
2 parents 4ced0ec + 4620e1e commit 67ce2ff
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
13 changes: 11 additions & 2 deletions applications.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion baseclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 67ce2ff

Please sign in to comment.