Skip to content

Commit

Permalink
add AppNameAvailable query (#56)
Browse files Browse the repository at this point in the history
  • Loading branch information
alichay committed May 10, 2024
1 parent 3883e36 commit 39edf76
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
20 changes: 20 additions & 0 deletions resource_apps.go
Original file line number Diff line number Diff line change
Expand Up @@ -384,3 +384,23 @@ func (client *Client) ResolveImageForApp(ctx context.Context, appName, imageRef

return data.App.Image, nil
}

func (client *Client) AppNameAvailable(ctx context.Context, appName string) (bool, error) {
query := `
query ($appName: String!) {
appNameAvailable(name: $appName)
}
`

req := client.NewRequest(query)

req.Var("appName", appName)
ctx = ctxWithAction(ctx, "app_name_available")

data, err := client.RunWithContext(ctx, req)
if err != nil {
return false, err
}

return data.AppNameAvailable, nil
}
1 change: 1 addition & 0 deletions types.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ type Query struct {
}

CanPerformBluegreenDeployment bool
AppNameAvailable bool
}

type CreatedWireGuardPeer struct {
Expand Down

0 comments on commit 39edf76

Please sign in to comment.