Skip to content
This repository has been archived by the owner on Apr 23, 2021. It is now read-only.

Commit

Permalink
Release 2.20180712.2 (#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
ssung88 authored Aug 22, 2018
1 parent a6ddbc5 commit 78d91e4
Show file tree
Hide file tree
Showing 20 changed files with 1,582 additions and 6 deletions.
11 changes: 11 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Change Log

## Version 2.20180712.2 (2018-08-21)

The Connect SDK now includes functionality for the OAuth API. The Square OAuth API lets applications request and obtain permission from a Square account to make API calls on behalf of that account. Applications can request individual permissions so that users do not need to grant full access to their Square accounts.

### OAuth API

* `ObtainToken` endpoint — Exchanges the authorization code for an access token. After a merchant authorizes your application with the permissions form, an authorization code is sent to the application's redirect URL (See [Implementing OAuth](https://docs.connect.squareup.com/api/oauth#implementingoauth) for information about how to set up the redirect URL).

* `RenewToken` endpoint — Renews an OAuth access token before it expires. OAuth access tokens besides your application's personal access token expire after __30 days__. You can also renew expired tokens within __15 days__ of their expiration. You cannot renew an access token that has been expired for more than 15 days. Instead, the associated merchant must complete the [OAuth flow](https://docs.connect.squareup.com/api/oauth#implementingoauth) from the beginning. __Important:__ The `Authorization` header you provide to this endpoint must have the following format: ``` Authorization: Client APPLICATION_SECRET ``` Replace `APPLICATION_SECRET` with your application's secret, available from the [application dashboard](https://connect.squareup.com/apps).
* `RevokeToken` endpoint — Revokes an access token generated with the OAuth flow. If a merchant has more than one access token for your application, this endpoint revokes all of them, regardless of which token you specify. If you revoke a merchant's access token, all of the merchant's active subscriptions associated with your application are canceled immediately. __Important:__ The `Authorization` header you provide to this endpoint must have the following format: ``` Authorization: Client APPLICATION_SECRET ``` Replace `APPLICATION_SECRET` with your application's secret, available from the [application dashboard](https://connect.squareup.com/apps).

## Version 2.20180712.1 (2018-08-02)

We have added MobileAuthorization API.
Expand Down
15 changes: 12 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Add this dependency to your project's POM:
<dependency>
<groupId>com.squareup</groupId>
<artifactId>connect</artifactId>
<version>2.20180712.1</version>
<version>2.20180712.2</version>
<scope>compile</scope>
</dependency>
```
Expand All @@ -28,7 +28,7 @@ Add this dependency to your project's POM:
Add this dependency to your project's build file:

```groovy
compile "com.squareup:connect:2.20180712.1"
compile "com.squareup:connect:2.20180712.2"
```

### Build and Install locally
Expand All @@ -47,7 +47,7 @@ At first generate the JAR by executing:

Then manually install the following JARs:

* target/connect-2.20180712.1.jar
* target/connect-2.20180712.2.jar
* target/lib/*.jar

## Getting Started
Expand Down Expand Up @@ -119,6 +119,9 @@ Class | Method | HTTP request | Description
*CustomersApi* | [**updateCustomer**](docs/CustomersApi.md#updateCustomer) | **PUT** /v2/customers/{customer_id} | UpdateCustomer
*LocationsApi* | [**listLocations**](docs/LocationsApi.md#listLocations) | **GET** /v2/locations | ListLocations
*MobileAuthorizationApi* | [**createMobileAuthorizationCode**](docs/MobileAuthorizationApi.md#createMobileAuthorizationCode) | **POST** /mobile/authorization-code | CreateMobileAuthorizationCode
*OAuthApi* | [**obtainToken**](docs/OAuthApi.md#obtainToken) | **POST** /oauth2/token | ObtainToken
*OAuthApi* | [**renewToken**](docs/OAuthApi.md#renewToken) | **POST** /oauth2/clients/{client_id}/access-token/renew | RenewToken
*OAuthApi* | [**revokeToken**](docs/OAuthApi.md#revokeToken) | **POST** /oauth2/revoke | RevokeToken
*OrdersApi* | [**batchRetrieveOrders**](docs/OrdersApi.md#batchRetrieveOrders) | **POST** /v2/locations/{location_id}/orders/batch-retrieve | BatchRetrieveOrders
*OrdersApi* | [**createOrder**](docs/OrdersApi.md#createOrder) | **POST** /v2/locations/{location_id}/orders | CreateOrder
*ReportingApi* | [**listAdditionalRecipientReceivableRefunds**](docs/ReportingApi.md#listAdditionalRecipientReceivableRefunds) | **GET** /v2/locations/{location_id}/additional-recipient-receivable-refunds | ListAdditionalRecipientReceivableRefunds
Expand Down Expand Up @@ -311,6 +314,8 @@ Class | Method | HTTP request | Description
- [LocationStatus](docs/LocationStatus.md)
- [LocationType](docs/LocationType.md)
- [Money](docs/Money.md)
- [ObtainTokenRequest](docs/ObtainTokenRequest.md)
- [ObtainTokenResponse](docs/ObtainTokenResponse.md)
- [Order](docs/Order.md)
- [OrderLineItem](docs/OrderLineItem.md)
- [OrderLineItemDiscount](docs/OrderLineItemDiscount.md)
Expand All @@ -324,12 +329,16 @@ Class | Method | HTTP request | Description
- [RegisterDomainRequest](docs/RegisterDomainRequest.md)
- [RegisterDomainResponse](docs/RegisterDomainResponse.md)
- [RegisterDomainResponseStatus](docs/RegisterDomainResponseStatus.md)
- [RenewTokenRequest](docs/RenewTokenRequest.md)
- [RenewTokenResponse](docs/RenewTokenResponse.md)
- [RetrieveCatalogObjectRequest](docs/RetrieveCatalogObjectRequest.md)
- [RetrieveCatalogObjectResponse](docs/RetrieveCatalogObjectResponse.md)
- [RetrieveCustomerRequest](docs/RetrieveCustomerRequest.md)
- [RetrieveCustomerResponse](docs/RetrieveCustomerResponse.md)
- [RetrieveTransactionRequest](docs/RetrieveTransactionRequest.md)
- [RetrieveTransactionResponse](docs/RetrieveTransactionResponse.md)
- [RevokeTokenRequest](docs/RevokeTokenRequest.md)
- [RevokeTokenResponse](docs/RevokeTokenResponse.md)
- [SearchCatalogObjectsRequest](docs/SearchCatalogObjectsRequest.md)
- [SearchCatalogObjectsResponse](docs/SearchCatalogObjectsResponse.md)
- [SearchCustomersRequest](docs/SearchCustomersRequest.md)
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apply plugin: 'idea'
apply plugin: 'eclipse'

group = 'com.squareup'
version = '2.20180712.1'
version = '2.20180712.2'

buildscript {
repositories {
Expand Down
168 changes: 168 additions & 0 deletions docs/OAuthApi.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
# OAuthApi

All URIs are relative to *https://connect.squareup.com*

Method | HTTP request | Description
------------- | ------------- | -------------
[**obtainToken**](OAuthApi.md#obtainToken) | **POST** /oauth2/token | ObtainToken
[**renewToken**](OAuthApi.md#renewToken) | **POST** /oauth2/clients/{client_id}/access-token/renew | RenewToken
[**revokeToken**](OAuthApi.md#revokeToken) | **POST** /oauth2/revoke | RevokeToken


<a name="obtainToken"></a>
# **obtainToken**
> ObtainTokenResponse obtainToken(body)
ObtainToken

Exchanges the authorization code for an access token. After a merchant authorizes your application with the permissions form, an authorization code is sent to the application&#39;s redirect URL (See [Implementing OAuth](https://docs.connect.squareup.com/api/oauth#implementingoauth) for information about how to set up the redirect URL).

### Example
```java
// Import classes:
//import com.squareup.connect.ApiException;
//import com.squareup.connect.api.OAuthApi;


OAuthApi apiInstance = new OAuthApi();
ObtainTokenRequest body = new ObtainTokenRequest(); // ObtainTokenRequest | An object containing the fields to POST for the request. See the corresponding object definition for field details.
try {
ObtainTokenResponse result = apiInstance.obtainToken(body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling OAuthApi#obtainToken");
e.printStackTrace();
}
```

### Parameters

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**ObtainTokenRequest**](ObtainTokenRequest.md)| An object containing the fields to POST for the request. See the corresponding object definition for field details. |

### Return type

[**ObtainTokenResponse**](ObtainTokenResponse.md)

### Authorization

No authorization required

### HTTP request headers

- **Content-Type**: application/json
- **Accept**: application/json

<a name="renewToken"></a>
# **renewToken**
> RenewTokenResponse renewToken(clientId, body)
RenewToken

Renews an OAuth access token before it expires. OAuth access tokens besides your application&#39;s personal access token expire after __30 days__. You can also renew expired tokens within __15 days__ of their expiration. You cannot renew an access token that has been expired for more than 15 days. Instead, the associated merchant must complete the [OAuth flow](https://docs.connect.squareup.com/api/oauth#implementingoauth) from the beginning. __Important:__ The &#x60;Authorization&#x60; header you provide to this endpoint must have the following format: &#x60;&#x60;&#x60; Authorization: Client APPLICATION_SECRET &#x60;&#x60;&#x60; Replace &#x60;APPLICATION_SECRET&#x60; with your application&#39;s secret, available from the [application dashboard](https://connect.squareup.com/apps).

### Example
```java
// Import classes:
//import com.squareup.connect.ApiClient;
//import com.squareup.connect.ApiException;
//import com.squareup.connect.Configuration;
//import com.squareup.connect.auth.*;
//import com.squareup.connect.api.OAuthApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure API key authorization: oauth2ClientSecret
ApiKeyAuth oauth2ClientSecret = (ApiKeyAuth) defaultClient.getAuthentication("oauth2ClientSecret");
oauth2ClientSecret.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//oauth2ClientSecret.setApiKeyPrefix("Token");

OAuthApi apiInstance = new OAuthApi();
String clientId = "clientId_example"; // String | Your application's ID, available from the [application dashboard](https://connect.squareup.com/apps).
RenewTokenRequest body = new RenewTokenRequest(); // RenewTokenRequest | An object containing the fields to POST for the request. See the corresponding object definition for field details.
try {
RenewTokenResponse result = apiInstance.renewToken(clientId, body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling OAuthApi#renewToken");
e.printStackTrace();
}
```

### Parameters

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**clientId** | **String**| Your application&#39;s ID, available from the [application dashboard](https://connect.squareup.com/apps). |
**body** | [**RenewTokenRequest**](RenewTokenRequest.md)| An object containing the fields to POST for the request. See the corresponding object definition for field details. |

### Return type

[**RenewTokenResponse**](RenewTokenResponse.md)

### Authorization

[oauth2ClientSecret](../README.md#oauth2ClientSecret)

### HTTP request headers

- **Content-Type**: application/json
- **Accept**: application/json

<a name="revokeToken"></a>
# **revokeToken**
> RevokeTokenResponse revokeToken(body)
RevokeToken

Revokes an access token generated with the OAuth flow. If a merchant has more than one access token for your application, this endpoint revokes all of them, regardless of which token you specify. If you revoke a merchant&#39;s access token, all of the merchant&#39;s active subscriptions associated with your application are canceled immediately. __Important:__ The &#x60;Authorization&#x60; header you provide to this endpoint must have the following format: &#x60;&#x60;&#x60; Authorization: Client APPLICATION_SECRET &#x60;&#x60;&#x60; Replace &#x60;APPLICATION_SECRET&#x60; with your application&#39;s secret, available from the [application dashboard](https://connect.squareup.com/apps).

### Example
```java
// Import classes:
//import com.squareup.connect.ApiClient;
//import com.squareup.connect.ApiException;
//import com.squareup.connect.Configuration;
//import com.squareup.connect.auth.*;
//import com.squareup.connect.api.OAuthApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure API key authorization: oauth2ClientSecret
ApiKeyAuth oauth2ClientSecret = (ApiKeyAuth) defaultClient.getAuthentication("oauth2ClientSecret");
oauth2ClientSecret.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//oauth2ClientSecret.setApiKeyPrefix("Token");

OAuthApi apiInstance = new OAuthApi();
RevokeTokenRequest body = new RevokeTokenRequest(); // RevokeTokenRequest | An object containing the fields to POST for the request. See the corresponding object definition for field details.
try {
RevokeTokenResponse result = apiInstance.revokeToken(body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling OAuthApi#revokeToken");
e.printStackTrace();
}
```

### Parameters

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**RevokeTokenRequest**](RevokeTokenRequest.md)| An object containing the fields to POST for the request. See the corresponding object definition for field details. |

### Return type

[**RevokeTokenResponse**](RevokeTokenResponse.md)

### Authorization

[oauth2ClientSecret](../README.md#oauth2ClientSecret)

### HTTP request headers

- **Content-Type**: application/json
- **Accept**: application/json

13 changes: 13 additions & 0 deletions docs/ObtainTokenRequest.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

# ObtainTokenRequest

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**clientId** | **String** | Your application&#39;s ID, available from the [application dashboard](https://connect.squareup.com/apps). | [optional]
**clientSecret** | **String** | Your application&#39;s secret, available from the [application dashboard](https://connect.squareup.com/apps). | [optional]
**code** | **String** | The authorization code to exchange. | [optional]
**redirectUri** | **String** | The redirect URL assigned in the [application dashboard](https://connect.squareup.com/apps). | [optional]



16 changes: 16 additions & 0 deletions docs/ObtainTokenResponse.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

# ObtainTokenResponse

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**accessToken** | **String** | Your application&#39;s access token. You provide this token in a header with every request to Connect API endpoints. See [Request and response headers](https://docs.connect.squareup.com/api/connect/v2/#requestandresponseheaders) for the format of this header. | [optional]
**tokenType** | **String** | This value is always _bearer_. | [optional]
**expiresAt** | **String** | The date when access_token expires, in [ISO 8601](http://www.iso.org/iso/home/standards/iso8601.htm) format. | [optional]
**merchantId** | **String** | The ID of the authorizing merchant&#39;s business. | [optional]
**subscriptionId** | **String** | The ID of the merchant [subscription](https://docs.connect.squareup.com/api/connect/v1/#navsection-subscriptionmanagement) associated with the authorization. Only present if the merchant signed up for a subscription during authorization. | [optional]
**planId** | **String** | The ID of the [subscription](https://docs.connect.squareup.com/api/connect/v1/#navsection-subscriptionmanagement) plan the merchant signed up for. Only present if the merchant signed up for a subscription during authorization. | [optional]
**idToken** | **String** | Then OpenID token belonging to this this person. Only present if the OPENID scope is included in the authorize request. | [optional]



10 changes: 10 additions & 0 deletions docs/RenewTokenRequest.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

# RenewTokenRequest

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**accessToken** | **String** | The token you want to renew. | [optional]



15 changes: 15 additions & 0 deletions docs/RenewTokenResponse.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

# RenewTokenResponse

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**accessToken** | **String** | The renewed access token. This value might be different from the &#x60;access_token&#x60; you provided in your request. You provide this token in a header with every request to Connect API endpoints. See [Request and response headers](https://docs.connect.squareup.com/api/connect/v2/#requestandresponseheaders) for the format of this header. | [optional]
**tokenType** | **String** | This value is always _bearer_. | [optional]
**expiresAt** | **String** | The date when access_token expires, in [ISO 8601](http://www.iso.org/iso/home/standards/iso8601.htm) format. | [optional]
**merchantId** | **String** | The ID of the authorizing merchant&#39;s business. | [optional]
**subscriptionId** | **String** | The ID of the merchant [subscription](https://docs.connect.squareup.com/api/connect/v1/#navsection-subscriptionmanagement) associated with the authorization. Only present if the merchant signed up for a subscription during authorization. | [optional]
**planId** | **String** | The ID of the [subscription](https://docs.connect.squareup.com/api/connect/v1/#navsection-subscriptionmanagement) plan the merchant signed up for. Only present if the merchant signed up for a subscription during authorization. | [optional]



12 changes: 12 additions & 0 deletions docs/RevokeTokenRequest.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

# RevokeTokenRequest

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**clientId** | **String** | Your application&#39;s ID, available from the [application dashboard](https://connect.squareup.com/apps). | [optional]
**accessToken** | **String** | The access token of the merchant whose token you want to revoke. Do not provide a value for merchant_id if you provide this parameter. | [optional]
**merchantId** | **String** | The ID of the merchant whose token you want to revoke. Do not provide a value for access_token if you provide this parameter. | [optional]



10 changes: 10 additions & 0 deletions docs/RevokeTokenResponse.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

# RevokeTokenResponse

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**success** | **Boolean** | If the request is successful, this is true. | [optional]



2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<artifactId>connect</artifactId>
<packaging>jar</packaging>
<name>connect</name>
<version>2.20180712.1</version>
<version>2.20180712.2</version>
<url>https://github.com/square/connect-java-sdk/</url>
<description>Java client library for the Square Connect API</description>
<scm>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/squareup/connect/ApiClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public ApiClient() {
this.dateFormat = new RFC3339DateFormat();

// Set default User-Agent.
setUserAgent("Square-Connect-Java/2.20180712.1");
setUserAgent("Square-Connect-Java/2.20180712.2");

// Setup authentications (key: authentication name, value: authentication).
authentications = new HashMap<String, Authentication>();
Expand Down
Loading

0 comments on commit 78d91e4

Please sign in to comment.