Skip to content

Commit

Permalink
removed extra docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
kgibson-spotnana committed Feb 21, 2024
1 parent 25da6de commit a471f60
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 46 deletions.
15 changes: 0 additions & 15 deletions applications.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ import (
)

// GetAllApplications returns all applications
//
// Example:
// allApps, err := c.GetAllApplications()
func (c *Client) GetAllApplications() (allApplications AllApps, err error) {
// Prepare request
totalApps := 0
Expand Down Expand Up @@ -66,9 +63,6 @@ func (c *Client) GetAllApplications() (allApplications AllApps, err error) {
}

// GetApplication returns a single application
//
// Example:
// app, err := c.GetApplication("5f5e3e3e4f7d3d7e3e3e3e3e")
func (c *Client) GetApplication(appId string) (application App, err error) {
// Prepare request
c.HostURL.Path = "/api/v2/applications/" + appId
Expand All @@ -86,9 +80,6 @@ func (c *Client) GetApplication(appId string) (application App, err error) {

// GetAppAssociations returns a single application
// groupType can be either "user_group" or "user"
//
// Example:
// appAssociations, err := c.GetAppAssociations("5f5e3e3e4f7d3d7e3e3e3e3e", "user_group")
func (c *Client) GetAppAssociations(appId string, groupType string) (appAssociations AppAssociations, err error) {
// Prepare request
totalAssociations := 0
Expand Down Expand Up @@ -127,9 +118,6 @@ func (c *Client) GetAppAssociations(appId string, groupType string) (appAssociat
}

// AssociateGroupWithApp associates a group with an application
//
// Example:
// err := c.AssociateGroupWithApp(appId: "5f5e3e3e4f7d3d7e3e3e3e3e", groupId: "5f5e3e3e4f7d3d7e3e3e3e3e")
func (c *Client) AssociateGroupWithApp(appId string, groupId string) (err error) {
// Prepare request
c.HostURL.Path = "/api/v2/applications/" + appId + "/associations"
Expand All @@ -152,9 +140,6 @@ func (c *Client) AssociateGroupWithApp(appId string, groupId string) (err error)
}

// RemoveGroupFromApp removes a group from an application
//
// Example:
// err := c.RemoveGroupFromApp(appId: "5f5e3e3e4f7d3d7e3e3e3e3e", groupId: "5f5e3e3e4f7d3d7e3e3e3e3e")
func (c *Client) RemoveGroupFromApp(appId string, groupId string) (err error) {
// Prepare request
c.HostURL.Path = "/api/v2/applications/" + appId + "/associations"
Expand Down
6 changes: 2 additions & 4 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// c, err := jumpcloud.NewClient(os.Getenv("JC_API_KEY"))
//
// # Use the Client
// groups, _ := c.GetAllUserGroups()
// groups, err := c.GetAllUserGroups()
//

package jumpcloud
Expand All @@ -26,9 +26,7 @@ type Client struct {
}

// NewClient factory returns a prepared client
//
// Example:
// c, err := jumpcloud.NewClient(os.Getenv("JC_API_KEY"))
// token is the JumpCloud API key
func NewClient(token string) (*Client, error) {
parsedUrl, err := url.Parse(HostURL)
c := Client{
Expand Down
24 changes: 0 additions & 24 deletions usergroups.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ import (
)

// GetAllUserGroups returns a list of all usergroups in Jumpcloud
//
// Example:
// allUserGroups, err := c.GetAllUserGroups()
func (c *Client) GetAllUserGroups() (allUserGroups UserGroups, err error) {
// Prepare request
c.HostURL.Path = "/api/v2/usergroups"
Expand Down Expand Up @@ -62,9 +59,6 @@ func (c *Client) GetAllUserGroups() (allUserGroups UserGroups, err error) {
}

// CreateUserGroup creates a new user group
//
// Example:
// newGroup, err := c.CreateUserGroup(UserGroup{Name: "New Group"})
func (c *Client) CreateUserGroup(newUser UserGroup) (userGroup UserGroup, err error) {
// Prepare request
c.HostURL.Path = "/api/v2/usergroups"
Expand All @@ -87,9 +81,6 @@ func (c *Client) CreateUserGroup(newUser UserGroup) (userGroup UserGroup, err er
}

// CreateUserGroups creates multiple user groups
//
// Example:
// newGroups, err := c.CreateUserGroups([]UserGroup{{Name: "New Group 1"}, {Name: "New Group 2"}})
func (c *Client) CreateUserGroups(newUserGroups []UserGroup) (userGroups []UserGroup, err error) {
// Iterate through the user groups and create them
for _, usergroup := range newUserGroups {
Expand All @@ -104,9 +95,6 @@ func (c *Client) CreateUserGroups(newUserGroups []UserGroup) (userGroups []UserG
}

// GetUserGroup query for a specific user group by ID
//
// Example:
// userGroup, err := c.GetUserGroup("5f5e3e3e4f7d3d7e3e3e3e3e")
func (c *Client) GetUserGroup(groupId string) (userGroup UserGroup, err error) {
// Prepare request
c.HostURL.Path = "/api/v2/usergroups/" + groupId
Expand All @@ -128,9 +116,6 @@ func (c *Client) GetUserGroup(groupId string) (userGroup UserGroup, err error) {
}

// DeleteUserGroup deletes a user group
//
// Example:
// err := c.DeleteUserGroup("5f5e3e3e4f7d3d7e3e3e3e3e")
func (c *Client) DeleteUserGroup(groupId string) (err error) {
// Prepare request
c.HostURL.Path = "/api/v2/usergroups/" + groupId
Expand All @@ -149,9 +134,6 @@ func (c *Client) DeleteUserGroup(groupId string) (err error) {
}

// GetGroupMembers returns a list of users in a group
//
// Example:
// groupMembers, err := c.GetGroupMembers("5f5e3e3e4f7d3d7e3e3e3e3e")
func (c *Client) GetGroupMembers(groupId string) (groupMembers GroupMembership, err error) {
// Prepare request
c.HostURL.Path = "/api/v2/usergroups/" + groupId + "/members"
Expand Down Expand Up @@ -201,9 +183,6 @@ func (c *Client) GetGroupMembers(groupId string) (groupMembers GroupMembership,
}

// GetUserGroupByName returns a group by name
//
// Example:
// userGroup, err := c.GetUserGroupByName("New Group")
func (c *Client) GetUserGroupByName(groupName string) (userGroup UserGroup, err error) {
// Prepare request
var results UserGroups
Expand Down Expand Up @@ -232,9 +211,6 @@ func (c *Client) GetUserGroupByName(groupName string) (userGroup UserGroup, err
}

// UpdateUserGroup updates a user group
//
// Example:
// updatedGroup, err := c.UpdateUserGroup("5f5e3e3e4f7d3d7e3e3e3e3e", UserGroup{Name: "Updated Group"})
func (c *Client) UpdateUserGroup(groupId string, updatedUserGroup UserGroup) (userGroup UserGroup, err error) {
// If update does not contain a description field, set it to the old description
// We do this because the API will overwrite the description field with an empty string if not passed
Expand Down
3 changes: 0 additions & 3 deletions users.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ import (
)

// GetUser returns the details of a user by ID
//
// Example:
// user, err := c.GetUser("5f5e3e3e")
func (c *Client) GetUser(userId string) (user SystemUser, err error) {
// Prepare request
c.HostURL.Path = "/api/systemusers/" + userId
Expand Down

0 comments on commit a471f60

Please sign in to comment.