Stack
Stack
Stack Class to initialize the provided parameter Stack
ContentType
To initialize the ContentType object from where the content will be fetched/retrieved.
| Name | Type | Description |
|---|---|---|
| content_type_uid (required) | string | Valid content type uid relevant to configured stack |
use Contentstack\Contentstack;
$stack = Contentstack::Stack('api_key', 'delivery_token', 'environment');
$content_type = $stack->ContentType('content_type_uid');use Contentstack\Contentstack;
$stack = Contentstack::Stack('api_key', 'delivery_token', 'environment');
$content_types = $stack->ContentType();Assets
Assets Class to initalize your Assets
| Name | Type | Description |
|---|---|---|
| asset_uid (required) | string | valid asset uid relevent to configured stack |
use Contentstack\Contentstack;
$stack = Contentstack::Stack('api_key', 'delivery_token', 'environment');
$assets = $stack->Assets('asset_uid');use Contentstack\Contentstack;
$stack = Contentstack::Stack('api_key', 'delivery_token', 'environment');
$assets = $stack->Assets();ImageTrasform
ImageTrasform function is define for image manipulation with different
| Name | Type | Description |
|---|---|---|
| url (required) | string | Image url on which we want to manipulate. |
| parameters (required) | object | It is an second parameter in which we want to place different manipulation key and value in array form |
use Contentstack\Contentstack;
$stack = Contentstack::Stack('api_key', 'delivery_token', 'environment');
$result_url = $stack->ImageTrasform('url', array('quality' => 100));LivePreviewQuery
To set live preview token and content type uid.
| Name | Type | Description |
|---|---|---|
| parameters (required) | object | Set live preview token and content type uid. |
use Contentstack\Contentstack;
$stack = Contentstack::Stack('api_key', 'delivery_token', 'environment');
$stack->LivePreviewQuery(array('live_preview'=> 'token', 'content_type_uid'=? 'content_type_uid', 'entry_uid'=> 'entry_uid'));getLastActivities
To get the last_activity information of the configured environment from all the content types.
use Contentstack\Contentstack;
$stack = Contentstack::Stack('api_key', 'delivery_token', 'environment');
$result = $stack->getLastActivities();setHost
To set the host on stack object
| Name | Type | Description |
|---|---|---|
| host (required) | string | Host name/ipaddress from where the content to be fetched |
use Contentstack\Contentstack;
$stack = Contentstack::Stack('api_key', 'delivery_token', 'environment');
$stack->setHost('host');getHost
This function returns host.
use Contentstack\Contentstack;
$stack = Contentstack::Stack('api_key', 'delivery_token', 'environment');
$host = $stack->getHost();setProtocol
This function sets protocol.
| Name | Type | Description |
|---|---|---|
| protocol (required) | string | Protocol type |
use Contentstack\Contentstack;
$stack = Contentstack::Stack('api_key', 'delivery_token', 'environment');
$stack->setProtocol('protocol');getProtocol
This function return protocol type.
use Contentstack\Contentstack;
$stack = Contentstack::Stack('api_key', 'delivery_token', 'environment');
$protocol = $stack->getProtocol();setPort
This function sets Port.
| Name | Type | Description |
|---|---|---|
| port (required) | string | Port Number |
use Contentstack\Contentstack;
$stack = Contentstack::Stack('api_key', 'delivery_token', 'environment');
$stack->setPort('port');getPort
This function return Port.
use Contentstack\Contentstack;
$stack = Contentstack::Stack('api_key', 'delivery_token', 'environment');
$port = $stack->getPort();setAPIKEY
This function sets API Key.
| Name | Type | Description |
|---|---|---|
| api_key (required) | string | Stack API key |
use Contentstack\Contentstack;
$stack = Contentstack::Stack('api_key', 'delivery_token', 'environment');
$stack->setAPIKEY('api_key');getAPIKEY
This function returns API Key.
use Contentstack\Contentstack;
$stack = Contentstack::Stack('api_key', 'delivery_token', 'environment');
$api_key = $stack->getAPIKEY();setDeliveryToken
This function sets Delivery Token.
| Name | Type | Description |
|---|---|---|
| delivery_token (required) | string | Environment specific delivery token |
use Contentstack\Contentstack;
$stack = Contentstack::Stack('api_key', 'delivery_token', 'environment');
$stack->setDeliveryToken('delivery_token');DeliveryToken
This function returns Delivery Token.
use Contentstack\Contentstack;
$stack = Contentstack::Stack('api_key', 'delivery_token', 'environment');
$token = $stack->DeliveryToken();setEnvironment
This function sets environment name.
| Name | Type | Description |
|---|---|---|
| environment (required) | string | Name of Environment |
use Contentstack\Contentstack;
$stack = Contentstack::Stack('api_key', 'delivery_token', 'environment');
$stack->setEnvironment('environment');getEnvironment
This function returns environment name.
use Contentstack\Contentstack;
$stack = Contentstack::Stack('api_key', 'delivery_token', 'environment');
$environment = $stack->getEnvironment();setBranch
This function sets Branch.
| Name | Type | Description |
|---|---|---|
| branch (required) | string | Name of branch |
use Contentstack\Contentstack;
$stack = Contentstack::Stack('api_key', 'delivery_token', 'environment');
$stack->setBranch('branch');Branch
use Contentstack\Contentstack;
$stack = Contentstack::Stack('api_key', 'delivery_token', 'environment');
$branch = $stack->Branch();getContentTypes
This call returns comprehensive information of all the content types available in a particular stack in your account.
| Name | Type | Description |
|---|---|---|
| params | object | Query params for getting content-type. |
use Contentstack\Contentstack;
$stack = Contentstack::Stack('api_key', 'delivery_token', 'environment');
$result = $stack->getContentTypes();sync
| Name | Type | Description |
|---|---|---|
| param.init | boolean | initializing sync |
| param.locale | string | initializing sync with entries of a specific locale |
| param.start_date | string | Default: initializing sync with entries published after a specific date |
| param.content_type_uid | string | initializing sync with entries of a specific content type |
| param.type | string | Use the type parameter to get a specific type of content.Supports 'asset_published', 'entry_published', 'asset_unpublished', 'entry_unpublished', 'asset_deleted', 'entry_deleted', 'content_type_deleted' |
| param.pagination_token | string | Fetching the next batch of entries using pagination token |
| param.sync_token | string | Performing subsequent sync after initial sync |
For initializing sync:
use Contentstack\Contentstack;
$stack = Contentstack::Stack('api_key', 'delivery_token', 'environment');
$result = $stack->sync({'init'=> true});For initializing sync with entries of a specific locale:
use Contentstack\Contentstack;
$stack = Contentstack::Stack('api_key', 'delivery_token', 'environment');
$result = $stack->sync({'init'=> true, 'locale'=> 'en-us'});For initializing sync with entries published after a specific date:
use Contentstack\Contentstack;
$stack = Contentstack::Stack('api_key', 'delivery_token', 'environment');
$result = $stack->sync({'init'=> true, 'start_date'=> '2018-10-22'});For initializing sync with entries of a specific content type:
use Contentstack\Contentstack;
$stack = Contentstack::Stack('api_key', 'delivery_token', 'environment');
$result = $stack->sync({'init'=> true, 'content_type_uid'=> 'session'});For initializing sync with specific type:
use Contentstack\Contentstack;
$stack = Contentstack::Stack('api_key', 'delivery_token', 'environment');
$result = $stack->sync({'init'=> true, 'type'=> 'entry_published'});For fetching the next batch of entries using pagination token:
use Contentstack\Contentstack;
$stack = Contentstack::Stack('api_key', 'delivery_token', 'environment');
$result = $stack->sync({'pagination_token'=> '<page_token>'});For performing subsequent sync after initial sync:
use Contentstack\Contentstack;
$stack = Contentstack::Stack('api_key', 'delivery_token', 'environment');
$result = $stack->sync({'sync_token'=> '<sync_token>'})