Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding GetAppPublicKey #97

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions zendesk/app.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package zendesk

import (
"fmt"
"io/ioutil"
)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a description like so:

// CreateOrganizationMembership creates an organization membership.
//
// Zendesk Core API docs: https://developer.zendesk.com/rest_api/docs/core/organization_memberships#create-membership

func (c *client) GetAppPublicKey(appID int64) (string, error) {
endpoint := fmt.Sprintf("/api/v2/apps/%d/public_key.pem", appID)
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