-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- added implementations for some listing variation image methods
- Loading branch information
Showing
2 changed files
with
37 additions
and
41 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.notronix.etsy.impl; | ||
|
||
import com.notronix.etsy.api.EtsyException; | ||
import com.notronix.etsy.api.authentication.model.Credentials; | ||
import com.notronix.etsy.api.shops.model.Shop; | ||
import com.notronix.etsy.api.users.model.GetMeResponse; | ||
import com.notronix.etsy.impl.authentication.model.EtsyTokenResponse; | ||
|
||
public class ApiTester | ||
{ | ||
public static void main(String[] args) throws EtsyException { | ||
final String keyString = args[0]; | ||
final String sharedSecret = args[1]; | ||
EtsyAPI etsyAPI = new EtsyAPI(keyString, sharedSecret); | ||
|
||
String at = "access_token"; | ||
String rt = "refresh_token"; | ||
|
||
Credentials accessCredentials = Credentials.forKeyPair(at, null); | ||
|
||
try { | ||
GetMeResponse getMeResponse = etsyAPI.getUserResource().getMe(accessCredentials); | ||
Shop shop = etsyAPI.getShopResource().getShop(getMeResponse.getShopId()); | ||
|
||
System.exit(0); | ||
} | ||
catch (EtsyException ex) { | ||
if (ex.isDueToExpiredToken()) { | ||
System.out.println("Token is expired."); | ||
EtsyTokenResponse tokenResponse = etsyAPI.getAuthResource().refreshToken(rt); | ||
System.out.println("Access Token: " + tokenResponse.getAccessToken()); | ||
System.out.println("Refresh Token: " + tokenResponse.getRefreshToken()); | ||
System.exit(1); | ||
} | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.