2525import java .util .HashMap ;
2626import java .util .List ;
2727import java .util .Map ;
28- import software .xdev .brevo .model .CreateDoiContactAttributesValue ;
2928import com .fasterxml .jackson .annotation .JsonPropertyOrder ;
3029import com .fasterxml .jackson .annotation .JsonTypeName ;
3130import java .io .UnsupportedEncodingException ;
@@ -51,7 +50,7 @@ public class CreateDoiContact {
5150
5251 public static final String JSON_PROPERTY_ATTRIBUTES = "attributes" ;
5352 @ jakarta .annotation .Nullable
54- private Map <String , CreateDoiContactAttributesValue > attributes = new HashMap <>();
53+ private Map <String , Object > attributes = new HashMap <>();
5554
5655 public static final String JSON_PROPERTY_INCLUDE_LIST_IDS = "includeListIds" ;
5756 @ jakarta .annotation .Nonnull
@@ -97,13 +96,13 @@ public void setEmail(@jakarta.annotation.Nonnull String email) {
9796 this .email = email ;
9897 }
9998
100- public CreateDoiContact attributes (@ jakarta .annotation .Nullable Map <String , CreateDoiContactAttributesValue > attributes ) {
99+ public CreateDoiContact attributes (@ jakarta .annotation .Nullable Map <String , Object > attributes ) {
101100
102101 this .attributes = attributes ;
103102 return this ;
104103 }
105104
106- public CreateDoiContact putAttributesItem (String key , CreateDoiContactAttributesValue attributesItem ) {
105+ public CreateDoiContact putAttributesItem (String key , Object attributesItem ) {
107106 if (this .attributes == null ) {
108107 this .attributes = new HashMap <>();
109108 }
@@ -117,16 +116,16 @@ public CreateDoiContact putAttributesItem(String key, CreateDoiContactAttributes
117116 */
118117 @ jakarta .annotation .Nullable
119118 @ JsonProperty (JSON_PROPERTY_ATTRIBUTES )
120- @ JsonInclude (value = JsonInclude .Include .USE_DEFAULTS )
119+ @ JsonInclude (content = JsonInclude . Include . ALWAYS , value = JsonInclude .Include .USE_DEFAULTS )
121120
122- public Map <String , CreateDoiContactAttributesValue > getAttributes () {
121+ public Map <String , Object > getAttributes () {
123122 return attributes ;
124123 }
125124
126125
127126 @ JsonProperty (JSON_PROPERTY_ATTRIBUTES )
128- @ JsonInclude (value = JsonInclude .Include .USE_DEFAULTS )
129- public void setAttributes (@ jakarta .annotation .Nullable Map <String , CreateDoiContactAttributesValue > attributes ) {
127+ @ JsonInclude (content = JsonInclude . Include . ALWAYS , value = JsonInclude .Include .USE_DEFAULTS )
128+ public void setAttributes (@ jakarta .annotation .Nullable Map <String , Object > attributes ) {
130129 this .attributes = attributes ;
131130 }
132131
@@ -338,9 +337,13 @@ public String toUrlQueryString(String prefix) {
338337 // add `attributes` to the URL query string
339338 if (getAttributes () != null ) {
340339 for (String _key : getAttributes ().keySet ()) {
341- if (getAttributes ().get (_key ) != null ) {
342- joiner .add (getAttributes ().get (_key ).toUrlQueryString (String .format ("%sattributes%s%s" , prefix , suffix ,
343- "" .equals (suffix ) ? "" : String .format ("%s%d%s" , containerPrefix , _key , containerSuffix ))));
340+ try {
341+ joiner .add (String .format ("%sattributes%s%s=%s" , prefix , suffix ,
342+ "" .equals (suffix ) ? "" : String .format ("%s%d%s" , containerPrefix , _key , containerSuffix ),
343+ getAttributes ().get (_key ), URLEncoder .encode (String .valueOf (getAttributes ().get (_key )), "UTF-8" ).replaceAll ("\\ +" , "%20" )));
344+ } catch (UnsupportedEncodingException e ) {
345+ // Should never happen, UTF-8 is always supported
346+ throw new RuntimeException (e );
344347 }
345348 }
346349 }
0 commit comments