Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
133 commits
Select commit Hold shift + click to select a range
3771a11
PHP SDK Version 3.0.0 released
Jan 1, 2017
ff5044a
README.md changes
hiteshbal91 Jan 1, 2017
ef9b7dd
Exception class added for the custom error handling
hiteshbal91 Jan 17, 2017
00f26a7
Assets query
rohitmishra209 Oct 3, 2017
5a407ed
Assets query
rohitmishra209 Oct 3, 2017
37d3329
Assets query
rohitmishra209 Oct 3, 2017
b345839
updated in testcases folder
rohitmishra209 Oct 4, 2017
287c4da
Updated on src folder and structure of app
rohitmishra209 Oct 5, 2017
cefd4f0
Updated on src folder and structure of app
rohitmishra209 Oct 5, 2017
32a4c6d
Updated in Testcases
rohitmishra209 Oct 6, 2017
a17fd78
Updated php-sdk
rohitmishra209 Oct 13, 2017
934b005
upadate testcases
rohitmishra209 Oct 14, 2017
c451cde
upadate testcases
rohitmishra209 Oct 14, 2017
f3a072f
upadate testcases
rohitmishra209 Oct 14, 2017
06609fe
upadate testcases
rohitmishra209 Oct 14, 2017
11e8c34
generating api-reference for the given version.
hiteshbal91 Oct 14, 2017
efcf0fd
Updated the image_transformation
rohitmishra209 Oct 24, 2017
86f81a6
updated the test case
rohitmishra209 Oct 25, 2017
f9b18ae
updated the test case file
Oct 25, 2017
67761d4
Updated the test cases and in image_transformation function
rohitmishra209 Oct 31, 2017
795d1fc
updated in testcases
rohitmishra209 Nov 1, 2017
194a167
updated the testcases files
rohitmishra209 Nov 2, 2017
0a79823
updated in test cases file
rohitmishra209 Nov 3, 2017
f94f665
updated in test cases file
rohitmishra209 Nov 3, 2017
00c5e5e
updated on Assets file
rohitmishra209 Nov 7, 2017
4b9562d
deleted some unwanted files
rohitmishra209 Nov 7, 2017
d2168ff
deleted some unwanted files
rohitmishra209 Nov 7, 2017
542b96f
deleted some unwanted files
rohitmishra209 Nov 7, 2017
76dd7b2
deleted some unwanted files
rohitmishra209 Nov 7, 2017
ab3caef
Updated the README file
Nov 9, 2017
7377d9f
Updated the README file
Nov 9, 2017
d8430f0
Updated the README file
Nov 9, 2017
718640e
Updated the README file
Nov 9, 2017
2385cdf
updated the README file
Nov 9, 2017
82d1709
Added new method under entries and Assets class
Dec 7, 2017
c70929f
updated in config file
Dec 8, 2017
0bd1916
updated in test file
Dec 8, 2017
08509eb
updated in testcase files
Dec 19, 2017
8317ec7
updated in testcase files
Dec 19, 2017
5cb5cae
updated in testcase files
Dec 19, 2017
d707f3d
updated in testcase files
Dec 19, 2017
0a2c933
Generate Api-reference doc
Dec 21, 2017
310bdd5
Merge pull request #1 from builtio-contentstack/add_param_method
rohitmishra209 Dec 21, 2017
a458900
updated in helper file
rohitmishra209 Sep 18, 2018
4f4975a
updated in helper file
rohitmishra209 Sep 19, 2018
5fb6214
updated the testcases
rohitmishra209 Apr 18, 2019
17f7aa1
Updated the testcases
rohitmishra209 May 22, 2019
bb6ec7d
Updated the README
rohitmishra209 May 22, 2019
3adeaf4
updated in LICENSE file
rohitmishra209 May 24, 2019
4e84081
Merge pull request #7 from contentstack/hotfix/1.2.2
rohitmishra209 May 24, 2019
e83c2fb
Supporting New query of multi-ct reference in reference field
rohitmishra209 Aug 1, 2019
40fe8a3
Supporting New query of multi-ct reference in reference field
rohitmishra209 Aug 1, 2019
65a64da
updated the reference doc
rohitmishra209 Aug 2, 2019
d2e5af1
updated the LICENSE format
rohitmishra209 Aug 2, 2019
a886990
Merge pull request #8 from contentstack/multi-ct-reference
rohitmishra209 Aug 2, 2019
8e8913e
Supporting the region bases data fetch
rohitmishra209 Sep 5, 2019
d6823f6
Region Support
rohitmishra209 Sep 5, 2019
977cf67
Support Snippet feature
rohitmishra209 Oct 18, 2019
3a473c2
made changes in global fields
rohitmishra209 Nov 5, 2019
707ec31
Update README.md
uttamukkoji Nov 6, 2019
434354e
Testcases updated
rohitmishra209 Nov 17, 2019
d943df9
Testcases updated
rohitmishra209 Nov 17, 2019
d494b37
created a doc
rohitmishra209 Nov 18, 2019
32598b5
Merge pull request #10 from contentstack/master
rohitmishra209 Nov 18, 2019
868a4d6
Merge pull request #9 from contentstack/snippets
rohitmishra209 Nov 18, 2019
cf5739d
Updated for region bases
rohitmishra209 Nov 20, 2019
c16b5a1
Documentation update
uttamukkoji Nov 20, 2019
4da574c
Updated the testcase
rohitmishra209 Nov 21, 2019
5edd0ee
Merge pull request #11 from contentstack/region
rohitmishra209 Nov 21, 2019
05e5420
Query check for parameters
uttamukkoji Feb 17, 2020
2fd71cf
Renamed base_query query method to addQuery
uttamukkoji Feb 18, 2020
3e861fd
Api reference generated
uttamukkoji Feb 18, 2020
6cd677d
Update LICENSE.txt
uttamukkoji Feb 21, 2020
d387dc7
Update README.md
uttamukkoji Feb 21, 2020
5716e33
Asset class Query method PHP standards
uttamukkoji Feb 27, 2020
7a1a7a5
Read me updated for delivery token example
uttamukkoji Feb 27, 2020
3031ceb
Merge branch 'master' into asset_query
rohitmishra209 Mar 4, 2020
1f6f33c
Merge pull request #12 from contentstack/asset_query
rohitmishra209 Mar 4, 2020
6832d68
Stack Tokens Moved to Headers
uttamukkoji May 8, 2020
378cebc
Merge pull request #13 from contentstack/tokenHotfix
uttamukkoji May 8, 2020
879c49f
Automation test support added
uttamukkoji Jun 8, 2020
2419808
Test Automation support added
uttamukkoji Jun 8, 2020
92b8925
Test Automation support added
uttamukkoji Jun 8, 2020
1a75bf1
Test Automation support added
uttamukkoji Jun 8, 2020
b55d057
Code coverage and PHPUnit xml file added
uttamukkoji Jun 9, 2020
23fd146
Result json
uttamukkoji Jun 30, 2020
d917471
Merge pull request #14 from contentstack/tokenHotfix
uttamukkoji Jul 1, 2020
c0111be
Change log file added
uttamukkoji Jul 14, 2020
f79386f
Merge pull request #15 from contentstack/tokenHotfix
uttamukkoji Jul 14, 2020
59c1f87
Publish content fallback implementation
uttamukkoji Oct 12, 2020
b09916f
Update composer.json
uttamukkoji Oct 26, 2020
162e739
Renamed index file
uttamukkoji Oct 27, 2020
a46abb0
Renamed index file
uttamukkoji Oct 27, 2020
37aa0cc
Merge branch 'master' of https://github.com/contentstack/contentstack…
uttamukkoji Oct 27, 2020
f34d232
test case update
uttamukkoji Oct 27, 2020
55848dd
Merge pull request #16 from contentstack/publish_fallback
uttamukkoji Dec 5, 2020
16e22be
Test case updated
uttamukkoji Dec 5, 2020
c90e686
changelog updated
uttamukkoji Dec 5, 2020
19c0811
API documentation
uttamukkoji Dec 7, 2020
b23df4a
Improving the README with php highlighting
ondrejfuhrer Jan 28, 2021
fb5336d
Merge pull request #18 from ondrejfuhrer/patch-1
uttamukkoji Jan 28, 2021
8167532
Embedded object Include function added
uttamukkoji Mar 11, 2021
e5afd49
fix(generateQuer): replace count() with isset() and remove json_enco…
mcarcangiu-ea Mar 15, 2021
2d2b17f
revert changes in generateQuery method
mcarcangiu-ea Mar 16, 2021
cf328c1
fix(addQuery) remove json_encode()
mcarcangiu-ea Mar 16, 2021
4c7c7e8
fix: remove superfluous check on array
mcarcangiu-ea Mar 16, 2021
4e5f78e
fix: :bug: BaseQuery
uttamukkoji Mar 16, 2021
82b3d19
Merge branch 'pr/20' into hotfix_addQuery
uttamukkoji Mar 16, 2021
d8f7102
Changelog update
uttamukkoji Mar 17, 2021
9ad35e5
refactor: :recycle: PSR 4 Standard
uttamukkoji Mar 22, 2021
ac70b0d
docs: :memo: Documentation Updated
uttamukkoji Mar 31, 2021
bd229d9
Merge pull request #22 from contentstack/fix/psr4
uttamukkoji Apr 2, 2021
3bef6a8
Merge branch 'master' into embeddec_items
uttamukkoji Apr 6, 2021
3c39544
Merge pull request #23 from contentstack/embedded_items
uttamukkoji Apr 6, 2021
5ac5a18
fix: :bug: Test case bug resolved
uttamukkoji Apr 6, 2021
edb5bb5
Update Download and install steps
uttamukkoji May 14, 2021
534b4a0
feat: :sparkles: Branch feature support added
uttamukkoji May 17, 2021
f23b9b6
:tada: Json RTE Feature
uttamukkoji Jul 16, 2021
bc2b5d8
Merge pull request #24 from contentstack/feature/json-rte
uttamukkoji Jul 16, 2021
bf25561
:tada: Live Preview feature support added
uttamukkoji Aug 18, 2021
f1d3ffe
Create CODEOWNERS
nandeesh-gajula Sep 9, 2021
e44c282
refactor: :recycle: include_branch function added
uttamukkoji Sep 15, 2021
ce70bda
fix: :bug: rename hash to live_preview
uttamukkoji Sep 20, 2021
bc23eb9
refactor: :recycle: Management token renamed
uttamukkoji Oct 11, 2021
4a29899
docs: :memo: Update year and change log
uttamukkoji Oct 14, 2021
dc0cdb5
Merge branch 'master' into feature/live-preview
uttamukkoji Oct 27, 2021
301719b
:memo: Update test case config
uttamukkoji Oct 27, 2021
2af15d6
update git ignore
uttamukkoji Oct 27, 2021
9aafab2
test case config update
uttamukkoji Oct 27, 2021
ded4d24
Merge branch 'feature/content-branching' into feature/live-preview
uttamukkoji Oct 27, 2021
66f6d9e
Branching feature merged
uttamukkoji Oct 27, 2021
0212d6f
Merge branch 'master' into feature/live-preview
uttamukkoji Dec 6, 2021
83ffe23
deprecated typeahead
uttamukkoji Dec 6, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ test/ImageTransformreport.html
examples/index.php
.DS_Store
tmp/
test/result.json
stdout
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@

## CHANGELOG
------------------------------------------------
## Version 2.1.0
###### Date: 29-Oct-2021
### New Feature
- Live Preview feature support added
- Content branching feature support added
------------------------------------------------

## Version 2.0.0
###### Date: 02-Apr-2021
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2012-2020 Contentstack (http://app.contentstack.com). All Rights Reserved
Copyright (c) 2012-2021 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
Expand Down
2 changes: 1 addition & 1 deletion src/Config/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @package Contentstack
* @author Uttam K Ukkoji <uttamukkoji@gmail.com>
* @author Rohit Mishra <rhtmishra4545@gmail.com>
* @copyright 2012-2020 Contentstack. All Rights Reserved
* @copyright 2012-2021 Contentstack. All Rights Reserved
* @license https://github.com/contentstack/contentstack-php/blob/master/LICENSE.txt MIT Licence
* @link https://pear.php.net/package/contentstack
* */
Expand Down
6 changes: 3 additions & 3 deletions src/Contentstack.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @package Contentstack
* @author Uttam K Ukkoji <uttamukkoji@gmail.com>
* @author Rohit Mishra <rhtmishra4545@gmail.com>
* @copyright 2012-2020 Contentstack. All Rights Reserved
* @copyright 2012-2021 Contentstack. All Rights Reserved
* @license https://github.com/contentstack/contentstack-php/blob/master/LICENSE.txt MIT Licence
* @link https://pear.php.net/package/contentstack
*/
Expand All @@ -26,7 +26,7 @@
* @package Contentstack
* @author Uttam K Ukkoji <uttamukkoji@gmail.com>
* @author Rohit Mishra <rhtmishra4545@gmail.com>
* @copyright 2012-2020 Contentstack. All Rights Reserved
* @copyright 2012-2021 Contentstack. All Rights Reserved
* @license https://github.com/contentstack/contentstack-php/blob/master/LICENSE.txt MIT Licence
* @link https://pear.php.net/package/contentstack
*/
Expand All @@ -46,7 +46,7 @@ abstract class Contentstack
public static function Stack($api_key = '',
$access_token = '',
$environment = '',
$config = array('region'=> '')
$config = array('region'=> '', 'branch'=> '', 'live_preview' => array('enable' => false, 'host' => 'api.contentstack.io'))
) {
return new Stack($api_key, $access_token, $environment, $config);
}
Expand Down
4 changes: 2 additions & 2 deletions src/ContentstackRegion.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @package Contentstack
* @author Uttam K Ukkoji <uttamukkoji@gmail.com>
* @author Rohit Mishra <rhtmishra4545@gmail.com>
* @copyright 2012-2020 Contentstack. All Rights Reserved
* @copyright 2012-2021 Contentstack. All Rights Reserved
* @license https://github.com/contentstack/contentstack-php/blob/master/LICENSE.txt MIT Licence
* @link https://pear.php.net/package/contentstack
* */
Expand All @@ -21,7 +21,7 @@
* @package Contentstack
* @author Uttam K Ukkoji <uttamukkoji@gmail.com>
* @author Rohit Mishra <rhtmishra4545@gmail.com>
* @copyright 2012-2020 Contentstack. All Rights Reserved
* @copyright 2012-2021 Contentstack. All Rights Reserved
* @license https://github.com/contentstack/contentstack-php/blob/master/LICENSE.txt MIT Licence
* @link https://pear.php.net/package/contentstack
* */
Expand Down
4 changes: 2 additions & 2 deletions src/Error/CSException.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* @package Contentstack
* @author Uttam K Ukkoji <uttamukkoji@gmail.com>
* @author Rohit Mishra <rhtmishra4545@gmail.com>
* @copyright 2012-2020 Contentstack. All Rights Reserved
* @copyright 2012-2021 Contentstack. All Rights Reserved
* @license https://github.com/contentstack/contentstack-php/blob/master/LICENSE.txt MIT Licence
* @link https://pear.php.net/package/contentstack
* */
Expand All @@ -24,7 +24,7 @@
* @package Contentstack
* @author Uttam K Ukkoji <uttamukkoji@gmail.com>
* @author Rohit Mishra <rhtmishra4545@gmail.com>
* @copyright 2012-2020 Contentstack. All Rights Reserved
* @copyright 2012-2021 Contentstack. All Rights Reserved
* @license https://github.com/contentstack/contentstack-php/blob/master/LICENSE.txt MIT Licence
* @link https://pear.php.net/package/contentstack
* */
Expand Down
4 changes: 2 additions & 2 deletions src/Stack/Assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* @package Contentstack
* @author Uttam K Ukkoji <uttamukkoji@gmail.com>
* @author Rohit Mishra <rhtmishra4545@gmail.com>
* @copyright 2012-2020 Contentstack. All Rights Reserved
* @copyright 2012-2021 Contentstack. All Rights Reserved
* @license https://github.com/contentstack/contentstack-php/blob/master/LICENSE.txt MIT Licence
* @link https://pear.php.net/package/contentstack
* */
Expand All @@ -31,7 +31,7 @@
* @package Contentstack
* @author Uttam K Ukkoji <uttamukkoji@gmail.com>
* @author Rohit Mishra <rhtmishra4545@gmail.com>
* @copyright 2012-2020 Contentstack. All Rights Reserved
* @copyright 2012-2021 Contentstack. All Rights Reserved
* @license https://github.com/contentstack/contentstack-php/blob/master/LICENSE.txt MIT Licence
* @link https://pear.php.net/package/contentstack
* */
Expand Down
22 changes: 20 additions & 2 deletions src/Stack/BaseQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* @package Contentstack
* @author Uttam K Ukkoji <uttamukkoji@gmail.com>
* @author Rohit Mishra <rhtmishra4545@gmail.com>
* @copyright 2012-2020 Contentstack. All Rights Reserved
* @copyright 2012-2021 Contentstack. All Rights Reserved
* @license https://github.com/contentstack/contentstack-php/blob/master/LICENSE.txt MIT Licence
* @link https://pear.php.net/package/contentstack
* */
Expand All @@ -27,7 +27,7 @@
* @package Contentstack
* @author Uttam K Ukkoji <uttamukkoji@gmail.com>
* @author Rohit Mishra <rhtmishra4545@gmail.com>
* @copyright 2012-2020 Contentstack. All Rights Reserved
* @copyright 2012-2021 Contentstack. All Rights Reserved
* @license https://github.com/contentstack/contentstack-php/blob/master/LICENSE.txt MIT Licence
* @link https://pear.php.net/package/contentstack
* */
Expand Down Expand Up @@ -143,6 +143,7 @@ public function includeReference($field_uids = array())
/**
* To search the given string in the entries
*
* @deprecated since verion 2.2.0
* @param $search - string to be search in entries
*
* @return Query
Expand Down Expand Up @@ -307,6 +308,23 @@ public function includeFallback()

return $this->queryObject;
}

/**
* To include branch of publish content.
*
* @return Query
*/
public function includeBranch()
{
$this->queryObject->_query = call_user_func(
'contentstackAddBoolean',
'include_branch',
$this->queryObject->_query
);

return $this->queryObject;
}

/**
* To include schema along with entries
*
Expand Down
4 changes: 2 additions & 2 deletions src/Stack/ContentType.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* @package Contentstack
* @author Uttam K Ukkoji <uttamukkoji@gmail.com>
* @author Rohit Mishra <rhtmishra4545@gmail.com>
* @copyright 2012-2020 Contentstack. All Rights Reserved
* @copyright 2012-2021 Contentstack. All Rights Reserved
* @license https://github.com/contentstack/contentstack-php/blob/master/LICENSE.txt MIT Licence
* @link https://pear.php.net/package/contentstack
* */
Expand All @@ -27,7 +27,7 @@
* @package Contentstack
* @author Uttam K Ukkoji <uttamukkoji@gmail.com>
* @author Rohit Mishra <rhtmishra4545@gmail.com>
* @copyright 2012-2020 Contentstack. All Rights Reserved
* @copyright 2012-2021 Contentstack. All Rights Reserved
* @license https://github.com/contentstack/contentstack-php/blob/master/LICENSE.txt MIT Licence
* @link https://pear.php.net/package/contentstack
* */
Expand Down
4 changes: 2 additions & 2 deletions src/Stack/ContentType/Entry.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* @package Contentstack
* @author Uttam K Ukkoji <uttamukkoji@gmail.com>
* @author Rohit Mishra <rhtmishra4545@gmail.com>
* @copyright 2012-2020 Contentstack. All Rights Reserved
* @copyright 2012-2021 Contentstack. All Rights Reserved
* @license https://github.com/contentstack/contentstack-php/blob/master/LICENSE.txt MIT Licence
* @link https://pear.php.net/package/contentstack
* */
Expand All @@ -26,7 +26,7 @@
* @package Contentstack
* @author Uttam K Ukkoji <uttamukkoji@gmail.com>
* @author Rohit Mishra <rhtmishra4545@gmail.com>
* @copyright 2012-2020 Contentstack. All Rights Reserved
* @copyright 2012-2021 Contentstack. All Rights Reserved
* @license https://github.com/contentstack/contentstack-php/blob/master/LICENSE.txt MIT Licence
* @link https://pear.php.net/package/contentstack
* */
Expand Down
4 changes: 2 additions & 2 deletions src/Stack/ContentType/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @package Contentstack
* @author Uttam K Ukkoji <uttamukkoji@gmail.com>
* @author Rohit Mishra <rhtmishra4545@gmail.com>
* @copyright 2012-2020 Contentstack. All Rights Reserved
* @copyright 2012-2021 Contentstack. All Rights Reserved
* @license https://github.com/contentstack/contentstack-php/blob/master/LICENSE.txt MIT Licence
* @link https://pear.php.net/package/contentstack
* */
Expand All @@ -25,7 +25,7 @@
* @package Contentstack
* @author Uttam K Ukkoji <uttamukkoji@gmail.com>
* @author Rohit Mishra <rhtmishra4545@gmail.com>
* @copyright 2012-2020 Contentstack. All Rights Reserved
* @copyright 2012-2021 Contentstack. All Rights Reserved
* @license https://github.com/contentstack/contentstack-php/blob/master/LICENSE.txt MIT Licence
* @link https://pear.php.net/package/contentstack
* */
Expand Down
4 changes: 2 additions & 2 deletions src/Stack/Result.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* @package Contentstack
* @author Uttam K Ukkoji <uttamukkoji@gmail.com>
* @author Rohit Mishra <rhtmishra4545@gmail.com>
* @copyright 2012-2020 Contentstack. All Rights Reserved
* @copyright 2012-2021 Contentstack. All Rights Reserved
* @license https://github.com/contentstack/contentstack-php/blob/master/LICENSE.txt MIT Licence
* @link https://pear.php.net/package/contentstack
* */
Expand All @@ -22,7 +22,7 @@
* @package Contentstack
* @author Uttam K Ukkoji <uttamukkoji@gmail.com>
* @author Rohit Mishra <rhtmishra4545@gmail.com>
* @copyright 2012-2020 Contentstack. All Rights Reserved
* @copyright 2012-2021 Contentstack. All Rights Reserved
* @license https://github.com/contentstack/contentstack-php/blob/master/LICENSE.txt MIT Licence
* @link https://pear.php.net/package/contentstack
* */
Expand Down
45 changes: 37 additions & 8 deletions src/Stack/Stack.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @package Contentstack
* @author Uttam K Ukkoji <uttamukkoji@gmail.com>
* @author Rohit Mishra <rhtmishra4545@gmail.com>
* @copyright 2012-2020 Contentstack. All Rights Reserved
* @copyright 2012-2021 Contentstack. All Rights Reserved
* @license https://github.com/contentstack/contentstack-php/blob/master/LICENSE.txt MIT Licence
* @link https://pear.php.net/package/contentstack
* */
Expand All @@ -26,7 +26,7 @@
* @package Contentstack
* @author Uttam K Ukkoji <uttamukkoji@gmail.com>
* @author Rohit Mishra <rhtmishra4545@gmail.com>
* @copyright 2012-2020 Contentstack. All Rights Reserved
* @copyright 2012-2021 Contentstack. All Rights Reserved
* @license https://github.com/contentstack/contentstack-php/blob/master/LICENSE.txt MIT Licence
* @link https://pear.php.net/package/contentstack
* */
Expand Down Expand Up @@ -55,20 +55,22 @@ public function __construct(
$api_key = '',
$delivery_token = '',
$environment = '',
$config = array('region'=> '')
$config = array('region'=> '', 'branch'=> '', 'live_preview' => array())
) {

if ($config && $config !== "undefined" && $config['region'] !== "undefined" && $config['region'] =="eu" ) {
if ($config && $config !== "undefined" && array_key_exists('region', $config) && $config['region'] !== "undefined" && $config['region'] =="eu" ) {
$this->host = $config['region'].'-cdn.contentstack.com';
}
$this->header = Utility::validateInput(
'stack', array('api_key' => $api_key,
'access_token' => $delivery_token,
'environment' => $environment,
'region' => $config['region'] ?? '')
'region' => $config['region'] ?? '',
'branch' => $config['branch'] ?? '')
);
$this->environment = $this->header['environment'];
unset($this->header['environment']);
$this->live_preview = $config['live_preview'] ?? array();
return $this;
}

Expand Down Expand Up @@ -135,7 +137,10 @@ public function ImageTrasform($url, $parameters)
}
}


public function LivePreviewQuery($parameters) {
$this->live_preview['live_preview'] = $parameters['live_preview'] ?? 'init';
$this->live_preview['content_type_uid'] = $parameters['content_type_uid'];
}

/**
* To get the last_activity information of the
Expand Down Expand Up @@ -220,7 +225,7 @@ public function getPort()
/**
* This function sets API Key.
*
* @param string $api_key - Name of Environment
* @param string $api_key - API Key
*
* @return Stack
* */
Expand All @@ -233,7 +238,7 @@ public function setAPIKEY($api_key = '')
/**
* This function sets Delivery Token.
*
* @param string $delivery_token - Name of Environment
* @param string $delivery_token - Delivery Token
*
* @return Stack
* */
Expand Down Expand Up @@ -286,6 +291,30 @@ public function getEnvironment()
return $this->environment;
}

/**
* This function sets Branch.
*
* @param string $branch - Name of branch
*
* @return Stack
* */
public function setBranch($branch = '')
{
Utility::validateInput('branch', $branch);
$this->header['branch'] = $branch;
return $this;
}

/**
* This function returns Branch.
*
* @return string
* */
public function Branch()
{
return $this->header['branch'];
}

/**
* This call returns comprehensive information of all
* the content types available in a particular stack in your account.
Expand Down
Loading