Changeset 25077 for trunk/ws.php


Ignore:
Timestamp:
Oct 22, 2013, 2:58:58 PM (11 years ago)
Author:
mistic100
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ws.php

    r20817 r25077  
    104104  include_once(PHPWG_ROOT_PATH.'include/ws_functions.inc.php');
    105105 
     106  $f_params = array(
     107    'f_min_rate' => array('default'=>null,
     108                          'type'=>WS_TYPE_FLOAT),
     109    'f_max_rate' => array('default'=>null,
     110                          'type'=>WS_TYPE_FLOAT),
     111    'f_min_hit' =>  array('default'=>null,
     112                          'type'=>WS_TYPE_INT|WS_TYPE_POSITIVE),
     113    'f_max_hit' =>  array('default'=>null,
     114                          'type'=>WS_TYPE_INT|WS_TYPE_POSITIVE),
     115    'f_min_ratio' => array('default'=>null,
     116                           'type'=>WS_TYPE_FLOAT|WS_TYPE_POSITIVE),
     117    'f_max_ratio' => array('default'=>null,
     118                           'type'=>WS_TYPE_FLOAT|WS_TYPE_POSITIVE),
     119    'f_max_level' => array('default'=>null,
     120                           'type'=>WS_TYPE_INT|WS_TYPE_POSITIVE),
     121    'f_min_date_available' => array('default'=>null),
     122    'f_max_date_available' => array('default'=>null),
     123    'f_min_date_created' =>   array('default'=>null),
     124    'f_max_date_created' =>   array('default'=>null),
     125    );
     126 
    106127  $service->addMethod(
    107128      'pwg.getVersion',
    108129      'ws_getVersion',
    109130      null,
    110       'retrieves the PWG version'
     131      'Returns the Piwigo version.'
    111132    );
    112133         
     
    115136      'ws_getInfos',
    116137      null,
    117       'retrieves general informations'
     138      '<b>Admin only.</b> Returns general informations.'
    118139    );
    119140
     
    122143      'ws_caddie_add',
    123144      array(
    124         'image_id'=> array('flags'=>WS_PARAM_FORCE_ARRAY),
    125         ),
    126       'adds the elements to the caddie'
     145        'image_id'=> array('flags'=>WS_PARAM_FORCE_ARRAY,
     146                           'type'=>WS_TYPE_ID),
     147        ),
     148      '<b>Admin only.</b> Adds elements to the caddie. Returns the number of elements added.'
    127149    );
    128150
     
    130152      'pwg.categories.getImages',
    131153      'ws_categories_getImages',
    132       array(
    133         'cat_id' =>     array('default'=>0,
    134                               'flags'=>WS_PARAM_FORCE_ARRAY),
    135         'recursive' =>  array('default'=>false ),
    136         'per_page' =>   array('default'=>100,
    137                               'maxValue'=>$conf['ws_max_images_per_page']),
    138         'page' =>       array('default'=>0),
    139         'order' =>      array('default'=>null),
    140         'f_min_rate' => array('default'=>null),
    141         'f_max_rate' => array('default'=>null),
    142         'f_min_hit' =>  array('default'=>null),
    143         'f_max_hit' =>  array('default'=>null),
    144         'f_min_date_available' => array('default'=>null),
    145         'f_max_date_available' => array('default'=>null),
    146         'f_min_date_created' =>   array('default'=>null),
    147         'f_max_date_created' =>   array('default'=>null),
    148         'f_min_ratio' => array('default'=>null),
    149         'f_max_ratio' => array('default'=>null),
    150         'f_max_level' => array('default'=>null),
    151         ),
     154      array_merge(array(
     155        'cat_id' =>     array('default'=>null,
     156                              'flags'=>WS_PARAM_FORCE_ARRAY,
     157                              'type'=>WS_TYPE_INT|WS_TYPE_POSITIVE),
     158        'recursive' =>  array('default'=>false,
     159                              'type'=>WS_TYPE_BOOL),
     160        'per_page' =>   array('default'=>100,
     161                              'maxValue'=>$conf['ws_max_images_per_page'],
     162                              'type'=>WS_TYPE_INT|WS_TYPE_POSITIVE),
     163        'page' =>       array('default'=>0,
     164                              'type'=>WS_TYPE_INT|WS_TYPE_POSITIVE),
     165        'order' =>      array('default'=>null,
     166                              'info'=>'id, file, name, hit, rating_score, date_creation, date_available, random'),
     167        ), $f_params),
    152168      'Returns elements for the corresponding categories.
    153 <br><b>cat_id</b> can be empty if <b>recursive</b> is true. Can be sent as an array.
    154 <br><b>order</b> comma separated fields for sorting (file,id, rating_score,...)'
     169<br><b>cat_id</b> can be empty if <b>recursive</b> is true.
     170<br><b>order</b> comma separated fields for sorting'
    155171    );
    156172
     
    159175      'ws_categories_getList',
    160176      array(
    161         'cat_id' =>       array('default'=>0),
    162         'recursive' =>    array('default'=>false),
    163         'public' =>       array('default'=>false),
    164         'tree_output' =>  array('default'=>false),
    165         'fullname' =>     array('default'=>false),
    166         ),
    167       'retrieves a list of categories (tree_output option only compatible with json/php output format'
     177        'cat_id' =>       array('default'=>null,
     178                                'type'=>WS_TYPE_INT|WS_TYPE_POSITIVE,
     179                                'info'=>'Parent category. "0" or empty for root.'),
     180        'recursive' =>    array('default'=>false,
     181                                'type'=>WS_TYPE_BOOL),
     182        'public' =>       array('default'=>false,
     183                                'type'=>WS_TYPE_BOOL),
     184        'tree_output' =>  array('default'=>false,
     185                                'type'=>WS_TYPE_BOOL),
     186        'fullname' =>     array('default'=>false,
     187                                'type'=>WS_TYPE_BOOL),
     188        ),
     189      'Returns a list of categories.'
    168190    );
    169191
     
    171193      'pwg.getMissingDerivatives',
    172194      'ws_getMissingDerivatives',
    173       array(
    174         'types' =>      array('default'=>array(),
    175                               'flags'=>WS_PARAM_FORCE_ARRAY),
    176         'ids' =>        array('default'=>array(),
    177                               'flags'=>WS_PARAM_FORCE_ARRAY),
    178         'max_urls' =>   array('default'=>200),
    179         'prev_page' =>  array('default'=>null),
    180         'f_min_rate' => array('default'=>null),
    181         'f_max_rate' => array('default'=>null),
    182         'f_min_hit' =>  array('default'=>null),
    183         'f_max_hit' =>  array('default'=>null),
    184         'f_min_date_available' => array('default'=>null),
    185         'f_max_date_available' => array('default'=>null),
    186         'f_min_date_created' =>   array('default'=>null),
    187         'f_max_date_created' =>   array('default'=>null),
    188         'f_min_ratio' => array('default'=>null),
    189         'f_max_ratio' => array('default'=>null),
    190         'f_max_level' => array('default'=>null),
    191         ),
    192       'retrieves a list of derivatives to build'
     195      array_merge(array(
     196        'types' =>        array('default'=>null,
     197                                'flags'=>WS_PARAM_FORCE_ARRAY,
     198                                'info'=>'square, thumb, 2small, xsmall, small, medium, large, xlarge, xxlarge'),
     199        'ids' =>          array('default'=>null,
     200                                'flags'=>WS_PARAM_FORCE_ARRAY,
     201                                'type'=>WS_TYPE_ID),
     202        'max_urls' =>     array('default'=>200,
     203                                'type'=>WS_TYPE_INT|WS_TYPE_POSITIVE),
     204        'prev_page' =>    array('default'=>null,
     205                                'type'=>WS_TYPE_INT|WS_TYPE_POSITIVE),
     206        ), $f_params),
     207      '<b>Admin only.</b> Returns a list of derivatives to build.'
    193208    );
    194209
     
    197212      'ws_images_addComment',
    198213      array(
    199         'image_id' => array(),
     214        'image_id' => array('type'=>WS_TYPE_ID),
    200215        'author' =>   array('default'=>is_a_guest()?'guest':$user['username']),
    201216        'content' =>  array(),
    202217        'key' =>      array(),
    203218        ),
    204       'add a comment to an image'
     219      '<b>POST only.</b> Adds a comment to an image.'
    205220    );
    206221
     
    209224      'ws_images_getInfo',
    210225      array(
    211         'image_id' =>           array(),
    212         'comments_page' =>      array('default'=>0 ),
    213         'comments_per_page' =>  array('default' =>  $conf['nb_comment_page'],
    214                                       'maxValue' => 2*$conf['nb_comment_page']),
    215         ),
    216       'retrieves information about the given photo'
     226        'image_id' =>           array('type'=>WS_TYPE_ID),
     227        'comments_page' =>      array('default'=>0,
     228                                      'type'=>WS_TYPE_INT|WS_TYPE_POSITIVE),
     229        'comments_per_page' =>  array('default'=>$conf['nb_comment_page'],
     230                                      'maxValue'=>2*$conf['nb_comment_page'],
     231                                      'type'=>WS_TYPE_INT|WS_TYPE_POSITIVE),
     232        ),
     233      'Returns information about an image.'
    217234    );
    218235
     
    220237      'pwg.images.rate',
    221238      'ws_images_rate',
    222       array('image_id', 'rate'),
    223       'rate the image'
     239      array(
     240        'image_id' => array('type'=>WS_TYPE_ID),
     241        'rate' =>     array('type'=>WS_TYPE_FLOAT),
     242      ),
     243      'Rates an image.'
    224244    );
    225245
     
    227247      'pwg.images.search',
    228248      'ws_images_search',
    229       array(
    230         'query' =>      array(),
    231         'per_page' =>   array('default'=>100,
    232                               'maxValue'=>$conf['ws_max_images_per_page']),
    233         'page' =>       array('default'=>0),
    234         'order' =>      array('default'=>null),
    235         'f_min_rate' => array('default'=>null),
    236         'f_max_rate' => array('default'=>null),
    237         'f_min_hit' =>  array('default'=>null),
    238         'f_max_hit' =>  array('default'=>null),
    239         'f_min_date_available' => array('default'=>null),
    240         'f_max_date_available' => array('default'=>null),
    241         'f_min_date_created' =>   array('default'=>null),
    242         'f_max_date_created' =>   array('default'=>null),
    243         'f_min_ratio' => array('default'=>null),
    244         'f_max_ratio' => array('default'=>null),
    245         'f_max_level' => array('default'=>null),
    246         ),
     249      array_merge(array(
     250        'query' =>        array(),
     251        'per_page' =>     array('default'=>100,
     252                                'maxValue'=>$conf['ws_max_images_per_page'],
     253                                'type'=>WS_TYPE_INT|WS_TYPE_POSITIVE),
     254        'page' =>         array('default'=>0,
     255                                'type'=>WS_TYPE_INT|WS_TYPE_POSITIVE),
     256        'order' =>        array('default'=>null,
     257                                'info'=>'id, file, name, hit, rating_score, date_creation, date_available, random'),
     258        ), $f_params),
    247259      'Returns elements for the corresponding query search.'
    248260    );
     
    252264      'ws_images_setPrivacyLevel',
    253265      array(
    254         'image_id' => array('flags'=>WS_PARAM_FORCE_ARRAY),
    255         'level' =>    array('maxValue'=>$conf['available_permission_levels']),
    256         ),
    257       'sets the privacy levels for the images (POST method only)'
     266        'image_id' => array('flags'=>WS_PARAM_FORCE_ARRAY,
     267                            'type'=>WS_TYPE_ID),
     268        'level' =>    array('maxValue'=>max($conf['available_permission_levels']),
     269                            'type'=>WS_TYPE_INT|WS_TYPE_POSITIVE),
     270        ),
     271      '<b>Admin & POST only.</b> Sets the privacy levels for the images.'
    258272    );
    259273
     
    261275      'pwg.images.setRank',
    262276      'ws_images_setRank',
    263       array('image_id', 'category_id', 'rank'),
    264       'sets the rank of a photo for a given album (POST method only, for admins)'
     277      array(
     278        'image_id'    => array('type'=>WS_TYPE_ID),
     279        'category_id' => array('type'=>WS_TYPE_ID),
     280        'rank'        => array('type'=>WS_TYPE_INT|WS_TYPE_POSITIVE|WS_TYPE_NOTNULL)
     281        ),
     282      '<b>Admin & POST only.</b> Sets the rank of a photo for a given album.'
    265283    );
    266284
     
    269287      'ws_rates_delete',
    270288      array(
    271         'user_id' =>      array(),
     289        'user_id' =>      array('type'=>WS_TYPE_ID),
    272290        'anonymous_id' => array('default'=>null),
    273291        ),
    274       'deletes all rates for a user (POST method only, admins only)'
     292      '<b>Admin & POST only.</b> Deletes all rates for a user.'
    275293    );
    276294
     
    279297      'ws_session_getStatus',
    280298      null,
    281       null
     299      'Gets information about the current session. Also provides a token useable with admin methods.'
    282300    );
    283301
     
    286304      'ws_session_login',
    287305      array('username', 'password'),
    288       'POST method only'
     306      '<b>POST only.</b> Tries to login the user.'
    289307    );
    290308
     
    293311      'ws_session_logout',
    294312      null,
    295       null
     313      'Ends the current session.'
    296314    );
    297315
     
    300318      'ws_tags_getList',
    301319      array(
    302         'sort_by_counter' => array('default' =>false),
    303         ),
    304       'retrieves a list of available tags'
     320        'sort_by_counter' => array('default'=>false,
     321                                   'type'=>WS_TYPE_BOOL),
     322        ),
     323      'Retrieves a list of available tags.'
    305324    );
    306325
     
    308327      'pwg.tags.getImages',
    309328      'ws_tags_getImages',
    310       array(
     329      array_merge(array(
    311330        'tag_id' =>       array('default'=>null,
    312                                 'flags'=>WS_PARAM_FORCE_ARRAY),
     331                                'flags'=>WS_PARAM_FORCE_ARRAY,
     332                                'type'=>WS_TYPE_ID),
    313333        'tag_url_name' => array('default'=>null,
    314334                                'flags'=>WS_PARAM_FORCE_ARRAY),
    315335        'tag_name' =>     array('default'=>null,
    316336                                'flags'=>WS_PARAM_FORCE_ARRAY),
    317         'tag_mode_and' => array('default'=>false),
     337        'tag_mode_and' => array('default'=>false,
     338                                'type'=>WS_TYPE_BOOL),
    318339        'per_page' =>     array('default'=>100,
    319                                 'maxValue'=>$conf['ws_max_images_per_page']),
    320         'page' =>         array('default'=>0),
    321         'order' =>        array('default'=>null),
    322         'f_min_rate' =>   array('default'=>null),
    323         'f_max_rate' =>   array('default'=>null),
    324         'f_min_hit' =>    array('default'=>null),
    325         'f_max_hit' =>    array('default'=>null),
    326         'f_min_date_available' => array('default'=>null),
    327         'f_max_date_available' => array('default'=>null),
    328         'f_min_date_created' =>   array('default'=>null),
    329         'f_max_date_created' =>   array('default'=>null),
    330         'f_min_ratio' => array('default'=>null),
    331         'f_max_ratio' => array('default'=>null),
    332         'f_max_level' => array('default'=>null),
    333         ),
    334       'Returns elements for the corresponding tags. Note that tag_id, tag_url_name, tag_name an be arrays. Fill at least one of them. '
     340                                'maxValue'=>$conf['ws_max_images_per_page'],
     341                                'type'=>WS_TYPE_INT|WS_TYPE_POSITIVE),
     342        'page' =>         array('default'=>0,
     343                                'type'=>WS_TYPE_INT|WS_TYPE_POSITIVE),
     344        'order' =>        array('default'=>null,
     345                                'info'=>'id, file, name, hit, rating_score, date_creation, date_available, random'),
     346        ), $f_params),
     347      'Returns elements for the corresponding tags. Fill at least tag_id, tag_url_name or tag_name.'
    335348    );
    336349
     
    338351      'pwg.images.addChunk',
    339352      'ws_images_add_chunk',
    340       array('data', 'original_sum', 'type', 'position'),
    341       'POST method only. For admin only.'
     353      array(
     354        'data' =>         array(),
     355        'original_sum' => array(),
     356        'type' =>         array('default'=>'file',
     357                                'info'=>'Must be "file", for backward compatiblity "high" and "thumb" are allowed.'),
     358        'position' =>     array()
     359        ),
     360      '<b>Admin & POST only.</b> Add a chunk of a file.'
    342361    );
    343362
     
    345364      'pwg.images.addFile',
    346365      'ws_images_addFile',
    347       array('image_id', 'type', 'sum'),
    348       'Add or update a file for an existing photo. pwg.images.addChunk must have been called  before (maybe several times)'
     366      array(
     367        'image_id' => array('type'=>WS_TYPE_ID),
     368        'type' =>     array('default'=>'file',
     369                            'info'=>'Must be "file", for backward compatiblity "high" and "thumb" are allowed.'),
     370        'sum' =>      array(),
     371        ),
     372      '<b>Admin only.</b> Add or update a file for an existing photo.
     373<br>pwg.images.addChunk must have been called before (maybe several times).'
    349374    );
    350375
     
    354379      'ws_images_add',
    355380      array(
    356         'file_sum' =>           array(),
    357381        'thumbnail_sum' =>      array('default'=>null),
    358382        'high_sum' =>           array('default'=>null),
    359383        'original_sum' =>       array(),
    360         'original_filename' =>  array('default'=>null),
     384        'original_filename' =>  array('default'=>null,
     385                                      'Provide it if "check_uniqueness" is true and $conf["uniqueness_mode"] is "filename".'),
    361386        'name' =>               array('default'=>null),
    362387        'author' =>             array('default'=>null),
    363388        'date_creation' =>      array('default'=>null),
    364389        'comment' =>            array('default'=>null),
    365         'categories' =>         array('default'=>null),
    366         'tag_ids' =>            array('default'=>null),
     390        'categories' =>         array('default'=>null,
     391                                      'info'=>'String list "category_id[,rank];category_id[,rank]".<br>The rank is optional and is equivalent to "auto" if not given.'),
     392        'tag_ids' =>            array('default'=>null,
     393                                      'info'=>'Comma separated ids'),
    367394        'level' =>              array('default'=>0,
    368                                       'maxValue'=>$conf['available_permission_levels']),
    369         'check_uniqueness' =>   array('default'=>true),
    370         'image_id' =>           array('default'=>null),
    371         ),
    372       'POST method only.
    373 <br><b>categories</b> is a string list "category_id[,rank];category_id[,rank]"
    374 The rank is optional and is equivalent to "auto" if not given.'
     395                                      'maxValue'=>max($conf['available_permission_levels']),
     396                                      'type'=>WS_TYPE_INT|WS_TYPE_POSITIVE),
     397        'check_uniqueness' =>   array('default'=>true,
     398                                      'type'=>WS_TYPE_BOOL),
     399        'image_id' =>           array('default'=>null,
     400                                      'type'=>WS_TYPE_ID),
     401        ),
     402      '<b>Admin only.</b> Add an image.
     403<br>pwg.images.addChunk must have been called before (maybe several times).
     404<br>Don\'t use "thumbnail_sum" and "high_sum", these parameters are here for backward compatibility.'
    375405    );
    376406
     
    379409      'ws_images_addSimple',
    380410      array(
    381         'category' => array('default'=>null),
     411        'category' => array('default'=>null,
     412                            'flags'=>WS_PARAM_FORCE_ARRAY,
     413                            'type'=>WS_TYPE_ID),
    382414        'name' =>     array('default'=>null),
    383415        'author' =>   array('default'=>null),
    384416        'comment' =>  array('default'=>null),
    385417        'level' =>    array('default'=>0,
    386                             'maxValue'=>$conf['available_permission_levels']),
     418                            'maxValue'=>max($conf['available_permission_levels']),
     419                            'type'=>WS_TYPE_INT|WS_TYPE_POSITIVE),
    387420        'tags' =>     array('default'=>null,
    388421                            'flags'=>WS_PARAM_ACCEPT_ARRAY),
    389         'image_id' => array('default'=>null),
    390         ),
    391       'POST method only.<br>Use the <b>image</b> field for uploading file.
    392 <br>Set the form encoding to "form-data"<br><b>category</b> is the numeric identifier of the destination category.
     422        'image_id' => array('default'=>null,
     423                            'type'=>WS_TYPE_ID),
     424        ),
     425      '<b>Admin & POST only.</b> Add an image.
     426<br>Use the <b>$_FILES[image]</b> field for uploading file.
     427<br>Set the form encoding to "form-data".
    393428<br>You can update an existing photo if you define an existing image_id.'
    394429    );
     
    398433      'ws_images_delete',
    399434      array(
    400         'image_id' =>   array('default'=>0),
     435        'image_id' =>   array('flags'=>WS_PARAM_ACCEPT_ARRAY),
    401436        'pwg_token' =>  array(),
    402437        ),
    403       'Delete photos. You can give several image_ids, comma separated'
     438      '<b>Admin & POST only.</b> Deletes image(s).'
    404439    );
    405440
     
    408443      'ws_categories_getAdminList',
    409444      null,
    410       'administration method only'
     445      '<b>Admin only.</b>'
    411446    );
    412447
     
    416451      array(
    417452        'name' =>         array(),
    418         'parent' =>       array('default'=>null),
     453        'parent' =>       array('default'=>null,
     454                                'type'=>WS_TYPE_ID),
    419455        'comment' =>      array('default'=>null),
    420         'visible' =>      array('default'=>null),
    421         'status' =>       array('default'=>null),
    422         'commentable' =>  array('default'=>'true'),
    423         ),
    424       'administration method only'
     456        'visible' =>      array('default'=>true,
     457                                'type'=>WS_TYPE_BOOL),
     458        'status' =>       array('default'=>null,
     459                                'info'=>'public, private'),
     460        'commentable' =>  array('default'=>true,
     461                                'type'=>WS_TYPE_BOOL),
     462        ),
     463      '<b>Admin only.</b> Adds an album.'
    425464    );
    426465
     
    429468      'ws_categories_delete',
    430469      array(
    431         'category_id'=>           array('default'=>0),
     470        'category_id'=>           array('flags'=>WS_PARAM_ACCEPT_ARRAY),
     471        'photo_deletion_mode' =>  array('default'=>'delete_orphans'),
    432472        'pwg_token' =>            array(),
    433         'photo_deletion_mode' =>  array('default'=>'delete_orphans'),
    434         ),
    435       'Delete categories. You can give several category_ids, comma separated.
     473        ),
     474      '<b>Admin & POST only.</b> Deletes album(s).
    436475<br><b>photo_deletion_mode</b> can be "no_delete" (may create orphan photos), "delete_orphans"
    437476(default mode, only deletes photos linked to no other album) or "force_delete" (delete all photos, even those linked to other albums)'
     
    442481      'ws_categories_move',
    443482      array(
    444         'category_id' =>  array('default'=>0),
    445         'parent' =>       array('default'=>0),
     483        'category_id' =>  array('flags'=>WS_PARAM_ACCEPT_ARRAY),
     484        'parent' =>       array('type'=>WS_TYPE_INT|WS_TYPE_POSITIVE),
    446485        'pwg_token' =>    array(),
    447486        ),
    448       '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.'
     487      '<b>Admin & POST only.</b> Move album(s).
     488<br>Set parent as 0 to move to gallery root. Only virtual categories can be moved.'
    449489    );
    450490
     
    453493      'ws_categories_setRepresentative',
    454494      array(
    455         'category_id' =>  array('default'=>0),
    456         'image_id' =>     array('default'=>0),
    457         ),
    458       'Set the representative photo for an album. The photo doesn\'t have to belong to the album. POST method only. Administration method only.'
     495        'category_id' =>  array('type'=>WS_TYPE_ID),
     496        'image_id' =>     array('type'=>WS_TYPE_ID),
     497        ),
     498      '<b>Admin & POST only.</b> Sets the representative photo for an album. The photo doesn\'t have to belong to the album.'
    459499    );
    460500
     
    463503      'ws_tags_getAdminList',
    464504      null,
    465       'administration method only'
    466     );
    467 
    468   $service->addMethod(
     505      '<b>Admin only.</b> '
     506    );
     507
     508  $service->addMethod( // TODO: create multiple tags
    469509      'pwg.tags.add',
    470510      'ws_tags_add',
    471511      array('name'),
    472       'administration method only'
     512      '<b>Admin only.</b> Adds a new tag.'
    473513    );
    474514
     
    480520        'filename_list' =>  array('default'=>null),
    481521        ),
    482       'check existence of a photo list'
     522      '<b>Admin only.</b>  Checks existence of images.
     523<br>Give <b>md5sum_list</b> if $conf[uniqueness_mode]==md5sum. Give <b>filename_list</b> if $conf[uniqueness_mode]==filename.'
    483524    );
    484525
     
    487528      'ws_images_checkFiles',
    488529      array(
    489         'image_id' =>       array(),
     530        'image_id' =>       array('type'=>WS_TYPE_ID),
     531        'file_sum' =>       array('default'=>null),
    490532        'thumbnail_sum' =>  array('default'=>null),
    491         'file_sum' =>       array('default'=>null),
    492533        'high_sum' =>       array('default'=>null),
    493534        ),
    494       '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"'
     535      '<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".
     536<br>Don\'t use "thumbnail_sum" and "high_sum", these parameters are here for backward compatibility.'
    495537    );
    496538
     
    499541      'ws_images_checkUpload',
    500542      null,
    501       'check if Piwigo is ready for upload'
     543      '<b>Admin only.</b> Checks if Piwigo is ready for upload.'
    502544    );
    503545
     
    506548      'ws_images_setInfo',
    507549      array(
    508         'image_id' =>       array(),
     550        'image_id' =>       array('type'=>WS_TYPE_ID),
    509551        'file' =>           array('default'=>null),
    510552        'name' =>           array('default'=>null),
     
    512554        'date_creation' =>  array('default'=>null),
    513555        'comment' =>        array('default'=>null),
    514         'categories' =>     array('default'=>null),
    515         'tag_ids' =>        array('default'=>null),
     556        'categories' =>     array('default'=>null,
     557                                  'info'=>'String list "category_id[,rank];category_id[,rank]".<br>The rank is optional and is equivalent to "auto" if not given.'),
     558        'tag_ids' =>        array('default'=>null,
     559                                  'info'=>'Comma separated ids'),
    516560        'level' =>          array('default'=>null,
    517                                   'maxValue'=>$conf['available_permission_levels']),
     561                                  'maxValue'=>max($conf['available_permission_levels']),
     562                                  'type'=>WS_TYPE_INT|WS_TYPE_POSITIVE),
    518563        'single_value_mode' =>    array('default'=>'fill_if_empty'),
    519564        'multiple_value_mode' =>  array('default'=>'append'),
    520565        ),
    521       'POST method only. Admin only
    522 <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.
     566      '<b>Admin & POST only.</b> Changes properties of an image.
    523567<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"
    524 (overwrite any existing value) and applies to single values properties like name/author/date_creation/comment
    525 <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'
     568(overwrite any existing value) and applies to single values properties like name/author/date_creation/comment.
     569<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.'
    526570    );
    527571
     
    530574      'ws_categories_setInfo',
    531575      array(
    532         'category_id' =>  array(),
     576        'category_id' =>  array('type'=>WS_TYPE_ID),
    533577        'name' =>         array('default'=>null),
    534578        'comment' =>      array('default'=>null),
    535579        ),
    536       'POST method only.'
     580      '<b>Admin & POST only.</b> Changes properties of an album.'
    537581    );
    538582 
     
    541585      'ws_plugins_getList',
    542586      null,
    543       'Admin only
    544 <br>get the list of plugin with id, name, version, state and description'
     587      '<b>Admin only.</b> Gets the list of plugins with id, name, version, state and description.'
    545588    );
    546589
     
    548591      'pwg.plugins.performAction',
    549592      'ws_plugins_performAction',
    550       array('action', 'plugin', 'pwg_token'),
    551       'Admin only
    552 <br>install/activate/deactivate/uninstall/delete a plugin'
     593      array(
     594        'action'    => array('info'=>'install, activate, deactivate, uninstall, delete'),
     595        'plugin'    => array(),
     596        'pwg_token' => array(),
     597        ),
     598      '<b>Admin only.</b>'
    553599    );
    554600
     
    556602      'pwg.themes.performAction',
    557603      'ws_themes_performAction',
    558       array('action', 'theme', 'pwg_token'),
    559       'activate/deactivate/delete/set_default a theme<br>administration status required'
     604      array(
     605        'action'    => array('info'=>'activate, deactivate, delete, set_default'),
     606        'theme'     => array(),
     607        'pwg_token' => array(),
     608        ),
     609      '<b>Admin only.</b>'
    560610    );
    561611
     
    563613      'pwg.extensions.update',
    564614      'ws_extensions_update',
    565       array('type', 'id', 'revision', 'pwg_token'),
    566       'Update an extension. Webmaster only.
    567 <br>Parameter type must be "plugins", "languages" or "themes".'
     615      array(
     616        'type' => array('info'=>'plugins, languages, themes'),
     617        'id' => array(),
     618        'revision' => array(),
     619        'pwg_token' => array(),
     620        ),
     621      '<b>Webmaster only.</b>'
    568622  );
    569623
     
    572626      'ws_extensions_ignoreupdate',
    573627      array(
    574         'type' =>       array('default'=>null),
     628        'type' =>       array('default'=>null,
     629                              'info'=>'plugins, languages, themes'),
    575630        'id' =>         array('default'=>null),
    576         'reset' =>      array('default'=>null),
     631        'reset' =>      array('default'=>false,
     632                              'type'=>WS_TYPE_BOOL,
     633                              'info'=>'If true, all ignored extensions will be reinitilized.'),
    577634        'pwg_token' =>  array(),
    578635      ),
    579       'Ignore an extension if it need update.
    580 <br>Parameter type must be "plugins", "languages" or "themes".
    581 <br>If reset parameter is true, all ignored extensions will be reinitilized.'
     636      '<b>Webmaster only.</b> Ignores an extension if it needs update.'
    582637  );
    583638
     
    586641      'ws_extensions_checkupdates',
    587642      null,
    588       'Check if piwigo or extensions are up to date.'
     643      '<b>Admin only.</b> Checks if piwigo or extensions are up to date.'
    589644  );
    590645}
Note: See TracChangeset for help on using the changeset viewer.