@@ -1394,6 +1394,12 @@ public Article updateArticle(Article article) {
1394
1394
JSON , json (Collections .singletonMap ("article" , article ))), handle (Article .class , "article" )));
1395
1395
}
1396
1396
1397
+ public Translation updateArticleTranslation (Long articleId , String locale , Translation translation ) {
1398
+ checkHasId (translation );
1399
+ return complete (submit (req ("PUT" , tmpl ("/help_center/articles/{id}/translations/{locale}.json" ).set ("id" , articleId ).set ("locale" ,locale ),
1400
+ JSON , json (Collections .singletonMap ("translation" , translation ))), handle (Translation .class , "translation" )));
1401
+ }
1402
+
1397
1403
public void deleteArticle (Article article ) {
1398
1404
checkHasId (article );
1399
1405
complete (submit (req ("DELETE" , tmpl ("/help_center/articles/{id}.json" ).set ("id" , article .getId ())),
@@ -1445,6 +1451,12 @@ public Category updateCategory(Category category) {
1445
1451
JSON , json (Collections .singletonMap ("category" , category ))), handle (Category .class , "category" )));
1446
1452
}
1447
1453
1454
+ public Translation updateCategoryTranslation (Long categoryId , String locale , Translation translation ) {
1455
+ checkHasId (translation );
1456
+ return complete (submit (req ("PUT" , tmpl ("/help_center/categories/{id}/translations/{locale}.json" ).set ("id" , categoryId ).set ("locale" ,locale ),
1457
+ JSON , json (Collections .singletonMap ("translation" , translation ))), handle (Translation .class , "translation" )));
1458
+ }
1459
+
1448
1460
public void deleteCategory (Category category ) {
1449
1461
checkHasId (category );
1450
1462
complete (submit (req ("DELETE" , tmpl ("/help_center/categories/{id}.json" ).set ("id" , category .getId ())),
@@ -1484,6 +1496,12 @@ public Section updateSection(Section section) {
1484
1496
JSON , json (Collections .singletonMap ("section" , section ))), handle (Section .class , "section" )));
1485
1497
}
1486
1498
1499
+ public Translation updateSectionTranslation (Long sectionId , String locale , Translation translation ) {
1500
+ checkHasId (translation );
1501
+ return complete (submit (req ("PUT" , tmpl ("/help_center/sections/{id}/translations/{locale}.json" ).set ("id" , sectionId ).set ("locale" ,locale ),
1502
+ JSON , json (Collections .singletonMap ("translation" , translation ))), handle (Translation .class , "translation" )));
1503
+ }
1504
+
1487
1505
public void deleteSection (Section section ) {
1488
1506
checkHasId (section );
1489
1507
complete (submit (req ("DELETE" , tmpl ("/help_center/sections/{id}.json" ).set ("id" , section .getId ())),
@@ -1964,6 +1982,12 @@ private static void checkHasId(SuspendedTicket ticket) {
1964
1982
}
1965
1983
}
1966
1984
1985
+ private static void checkHasId (Translation translation ) {
1986
+ if (translation .getId () == null ) {
1987
+ throw new IllegalArgumentException ("Translation requires id" );
1988
+ }
1989
+ }
1990
+
1967
1991
private static void checkHasToken (Attachment .Upload upload ) {
1968
1992
if (upload .getToken () == null ) {
1969
1993
throw new IllegalArgumentException ("Upload requires token" );
0 commit comments