# Durable Objects # Namespaces ## List Namespaces `client.DurableObjects.Namespaces.List(ctx, params) (*V4PagePaginationArray[Namespace], error)` **get** `/accounts/{account_id}/workers/durable_objects/namespaces` Returns the Durable Object namespaces owned by an account. ### Parameters - `params NamespaceListParams` - `AccountID param.Field[string]` Path param: Identifier. - `Page param.Field[int64]` Query param: Current page. - `PerPage param.Field[int64]` Query param: Items per-page. ### Returns - `type Namespace struct{…}` - `ID string` - `Class string` - `Name string` - `Script string` - `UseSqlite bool` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/durable_objects" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) page, err := client.DurableObjects.Namespaces.List(context.TODO(), durable_objects.NamespaceListParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", page) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": [ { "id": "id", "class": "class", "name": "name", "script": "script", "use_sqlite": true } ], "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000, "total_pages": 100 } } ``` ## Domain Types ### Namespace - `type Namespace struct{…}` - `ID string` - `Class string` - `Name string` - `Script string` - `UseSqlite bool` # Objects ## List Objects `client.DurableObjects.Namespaces.Objects.List(ctx, id, params) (*CursorPaginationAfter[DurableObject], error)` **get** `/accounts/{account_id}/workers/durable_objects/namespaces/{id}/objects` Returns the Durable Objects in a given namespace. ### Parameters - `id string` ID of the namespace. - `params NamespaceObjectListParams` - `AccountID param.Field[string]` Path param: Identifier. - `Cursor param.Field[string]` Query param: Opaque token indicating the position from which to continue when requesting the next set of records. A valid value for the cursor can be obtained from the cursors object in the result_info structure. - `Limit param.Field[float64]` Query param: The number of objects to return. The cursor attribute may be used to iterate over the next batch of objects if there are more than the limit. ### Returns - `type DurableObject struct{…}` - `ID string` ID of the Durable Object. - `HasStoredData bool` Whether the Durable Object has stored data. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/durable_objects" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) page, err := client.DurableObjects.Namespaces.Objects.List( context.TODO(), "5fd1cafff895419c8bcc647fc64ab8f0", durable_objects.NamespaceObjectListParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", page) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": [ { "id": "fe7803fc55b964e09d94666545aab688d360c6bda69ba349ced1e5f28d2fc2c8", "hasStoredData": true } ], "result_info": { "count": 1, "cursor": "AAAAANuhDN7SjacTnSVsDu3WW1Lvst6dxJGTjRY5BhxPXdf6L6uTcpd_NVtjhn11OUYRsVEykxoUwF-JQU4dn6QylZSKTOJuG0indrdn_MlHpMRtsxgXjs-RPdHYIVm3odE_uvEQ_dTQGFm8oikZMohns34DLBgrQpc", "page": 1, "per_page": 20, "total_count": 2000, "total_pages": 100 } } ``` ## Domain Types ### Durable Object - `type DurableObject struct{…}` - `ID string` ID of the Durable Object. - `HasStoredData bool` Whether the Durable Object has stored data.