Skip to content

Commit 6d3f2fc

Browse files
authored
support update brand. (#98)
* support update brand. * change the type of userID and update the docstring. * fix the error message.
1 parent da7fbb3 commit 6d3f2fc

File tree

3 files changed

+204
-0
lines changed

3 files changed

+204
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* Added support for `Retrieve Carrier Types`
77
* Added support for `One Call Buy an Order`
88
* Allow user to override default API timeouts
9+
* Added support for `Update User Brand`
910

1011
## 5.0.0 2022-01-14
1112

Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
package com.easypost.model;
2+
3+
import com.easypost.net.EasyPostResource;
4+
5+
public class Brand extends EasyPostResource {
6+
private String backgroundColor;
7+
private String color;
8+
private String logo;
9+
private String logoHref;
10+
private String ad;
11+
private String adHref;
12+
private String name;
13+
private String userID;
14+
private String theme;
15+
16+
/**
17+
* Get the background of the Brand.
18+
*
19+
* @return the background of the Brand.
20+
*/
21+
public String getBackgroundColor() {
22+
return backgroundColor;
23+
}
24+
25+
/**
26+
* Set the background of the Brand.
27+
*
28+
* @param backgroundColor the background of the Brand.
29+
*/
30+
public void setBackgroundColor(String backgroundColor) {
31+
this.backgroundColor = backgroundColor;
32+
}
33+
34+
/**
35+
* Get the color of the Brand.
36+
*
37+
* @return the color of the Brand.
38+
*/
39+
public String getColor() {
40+
return this.color;
41+
}
42+
43+
/**
44+
* Set the color of the Brand.
45+
*
46+
* @param color the color of the Brand.
47+
*/
48+
public void setColor(String color) {
49+
this.color = color;
50+
}
51+
52+
/**
53+
* Get the logo of the Brand.
54+
*
55+
* @return the logo of the Brand.
56+
*/
57+
public String getLogo() {
58+
return this.logo;
59+
}
60+
61+
/**
62+
* Set the logo of the Brand.
63+
*
64+
* @param logo the logo of the Brand.
65+
*/
66+
public void setLogo(String logo) {
67+
this.logo = logo;
68+
}
69+
70+
/**
71+
* Get the logo href of the Brand.
72+
*
73+
* @return the logo href of the Brand.
74+
*/
75+
public String getLogoHref() {
76+
return this.logoHref;
77+
}
78+
79+
/**
80+
* Set the logo href of the Brand.
81+
*
82+
* @param logoHref the logo href of the Brand.
83+
*/
84+
public void setLogoHref(String logoHref) {
85+
this.logoHref = logoHref;
86+
}
87+
88+
/**
89+
* Get the ad of the Brand.
90+
*
91+
* @return the ad of the Brand.
92+
*/
93+
public String getAd() {
94+
return this.ad;
95+
}
96+
97+
/**
98+
* Set the ad of the Brand.
99+
*
100+
* @param ad the ad of the Brand.
101+
*/
102+
public void setAd(String ad) {
103+
this.ad = ad;
104+
}
105+
106+
/**
107+
* Get the ad href of the Brand.
108+
*
109+
* @return the ad href of the Brand.
110+
*/
111+
public String getAdHref() {
112+
return this.adHref;
113+
}
114+
115+
/**
116+
* Set the ad href of the Brand.
117+
*
118+
* @param adHref the ad href of the Brand.
119+
*/
120+
public void setAdHref(String adHref) {
121+
this.adHref = adHref;
122+
}
123+
124+
/**
125+
* Get the name of the User.
126+
*
127+
* @return the name of the User.
128+
*/
129+
public String getName() {
130+
return this.name;
131+
}
132+
133+
/**
134+
* Set the name of the User.
135+
*
136+
* @param name the name of the User.
137+
*/
138+
public void setName(String name) {
139+
this.name = name;
140+
}
141+
142+
/**
143+
* Get the user ID of the Brand.
144+
*
145+
* @return the user ID of the Brand.
146+
*/
147+
public String getUserID() {
148+
return this.userID;
149+
}
150+
151+
/**
152+
* Set the user ID of the Brand.
153+
*
154+
* @param userID the user ID of the Brand.
155+
*/
156+
public void setUserID(String userID) {
157+
this.userID = userID;
158+
}
159+
160+
/**
161+
* Get the theme of the Brand.
162+
*
163+
* @return the theme of the Brand.
164+
*/
165+
public String getTheme() {
166+
return this.theme;
167+
}
168+
169+
/**
170+
* Set the theme of the Brand.
171+
*
172+
* @param theme the theme of the Brand.
173+
*/
174+
public void setTheme(String theme) {
175+
this.theme = theme;
176+
}
177+
}

src/main/java/com/easypost/model/User.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,5 +332,31 @@ public List<ApiKey> apiKeys() throws EasyPostException {
332332
throw new EasyPostException(
333333
String.format("Unable to find api key. Please contact %s.", EasyPostResource.EASYPOST_SUPPORT_EMAIL));
334334
}
335+
336+
/**
337+
* Update the user brand.
338+
*
339+
* @param params Map of parameters.
340+
* @return Brand object.
341+
* @throws EasyPostException when the request fails.
342+
*/
343+
public Brand updateBrand(Map<String, Object> params) throws EasyPostException {
344+
return updateBrand(params, null);
345+
}
346+
347+
/**
348+
* Update the user brand.
349+
*
350+
* @param params Map of parameters.
351+
* @param apiKey User API key.
352+
* @return Brand object.
353+
* @throws EasyPostException when the request fails.
354+
*/
355+
public Brand updateBrand(Map<String, Object> params, String apiKey) throws EasyPostException {
356+
String updateBrandUrl = String.format("%s/brand", instanceURL(User.class, id));
357+
Map<String, Object> wrappedParams = new HashMap<String, Object>();
358+
wrappedParams.put("brand", params);
359+
return request(RequestMethod.PUT, updateBrandUrl, wrappedParams, Brand.class, apiKey);
360+
}
335361
}
336362

0 commit comments

Comments
 (0)