This repository has been archived by the owner on Apr 23, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
1,582 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'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'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). | ||
|
||
### 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'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'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). | ||
|
||
### 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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
|
||
# ObtainTokenRequest | ||
|
||
## Properties | ||
Name | Type | Description | Notes | ||
------------ | ------------- | ------------- | ------------- | ||
**clientId** | **String** | Your application's ID, available from the [application dashboard](https://connect.squareup.com/apps). | [optional] | ||
**clientSecret** | **String** | Your application'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] | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
|
||
# ObtainTokenResponse | ||
|
||
## Properties | ||
Name | Type | Description | Notes | ||
------------ | ------------- | ------------- | ------------- | ||
**accessToken** | **String** | Your application'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'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] | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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] | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 `access_token` 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'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] | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
|
||
# RevokeTokenRequest | ||
|
||
## Properties | ||
Name | Type | Description | Notes | ||
------------ | ------------- | ------------- | ------------- | ||
**clientId** | **String** | Your application'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] | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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] | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.