Modification affichage

This commit is contained in:
xdrm-brackets 2016-06-03 17:29:37 +02:00
parent b0df8790cd
commit 095a550fc5
1 changed files with 51 additions and 12 deletions

View File

@ -122,33 +122,72 @@
if( count($method['permissions']) > 0) if( count($method['permissions']) > 0)
$content .= '> Permissions `'.implode('``', $method['permissions'])."`\n\n"; $content .= '> Permissions `'.implode('``', $method['permissions'])."`\n\n";
// Liste des paramètres
if( isset($method['parameters']) && count($method['parameters']) > 0 ){
// On explicite tous les paramètres
$content .= "+ Parameters\n\n";
foreach($method['parameters'] as $argName=>$argument){
$optional = isset($argument['optional']) && $argument['optional'] === true;
$content .= " + _${argName}_ (${argument['type']}, ".( $optional ? 'optional' : 'required' ).") - ${argument['description']}\n";
}
$content .= "\n";
}
/* (2) Requête */ /* (2) Requête */
$content .= "+ Request (multipart/form-data)\n\n"; $content .= "+ Request (multipart/form-data)\n\n";
// Header
$content .= " + Headers\n\n"; $content .= " + Headers\n\n";
$content.= " Authorization: Digest {yourAccessToken}\n\n"; $content.= " Authorization: Digest {yourAccessToken}\n\n";
if( isset($method['arguments'])){ if( isset($method['parameters']) && count($method['parameters']) > 0 ){
$content .= " + Attributes\n\n";
foreach($method['arguments'] as $argName=>$argument) // Body
$content .= " $argName: (${argument['type']}) - ${argument['description']}\n"; $content .= " + Body\n\n ";
$c = 0;
foreach($method['parameters'] as $argName=>$argument){
if( $c > 0 ) $content .= '&';
$content .= "$argName=_${argName}_";
$c++;
}
$content .= "\n\n";
// Schema
$content .= " + Schema\n\n";
$content .= " {\n";
foreach($method['parameters'] as $argName=>$argData)
$content .= " \"$argName\": _${argName}_\n";
$content .= " }\n\n";
} }
/* (3) Réponse */ /* (3) Réponse */
$content .= "+ Response 200 (application/json)\n\n"; $content .= "+ Response 200 (application/json)\n\n";
$content .= " + Body\n\n";
if( isset($method['output']) && count($method['output']) > 0 ){ if( isset($method['output']) && count($method['output']) > 0 ){
// Body
$content .= " + Body\n\n";
$content .= " {\n"; $content .= " {\n";
foreach($method['output'] as $outName=>$outData) foreach($method['output'] as $outName=>$outData)
$content .= " \"$outName\": @$outName\n"; $content .= " \"$outName\": @$outName\n";
$content .= " }\n\n\n"; $content .= " }\n\n";
// Schema
$content .= " + Schema\n\n";
$content .= " {\n";
foreach($method['output'] as $outName=>$outData)
$content .= " \"$outName\": @$outName\n";
$content .= " }\n\n";
// On explicite tous les paramètres
$content .= " + Attributes (object)\n\n";
foreach($method['output'] as $outName=>$outData)
$content .= " + $outName (${outData['type']}) - ${outData['description']}\n";
} }
$content .= "\n\n";
} }
} }