Skip to content

Commit c01a9ee

Browse files
authored
Consolidate Go initialism casing (#1527)
* Consolidate Go initialism casing * replace UriConnection for URIConnection * replace TcpConnection for TCPConnection * Update docs for Go initialism casing * Remove Go GitHub casing overrides
1 parent d48e0d3 commit c01a9ee

55 files changed

Lines changed: 1690 additions & 1693 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/auth/byok.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ func main() {
115115
Provider: &copilot.ProviderConfig{
116116
Type: "openai",
117117
BaseURL: "https://your-resource.openai.azure.com/openai/v1/",
118-
WireApi: "responses", // Use "completions" for older models
118+
WireAPI: "responses", // Use "completions" for older models
119119
APIKey: os.Getenv("FOUNDRY_API_KEY"),
120120
},
121121
})

docs/getting-started.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2000,9 +2000,9 @@ import (
20002000
func main() {
20012001
ctx := context.Background()
20022002

2003-
client := copilot.NewClient(&copilot.ClientOptions{
2004-
Connection: copilot.UriConnection{URL: "localhost:4321"},
2005-
})
2003+
client := copilot.NewClient(&copilot.ClientOptions{
2004+
Connection: copilot.URIConnection{URL: "localhost:4321"},
2005+
})
20062006

20072007
if err := client.Start(ctx); err != nil {
20082008
log.Fatal(err)
@@ -2021,7 +2021,7 @@ func main() {
20212021
import copilot "github.com/github/copilot-sdk/go"
20222022

20232023
client := copilot.NewClient(&copilot.ClientOptions{
2024-
Connection: copilot.UriConnection{URL: "localhost:4321"},
2024+
Connection: copilot.URIConnection{URL: "localhost:4321"},
20252025
})
20262026

20272027
if err := client.Start(ctx); err != nil {
@@ -2105,7 +2105,7 @@ var session = client.createSession(
21052105

21062106
</details>
21072107

2108-
**Note:** When `cli_url` / `cliUrl` / Go's `UriConnection` is provided, or Rust uses `Transport::External`, the SDK will not spawn or manage a CLI process - it will only connect to the existing server at the specified URL.
2108+
**Note:** When `cli_url` / `cliUrl` / Go's `URIConnection` is provided, or Rust uses `Transport::External`, the SDK will not spawn or manage a CLI process - it will only connect to the existing server at the specified URL.
21092109

21102110
## Telemetry and observability
21112111

docs/setup/backend-services.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Run the Copilot SDK in server-side applications—APIs, web backends, microservi
66

77
## How it works
88

9-
Instead of the SDK spawning a CLI child process, you run the CLI independently in **headless server mode**. Your backend connects to it over TCP using the `Connection` option (`UriConnection`).
9+
Instead of the SDK spawning a CLI child process, you run the CLI independently in **headless server mode**. Your backend connects to it over TCP using the `Connection` option (`URIConnection`).
1010

1111
```mermaid
1212
flowchart TB
@@ -183,9 +183,9 @@ func main() {
183183
userID := "user1"
184184
message := "Hello"
185185

186-
client := copilot.NewClient(&copilot.ClientOptions{
187-
Connection: copilot.UriConnection{URL: "localhost:4321"},
188-
})
186+
client := copilot.NewClient(&copilot.ClientOptions{
187+
Connection: copilot.URIConnection{URL: "localhost:4321"},
188+
})
189189
client.Start(ctx)
190190
defer client.Stop()
191191

@@ -202,7 +202,7 @@ func main() {
202202

203203
```go
204204
client := copilot.NewClient(&copilot.ClientOptions{
205-
Connection: copilot.UriConnection{URL: "localhost:4321"},
205+
Connection: copilot.URIConnection{URL: "localhost:4321"},
206206
})
207207
client.Start(ctx)
208208
defer client.Stop()

docs/setup/multi-tenancy.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,12 @@ func main() {
108108
requestID := "req-1"
109109
user := appUser{ID: "alice", GitHubToken: "gho_xxx"}
110110

111-
client := copilot.NewClient(&copilot.ClientOptions{
112-
Mode: copilot.ModeEmpty,
113-
BaseDirectory: fmt.Sprintf("/var/lib/my-app/copilot/%s", runtimeInstanceID),
114-
SessionIdleTimeoutSeconds: 900,
115-
Connection: copilot.UriConnection{URL: runtimeURL},
116-
})
111+
client := copilot.NewClient(&copilot.ClientOptions{
112+
Mode: copilot.ModeEmpty,
113+
BaseDirectory: fmt.Sprintf("/var/lib/my-app/copilot/%s", runtimeInstanceID),
114+
SessionIdleTimeoutSeconds: 900,
115+
Connection: copilot.URIConnection{URL: runtimeURL},
116+
})
117117

118118
session, err := client.CreateSession(ctx, &copilot.SessionConfig{
119119
SessionID: fmt.Sprintf("user-%s-%s", user.ID, requestID),
@@ -132,7 +132,7 @@ client := copilot.NewClient(&copilot.ClientOptions{
132132
Mode: copilot.ModeEmpty,
133133
BaseDirectory: fmt.Sprintf("/var/lib/my-app/copilot/%s", runtimeInstanceID),
134134
SessionIdleTimeoutSeconds: 900,
135-
Connection: copilot.UriConnection{URL: runtimeURL},
135+
Connection: copilot.URIConnection{URL: runtimeURL},
136136
})
137137

138138
session, err := client.CreateSession(ctx, &copilot.SessionConfig{
@@ -338,7 +338,7 @@ Verified public SDK surfaces:
338338
|----------|---------------------|----------------------|
339339
| TypeScript | `sessionFs` | `createSessionFsAdapter` / provider callbacks |
340340
| Python | `session_fs` | `create_session_fs_handler` |
341-
| Go | `SessionFs` | `CreateSessionFsProvider` |
341+
| Go | `SessionFS` | `CreateSessionFSProvider` |
342342
| .NET | `SessionFs` | `CreateSessionFsProvider` |
343343
| Rust | `with_session_fs(...)` | `with_session_fs_provider(...)` |
344344

@@ -352,7 +352,7 @@ Use an external runtime connection when multiple SDK clients should share one al
352352
|----------|-----------------------------|
353353
| TypeScript | `RuntimeConnection.forUri(url)` |
354354
| Python | `RuntimeConnection.for_uri(url)` |
355-
| Go | `copilot.UriConnection{URL: url}` |
355+
| Go | `copilot.URIConnection{URL: url}` |
356356
| .NET | `RuntimeConnection.ForUri(url)` |
357357
| Java | `setCliUrl(url)` |
358358
| Rust | `Transport::External { host, port, connection_token }` |

go/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -136,17 +136,17 @@ Event types: `SessionLifecycleCreated`, `SessionLifecycleDeleted`, `SessionLifec
136136

137137
- `Connection` (RuntimeConnection): How the SDK connects to the runtime. Construct via one of:
138138
- `StdioConnection{Path, Args}` — spawn a runtime over stdio (the default if `Connection` is nil)
139-
- `TcpConnection{Port, ConnectionToken, Path, Args}` — spawn a runtime that listens on TCP
140-
- `UriConnection{URL, ConnectionToken}` — connect to an already-running runtime (no process spawned)
139+
- `TCPConnection{Port, ConnectionToken, Path, Args}` — spawn a runtime that listens on TCP
140+
- `URIConnection{URL, ConnectionToken}` — connect to an already-running runtime (no process spawned)
141141

142142
When `Path` is empty for stdio/tcp, the SDK uses the bundled CLI (or `COPILOT_CLI_PATH` env var).
143143
- `WorkingDirectory` (string): Working directory for the runtime process
144-
- `BaseDirectory` (string): Base directory for Copilot data (session state, config, etc.). Sets `COPILOT_HOME` on the spawned runtime. When empty, the runtime defaults to `~/.copilot`. Ignored with `UriConnection`. This does **not** affect where the Go SDK extracts the embedded CLI binary; use `embeddedcli.Config.Dir` for the extraction/cache location.
144+
- `BaseDirectory` (string): Base directory for Copilot data (session state, config, etc.). Sets `COPILOT_HOME` on the spawned runtime. When empty, the runtime defaults to `~/.copilot`. Ignored with `URIConnection`. This does **not** affect where the Go SDK extracts the embedded CLI binary; use `embeddedcli.Config.Dir` for the extraction/cache location.
145145
- `LogLevel` (string): Log level. When empty (default), the runtime uses its own default level (the SDK does not pass `--log-level`).
146146
- `Env` ([]string): Environment variables for the runtime process (default: inherits from current process)
147147
- `GitHubToken` (string): GitHub token for authentication. When provided, takes priority over other auth methods.
148-
- `UseLoggedInUser` (\*bool): Whether to use logged-in user for authentication (default: true, but false when `GitHubToken` is provided). Cannot be used with `UriConnection`.
149-
- `EnableRemoteSessions` (bool): Enable remote session support (Mission Control integration). Ignored with `UriConnection`.
148+
- `UseLoggedInUser` (\*bool): Whether to use logged-in user for authentication (default: true, but false when `GitHubToken` is provided). Cannot be used with `URIConnection`.
149+
- `EnableRemoteSessions` (bool): Enable remote session support (Mission Control integration). Ignored with `URIConnection`.
150150
- `Telemetry` (\*TelemetryConfig): OpenTelemetry configuration for the runtime. Providing this enables telemetry — no separate flag needed. See [Telemetry](#telemetry) below.
151151

152152
**SessionConfig:**
@@ -495,7 +495,7 @@ The SDK supports custom OpenAI-compatible API providers (BYOK - Bring Your Own K
495495
- `BaseURL` (string): API endpoint URL (required)
496496
- `APIKey` (string): API key (optional for local providers like Ollama)
497497
- `BearerToken` (string): Bearer token for authentication (takes precedence over APIKey)
498-
- `WireApi` (string): API format for OpenAI/Azure - "completions" or "responses" (default: "completions")
498+
- `WireAPI` (string): API format for OpenAI/Azure - "completions" or "responses" (default: "completions")
499499
- `Azure.APIVersion` (string): Azure API version (default: "2024-10-21")
500500

501501
**Example with Ollama:**
@@ -802,7 +802,7 @@ confirmed, err := ui.Confirm(ctx, "Deploy to production?")
802802
choice, ok, err := ui.Select(ctx, "Pick an environment", []string{"staging", "production"})
803803

804804
// Text input — returns (text, ok bool, error)
805-
name, ok, err := ui.Input(ctx, "Enter the release name", &copilot.UiInputOptions{
805+
name, ok, err := ui.Input(ctx, "Enter the release name", &copilot.UIInputOptions{
806806
Title: "Release Name",
807807
Description: "A short name for the release",
808808
MinLength: copilot.Int(1),

go/canvas_test.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ func TestCanvasAdapter_DispatchesToHandler(t *testing.T) {
136136
session := newTestCanvasSession("s1")
137137
session.registerCanvasHandler(handler)
138138

139-
openResp, err := session.clientSessionApis.Canvas.Open(&rpc.CanvasProviderOpenRequest{
139+
openResp, err := session.clientSessionAPIs.Canvas.Open(&rpc.CanvasProviderOpenRequest{
140140
SessionID: "s1",
141141
ExtensionID: "project:echo",
142142
CanvasID: "echo",
@@ -156,7 +156,7 @@ func TestCanvasAdapter_DispatchesToHandler(t *testing.T) {
156156
t.Fatalf("response URL not propagated: %+v", openResp)
157157
}
158158

159-
actionResp, err := session.clientSessionApis.Canvas.Invoke(&rpc.CanvasProviderInvokeActionRequest{
159+
actionResp, err := session.clientSessionAPIs.Canvas.Invoke(&rpc.CanvasProviderInvokeActionRequest{
160160
SessionID: "s1",
161161
ExtensionID: "project:echo",
162162
CanvasID: "echo",
@@ -178,7 +178,7 @@ func TestCanvasAdapter_DispatchesToHandler(t *testing.T) {
178178
t.Fatalf("unexpected action result: %#v", actionResp)
179179
}
180180

181-
closeResp, err := session.clientSessionApis.Canvas.Close(&rpc.CanvasProviderCloseRequest{
181+
closeResp, err := session.clientSessionAPIs.Canvas.Close(&rpc.CanvasProviderCloseRequest{
182182
SessionID: "s1",
183183
ExtensionID: "project:echo",
184184
CanvasID: "echo",
@@ -198,7 +198,7 @@ func TestCanvasAdapter_DispatchesToHandler(t *testing.T) {
198198
func TestCanvasAdapter_NoHandler_ReturnsUnsetError(t *testing.T) {
199199
session := newTestCanvasSession("s1")
200200

201-
_, err := session.clientSessionApis.Canvas.Open(&rpc.CanvasProviderOpenRequest{SessionID: "s1"})
201+
_, err := session.clientSessionAPIs.Canvas.Open(&rpc.CanvasProviderOpenRequest{SessionID: "s1"})
202202
assertCanvasJSONRPCError(t, err, "canvas_handler_unset", "")
203203
}
204204

@@ -208,7 +208,7 @@ func TestCanvasAdapter_HandlerCanvasError_Wired(t *testing.T) {
208208
openErr: NewCanvasError("permission_denied", "nope"),
209209
})
210210

211-
_, err := session.clientSessionApis.Canvas.Open(&rpc.CanvasProviderOpenRequest{SessionID: "s1"})
211+
_, err := session.clientSessionAPIs.Canvas.Open(&rpc.CanvasProviderOpenRequest{SessionID: "s1"})
212212
assertCanvasJSONRPCError(t, err, "permission_denied", "nope")
213213
}
214214

@@ -218,11 +218,11 @@ func TestCanvasAdapter_HandlerGenericError_WrappedAsCanvasHandlerError(t *testin
218218
openErr: errors.New("boom"),
219219
})
220220

221-
_, err := session.clientSessionApis.Canvas.Open(&rpc.CanvasProviderOpenRequest{SessionID: "s1"})
221+
_, err := session.clientSessionAPIs.Canvas.Open(&rpc.CanvasProviderOpenRequest{SessionID: "s1"})
222222
assertCanvasJSONRPCError(t, err, "canvas_handler_error", "boom")
223223
}
224224

225-
func TestCanvasRegisterClientSessionApiHandlers_RawJSONRoundTrip(t *testing.T) {
225+
func TestCanvasRegisterClientSessionAPIHandlers_RawJSONRoundTrip(t *testing.T) {
226226
clientToServerReader, clientToServerWriter := io.Pipe()
227227
serverToClientReader, serverToClientWriter := io.Pipe()
228228

@@ -233,9 +233,9 @@ func TestCanvasRegisterClientSessionApiHandlers_RawJSONRoundTrip(t *testing.T) {
233233
openResult: rpc.CanvasProviderOpenResult{Status: strPtr("ready")},
234234
actionResult: map[string]any{"count": float64(2)},
235235
})
236-
rpc.RegisterClientSessionApiHandlers(server, func(sessionID string) *rpc.ClientSessionApiHandlers {
236+
rpc.RegisterClientSessionAPIHandlers(server, func(sessionID string) *rpc.ClientSessionAPIHandlers {
237237
if sessionID == "s1" {
238-
return session.clientSessionApis
238+
return session.clientSessionAPIs
239239
}
240240
return nil
241241
})
@@ -417,9 +417,9 @@ func assertCanvasJSONRPCError(t *testing.T, err error, wantCode, wantMessage str
417417
func newTestCanvasSession(sessionID string) *Session {
418418
session := &Session{
419419
SessionID: sessionID,
420-
clientSessionApis: &rpc.ClientSessionApiHandlers{},
420+
clientSessionAPIs: &rpc.ClientSessionAPIHandlers{},
421421
}
422-
session.clientSessionApis.Canvas = newCanvasClientSessionAdapter(session)
422+
session.clientSessionAPIs.Canvas = newCanvasClientSessionAdapter(session)
423423
return session
424424
}
425425

0 commit comments

Comments
 (0)