Skip to content

Commit 2077284

Browse files
authored
Merge pull request #15 from FreeClimbAPI/replaceAuthToken
Find and Replace Auth Token -> API Key
2 parents 0eed21d + 6159e9b commit 2077284

File tree

53 files changed

+221
-216
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+221
-216
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
77
## [Unreleased]
88
None
99

10+
<a name="4.1.0"></a>
11+
## [4.1.0] - 2021-05-10
12+
### Changed
13+
- Replace any language instance of auth_token or similar speech to api_key
14+
1015
<a name="4.0.1"></a>
1116
## [4.0.1] - 2021-05-03
1217
### Fixed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ Test the SDK is working by sending yourself a text message.
2020
public class Example {
2121

2222
public static final String accountId = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
23-
public static final String authToken = "your_auth_token";
23+
public static final String apiKey = "your_api_key";
2424
public static final String To = "your_phone_number";
2525
public static final String From = "a_free_climb_phone_number_in_your_account";
2626

2727
public static void main(String[] args) throws FreeClimbException {
28-
FreeClimbClient client = new FreeClimbClient(accountId, authToken);
28+
FreeClimbClient client = new FreeClimbClient(accountId, apiKey);
2929

3030
client.messages.create(From, To, "Welcome to FreeClimb!");
3131
}

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ group = 'com.github.FreeClimbAPI'
99

1010
sourceCompatibility = 1.7 // java 7
1111
targetCompatibility = 1.7
12-
version = '4.0.1'
12+
version = '4.1.0'
1313

1414
repositories {
1515
mavenCentral()

src/main/java/com/vailsys/freeclimb/api/APIAccountRequester.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public class APIAccountRequester extends APIRequester {
1414
/** The rootPath is used by subclasses to build the path to their endpoints. */
1515
protected static final String rootPath = constructAbsolutePath(accountPathHead);
1616

17-
protected APIAccountRequester(String credAccountId, String credAuthToken) {
18-
super(credAccountId, credAuthToken);
17+
protected APIAccountRequester(String credAccountId, String credApiKey) {
18+
super(credAccountId, credApiKey);
1919
}
2020
}

src/main/java/com/vailsys/freeclimb/api/APIRequester.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,20 +40,20 @@ public class APIRequester {
4040
}.getType();
4141

4242
private String credAccountId;
43-
private String credAuthToken;
43+
private String credApiKey;
4444
private String encodedAuth;
4545
private String freeclimbUrl;
4646

4747
/**
4848
* Create a new APIRequester.
4949
*
5050
* @param credAccountId The accountId to use to authenticate requests.
51-
* @param credAuthToken The authToken to use to authenticate requests.
51+
* @param credApiKey The apiKey to use to authenticate requests.
5252
*/
53-
protected APIRequester(String credAccountId, String credAuthToken) {
53+
protected APIRequester(String credAccountId, String credApiKey) {
5454
this.credAccountId = credAccountId;
55-
this.credAuthToken = credAuthToken;
56-
this.encodedAuth = printBase64Binary((credAccountId + ":" + credAuthToken).getBytes(StandardCharsets.UTF_8));
55+
this.credApiKey = credApiKey;
56+
this.encodedAuth = printBase64Binary((credAccountId + ":" + credApiKey).getBytes(StandardCharsets.UTF_8));
5757
this.freeclimbUrl = APIRequester.FREECLIMB_URL;
5858
}
5959

@@ -62,9 +62,9 @@ protected String getCredentialAccountId() {
6262
return this.credAccountId;
6363
}
6464

65-
/** @return the authToken being used for authentication */
66-
protected String getCredentialAuthToken() {
67-
return this.credAuthToken;
65+
/** @return the apiKey being used for authentication */
66+
protected String getCredentialApiKey() {
67+
return this.credApiKey;
6868
}
6969

7070
/** @return the url being used for the FreeClimb API */

src/main/java/com/vailsys/freeclimb/api/FreeClimbClient.java

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
*/
2020
public class FreeClimbClient {
2121
private String credAccountId;
22-
private String credAuthToken;
22+
private String credApiKey;
2323
private String accountId;
2424

2525
public AccountRequester accounts;
@@ -41,8 +41,8 @@ public class FreeClimbClient {
4141
*
4242
* @param credAccountId The Account ID to use in your credentials for the
4343
* FreeClimb API.
44-
* @param credAuthToken The Auth Token to use in your credentials for the
45-
* FreeClimb API. This should be the matching Auth Token to
44+
* @param credApiKey The API key to use in your credentials for the
45+
* FreeClimb API. This should be the matching API key to
4646
* the credAccountId parameter.
4747
* @param accountId The Account ID of the account you want to act as. This
4848
* should either be the same Account ID ass credAccountId
@@ -52,42 +52,42 @@ public class FreeClimbClient {
5252
* @throws FreeClimbException when any of the requesters throws a
5353
* FreeClimbException.
5454
*/
55-
public FreeClimbClient(String credAccountId, String credAuthToken, String accountId) throws FreeClimbException {
55+
public FreeClimbClient(String credAccountId, String credApiKey, String accountId) throws FreeClimbException {
5656
this.credAccountId = credAccountId;
57-
this.credAuthToken = credAuthToken;
57+
this.credApiKey = credApiKey;
5858
this.accountId = accountId;
5959

60-
this.accounts = new AccountRequester(credAccountId, credAuthToken, accountId);
61-
this.recordings = new RecordingsRequester(credAccountId, credAuthToken, accountId);
62-
this.calls = new CallsRequester(credAccountId, credAuthToken, accountId);
63-
this.conferences = new ConferencesRequester(credAccountId, credAuthToken, accountId);
64-
this.logs = new LogRequester(credAccountId, credAuthToken, accountId);
65-
this.available = new AvailablePhoneNumberRequester(credAccountId, credAuthToken, accountId);
66-
this.calling = new CallingNumberRequester(credAccountId, credAuthToken, accountId);
67-
this.incoming = new IncomingPhoneNumberRequester(credAccountId, credAuthToken, accountId);
68-
this.queues = new QueuesRequester(credAccountId, credAuthToken, accountId);
69-
this.applications = new ApplicationsRequester(credAccountId, credAuthToken, accountId);
70-
this.messages = new MessagesRequester(credAccountId, credAuthToken, accountId);
60+
this.accounts = new AccountRequester(credAccountId, credApiKey, accountId);
61+
this.recordings = new RecordingsRequester(credAccountId, credApiKey, accountId);
62+
this.calls = new CallsRequester(credAccountId, credApiKey, accountId);
63+
this.conferences = new ConferencesRequester(credAccountId, credApiKey, accountId);
64+
this.logs = new LogRequester(credAccountId, credApiKey, accountId);
65+
this.available = new AvailablePhoneNumberRequester(credAccountId, credApiKey, accountId);
66+
this.calling = new CallingNumberRequester(credAccountId, credApiKey, accountId);
67+
this.incoming = new IncomingPhoneNumberRequester(credAccountId, credApiKey, accountId);
68+
this.queues = new QueuesRequester(credAccountId, credApiKey, accountId);
69+
this.applications = new ApplicationsRequester(credAccountId, credApiKey, accountId);
70+
this.messages = new MessagesRequester(credAccountId, credApiKey, accountId);
7171
}
7272

7373
/**
7474
* This constructor allows one to create a FreeClimbClient that authenticates
7575
* with one set of credentials and acts as that account.
7676
*
7777
* This Constructor is a shortcut for calling
78-
* {@code FreeClimbClient(credAccountId, credAuthToken, credAccountId)}.
78+
* {@code FreeClimbClient(credAccountId, credApiKey, credAccountId)}.
7979
*
8080
* @param credAccountId The Account ID to use in your credentials for the
8181
* FreeClimb API.
82-
* @param credAuthToken The Auth Token to use in your credentials for the
83-
* FreeClimb API. This should be the matching Auth Token to
82+
* @param credApiKey The API key to use in your credentials for the
83+
* FreeClimb API. This should be the matching API key to
8484
* the credAccountId parameter.
8585
* @see #FreeClimbClient(String, String, String)
8686
* @throws FreeClimbException when any of the requesters throws a
8787
* FreeClimbException.
8888
*/
89-
public FreeClimbClient(String credAccountId, String credAuthToken) throws FreeClimbException {
90-
this(credAccountId, credAuthToken, credAccountId);
89+
public FreeClimbClient(String credAccountId, String credApiKey) throws FreeClimbException {
90+
this(credAccountId, credApiKey, credAccountId);
9191
}
9292

9393
/**
@@ -98,10 +98,10 @@ public String getCredAccountId() {
9898
}
9999

100100
/**
101-
* @return the Auth Token being used to authenticate with the API
101+
* @return the API key being used to authenticate with the API
102102
*/
103-
public String getCredAuthToken() {
104-
return credAuthToken;
103+
public String getCredApiKey() {
104+
return credApiKey;
105105
}
106106

107107
/**

src/main/java/com/vailsys/freeclimb/api/FreeClimbList.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public abstract class FreeClimbList<T> extends APIRequester {
4444
*
4545
* @param accountId The accountId to use for credentials with the FreeClimb API
4646
* when pulling new pages of the list.
47-
* @param authToken The authToken to use for credentials with the FreeClimb API
47+
* @param apiKey The apiKey to use for credentials with the FreeClimb API
4848
* when pulling new pages of the list.
4949
* @param rawPage The JSON string representing the first page of the list.
5050
* @param listField The name of the array of resources within the raw JSON list.
@@ -53,9 +53,9 @@ public abstract class FreeClimbList<T> extends APIRequester {
5353
* @param theType The Type of the FreeClimb Resource this list will contain.
5454
* @throws FreeClimbException when the page is not valid JSON.
5555
*/
56-
protected FreeClimbList(String accountId, String authToken, String rawPage, String listField, Class<T> theType)
56+
protected FreeClimbList(String accountId, String apiKey, String rawPage, String listField, Class<T> theType)
5757
throws FreeClimbException {
58-
super(accountId, authToken);
58+
super(accountId, apiKey);
5959
this.list = new ArrayList<T>();
6060
this.listField = listField;
6161
this.theType = theType;

src/main/java/com/vailsys/freeclimb/api/account/Account.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ public class Account extends FreeClimbCommon {
2727
*/
2828
private String accountId;
2929
/**
30-
* The authToken for this account instance.
30+
* The apiKey for this account instance.
3131
*/
32-
private String authToken;
32+
private String apiKey;
3333
/**
3434
* The alias for this account.
3535
*/
@@ -81,12 +81,12 @@ public String getAccountId() {
8181
}
8282

8383
/**
84-
* Retrieve the authToken for this account from the object.
84+
* Retrieve the apiKey for this account from the object.
8585
*
86-
* @return The authToken for this account.
86+
* @return The apiKey for this account.
8787
*/
88-
public String getAuthToken() {
89-
return authToken;
88+
public String getApiKey() {
89+
return apiKey;
9090
}
9191

9292
/**
@@ -150,10 +150,10 @@ public boolean equals(Account that) {
150150
result = result && that.getAccountId() == null;
151151
}
152152

153-
if (this.getAuthToken() != null) {
154-
result = result && that.getAuthToken().equals(this.getAuthToken());
153+
if (this.getApiKey() != null) {
154+
result = result && that.getApiKey().equals(this.getApiKey());
155155
} else {
156-
result = result && that.getAuthToken() == null;
156+
result = result && that.getApiKey() == null;
157157
}
158158

159159
if (this.getAlias() != null) {

src/main/java/com/vailsys/freeclimb/api/account/AccountRequester.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@ public class AccountRequester extends APIRequester {
2929
* @param credAccountId The accountId to use as authentication credentials in
3030
* the HTTP Basic Auth header for requests made by this
3131
* requester.
32-
* @param credAuthToken The authToken to use as authentication credentials in
32+
* @param credApiKey The apiKey to use as authentication credentials in
3333
* the HTTP Basic Auth header for requests made by this
3434
* requester.
3535
* @param actingAccountId The accountId to as as. This can be the same as
3636
* {@code credAccountId} or the accountId of a subaccount
3737
* of the {@code credAccountId}.
3838
*/
39-
public AccountRequester(String credAccountId, String credAuthToken, String actingAccountId) {
40-
super(credAccountId, credAuthToken);
39+
public AccountRequester(String credAccountId, String credApiKey, String actingAccountId) {
40+
super(credAccountId, credApiKey);
4141
this.actingAccountId = actingAccountId;
4242
this.path = APIRequester.constructAbsolutePath(pathHead);
4343
}

src/main/java/com/vailsys/freeclimb/api/application/ApplicationList.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ public class ApplicationList extends FreeClimbList<Application> {
1515
* Creates a new ApplicationList.
1616
*
1717
* @param accountId the accountId to use in requests for subsequent pages.
18-
* @param authToken the authToken to use in requests for subsequent pages.
18+
* @param apiKey the apiKey to use in requests for subsequent pages.
1919
* @param rawPage the raw JSON string representing a page of an application
2020
* list from the FreeClimb API
2121
* @throws FreeClimbException when the JSON is invalid.
2222
*/
23-
public ApplicationList(String accountId, String authToken, String rawPage) throws FreeClimbException {
24-
super(accountId, authToken, rawPage, "applications", Application.class);
23+
public ApplicationList(String accountId, String apiKey, String rawPage) throws FreeClimbException {
24+
super(accountId, apiKey, rawPage, "applications", Application.class);
2525
}
2626
}

0 commit comments

Comments
 (0)