Skip to content

Commit fadad64

Browse files
[TCM-6005] Add strings api post endpoints. (#125)
1 parent fc5eff9 commit fadad64

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

smartling-strings-api/src/main/java/com/smartling/api/strings/v2/StringsApi.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,15 @@ public interface StringsApi extends AutoCloseable
3535
@Path("/projects/{projectUid}/source-strings")
3636
SourceStringListPTO getSourceStrings(@PathParam("projectUid") String projectUid, @BeanParam GetSourceStringsCommandPTO sourceStringsCommand);
3737

38+
@POST
39+
@Path("/projects/{projectUid}/source-strings")
40+
SourceStringListPTO getSourceStringsPost(@PathParam("projectUid") String projectUid, GetSourceStringsCommandPTO sourceStringsCommand);
41+
3842
@GET
3943
@Path("/projects/{projectUid}/translations")
4044
ListResponse<TranslationsPTO> getTranslations(@PathParam("projectUid") String projectUid, @BeanParam TranslationsCommandPTO translationsCommand);
45+
46+
@POST
47+
@Path("/projects/{projectUid}/translations")
48+
ListResponse<TranslationsPTO> getTranslationsPost(@PathParam("projectUid") String projectUid, TranslationsCommandPTO translationsCommand);
4149
}

smartling-strings-api/src/test/java/com/smartling/api/strings/v2/StringsApiTest.java

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@
2121

2222
import javax.ws.rs.core.HttpHeaders;
2323

24-
import static org.junit.Assert.*;
24+
import static org.junit.Assert.assertEquals;
25+
import static org.junit.Assert.assertNotNull;
26+
import static org.junit.Assert.assertTrue;
2527

2628
public class StringsApiTest
2729
{
@@ -195,6 +197,18 @@ public void testGetSourceStrings() throws Exception
195197
assertTrue(request.getPath().contains("/projects/" + PROJECT_UID + "/source-strings"));
196198
}
197199

200+
@Test
201+
public void getSourceStringsPost() throws Exception
202+
{
203+
assignResponse(HttpStatus.SC_OK, SOURCE_STRINGS);
204+
205+
SourceStringListPTO sourceStrings = stringsApi.getSourceStringsPost(PROJECT_UID, new GetSourceStringsCommandPTO());
206+
assertNotNull(sourceStrings);
207+
RecordedRequest request = mockWebServer.takeRequest();
208+
assertEquals("POST", request.getMethod());
209+
assertTrue(request.getPath().contains("/projects/" + PROJECT_UID + "/source-strings"));
210+
}
211+
198212
@Test
199213
public void testGetTranslations() throws Exception
200214
{
@@ -206,4 +220,16 @@ public void testGetTranslations() throws Exception
206220
assertEquals("GET", request.getMethod());
207221
assertTrue(request.getPath().contains("/projects/" + PROJECT_UID + "/translations"));
208222
}
223+
224+
@Test
225+
public void testGetTranslationsPost() throws Exception
226+
{
227+
assignResponse(HttpStatus.SC_OK, TRANSLATIONS);
228+
229+
ListResponse<TranslationsPTO> translations = stringsApi.getTranslationsPost(PROJECT_UID, new TranslationsCommandPTO());
230+
assertNotNull(translations);
231+
RecordedRequest request = mockWebServer.takeRequest();
232+
assertEquals("POST", request.getMethod());
233+
assertTrue(request.getPath().contains("/projects/" + PROJECT_UID + "/translations"));
234+
}
209235
}

0 commit comments

Comments
 (0)