Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
tw.yukina.notion.sdk.endpoint.block.UpdateBlock Maven / Gradle / Ivy
package tw.yukina.notion.sdk.endpoint.block;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
import okhttp3.*;
import org.jetbrains.annotations.NotNull;
import tw.yukina.notion.sdk.endpoint.exception.NotionAPIException;
import tw.yukina.notion.sdk.model.block.Block;
import java.io.IOException;
import static tw.yukina.notion.sdk.Configuration.*;
public class UpdateBlock extends AbstractBlockEndpoint{
@NotNull
public static Block callValue(@NotNull String uuid, @NotNull Block block,
@NotNull OkHttpClient okHttpClient,
@NotNull Request.Builder builder,
@NotNull ObjectMapper objectMapper) {
return toBlock(callTree(uuid, block, okHttpClient, builder, objectMapper), objectMapper);
}
@NotNull
public static Block callValue(@NotNull String uuid, @NotNull JsonNode json,
@NotNull OkHttpClient okHttpClient,
@NotNull Request.Builder builder,
@NotNull ObjectMapper objectMapper) {
return toBlock(callTree(uuid, json, okHttpClient, builder, objectMapper), objectMapper);
}
@NotNull
public static Block callValue(@NotNull String uuid, @NotNull String json,
@NotNull OkHttpClient okHttpClient,
@NotNull Request.Builder builder,
@NotNull ObjectMapper objectMapper) {
return toBlock(callTree(uuid, json, okHttpClient, builder, objectMapper), objectMapper);
}
@NotNull
public static ObjectNode callTree(@NotNull String uuid, @NotNull Block block,
@NotNull OkHttpClient okHttpClient,
@NotNull Request.Builder builder,
@NotNull ObjectMapper objectMapper) {
return getObjectNode(call(uuid, block, okHttpClient, builder, objectMapper), objectMapper);
}
@NotNull
public static ObjectNode callTree(@NotNull String uuid, @NotNull JsonNode json,
@NotNull OkHttpClient okHttpClient,
@NotNull Request.Builder builder,
@NotNull ObjectMapper objectMapper) {
return getObjectNode(call(uuid, json, okHttpClient, builder), objectMapper);
}
@NotNull
public static ObjectNode callTree(@NotNull String uuid, @NotNull String json,
@NotNull OkHttpClient okHttpClient,
@NotNull Request.Builder builder,
@NotNull ObjectMapper objectMapper) {
return getObjectNode(call(uuid, json, okHttpClient, builder), objectMapper);
}
@NotNull
public static Response call(@NotNull String uuid, @NotNull Block block,
@NotNull OkHttpClient okHttpClient,
@NotNull Request.Builder builder,
@NotNull ObjectMapper objectMapper) {
return call(uuid, objectMapper.valueToTree(block), okHttpClient, builder);
}
@NotNull
public static Response call(@NotNull String uuid, @NotNull JsonNode json,
@NotNull OkHttpClient okHttpClient,
@NotNull Request.Builder builder) {
ObjectNode objectNode = getObjectNode(json);
preparePostBlock(objectNode);
return call(uuid, objectNode.toString(), okHttpClient, builder);
}
@NotNull
public static Response call(@NotNull String uuid, @NotNull String json,
@NotNull OkHttpClient okHttpClient,
@NotNull Request.Builder builder) {
return getResponse(uuid, json, okHttpClient, builder, PATH);
}
}