# Calls # SFU ## List apps `client.Calls.SFU.List(ctx, query) (*SinglePage[SFUListResponse], error)` **get** `/accounts/{account_id}/calls/apps` Lists all apps in the Cloudflare account ### Parameters - `query SFUListParams` - `AccountID param.Field[string]` The account identifier tag. ### Returns - `type SFUListResponse struct{…}` - `Created Time` The date and time the item was created. - `Modified Time` The date and time the item was last modified. - `Name string` A short description of Calls app, not shown to end users. - `UID string` A Cloudflare-generated unique identifier for a item. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/calls" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) page, err := client.Calls.SFU.List(context.TODO(), calls.SFUListParams{ 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": [ { "created": "2014-01-02T02:20:00Z", "modified": "2014-01-02T02:20:00Z", "name": "production-realtime-app", "uid": "2a95132c15732412d22c1476fa83f27a" } ] } ``` ## Retrieve app details `client.Calls.SFU.Get(ctx, appID, query) (*SFUGetResponse, error)` **get** `/accounts/{account_id}/calls/apps/{app_id}` Fetches details for a single Calls app. ### Parameters - `appID string` A Cloudflare-generated unique identifier for a item. - `query SFUGetParams` - `AccountID param.Field[string]` The account identifier tag. ### Returns - `type SFUGetResponse struct{…}` - `Created Time` The date and time the item was created. - `Modified Time` The date and time the item was last modified. - `Name string` A short description of Calls app, not shown to end users. - `UID string` A Cloudflare-generated unique identifier for a item. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/calls" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) sfu, err := client.Calls.SFU.Get( context.TODO(), "2a95132c15732412d22c1476fa83f27a", calls.SFUGetParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", sfu.UID) } ``` #### 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": { "created": "2014-01-02T02:20:00Z", "modified": "2014-01-02T02:20:00Z", "name": "production-realtime-app", "uid": "2a95132c15732412d22c1476fa83f27a" } } ``` ## Create a new app `client.Calls.SFU.New(ctx, params) (*SFUNewResponse, error)` **post** `/accounts/{account_id}/calls/apps` Creates a new Cloudflare calls app. An app is an unique enviroment where each Session can access all Tracks within the app. ### Parameters - `params SFUNewParams` - `AccountID param.Field[string]` Path param: The account identifier tag. - `Name param.Field[string]` Body param: A short description of Calls app, not shown to end users. ### Returns - `type SFUNewResponse struct{…}` - `Created Time` The date and time the item was created. - `Modified Time` The date and time the item was last modified. - `Name string` A short description of Calls app, not shown to end users. - `Secret string` Bearer token - `UID string` A Cloudflare-generated unique identifier for a item. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/calls" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) sfu, err := client.Calls.SFU.New(context.TODO(), calls.SFUNewParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", sfu.UID) } ``` #### 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": { "created": "2014-01-02T02:20:00Z", "modified": "2014-01-02T02:20:00Z", "name": "production-realtime-app", "secret": "66bcf64aa8907b9f9d90ac17746a77ce394c393b92b3916633dc02846e608ad4", "uid": "2a95132c15732412d22c1476fa83f27a" } } ``` ## Edit app details `client.Calls.SFU.Update(ctx, appID, params) (*SFUUpdateResponse, error)` **put** `/accounts/{account_id}/calls/apps/{app_id}` Edit details for a single app. ### Parameters - `appID string` A Cloudflare-generated unique identifier for a item. - `params SFUUpdateParams` - `AccountID param.Field[string]` Path param: The account identifier tag. - `Name param.Field[string]` Body param: A short description of Calls app, not shown to end users. ### Returns - `type SFUUpdateResponse struct{…}` - `Created Time` The date and time the item was created. - `Modified Time` The date and time the item was last modified. - `Name string` A short description of Calls app, not shown to end users. - `UID string` A Cloudflare-generated unique identifier for a item. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/calls" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) sfu, err := client.Calls.SFU.Update( context.TODO(), "2a95132c15732412d22c1476fa83f27a", calls.SFUUpdateParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", sfu.UID) } ``` #### 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": { "created": "2014-01-02T02:20:00Z", "modified": "2014-01-02T02:20:00Z", "name": "production-realtime-app", "uid": "2a95132c15732412d22c1476fa83f27a" } } ``` ## Delete app `client.Calls.SFU.Delete(ctx, appID, body) (*SFUDeleteResponse, error)` **delete** `/accounts/{account_id}/calls/apps/{app_id}` Deletes an app from Cloudflare Calls ### Parameters - `appID string` A Cloudflare-generated unique identifier for a item. - `body SFUDeleteParams` - `AccountID param.Field[string]` The account identifier tag. ### Returns - `type SFUDeleteResponse struct{…}` - `Created Time` The date and time the item was created. - `Modified Time` The date and time the item was last modified. - `Name string` A short description of Calls app, not shown to end users. - `UID string` A Cloudflare-generated unique identifier for a item. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/calls" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) sfu, err := client.Calls.SFU.Delete( context.TODO(), "2a95132c15732412d22c1476fa83f27a", calls.SFUDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", sfu.UID) } ``` #### 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": { "created": "2014-01-02T02:20:00Z", "modified": "2014-01-02T02:20:00Z", "name": "production-realtime-app", "uid": "2a95132c15732412d22c1476fa83f27a" } } ``` # TURN ## List TURN Keys `client.Calls.TURN.List(ctx, query) (*SinglePage[TURNListResponse], error)` **get** `/accounts/{account_id}/calls/turn_keys` Lists all TURN keys in the Cloudflare account ### Parameters - `query TURNListParams` - `AccountID param.Field[string]` The account identifier tag. ### Returns - `type TURNListResponse struct{…}` - `Created Time` The date and time the item was created. - `Modified Time` The date and time the item was last modified. - `Name string` A short description of Calls app, not shown to end users. - `UID string` A Cloudflare-generated unique identifier for a item. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/calls" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) page, err := client.Calls.TURN.List(context.TODO(), calls.TURNListParams{ 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": [ { "created": "2014-01-02T02:20:00Z", "modified": "2014-01-02T02:20:00Z", "name": "production-realtime-app", "uid": "2a95132c15732412d22c1476fa83f27a" } ] } ``` ## Retrieve TURN key details `client.Calls.TURN.Get(ctx, keyID, query) (*TURNGetResponse, error)` **get** `/accounts/{account_id}/calls/turn_keys/{key_id}` Fetches details for a single TURN key. ### Parameters - `keyID string` A Cloudflare-generated unique identifier for a item. - `query TURNGetParams` - `AccountID param.Field[string]` The account identifier tag. ### Returns - `type TURNGetResponse struct{…}` - `Created Time` The date and time the item was created. - `Modified Time` The date and time the item was last modified. - `Name string` A short description of Calls app, not shown to end users. - `UID string` A Cloudflare-generated unique identifier for a item. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/calls" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) turn, err := client.Calls.TURN.Get( context.TODO(), "2a95132c15732412d22c1476fa83f27a", calls.TURNGetParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", turn.UID) } ``` #### 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": { "created": "2014-01-02T02:20:00Z", "modified": "2014-01-02T02:20:00Z", "name": "production-realtime-app", "uid": "2a95132c15732412d22c1476fa83f27a" } } ``` ## Create a new TURN key `client.Calls.TURN.New(ctx, params) (*TURNNewResponse, error)` **post** `/accounts/{account_id}/calls/turn_keys` Creates a new Cloudflare Calls TURN key. ### Parameters - `params TURNNewParams` - `AccountID param.Field[string]` Path param: The account identifier tag. - `Name param.Field[string]` Body param: A short description of a TURN key, not shown to end users. ### Returns - `type TURNNewResponse struct{…}` - `Created Time` The date and time the item was created. - `Key string` Bearer token - `Modified Time` The date and time the item was last modified. - `Name string` A short description of a TURN key, not shown to end users. - `UID string` A Cloudflare-generated unique identifier for a item. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/calls" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) turn, err := client.Calls.TURN.New(context.TODO(), calls.TURNNewParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", turn.UID) } ``` #### 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": { "created": "2014-01-02T02:20:00Z", "key": "66bcf64aa8907b9f9d90ac17746a77ce394c393b92b3916633dc02846e608ad4", "modified": "2014-01-02T02:20:00Z", "name": "my-turn-key", "uid": "2a95132c15732412d22c1476fa83f27a" } } ``` ## Edit TURN key details `client.Calls.TURN.Update(ctx, keyID, params) (*TURNUpdateResponse, error)` **put** `/accounts/{account_id}/calls/turn_keys/{key_id}` Edit details for a single TURN key. ### Parameters - `keyID string` A Cloudflare-generated unique identifier for a item. - `params TURNUpdateParams` - `AccountID param.Field[string]` Path param: The account identifier tag. - `Name param.Field[string]` Body param: A short description of a TURN key, not shown to end users. ### Returns - `type TURNUpdateResponse struct{…}` - `Created Time` The date and time the item was created. - `Modified Time` The date and time the item was last modified. - `Name string` A short description of Calls app, not shown to end users. - `UID string` A Cloudflare-generated unique identifier for a item. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/calls" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) turn, err := client.Calls.TURN.Update( context.TODO(), "2a95132c15732412d22c1476fa83f27a", calls.TURNUpdateParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", turn.UID) } ``` #### 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": { "created": "2014-01-02T02:20:00Z", "modified": "2014-01-02T02:20:00Z", "name": "production-realtime-app", "uid": "2a95132c15732412d22c1476fa83f27a" } } ``` ## Delete TURN key `client.Calls.TURN.Delete(ctx, keyID, body) (*TURNDeleteResponse, error)` **delete** `/accounts/{account_id}/calls/turn_keys/{key_id}` Deletes a TURN key from Cloudflare Calls ### Parameters - `keyID string` A Cloudflare-generated unique identifier for a item. - `body TURNDeleteParams` - `AccountID param.Field[string]` The account identifier tag. ### Returns - `type TURNDeleteResponse struct{…}` - `Created Time` The date and time the item was created. - `Modified Time` The date and time the item was last modified. - `Name string` A short description of Calls app, not shown to end users. - `UID string` A Cloudflare-generated unique identifier for a item. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/calls" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) turn, err := client.Calls.TURN.Delete( context.TODO(), "2a95132c15732412d22c1476fa83f27a", calls.TURNDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", turn.UID) } ``` #### 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": { "created": "2014-01-02T02:20:00Z", "modified": "2014-01-02T02:20:00Z", "name": "production-realtime-app", "uid": "2a95132c15732412d22c1476fa83f27a" } } ```