Skip to content

easyang/telnyx-java

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

96 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Telnyx Java SDK

Telnyx

Build Status Maven Central

Java SDK for the Telnyx API

  • API version: 2.0.0

SIP trunking, SMS, MMS, Call Control and Telephony Data Services.

Automatically generated by the OpenAPI Generator

Local Installation

Maven users

Add this dependency to your project's POM:

<dependency>
  <groupId>com.telnyx.sdk</groupId>
  <artifactId>telnyx</artifactId>
  <version>2.6.0</version>
  <scope>compile</scope>
</dependency>

Gradle users

Add this dependency to your project's build file:

compile "com.telnyx.sdk:telnyx:2.6.0"

Others

To build the API client library locally, first clone this repo and insure the telnyx-mock is installed and running for test validation, use -DskipTests as a flag if the mock is not running.

At first generate the JAR by executing:

mvn clean package

Then manually install the following JARs:

  • target/telnyx-2.6.0.jar
  • target/lib/*.jar

JDK Support

API client library supports:

  1. Java 1.8+
  2. Maven/Gradle

Getting Started

// Import classes:
import com.telnyx.sdk.ApiClient;
import com.telnyx.sdk.ApiException;
import com.telnyx.sdk.Configuration;
import com.telnyx.sdk.auth.*;
import com.telnyx.sdk.model.*;
import com.telnyx.sdk.api.MessagesApi;

public class Example {

    private static final String YOUR_TELNYX_NUMBER = "+19842550944";
    private static final String YOUR_MOBILE_NUMBER = "+19198675309";
    private static final String YOUR_TELNYX_API_KEY = "KEY";

    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();
        defaultClient.setBasePath("https://api.telnyx.com/v2");

        // Configure HTTP bearer authorization: bearerAuth
        HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth");
        bearerAuth.setBearerToken(YOUR_TELNYX_API_KEY);

        MessagesApi apiInstance = new MessagesApi(defaultClient);
         // CreateMessageRequest | Message payload
        CreateMessageRequest createMessageRequest = new CreateMessageRequest()
                .from(YOUR_TELNYX_NUMBER)
                .to(YOUR_MOBILE_NUMBER)
                .text("Hello From Telnyx");
        try {
            MessageResponse result = apiInstance.createMessage(createMessageRequest);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling MessagesApi#createMessage");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Reason: " + e.getResponseBody());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}

Documentation for API Endpoints

All URIs are relative to https://api.telnyx.com/v2

Class Method HTTP request Description
AccessTokensApi createTelephonyCredentialToken POST /telephony_credentials/{id}/token Create an Access Token.
BulkCredentialsApi bulkCredentialAction POST /actions/{action}/telephony_credentials Perform activate or deactivate action on all credentials filtered by the provided tag.
BulkCredentialsApi createBulkTelephonyCredential POST /actions/bulk/telephony_credentials Creates several credentials
BulkCredentialsApi deleteBulkTelephonyCredential DELETE /actions/bulk/telephony_credentials Delete several credentials
BulkCredentialsApi updateBulkTelephonyCredential PATCH /actions/bulk/telephony_credentials Update several credentials
CallCommandsApi callAnswer POST /calls/{call_control_id}/actions/answer Answer call
CallCommandsApi callBridge POST /calls/{call_control_id}/actions/bridge Bridge calls
CallCommandsApi callDial POST /calls Dial
CallCommandsApi callForkStart POST /calls/{call_control_id}/actions/fork_start Forking start
CallCommandsApi callForkStop POST /calls/{call_control_id}/actions/fork_stop Forking stop
CallCommandsApi callGatherStop POST /calls/{call_control_id}/actions/gather_stop Gather stop
CallCommandsApi callGatherUsingAudio POST /calls/{call_control_id}/actions/gather_using_audio Gather using audio
CallCommandsApi callGatherUsingSpeak POST /calls/{call_control_id}/actions/gather_using_speak Gather using speak
CallCommandsApi callHangup POST /calls/{call_control_id}/actions/hangup Hangup call
CallCommandsApi callPlaybackStart POST /calls/{call_control_id}/actions/playback_start Play audio URL
CallCommandsApi callPlaybackStop POST /calls/{call_control_id}/actions/playback_stop Stop audio playback
CallCommandsApi callRecordPause POST /calls/{call_control_id}/actions/record_pause Record pause
CallCommandsApi callRecordResume POST /calls/{call_control_id}/actions/record_resume Record resume
CallCommandsApi callRecordStart POST /calls/{call_control_id}/actions/record_start Recording start
CallCommandsApi callRecordStop POST /calls/{call_control_id}/actions/record_stop Recording stop
CallCommandsApi callRefer POST /calls/{call_control_id}/actions/refer SIP Refer a call
CallCommandsApi callReject POST /calls/{call_control_id}/actions/reject Reject a call
CallCommandsApi callSendDTMF POST /calls/{call_control_id}/actions/send_dtmf Send DTMF
CallCommandsApi callSpeak POST /calls/{call_control_id}/actions/speak Speak text
CallCommandsApi callTranscriptionStart POST /calls/{call_control_id}/actions/transcription_start Transcription start
CallCommandsApi callTranscriptionStop POST /calls/{call_control_id}/actions/transcription_stop Transcription stop
CallCommandsApi callTransfer POST /calls/{call_control_id}/actions/transfer Transfer call
CallControlApplicationsApi createCallControlApplication POST /call_control_applications Create a call control application
CallControlApplicationsApi deleteCallControlApplication DELETE /call_control_applications/{id} Delete a call control application
CallControlApplicationsApi listCallControlApplications GET /call_control_applications List call control applications
CallControlApplicationsApi retrieveCallControlApplication GET /call_control_applications/{id} Retrieve a call control application
CallControlApplicationsApi updateCallControlApplication PATCH /call_control_applications/{id} Update a call control application
CallInformationApi retrieveCallStatus GET /calls/{call_control_id} Retrieve a call status
ConferenceCommandsApi conferenceDialParticipantIn POST /conferences/{id}/actions/dial_participant Dial a new participant into a conference
ConferenceCommandsApi conferenceHoldParticipants POST /conferences/{id}/actions/hold Hold conference participants
ConferenceCommandsApi conferenceJoin POST /conferences/{id}/actions/join Join a conference
ConferenceCommandsApi conferenceMuteParticipants POST /conferences/{id}/actions/mute Mute conference participants
ConferenceCommandsApi conferencePlayAudio POST /conferences/{id}/actions/play Play audio to conference participants
ConferenceCommandsApi conferenceSpeakText POST /conferences/{id}/actions/speak Speak text to conference participants
ConferenceCommandsApi conferenceStartRecording POST /conferences/{id}/actions/record_start Conference recording start
ConferenceCommandsApi conferenceStopAudio POST /conferences/{id}/actions/stop Stop audio being played on the conference
ConferenceCommandsApi conferenceStopRecording POST /conferences/{id}/actions/record_stop Conference recording stop
ConferenceCommandsApi conferenceUnholdParticipants POST /conferences/{id}/actions/unhold Unhold conference participants
ConferenceCommandsApi conferenceUnmuteParticipants POST /conferences/{id}/actions/unmute Unmute conference participants
ConferenceCommandsApi conferenceUpdate POST /conferences/{id}/actions/update Update conference participant
ConferenceCommandsApi createConference POST /conferences Create conference
ConferenceCommandsApi listConferenceParticipants GET /conferences/{conference_id}/participants List conference participants
ConferenceCommandsApi listConferences GET /conferences List conferences
ConferenceCommandsApi retrieveConference GET /conferences/{id} Retrieve a conference
ConnectionsApi listConnections GET /connections List connections
ConnectionsApi retrieveConnection GET /connections/{id} Retrieve a connection
CredentialConnectionsApi createCredentialConnection POST /credential_connections Create a credential connection
CredentialConnectionsApi deleteCredentialConnection DELETE /credential_connections/{id} Delete a credential connection
CredentialConnectionsApi listCredentialConnections GET /credential_connections List credential connections
CredentialConnectionsApi retrieveCredentialConnection GET /credential_connections/{id} Retrieve a credential connection
CredentialConnectionsApi updateCredentialConnection PATCH /credential_connections/{id} Update a credential connection
CredentialsApi createTelephonyCredential POST /telephony_credentials Create a credential
CredentialsApi deleteTelephonyCredential DELETE /telephony_credentials/{id} Delete a credential
CredentialsApi findTelephonyCredentials GET /telephony_credentials List all credentials
CredentialsApi getTelephonyCredential GET /telephony_credentials/{id} Get a credential
CredentialsApi listTags GET /telephony_credentials/tags List all tags
CredentialsApi telephonyCredentialAction POST /telephony_credentials/{id}/actions/{action} Perform activate or deactivate action on provided Credential
CredentialsApi updateTelephonyCredential PATCH /telephony_credentials/{id} Update a credential
CsvDownloadsApi createCsvDownload POST /phone_numbers/csv_downloads Create a CSV download
CsvDownloadsApi listCsvDownloads GET /phone_numbers/csv_downloads List CSV downloads
CsvDownloadsApi retrieveCsvDownload GET /phone_numbers/csv_downloads/{id} Retrieve a CSV download
DebuggingApi listCallEvents GET /call_events List call events
FqdNsApi createFqdn POST /fqdns Create an FQDN
FqdNsApi deleteFqdn DELETE /fqdns/{id} Delete an FQDN
FqdNsApi listFqdns GET /fqdns List FQDNs
FqdNsApi retrieveFqdn GET /fqdns/{id} Retrieve an FQDN
FqdNsApi updateFqdn PATCH /fqdns/{id} Update an FQDN
FqdnConnectionsApi createFqdnConnection POST /fqdn_connections Create an FQDN connection
FqdnConnectionsApi deleteFqdnConnection DELETE /fqdn_connections/{id} Delete an FQDN connection
FqdnConnectionsApi listFqdnConnections GET /fqdn_connections List FQDN connections
FqdnConnectionsApi retrieveFqdnConnection GET /fqdn_connections/{id} Retrieve an FQDN connection
FqdnConnectionsApi updateFqdnConnection PATCH /fqdn_connections/{id} Update an FQDN connection
IPsApi createIp POST /ips Create an Ip
IPsApi deleteIp DELETE /ips/{id} Delete an Ip
IPsApi listIps GET /ips List Ips
IPsApi retrieveIp GET /ips/{id} Retrieve an Ip
IPsApi updateIp PATCH /ips/{id} Update an Ip
IpConnectionsApi createIpConnection POST /ip_connections Create an Ip connection
IpConnectionsApi deleteIpConnection DELETE /ip_connections/{id} Delete an Ip connection
IpConnectionsApi listIpConnections GET /ip_connections List Ip connections
IpConnectionsApi retrieveIpConnection GET /ip_connections/{id} Retrieve an Ip connection
IpConnectionsApi updateIpConnection PATCH /ip_connections/{id} Update an Ip connection
MessagesApi createLongCodeMessage POST /messages/long_code Send a long code message
MessagesApi createMessage POST /messages Send a message
MessagesApi createNumberPoolMessage POST /messages/number_pool Send a message using number pool
MessagesApi createShortCodeMessage POST /messages/short_code Send a short code message
MessagesApi retrieveMessage GET /messages/{id} Retrieve a message
MessagingHostedNumberApi createMessagingHostedNumberOrder POST /messaging_hosted_number_orders Create a messaging hosted number order
MessagingHostedNumberApi deleteMessagingHostedNumber DELETE /messaging_hosted_numbers/{id} Delete a messaging hosted number
MessagingHostedNumberApi listMessagingHostedNumberOrder GET /messaging_hosted_number_orders List messaging hosted number orders
MessagingHostedNumberApi retrieveMessagingHostedNumberOrder GET /messaging_hosted_number_orders/{id} Retrieve a messaging hosted number order
MessagingHostedNumberApi uploadFileMessagingHostedNumberOrder POST /messaging_hosted_number_orders/{id}/actions/file_upload Upload file required for a messaging hosted number order
MessagingProfilesApi createMessagingProfile POST /messaging_profiles Create a messaging profile
MessagingProfilesApi deleteMessagingProfile DELETE /messaging_profiles/{id} Delete a messaging profile
MessagingProfilesApi listMessagingProfileMetrics GET /messaging_profile_metrics List messaging profile metrics
MessagingProfilesApi listMessagingProfilePhoneNumbers GET /messaging_profiles/{id}/phone_numbers List phone numbers associated with a messaging profile
MessagingProfilesApi listMessagingProfileShortCodes GET /messaging_profiles/{id}/short_codes List short codes associated with a messaging profile
MessagingProfilesApi listMessagingProfiles GET /messaging_profiles List messaging profiles
MessagingProfilesApi retrieveMessagingProfile GET /messaging_profiles/{id} Retrieve a messaging profile
MessagingProfilesApi retrieveMessagingProfileDetailedMetrics GET /messaging_profiles/{id}/metrics Retrieve messaging profile metrics
MessagingProfilesApi updateMessagingProfile PATCH /messaging_profiles/{id} Update a messaging profile
MessagingUrlDomainsApi listMessagingUrlDomains GET /messaging_url_domains List messaging URL domains
NumberBackgroundJobsApi createPhoneNumbersJobDeletePhoneNumbers POST /phone_numbers/jobs/delete_phone_numbers Delete a batch of numbers
NumberBackgroundJobsApi createPhoneNumbersJobUpdateEmergencySettings POST /phone_numbers/jobs/update_emergency_settings Update the emergency settings from a batch of numbers
NumberBackgroundJobsApi createPhoneNumbersJobUpdatePhoneNumber POST /phone_numbers/jobs/update_phone_numbers Update a batch of numbers
NumberBackgroundJobsApi listPhoneNumbersJobs GET /phone_numbers/jobs Lists the phone numbers jobs
NumberBackgroundJobsApi retrievePhoneNumbersJob GET /phone_numbers/jobs/{id} Retrieve a phone numbers job
NumberConfigurationsApi deletePhoneNumber DELETE /phone_numbers/{id} Delete a phone number
NumberConfigurationsApi enableEmergencyPhoneNumber POST /phone_numbers/{id}/actions/enable_emergency Enable emergency for a phone number
NumberConfigurationsApi listPhoneNumbers GET /phone_numbers List phone numbers
NumberConfigurationsApi listPhoneNumbersWithMessagingSettings GET /phone_numbers/messaging List phone numbers with messaging settings
NumberConfigurationsApi listPhoneNumbersWithVoiceSettings GET /phone_numbers/voice List phone numbers with voice settings
NumberConfigurationsApi retrievePhoneNumber GET /phone_numbers/{id} Retrieve a phone number
NumberConfigurationsApi retrievePhoneNumberWithMessagingSettings GET /phone_numbers/{id}/messaging Retrieve a phone number with messaging settings
NumberConfigurationsApi retrievePhoneNumberWithVoiceSettings GET /phone_numbers/{id}/voice Retrieve a phone number with voice settings
NumberConfigurationsApi updatePhoneNumber PATCH /phone_numbers/{id} Update a phone number
NumberConfigurationsApi updatePhoneNumberWithMessagingSettings PATCH /phone_numbers/{id}/messaging Update a phone number with messaging settings
NumberConfigurationsApi updatePhoneNumberWithVoiceSettings PATCH /phone_numbers/{id}/voice Update a phone number with voice settings
NumberLookupApi numberLookup GET /number_lookup/{phone_number} Lookup phone number data
NumberOrderDocumentsApi createNumberOrderDocument POST /number_order_documents Create a number order document
NumberOrderDocumentsApi listNumberOrderDocuments GET /number_order_documents List number order documents
NumberOrderDocumentsApi retrieveNumberOrderDocument GET /number_order_documents/{number_order_document_id} Retrieve a number order document
NumberOrderDocumentsApi updateNumberOrderDocument PATCH /number_order_documents/{number_order_document_id} Update a number order document
NumberOrderRegulatoryRequirementsApi listNumberOrderRegulatoryRequirements GET /regulatory_requirements List number order regulatory requirements
NumberOrderRegulatoryRequirementsApi listPhoneNumberRegulatoryRequirements GET /phone_numbers_regulatory_requirements List regulatory requirements per number
NumberOrderRegulatoryRequirementsApi retrieveNumberOrderRegulatoryRequirement GET /regulatory_requirements/{requirement_id} Retrieve a number order regulatory requirement
NumberOrdersApi createNumberOrder POST /number_orders Create a number order
NumberOrdersApi listNumberOrders GET /number_orders List number orders
NumberOrdersApi retrieveNumberOrder GET /number_orders/{number_order_id} Retrieve a number order
NumberOrdersApi updateNumberOrder PATCH /number_orders/{number_order_id} Update a number order
NumberReservationsApi createNumberReservation POST /number_reservations Create a number reservation
NumberReservationsApi extendNumberReservationExpiryTime POST /number_reservations/{number_reservation_id}/actions/extend Extend a number reservation
NumberReservationsApi listNumberReservations GET /number_reservations List number reservations
NumberReservationsApi retrieveNumberReservation GET /number_reservations/{number_reservation_id} Retrieve a number reservation
NumberSearchApi listAvailablePhoneNumbers GET /available_phone_numbers List available phone numbers
OutboundVoiceProfilesApi createOutboundVoiceProfile POST /outbound_voice_profiles Create an outbound voice profile
OutboundVoiceProfilesApi deleteOutboundVoiceProfile DELETE /outbound_voice_profiles/{id} Delete an outbound voice profile
OutboundVoiceProfilesApi listOutboundVoiceProfiles GET /outbound_voice_profiles Get all outbound voice profiles
OutboundVoiceProfilesApi retrieveOutboundVoiceProfile GET /outbound_voice_profiles/{id} Retrieve an outbound voice profile
OutboundVoiceProfilesApi updateOutboundVoiceProfile PATCH /outbound_voice_profiles/{id} Updates an existing outbound voice profile.
ProgrammableFaxApplicationsApi createFaxApplication POST /fax_applications Creates a Fax Application
ProgrammableFaxApplicationsApi deleteFaxApplication DELETE /fax_applications/{id} Deletes a Fax Application
ProgrammableFaxApplicationsApi getFaxApplication GET /fax_applications/{id} Retrieve a Fax Application
ProgrammableFaxApplicationsApi listFaxApplications GET /fax_applications List all Fax Applications
ProgrammableFaxApplicationsApi updateFaxApplication PATCH /fax_applications/{id} Update a Fax Application
ProgrammableFaxCommandsApi deleteFax DELETE /faxes/{id} Delete a fax
ProgrammableFaxCommandsApi listFaxes GET /faxes View a list of faxes
ProgrammableFaxCommandsApi refreshFax POST /faxes/{id}/actions/refresh Refresh a fax
ProgrammableFaxCommandsApi sendFax POST /faxes Send a fax
ProgrammableFaxCommandsApi viewFax GET /faxes/{id} View a fax
RecordingsCommandsApi listRecordings GET /recordings List recordings
RecordingsCommandsApi retrieveRecording GET /recordings/{id} Retrieve a recording
ShortCodesApi listShortCodes GET /short_codes List short codes
ShortCodesApi retrieveShortCode GET /short_codes/{id} Retrieve a short code
ShortCodesApi updateShortCode PATCH /short_codes/{id} Update short code
TeXmlApplicationsApi createTexmlApplication POST /texml_applications Creates a TeXML Application
TeXmlApplicationsApi deleteTexmlApplication DELETE /texml_applications/{id} Deletes a TeXML Application
TeXmlApplicationsApi findTexmlApplications GET /texml_applications List all TeXML Applications
TeXmlApplicationsApi getTexmlApplication GET /texml_applications/{id} Retrieve a TeXML Application
TeXmlApplicationsApi updateTexmlApplication PATCH /texml_applications/{id} Update a TeXML Application
VerifyApi createVerification POST /verifications Trigger a verification
VerifyApi createVerifyProfile POST /verify_profiles Create a Verify profile
VerifyApi deleteVerifyProfile DELETE /verify_profiles/{verify_profile_id} Delete a Verify profile
VerifyApi listVerifications GET /verifications/by_phone_number/{phone_number} List verifications by phone number
VerifyApi listVerifyProfiles GET /verify_profiles List all Verify profiles
VerifyApi retrieveVerification GET /verifications/{verification_id} Retrieve a verification
VerifyApi retrieveVerifyProfile GET /verify_profiles/{verify_profile_id} Retrieve a Verify profile
VerifyApi updateVerifyProfile PATCH /verify_profiles/{verify_profile_id} Update a Verify profile
VerifyApi verifyVerificationCode POST /verifications/by_phone_number/{phone_number}/actions/verify Submit a verification code

Documentation for Models

Documentation for Authorization

Authentication schemes defined for the API:

BearerAuth

  • Type: HTTP basic authentication

bearerAuth

  • Type: HTTP basic authentication

Recommendation

It's recommended to create an instance of ApiClient per thread in a multithreaded environment to avoid any potential issues.

Author

support@telnyx.com

About

Java SDK for the Telnyx API

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 94.1%
  • Mustache 5.7%
  • Other 0.2%