Skip to content

Commit

Permalink
- v3.0.0009
Browse files Browse the repository at this point in the history
- added implementations for some listing variation image methods
  • Loading branch information
cmunden committed Jun 4, 2023
1 parent e8f92a6 commit f2312d5
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 41 deletions.
37 changes: 37 additions & 0 deletions src/test/java/com/notronix/etsy/impl/ApiTester.java
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);
}
}
}
}
41 changes: 0 additions & 41 deletions src/test/java/com/notronix/etsy/impl/v3/ApiTester.java

This file was deleted.

0 comments on commit f2312d5

Please sign in to comment.