X Tutup
Skip to content

Commit 0671986

Browse files
committed
move api to internal/
1 parent 3abde5f commit 0671986

File tree

11 files changed

+28
-11
lines changed

11 files changed

+28
-11
lines changed

cmd/ghcs/code.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"net/url"
77
"os"
88

9-
"github.com/github/ghcs/api"
9+
"github.com/github/ghcs/internal/api"
1010
"github.com/skratchdot/open-golang/open"
1111
"github.com/spf13/cobra"
1212
)

cmd/ghcs/common.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111

1212
"github.com/AlecAivazis/survey/v2"
1313
"github.com/AlecAivazis/survey/v2/terminal"
14-
"github.com/github/ghcs/api"
14+
"github.com/github/ghcs/internal/api"
1515
"golang.org/x/term"
1616
)
1717

cmd/ghcs/create.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import (
99

1010
"github.com/AlecAivazis/survey/v2"
1111
"github.com/fatih/camelcase"
12-
"github.com/github/ghcs/api"
1312
"github.com/github/ghcs/cmd/ghcs/output"
13+
"github.com/github/ghcs/internal/api"
1414
"github.com/github/ghcs/internal/codespaces"
1515
"github.com/spf13/cobra"
1616
)

cmd/ghcs/delete.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import (
77
"os"
88
"strings"
99

10-
"github.com/github/ghcs/api"
1110
"github.com/github/ghcs/cmd/ghcs/output"
11+
"github.com/github/ghcs/internal/api"
1212
"github.com/spf13/cobra"
1313
)
1414

cmd/ghcs/list.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import (
55
"fmt"
66
"os"
77

8-
"github.com/github/ghcs/api"
98
"github.com/github/ghcs/cmd/ghcs/output"
9+
"github.com/github/ghcs/internal/api"
1010
"github.com/spf13/cobra"
1111
)
1212

cmd/ghcs/logs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import (
66
"net"
77
"os"
88

9-
"github.com/github/ghcs/api"
109
"github.com/github/ghcs/cmd/ghcs/output"
10+
"github.com/github/ghcs/internal/api"
1111
"github.com/github/ghcs/internal/codespaces"
1212
"github.com/github/go-liveshare"
1313
"github.com/spf13/cobra"

cmd/ghcs/ports.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ import (
1111
"strconv"
1212
"strings"
1313

14-
"github.com/github/ghcs/api"
1514
"github.com/github/ghcs/cmd/ghcs/output"
15+
"github.com/github/ghcs/internal/api"
1616
"github.com/github/ghcs/internal/codespaces"
1717
"github.com/github/go-liveshare"
1818
"github.com/muhammadmuzzammil1998/jsonc"

cmd/ghcs/ssh.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import (
66
"net"
77
"os"
88

9-
"github.com/github/ghcs/api"
109
"github.com/github/ghcs/cmd/ghcs/output"
10+
"github.com/github/ghcs/internal/api"
1111
"github.com/github/ghcs/internal/codespaces"
1212
"github.com/github/go-liveshare"
1313
"github.com/spf13/cobra"

api/api.go renamed to internal/api/api.go

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// TODO(adonovan): rename to package codespaces, and codespaces.Client.
21
package api
32

43
// For descriptions of service interfaces, see:
@@ -7,6 +6,24 @@ package api
76
// - https://github.com/github/github/blob/master/app/api/codespaces.rb (for vscs_internal)
87
// TODO(adonovan): replace the last link with a public doc URL when available.
98

9+
// TODO(adonovan): a possible reorganization would be to split this
10+
// file into three internal packages, one per backend service, and to
11+
// rename api.API to github.Client:
12+
//
13+
// - github.GetUser(github.Client)
14+
// - github.GetRepository(Client)
15+
// - github.ReadFile(Client, nwo, branch, path) // was GetCodespaceRepositoryContents
16+
// - codespaces.Create(Client, user, repo, sku, branch, location)
17+
// - codespaces.Delete(Client, user, token, name)
18+
// - codespaces.Get(Client, token, owner, name)
19+
// - codespaces.GetMachineTypes(Client, user, repo, branch, location)
20+
// - codespaces.GetToken(Client, login, name)
21+
// - codespaces.List(Client, user)
22+
// - codespaces.Start(Client, token, codespace)
23+
// - visualstudio.GetRegionLocation(http.Client) // no dependency on github
24+
//
25+
// This would make the meaning of each operation clearer.
26+
1027
import (
1128
"bytes"
1229
"context"

internal/codespaces/codespaces.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"fmt"
77
"time"
88

9-
"github.com/github/ghcs/api"
9+
"github.com/github/ghcs/internal/api"
1010
"github.com/github/go-liveshare"
1111
)
1212

0 commit comments

Comments
 (0)
X Tutup