Java Code Examples for com.google.api.client.json.Json#MEDIA_TYPE
The following examples show how to use
com.google.api.client.json.Json#MEDIA_TYPE .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AnotherFakeApi.java From openapi-generator with Apache License 2.0 | 5 votes |
public HttpResponse call123testSpecialTagsForHttpResponse(java.io.InputStream body, String mediaType) throws IOException { // verify the required parameter 'body' is set if (body == null) { throw new IllegalArgumentException("Missing the required parameter 'body' when calling call123testSpecialTags"); } UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/another-fake/dummy"); String localVarUrl = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = body == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PATCH, genericUrl, content).execute(); }
Example 2
Source File: FakeApi.java From openapi-generator with Apache License 2.0 | 5 votes |
public HttpResponse testInlineAdditionalPropertiesForHttpResponse(java.io.InputStream param, String mediaType) throws IOException { // verify the required parameter 'param' is set if (param == null) { throw new IllegalArgumentException("Missing the required parameter 'param' when calling testInlineAdditionalProperties"); } UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake/inline-additionalProperties"); String localVarUrl = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = param == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, param); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); }
Example 3
Source File: FakeApi.java From openapi-generator with Apache License 2.0 | 5 votes |
public HttpResponse testClientModelForHttpResponse(java.io.InputStream body, String mediaType) throws IOException { // verify the required parameter 'body' is set if (body == null) { throw new IllegalArgumentException("Missing the required parameter 'body' when calling testClientModel"); } UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake"); String localVarUrl = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = body == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PATCH, genericUrl, content).execute(); }
Example 4
Source File: GoogleJsonResponseExceptionTest.java From google-api-java-client with Apache License 2.0 | 5 votes |
public void testFrom_detailsNoErrorField() throws Exception { HttpTransport transport = new ErrorTransport("{\"error_description\": \"Invalid value\"}", Json.MEDIA_TYPE); HttpRequest request = transport.createRequestFactory().buildGetRequest(HttpTesting.SIMPLE_GENERIC_URL); request.setThrowExceptionOnExecuteError(false); HttpResponse response = request.execute(); GoogleJsonResponseException ge = GoogleJsonResponseException.from(GoogleJsonErrorTest.FACTORY, response); assertNull(ge.getDetails()); assertEquals("403", ge.getMessage()); }
Example 5
Source File: FakeApi.java From openapi-generator with Apache License 2.0 | 5 votes |
public HttpResponse testBodyWithFileSchemaForHttpResponse(java.io.InputStream body, String mediaType) throws IOException { // verify the required parameter 'body' is set if (body == null) { throw new IllegalArgumentException("Missing the required parameter 'body' when calling testBodyWithFileSchema"); } UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake/body-with-file-schema"); String localVarUrl = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = body == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); }
Example 6
Source File: FakeApi.java From openapi-generator with Apache License 2.0 | 5 votes |
public HttpResponse fakeOuterNumberSerializeForHttpResponse(java.io.InputStream body, String mediaType) throws IOException { UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake/outer/number"); String localVarUrl = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = body == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); }
Example 7
Source File: FakeApi.java From openapi-generator with Apache License 2.0 | 5 votes |
public HttpResponse fakeOuterCompositeSerializeForHttpResponse(java.io.InputStream body, String mediaType) throws IOException { UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake/outer/composite"); String localVarUrl = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = body == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); }
Example 8
Source File: GoogleJsonResponseExceptionTest.java From google-api-java-client with Apache License 2.0 | 5 votes |
public void testFrom_errorEmptyContentButWithJsonContentType() throws Exception { HttpTransport transport = new ErrorTransport(null, Json.MEDIA_TYPE); HttpRequest request = transport.createRequestFactory().buildGetRequest(HttpTesting.SIMPLE_GENERIC_URL); request.setThrowExceptionOnExecuteError(false); HttpResponse response = request.execute(); GoogleJsonResponseException ge = GoogleJsonResponseException.from(GoogleJsonErrorTest.FACTORY, response); assertNull(ge.getDetails()); assertEquals("403", ge.getMessage()); }
Example 9
Source File: FakeApi.java From openapi-generator with Apache License 2.0 | 5 votes |
public HttpResponse createXmlItemForHttpResponse(java.io.InputStream xmlItem, String mediaType) throws IOException { // verify the required parameter 'xmlItem' is set if (xmlItem == null) { throw new IllegalArgumentException("Missing the required parameter 'xmlItem' when calling createXmlItem"); } UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake/create_xml_item"); String localVarUrl = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = xmlItem == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, xmlItem); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); }
Example 10
Source File: FakeClassnameTags123Api.java From openapi-generator with Apache License 2.0 | 5 votes |
public HttpResponse testClassnameForHttpResponse(java.io.InputStream body, String mediaType) throws IOException { // verify the required parameter 'body' is set if (body == null) { throw new IllegalArgumentException("Missing the required parameter 'body' when calling testClassname"); } UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake_classname_test"); String localVarUrl = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = body == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PATCH, genericUrl, content).execute(); }
Example 11
Source File: PetApi.java From openapi-generator with Apache License 2.0 | 5 votes |
public HttpResponse updatePetForHttpResponse(java.io.InputStream body, String mediaType) throws IOException { // verify the required parameter 'body' is set if (body == null) { throw new IllegalArgumentException("Missing the required parameter 'body' when calling updatePet"); } UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/pet"); String localVarUrl = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = body == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); }
Example 12
Source File: PetApi.java From openapi-generator with Apache License 2.0 | 5 votes |
public HttpResponse addPetForHttpResponse(java.io.InputStream body, String mediaType) throws IOException { // verify the required parameter 'body' is set if (body == null) { throw new IllegalArgumentException("Missing the required parameter 'body' when calling addPet"); } UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/pet"); String localVarUrl = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = body == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); }
Example 13
Source File: GoogleJsonResponseExceptionTest.java From google-api-java-client with Apache License 2.0 | 5 votes |
public void testFrom_errorNoContentButWithJsonContentType() throws Exception { HttpTransport transport = new ErrorTransport("", Json.MEDIA_TYPE); HttpRequest request = transport.createRequestFactory().buildGetRequest(HttpTesting.SIMPLE_GENERIC_URL); request.setThrowExceptionOnExecuteError(false); HttpResponse response = request.execute(); GoogleJsonResponseException ge = GoogleJsonResponseException.from(GoogleJsonErrorTest.FACTORY, response); assertNull(ge.getDetails()); assertEquals("403", ge.getMessage()); }
Example 14
Source File: GoogleJsonResponseExceptionTest.java From google-api-java-client with Apache License 2.0 | 5 votes |
public void testFrom_detailsErrorObject() throws Exception { HttpTransport transport = new ErrorTransport("{\"error\": {\"message\": \"invalid_token\"}, \"error_description\": \"Invalid value\"}", Json.MEDIA_TYPE); HttpRequest request = transport.createRequestFactory().buildGetRequest(HttpTesting.SIMPLE_GENERIC_URL); request.setThrowExceptionOnExecuteError(false); HttpResponse response = request.execute(); GoogleJsonResponseException ge = GoogleJsonResponseException.from(GoogleJsonErrorTest.FACTORY, response); assertNotNull(ge.getDetails()); assertEquals("invalid_token", ge.getDetails().getMessage()); assertTrue(ge.getMessage().contains("403")); }
Example 15
Source File: UserApi.java From openapi-generator with Apache License 2.0 | 5 votes |
public HttpResponse createUsersWithArrayInputForHttpResponse(java.io.InputStream body, String mediaType) throws IOException { // verify the required parameter 'body' is set if (body == null) { throw new IllegalArgumentException("Missing the required parameter 'body' when calling createUsersWithArrayInput"); } UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/user/createWithArray"); String localVarUrl = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = body == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); }
Example 16
Source File: UserApi.java From openapi-generator with Apache License 2.0 | 5 votes |
public HttpResponse createUserForHttpResponse(java.io.InputStream body, String mediaType) throws IOException { // verify the required parameter 'body' is set if (body == null) { throw new IllegalArgumentException("Missing the required parameter 'body' when calling createUser"); } UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/user"); String localVarUrl = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = body == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); }
Example 17
Source File: StoreApi.java From openapi-generator with Apache License 2.0 | 5 votes |
public HttpResponse placeOrderForHttpResponse(java.io.InputStream body, String mediaType) throws IOException { // verify the required parameter 'body' is set if (body == null) { throw new IllegalArgumentException("Missing the required parameter 'body' when calling placeOrder"); } UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/store/order"); String localVarUrl = uriBuilder.build().toString(); GenericUrl genericUrl = new GenericUrl(localVarUrl); HttpContent content = body == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, body); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); }
Example 18
Source File: GoogleJsonErrorTest.java From google-api-java-client with Apache License 2.0 | 4 votes |
ErrorTransport() { this(ERROR_RESPONSE, Json.MEDIA_TYPE); }
Example 19
Source File: ApiClient.java From openapi-generator with Apache License 2.0 | 4 votes |
public JacksonJsonHttpContent(Object data) { super(Json.MEDIA_TYPE); this.data = data; }
Example 20
Source File: ApiClient.java From Xero-Java with MIT License | 4 votes |
public JacksonJsonHttpContent(Object data) { super(Json.MEDIA_TYPE); this.data = data; }