All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.contentstack.cms.stack.Label Maven / Gradle / Ivy

Go to download

Contentstack Java Management SDK for Content Management API, Contentstack is a headless CMS with an API-first approach

The newest version!
package com.contentstack.cms.stack;

import com.contentstack.cms.BaseImplementation;
import okhttp3.ResponseBody;
import org.jetbrains.annotations.NotNull;
import org.json.simple.JSONObject;
import retrofit2.Call;
import retrofit2.Retrofit;

import java.util.HashMap;
import java.util.Map;

/**
 * Labels allow you to group a collection of content within a stack. Using
 * labels you can group content types that need
 * to work together. Read more about Labels.
 * 

* You can now pass the branch header in the API request to fetch or manage * modules located within specific branches of * the stack. Additionally, you can also set the include_branch query parameter * to true to include the _branch top-level * key in the response. This key specifies the unique ID of the branch where the * concerned Contentstack module resides. * * @author ***REMOVED*** * @version v0.1.0 * @since 2022-10-22 */ public class Label implements BaseImplementation

* When executing the API call, under the Header section, you need to * enter the API key of your stack and the * authtoken that you receive after logging into your account. *

* Using {@link #addParam(String, Object)} you can add queries to extend the * functionality of this API call. Under * the URI Parameters section, insert a parameter named query and provide a * query in JSON format as the value. *

* To learn more about the queries, refer to the Query section of the Content * Delivery API doc. * * @return Call * @see Get * all * labels * * @see #addHeader(String, String) to add headers * @see #addParam(String, Object) to add query parameters * @since 0.1.0 */ public Call find() { return this.service.get(this.headers, this.params); } /** * The Get label call returns information about a particular label of a stack. *

* * @return Call * @see Get * a single label * * * @see #addHeader(String, String) to add headers * @see #addParam(String, Object) to add query parameters * @since 0.1.0 */ public Call fetch() { validate(); return this.service.get(this.headers, this.labelUid, this.params); } /** * This call is used to create a label. *

* When executing the API call, under the 'Header' section, you need to enter * the API key of your stack and the * authtoken that you receive after logging into your account. *

* In the 'Body' section, enter the label details, such as the name of the * label, the uid of the parent label, and * the content types that need to be included in the label. These details need * to be provided in JSON format. *

* * @param requestBody JSONObject request body * @return Call * @see Add * label * * * @see #addHeader(String, String) to add headers * @since 0.1.0 */ public Call create(@NotNull JSONObject requestBody) { return this.service.add(this.headers, requestBody); } /** * The Update label call is used to update an existing label. *

* When executing the API call, under the 'Header' section, you need to enter * the authtoken that you receive after * logging into your account. *

* In the 'Body' section, enter the updated details of your label, which include * the name of the label, the uid of * the parent label, and the content types that need to be included in the * label. These details need to be provided * in JSON format *

* * @param body the request body to update the {@link Label} * @return Call * @see Update * label * * * @see #addHeader(String, String) to add headers * @see #addParam(String, Object) to add query parameters * @since 0.1.0 */ public Call update(@NotNull JSONObject body) { validate(); return this.service.update(this.headers, this.labelUid, body); } /** * Delete label call is used to delete a specific label. *

* When executing the API call, under the 'Header' section, you need to enter * the authtoken that you receive after * logging into your account *

* * @return Call * @see Delete * label * * * @see #addHeader(String, String) to add headers * @see #addParam(String, Object) to add query parameters * @since 0.1.0 */ public Call delete() { validate(); return this.service.delete(this.headers, this.labelUid); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy