Skip to content

Commit

Permalink
orgs schema updates, version 0.10.0
Browse files Browse the repository at this point in the history
  • Loading branch information
bgentry committed May 14, 2014
1 parent 799f214 commit 34471aa
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 12 deletions.
31 changes: 28 additions & 3 deletions gen/schema.json
Expand Up @@ -3212,8 +3212,8 @@
},
"links": [
{
"description": "Create a new organization app. Use this endpoint instead of the `/apps` endpoint when you want to create an app that will be owned by an organization in which you are a member, rather than your personal account.",
"href": "/organizations/{(%23%2Fdefinitions%2Forganization%2Fdefinitions%2Fidentity)}/apps",
"description": "Create a new app in the specified organization, in the default organization if unspecified, or in personal account, if default organization is not set.",
"href": "/organizations/apps",
"method": "POST",
"rel": "create",
"schema": {
Expand All @@ -3224,6 +3224,9 @@
"name": {
"$ref": "#/definitions/app/definitions/name"
},
"organization": {
"$ref": "#/definitions/organization/definitions/name"
},
"region": {
"$ref": "#/definitions/region/definitions/name"
},
Expand All @@ -3237,12 +3240,19 @@
},
"title": "Create"
},
{
"description": "List apps in the default organization, or in personal account, if default organization is not set.",
"href": "/organizations/apps",
"method": "GET",
"rel": "instances",
"title": "List"
},
{
"description": "List organization apps.",
"href": "/organizations/{(%23%2Fdefinitions%2Forganization%2Fdefinitions%2Fidentity)}/apps",
"method": "GET",
"rel": "instances",
"title": "List"
"title": "List For Organization"
},
{
"description": "Info for an organization app.",
Expand Down Expand Up @@ -3352,6 +3362,21 @@
"object"
]
},
"owner": {
"description": "identity of app owner",
"properties": {
"email": {
"$ref": "#/definitions/account/definitions/email"
},
"id": {
"$ref": "#/definitions/account/definitions/id"
}
},
"type": [
"null",
"object"
]
},
"region": {
"description": "identity of app region",
"properties": {
Expand Down
2 changes: 1 addition & 1 deletion heroku.go
Expand Up @@ -22,7 +22,7 @@ import (
)

const (
Version = "0.9.0"
Version = "0.10.0"
DefaultAPIURL = "https://api.heroku.com"
DefaultUserAgent = "heroku-go/" + Version + " (" + runtime.GOOS + "; " + runtime.GOARCH + ")"
)
Expand Down
41 changes: 33 additions & 8 deletions organization_app.go
Expand Up @@ -43,6 +43,12 @@ type OrganizationApp struct {
Name string `json:"name"`
} `json:"organization"`

// identity of app owner
Owner *struct {
Email string `json:"email"`
Id string `json:"id"`
} `json:"owner"`

// identity of app region
Region struct {
Id string `json:"id"`
Expand Down Expand Up @@ -71,15 +77,13 @@ type OrganizationApp struct {
WebURL string `json:"web_url"`
}

// Create a new organization app. Use this endpoint instead of the /apps
// endpoint when you want to create an app that will be owned by an organization
// in which you are a member, rather than your personal account.
// Create a new app in the specified organization, in the default organization
// if unspecified, or in personal account, if default organization is not set.
//
// organizationIdentity is the unique identifier of the OrganizationApp's
// Organization. options is the struct of optional parameters for this action.
func (c *Client) OrganizationAppCreate(organizationIdentity string, options *OrganizationAppCreateOpts) (*OrganizationApp, error) {
// options is the struct of optional parameters for this action.
func (c *Client) OrganizationAppCreate(options *OrganizationAppCreateOpts) (*OrganizationApp, error) {
var organizationAppRes OrganizationApp
return &organizationAppRes, c.Post(&organizationAppRes, "/organizations/"+organizationIdentity+"/apps", options)
return &organizationAppRes, c.Post(&organizationAppRes, "/organizations/apps", options)
}

// OrganizationAppCreateOpts holds the optional parameters for OrganizationAppCreate
Expand All @@ -88,18 +92,39 @@ type OrganizationAppCreateOpts struct {
Locked *bool `json:"locked,omitempty"`
// unique name of app
Name *string `json:"name,omitempty"`
// organization that owns this app
Organization *string `json:"organization,omitempty"`
// identity of app region
Region *string `json:"region,omitempty"`
// identity of app stack
Stack *string `json:"stack,omitempty"`
}

// List apps in the default organization, or in personal account, if default
// organization is not set.
//
// lr is an optional ListRange that sets the Range options for the paginated
// list of results.
func (c *Client) OrganizationAppList(lr *ListRange) ([]OrganizationApp, error) {
req, err := c.NewRequest("GET", "/organizations/apps", nil)
if err != nil {
return nil, err
}

if lr != nil {
lr.SetHeader(req)
}

var organizationAppsRes []OrganizationApp
return organizationAppsRes, c.DoReq(req, &organizationAppsRes)
}

// List organization apps.
//
// organizationIdentity is the unique identifier of the OrganizationApp's
// Organization. lr is an optional ListRange that sets the Range options for the
// paginated list of results.
func (c *Client) OrganizationAppList(organizationIdentity string, lr *ListRange) ([]OrganizationApp, error) {
func (c *Client) OrganizationAppListForOrganization(organizationIdentity string, lr *ListRange) ([]OrganizationApp, error) {
req, err := c.NewRequest("GET", "/organizations/"+organizationIdentity+"/apps", nil)
if err != nil {
return nil, err
Expand Down

0 comments on commit 34471aa

Please sign in to comment.