Skip to content

Commit 91b256f

Browse files
authored
Merge pull request #128 from square/eden/bump-square-version
Bump Square Version
2 parents e1390b9 + 797e4b0 commit 91b256f

File tree

2 files changed

+132
-132
lines changed

2 files changed

+132
-132
lines changed

doc/client.md

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ The following parameters are configurable for the API Client:
55

66
| Parameter | Type | Description |
77
| --- | --- | --- |
8-
| `squareVersion` | `String` | Square Connect API versions<br>*Default*: `"2024-12-18"` |
8+
| `squareVersion` | `String` | Square Connect API versions<br>*Default*: `"2025-01-23"` |
99
| `customUrl` | `String` | Sets the base URL requests are made to. Defaults to `https://connect.squareup.com`<br>*Default*: `"https://connect.squareup.com"` |
1010
| `environment` | `string` | The API environment. <br> **Default: `production`** |
1111
| `httpClientConfig` | [`Consumer<HttpClientConfiguration.Builder>`](http-client-configuration-builder.md) | Set up Http Client Configuration instance. |
@@ -16,55 +16,55 @@ The following parameters are configurable for the API Client:
1616
The API client can be initialized as follows:
1717

1818
```java
19-
SquareClient client = new SquareClient.Builder()
20-
.httpClientConfig(configBuilder -> configBuilder
21-
.timeout(0))
22-
.squareVersion("2024-12-18")
23-
.bearerAuthCredentials(new BearerAuthModel.Builder(
24-
"AccessToken"
25-
)
26-
.build())
27-
.environment(Environment.PRODUCTION)
28-
.customUrl("https://connect.squareup.com")
19+
SquareClient client = new SquareClient.Builder()
20+
.httpClientConfig(configBuilder -> configBuilder
21+
.timeout(0))
22+
.squareVersion("2025-01-23")
23+
.bearerAuthCredentials(new BearerAuthModel.Builder(
24+
"AccessToken"
25+
)
26+
.build())
27+
.environment(Environment.PRODUCTION)
28+
.customUrl("https://connect.squareup.com")
2929
.build();
3030
```
3131

3232
## Make Calls with the API Client
3333

3434
```java
35-
package com.example;
36-
37-
import com.squareup.square.Environment;
38-
import com.squareup.square.SquareClient;
39-
import com.squareup.square.api.LocationsApi;
40-
import com.squareup.square.authentication.BearerAuthModel;
41-
42-
public class Program {
43-
44-
public static void main(String[] args) {
45-
SquareClient client = new SquareClient.Builder()
46-
.httpClientConfig(configBuilder -> configBuilder
47-
.timeout(0))
48-
.squareVersion("2024-12-18")
49-
.bearerAuthCredentials(new BearerAuthModel.Builder(
50-
"AccessToken"
51-
)
52-
.build())
53-
.environment(Environment.PRODUCTION)
54-
.customUrl("https://connect.squareup.com")
55-
.build();
56-
35+
package com.example;
36+
37+
import com.squareup.square.Environment;
38+
import com.squareup.square.SquareClient;
39+
import com.squareup.square.api.LocationsApi;
40+
import com.squareup.square.authentication.BearerAuthModel;
41+
42+
public class Program {
43+
44+
public static void main(String[] args) {
45+
SquareClient client = new SquareClient.Builder()
46+
.httpClientConfig(configBuilder -> configBuilder
47+
.timeout(0))
48+
.squareVersion("2025-01-23")
49+
.bearerAuthCredentials(new BearerAuthModel.Builder(
50+
"AccessToken"
51+
)
52+
.build())
53+
.environment(Environment.PRODUCTION)
54+
.customUrl("https://connect.squareup.com")
55+
.build();
56+
5757
LocationsApi locationsApi = client.getLocationsApi();
58-
59-
locationsApi.listLocationsAsync().thenAccept(result -> {
60-
// TODO success callback handler
61-
System.out.println(result);
62-
}).exceptionally(exception -> {
63-
// TODO failure callback handler
64-
exception.printStackTrace();
65-
return null;
66-
});
67-
}
58+
59+
locationsApi.listLocationsAsync().thenAccept(result -> {
60+
// TODO success callback handler
61+
System.out.println(result);
62+
}).exceptionally(exception -> {
63+
// TODO failure callback handler
64+
exception.printStackTrace();
65+
return null;
66+
});
67+
}
6868
}
6969
```
7070

src/main/java/com/squareup/square/SquareClient.java

Lines changed: 89 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -722,24 +722,24 @@ public String getSdkVersion() {
722722
return "42.1.0.20241218";
723723
}
724724

725-
/**
726-
* The timeout to use for making HTTP requests.
727-
* @deprecated This method will be removed in a future version. Use
728-
* {@link #getHttpClientConfig()} instead.
729-
*
730-
* @return timeout
731-
*/
732-
@Deprecated
733-
public long timeout() {
734-
return httpClientConfig.getTimeout();
735-
}
736-
737-
/**
738-
* Get base URI by current environment.
739-
* @param server Server for which to get the base URI
740-
* @return Processed base URI
741-
*/
742-
public String getBaseUri(Server server) {
725+
/**
726+
* The timeout to use for making HTTP requests.
727+
* @deprecated This method will be removed in a future version. Use
728+
* {@link #getHttpClientConfig()} instead.
729+
*
730+
* @return timeout
731+
*/
732+
@Deprecated
733+
public long timeout() {
734+
return httpClientConfig.getTimeout();
735+
}
736+
737+
/**
738+
* Get base URI by current environment.
739+
* @param server Server for which to get the base URI
740+
* @return Processed base URI
741+
*/
742+
public String getBaseUri(Server server) {
743743
Map<String, SimpleEntry<Object, Boolean>> parameters = new HashMap<>();
744744
parameters.put("custom_url",
745745
new SimpleEntry<Object, Boolean>(this.customUrl, false));
@@ -753,28 +753,28 @@ public String getBaseUri(Server server) {
753753
* @return Processed base URI
754754
*/
755755
public String getBaseUri() {
756-
return getBaseUri(Server.ENUM_DEFAULT);
757-
}
758-
759-
760-
/**
761-
* Get base URI by current environment.
762-
*
763-
* @param server string for which to get the base URI
764-
* @return Processed base URI
765-
*/
766-
public String getBaseUri(String server) {
767-
return getBaseUri(Server.fromString(server));
768-
}
769-
770-
771-
/**
772-
* Base URLs by environment and server aliases.
773-
* @param environment Environment for which to get the base URI
774-
* @param server Server for which to get the base URI
775-
* @return base URL
776-
*/
777-
private static String environmentMapper(Environment environment, Server server) {
756+
return getBaseUri(Server.ENUM_DEFAULT);
757+
}
758+
759+
760+
/**
761+
* Get base URI by current environment.
762+
*
763+
* @param server string for which to get the base URI
764+
* @return Processed base URI
765+
*/
766+
public String getBaseUri(String server) {
767+
return getBaseUri(Server.fromString(server));
768+
}
769+
770+
771+
/**
772+
* Base URLs by environment and server aliases.
773+
* @param environment Environment for which to get the base URI
774+
* @param server Server for which to get the base URI
775+
* @return base URL
776+
*/
777+
private static String environmentMapper(Environment environment, Server server) {
778778
if (environment.equals(Environment.PRODUCTION)) {
779779
if (server.equals(Server.ENUM_DEFAULT)) {
780780
return "https://connect.squareup.com";
@@ -832,7 +832,7 @@ public static class Builder {
832832

833833
private Environment environment = Environment.PRODUCTION;
834834
private String customUrl = "https://connect.squareup.com";
835-
private String squareVersion = "2024-12-18";
835+
private String squareVersion = "2025-01-23";
836836
private HttpClient httpClient;
837837
private Headers additionalHeaders = new Headers();
838838
private String userAgentDetail = null;
@@ -927,54 +927,54 @@ public Builder userAgentDetail(String userAgentDetail) {
927927
return this;
928928
}
929929

930-
/**
931-
* The timeout to use for making HTTP requests.
932-
* @deprecated This method will be removed in a future version. Use
933-
* {@link #httpClientConfig(Consumer) httpClientConfig} instead.
934-
* @param timeout must be greater then 0.
935-
* @return Builder
936-
*/
937-
@Deprecated
938-
public Builder timeout(long timeout) {
939-
this.httpClientConfigBuilder.timeout(timeout);
940-
return this;
941-
}
942-
943-
/**
944-
* HttpCallback.
945-
* @param httpCallback Callback to be called before and after the HTTP call.
946-
* @return Builder
947-
*/
948-
public Builder httpCallback(HttpCallback httpCallback) {
949-
this.httpCallback = httpCallback;
950-
return this;
951-
}
952-
953-
/**
954-
* Setter for the Builder of httpClientConfiguration, takes in an operation to be performed
955-
* on the builder instance of HTTP client configuration.
956-
*
957-
* @param action Consumer for the builder of httpClientConfiguration.
958-
* @return Builder
959-
*/
960-
public Builder httpClientConfig(Consumer<HttpClientConfiguration.Builder> action) {
961-
action.accept(httpClientConfigBuilder);
962-
return this;
963-
}
964-
965-
/**
966-
* Private Setter for the Builder of httpClientConfiguration, takes in an operation to be performed
967-
* on the builder instance of HTTP client configuration.
968-
*
969-
* @param supplier Supplier for the builder of httpClientConfiguration.
970-
* @return Builder
971-
*/
972-
private Builder httpClientConfig(Supplier<HttpClientConfiguration.Builder> supplier) {
973-
httpClientConfigBuilder = supplier.get();
974-
return this;
975-
}
976-
977-
/**
930+
/**
931+
* The timeout to use for making HTTP requests.
932+
* @deprecated This method will be removed in a future version. Use
933+
* {@link #httpClientConfig(Consumer) httpClientConfig} instead.
934+
* @param timeout must be greater then 0.
935+
* @return Builder
936+
*/
937+
@Deprecated
938+
public Builder timeout(long timeout) {
939+
this.httpClientConfigBuilder.timeout(timeout);
940+
return this;
941+
}
942+
943+
/**
944+
* HttpCallback.
945+
* @param httpCallback Callback to be called before and after the HTTP call.
946+
* @return Builder
947+
*/
948+
public Builder httpCallback(HttpCallback httpCallback) {
949+
this.httpCallback = httpCallback;
950+
return this;
951+
}
952+
953+
/**
954+
* Setter for the Builder of httpClientConfiguration, takes in an operation to be performed
955+
* on the builder instance of HTTP client configuration.
956+
*
957+
* @param action Consumer for the builder of httpClientConfiguration.
958+
* @return Builder
959+
*/
960+
public Builder httpClientConfig(Consumer<HttpClientConfiguration.Builder> action) {
961+
action.accept(httpClientConfigBuilder);
962+
return this;
963+
}
964+
965+
/**
966+
* Private Setter for the Builder of httpClientConfiguration, takes in an operation to be performed
967+
* on the builder instance of HTTP client configuration.
968+
*
969+
* @param supplier Supplier for the builder of httpClientConfiguration.
970+
* @return Builder
971+
*/
972+
private Builder httpClientConfig(Supplier<HttpClientConfiguration.Builder> supplier) {
973+
httpClientConfigBuilder = supplier.get();
974+
return this;
975+
}
976+
977+
/**
978978
* Builds a new SquareClient object using the set fields.
979979
* @return SquareClient
980980
*/

0 commit comments

Comments
 (0)