Packages

Storymarket supports grouping of collected content into packages (which can have their own pricing and rights schemes).

Packages (managed via Storymarket.packages) are fairly similar to other content types (see Content APIs). The difference is that packages have a set of content “inside” the packages, so when uploading packages you’ll need to provide that data. Like all related objects, you can provide related data as either instances of the appropriate content object or as IDs. For example:

>>> api = storymarket.Storymarket(STORYMARKET_API_KEY)

# Grab a few objects to create a package with.
>>> text1 = api.text.get(123)
>>> text2 = api.text.get(456)
>>> vid1 = api.text.get(444)

# Make the package.
>>> api.packages.create({
...     'title': 'My Content Package',
...     'tags': ['hi'],
...     'org': api.orgs.all()[0],
...     'category': api.categories.get(123),
...     'text_items': [text1, text2, 789],
...     'video_items': [vid1],
...     'audio_items': [111, 222]
... })

As you can see, each type has its own key in the creation dict – audio_items, data_items, text_items, photo_items, or video_items – and each item in those lists can be an int or an instance.

Reference

Detailed reference for the package classes follow:

class storymarket.PackageManager(api)
all()

Get a list of all content resources of this type.

Return type:A list of instances of appropriate ContentResource subclasses (e.g. Audio, Video, etc.)
get(resource)

Get a single content resource of this type.

Parameters:resource – The resource instance or its ID.
Return type:An instance of an appropriate ContentResource subclass (e.g. Audio, Video, etc.)
create(data)

Create a new resource of this type.

Parameters:data – The data for the object to create. This could be an instance of the resource class, or a dictionary of simplified data.
Return type:The created resource class.
update(resource, data=None)

Update an existing resource.

Parameters:
  • resource – The resource instance or its ID.
  • data – The data to use for updating. This could be an instance of the resource class, or a dictionary of simplified data, or None to use the data from the resource instance itself.
Return type:

None

class storymarket.Package(manager, info)
audio_items

List of Audio items in this package.

author
category
data_items

List of Data items in this package.

description
expire_date
fact_checked
one_off_author
photo_items

List of Photo items in this package.

pricing_scheme
rights_scheme
tags
text_items

List of Text items in this package.

title
uploaded_by
video_items

List of Video items in this package.

save()

Save changes to this resource by PUTing it back to the server.

Table Of Contents

Previous topic

Content APIs

This Page