Skip to content

Commit

Permalink
Update Square API version and fix depreciated method on client builder
Browse files Browse the repository at this point in the history
  • Loading branch information
docwho2 committed May 18, 2024
1 parent d8f699b commit fc02058
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import com.squareup.square.Environment;
import com.squareup.square.SquareClient;
import com.squareup.square.authentication.BearerAuthModel;
import com.theokanning.openai.completion.chat.ChatFunction;
import com.theokanning.openai.service.FunctionExecutor;
import java.lang.reflect.InvocationTargetException;
Expand Down Expand Up @@ -83,7 +84,7 @@ public abstract class AbstractFunction<T> implements Cloneable {
// If square enabled, then configure the client
if (squareEnabled) {
squareClient = new SquareClient.Builder()
.accessToken(key)
.bearerAuthCredentials( new BearerAuthModel.Builder(key).build())
.environment(Environment.valueOf(System.getenv("SQUARE_ENVIRONMENT")))
.build();
} else {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package cloud.cleo.squareup.functions;

import static cloud.cleo.squareup.functions.AbstractFunction.allCombinations;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package cloud.cleo.squareup.functions;

import static cloud.cleo.squareup.functions.AbstractFunction.log;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.squareup.square.Environment;
import com.squareup.square.SquareClient;
import com.squareup.square.api.LocationsApi;
import com.squareup.square.authentication.BearerAuthModel;
import com.squareup.square.models.BusinessHoursPeriod;
import com.squareup.square.models.Location;
import java.time.DayOfWeek;
Expand All @@ -28,7 +29,7 @@ public class SquareHours {
private final static String SQUARE_API_KEY = System.getenv("SQUARE_API_KEY");

private final static SquareClient client = new SquareClient.Builder()
.accessToken(SQUARE_API_KEY)
.bearerAuthCredentials( new BearerAuthModel.Builder(SQUARE_API_KEY).build())
.environment(Environment.valueOf(System.getenv("SQUARE_ENVIRONMENT")))
.build();

Expand Down

0 comments on commit fc02058

Please sign in to comment.