diff options
author | mistic100 <mistic@piwigo.org> | 2013-10-22 12:58:58 +0000 |
---|---|---|
committer | mistic100 <mistic@piwigo.org> | 2013-10-22 12:58:58 +0000 |
commit | 24b977d8775e70e15b60cbd5143e84f4c08d4e23 (patch) | |
tree | 586d34b971897e705b9803abf6ad4a9686f22e8f /ws.php | |
parent | 677fe6f8881e43b009c8a2babb0565b6ba1620df (diff) |
feature:2982 API: add high-level type check
introduces some constants fro bool, int, float, positive and notnull parameters
types are tested in PwgServer::invoke and no in each method
+ some optimizations + update methods descriptions
git-svn-id: http://piwigo.org/svn/trunk@25077 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'ws.php')
-rw-r--r-- | ws.php | 417 |
1 files changed, 236 insertions, 181 deletions
@@ -103,147 +103,159 @@ function ws_addDefaultMethods( $arr ) include_once(PHPWG_ROOT_PATH.'include/ws_functions.inc.php'); + $f_params = array( + 'f_min_rate' => array('default'=>null, + 'type'=>WS_TYPE_FLOAT), + 'f_max_rate' => array('default'=>null, + 'type'=>WS_TYPE_FLOAT), + 'f_min_hit' => array('default'=>null, + 'type'=>WS_TYPE_INT|WS_TYPE_POSITIVE), + 'f_max_hit' => array('default'=>null, + 'type'=>WS_TYPE_INT|WS_TYPE_POSITIVE), + 'f_min_ratio' => array('default'=>null, + 'type'=>WS_TYPE_FLOAT|WS_TYPE_POSITIVE), + 'f_max_ratio' => array('default'=>null, + 'type'=>WS_TYPE_FLOAT|WS_TYPE_POSITIVE), + 'f_max_level' => array('default'=>null, + 'type'=>WS_TYPE_INT|WS_TYPE_POSITIVE), + 'f_min_date_available' => array('default'=>null), + 'f_max_date_available' => array('default'=>null), + 'f_min_date_created' => array('default'=>null), + 'f_max_date_created' => array('default'=>null), + ); + $service->addMethod( 'pwg.getVersion', 'ws_getVersion', null, - 'retrieves the PWG version' + 'Returns the Piwigo version.' ); $service->addMethod( 'pwg.getInfos', 'ws_getInfos', null, - 'retrieves general informations' + '<b>Admin only.</b> Returns general informations.' ); $service->addMethod( 'pwg.caddie.add', 'ws_caddie_add', array( - 'image_id'=> array('flags'=>WS_PARAM_FORCE_ARRAY), + 'image_id'=> array('flags'=>WS_PARAM_FORCE_ARRAY, + 'type'=>WS_TYPE_ID), ), - 'adds the elements to the caddie' + '<b>Admin only.</b> Adds elements to the caddie. Returns the number of elements added.' ); $service->addMethod( 'pwg.categories.getImages', 'ws_categories_getImages', - array( - 'cat_id' => array('default'=>0, - 'flags'=>WS_PARAM_FORCE_ARRAY), - 'recursive' => array('default'=>false ), - 'per_page' => array('default'=>100, - 'maxValue'=>$conf['ws_max_images_per_page']), - 'page' => array('default'=>0), - 'order' => array('default'=>null), - 'f_min_rate' => array('default'=>null), - 'f_max_rate' => array('default'=>null), - 'f_min_hit' => array('default'=>null), - 'f_max_hit' => array('default'=>null), - 'f_min_date_available' => array('default'=>null), - 'f_max_date_available' => array('default'=>null), - 'f_min_date_created' => array('default'=>null), - 'f_max_date_created' => array('default'=>null), - 'f_min_ratio' => array('default'=>null), - 'f_max_ratio' => array('default'=>null), - 'f_max_level' => array('default'=>null), - ), + array_merge(array( + 'cat_id' => array('default'=>null, + 'flags'=>WS_PARAM_FORCE_ARRAY, + 'type'=>WS_TYPE_INT|WS_TYPE_POSITIVE), + 'recursive' => array('default'=>false, + 'type'=>WS_TYPE_BOOL), + 'per_page' => array('default'=>100, + 'maxValue'=>$conf['ws_max_images_per_page'], + 'type'=>WS_TYPE_INT|WS_TYPE_POSITIVE), + 'page' => array('default'=>0, + 'type'=>WS_TYPE_INT|WS_TYPE_POSITIVE), + 'order' => array('default'=>null, + 'info'=>'id, file, name, hit, rating_score, date_creation, date_available, random'), + ), $f_params), 'Returns elements for the corresponding categories. -<br><b>cat_id</b> can be empty if <b>recursive</b> is true. Can be sent as an array. -<br><b>order</b> comma separated fields for sorting (file,id, rating_score,...)' +<br><b>cat_id</b> can be empty if <b>recursive</b> is true. +<br><b>order</b> comma separated fields for sorting' ); $service->addMethod( 'pwg.categories.getList', 'ws_categories_getList', array( - 'cat_id' => array('default'=>0), - 'recursive' => array('default'=>false), - 'public' => array('default'=>false), - 'tree_output' => array('default'=>false), - 'fullname' => array('default'=>false), + 'cat_id' => array('default'=>null, + 'type'=>WS_TYPE_INT|WS_TYPE_POSITIVE, + 'info'=>'Parent category. "0" or empty for root.'), + 'recursive' => array('default'=>false, + 'type'=>WS_TYPE_BOOL), + 'public' => array('default'=>false, + 'type'=>WS_TYPE_BOOL), + 'tree_output' => array('default'=>false, + 'type'=>WS_TYPE_BOOL), + 'fullname' => array('default'=>false, + 'type'=>WS_TYPE_BOOL), ), - 'retrieves a list of categories (tree_output option only compatible with json/php output format' + 'Returns a list of categories.' ); $service->addMethod( 'pwg.getMissingDerivatives', 'ws_getMissingDerivatives', - array( - 'types' => array('default'=>array(), - 'flags'=>WS_PARAM_FORCE_ARRAY), - 'ids' => array('default'=>array(), - 'flags'=>WS_PARAM_FORCE_ARRAY), - 'max_urls' => array('default'=>200), - 'prev_page' => array('default'=>null), - 'f_min_rate' => array('default'=>null), - 'f_max_rate' => array('default'=>null), - 'f_min_hit' => array('default'=>null), - 'f_max_hit' => array('default'=>null), - 'f_min_date_available' => array('default'=>null), - 'f_max_date_available' => array('default'=>null), - 'f_min_date_created' => array('default'=>null), - 'f_max_date_created' => array('default'=>null), - 'f_min_ratio' => array('default'=>null), - 'f_max_ratio' => array('default'=>null), - 'f_max_level' => array('default'=>null), - ), - 'retrieves a list of derivatives to build' + array_merge(array( + 'types' => array('default'=>null, + 'flags'=>WS_PARAM_FORCE_ARRAY, + 'info'=>'square, thumb, 2small, xsmall, small, medium, large, xlarge, xxlarge'), + 'ids' => array('default'=>null, + 'flags'=>WS_PARAM_FORCE_ARRAY, + 'type'=>WS_TYPE_ID), + 'max_urls' => array('default'=>200, + 'type'=>WS_TYPE_INT|WS_TYPE_POSITIVE), + 'prev_page' => array('default'=>null, + 'type'=>WS_TYPE_INT|WS_TYPE_POSITIVE), + ), $f_params), + '<b>Admin only.</b> Returns a list of derivatives to build.' ); $service->addMethod( 'pwg.images.addComment', 'ws_images_addComment', array( - 'image_id' => array(), + 'image_id' => array('type'=>WS_TYPE_ID), 'author' => array('default'=>is_a_guest()?'guest':$user['username']), 'content' => array(), 'key' => array(), ), - 'add a comment to an image' + '<b>POST only.</b> Adds a comment to an image.' ); $service->addMethod( 'pwg.images.getInfo', 'ws_images_getInfo', array( - 'image_id' => array(), - 'comments_page' => array('default'=>0 ), - 'comments_per_page' => array('default' => $conf['nb_comment_page'], - 'maxValue' => 2*$conf['nb_comment_page']), + 'image_id' => array('type'=>WS_TYPE_ID), + 'comments_page' => array('default'=>0, + 'type'=>WS_TYPE_INT|WS_TYPE_POSITIVE), + 'comments_per_page' => array('default'=>$conf['nb_comment_page'], + 'maxValue'=>2*$conf['nb_comment_page'], + 'type'=>WS_TYPE_INT|WS_TYPE_POSITIVE), ), - 'retrieves information about the given photo' + 'Returns information about an image.' ); $service->addMethod( 'pwg.images.rate', 'ws_images_rate', - array('image_id', 'rate'), - 'rate the image' + array( + 'image_id' => array('type'=>WS_TYPE_ID), + 'rate' => array('type'=>WS_TYPE_FLOAT), + ), + 'Rates an image.' ); $service->addMethod( 'pwg.images.search', 'ws_images_search', - array( - 'query' => array(), - 'per_page' => array('default'=>100, - 'maxValue'=>$conf['ws_max_images_per_page']), - 'page' => array('default'=>0), - 'order' => array('default'=>null), - 'f_min_rate' => array('default'=>null), - 'f_max_rate' => array('default'=>null), - 'f_min_hit' => array('default'=>null), - 'f_max_hit' => array('default'=>null), - 'f_min_date_available' => array('default'=>null), - 'f_max_date_available' => array('default'=>null), - 'f_min_date_created' => array('default'=>null), - 'f_max_date_created' => array('default'=>null), - 'f_min_ratio' => array('default'=>null), - 'f_max_ratio' => array('default'=>null), - 'f_max_level' => array('default'=>null), - ), + array_merge(array( + 'query' => array(), + 'per_page' => array('default'=>100, + 'maxValue'=>$conf['ws_max_images_per_page'], + 'type'=>WS_TYPE_INT|WS_TYPE_POSITIVE), + 'page' => array('default'=>0, + 'type'=>WS_TYPE_INT|WS_TYPE_POSITIVE), + 'order' => array('default'=>null, + 'info'=>'id, file, name, hit, rating_score, date_creation, date_available, random'), + ), $f_params), 'Returns elements for the corresponding query search.' ); @@ -251,101 +263,114 @@ function ws_addDefaultMethods( $arr ) 'pwg.images.setPrivacyLevel', 'ws_images_setPrivacyLevel', array( - 'image_id' => array('flags'=>WS_PARAM_FORCE_ARRAY), - 'level' => array('maxValue'=>$conf['available_permission_levels']), + 'image_id' => array('flags'=>WS_PARAM_FORCE_ARRAY, + 'type'=>WS_TYPE_ID), + 'level' => array('maxValue'=>max($conf['available_permission_levels']), + 'type'=>WS_TYPE_INT|WS_TYPE_POSITIVE), ), - 'sets the privacy levels for the images (POST method only)' + '<b>Admin & POST only.</b> Sets the privacy levels for the images.' ); $service->addMethod( 'pwg.images.setRank', 'ws_images_setRank', - array('image_id', 'category_id', 'rank'), - 'sets the rank of a photo for a given album (POST method only, for admins)' + array( + 'image_id' => array('type'=>WS_TYPE_ID), + 'category_id' => array('type'=>WS_TYPE_ID), + 'rank' => array('type'=>WS_TYPE_INT|WS_TYPE_POSITIVE|WS_TYPE_NOTNULL) + ), + '<b>Admin & POST only.</b> Sets the rank of a photo for a given album.' ); $service->addMethod( 'pwg.rates.delete', 'ws_rates_delete', array( - 'user_id' => array(), + 'user_id' => array('type'=>WS_TYPE_ID), 'anonymous_id' => array('default'=>null), ), - 'deletes all rates for a user (POST method only, admins only)' + '<b>Admin & POST only.</b> Deletes all rates for a user.' ); $service->addMethod( 'pwg.session.getStatus', 'ws_session_getStatus', null, - null + 'Gets information about the current session. Also provides a token useable with admin methods.' ); $service->addMethod( 'pwg.session.login', 'ws_session_login', array('username', 'password'), - 'POST method only' + '<b>POST only.</b> Tries to login the user.' ); $service->addMethod( 'pwg.session.logout', 'ws_session_logout', null, - null + 'Ends the current session.' ); $service->addMethod( 'pwg.tags.getList', 'ws_tags_getList', array( - 'sort_by_counter' => array('default' =>false), + 'sort_by_counter' => array('default'=>false, + 'type'=>WS_TYPE_BOOL), ), - 'retrieves a list of available tags' + 'Retrieves a list of available tags.' ); $service->addMethod( 'pwg.tags.getImages', 'ws_tags_getImages', - array( + array_merge(array( 'tag_id' => array('default'=>null, - 'flags'=>WS_PARAM_FORCE_ARRAY), + 'flags'=>WS_PARAM_FORCE_ARRAY, + 'type'=>WS_TYPE_ID), 'tag_url_name' => array('default'=>null, 'flags'=>WS_PARAM_FORCE_ARRAY), 'tag_name' => array('default'=>null, 'flags'=>WS_PARAM_FORCE_ARRAY), - 'tag_mode_and' => array('default'=>false), + 'tag_mode_and' => array('default'=>false, + 'type'=>WS_TYPE_BOOL), 'per_page' => array('default'=>100, - 'maxValue'=>$conf['ws_max_images_per_page']), - 'page' => array('default'=>0), - 'order' => array('default'=>null), - 'f_min_rate' => array('default'=>null), - 'f_max_rate' => array('default'=>null), - 'f_min_hit' => array('default'=>null), - 'f_max_hit' => array('default'=>null), - 'f_min_date_available' => array('default'=>null), - 'f_max_date_available' => array('default'=>null), - 'f_min_date_created' => array('default'=>null), - 'f_max_date_created' => array('default'=>null), - 'f_min_ratio' => array('default'=>null), - 'f_max_ratio' => array('default'=>null), - 'f_max_level' => array('default'=>null), - ), - 'Returns elements for the corresponding tags. Note that tag_id, tag_url_name, tag_name an be arrays. Fill at least one of them. ' + 'maxValue'=>$conf['ws_max_images_per_page'], + 'type'=>WS_TYPE_INT|WS_TYPE_POSITIVE), + 'page' => array('default'=>0, + 'type'=>WS_TYPE_INT|WS_TYPE_POSITIVE), + 'order' => array('default'=>null, + 'info'=>'id, file, name, hit, rating_score, date_creation, date_available, random'), + ), $f_params), + 'Returns elements for the corresponding tags. Fill at least tag_id, tag_url_name or tag_name.' ); $service->addMethod( 'pwg.images.addChunk', 'ws_images_add_chunk', - array('data', 'original_sum', 'type', 'position'), - 'POST method only. For admin only.' + array( + 'data' => array(), + 'original_sum' => array(), + 'type' => array('default'=>'file', + 'info'=>'Must be "file", for backward compatiblity "high" and "thumb" are allowed.'), + 'position' => array() + ), + '<b>Admin & POST only.</b> Add a chunk of a file.' ); $service->addMethod( 'pwg.images.addFile', 'ws_images_addFile', - array('image_id', 'type', 'sum'), - 'Add or update a file for an existing photo. pwg.images.addChunk must have been called before (maybe several times)' + array( + 'image_id' => array('type'=>WS_TYPE_ID), + 'type' => array('default'=>'file', + 'info'=>'Must be "file", for backward compatiblity "high" and "thumb" are allowed.'), + 'sum' => array(), + ), + '<b>Admin only.</b> Add or update a file for an existing photo. +<br>pwg.images.addChunk must have been called before (maybe several times).' ); @@ -353,43 +378,53 @@ function ws_addDefaultMethods( $arr ) 'pwg.images.add', 'ws_images_add', array( - 'file_sum' => array(), 'thumbnail_sum' => array('default'=>null), 'high_sum' => array('default'=>null), 'original_sum' => array(), - 'original_filename' => array('default'=>null), + 'original_filename' => array('default'=>null, + 'Provide it if "check_uniqueness" is true and $conf["uniqueness_mode"] is "filename".'), 'name' => array('default'=>null), 'author' => array('default'=>null), 'date_creation' => array('default'=>null), 'comment' => array('default'=>null), - 'categories' => array('default'=>null), - 'tag_ids' => array('default'=>null), + 'categories' => array('default'=>null, + 'info'=>'String list "category_id[,rank];category_id[,rank]".<br>The rank is optional and is equivalent to "auto" if not given.'), + 'tag_ids' => array('default'=>null, + 'info'=>'Comma separated ids'), 'level' => array('default'=>0, - 'maxValue'=>$conf['available_permission_levels']), - 'check_uniqueness' => array('default'=>true), - 'image_id' => array('default'=>null), + 'maxValue'=>max($conf['available_permission_levels']), + 'type'=>WS_TYPE_INT|WS_TYPE_POSITIVE), + 'check_uniqueness' => array('default'=>true, + 'type'=>WS_TYPE_BOOL), + 'image_id' => array('default'=>null, + 'type'=>WS_TYPE_ID), ), - 'POST method only. -<br><b>categories</b> is a string list "category_id[,rank];category_id[,rank]" -The rank is optional and is equivalent to "auto" if not given.' + '<b>Admin only.</b> Add an image. +<br>pwg.images.addChunk must have been called before (maybe several times). +<br>Don\'t use "thumbnail_sum" and "high_sum", these parameters are here for backward compatibility.' ); $service->addMethod( 'pwg.images.addSimple', 'ws_images_addSimple', array( - 'category' => array('default'=>null), + 'category' => array('default'=>null, + 'flags'=>WS_PARAM_FORCE_ARRAY, + 'type'=>WS_TYPE_ID), 'name' => array('default'=>null), 'author' => array('default'=>null), 'comment' => array('default'=>null), 'level' => array('default'=>0, - 'maxValue'=>$conf['available_permission_levels']), + 'maxValue'=>max($conf['available_permission_levels']), + 'type'=>WS_TYPE_INT|WS_TYPE_POSITIVE), 'tags' => array('default'=>null, 'flags'=>WS_PARAM_ACCEPT_ARRAY), - 'image_id' => array('default'=>null), + 'image_id' => array('default'=>null, + 'type'=>WS_TYPE_ID), ), - 'POST method only.<br>Use the <b>image</b> field for uploading file. -<br>Set the form encoding to "form-data"<br><b>category</b> is the numeric identifier of the destination category. + '<b>Admin & POST only.</b> Add an image. +<br>Use the <b>$_FILES[image]</b> field for uploading file. +<br>Set the form encoding to "form-data". <br>You can update an existing photo if you define an existing image_id.' ); @@ -397,17 +432,17 @@ The rank is optional and is equivalent to "auto" if not given.' 'pwg.images.delete', 'ws_images_delete', array( - 'image_id' => array('default'=>0), + 'image_id' => array('flags'=>WS_PARAM_ACCEPT_ARRAY), 'pwg_token' => array(), ), - 'Delete photos. You can give several image_ids, comma separated' + '<b>Admin & POST only.</b> Deletes image(s).' ); $service->addMethod( 'pwg.categories.getAdminList', 'ws_categories_getAdminList', null, - 'administration method only' + '<b>Admin only.</b>' ); $service->addMethod( @@ -415,24 +450,28 @@ The rank is optional and is equivalent to "auto" if not given.' 'ws_categories_add', array( 'name' => array(), - 'parent' => array('default'=>null), + 'parent' => array('default'=>null, + 'type'=>WS_TYPE_ID), 'comment' => array('default'=>null), - 'visible' => array('default'=>null), - 'status' => array('default'=>null), - 'commentable' => array('default'=>'true'), + 'visible' => array('default'=>true, + 'type'=>WS_TYPE_BOOL), + 'status' => array('default'=>null, + 'info'=>'public, private'), + 'commentable' => array('default'=>true, + 'type'=>WS_TYPE_BOOL), ), - 'administration method only' + '<b>Admin only.</b> Adds an album.' ); $service->addMethod( 'pwg.categories.delete', 'ws_categories_delete', array( - 'category_id'=> array('default'=>0), - 'pwg_token' => array(), + 'category_id'=> array('flags'=>WS_PARAM_ACCEPT_ARRAY), 'photo_deletion_mode' => array('default'=>'delete_orphans'), + 'pwg_token' => array(), ), - 'Delete categories. You can give several category_ids, comma separated. + '<b>Admin & POST only.</b> Deletes album(s). <br><b>photo_deletion_mode</b> can be "no_delete" (may create orphan photos), "delete_orphans" (default mode, only deletes photos linked to no other album) or "force_delete" (delete all photos, even those linked to other albums)' ); @@ -441,35 +480,36 @@ The rank is optional and is equivalent to "auto" if not given.' 'pwg.categories.move', 'ws_categories_move', array( - 'category_id' => array('default'=>0), - 'parent' => array('default'=>0), + 'category_id' => array('flags'=>WS_PARAM_ACCEPT_ARRAY), + 'parent' => array('type'=>WS_TYPE_INT|WS_TYPE_POSITIVE), 'pwg_token' => array(), ), - 'Move categories. You can give several category_ids, comma separated. Set parent as 0 to move to gallery root. Only virtual categories can be moved.' + '<b>Admin & POST only.</b> Move album(s). +<br>Set parent as 0 to move to gallery root. Only virtual categories can be moved.' ); $service->addMethod( 'pwg.categories.setRepresentative', 'ws_categories_setRepresentative', array( - 'category_id' => array('default'=>0), - 'image_id' => array('default'=>0), + 'category_id' => array('type'=>WS_TYPE_ID), + 'image_id' => array('type'=>WS_TYPE_ID), ), - 'Set the representative photo for an album. The photo doesn\'t have to belong to the album. POST method only. Administration method only.' + '<b>Admin & POST only.</b> Sets the representative photo for an album. The photo doesn\'t have to belong to the album.' ); $service->addMethod( 'pwg.tags.getAdminList', 'ws_tags_getAdminList', null, - 'administration method only' + '<b>Admin only.</b> ' ); - $service->addMethod( + $service->addMethod( // TODO: create multiple tags 'pwg.tags.add', 'ws_tags_add', array('name'), - 'administration method only' + '<b>Admin only.</b> Adds a new tag.' ); $service->addMethod( @@ -479,114 +519,129 @@ The rank is optional and is equivalent to "auto" if not given.' 'md5sum_list' => array('default'=>null), 'filename_list' => array('default'=>null), ), - 'check existence of a photo list' + '<b>Admin only.</b> Checks existence of images. +<br>Give <b>md5sum_list</b> if $conf[uniqueness_mode]==md5sum. Give <b>filename_list</b> if $conf[uniqueness_mode]==filename.' ); $service->addMethod( 'pwg.images.checkFiles', 'ws_images_checkFiles', array( - 'image_id' => array(), - 'thumbnail_sum' => array('default'=>null), + 'image_id' => array('type'=>WS_TYPE_ID), 'file_sum' => array('default'=>null), + 'thumbnail_sum' => array('default'=>null), 'high_sum' => array('default'=>null), ), - 'check if you have updated version of your files for a given photo, for each requested file type, the answer can be "missing", "equals" or "differs"' + '<b>Admin only.</b> Checks if you have updated version of your files for a given photo, the answer can be "missing", "equals" or "differs". +<br>Don\'t use "thumbnail_sum" and "high_sum", these parameters are here for backward compatibility.' ); $service->addMethod( 'pwg.images.checkUpload', 'ws_images_checkUpload', null, - 'check if Piwigo is ready for upload' + '<b>Admin only.</b> Checks if Piwigo is ready for upload.' ); $service->addMethod( 'pwg.images.setInfo', 'ws_images_setInfo', array( - 'image_id' => array(), + 'image_id' => array('type'=>WS_TYPE_ID), 'file' => array('default'=>null), 'name' => array('default'=>null), 'author' => array('default'=>null), 'date_creation' => array('default'=>null), 'comment' => array('default'=>null), - 'categories' => array('default'=>null), - 'tag_ids' => array('default'=>null), + 'categories' => array('default'=>null, + 'info'=>'String list "category_id[,rank];category_id[,rank]".<br>The rank is optional and is equivalent to "auto" if not given.'), + 'tag_ids' => array('default'=>null, + 'info'=>'Comma separated ids'), 'level' => array('default'=>null, - 'maxValue'=>$conf['available_permission_levels']), + 'maxValue'=>max($conf['available_permission_levels']), + 'type'=>WS_TYPE_INT|WS_TYPE_POSITIVE), 'single_value_mode' => array('default'=>'fill_if_empty'), 'multiple_value_mode' => array('default'=>'append'), ), - 'POST method only. Admin only -<br><b>categories</b> is a string list "category_id[,rank];category_id[,rank]" The rank is optional and is equivalent to "auto" if not given. + '<b>Admin & POST only.</b> Changes properties of an image. <br><b>single_value_mode</b> can be "fill_if_empty" (only use the input value if the corresponding values is currently empty) or "replace" -(overwrite any existing value) and applies to single values properties like name/author/date_creation/comment -<br><b>multiple_value_mode</b> can be "append" (no change on existing values, add the new values) or "replace" and applies to multiple values properties like tag_ids/categories' +(overwrite any existing value) and applies to single values properties like name/author/date_creation/comment. +<br><b>multiple_value_mode</b> can be "append" (no change on existing values, add the new values) or "replace" and applies to multiple values properties like tag_ids/categories.' ); $service->addMethod( 'pwg.categories.setInfo', 'ws_categories_setInfo', array( - 'category_id' => array(), + 'category_id' => array('type'=>WS_TYPE_ID), 'name' => array('default'=>null), 'comment' => array('default'=>null), ), - 'POST method only.' + '<b>Admin & POST only.</b> Changes properties of an album.' ); $service->addMethod( 'pwg.plugins.getList', 'ws_plugins_getList', null, - 'Admin only -<br>get the list of plugin with id, name, version, state and description' + '<b>Admin only.</b> Gets the list of plugins with id, name, version, state and description.' ); $service->addMethod( 'pwg.plugins.performAction', 'ws_plugins_performAction', - array('action', 'plugin', 'pwg_token'), - 'Admin only -<br>install/activate/deactivate/uninstall/delete a plugin' + array( + 'action' => array('info'=>'install, activate, deactivate, uninstall, delete'), + 'plugin' => array(), + 'pwg_token' => array(), + ), + '<b>Admin only.</b>' ); $service->addMethod( 'pwg.themes.performAction', 'ws_themes_performAction', - array('action', 'theme', 'pwg_token'), - 'activate/deactivate/delete/set_default a theme<br>administration status required' + array( + 'action' => array('info'=>'activate, deactivate, delete, set_default'), + 'theme' => array(), + 'pwg_token' => array(), + ), + '<b>Admin only.</b>' ); $service->addMethod( 'pwg.extensions.update', 'ws_extensions_update', - array('type', 'id', 'revision', 'pwg_token'), - 'Update an extension. Webmaster only. -<br>Parameter type must be "plugins", "languages" or "themes".' + array( + 'type' => array('info'=>'plugins, languages, themes'), + 'id' => array(), + 'revision' => array(), + 'pwg_token' => array(), + ), + '<b>Webmaster only.</b>' ); $service->addMethod( 'pwg.extensions.ignoreUpdate', 'ws_extensions_ignoreupdate', array( - 'type' => array('default'=>null), + 'type' => array('default'=>null, + 'info'=>'plugins, languages, themes'), 'id' => array('default'=>null), - 'reset' => array('default'=>null), + 'reset' => array('default'=>false, + 'type'=>WS_TYPE_BOOL, + 'info'=>'If true, all ignored extensions will be reinitilized.'), 'pwg_token' => array(), ), - 'Ignore an extension if it need update. -<br>Parameter type must be "plugins", "languages" or "themes". -<br>If reset parameter is true, all ignored extensions will be reinitilized.' + '<b>Webmaster only.</b> Ignores an extension if it needs update.' ); $service->addMethod( 'pwg.extensions.checkUpdates', 'ws_extensions_checkupdates', null, - 'Check if piwigo or extensions are up to date.' + '<b>Admin only.</b> Checks if piwigo or extensions are up to date.' ); } -?> +?>
\ No newline at end of file |