本文整理汇总了Java中retrofit2.http.PATCH类的典型用法代码示例。如果您正苦于以下问题:Java PATCH类的具体用法?Java PATCH怎么用?Java PATCH使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PATCH类属于retrofit2.http包,在下文中一共展示了PATCH类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: twoMethodsFail
import retrofit2.http.PATCH; //导入依赖的package包/类
@Test public void twoMethodsFail() {
class Example {
@PATCH("/foo") //
@POST("/foo") //
Call<ResponseBody> method() {
return null;
}
}
try {
buildRequest(Example.class);
fail();
} catch (IllegalArgumentException e) {
assertThat(e.getMessage())
.isIn("Only one HTTP method is allowed. Found: PATCH and POST.\n for method Example.method",
"Only one HTTP method is allowed. Found: POST and PATCH.\n for method Example.method");
}
}
示例2: parseMethodAnnotation
import retrofit2.http.PATCH; //导入依赖的package包/类
private void parseMethodAnnotation(Annotation annotation) {
if (annotation instanceof DELETE) {
parseHttpMethodAndPath("DELETE", ((DELETE) annotation).value(), false);
} else if (annotation instanceof GET) {
parseHttpMethodAndPath("GET", ((GET) annotation).value(), false);
} else if (annotation instanceof HEAD) {
parseHttpMethodAndPath("HEAD", ((HEAD) annotation).value(), false);
if (!Void.class.equals(responseType)) {
throw methodError("HEAD method must use Void as response type.");
}
} else if (annotation instanceof PATCH) {
parseHttpMethodAndPath("PATCH", ((PATCH) annotation).value(), true);
} else if (annotation instanceof POST) {
parseHttpMethodAndPath("POST", ((POST) annotation).value(), true);
} else if (annotation instanceof PUT) {
parseHttpMethodAndPath("PUT", ((PUT) annotation).value(), true);
} else if (annotation instanceof OPTIONS) {
parseHttpMethodAndPath("OPTIONS", ((OPTIONS) annotation).value(), false);
} else if (annotation instanceof HTTP) {
HTTP http = (HTTP) annotation;
parseHttpMethodAndPath(http.method(), http.path(), http.hasBody());
} else if (annotation instanceof retrofit2.http.Headers) {
String[] headersToParse = ((retrofit2.http.Headers) annotation).value();
if (headersToParse.length == 0) {
throw methodError("@Headers annotation is empty.");
}
headers = parseHeaders(headersToParse);
} else if (annotation instanceof Multipart) {
if (isFormEncoded) {
throw methodError("Only one encoding annotation is allowed.");
}
isMultipart = true;
} else if (annotation instanceof FormUrlEncoded) {
if (isMultipart) {
throw methodError("Only one encoding annotation is allowed.");
}
isFormEncoded = true;
}
}
示例3: editComment
import retrofit2.http.PATCH; //导入依赖的package包/类
@NonNull @PATCH("repos/{owner}/{repo}/issues/comments/{commentId}")
@Headers("Accept: application/vnd.github.html,application/vnd.github.VERSION.raw")
Observable<Response<IssueEvent>> editComment(
@Path("owner") String owner,
@Path("repo") String repo,
@Path("commentId") String commentId,
@Body CommentRequestModel body
);
示例4: editIssue
import retrofit2.http.PATCH; //导入依赖的package包/类
@NonNull @PATCH("repos/{owner}/{repo}/issues/{issueNumber}")
@Headers("Accept: application/vnd.github.html,application/vnd.github.VERSION.raw")
Observable<Response<Issue>> editIssue(
@Path("owner") String owner,
@Path("repo") String repo,
@Path("issueNumber") int issueNumber,
@Body Issue body
);
示例5: patch
import retrofit2.http.PATCH; //导入依赖的package包/类
@PATCH("segment/patch")
Observable<ResponseBody> patch(@Query("query") String q);
示例6:
import retrofit2.http.PATCH; //导入依赖的package包/类
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: fixtures.http.HttpRetrys patch504" })
@PATCH("http/retry/504")
Observable<Response<ResponseBody>> patch504(@Body Boolean booleanValue);
示例7: editIssue
import retrofit2.http.PATCH; //导入依赖的package包/类
@PATCH("/issues/{issue_auth_token}")
Call<Issue> editIssue(@Header("Authorization") String authToken, @Body JsonObject editedIssue,
@Path("issue_auth_token") String issueAuthToken);
示例8: patch
import retrofit2.http.PATCH; //导入依赖的package包/类
@FormUrlEncoded
@PATCH()
Observable<ResponseBody> patch(@Url() String url, @FieldMap Map<String, String> maps);
示例9: heartbeat
import retrofit2.http.PATCH; //导入依赖的package包/类
@PATCH("sessions/{session}")
Call<Session> heartbeat(@Path("session") long id);
示例10: update
import retrofit2.http.PATCH; //导入依赖的package包/类
@PATCH("keys/{key}")
Call<StorageEntry> update(@Path("key") String key,
@Query("session") long session,
@Query("value") String value,
@Query("version") long version);
示例11: updateConsumerApplication
import retrofit2.http.PATCH; //导入依赖的package包/类
@PATCH("/consumers/{consumer_id}/oauth2/{id}")
Call<Application> updateConsumerApplication(@Path("consumer_id") String consumerId, @Path("id") String applicationId, @Body Application request);
示例12: updateToken
import retrofit2.http.PATCH; //导入依赖的package包/类
@PATCH("/oauth2_tokens/{id}")
Call<Token> updateToken(@Path("id") String tokenId, @Body Token request);
示例13: updatePluginForApi
import retrofit2.http.PATCH; //导入依赖的package包/类
@PATCH("/apis/{api}/plugins/{id}")
Call<Plugin> updatePluginForApi(@Path("api") String apiNameOrId, @Path("id") String pluginNameOrId, @Body Plugin request);
示例14: update
import retrofit2.http.PATCH; //导入依赖的package包/类
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.msi.UserAssignedIdentities update" })
@PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{resourceName}")
Observable<Response<ResponseBody>> update(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceName") String resourceName, @Query("api-version") String apiVersion, @Body IdentityInner parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
示例15: updateCertificate
import retrofit2.http.PATCH; //导入依赖的package包/类
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.appservice.AppServiceCertificateOrders updateCertificate" })
@PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates/{name}")
Observable<Response<ResponseBody>> updateCertificate(@Path("resourceGroupName") String resourceGroupName, @Path("certificateOrderName") String certificateOrderName, @Path("name") String name, @Path("subscriptionId") String subscriptionId, @Body AppServiceCertificatePatchResourceInner keyVaultCertificate, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);