Skip to content

Commit

Permalink
adding GetAppPublicKey
Browse files Browse the repository at this point in the history
  • Loading branch information
leodotcloud committed May 29, 2020
1 parent fddb564 commit 4f01314
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
23 changes: 23 additions & 0 deletions zendesk/app.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package zendesk

import (
"fmt"
"io/ioutil"
"log"
)

func (c *client) GetAppPublicKey(appID int64) (string, error) {
endpoint := fmt.Sprintf("/api/v2/apps/%d/public_key.pem", appID)
log.Println(endpoint)
resp, err := c.request("GET", endpoint, nil, nil)
if err != nil {
return "", err
}
defer resp.Body.Close()
cert, err := ioutil.ReadAll(resp.Body)
if err != nil {
return "", err
}

return string(cert), err
}
1 change: 1 addition & 0 deletions zendesk/zendesk.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ type Client interface {
DeleteUser(int64) (*User, error)
DeleteOrganizationMembershipByID(int64) error
DeleteGroup(int64) error
GetAppPublicKey(int64) (string, error)
ListIdentities(int64) ([]UserIdentity, error)
ListLocales() ([]Locale, error)
ListOrganizationMembershipsByUserID(id int64) ([]OrganizationMembership, error)
Expand Down

0 comments on commit 4f01314

Please sign in to comment.