summaryrefslogtreecommitdiff
path: root/res/res_ari_recordings.c
diff options
context:
space:
mode:
authorDavid M. Lee <dlee@digium.com>2013-08-02 14:36:32 +0000
committerDavid M. Lee <dlee@digium.com>2013-08-02 14:36:32 +0000
commit537ecebd2dc27120144498598f32dec97db6808d (patch)
treea3815f8c3f9cc7e2443d8cebc31a7b1d109aa81d /res/res_ari_recordings.c
parent10c91bc96eafbf5f897869ede83127c9c267981c (diff)
ARI - implement allowMultiple for parameters
Swagger allows parameters to be specified as 'allowMultiple', meaning that the parameter may be specified as a comma separated list of values. I had written some of the API docs using that, but promptly forgot about implementing it. This patch finally fills in that gap. The codegen template was updated to represent 'allowMultiple' fields as array/size fields in the _args structs. It also parses the comma separated list using ast_app_separate_args(), so quoted strings in the argument will be handled properly. Review: https://reviewboard.asterisk.org/r/2698/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@396122 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/res_ari_recordings.c')
-rw-r--r--res/res_ari_recordings.c85
1 files changed, 56 insertions, 29 deletions
diff --git a/res/res_ari_recordings.c b/res/res_ari_recordings.c
index a63f37b18..01ad49a65 100644
--- a/res/res_ari_recordings.c
+++ b/res/res_ari_recordings.c
@@ -41,6 +41,7 @@
ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+#include "asterisk/app.h"
#include "asterisk/module.h"
#include "asterisk/stasis_app.h"
#include "ari/resource_recordings.h"
@@ -48,6 +49,8 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "ari/ari_model_validators.h"
#endif
+#define MAX_VALS 128
+
/*!
* \brief Parameter parsing callback for /recordings/stored.
* \param get_params GET parameters in the HTTP request.
@@ -59,12 +62,12 @@ static void ast_ari_get_stored_recordings_cb(
struct ast_variable *get_params, struct ast_variable *path_vars,
struct ast_variable *headers, struct ast_ari_response *response)
{
+ struct ast_get_stored_recordings_args args = {};
#if defined(AST_DEVMODE)
int is_valid;
int code;
#endif /* AST_DEVMODE */
- struct ast_get_stored_recordings_args args = {};
ast_ari_get_stored_recordings(headers, &args, response);
#if defined(AST_DEVMODE)
code = response->response_code;
@@ -93,6 +96,9 @@ static void ast_ari_get_stored_recordings_cb(
"Internal Server Error", "Response validation failed");
}
#endif /* AST_DEVMODE */
+
+fin: __attribute__((unused))
+ return;
}
/*!
* \brief Parameter parsing callback for /recordings/stored/{recordingName}.
@@ -105,14 +111,13 @@ static void ast_ari_get_stored_recording_cb(
struct ast_variable *get_params, struct ast_variable *path_vars,
struct ast_variable *headers, struct ast_ari_response *response)
{
+ struct ast_get_stored_recording_args args = {};
+ struct ast_variable *i;
#if defined(AST_DEVMODE)
int is_valid;
int code;
#endif /* AST_DEVMODE */
- struct ast_get_stored_recording_args args = {};
- struct ast_variable *i;
-
for (i = path_vars; i; i = i->next) {
if (strcmp(i->name, "recordingName") == 0) {
args.recording_name = (i->value);
@@ -147,6 +152,9 @@ static void ast_ari_get_stored_recording_cb(
"Internal Server Error", "Response validation failed");
}
#endif /* AST_DEVMODE */
+
+fin: __attribute__((unused))
+ return;
}
/*!
* \brief Parameter parsing callback for /recordings/stored/{recordingName}.
@@ -159,14 +167,13 @@ static void ast_ari_delete_stored_recording_cb(
struct ast_variable *get_params, struct ast_variable *path_vars,
struct ast_variable *headers, struct ast_ari_response *response)
{
+ struct ast_delete_stored_recording_args args = {};
+ struct ast_variable *i;
#if defined(AST_DEVMODE)
int is_valid;
int code;
#endif /* AST_DEVMODE */
- struct ast_delete_stored_recording_args args = {};
- struct ast_variable *i;
-
for (i = path_vars; i; i = i->next) {
if (strcmp(i->name, "recordingName") == 0) {
args.recording_name = (i->value);
@@ -201,6 +208,9 @@ static void ast_ari_delete_stored_recording_cb(
"Internal Server Error", "Response validation failed");
}
#endif /* AST_DEVMODE */
+
+fin: __attribute__((unused))
+ return;
}
/*!
* \brief Parameter parsing callback for /recordings/live.
@@ -213,12 +223,12 @@ static void ast_ari_get_live_recordings_cb(
struct ast_variable *get_params, struct ast_variable *path_vars,
struct ast_variable *headers, struct ast_ari_response *response)
{
+ struct ast_get_live_recordings_args args = {};
#if defined(AST_DEVMODE)
int is_valid;
int code;
#endif /* AST_DEVMODE */
- struct ast_get_live_recordings_args args = {};
ast_ari_get_live_recordings(headers, &args, response);
#if defined(AST_DEVMODE)
code = response->response_code;
@@ -247,6 +257,9 @@ static void ast_ari_get_live_recordings_cb(
"Internal Server Error", "Response validation failed");
}
#endif /* AST_DEVMODE */
+
+fin: __attribute__((unused))
+ return;
}
/*!
* \brief Parameter parsing callback for /recordings/live/{recordingName}.
@@ -259,14 +272,13 @@ static void ast_ari_get_live_recording_cb(
struct ast_variable *get_params, struct ast_variable *path_vars,
struct ast_variable *headers, struct ast_ari_response *response)
{
+ struct ast_get_live_recording_args args = {};
+ struct ast_variable *i;
#if defined(AST_DEVMODE)
int is_valid;
int code;
#endif /* AST_DEVMODE */
- struct ast_get_live_recording_args args = {};
- struct ast_variable *i;
-
for (i = path_vars; i; i = i->next) {
if (strcmp(i->name, "recordingName") == 0) {
args.recording_name = (i->value);
@@ -301,6 +313,9 @@ static void ast_ari_get_live_recording_cb(
"Internal Server Error", "Response validation failed");
}
#endif /* AST_DEVMODE */
+
+fin: __attribute__((unused))
+ return;
}
/*!
* \brief Parameter parsing callback for /recordings/live/{recordingName}.
@@ -313,14 +328,13 @@ static void ast_ari_cancel_recording_cb(
struct ast_variable *get_params, struct ast_variable *path_vars,
struct ast_variable *headers, struct ast_ari_response *response)
{
+ struct ast_cancel_recording_args args = {};
+ struct ast_variable *i;
#if defined(AST_DEVMODE)
int is_valid;
int code;
#endif /* AST_DEVMODE */
- struct ast_cancel_recording_args args = {};
- struct ast_variable *i;
-
for (i = path_vars; i; i = i->next) {
if (strcmp(i->name, "recordingName") == 0) {
args.recording_name = (i->value);
@@ -355,6 +369,9 @@ static void ast_ari_cancel_recording_cb(
"Internal Server Error", "Response validation failed");
}
#endif /* AST_DEVMODE */
+
+fin: __attribute__((unused))
+ return;
}
/*!
* \brief Parameter parsing callback for /recordings/live/{recordingName}/stop.
@@ -367,14 +384,13 @@ static void ast_ari_stop_recording_cb(
struct ast_variable *get_params, struct ast_variable *path_vars,
struct ast_variable *headers, struct ast_ari_response *response)
{
+ struct ast_stop_recording_args args = {};
+ struct ast_variable *i;
#if defined(AST_DEVMODE)
int is_valid;
int code;
#endif /* AST_DEVMODE */
- struct ast_stop_recording_args args = {};
- struct ast_variable *i;
-
for (i = path_vars; i; i = i->next) {
if (strcmp(i->name, "recordingName") == 0) {
args.recording_name = (i->value);
@@ -409,6 +425,9 @@ static void ast_ari_stop_recording_cb(
"Internal Server Error", "Response validation failed");
}
#endif /* AST_DEVMODE */
+
+fin: __attribute__((unused))
+ return;
}
/*!
* \brief Parameter parsing callback for /recordings/live/{recordingName}/pause.
@@ -421,14 +440,13 @@ static void ast_ari_pause_recording_cb(
struct ast_variable *get_params, struct ast_variable *path_vars,
struct ast_variable *headers, struct ast_ari_response *response)
{
+ struct ast_pause_recording_args args = {};
+ struct ast_variable *i;
#if defined(AST_DEVMODE)
int is_valid;
int code;
#endif /* AST_DEVMODE */
- struct ast_pause_recording_args args = {};
- struct ast_variable *i;
-
for (i = path_vars; i; i = i->next) {
if (strcmp(i->name, "recordingName") == 0) {
args.recording_name = (i->value);
@@ -463,6 +481,9 @@ static void ast_ari_pause_recording_cb(
"Internal Server Error", "Response validation failed");
}
#endif /* AST_DEVMODE */
+
+fin: __attribute__((unused))
+ return;
}
/*!
* \brief Parameter parsing callback for /recordings/live/{recordingName}/unpause.
@@ -475,14 +496,13 @@ static void ast_ari_unpause_recording_cb(
struct ast_variable *get_params, struct ast_variable *path_vars,
struct ast_variable *headers, struct ast_ari_response *response)
{
+ struct ast_unpause_recording_args args = {};
+ struct ast_variable *i;
#if defined(AST_DEVMODE)
int is_valid;
int code;
#endif /* AST_DEVMODE */
- struct ast_unpause_recording_args args = {};
- struct ast_variable *i;
-
for (i = path_vars; i; i = i->next) {
if (strcmp(i->name, "recordingName") == 0) {
args.recording_name = (i->value);
@@ -517,6 +537,9 @@ static void ast_ari_unpause_recording_cb(
"Internal Server Error", "Response validation failed");
}
#endif /* AST_DEVMODE */
+
+fin: __attribute__((unused))
+ return;
}
/*!
* \brief Parameter parsing callback for /recordings/live/{recordingName}/mute.
@@ -529,14 +552,13 @@ static void ast_ari_mute_recording_cb(
struct ast_variable *get_params, struct ast_variable *path_vars,
struct ast_variable *headers, struct ast_ari_response *response)
{
+ struct ast_mute_recording_args args = {};
+ struct ast_variable *i;
#if defined(AST_DEVMODE)
int is_valid;
int code;
#endif /* AST_DEVMODE */
- struct ast_mute_recording_args args = {};
- struct ast_variable *i;
-
for (i = path_vars; i; i = i->next) {
if (strcmp(i->name, "recordingName") == 0) {
args.recording_name = (i->value);
@@ -571,6 +593,9 @@ static void ast_ari_mute_recording_cb(
"Internal Server Error", "Response validation failed");
}
#endif /* AST_DEVMODE */
+
+fin: __attribute__((unused))
+ return;
}
/*!
* \brief Parameter parsing callback for /recordings/live/{recordingName}/unmute.
@@ -583,14 +608,13 @@ static void ast_ari_unmute_recording_cb(
struct ast_variable *get_params, struct ast_variable *path_vars,
struct ast_variable *headers, struct ast_ari_response *response)
{
+ struct ast_unmute_recording_args args = {};
+ struct ast_variable *i;
#if defined(AST_DEVMODE)
int is_valid;
int code;
#endif /* AST_DEVMODE */
- struct ast_unmute_recording_args args = {};
- struct ast_variable *i;
-
for (i = path_vars; i; i = i->next) {
if (strcmp(i->name, "recordingName") == 0) {
args.recording_name = (i->value);
@@ -625,6 +649,9 @@ static void ast_ari_unmute_recording_cb(
"Internal Server Error", "Response validation failed");
}
#endif /* AST_DEVMODE */
+
+fin: __attribute__((unused))
+ return;
}
/*! \brief REST handler for /api-docs/recordings.{format} */