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

fix: add get-organization-applications API #81

Merged
Merged
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 casdoorsdk/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,27 @@ func (c *Client) GetApplications() ([]*Application, error) {
return applications, nil
}

func (c *Client) GetOrganizationApplications() ([]*Application, error) {
queryMap := map[string]string{
"owner": "admin",
"organization": c.OrganizationName,
}

url := c.GetUrl("get-organization-applications", queryMap)

bytes, err := c.DoGetBytes(url)
if err != nil {
return nil, err
}

var applications []*Application
err = json.Unmarshal(bytes, &applications)
if err != nil {
return nil, err
}
return applications, nil
}

func (c *Client) GetApplication(name string) (*Application, error) {
queryMap := map[string]string{
"id": fmt.Sprintf("%s/%s", c.OrganizationName, name),
Expand Down
4 changes: 4 additions & 0 deletions casdoorsdk/application_global.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ func GetApplications() ([]*Application, error) {
return globalClient.GetApplications()
}

func GetOrganizationApplications() ([]*Application, error) {
return globalClient.GetOrganizationApplications()
}

func GetApplication(name string) ([]*Application, error) {
return globalClient.GetApplications()
}
Expand Down
Loading