From fcb4fab530314cd3176f25d7451dd1e51161ad48 Mon Sep 17 00:00:00 2001 From: Richard Jose Date: Sun, 4 Dec 2022 22:19:09 -0500 Subject: [PATCH] feat: common base interface for responses --- .../wayfair/javafroid/model/BaseResponse.java | 7 +++++++ .../javafroid/model/EntitiesResponse.java | 2 +- .../javafroid/model/EntityObjectResponse.java | 16 ++++++++-------- 3 files changed, 16 insertions(+), 9 deletions(-) create mode 100644 src/main/java/com/wayfair/javafroid/model/BaseResponse.java diff --git a/src/main/java/com/wayfair/javafroid/model/BaseResponse.java b/src/main/java/com/wayfair/javafroid/model/BaseResponse.java new file mode 100644 index 0000000..e0bc930 --- /dev/null +++ b/src/main/java/com/wayfair/javafroid/model/BaseResponse.java @@ -0,0 +1,7 @@ +package com.wayfair.javafroid.model; + +import java.util.List; + +public interface BaseResponse { + List getErrors(); +} diff --git a/src/main/java/com/wayfair/javafroid/model/EntitiesResponse.java b/src/main/java/com/wayfair/javafroid/model/EntitiesResponse.java index 36cea21..09dcc63 100644 --- a/src/main/java/com/wayfair/javafroid/model/EntitiesResponse.java +++ b/src/main/java/com/wayfair/javafroid/model/EntitiesResponse.java @@ -3,7 +3,7 @@ import java.util.ArrayList; import java.util.List; -public class EntitiesResponse { +public class EntitiesResponse implements BaseResponse { private EntityList data; private List errors; diff --git a/src/main/java/com/wayfair/javafroid/model/EntityObjectResponse.java b/src/main/java/com/wayfair/javafroid/model/EntityObjectResponse.java index 9f469e1..6524f9e 100644 --- a/src/main/java/com/wayfair/javafroid/model/EntityObjectResponse.java +++ b/src/main/java/com/wayfair/javafroid/model/EntityObjectResponse.java @@ -3,17 +3,17 @@ import java.util.List; import java.util.Map; -public class EntityObjectResponse { +public class EntityObjectResponse implements BaseResponse { private Map data; - private List error; + private List errors; private Map extensions; public EntityObjectResponse() { } - public EntityObjectResponse(Map data, List error, Map extensions) { + public EntityObjectResponse(Map data, List errors, Map extensions) { this.data = data; - this.error = error; + this.errors = errors; this.extensions = extensions; } @@ -21,8 +21,8 @@ public Map getData() { return data; } - public List getError() { - return error; + public List getErrors() { + return errors; } public Map getExtensions() { @@ -33,8 +33,8 @@ public void setData(Map data) { this.data = data; } - public void setError(List error) { - this.error = error; + public void setErrors(List errors) { + this.errors = errors; } public void setExtensions(Map extensions) {