Skip to content

Commit

Permalink
Implement GoalInvocationId.fromJSON
Browse files Browse the repository at this point in the history
  • Loading branch information
JoelCourtney committed Sep 5, 2024
1 parent 2f7ce20 commit 100a8d8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
package gov.nasa.jpl.aerie.e2e.types;

public record GoalInvocationId(int goalId, int invocationId) { }
import javax.json.JsonObject;

public record GoalInvocationId(int goalId, int invocationId) {
public static GoalInvocationId fromJSON(JsonObject json) {
return new GoalInvocationId(
json.getInt("goal_id"),
json.getInt("goal_invocation_id")
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,7 @@ public GoalInvocationId createSchedulingSpecProcedure(
final var resp = makeRequest(GQL.CREATE_SCHEDULING_SPEC_GOAL, variables)
.getJsonObject("insert_scheduling_specification_goals_one");

return new GoalInvocationId(resp.getInt("goal_id"), resp.getInt("goal_invocation_id"));
return GoalInvocationId.fromJSON(resp);
}

public GoalInvocationId createSchedulingSpecGoal(
Expand Down Expand Up @@ -738,7 +738,7 @@ public GoalInvocationId createSchedulingSpecGoal(
final var resp = makeRequest(GQL.CREATE_SCHEDULING_SPEC_GOAL, variables)
.getJsonObject("insert_scheduling_specification_goals_one");

return new GoalInvocationId(resp.getInt("goal_id"), resp.getInt("goal_invocation_id"));
return GoalInvocationId.fromJSON(resp);
}

public int updateGoalDefinition(int goalId, String definition) throws IOException {
Expand Down

0 comments on commit 100a8d8

Please sign in to comment.