Loading...
Loading...
Configure account addresses, authentication providers, IP access controls, billing groups, and integration secrets. This skill provides Go SDK examples.
npx skill4agent add team-telnyx/telnyx-ext-agent-skills telnyx-account-access-gogo get github.com/team-telnyx/telnyx-goimport (
"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")),
)clientGET /addresses page, err := client.Addresses.List(context.TODO(), telnyx.AddressListParams{})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)POST /addressesfirst_namelast_namebusiness_namestreet_addresslocalitycountry_codeaddress_bookadministrative_areaboroughcustomer_referenceextended_addressneighborhoodphone_numberpostal_codevalidate_address address, err := client.Addresses.New(context.TODO(), telnyx.AddressNewParams{
BusinessName: "Toy-O'Kon",
CountryCode: "US",
FirstName: "Alfred",
LastName: "Foster",
Locality: "Austin",
StreetAddress: "600 Congress Avenue",
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", address.Data)GET /addresses/{id} address, err := client.Addresses.Get(context.TODO(), "id")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", address.Data)DELETE /addresses/{id} address, err := client.Addresses.Delete(context.TODO(), "id")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", address.Data)POST /addresses/{id}/actions/accept_suggestionsid response, err := client.Addresses.Actions.AcceptSuggestions(
context.TODO(),
"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
telnyx.AddressActionAcceptSuggestionsParams{},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Data)POST /addresses/actions/validatecountry_codestreet_addresspostal_codeadministrative_areaextended_addresslocality response, err := client.Addresses.Actions.Validate(context.TODO(), telnyx.AddressActionValidateParams{
CountryCode: "US",
PostalCode: "78701",
StreetAddress: "600 Congress Avenue",
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Data)GET /authentication_providers page, err := client.AuthenticationProviders.List(context.TODO(), telnyx.AuthenticationProviderListParams{})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)POST /authentication_providersnameshort_namesettingsactivesettings_url authenticationProvider, err := client.AuthenticationProviders.New(context.TODO(), 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 {
panic(err.Error())
}
fmt.Printf("%+v\n", authenticationProvider.Data)GET /authentication_providers/{id} authenticationProvider, err := client.AuthenticationProviders.Get(context.TODO(), "id")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", authenticationProvider.Data)PATCH /authentication_providers/{id}activenamesettingssettings_urlshort_name authenticationProvider, err := client.AuthenticationProviders.Update(
context.TODO(),
"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 {
panic(err.Error())
}
fmt.Printf("%+v\n", authenticationProvider.Data)DELETE /authentication_providers/{id} authenticationProvider, err := client.AuthenticationProviders.Delete(context.TODO(), "id")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", authenticationProvider.Data)GET /billing_groups page, err := client.BillingGroups.List(context.TODO(), telnyx.BillingGroupListParams{})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)POST /billing_groupsname billingGroup, err := client.BillingGroups.New(context.TODO(), telnyx.BillingGroupNewParams{
Name: telnyx.String("string"),
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", billingGroup.Data)GET /billing_groups/{id} billingGroup, err := client.BillingGroups.Get(context.TODO(), "f5586561-8ff0-4291-a0ac-84fe544797bd")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", billingGroup.Data)PATCH /billing_groups/{id}name billingGroup, err := client.BillingGroups.Update(
context.TODO(),
"f5586561-8ff0-4291-a0ac-84fe544797bd",
telnyx.BillingGroupUpdateParams{
Name: telnyx.String("string"),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", billingGroup.Data)DELETE /billing_groups/{id} billingGroup, err := client.BillingGroups.Delete(context.TODO(), "f5586561-8ff0-4291-a0ac-84fe544797bd")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", billingGroup.Data)GET /integration_secrets page, err := client.IntegrationSecrets.List(context.TODO(), telnyx.IntegrationSecretListParams{})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)POST /integration_secretsidentifiertypepasswordtokenusername integrationSecret, err := client.IntegrationSecrets.New(context.TODO(), telnyx.IntegrationSecretNewParams{
Identifier: "my_secret",
Type: telnyx.IntegrationSecretNewParamsTypeBearer,
Token: telnyx.String("my_secret_value"),
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", integrationSecret.Data)DELETE /integration_secrets/{id} err := client.IntegrationSecrets.Delete(context.TODO(), "id")
if err != nil {
panic(err.Error())
}GET /access_ip_address page, err := client.AccessIPAddress.List(context.TODO(), telnyx.AccessIPAddressListParams{})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)POST /access_ip_addressip_addressdescription accessIPAddressResponse, err := client.AccessIPAddress.New(context.TODO(), telnyx.AccessIPAddressNewParams{
IPAddress: "ip_address",
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", accessIPAddressResponse.ID)GET /access_ip_address/{access_ip_address_id} accessIPAddressResponse, err := client.AccessIPAddress.Get(context.TODO(), "access_ip_address_id")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", accessIPAddressResponse.ID)DELETE /access_ip_address/{access_ip_address_id} accessIPAddressResponse, err := client.AccessIPAddress.Delete(context.TODO(), "access_ip_address_id")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", accessIPAddressResponse.ID)GET /access_ip_ranges page, err := client.AccessIPRanges.List(context.TODO(), telnyx.AccessIPRangeListParams{})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)POST /access_ip_rangescidr_blockdescription accessIPRange, err := client.AccessIPRanges.New(context.TODO(), telnyx.AccessIPRangeNewParams{
CidrBlock: "cidr_block",
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", accessIPRange.ID)DELETE /access_ip_ranges/{access_ip_range_id} accessIPRange, err := client.AccessIPRanges.Delete(context.TODO(), "access_ip_range_id")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", accessIPRange.ID)