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

com.contentstack.cms.stack.Stack 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;

/**
 * A stack is a space that stores the content of a project (a web or mobile
 * property). Within a stack, you can create
 * content structures, content entries, users, etc. related to the project.
 *
 * @author ***REMOVED***
 * @version v0.1.0
 * @since 2022 -10-22
 */
public class Stack implements BaseImplementation {

    private final StackService service;
    protected Retrofit client;
    protected HashMap headers;
    protected HashMap params;

    /**
     * Instantiates a new Stack.
     *
     * @param client the Retrofit instance
     */
    public Stack(@NotNull Retrofit client) {
        this.headers = new HashMap<>();
        this.client = client;
        this.params = new HashMap<>();
        this.service = client.create(StackService.class);
    }

    /**
     * The addParam function adds a key-value pair to a stack and returns the
     * updated stack.
     *
     * @param key   A string representing the key for the parameter.
     * @param value The value parameter is of type Object, which means it can accept
     *              any type of object as
     *              its value.
     * @return The method is returning a reference to the current instance of the
     * Stack object.
     */
    public Stack addParam(@NotNull String key, @NotNull Object value) {
        this.params.put(key, value);
        return this;
    }

    /**
     * @param key   The key parameter is a string that represents the name or
     *              identifier of the header.
     *              It is used to specify the type of information being sent in the
     *              header.
     * @param value The value parameter is a string that represents the value of the
     *              header.
     * @return instance of the Stack
     */
    @Override
    public Stack addHeader(@NotNull String key, @NotNull String value) {
        this.headers.put(key, value);
        return this;
    }

    /**
     * @param params The "params" parameter is a HashMap that maps String keys to
     *               Object values. It is
     *               annotated with @NotNull, indicating that it cannot be null.
     * @return instance of the Stack
     */
    @Override
    public Stack addParams(@NotNull HashMap params) {
        this.params.putAll(params);
        return this;
    }

    /**
     * @param headers A HashMap containing key-value pairs of headers, where the key
     *                is a String
     *                representing the header name and the value is a String
     *                representing the header value.
     * @return instance of the Stack
     */
    @Override
    public Stack addHeaders(@NotNull HashMap headers) {
        this.headers.putAll(headers);
        return this;
    }

    /**
     * The function removes a parameter from a stack and returns the modified stack.
     *
     * @param key The parameter "key" is of type String and is marked with
     *            the @NotNull annotation,
     *            indicating that it cannot be null.
     * @return The method is returning a Stack object.
     */
    public Stack removeParam(@NotNull String key) {
        this.params.remove(key);
        return this;
    }

    /**
     * The function clears the parameters in a stack and returns the modified stack.
     *
     * @return The method is returning a reference to the current instance of the
     * Stack object.
     */
    protected Stack clearParams() {
        this.params.clear();
        return this;
    }

    // The above code is defining a constructor for a class called "Stack". The
    // constructor takes two
    // parameters: a Retrofit client and a map of headers.
    public Stack(@NotNull Retrofit client, @NotNull Map headers) {
        this.headers = new HashMap<>();
        this.client = client;
        this.headers.putAll(headers);
        this.params = new HashMap<>();
        this.service = client.create(StackService.class);
    }

    /**
     * Content type
     * 

* Content type defines the structure or schema of a page or a section of your * web or mobile property. To create * content for your application, you are required to first create a content * type, and then create entries using the * content type. *

* * Additional Resource *

* To get an idea of building your content type as per webpage's layout, we * recommend you to check out our Content * Modeling guide * * @return ContentType */ public ContentType contentType() { return new ContentType(this.client, this.headers); } /** * Content type *

* Content type defines the structure or schema of a page or a section of your * web or mobile property. To create * content for your application, you are required to first create a content * type, and then create entries using the * content type. *

* * Additional Resource *

* To get an idea of building your content type as per webpage's layout, we * recommend you to check out our Content * Modeling guide * * @param contentTypeUid Enter the unique ID of the content type of which you * want to retrieve the details. The UID is generated * based on the title of the content type. The unique ID * of a content type is unique across a stack * @return ContentType */ public ContentType contentType(@NotNull String contentTypeUid) { return new ContentType(this.client, this.headers, contentTypeUid); } /** * Assets
* Assets refer to all the media files (images, videos, PDFs, audio files, and * so on) uploaded in your Contentstack * repository for future use. *

* These files can be attached and used in multiple entries. *

    *
  • * folder(optional) * Enter either the UID of a specific folder to get the assets of that folder, * or enter ‘cs_root’ to get all assets and their folder details from the root * folder. *

    * Example:your_uid *

  • *
  • * include_folders(optional) * Set this parameter to ‘true’ to include the details of the created folders * along with the details of the assets. *

    * Example:true *

  • *
  • * environment(optional) * Enter the name of the environment to retrieve the assets published on them. * You can enter multiple environments. *

    * Example:production *

  • *
  • * version(optional) * Specify the version number of the asset that you want to retrieve. If the * version is not specified, the details of the latest version will be * retrieved. *

    * Example:1 *

  • *
  • * include_publish_details(optional) * Enter 'true' to include the publish details of the entry. *

    * Example:true *

  • *
  • * include_count(optional) * Set this parameter to 'true' to include the total number of assets available * in your stack in the response body. *

    * Example:false *

  • *
  • * relative_urls(optional) * Set this to 'true' to display the relative URL of the asset. *

    * Example:false *

  • *
  • * asc_field_uid(optional) * Enter the unique ID of the field for sorting the assets in ascending order by * that field. *

    * Example:created_at *

  • *
  • * desc_field_uid(optional) * Enter the unique ID of the field for sorting the assets in descending order * by that field. *

    * Example:file_size *

  • *
  • * include_branch(optional) * Set this to 'true' to include the _branch top-level key in the * response. This key states the unique ID of the branch where the concerned * Contentstack module resides. *

    * Example:false *

* * @return Asset */ public Asset asset() { return new Asset(this.client, this.headers); } /** * Assets
* Assets refer to all the media files (images, videos, PDFs, audio files, and * so on) uploaded in your Contentstack * repository for future use. *

* These files can be attached and used in multiple entries. *

    *
  • * folder(optional) * Enter either the UID of a specific folder to get the assets of that folder, * or enter ‘cs_root’ to get all assets and their folder details from the root * folder. *

    * Example: uid899999999 *

  • *
  • * include_folders(optional) * Set this parameter to ‘true’ to include the details of the created folders * along with the details of the assets. *

    * Example:true *

  • *
  • * environment(optional) * Enter the name of the environment to retrieve the assets published on them. * You can enter multiple environments. *

    * Example:production *

  • *
  • * version(optional) * Specify the version number of the asset that you want to retrieve. If the * version is not specified, the details of the latest version will be * retrieved. *

    * Example:1 *

  • *
  • * include_publish_details(optional) * Enter 'true' to include the publish details of the entry. *

    * Example:true *

  • *
  • * include_count(optional) * Set this parameter to 'true' to include the total number of assets available * in your stack in the response body. *

    * Example:false *

  • *
  • * relative_urls(optional) * Set this to 'true' to display the relative URL of the asset. *

    * Example:false *

  • *
  • * asc_field_uid(optional) * Enter the unique ID of the field for sorting the assets in ascending order by * that field. *

    * Example:created_at *

  • *
  • * desc_field_uid(optional) * Enter the unique ID of the field for sorting the assets in descending order * by that field. *

    * Example:file_size *

  • *
  • * include_branch(optional) * Set this to 'true' to include the _branch top-level key in the * response. This key states the unique ID of the branch where the concerned * Contentstack module resides. *

    * Example:false *

* * @param assetUid the assetUid * @return Asset */ public Asset asset(String assetUid) { return new Asset(this.client, this.headers, assetUid); } /** * A Global field is a reusable field (or group of fields) that you can define * once and reuse in any content type * within your stack. This eliminates the need (and thereby time and efforts) to * create the same set of fields * repeatedly in multiple content types. * * @return GlobalField */ public GlobalField globalField() { return new GlobalField(this.client,this.headers); } /** * A Global field is a reusable field (or group of fields) that you can define * once and reuse in any content type * within your stack. This eliminates the need (and thereby time and efforts) to * create the same set of fields * repeatedly in multiple content types. * * @param globalFiledUid the globalField uid * @return GlobalField */ public GlobalField globalField(@NotNull String globalFiledUid) { return new GlobalField(this.client,this.headers,globalFiledUid); } /** * Contentstack has a sophisticated multilingual capability. It allows you to * create and publish entries in any * language. This feature allows you to set up multilingual websites and cater * to a wide variety of audience by * serving content in their local language(s). *

* * @return Locale * @see Languages */ public Locale locale() { return new Locale(this.client,this.headers); } /** * Contentstack has a sophisticated multilingual capability. It allows you to * create and publish entries in any * language. This feature allows you to set up multilingual websites and cater * to a wide variety of audience by * serving content in their local language(s). *

* * @param code the locale code. * @return Locale * @see Languages */ public Locale locale(String code) { return new Locale(this.client,this.headers, code); } /** * A publishing environment corresponds to one or more deployment servers or a * content delivery destination where * the entries need to be published. *

* Read more about * * @return Environment * @see Environments */ public Environment environment() { return new Environment(this.client,this.headers); } /** * A publishing environment corresponds to one or more deployment servers or a * content delivery destination where * the entries need to be published. *

* Read more about * * @param environment uid * @return Environment * @see Environments */ public Environment environment(String environment) { return new Environment(this.client,this.headers, environment); } /** * 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 * * @return Label *

* 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. */ public Label label() { return new Label(this.client,this.headers); } /** * 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 * * @param labelUid The label * @return Label *

* 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. */ public Label label(String labelUid) { return new Label(this.client,this.headers, labelUid); } /** * Extensions let you create custom fields and custom widgets that lets you * customize Contentment's default UI and * behavior. Read more about Extensions. *

* 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. *

* * @return instance of {@link Extensions} */ public Extensions extensions() { return new Extensions(this.client,this.headers); } /** * Extensions let you create custom fields and custom widgets that lets you * customize Contentment's default UI and * behavior. Read more about Extensions. *

* 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. *

* * @param customFieldUid The UID of the custom field that you want to update * {@link #addParam(String, Object)} Set this to 'true' * to include the '_branch' top-level key in the response. * This key states the unique ID of the branch where * the concerned Contentstack module resides. * @return instance of {@link Extensions} */ public Extensions extensions(String customFieldUid) { return new Extensions(this.client,this.headers, customFieldUid); } /** * Contentstack provides different types of tokens to authorize API requests. * You can use Delivery Tokens to * authenticate Content Delivery API (CDA) requests and retrieve the published * content of an environment. To * authenticate Content Management API (CMA) requests over your stack content, * you can use Management Tokens. *

* Delivery tokens provide read-only access to the associated environments, * while management tokens provide * read-write access to the content of your stack. Use these tokens along with * the stack API key to make authorized * API requests *

* * @return Tokens */ public Tokens tokens() { return new Tokens(this.client,this.headers); } /** * A role is a collection of permissions that will be applicable to all the * users who are assigned this role * * @return Role */ public Roles roles() { return new Roles(this.client,this.headers); } /** * A role is a collection of permissions that will be applicable to all the * users who are assigned this role * * @param roleUid The unique ID of the role of which you want to retrieve the * details * @return Role */ public Roles roles(String roleUid) { return new Roles(this.client, this.headers,roleUid); } /** * You can pin a set of entries and assets (along with the deployment action, i.e., * publish/un-publish) to a * release, and then deploy this release to an environment. This will * publish/un-publish all the items of the release to the specified environment. * Read more about Releases. * * @return Release */ public Release releases() { return new Release(this.client,this.headers); } /** * You can pin a set of entries and assets (along with the deployment action, i.e., * publish/un-publish) to a * release, and then deploy this release to an environment. This will * publish/un-publish all the items of the release to the specified environment. * Read more about Releases. * * @param releaseUid The unique ID of the release of which you want to retrieve * the details * @return Release */ public Release releases(String releaseUid) { return new Release(this.client,this.headers,releaseUid); } /** * Workflow * is a * tool that allows you to streamline the process of content creation and * publishing, and lets you manage the * content lifecycle of your project smoothly. * * @return Workflow */ public Workflow workflow() { return new Workflow(this.client,this.headers); } /** * Workflow * is a * tool that allows you to streamline the process of content creation and * publishing, and lets you manage the * content lifecycle of your project smoothly. * * @param workflowUid The UID of your workflow that you want to retrieve * @return Workflow */ public Workflow workflow(@NotNull String workflowUid) { return new Workflow(this.client, this.headers,workflowUid); } /** * Audit log displays a record of all the activities performed in a stack and * helps you keep a track of all * published items, updates, deletes, and current status of the existing * content. Read more about AuditLog. * * @return AuditLog */ public AuditLog auditLog() { return new AuditLog(this.client,this.headers); } /** * Audit log displays a record of all the activities performed in a stack and * helps you keep a track of all * published items, updates, deletes, and current status of the existing * content. Read more about AuditLog. * * @param logItemUid the logItemUid * @return AuditLog */ public AuditLog auditLog(@NotNull String logItemUid) { return new AuditLog(this.client,this.headers, logItemUid); } /** * The Publishing Queue displays the historical and current details of * activities such as publish, un-publish, or * delete that can be performed on entries and/or assets. It also shows details * of Release deployments. These * details include time, entry, content type, version, language, user, * environment, and status. *

* For more details, refer the Publish * Queue * documentation. * * @return PublishQueue */ public PublishQueue publishQueue() { return new PublishQueue(this.client,this.headers); } /** * You can perform bulk operations such as Publish, Un-publish, and Delete on * multiple entries or assets, or Change * the Workflow Details of multiple entries or assets at the same time. *

* For more details, refer the Bulk * Operation * documentation. * * @return BulkOperation */ public BulkOperation bulkOperation() { return new BulkOperation(this.client,this.headers); } /** * The Publishing Queue displays the historical and current details of * activities such as publish, un-publish, or * delete that can be performed on entries and/or assets. It also shows details * of Release deployments. These * details include time, entry, content type, version, language, user, * environment, and status. *

* For more details, refer the Publish * Queue * documentation. * * @param publishQueueUid The UID of a specific publish queue activity of which * you want to retrieve the details. Execute the Get * publish queue API request to retrieve the UID of a * particular publish queue activity. * @return PublishQueue */ public PublishQueue publishQueue(@NotNull String publishQueueUid) { return new PublishQueue(this.client,this.headers, publishQueueUid); } /** * A webhook is a mechanism that sends real-time information to any third-party * app or service to keep your * application in sync with your Contentstack account. Webhooks allow you to * specify a URL to which you would like * Contentstack to post data when an event happens. Read more about Webhooks * *

* Note: If any key name in the response data sent to a notification URL * begins with a dollar sign ($), it will be prefixed with the acronym "cs" as a * wildcard. For example, the key * named "$success" would be replaced with "cs$success." For more information, * refer to our API Change Log * documentation. The option to define stack-level scope for webhooks is not * available when using the classic * Contentstack interface. * * @return Webhook */ public Webhook webhook() { return new Webhook(this.client,this.headers); } /** * A webhook is a mechanism that sends real-time information to any third-party * app or service to keep your * application in sync with your Contentstack account. Webhooks allow you to * specify a URL to which you would like * Contentstack to post data when an event happens. Read more about Webhooks * *

* Note: If any key name in the response data sent to a notification URL * begins with a dollar sign ($), it will be prefixed with the acronym "cs" as a * wildcard. For example, the key * named "$success" would be replaced with "cs$success." For more information, * refer to our API Change Log * documentation. The option to define stack-level scope for webhooks is not * available when using the classic * Contentstack interface. * * @param webhookUid Enter the unique ID of the webhook of which you want to * retrieve the details. Execute the Get all * webhooks call to retrieve the UID of a webhook * @return Webhook */ public Webhook webhook(String webhookUid) { return new Webhook(this.client,this.headers, webhookUid); } /** * Branches *
* Branches allows you to isolate and easily manage your * in-progress work from your stable, live work * in the production environment. It helps multiple development teams to work in * parallel in a more collaborative, * organized, and structured manner without impacting each other. *
* * @return Branch */ public Branch branch() { return new Branch(this.client,this.headers); } /** * Branches *
* Branches allows you to isolate and easily manage your * in-progress work from your stable, live work * in the production environment. It helps multiple development teams to work in * parallel in a more collaborative, * organized, and structured manner without impacting each other. *
* * @param branchUid The unique ID of the branch of which you want to retrieve * the details. * @return Branch */ public Branch branch(String branchUid) { return new Branch(this.client,this.headers, branchUid); } /** * An alias acts as a pointer to a particular branch. You can specify the alias * ID in your frontend code to pull * content from the target branch associated with an alias. * * @return Alias */ public Alias alias() { return new Alias(this.client,this.headers); } /** * An alias acts as a pointer to a particular branch. You can specify the alias * ID in your frontend code to pull * content from the target branch associated with an alias. * * @param aliasUid The unique ID of the alias of which you want to retrieve the * details. The UID of an alias is unique * across a stack. Execute the Get all aliases call to retrieve * the UID of an alias * @return Alias */ public Alias alias(String aliasUid) { return new Alias(this.client, this.headers,aliasUid); } /** * The taxonomy works on data where hierarchy is configured * *

     * {@code
     * Stack stack = new Contentstack.Builder().setAuthtoken("authtoken").build().stack();
     * Taxonomy taxonomy = stack.taxonomy();
     * Call response = taxonomy.fetch().execute();
     * }
     * 
* * @return instance of Taxonomy */ public Taxonomy taxonomy() { return new Taxonomy(this.client, this.headers); } /** * The taxonomy works on data where hierarchy is configured * * @param taxonomyUid the taxonomy uid * @return instance of Taxonomy *
*
     * {@code
     * Stack stack = new Contentstack.Builder().setAuthtoken("authtoken").build().stack();
     * Taxonomy taxonomy = stack.taxonomy("taxonomyId");
     * taxonomy.terms();
     * taxonomy.fetch();
     * taxonomy.find();
     * }
     * 
*/ public Taxonomy taxonomy(@NotNull String taxonomyUid) { return new Taxonomy(this.client, this.headers, taxonomyUid); } /** * Get stacks *
* All Stack:- authtoken is required to fetch all the stacks *
*
* Single Stack:- : api_key and authtoken is required and * organization_uid is optional *
*
* Example: * *
     * {@code
     * Stack stack = new Contentstack.Builder().setAuthtoken("authtoken").build().stack();
     * stack.addParam("include_collaborators", true);
     * stack.addParam("include_stack_variables", true);
     * stack.addParam("include_discrete_variables", true);
     * stack.addParam("include_count", true);
     * stack.addHeader("organization_uid", orgId);
     * Request request = stack.fetch().request();
     * }
     * 
* * For SSO-enabled organizations, it is mandatory to pass the organization * UID in the header. *
*
* - Add headers using {@link #addHeader(String, String)} *
* - Add query parameters using {@link #addParam(String, Object)} * * @return Call * @see Get * all * Stacks * @see Get * single Stack * @since 0.1.0 */ public Call find() { return this.service.fetch(this.headers, this.params); } /** * Create stack. *
* The Create stack call creates a new stack in your Contentstack account. *
* In the 'Body' section, provide the schema of the stack in JSON format *
* Note:At any given point of time, an organization can create only one * stack per minute. * * @param organizationUid the organization uid * @param requestBody The request body as JSONObject * @return Call * @see Get * all * Stacks * @since 0.1.0 */ public Call create( @NotNull String organizationUid, @NotNull JSONObject requestBody) { return service.create(organizationUid, requestBody); } /** * Update Stack *
* The Update stack call lets you update the name and description of an existing * stack. *
* In the 'Body' section, provide the updated schema of the stack in JSON * format. *
* Note Warning: The master locale cannot be changed once it is set * while stack creation. So, you cannot use this call to change/update the * master language. * * @param requestBody the Request body * @return the stack */ public Call update(@NotNull JSONObject requestBody) { return service.update(this.headers, requestBody); } /** * Transfer Stack Ownership *
* The Transfer stack ownership to other users call sends the specified user an * email invitation for accepting the * ownership of a particular stack. * *
*
* Once the specified user accepts the invitation by clicking on the link * provided in the email, the ownership of * the stack gets transferred to the new user. Subsequently, the previous owner * will no longer have any permission * on the stack. *
* Note *
* * Warning: The master locale cannot be changed once it is set while stack * creation. So, you cannot use this call to * change/update the master language. * *

* * (Read more) * * @param body The request body as JSONObject * @return the stack */ public Call transferOwnership(@NotNull JSONObject body) { return service.transferOwnership(this.headers, body); } /** * Accept Stack Ownership *
* The Accept stack owned by other user call allows a user to accept the * ownership of a particular stack via an * email invitation. *
*

* Once the user accepts the invitation by clicking on the link, the ownership * is transferred to the new user * account. Subsequently, the user who transferred the stack will no longer have * any permission on the stack. *
*

* * (Read more) *
* uid and api_key is required to get the acceptOwnership * information *

    *
  • To Accept stack owned by other user, user * {@link #addParam(String, Object)} to add query parameters
  • *
  • To Add Header use {@link #addHeader(String, String)}
  • *
* * @param ownershipToken the ownership token received via email by another user. * @return the stack */ public Call acceptOwnership( @NotNull String ownershipToken) { return service.acceptOwnership(this.headers, ownershipToken, this.params); } /** * Stack Settings * The Get stack settings call retrieves the * configuration settings of an existing stack. *
*

* * *(Read * more) * * @return the call */ public Call setting() { return service.setting(this.headers); } /** * Add/Update Stack Settings *

* The Add stack settings request lets you add additional settings for your * existing stack. *

*
*

* You can add specific settings for your stack by passing any of the following * parameters within the * stack_variables section in the Request Body: *

*

* Additionally, you can pass cs_only_break line: true under the * rte parameter to ensure that only a *
* tag is added inside the Rich Text Editor field when the content * manager presses Enter. When this * parameter is set to false, the
* tag is replaced with *

*
*

*
* Here is a sample of the Request Body: * *
     * {"stack_settings":{
     *    "stack_variables":{
     *      "enforce_unique_urls":true,
     *       "sys_rte_allowed_tags":"style | figure | script"
     *    },
     *    "rte":{
     *      "cs_only_line":true
     *      }
     *    }
     *  }
     * 
*

* * *(Read * more) *
*
* Reset stack settings *

* The Reset stack settings call resets your stack to default settings, and * additionally, lets you add parameters to * or modify the settings of an existing stack. *

*
* Here is a sample of the Request Body: * *
     *
     * {
     *     "stack_settings":{
     *         "discrete_variables":{},
     *         "stack_variables":{}
     *     }
     * }
     * 
*

* * (Read * more) * * @param requestBody the request body as JSONObject * @return the call */ public Call updateSetting(@NotNull JSONObject requestBody) { return service.updateSetting(this.headers, requestBody); } /** * Reset stack settings *

* The Reset stack settings call resets your stack to default settings, and * additionally, lets you add parameters to * or modify the settings of an existing stack. *

*
* Here is a sample of the Request Body: * *
     *
     * {
     *     "stack_settings":{
     *         "discrete_variables":{},
     *         "stack_variables":{}
     *     }
     * }
     * 
*

* * (Read * more) * * @param requestBody the request body * @return the call */ public Call resetSetting(@NotNull JSONObject requestBody) { return service.updateSetting(this.headers, requestBody); } /** * Share a stack *

* The Share a stack call shares a stack with the specified user to collaborate * on the stack. *

*
*

* In the 'Body' section, you need to provide the email ID of the user with whom * you wish to share the stack along * with the role uid that you wish to assign the user. *

* Here is a sample of the Request Body: * *
     *    {
     * 	"emails": [
     * 		"[email protected]"
     * 	],
     * 	"roles": {
     * 		"[email protected]": [
     * 			"some_example_s"
     * 		]
     *        }
     * }
     * 
* * @param requestBody the request body * @return the call */ public Call share(@NotNull JSONObject requestBody) { return service.share(this.headers, requestBody); } /** * Un-share a stack *

* The Un-share a stack removes the user account from the list of collaborators. * Once this call is executed, the user * will not be able to view the stack in their account. *

*
*

* In the 'Body' section, you need to provide the email ID of the user from whom * you wish to un-share the stack. *

* Here is a sample of the Request Body: * *
     * {
     * "email": "[email protected]"
     * }
     * 
* * @param requestBody the request body * @return the call */ public Call unshare(@NotNull JSONObject requestBody) { return service.unshare(this.headers, requestBody); } /** * Get all users of a stack *
*

* The Get all users of a stack call fetches the list of all users of a * particular stack *

* * @return the call */ public Call allUsers() { return service.allUsers(this.headers); } /** * Update User Role *
*

* The Update User Role API Request updates the roles of an existing user * account. This API Request will override * the existing roles assigned to a user. For example, we have an existing user * with the Developer role, and * if you execute this API request with "Content Manager" role, the user role * will lose Developer rights and * the user role be updated to just Content Manager. *

*
*

* When executing the API call, under the Body section, enter the UIDs of * roles that you want to assign a * user. This information should be in JSON format. * Here is a sample of the Request Body: * *

     * {
     * "users": {
     * "user_uid": ["role_uid1", "role_uid2"]
     * }
     * }
     * 
* * @param body the request body * @return Call */ public Call roles(@NotNull JSONObject body) { return service.updateUserRoles(this.headers, body); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy