You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+176-87
Original file line number
Diff line number
Diff line change
@@ -22,60 +22,200 @@ New accounts and subaccounts are now required to use TLS 1.2 when accessing the
22
22
23
23
This library supports the following Java implementations:
24
24
25
-
* OpenJDK 8
26
-
* OpenJDK 11
27
-
* OpenJDK 17
28
-
* OracleJDK 8
29
-
* OracleJDK 11
30
-
* OracleJDK 17
25
+
- OpenJDK 8
26
+
- OpenJDK 11
27
+
- OpenJDK 17
28
+
- OracleJDK 8
29
+
- OracleJDK 11
30
+
- OracleJDK 17
31
31
32
32
For Java 7 support, use `twilio-java` major version `7.X.X`.
33
33
34
34
## Installation
35
35
36
-
twilio-java uses Maven. At present the jars *are* available from a public [maven](https://mvnrepository.com/artifact/com.twilio.sdk/twilio) repository.
36
+
`twilio-java` uses Maven. At present the jars _are_ available from a public [maven](https://mvnrepository.com/artifact/com.twilio.sdk/twilio) repository.
37
37
38
38
Use the following dependency in your project to grab via Maven:
39
39
40
-
```
41
-
<dependency>
42
-
<groupId>com.twilio.sdk</groupId>
43
-
<artifactId>twilio</artifactId>
44
-
<version>9.X.X</version>
45
-
<scope>compile</scope>
46
-
</dependency>
40
+
```xml
41
+
<dependency>
42
+
<groupId>com.twilio.sdk</groupId>
43
+
<artifactId>twilio</artifactId>
44
+
<version>9.X.X</version>
45
+
<scope>compile</scope>
46
+
</dependency>
47
47
```
48
48
49
49
or Gradle:
50
+
50
51
```groovy
51
52
implementation "com.twilio.sdk:twilio:9.X.X"
52
53
```
53
54
54
55
If you want to compile it yourself, here's how:
55
56
56
-
$ git clone git@github.com:twilio/twilio-java
57
-
$ cd twilio-java
58
-
$ mvn install # Requires maven, download from https://maven.apache.org/download.html
57
+
```shell
58
+
git clone git@github.com:twilio/twilio-java
59
+
cd twilio-java
60
+
mvn install # Requires maven, download from https://maven.apache.org/download.html
61
+
```
59
62
60
63
If you want to build your own .jar, execute the following from within the cloned directory:
61
64
62
-
$ mvn package
65
+
```shell
66
+
mvn package
67
+
```
63
68
64
69
If you run into trouble with local tests, use:
65
70
66
-
$ mvn package -Dmaven.test.skip=true
71
+
```shell
72
+
mvn package -Dmaven.test.skip=true
73
+
```
74
+
75
+
### Test your installation
76
+
77
+
Try sending yourself an SMS message, like this:
78
+
79
+
```java
80
+
importcom.twilio.Twilio;
81
+
importcom.twilio.rest.api.v2010.account.Message;
82
+
importcom.twilio.type.PhoneNumber;
83
+
84
+
publicclassExample {
85
+
86
+
// Find your Account Sid and Token at console.twilio.com
"This is the ship that made the Kessel Run in fourteen parsecs?"
98
+
)
99
+
.create();
100
+
101
+
System.out.println(message.getSid());
102
+
}
103
+
}
104
+
```
105
+
106
+
> **Warning**
107
+
> It's okay to hardcode your credentials when testing locally, but you should use environment variables to keep them secret before committing any code or deploying to production. Check out [How to Set Environment Variables](https://www.twilio.com/blog/2017/01/how-to-set-environment-variables.html) for more information.
108
+
109
+
## Usage
69
110
70
111
### Initialize the Client
71
112
72
113
```java
73
-
// Find your Account SID and Auth Token at twilio.com/console
74
-
// DANGER! This is insecure. See http://twil.io/secure
The library automatically handles paging for you. With the `read` method, you can specify the number of records you want to receive (`limit`) and the maximum size you want each page fetch to be (`pageSize`). The library will then handle the task for you, fetching new pages under the hood as you iterate over the records.
194
+
195
+
For more information, view the [auto-generated library docs](https://www.twilio.com/docs/libraries/reference/twilio-java/).
To use a custom HTTP client with this helper library, please see the [Twilio documentation](https://www.twilio.com/docs/libraries/java/custom-http-clients-java).
316
+
To use a custom HTTP client with this helper library, please see the [advanced example of how to do so](./advanced-examples/custom-http-client.md).
228
317
229
-
## Docker Image
318
+
## Docker image
230
319
231
320
The `Dockerfile` present in this repository and its respective `twilio/twilio-java` Docker image are currently used by Twilio for testing purposes only.
Copy file name to clipboardExpand all lines: UPGRADE.md
-2
Original file line number
Diff line number
Diff line change
@@ -10,8 +10,6 @@ _`MAJOR` version bumps will have upgrade notes posted here._
10
10
11
11
Behind the scenes Java Helper is now auto-generated via OpenAPI with this release. This enables us to rapidly add new features and enhance consistency across versions and languages.
12
12
13
-
To learn more about the Java Helper Library, check out [our docs](https://www.twilio.com/docs/libraries/java).
0 commit comments