Bric::SOAP::Media(3)

NAME
Bric::SOAP::Media - SOAP interface to Bricolage media.

VERSION
$LastChangedRevision$

DATE
$LastChangedDate: 2008-01-25 01:09:39 +0100 (Fri, 25 Jan 2008) $

SYNOPSIS
  use SOAP::Lite;
  import SOAP::Data 'name';

  # setup soap object to login with
  my $soap = new SOAP::Lite
    uri      => 'http://bricolage.sourceforge.net/Bric/SOAP/Auth',
    readable => DEBUG;
  $soap->proxy('http://localhost/soap',
               cookie_jar => HTTP::Cookies->new(ignore_discard => 1));
  # login
  $soap->login(name(username => USER),
               name(password => PASSWORD));

  # set uri for Media module
  $soap->uri('http://bricolage.sourceforge.net/Bric/SOAP/Media');

  # get a list of media_ids for all Illustrations (a Media Type)
  my $media_ids = $soap->list_ids(name(element => 'Illustration'));

DESCRIPTION
This module provides a SOAP interface to manipulating Bricolage media.

INTERFACE

  Public Class Methods

list_ids
    This method queries the database for matching media and returns a list of ids. If no media is found an empty list will be returned.

    This method can accept the following named parameters to specify the search. Some fields support matching and are marked with an (M). The value for these fields will be interpreted as an SQL match expression and will be matched case-insensitively. Other fields must specify an exact string to match. Match fields combine to narrow the search results (via ANDs in an SQL WHERE clause).

    title (M)
        The media title.

    description (M)
        The media description.

    uri (M)
        The media uri.

    file_name (M)
        The name of the file inside the media object.

    simple (M)
        A single OR search that hits title, description and uri.

    category
        The category containing the media, given as the complete category path from the root. Example: "/news/linux".

    workflow
        The name of the workflow containing the media. (ex. Media)

    priority
        The priority of the media object.

    element
        The name of the top-level element for the media. Also know as the "Media Type". This value corresponds to the element attribute on the media element in the asset schema.

    site
        The name of the site which the story is in.

    publish_date_start
        Lower bound on publishing date. Given in XML Schema dateTime format (CCYY-MM-DDThh:mm:ssTZ).

    publish_date_end
        Upper bound on publishing date. Given in XML Schema dateTime format (CCYY-MM-DDThh:mm:ssTZ).

    first_publish_date_start
        Lower bound on the first date a media document was published. Given in XML Schema dateTime format (CCYY-MM-DDThh:mm:ssTZ).

    first_publish_date_end
        Upper bound on the first date a media document was published. Given in XML Schema dateTime format (CCYY-MM-DDThh:mm:ssTZ).

    cover_date_start
        Lower bound on cover date. Given in XML Schema dateTime format (CCYY-MM-DDThh:mm:ssTZ).

    cover_date_end
        Upper bound on cover date. Given in XML Schema dateTime format (CCYY-MM-DDThh:mm:ssTZ).

    expire_date_start
        Lower bound on cover date. Given in XML Schema dateTime format (CCYY-MM-DDThh:mm:ssTZ).

    expire_date_end
        Upper bound on cover date. Given in XML Schema dateTime format (CCYY-MM-DDThh:mm:ssTZ).

    element_key_name (M)
        The key name of the top-level element for the media document. This is more accurate than the "element" parameter, since there can be multiple elements with the same name.

    unexpired
        Set to a true value to get a list of only unexpired stories.

    subelement_key_name (M)
        The key name for a container element that's a subelement of a media document.

    data_text (M)
        Text stored in the fields of the media document element or any of its subelements. Only fields that use the "short" storage type will be searched.

    output_channel
        The name of an ouput channel that stories must be associated with.

    keyword (M)
        A keyword associated with a media document.

    contrib_id
        A Bricolage contributor object ID. Only stories associated with that contributor will have their IDs listed.

    Throws:

    Exception::AP

    Side Effects: NONE

    Notes: In addition to the parameters listed above, you can use most of the parameters listed in the documentation for the list method in Bric::Biz::Asset::Business::Media.

export
    The export method retrieves a set of media from the database, serializes them and returns them as a single XML document. See Bric::SOAP for the schema of the returned document.

    Accepted paramters are:

    media_id
        Specifies a single media_id to be retrieved.

    media_ids
        Specifies a list of media_ids. The value for this option should be an array of interger "media_id" elements.

    Throws:

    Exception::AP

    Side Effects: NONE

    Notes: Bric::SOAP::Media->export doesn't provide equivalents to the export_related_stories and export_related_media options in Bric::SOAP::Story->export. Related media and related stories will always be returned with absolute id references. If you're... creative... enough to be using related media and stories in your Media types then you'll have to manually fetch the relations.

create
    The create method creates new objects using the data contained in an XML document of the format created by export().

    Returns a list of new ids created in the order of the assets in the document.

    Available options:

    document (required)
        The XML document containing objects to be created. The document must contain at least one media object.

    workflow
        Specifies the initial workflow the story is to be created in

    desk
        Specifies the initial desk the story is to be created on

    Throws:

    Exception::AP

    Side Effects: NONE

    Notes: The setting for publish_status in the incoming media is ignored and always 0 for new media.

    New stories are put in the first "media workflow" unless you pass in the --workflow option. The start desk of the workflow is used unless you pass the --desk option.

update
    The update method updates media using the data in an XML document of the format created by export(). A common use of update() is to export() a selected media object, make changes to one or more fields and then submit the changes with update().

    Returns a list of new ids created in the order of the assets in the document.

    Takes the following options:

    document (required)
        The XML document where the objects to be updated can be found. The document must contain at least one media and may contain any number of related media objects.

    update_ids (required)
        A list of "media_id" integers for the assets to be updated. These must match id attributes on media elements in the document. If you include objects in the document that are not listed in update_ids then they will be treated as in create(). For that reason an update() with an empty update_ids list is equivalent to a create().

    workflow
        Specifies the workflow to move the media to

    desk
        Specifies the desk to move the media to

    Throws:

    Exception::AP

    Side Effects: NONE

    NNotes: The setting for publish_status for new media is ignored and always 0 for new stories. Updated media do get their publish_status set from the incoming document.

delete
    The delete() method deletes media. It takes the following options:

    media_id
        Specifies a single media_id to be deleted.

    media_ids
        Specifies a list of media_ids to delete.

    Throws:

    Exception::AP

    Side Effects: NONE

    Notes: NONE

$self->module
    Returns the module name, that is the first argument passed to bric_soap.

is_allowed_param
$pkg->is_allowed_param($param, $method)
    Returns true if $param is an allowed parameter to the $method method.

  Private Class Methods

$pkg->load_asset($args)
    This method provides the meat of both create() and update(). The only difference between the two methods is that update_ids will be empty on create().

$pkg->serialize_asset(writer => $writer, media_id => $media_id, args => $args)
    Serializes a single media object into a <media> element using the given writer and args.

AUTHOR
Sam Tregar <stregar@about-inc.com>

SEE ALSO
Bric::SOAP