Class Query

  • All Implemented Interfaces:
    INotifyClass

    public class Query
    extends Object
    implements INotifyClass
    MIT License Copyright (c) 2012 - 2019 Contentstack Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
    • Constructor Detail

      • Query

        protected Query​(String formName)
    • Method Detail

      • setContentTypeInstance

        protected void setContentTypeInstance​(ContentType contentTypeInstance)
      • setHeader

        public void setHeader​(String key,
                              String value)
        To set headers for Built.io Contentstack rest calls.
        Scope is limited to this object and followed classes.
        Parameters:
        key - header name.
        value - header value against given header name.

        Example :
          //'blt5d4sample2633b' is a dummy Stack API key
          //'blt6d0240b5sample254090d' is dummy access token.
          Stack stack = Contentstack.stack(context, "blt5d4sample2633b", "blt6d0240b5sample254090d", "stag", false);
          Query csQuery = stack.contentType("contentType_name").query();
        csQuery.setHeader("custom_key", "custom_value");
      • removeHeader

        public void removeHeader​(String key)
        Remove header key @param key custom_header_key
        Parameters:
        key - String

        Example :
          //'blt5d4sample2633b' is a dummy Stack API key
          //'blt6d0240b5sample254090d' is dummy access token.
          Stack stack = Contentstack.stack(context, "blt5d4sample2633b", "blt6d0240b5sample254090d", "stag", false);
          Query csQuery = stack.contentType("contentType_name").query();
        csQuery.removeHeader("custom_key");
      • getContentType

        public String getContentType()
      • where

        public Query where​(String key,
                           Object value)
        Add a constraint to fetch all entries that contains given value against specified key
        Parameters:
        key - field uid.
        value - field value which get 'included' from the response.
        Returns:
        Query object, so you can chain this call.

        Note : for group field provide key in a "key.groupFieldUid" format.

        Example :

            //'blt5d4sample2633b' is a dummy Stack API key
            //'blt6d0240b5sample254090d' is dummy access token.
            Stack stack = Contentstack.stack(context, "blt5d4sample2633b", "blt6d0240b5sample254090d", "stag", false);
            Query csQuery = stack.contentType("contentType_name").query();
            csQuery.where("uid", "bltf4fbsample851db");
         
      • addQuery

        public Query addQuery​(String key,
                              String value)
        Add a custom query against specified key.
        Parameters:
        key - key.
        value - value.
        Returns:
        Query object, so you can chain this call.

        Example :
           //'blt5d4sample2633b' is a dummy Stack API key
           //'blt6d0240b5sample254090d' is dummy access token.
           Stack stack = Contentstack.stack(context, "blt5d4sample2633b", "blt6d0240b5sample254090d", "stag", false);
           Query csQuery = stack.contentType("contentType_name").query();
           csQuery.addQuery("query_param_key", "query_param_value");
         
      • removeQuery

        public Query removeQuery​(String key)
        Remove provided query key from custom query if exist.
        Parameters:
        key - Query name to remove.
        Returns:
        Query object, so you can chain this call.

        Example :
              projectQuery.removeQuery("Query_Key");
         
      • and

        public Query and​(ArrayList<Query> queryObjects)
        Combines all the queries together using AND operator
        Parameters:
        queryObjects - list of Query instances on which AND query executes.
        Returns:
        Query object, so you can chain this call.

        Example ;
            //'blt5d4sample2633b' is a dummy Stack API key
            //'blt6d0240b5sample254090d' is dummy access token.
            Stack stack = Contentstack.stack(context, "blt5d4sample2633b", "blt6d0240b5sample254090d", "stag", false);
            Query csQuery = stack.contentType("contentType_name").query();
        
            Query query = projectClass.query();
            query.where('username','something');
        
            Query subQuery = projectClass.query();
            subQuery.where('email_address','[email protected]');
        
            ArrayList<Query> array = new ArrayList<Query>();
        array.add(query); array.add(subQuery);
        projectQuery.and(array);
      • or

        public Query or​(ArrayList<Query> queryObjects)
        Add a constraint to fetch all entries which satisfy any queries.
        Parameters:
        queryObjects - list of Query instances on which OR query executes.
        Returns:
        Query object, so you can chain this call.

        Example :
             //'blt5d4sample2633b' is a dummy Stack API key
             //'blt6d0240b5sample254090d' is dummy access token.
             Stack stack = Contentstack.stack(context, "blt5d4sample2633b", "blt6d0240b5sample254090d", "stag", false);
             Query csQuery = stack.contentType("contentType_name").query();
        
             Query query = projectClass.query();
             query.where('username','something');
        
             Query subQuery = projectClass.query();
             subQuery.where('email_address','[email protected]');
        
             ArrayList<Query> array = new ArrayList<Query>();
             array.add(query);
             array.add(subQuery);
        csQuery.or(array);
      • lessThan

        public Query lessThan​(String key,
                              Object value)
        Add a constraint to the query that requires a particular key entry to be less than the provided value.
        Parameters:
        key - the key to be constrained.
        value - the value that provides an upper bound.
        Returns:
        Query object, so you can chain this call.

        Example :
             //'blt5d4sample2633b' is a dummy Stack API key
             //'blt6d0240b5sample254090d' is dummy access token.
             Stack stack = Contentstack.stack(context, "blt5d4sample2633b", "blt6d0240b5sample254090d", "stag", false);
             Query csQuery = stack.contentType("contentType_name").query();
        
             csQuery.lessThan("due_date", "2013-06-25T00:00:00+05:30");
         
      • lessThanOrEqualTo

        public Query lessThanOrEqualTo​(String key,
                                       Object value)
        Add a constraint to the query that requires a particular key entry to be less than or equal to the provided value.
        Parameters:
        key - The key to be constrained
        value - The value that must be equalled.
        Returns:
        Query object, so you can chain this call.

        Example :
             //'blt5d4sample2633b' is a dummy Stack API key
             //'blt6d0240b5sample254090d' is dummy access token.
             Stack stack = Contentstack.stack(context, "blt5d4sample2633b", "blt6d0240b5sample254090d", "stag", false);
             Query csQuery = stack.contentType("contentType_name").query();
             csQuery.lessThanOrEqualTo("due_date", "2013-06-25T00:00:00+05:30");
         
      • greaterThan

        public Query greaterThan​(String key,
                                 Object value)
        Add a constraint to the query that requires a particular key entry to be greater than the provided value.
        Parameters:
        key - The key to be constrained.
        value - The value that provides an lower bound.
        Returns:
        Query object, so you can chain this call.

        Example :
             //'blt5d4sample2633b' is a dummy Stack API key
             //'blt6d0240b5sample254090d' is dummy access token.
             Stack stack = Contentstack.stack(context, "blt5d4sample2633b", "blt6d0240b5sample254090d", "stag", false);
             Query csQuery = stack.contentType("contentType_name").query();
             csQuery.greaterThan("due_date", "2013-06-25T00:00:00+05:30");
         
      • greaterThanOrEqualTo

        public Query greaterThanOrEqualTo​(String key,
                                          Object value)
        Add a constraint to the query that requires a particular key entry to be greater than or equal to the provided value.
        Parameters:
        key - The key to be constrained.
        value - The value that provides an lower bound.
        Returns:
        Query object, so you can chain this call.

        Example :
             //'blt5d4sample2633b' is a dummy Stack API key
             //'blt6d0240b5sample254090d' is dummy access token.
             Stack stack = Contentstack.stack(context, "blt5d4sample2633b", "blt6d0240b5sample254090d", "stag", false);
             Query csQuery = stack.contentType("contentType_name").query();
        
             csQuery.greaterThanOrEqualTo("due_date", "2013-06-25T00:00:00+05:30");
         
      • notEqualTo

        public Query notEqualTo​(String key,
                                Object value)
        Add a constraint to the query that requires a particular key's entry to be not equal to the provided value.
        Parameters:
        key - The key to be constrained.
        value - The object that must not be equaled.
        Returns:
        Query object, so you can chain this call.

        Example ;
             //'blt5d4sample2633b' is a dummy Stack API key
             //'blt6d0240b5sample254090d' is dummy access token.
             Stack stack = Contentstack.stack(context, "blt5d4sample2633b", "blt6d0240b5sample254090d", "stag", false);
             Query csQuery = stack.contentType("contentType_name").query();
        
             csQuery.notEqualTo("due_date", "2013-06-25T00:00:00+05:30");
         
      • containedIn

        public Query containedIn​(String key,
                                 Object[] values)
        Add a constraint to the query that requires a particular key's entry to be contained in the provided array.
        Parameters:
        key - The key to be constrained.
        values - The possible values for the key's object.
        Returns:
        Query object, so you can chain this call.

        Example :
             //'blt5d4sample2633b' is a dummy Stack API key
             //'blt6d0240b5sample254090d' is dummy access token.
             Stack stack = Contentstack.stack(context, "blt5d4sample2633b", "blt6d0240b5sample254090d", "stag", false);
             Query csQuery = stack.contentType("contentType_name").query();
        
             csQuery.containedIn("severity", new Object[]{"Show Stopper", "Critical"});
         
      • notContainedIn

        public Query notContainedIn​(String key,
                                    Object[] values)
        Add a constraint to the query that requires a particular key entry's value not be contained in the provided array.
        Parameters:
        key - The key to be constrained.
        values - The list of values the key object should not be.
        Returns:
        Query object, so you can chain this call.

        Example :
             //'blt5d4sample2633b' is a dummy Stack API key
             //'blt6d0240b5sample254090d' is dummy access token.
             Stack stack = Contentstack.stack(context, "blt5d4sample2633b", "blt6d0240b5sample254090d", "stag", false);
             Query csQuery = stack.contentType("contentType_name").query();
        
             csQuery.notContainedIn("severity", new Object[]{"Show Stopper", "Critical"});
         
      • exists

        public Query exists​(String key)
        Add a constraint that requires, a specified key exists in response.
        Parameters:
        key - The key to be constrained.
        Returns:
        Query object, so you can chain this call.

        Example :
              //'blt5d4sample2633b' is a dummy Stack API key
             //'blt6d0240b5sample254090d' is dummy access token.
             Stack stack = Contentstack.stack(context, "blt5d4sample2633b", "blt6d0240b5sample254090d", "stag", false);
             Query csQuery = stack.contentType("contentType_name").query();
        
             csQuery.exists("status");
         
      • notExists

        public Query notExists​(String key)
        Add a constraint that requires, a specified key does not exists in response.
        Parameters:
        key - The key to be constrained.
        Returns:
        Query object, so you can chain this call.

        Example :
             //'blt5d4sample2633b' is a dummy Stack API key
             //'blt6d0240b5sample254090d' is dummy access token.
             Stack stack = Contentstack.stack(context, "blt5d4sample2633b", "blt6d0240b5sample254090d", "stag", false);
             Query csQuery = stack.contentType("contentType_name").query();
             csQuery.notExists("status");
         
      • includeReference

        public Query includeReference​(String key)
        Add a constraint that requires a particular reference key details.
        Parameters:
        key - key that to be constrained.
        Returns:
        Query object, so you can chain this call.

        Example :
             //'blt5d4sample2633b' is a dummy Stack API key
             //'blt6d0240b5sample254090d' is dummy access token.
             Stack stack = Contentstack.stack(context, "blt5d4sample2633b", "blt6d0240b5sample254090d", "stag", false);
             Query csQuery = stack.contentType("contentType_name").query();
             csQuery.includeReference("for_bug");
         
      • tags

        public Query tags​(String[] tags)
        Include tags with which to search entries.
        Parameters:
        tags - Comma separated array of tags with which to search entries.
        Returns:
        Query object, so you can chain this call.

        Example :
             //'blt5d4sample2633b' is a dummy Stack API key
             //'blt6d0240b5sample254090d' is dummy access token.
             Stack stack = Contentstack.stack(context, "blt5d4sample2633b", "blt6d0240b5sample254090d", "stag", false);
             Query csQuery = stack.contentType("contentType_name").query();
             csQuery.tags(new String[]{"tag1","tag2"});
         
      • ascending

        public Query ascending​(String key)
        Sort the results in ascending order with the given key.
        Sort the returned entries in ascending order of the provided key.
        Parameters:
        key - The key to order by.
        Returns:
        Query object, so you can chain this call.

        Example :
             //'blt5d4sample2633b' is a dummy Stack API key
             //'blt6d0240b5sample254090d' is dummy access token.
             Stack stack = Contentstack.stack(context, "blt5d4sample2633b", "blt6d0240b5sample254090d", "stag", false);
             Query csQuery = stack.contentType("contentType_name").query();
             csQuery.ascending("name");
         
      • descending

        public Query descending​(String key)
        Sort the results in descending order with the given key.
        Sort the returned entries in descending order of the provided key.
        Parameters:
        key - The key to order by.
        Returns:
        Query object, so you can chain this call.

        Example :
             //'blt5d4sample2633b' is a dummy Stack API key
             //'blt6d0240b5sample254090d' is dummy access token.
             Stack stack = Contentstack.stack(context, "blt5d4sample2633b", "blt6d0240b5sample254090d", "stag", false);
             Query csQuery = stack.contentType("contentType_name").query();
             csQuery.descending("name");
         
      • except

        public Query except​(ArrayList<String> fieldUid)
        Specifies list of field uids that would be 'excluded' from the response.
        Parameters:
        fieldUid - field uid which get 'excluded' from the response.
        Returns:
        Query object, so you can chain this call.

        Example :
             //'blt5d4sample2633b' is a dummy Stack API key
             //'blt6d0240b5sample254090d' is dummy access token.
             Stack stack = Contentstack.stack(context, "blt5d4sample2633b", "blt6d0240b5sample254090d", "stag", false);
             Query csQuery = stack.contentType("contentType_name").query();
        ArrayList<String> array = new ArrayList<String>(); array.add("name"); array.add("description");
        csQuery.except(array);
      • except

        public Query except​(String[] fieldUids)
        Specifies list of field uids that would be 'excluded' from the response.
        Parameters:
        fieldUids - field uid which get 'excluded' from the response.
        Returns:
        Query object, so you can chain this call.

        Example :
          //'blt5d4sample2633b' is a dummy Stack API key
          //'blt6d0240b5sample254090d' is dummy access token.
          Stack stack = Contentstack.stack(context, "blt5d4sample2633b", "blt6d0240b5sample254090d", "stag", false);
          Query csQuery = stack.contentType("contentType_name").query();
        csQuery.except(new String[]{"name", "description"});
      • only

        public Query only​(String[] fieldUid)
        Specifies an array of 'only' keys in BASE object that would be 'included' in the response.
        Parameters:
        fieldUid - Array of the 'only' reference keys to be included in response.
        Returns:
        Query object, so you can chain this call.

        Example :
             //'blt5d4sample2633b' is a dummy Stack API key
             //'blt6d0240b5sample254090d' is dummy access token.
             Stack stack = Contentstack.stack(context, "blt5d4sample2633b", "blt6d0240b5sample254090d", "stag", false);
             Query csQuery = stack.contentType("contentType_name").query();
        csQuery.only(new String[]{"name"});
      • onlyWithReferenceUid

        public Query onlyWithReferenceUid​(ArrayList<String> fieldUid,
                                          String referenceFieldUid)
        Specifies an array of 'only' keys that would be 'included' in the response.
        Parameters:
        fieldUid - Array of the 'only' reference keys to be included in response.
        referenceFieldUid - Key who has reference to some other class object.
        Returns:
        Query object, so you can chain this call.

        Example :
              //'blt5d4sample2633b' is a dummy Stack API key
             //'blt6d0240b5sample254090d' is dummy access token.
             Stack stack = Contentstack.stack(context, "blt5d4sample2633b", "blt6d0240b5sample254090d", "stag", false);
             Query csQuery = stack.contentType("contentType_name").query();
        ArrayList<String> array = new ArrayList<String>(); array.add("description"); array.add("name");
        csQuery.onlyWithReferenceUid(array, "for_bug");
      • exceptWithReferenceUid

        public Query exceptWithReferenceUid​(ArrayList<String> fieldUid,
                                            String referenceFieldUid)
        Specifies an array of 'except' keys that would be 'excluded' in the response.
        Parameters:
        fieldUid - Array of the 'except' reference keys to be excluded in response.
        referenceFieldUid - Key who has reference to some other class object.
        Returns:
        Query object, so you can chain this call.

        Example :
             //'blt5d4sample2633b' is a dummy Stack API key
             //'blt6d0240b5sample254090d' is dummy access token.
             Stack stack = Contentstack.stack(context, "blt5d4sample2633b", "blt6d0240b5sample254090d", "stag", false);
             Query csQuery = stack.contentType("contentType_name").query();
        ArrayList<String> array = new ArrayList<String>(); array.add("description"); array.add("name");
        csQuery.exceptWithReferenceUid(array, "for_bug");
      • count

        public Query count()
        Retrieve only count of entries in result.
        Returns:
        Query object, so you can chain this call. Note :- Call QueryResult.getCount() method in the success to get count of objects.

        Example :
             //'blt5d4sample2633b' is a dummy Stack API key
             //'blt6d0240b5sample254090d' is dummy access token.
             Stack stack = Contentstack.stack(context, "blt5d4sample2633b", "blt6d0240b5sample254090d", "stag", false);
             Query csQuery = stack.contentType("contentType_name").query();
        csQuery.count();
      • includeCount

        public Query includeCount()
        Retrieve count and data of objects in result
        Returns:
        Query object, so you can chain this call. Note :- Call QueryResult.getCount() method in the success to get count of objects.

        Example :
             //'blt5d4sample2633b' is a dummy Stack API key
             //'blt6d0240b5sample254090d' is dummy access token.
             Stack stack = Contentstack.stack(context, "blt5d4sample2633b", "blt6d0240b5sample254090d", "stag", false);
             Query csQuery = stack.contentType("contentType_name").query();
        csQuery.includeCount();
      • includeContentType

        public Query includeContentType()
        Include Content Type of all returned objects along with objects themselves.
        Returns:
        Query object, so you can chain this call.

        Example :
             //'blt5d4sample2633b' is a dummy Stack API key
             //'blt6d0240b5sample254090d' is dummy access token.
             Stack stack = Contentstack.stack(context, "blt5d4sample2633b", "blt6d0240b5sample254090d", "stag", false);
             Query csQuery = stack.contentType("contentType_name").query();
        csQuery.includeContentType();
      • includeOwner

        public Query includeOwner()
        Include object owner's profile in the objects data.
        Returns:
        Query object, so you can chain this call.

        Example :
             //'blt5d4sample2633b' is a dummy Stack API key
             //'blt6d0240b5sample254090d' is dummy access token.
             Stack stack = Contentstack.stack(context, "blt5d4sample2633b", "blt6d0240b5sample254090d", "stag", false);
             Query csQuery = stack.contentType("contentType_name").query();
        csQuery.includeOwner();
      • skip

        public Query skip​(int number)
        The number of objects to skip before returning any.
        Parameters:
        number - No of objects to skip from returned objects
        Returns:
        Query object, so you can chain this call.

        Note: The skip parameter can be used for pagination, "skip" specifies the number of objects to skip in the response.

        Example :

              //'blt5d4sample2633b' is a dummy Stack API key
              //'blt6d0240b5sample254090d' is dummy access token.
              Stack stack = Contentstack.stack(context, "blt5d4sample2633b", "blt6d0240b5sample254090d", "stag", false);
              Query csQuery = stack.contentType("contentType_name").query();
        csQuery.skip(2);
      • limit

        public Query limit​(int number)
        A limit on the number of objects to return.
        Parameters:
        number - No of objects to limit.
        Returns:
        Query object, so you can chain this call.

        Note: The limit parameter can be used for pagination, " limit" specifies the number of objects to limit to in the response.

        Example :

              //'blt5d4sample2633b' is a dummy Stack API key
              //'blt6d0240b5sample254090d' is dummy access token.
              Stack stack = Contentstack.stack(context, "blt5d4sample2633b", "blt6d0240b5sample254090d", "stag", false);
              Query csQuery = stack.contentType("contentType_name").query();
        csQuery.limit(2);
      • regex

        public Query regex​(String key,
                           String regex)
        Add a regular expression constraint for finding string values that match the provided regular expression. This may be slow for large data sets.
        Parameters:
        key - The key to be constrained.
        regex - The regular expression pattern to match.
        Returns:
        Query object, so you can chain this call.

        Example :
              //'blt5d4sample2633b' is a dummy Stack API key
              //'blt6d0240b5sample254090d' is dummy access token.
              Stack stack = Contentstack.stack(context, "blt5d4sample2633b", "blt6d0240b5sample254090d", "stag", false);
              Query csQuery = stack.contentType("contentType_name").query();
        csQuery.regex("name", "^browser");
      • regex

        public Query regex​(String key,
                           String regex,
                           String modifiers)
        Add a regular expression constraint for finding string values that match the provided regular expression. This may be slow for large data sets.
        Parameters:
        key - The key to be constrained.
        regex - The regular expression pattern to match
        modifiers - Any of the following supported Regular expression modifiers.

        use i for case-insensitive matching.

        use m for making dot match newlines.

        use x for ignoring whitespace in regex

        Returns:
        Query object, so you can chain this call.

        Example :
              //'blt5d4sample2633b' is a dummy Stack API key
              //'blt6d0240b5sample254090d' is dummy access token.
              Stack stack = Contentstack.stack(context, "blt5d4sample2633b", "blt6d0240b5sample254090d", "stag", false);
              Query csQuery = stack.contentType("contentType_name").query();
        csQuery.regex("name", "^browser", "i");
      • language

        @Deprecated
        public Query language​(Language language)
        Deprecated.
        Set Language instance.
        Parameters:
        language - Language value
        Returns:
        Query object, so you can chain this call

        Example :
              //'blt5d4sample2633b' is a dummy Stack API key
              //'blt6d0240b5sample254090d' is dummy access token.
              Stack stack = Contentstack.stack(context, "blt5d4sample2633b", "blt6d0240b5sample254090d", "stag", false);
              Query csQuery = stack.contentType("contentType_name").query();
        csQuery.language(Language.ENGLISH_UNITED_STATES);
      • locale

        public Query locale​(String locale)
        Set Language instance.
        Parameters:
        locale - String value
        Returns:
        Query object, so you can chain this call

        Example :
              //'blt5d4sample2633b' is a dummy Stack API key
              //'blt6d0240b5sample254090d' is dummy access token.
              Stack stack = Contentstack.stack(context, "blt5d4sample2633b", "blt6d0240b5sample254090d", "stag", false);
              Query csQuery = stack.contentType("contentType_name").query();
        csQuery.language(Language.ENGLISH_UNITED_STATES);
      • search

        public Query search​(String value)
        This method provides only the entries matching the specified value.
        Parameters:
        value - value used to match or compare
        Returns:
        Query object, so you can chain this call.

        Example :
              //'blt5d4sample2633b' is a dummy Stack API key
              //'blt6d0240b5sample254090d' is dummy access token.
              Stack stack = Contentstack.stack(context, "blt5d4sample2633b", "blt6d0240b5sample254090d", "stag", false);
              Query csQuery = stack.contentType("contentType_name").query();
        csQuery.search("header");
      • find

        public Query find​(QueryResultsCallBack callback)
        Execute a Query and Caches its result (Optional)
        Parameters:
        callback - QueryResultsCallBack object to notify the application when the request has completed.
        Returns:
        Query object, so you can chain this call.

        Example :
              //'blt5d4sample2633b' is a dummy Stack API key
              //'blt6d0240b5sample254090d' is dummy access token.
              Stack stack = Contentstack.stack(context, "blt5d4sample2633b", "blt6d0240b5sample254090d", "stag", false);
              Query csQuery = stack.contentType("contentType_name").query();
        csQuery.find(new QueryResultsCallBack() {
        @Override public void onCompletion(ResponseType responseType, QueryResult queryResult, Error error) {
        } });
      • findOne

        public Query findOne​(SingleQueryResultCallback callBack)
        Execute a Query and Caches its result (Optional)
        Parameters:
        callBack - QueryResultsCallBack object to notify the application when the request has completed.
        Returns:
        Query object, so you can chain this call.

        Example :
              //'blt5d4sample2633b' is a dummy Stack API key
              //'blt6d0240b5sample254090d' is dummy access token.
              Stack stack = Contentstack.stack(context, "blt5d4sample2633b", "blt6d0240b5sample254090d", "stag", false);
              Query csQuery = stack.contentType("contentType_name").query();
        csQuery.findOne(new QueryResultsCallBack() {
        @Override public void onCompletion(ResponseType responseType, ENTRY entry, Error error) {
        } });
      • getResultObject

        public void getResultObject​(List<Object> objects,
                                    org.json.JSONObject jsonObject,
                                    boolean isSingleEntry)
        Specified by:
        getResultObject in interface INotifyClass
      • addParam

        public Query addParam​(String key,
                              String value)
        This method adds key and value to an Entry.
        Parameters:
        key - The key as string which needs to be added to the Query
        value - The value as string which needs to be added to the Query
        Returns:
        Query

        Example :
              //'blt5d4sample2633b' is a dummy Stack API key
              //'blt6d0240b5sample254090d' is dummy access token.
              Stack stack = Contentstack.stack(context, "blt5d4sample2633b", "blt6d0240b5sample254090d", "stag", false);
              Query csQuery = stack.contentType("contentType_name").query();
        csQuery.addParam("key", "some_value"); csQuery.findOne(new QueryResultsCallBack() {
        @Override public void onCompletion(ResponseType responseType, ENTRY entry, Error error) {
        } });
      • includeReferenceContentTypUid

        public Query includeReferenceContentTypUid()
        This method also includes the content type UIDs of the referenced entries returned in the response
        Returns:
        Query

        Example :
              //'blt5d4sample2633b' is a dummy Stack API key
              //'blt6d0240b5sample254090d' is dummy access token.
              Stack stack = Contentstack.stack(context, "blt5d4sample2633b", "blt6d0240b5sample254090d", "stag", false);
              Query csQuery = stack.contentType("contentType_name").query();
        csQuery.includeReferenceContentTypUid(); csQuery.findOne(new QueryResultsCallBack() {
        @Override public void onCompletion(ResponseType responseType, ENTRY entry, Error error) {
        } });