@@ -41,10 +41,8 @@ The full API of this library can be found in [api.md](api.md).
4141package main
4242
4343import (
44- " bytes"
4544 " context"
4645 " fmt"
47- " io"
4846
4947 " github.com/onkernel/kernel-go-sdk"
5048 " github.com/onkernel/kernel-go-sdk/option"
@@ -55,18 +53,15 @@ func main() {
5553 option.WithAPIKey (" My API Key" ), // defaults to os.LookupEnv("KERNEL_API_KEY")
5654 option.WithEnvironmentDevelopment (), // defaults to option.WithEnvironmentProduction()
5755 )
58- deployment , err := client.Apps .Deployments .New (context.TODO (), kernel.AppDeploymentNewParams {
59- EntrypointRelPath: " main.ts" ,
60- File: io.Reader (bytes.NewBuffer ([]byte (" REPLACE_ME" ))),
61- EnvVars: map [string ]string {
62- " OPENAI_API_KEY" : " x" ,
56+ browser , err := client.Browsers .New (context.TODO (), kernel.BrowserNewParams {
57+ Persistence: kernel.BrowserPersistenceParam {
58+ ID: " browser-for-user-1234" ,
6359 },
64- Version: kernel.String (" 1.0.0" ),
6560 })
6661 if err != nil {
6762 panic (err.Error ())
6863 }
69- fmt.Printf (" %+v \n " , deployment. Apps )
64+ fmt.Printf (" %+v \n " , browser. SessionID )
7065}
7166
7267```
@@ -304,7 +299,6 @@ To handle errors, we recommend that you use the `errors.As` pattern:
304299
305300``` go
306301_ , err := client.Browsers .New (context.TODO (), kernel.BrowserNewParams {
307- InvocationID : kernel.String (" REPLACE_ME" ),
308302 Persistence : kernel.BrowserPersistenceParam {
309303 ID: " browser-for-user-1234" ,
310304 },
@@ -336,7 +330,6 @@ defer cancel()
336330client.Browsers .New (
337331 ctx,
338332 kernel.BrowserNewParams {
339- InvocationID : kernel.String (" REPLACE_ME" ),
340333 Persistence : kernel.BrowserPersistenceParam {
341334 ID: " browser-for-user-1234" ,
342335 },
@@ -362,19 +355,19 @@ which can be used to wrap any `io.Reader` with the appropriate file name and con
362355``` go
363356// A file from the file system
364357file , err := os.Open (" /path/to/file" )
365- kernel.AppDeploymentNewParams {
358+ kernel.DeploymentNewParams {
366359 EntrypointRelPath : " src/app.py" ,
367360 File : file,
368361}
369362
370363// A file from a string
371- kernel.AppDeploymentNewParams {
364+ kernel.DeploymentNewParams {
372365 EntrypointRelPath : " src/app.py" ,
373366 File : strings.NewReader (" my file contents" ),
374367}
375368
376369// With a custom filename and contentType
377- kernel.AppDeploymentNewParams {
370+ kernel.DeploymentNewParams {
378371 EntrypointRelPath : " src/app.py" ,
379372 File : kernel.File (strings.NewReader (` {"hello": "foo"}` ), " file.go" , " application/json" ),
380373}
@@ -398,7 +391,6 @@ client := kernel.NewClient(
398391client.Browsers .New (
399392 context.TODO (),
400393 kernel.BrowserNewParams {
401- InvocationID : kernel.String (" REPLACE_ME" ),
402394 Persistence : kernel.BrowserPersistenceParam {
403395 ID: " browser-for-user-1234" ,
404396 },
@@ -418,7 +410,6 @@ var response *http.Response
418410browser , err := client.Browsers .New (
419411 context.TODO (),
420412 kernel.BrowserNewParams {
421- InvocationID : kernel.String (" REPLACE_ME" ),
422413 Persistence : kernel.BrowserPersistenceParam {
423414 ID: " browser-for-user-1234" ,
424415 },
0 commit comments