Skip to content

Commit edfaac2

Browse files
authored
updates from review
1 parent 86feaff commit edfaac2

File tree

2 files changed

+3
-14
lines changed

2 files changed

+3
-14
lines changed

internal/codespaces/api/api.go

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -701,23 +701,13 @@ func (a *API) DeleteCodespace(ctx context.Context, codespaceName string) error {
701701
}
702702

703703
type EditCodespaceParams struct {
704-
DisplayName string
705-
IdleTimeoutMinutes int
706-
Machine string
707-
}
708-
709-
type editRequest struct {
710704
DisplayName string `json:"display_name,omitempty"`
711705
IdleTimeoutMinutes int `json:"idle_timeout_minutes,omitempty"`
712706
Machine string `json:"machine,omitempty"`
713707
}
714708

715709
func (a *API) EditCodespace(ctx context.Context, codespaceName string, params *EditCodespaceParams) (*Codespace, error) {
716-
requestBody, err := json.Marshal(editRequest{
717-
DisplayName: params.DisplayName,
718-
IdleTimeoutMinutes: params.IdleTimeoutMinutes,
719-
Machine: params.Machine,
720-
})
710+
requestBody, err := json.Marshal(params)
721711

722712
if err != nil {
723713
return nil, fmt.Errorf("error marshaling request: %w", err)
@@ -735,7 +725,7 @@ func (a *API) EditCodespace(ctx context.Context, codespaceName string, params *E
735725
}
736726
defer resp.Body.Close()
737727

738-
if resp.StatusCode != http.StatusOK && resp.StatusCode != http.StatusCreated {
728+
if resp.StatusCode != http.StatusOK {
739729
return nil, api.HandleHTTPError(resp)
740730
}
741731

pkg/cmd/codespace/edit.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ func (a *App) Edit(ctx context.Context, opts editOptions) error {
5050
SKU: opts.machine,
5151
}
5252
a.StartProgressIndicatorWithLabel("Editing codespace")
53-
codespace, err := a.apiClient.EditCodespace(ctx, userInputs.CodespaceName, &api.EditCodespaceParams{
53+
_, err := a.apiClient.EditCodespace(ctx, userInputs.CodespaceName, &api.EditCodespaceParams{
5454
DisplayName: userInputs.DisplayName,
5555
IdleTimeoutMinutes: int(userInputs.IdleTimeout.Minutes()),
5656
Machine: userInputs.SKU,
@@ -60,6 +60,5 @@ func (a *App) Edit(ctx context.Context, opts editOptions) error {
6060
return fmt.Errorf("error editing codespace: %w", err)
6161
}
6262

63-
fmt.Fprintln(a.io.Out, codespace.DisplayName)
6463
return nil
6564
}

0 commit comments

Comments
 (0)