Improve API documentation

This commit is contained in:
Francis Lachapelle
2015-04-29 22:56:04 -04:00
parent f2833a2781
commit d3916e6e5e
3 changed files with 55 additions and 8 deletions
+16 -1
View File
@@ -1,6 +1,6 @@
/* UIxParentFolderActions.m - this file is part of SOGo
*
* Copyright (C) 2007-2014 Inverse inc.
* Copyright (C) 2007-2015 Inverse inc.
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -36,6 +36,21 @@
@implementation UIxParentFolderActions
/**
* @api {post} /so/:username/:module/createFolder Create folder
* @apiVersion 1.0.0
* @apiName PostCreateFolder
* @apiGroup Common
* @apiExample {curl} Example usage:
* curl -i http://localhost/SOGo/so/sogo1/Calendar/createFolder \
* -H "Content-Type: application/json" \
* -d '{ "name": "Business" }'
*
* @apiDescription Called to create a new calendar or a new address book.
*
* @apiParam {String} name The display name of the new folder
* @apiSuccess (Success 201) {String} id Folder ID
*/
- (id <WOActionResults>) createFolderAction
{
WOResponse *response;
+22 -6
View File
@@ -1,5 +1,5 @@
/*
Copyright (C) 2006-2013 Inverse inc.
Copyright (C) 2006-2015 Inverse inc.
Copyright (C) 2004-2005 SKYRIX Software AG
This file is part of SOGo
@@ -108,17 +108,33 @@
}
/* These methods are only available on instance of SOGoWebAppointmentFolder. */
/**
* @api {get} /so/:username/Scheduler/:calendarId/reload Load Web calendar
* @apiVersion 1.0.0
* @apiName PostReloadWebCalendar
* @apiGroup Calendar
* @apiExample {curl} Example usage:
* curl -i http://localhost/SOGo/so/sogo1/Calendar/5B30-55419180-7-6B687280/reload
*
* @apiDescription Load and parse the events from a remote Web calendar (.ics)
*
* @apiSuccess (Success 200) {Number} status The HTTP code received when accessing the remote URL
* @apiSuccess (Success 200) {String} [imported] The number of imported events in case of success
* @apiError (Error 500) {String} [error] The error type in case of a failure
*/
- (WOResponse *) reloadAction
{
WOResponse *response;
NSDictionary *results;
unsigned int httpCode;
response = [self responseWithStatus: 200];
[response setHeader: @"application/json" forKey: @"content-type"];
httpCode = 200;
results = [[self clientObject] loadWebCalendar];
[response appendContentString: [results jsonRepresentation]];
return response;
if ([results objectForKey: @"error"])
httpCode = 500;
return [self responseWithStatus: httpCode andJSONRepresentation: results];
}
- (WOResponse *) setCredentialsAction
+17 -1
View File
@@ -38,6 +38,22 @@
@implementation UIxCalMainActions
/**
* @api {post} /so/:username/Scheduler/addWebCalendar Add Web calendar
* @apiVersion 1.0.0
* @apiName PostAddWebCalendar
* @apiGroup Calendar
* @apiExample {curl} Example usage:
* curl -i http://localhost/SOGo/so/sogo1/Calendar/addWebCalendar \
* -H "Content-Type: application/json" \
* -d '{ "url": "http://localhost/test.ics" }'
*
* @apiDescription Called to subscribe to a remote Web calendar (.ics)
*
* @apiParam {String} url The URL of the remote Web calendar
* @apiSuccess (Success 200) {String} id Calendar ID
* @apiSuccess (Success 200) {String} name The display name of the calendar
*/
- (WOResponse *) addWebCalendarAction
{
NSDictionary *params;
@@ -64,7 +80,7 @@
{
jsonResponse = [NSMutableDictionary dictionary];
[jsonResponse setObject: [folder displayName] forKey: @"name"];
[jsonResponse setObject: [folder name] forKey: @"id"];
[jsonResponse setObject: [folder nameInContainer] forKey: @"id"];
}
else
ex = [NSException exceptionWithName: @"newWebCalendarWithURLException"