-
Notifications
You must be signed in to change notification settings - Fork 5
/
api_op_update.go
54 lines (46 loc) · 1.81 KB
/
api_op_update.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// Package key contains auto-generated files. DO NOT MODIFY
package key
import (
"context"
"net/http"
"github.com/RJPearson94/twilio-sdk-go/client"
"github.com/RJPearson94/twilio-sdk-go/utils"
)
// UpdateKeyInput defines input fields for updating a API Key
type UpdateKeyInput struct {
FriendlyName *string `form:"FriendlyName,omitempty"`
}
// UpdateKeyResponse defines the response fields for the updated API Key
type UpdateKeyResponse struct {
DateCreated utils.RFC2822Time `json:"date_created"`
DateUpdated *utils.RFC2822Time `json:"date_updated,omitempty"`
FriendlyName string `json:"friendly_name"`
Sid string `json:"sid"`
}
// Update modifies a key resource. The secret is not returned for security reasons
// See https://www.twilio.com/docs/iam/keys/api-key-resource#update-a-key-resource for more details
// Context is defaulted to Background. See https://golang.org/pkg/context/#Background for more information
func (c Client) Update(input *UpdateKeyInput) (*UpdateKeyResponse, error) {
return c.UpdateWithContext(context.Background(), input)
}
// UpdateWithContext modifies a key resource. The secret is not returned for security reasons
// See https://www.twilio.com/docs/iam/keys/api-key-resource#update-a-key-resource for more details
func (c Client) UpdateWithContext(context context.Context, input *UpdateKeyInput) (*UpdateKeyResponse, error) {
op := client.Operation{
Method: http.MethodPost,
URI: "/Accounts/{accountSid}/Keys/{sid}.json",
ContentType: client.URLEncoded,
PathParams: map[string]string{
"accountSid": c.accountSid,
"sid": c.sid,
},
}
if input == nil {
input = &UpdateKeyInput{}
}
response := &UpdateKeyResponse{}
if err := c.client.Send(context, op, input, response); err != nil {
return nil, err
}
return response, nil
}