telnyx-account-access-go

📁 team-telnyx/telnyx-ext-agent-skills 📅 3 days ago
3
总安装量
3
周安装量
#61146
全站排名
安装命令
npx skills add https://github.com/team-telnyx/telnyx-ext-agent-skills --skill telnyx-account-access-go

Agent 安装分布

opencode 3
gemini-cli 3
antigravity 3
claude-code 3
windsurf 3
github-copilot 3

Skill 文档

Telnyx Account Access – Go

Installation

go get github.com/team-telnyx/telnyx-go

Setup

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 client is already initialized as shown above.

List all addresses

Returns a list of your addresses.

GET /addresses

	page, err := client.Addresses.List(context.TODO(), telnyx.AddressListParams{})
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", page)

Creates an address

Creates an address.

POST /addresses — Required: first_name, last_name, business_name, street_address, locality, country_code

Optional: address_book (boolean), administrative_area (string), borough (string), customer_reference (string), extended_address (string), neighborhood (string), phone_number (string), postal_code (string), validate_address (boolean)

	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)

Retrieve an address

Retrieves the details of an existing address.

GET /addresses/{id}

	address, err := client.Addresses.Get(context.TODO(), "id")
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", address.Data)

Deletes an address

Deletes an existing address.

DELETE /addresses/{id}

	address, err := client.Addresses.Delete(context.TODO(), "id")
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", address.Data)

Accepts this address suggestion as a new emergency address for Operator Connect and finishes the uploads of the numbers associated with it to Microsoft.

POST /addresses/{id}/actions/accept_suggestions

Optional: id (string)

	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)

Validate an address

Validates an address for emergency services.

POST /addresses/actions/validate — Required: country_code, street_address, postal_code

Optional: administrative_area (string), extended_address (string), locality (string)

	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)

List all SSO authentication providers

Returns a list of your SSO authentication providers.

GET /authentication_providers

	page, err := client.AuthenticationProviders.List(context.TODO(), telnyx.AuthenticationProviderListParams{})
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", page)

Creates an authentication provider

Creates an authentication provider.

POST /authentication_providers — Required: name, short_name, settings

Optional: active (boolean), settings_url (uri)

	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)

Retrieve an authentication provider

Retrieves the details of an existing authentication provider.

GET /authentication_providers/{id}

	authenticationProvider, err := client.AuthenticationProviders.Get(context.TODO(), "id")
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", authenticationProvider.Data)

Update an authentication provider

Updates settings of an existing authentication provider.

PATCH /authentication_providers/{id}

Optional: active (boolean), name (string), settings (object), settings_url (uri), short_name (string)

	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)

Deletes an authentication provider

Deletes an existing authentication provider.

DELETE /authentication_providers/{id}

	authenticationProvider, err := client.AuthenticationProviders.Delete(context.TODO(), "id")
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", authenticationProvider.Data)

List all billing groups

GET /billing_groups

	page, err := client.BillingGroups.List(context.TODO(), telnyx.BillingGroupListParams{})
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", page)

Create a billing group

POST /billing_groups

Optional: name (string)

	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 a billing group

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)

Update a billing group

PATCH /billing_groups/{id}

Optional: name (string)

	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 a billing group

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)

List integration secrets

Retrieve a list of all integration secrets configured by the user.

GET /integration_secrets

	page, err := client.IntegrationSecrets.List(context.TODO(), telnyx.IntegrationSecretListParams{})
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", page)

Create a secret

Create a new secret with an associated identifier that can be used to securely integrate with other services.

POST /integration_secrets — Required: identifier, type

Optional: password (string), token (string), username (string)

	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 an integration secret

Delete an integration secret given its ID.

DELETE /integration_secrets/{id}

	err := client.IntegrationSecrets.Delete(context.TODO(), "id")
	if err != nil {
		panic(err.Error())
	}

List all Access IP Addresses

GET /access_ip_address

	page, err := client.AccessIPAddress.List(context.TODO(), telnyx.AccessIPAddressListParams{})
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", page)

Create new Access IP Address

POST /access_ip_address — Required: ip_address

Optional: description (string)

	accessIPAddressResponse, err := client.AccessIPAddress.New(context.TODO(), telnyx.AccessIPAddressNewParams{
		IPAddress: "ip_address",
	})
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", accessIPAddressResponse.ID)

Retrieve an access IP address

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

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)

List all Access IP Ranges

GET /access_ip_ranges

	page, err := client.AccessIPRanges.List(context.TODO(), telnyx.AccessIPRangeListParams{})
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", page)

Create new Access IP Range

POST /access_ip_ranges — Required: cidr_block

Optional: description (string)

	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

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)