mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
chore(coderd): allow creating workspaces without specifying an organization (#14048)
This commit is contained in:
@@ -473,8 +473,15 @@ func (c *Client) TemplateByName(ctx context.Context, organizationID uuid.UUID, n
|
||||
}
|
||||
|
||||
// CreateWorkspace creates a new workspace for the template specified.
|
||||
func (c *Client) CreateWorkspace(ctx context.Context, organizationID uuid.UUID, user string, request CreateWorkspaceRequest) (Workspace, error) {
|
||||
res, err := c.Request(ctx, http.MethodPost, fmt.Sprintf("/api/v2/organizations/%s/members/%s/workspaces", organizationID, user), request)
|
||||
//
|
||||
// Deprecated: Use CreateUserWorkspace instead.
|
||||
func (c *Client) CreateWorkspace(ctx context.Context, _ uuid.UUID, user string, request CreateWorkspaceRequest) (Workspace, error) {
|
||||
return c.CreateUserWorkspace(ctx, user, request)
|
||||
}
|
||||
|
||||
// CreateUserWorkspace creates a new workspace for the template specified.
|
||||
func (c *Client) CreateUserWorkspace(ctx context.Context, user string, request CreateWorkspaceRequest) (Workspace, error) {
|
||||
res, err := c.Request(ctx, http.MethodPost, fmt.Sprintf("/api/v2/users/%s/workspaces", user), request)
|
||||
if err != nil {
|
||||
return Workspace{}, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user