telnyx-account-access-go
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese<!-- Auto-generated from Telnyx OpenAPI specs. Do not edit. -->
<!-- Auto-generated from Telnyx OpenAPI specs. Do not edit. -->
Telnyx Account Access - Go
Telnyx 账户访问 - Go
Installation
安装
bash
go get github.com/team-telnyx/telnyx-gobash
go get github.com/team-telnyx/telnyx-goSetup
初始化配置
go
import (
"context"
"fmt"
"os"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
client := telnyx.NewClient(
option.WithAPIKey(os.Getenv("TELNYX_API_KEY")),
)All examples below assume is already initialized as shown above.
clientgo
import (
"context"
"fmt"
"os"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
client := telnyx.NewClient(
option.WithAPIKey(os.Getenv("TELNYX_API_KEY")),
)以下所有示例均假定已经按照上述方式完成初始化。
clientError Handling
错误处理
All API calls can fail with network errors, rate limits (429), validation errors (422),
or authentication errors (401). Always handle errors in production code:
go
import "errors"
result, err := client.Messages.Send(ctx, params)
if err != nil {
var apiErr *telnyx.Error
if errors.As(err, &apiErr) {
switch apiErr.StatusCode {
case 422:
fmt.Println("Validation error — check required fields and formats")
case 429:
// Rate limited — wait and retry with exponential backoff
fmt.Println("Rate limited, retrying...")
default:
fmt.Printf("API error %d: %s\n", apiErr.StatusCode, apiErr.Error())
}
} else {
fmt.Println("Network error — check connectivity and retry")
}
}Common error codes: invalid API key, insufficient permissions,
resource not found, validation error (check field formats),
rate limited (retry with exponential backoff).
401403404422429所有API调用都可能因网络错误、速率限制(429)、校验错误(422)或身份认证错误(401)而失败。生产环境代码中请始终做好错误处理:
go
import "errors"
result, err := client.Messages.Send(ctx, params)
if err != nil {
var apiErr *telnyx.Error
if errors.As(err, &apiErr) {
switch apiErr.StatusCode {
case 422:
fmt.Println("Validation error — check required fields and formats")
case 429:
// Rate limited — wait and retry with exponential backoff
fmt.Println("Rate limited, retrying...")
default:
fmt.Printf("API error %d: %s\n", apiErr.StatusCode, apiErr.Error())
}
} else {
fmt.Println("Network error — check connectivity and retry")
}
}常见错误码: 无效API密钥, 权限不足, 资源不存在, 校验错误(请检查字段格式), 触发速率限制(请使用指数退避策略重试)。
401403404422429Important Notes
重要说明
- Pagination: Use for automatic iteration:
ListAutoPaging().iter := client.Resource.ListAutoPaging(ctx, params); for iter.Next() { item := iter.Current() }
- 分页: 使用实现自动遍历:
ListAutoPaging()。iter := client.Resource.ListAutoPaging(ctx, params); for iter.Next() { item := iter.Current() }
List all Access IP Addresses
列出所有访问IP地址
GET /access_ip_addressgo
page, err := client.AccessIPAddress.List(context.Background(), telnyx.AccessIPAddressListParams{})
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", page)Returns: (date-time), (string), (string), (string), (string), (enum: pending, added), (date-time), (string)
created_atdescriptionidip_addresssourcestatusupdated_atuser_idGET /access_ip_addressgo
page, err := client.AccessIPAddress.List(context.Background(), telnyx.AccessIPAddressListParams{})
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", page)返回参数: (date-time), (string), (string), (string), (string), (enum: pending, added), (date-time), (string)
created_atdescriptionidip_addresssourcestatusupdated_atuser_idCreate new Access IP Address
创建新的访问IP地址
POST /access_ip_addressip_addressOptional: (string)
descriptiongo
accessIPAddressResponse, err := client.AccessIPAddress.New(context.Background(), telnyx.AccessIPAddressNewParams{
IPAddress: "203.0.113.10",
})
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", accessIPAddressResponse.ID)Returns: (date-time), (string), (string), (string), (string), (enum: pending, added), (date-time), (string)
created_atdescriptionidip_addresssourcestatusupdated_atuser_idPOST /access_ip_addressip_address可选参数: (string)
descriptiongo
accessIPAddressResponse, err := client.AccessIPAddress.New(context.Background(), telnyx.AccessIPAddressNewParams{
IPAddress: "203.0.113.10",
})
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", accessIPAddressResponse.ID)返回参数: (date-time), (string), (string), (string), (string), (enum: pending, added), (date-time), (string)
created_atdescriptionidip_addresssourcestatusupdated_atuser_idRetrieve an access IP address
查询单个访问IP地址
GET /access_ip_address/{access_ip_address_id}go
accessIPAddressResponse, err := client.AccessIPAddress.Get(context.Background(), "access_ip_address_id")
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", accessIPAddressResponse.ID)Returns: (date-time), (string), (string), (string), (string), (enum: pending, added), (date-time), (string)
created_atdescriptionidip_addresssourcestatusupdated_atuser_idGET /access_ip_address/{access_ip_address_id}go
accessIPAddressResponse, err := client.AccessIPAddress.Get(context.Background(), "access_ip_address_id")
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", accessIPAddressResponse.ID)返回参数: (date-time), (string), (string), (string), (string), (enum: pending, added), (date-time), (string)
created_atdescriptionidip_addresssourcestatusupdated_atuser_idDelete access IP address
删除访问IP地址
DELETE /access_ip_address/{access_ip_address_id}go
accessIPAddressResponse, err := client.AccessIPAddress.Delete(context.Background(), "access_ip_address_id")
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", accessIPAddressResponse.ID)Returns: (date-time), (string), (string), (string), (string), (enum: pending, added), (date-time), (string)
created_atdescriptionidip_addresssourcestatusupdated_atuser_idDELETE /access_ip_address/{access_ip_address_id}go
accessIPAddressResponse, err := client.AccessIPAddress.Delete(context.Background(), "access_ip_address_id")
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", accessIPAddressResponse.ID)返回参数: (date-time), (string), (string), (string), (string), (enum: pending, added), (date-time), (string)
created_atdescriptionidip_addresssourcestatusupdated_atuser_idList all addresses
列出所有地址
Returns a list of your addresses.
GET /addressesgo
page, err := client.Addresses.List(context.Background(), telnyx.AddressListParams{})
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", page)Returns: (boolean), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (boolean)
address_bookadministrative_areaboroughbusiness_namecountry_codecreated_atcustomer_referenceextended_addressfirst_nameidlast_namelocalityneighborhoodphone_numberpostal_coderecord_typestreet_addressupdated_atvalidate_address返回你的所有地址列表。
GET /addressesgo
page, err := client.Addresses.List(context.Background(), telnyx.AddressListParams{})
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", page)返回参数: (boolean), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (boolean)
address_bookadministrative_areaboroughbusiness_namecountry_codecreated_atcustomer_referenceextended_addressfirst_nameidlast_namelocalityneighborhoodphone_numberpostal_coderecord_typestreet_addressupdated_atvalidate_addressCreates an address
创建地址
Creates an address.
POST /addressesfirst_namelast_namebusiness_namestreet_addresslocalitycountry_codeOptional: (boolean), (string), (string), (string), (string), (string), (string), (string), (boolean)
address_bookadministrative_areaboroughcustomer_referenceextended_addressneighborhoodphone_numberpostal_codevalidate_addressgo
address, err := client.Addresses.New(context.Background(), telnyx.AddressNewParams{
BusinessName: "Toy-O'Kon",
CountryCode: "US",
FirstName: "Alfred",
LastName: "Foster",
Locality: "Austin",
StreetAddress: "600 Congress Avenue",
})
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", address.Data)Returns: (boolean), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (boolean)
address_bookadministrative_areaboroughbusiness_namecountry_codecreated_atcustomer_referenceextended_addressfirst_nameidlast_namelocalityneighborhoodphone_numberpostal_coderecord_typestreet_addressupdated_atvalidate_address创建一个新地址。
POST /addressesfirst_namelast_namebusiness_namestreet_addresslocalitycountry_code可选参数: (boolean), (string), (string), (string), (string), (string), (string), (string), (boolean)
address_bookadministrative_areaboroughcustomer_referenceextended_addressneighborhoodphone_numberpostal_codevalidate_addressgo
address, err := client.Addresses.New(context.Background(), telnyx.AddressNewParams{
BusinessName: "Toy-O'Kon",
CountryCode: "US",
FirstName: "Alfred",
LastName: "Foster",
Locality: "Austin",
StreetAddress: "600 Congress Avenue",
})
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", address.Data)返回参数: (boolean), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (boolean)
address_bookadministrative_areaboroughbusiness_namecountry_codecreated_atcustomer_referenceextended_addressfirst_nameidlast_namelocalityneighborhoodphone_numberpostal_coderecord_typestreet_addressupdated_atvalidate_addressValidate an address
校验地址
Validates an address for emergency services.
POST /addresses/actions/validatecountry_codestreet_addresspostal_codeOptional: (string), (string), (string)
administrative_areaextended_addresslocalitygo
response, err := client.Addresses.Actions.Validate(context.Background(), telnyx.AddressActionValidateParams{
CountryCode: "US",
PostalCode: "78701",
StreetAddress: "600 Congress Avenue",
})
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", response.Data)Returns: (array[object]), (string), (enum: valid, invalid), (object)
errorsrecord_typeresultsuggested校验地址是否可用于紧急服务。
POST /addresses/actions/validatecountry_codestreet_addresspostal_code可选参数: (string), (string), (string)
administrative_areaextended_addresslocalitygo
response, err := client.Addresses.Actions.Validate(context.Background(), telnyx.AddressActionValidateParams{
CountryCode: "US",
PostalCode: "78701",
StreetAddress: "600 Congress Avenue",
})
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", response.Data)返回参数: (array[object]), (string), (enum: valid, invalid), (object)
errorsrecord_typeresultsuggestedRetrieve an address
查询单个地址
Retrieves the details of an existing address.
GET /addresses/{id}go
address, err := client.Addresses.Get(context.Background(), "id")
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", address.Data)Returns: (boolean), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (boolean)
address_bookadministrative_areaboroughbusiness_namecountry_codecreated_atcustomer_referenceextended_addressfirst_nameidlast_namelocalityneighborhoodphone_numberpostal_coderecord_typestreet_addressupdated_atvalidate_address查询现有地址的详细信息。
GET /addresses/{id}go
address, err := client.Addresses.Get(context.Background(), "id")
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", address.Data)返回参数: (boolean), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (boolean)
address_bookadministrative_areaboroughbusiness_namecountry_codecreated_atcustomer_referenceextended_addressfirst_nameidlast_namelocalityneighborhoodphone_numberpostal_coderecord_typestreet_addressupdated_atvalidate_addressDeletes an address
删除地址
Deletes an existing address.
DELETE /addresses/{id}go
address, err := client.Addresses.Delete(context.Background(), "id")
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", address.Data)Returns: (boolean), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (boolean)
address_bookadministrative_areaboroughbusiness_namecountry_codecreated_atcustomer_referenceextended_addressfirst_nameidlast_namelocalityneighborhoodphone_numberpostal_coderecord_typestreet_addressupdated_atvalidate_address删除现有地址。
DELETE /addresses/{id}go
address, err := client.Addresses.Delete(context.Background(), "id")
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", address.Data)返回参数: (boolean), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (string), (boolean)
address_bookadministrative_areaboroughbusiness_namecountry_codecreated_atcustomer_referenceextended_addressfirst_nameidlast_namelocalityneighborhoodphone_numberpostal_coderecord_typestreet_addressupdated_atvalidate_addressAccepts this address suggestion as a new emergency address for Operator Connect and finishes the uploads of the numbers associated with it to Microsoft.
接受该地址建议作为Operator Connect的新紧急地址,并完成关联号码到微软平台的上传。
POST /addresses/{id}/actions/accept_suggestionsOptional: (string)
idgo
response, err := client.Addresses.Actions.AcceptSuggestions(
context.Background(),
"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
telnyx.AddressActionAcceptSuggestionsParams{},
)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", response.Data)Returns: (boolean), (uuid), (enum: address_suggestion)
acceptedidrecord_typePOST /addresses/{id}/actions/accept_suggestions可选参数: (string)
idgo
response, err := client.Addresses.Actions.AcceptSuggestions(
context.Background(),
"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
telnyx.AddressActionAcceptSuggestionsParams{},
)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", response.Data)返回参数: (boolean), (uuid), (enum: address_suggestion)
acceptedidrecord_typeList all SSO authentication providers
列出所有SSO身份认证提供商
Returns a list of your SSO authentication providers.
GET /authentication_providersgo
page, err := client.AuthenticationProviders.List(context.Background(), telnyx.AuthenticationProviderListParams{})
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", page)Returns: (date-time), (boolean), (date-time), (uuid), (string), (uuid), (string), (object), (string), (date-time)
activated_atactivecreated_atidnameorganization_idrecord_typesettingsshort_nameupdated_at返回你的所有SSO身份认证提供商列表。
GET /authentication_providersgo
page, err := client.AuthenticationProviders.List(context.Background(), telnyx.AuthenticationProviderListParams{})
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", page)返回参数: (date-time), (boolean), (date-time), (uuid), (string), (uuid), (string), (object), (string), (date-time)
activated_atactivecreated_atidnameorganization_idrecord_typesettingsshort_nameupdated_atCreates an authentication provider
创建身份认证提供商
Creates an authentication provider.
POST /authentication_providersnameshort_namesettingsOptional: (boolean), (uri)
activesettings_urlgo
authenticationProvider, err := client.AuthenticationProviders.New(context.Background(), telnyx.AuthenticationProviderNewParams{
Name: "Okta",
Settings: telnyx.SettingsParam{
IdpCertFingerprint: "13:38:C7:BB:C9:FF:4A:70:38:3A:E3:D9:5C:CD:DB:2E:50:1E:80:A7",
IdpEntityID: "https://myorg.myidp.com/saml/metadata",
IdpSSOTargetURL: "https://myorg.myidp.com/trust/saml2/http-post/sso",
},
ShortName: "myorg",
})
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", authenticationProvider.Data)Returns: (date-time), (boolean), (date-time), (uuid), (string), (uuid), (string), (object), (string), (date-time)
activated_atactivecreated_atidnameorganization_idrecord_typesettingsshort_nameupdated_at创建一个新的身份认证提供商。
POST /authentication_providersnameshort_namesettings可选参数: (boolean), (uri)
activesettings_urlgo
authenticationProvider, err := client.AuthenticationProviders.New(context.Background(), telnyx.AuthenticationProviderNewParams{
Name: "Okta",
Settings: telnyx.SettingsParam{
IdpCertFingerprint: "13:38:C7:BB:C9:FF:4A:70:38:3A:E3:D9:5C:CD:DB:2E:50:1E:80:A7",
IdpEntityID: "https://myorg.myidp.com/saml/metadata",
IdpSSOTargetURL: "https://myorg.myidp.com/trust/saml2/http-post/sso",
},
ShortName: "myorg",
})
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", authenticationProvider.Data)返回参数: (date-time), (boolean), (date-time), (uuid), (string), (uuid), (string), (object), (string), (date-time)
activated_atactivecreated_atidnameorganization_idrecord_typesettingsshort_nameupdated_atRetrieve an authentication provider
查询单个身份认证提供商
Retrieves the details of an existing authentication provider.
GET /authentication_providers/{id}go
authenticationProvider, err := client.AuthenticationProviders.Get(context.Background(), "id")
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", authenticationProvider.Data)Returns: (date-time), (boolean), (date-time), (uuid), (string), (uuid), (string), (object), (string), (date-time)
activated_atactivecreated_atidnameorganization_idrecord_typesettingsshort_nameupdated_at查询现有身份认证提供商的详细信息。
GET /authentication_providers/{id}go
authenticationProvider, err := client.AuthenticationProviders.Get(context.Background(), "id")
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", authenticationProvider.Data)返回参数: (date-time), (boolean), (date-time), (uuid), (string), (uuid), (string), (object), (string), (date-time)
activated_atactivecreated_atidnameorganization_idrecord_typesettingsshort_nameupdated_atUpdate an authentication provider
更新身份认证提供商
Updates settings of an existing authentication provider.
PATCH /authentication_providers/{id}Optional: (boolean), (string), (object), (uri), (string)
activenamesettingssettings_urlshort_namego
authenticationProvider, err := client.AuthenticationProviders.Update(
context.Background(),
"id",
telnyx.AuthenticationProviderUpdateParams{
Active: telnyx.Bool(true),
Name: telnyx.String("Okta"),
Settings: telnyx.SettingsParam{
IdpEntityID: "https://myorg.myidp.com/saml/metadata",
IdpSSOTargetURL: "https://myorg.myidp.com/trust/saml2/http-post/sso",
IdpCertFingerprint: "13:38:C7:BB:C9:FF:4A:70:38:3A:E3:D9:5C:CD:DB:2E:50:1E:80:A7",
IdpCertFingerprintAlgorithm: telnyx.SettingsIdpCertFingerprintAlgorithmSha1,
},
ShortName: telnyx.String("myorg"),
},
)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", authenticationProvider.Data)Returns: (date-time), (boolean), (date-time), (uuid), (string), (uuid), (string), (object), (string), (date-time)
activated_atactivecreated_atidnameorganization_idrecord_typesettingsshort_nameupdated_at更新现有身份认证提供商的配置。
PATCH /authentication_providers/{id}可选参数: (boolean), (string), (object), (uri), (string)
activenamesettingssettings_urlshort_namego
authenticationProvider, err := client.AuthenticationProviders.Update(
context.Background(),
"id",
telnyx.AuthenticationProviderUpdateParams{
Active: telnyx.Bool(true),
Name: telnyx.String("Okta"),
Settings: telnyx.SettingsParam{
IdpEntityID: "https://myorg.myidp.com/saml/metadata",
IdpSSOTargetURL: "https://myorg.myidp.com/trust/saml2/http-post/sso",
IdpCertFingerprint: "13:38:C7:BB:C9:FF:4A:70:38:3A:E3:D9:5C:CD:DB:2E:50:1E:80:A7",
IdpCertFingerprintAlgorithm: telnyx.SettingsIdpCertFingerprintAlgorithmSha1,
},
ShortName: telnyx.String("myorg"),
},
)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", authenticationProvider.Data)返回参数: (date-time), (boolean), (date-time), (uuid), (string), (uuid), (string), (object), (string), (date-time)
activated_atactivecreated_atidnameorganization_idrecord_typesettingsshort_nameupdated_atDeletes an authentication provider
删除身份认证提供商
Deletes an existing authentication provider.
DELETE /authentication_providers/{id}go
authenticationProvider, err := client.AuthenticationProviders.Delete(context.Background(), "id")
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", authenticationProvider.Data)Returns: (date-time), (boolean), (date-time), (uuid), (string), (uuid), (string), (object), (string), (date-time)
activated_atactivecreated_atidnameorganization_idrecord_typesettingsshort_nameupdated_at删除现有身份认证提供商。
DELETE /authentication_providers/{id}go
authenticationProvider, err := client.AuthenticationProviders.Delete(context.Background(), "id")
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", authenticationProvider.Data)返回参数: (date-time), (boolean), (date-time), (uuid), (string), (uuid), (string), (object), (string), (date-time)
activated_atactivecreated_atidnameorganization_idrecord_typesettingsshort_nameupdated_atList all billing groups
列出所有账单组
GET /billing_groupsgo
page, err := client.BillingGroups.List(context.Background(), telnyx.BillingGroupListParams{})
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", page)Returns: (date-time), (date-time), (uuid), (string), (uuid), (enum: billing_group), (date-time)
created_atdeleted_atidnameorganization_idrecord_typeupdated_atGET /billing_groupsgo
page, err := client.BillingGroups.List(context.Background(), telnyx.BillingGroupListParams{})
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", page)返回参数: (date-time), (date-time), (uuid), (string), (uuid), (enum: billing_group), (date-time)
created_atdeleted_atidnameorganization_idrecord_typeupdated_atCreate a billing group
创建账单组
POST /billing_groupsOptional: (string)
namego
billingGroup, err := client.BillingGroups.New(context.Background(), telnyx.BillingGroupNewParams{
Name: telnyx.String("string"),
})
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", billingGroup.Data)Returns: (date-time), (date-time), (uuid), (string), (uuid), (enum: billing_group), (date-time)
created_atdeleted_atidnameorganization_idrecord_typeupdated_atPOST /billing_groups可选参数: (string)
namego
billingGroup, err := client.BillingGroups.New(context.Background(), telnyx.BillingGroupNewParams{
Name: telnyx.String("string"),
})
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", billingGroup.Data)返回参数: (date-time), (date-time), (uuid), (string), (uuid), (enum: billing_group), (date-time)
created_atdeleted_atidnameorganization_idrecord_typeupdated_atGet a billing group
查询单个账单组
GET /billing_groups/{id}go
billingGroup, err := client.BillingGroups.Get(context.Background(), "f5586561-8ff0-4291-a0ac-84fe544797bd")
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", billingGroup.Data)Returns: (date-time), (date-time), (uuid), (string), (uuid), (enum: billing_group), (date-time)
created_atdeleted_atidnameorganization_idrecord_typeupdated_atGET /billing_groups/{id}go
billingGroup, err := client.BillingGroups.Get(context.Background(), "f5586561-8ff0-4291-a0ac-84fe544797bd")
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", billingGroup.Data)返回参数: (date-time), (date-time), (uuid), (string), (uuid), (enum: billing_group), (date-time)
created_atdeleted_atidnameorganization_idrecord_typeupdated_atUpdate a billing group
更新账单组
PATCH /billing_groups/{id}Optional: (string)
namego
billingGroup, err := client.BillingGroups.Update(
context.Background(),
"f5586561-8ff0-4291-a0ac-84fe544797bd",
telnyx.BillingGroupUpdateParams{
Name: telnyx.String("string"),
},
)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", billingGroup.Data)Returns: (date-time), (date-time), (uuid), (string), (uuid), (enum: billing_group), (date-time)
created_atdeleted_atidnameorganization_idrecord_typeupdated_atPATCH /billing_groups/{id}可选参数: (string)
namego
billingGroup, err := client.BillingGroups.Update(
context.Background(),
"f5586561-8ff0-4291-a0ac-84fe544797bd",
telnyx.BillingGroupUpdateParams{
Name: telnyx.String("string"),
},
)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", billingGroup.Data)返回参数: (date-time), (date-time), (uuid), (string), (uuid), (enum: billing_group), (date-time)
created_atdeleted_atidnameorganization_idrecord_typeupdated_atDelete a billing group
删除账单组
DELETE /billing_groups/{id}go
billingGroup, err := client.BillingGroups.Delete(context.Background(), "f5586561-8ff0-4291-a0ac-84fe544797bd")
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", billingGroup.Data)Returns: (date-time), (date-time), (uuid), (string), (uuid), (enum: billing_group), (date-time)
created_atdeleted_atidnameorganization_idrecord_typeupdated_atDELETE /billing_groups/{id}go
billingGroup, err := client.BillingGroups.Delete(context.Background(), "f5586561-8ff0-4291-a0ac-84fe544797bd")
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", billingGroup.Data)返回参数: (date-time), (date-time), (uuid), (string), (uuid), (enum: billing_group), (date-time)
created_atdeleted_atidnameorganization_idrecord_typeupdated_atList integration secrets
列出集成密钥
Retrieve a list of all integration secrets configured by the user.
GET /integration_secretsgo
page, err := client.IntegrationSecrets.List(context.Background(), telnyx.IntegrationSecretListParams{})
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", page)Returns: (date-time), (string), (string), (string), (date-time)
created_atididentifierrecord_typeupdated_at查询用户配置的所有集成密钥列表。
GET /integration_secretsgo
page, err := client.IntegrationSecrets.List(context.Background(), telnyx.IntegrationSecretListParams{})
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", page)返回参数: (date-time), (string), (string), (string), (date-time)
created_atididentifierrecord_typeupdated_atCreate a secret
创建密钥
Create a new secret with an associated identifier that can be used to securely integrate with other services.
POST /integration_secretsidentifiertypeOptional: (string), (string), (string)
passwordtokenusernamego
integrationSecret, err := client.IntegrationSecrets.New(context.Background(), telnyx.IntegrationSecretNewParams{
Identifier: "my_secret",
Type: telnyx.IntegrationSecretNewParamsTypeBearer,
Token: telnyx.String("my_secret_value"),
})
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", integrationSecret.Data)Returns: (date-time), (string), (string), (string), (date-time)
created_atididentifierrecord_typeupdated_at创建关联了唯一标识符的新密钥,可用于与其他服务的安全集成。
POST /integration_secretsidentifiertype可选参数: (string), (string), (string)
passwordtokenusernamego
integrationSecret, err := client.IntegrationSecrets.New(context.Background(), telnyx.IntegrationSecretNewParams{
Identifier: "my_secret",
Type: telnyx.IntegrationSecretNewParamsTypeBearer,
Token: telnyx.String("my_secret_value"),
})
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", integrationSecret.Data)返回参数: (date-time), (string), (string), (string), (date-time)
created_atididentifierrecord_typeupdated_atDelete an integration secret
删除集成密钥
Delete an integration secret given its ID.
DELETE /integration_secrets/{id}go
err := client.IntegrationSecrets.Delete(context.Background(), "id")
if err != nil {
log.Fatal(err)
}根据ID删除指定的集成密钥。
DELETE /integration_secrets/{id}go
err := client.IntegrationSecrets.Delete(context.Background(), "id")
if err != nil {
log.Fatal(err)
}Create an Access Token.
创建访问令牌
Create an Access Token (JWT) for the credential.
POST /telephony_credentials/{id}/tokengo
response, err := client.TelephonyCredentials.NewToken(context.Background(), "id")
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", response)为凭证创建访问令牌(JWT)。
POST /telephony_credentials/{id}/tokengo
response, err := client.TelephonyCredentials.NewToken(context.Background(), "id")
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", response)