diff --git a/LICENSE.txt b/LICENSE.txt index 2010d546..08c15e79 100755 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2012-2022 Contentstack (http://app.contentstack.com). All Rights Reserved +Copyright (c) 2012-2023 Contentstack (http://app.contentstack.com). All Rights Reserved Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Contentstack.php b/src/Contentstack.php index 0873130f..138f6e6a 100755 --- a/src/Contentstack.php +++ b/src/Contentstack.php @@ -39,14 +39,15 @@ abstract class Contentstack * @param string $access_token : Contentstack Stack ACCESS TOKEN. * @param string $environment : Environment Name. * @param array $config : Stack Configuration to provide region. - * @param ContentstackRegion $region : Region name of Contentstack. - + * @param ContentstackRegion $region : Region name of Contentstack. (default region 'us') + * * @return Stack * */ + public static function Stack($api_key = '', $access_token = '', $environment = '', - $config = array('region'=> '', 'branch'=> '', 'live_preview' => array('enable' => false, 'host' => 'api.contentstack.io')) + $config = array('region'=> 'us', 'branch'=> '', 'live_preview' => array('enable' => false, 'host' => 'api.contentstack.io')) ) { return new Stack($api_key, $access_token, $environment, $config); } diff --git a/src/ContentstackRegion.php b/src/ContentstackRegion.php index 42f24868..b3026e9b 100755 --- a/src/ContentstackRegion.php +++ b/src/ContentstackRegion.php @@ -30,4 +30,5 @@ class ContentstackRegion const EU= "eu"; const US= "us"; const AZURE_NA= "azure-na"; + const AZURE_EU= "azure-eu"; } \ No newline at end of file diff --git a/src/Stack/BaseQuery.php b/src/Stack/BaseQuery.php index f7f548a3..e7b34c4d 100755 --- a/src/Stack/BaseQuery.php +++ b/src/Stack/BaseQuery.php @@ -546,6 +546,30 @@ public function includeCount() return $this->queryObject; } + /** + * To include the Metadata of entries based on the results + * + * @example + * + * use Contentstack\Contentstack; + * $stack = Contentstack::Stack("API_KEY", "DELIVERY_TOKEN", "ENVIRONMENT"); + * $result = $stack->ContentType('product')->Query()->toJSON()->includeMetadata()->find(); + * + * @return Query + * */ + + + public function includeMetadata() + { + $this->queryObject->_query = call_user_func( + 'contentstackAddBoolean', + 'include_metadata', + $this->queryObject->_query + ); + return $this->queryObject; + } + + /** * To get only count result * @@ -603,7 +627,7 @@ public function includeOwner() * * @return Query * */ - public function addParam($key = '', $value = '') + public function addParam($key = '', $value = '') { $this->queryObject->_query = call_user_func( 'contentstackAddParam', diff --git a/src/Stack/Stack.php b/src/Stack/Stack.php index e610f80f..4ea771f0 100755 --- a/src/Stack/Stack.php +++ b/src/Stack/Stack.php @@ -49,13 +49,14 @@ class Stack * @param string $api_key - API Key of Stack * @param string $delivery_token - Delivery Token of Stack * @param string $environment - Environment Name of Stack - * @param string $region - API Key of Stack + * @param string $region - Region name of Contentstack. (default region 'us') + * * */ public function __construct( $api_key = '', $delivery_token = '', $environment = '', - $config = array('region'=> '', 'branch'=> '', 'live_preview' => array()) + $config = array('region'=> 'us', 'branch'=> '', 'live_preview' => array()) ) { $previewHost = 'api.contentstack.io'; if ($config && $config !== "undefined" && array_key_exists('region', $config) && $config['region'] !== "undefined" && $config['region'] !== "us" ) {