CollectionItem

CollectionItem

CollectionItem class

Constructor

new CollectionItem(options)

Create a new CollectionItem object

Source:
Parameters:
Name Type Description
options Object

Options to create this CollectionItem

Name Type Description
collection Object

Collection for this CollectionItem

name String

Name for this CollectionItem

path String

Path for this CollectionItem

Methods

contentBase64(paramsopt) → {String}

Transform this CollectionItem into base64 content (to be sent to github)

Source:
Parameters:
Name Type Attributes Description
params Object <optional>

Additional params (sent to github)

Returns:
Type:
String
  • Returns base64 encoded string of Jekyll style file content

defaults(paramsopt) → {Promise.<Object>}

Get defaults (current fields & body) for this collection item

Source:
Parameters:
Name Type Attributes Description
params Object <optional>

Additional params (sent to github)

Returns:
Type:
Promise.<Object>
  • Returns promise with defaults

defaultsKey(key, paramsopt) → {Promise.<(Object|String)>}

Get specific default key for this collection item

Source:
Parameters:
Name Type Attributes Description
key String

Key for default to get (fields or body)

params Object <optional>

Additional params (sent to github)

Returns:
Type:
Promise.<(Object|String)>
  • Returns promise with requested default key data

delete(paramsopt) → {Promise.<CollectionItem>}

Delete this CollectionItem

Source:
Parameters:
Name Type Attributes Description
params Object <optional>

Additional params (sent to github)

Returns:
Type:
Promise.<CollectionItem>
  • Returns promise with itself

init(paramsopt) → {Promise.<CollectionItem>}

Initialize this collection item Load fields and content and save to itself

Source:
Parameters:
Name Type Attributes Description
params Object <optional>

Additional params (sent to github)

Returns:
Type:
Promise.<CollectionItem>
  • Returns promise with itself

reload(paramsopt) → {Promise.<CollectionItem>}

Reload this collection item (update attributes & sha)

Source:
Parameters:
Name Type Attributes Description
params Object <optional>

Additional params (sent to github)

Returns:
Type:
Promise.<CollectionItem>
  • Returns promise with itself

rename(name, paramsopt) → {Promise.<CollectionItem>}

Rename this CollectionItem

Source:
Parameters:
Name Type Attributes Description
name String

New name for this item

params Object <optional>

Additional params (sent to github)

Returns:
Type:
Promise.<CollectionItem>
  • Returns promise with itself

save(paramsopt) → {Promise.<CollectionItem>}

Save this CollectionItem

Source:
Parameters:
Name Type Attributes Description
params Object <optional>

Additional params (sent to github)

Returns:
Type:
Promise.<CollectionItem>
  • Returns promise with itself