Stack

View as Markdown

Stack

Stack Class to initialize the provided parameter Stack

ContentType

To initialize the ContentType object from where the content will be fetched/retrieved.

NameTypeDescription
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

NameTypeDescription
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

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

NameTypeDescription
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

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

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

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

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

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

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

NameTypeDescription
branch (required)string

Name of branch

use Contentstack\Contentstack;


$stack = Contentstack::Stack('api_key', 'delivery_token', 'environment');

$stack->setBranch('branch');

Branch

This function returns 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.



NameTypeDescription
paramsobject

Query params for getting content-type.

use Contentstack\Contentstack;


$stack = Contentstack::Stack('api_key', 'delivery_token', 'environment');

$result = $stack->getContentTypes();

sync

Syncs your Contentstack data with your app and ensures that the data is always up-to-date by providing delta updates
NameTypeDescription
param.initboolean
initializing sync
param.localestring
initializing sync with entries of a specific locale
param.start_datestringDefault: initializing sync with entries published after a specific date
param.content_type_uidstring

initializing sync with entries of a specific content type

param.typestring

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_tokenstring

Fetching the next batch of entries using pagination token

param.sync_tokenstring

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>'})