ARI playback: Rename ARI Playback to Playbacks
authorKevin Harwell <kharwell@digium.com>
Fri, 8 Nov 2013 17:59:16 +0000 (17:59 +0000)
committerKevin Harwell <kharwell@digium.com>
Fri, 8 Nov 2013 17:59:16 +0000 (17:59 +0000)
Before playback was the only non plural resource.  It has been renamed to
playbacks for consistency.

(closes issue ASTERISK-22737)
Reported by: Paul Belanger
........

Merged revisions 402560 from http://svn.asterisk.org/svn/asterisk/branches/12

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@402562 65c4cc65-6c06-0410-ace0-fbb531ad65f3

res/ari.make
res/ari/resource_playbacks.c [moved from res/ari/resource_playback.c with 89% similarity]
res/ari/resource_playbacks.h [moved from res/ari/resource_playback.h with 80% similarity]
res/res_ari_playbacks.c [moved from res/res_ari_playback.c with 76% similarity]
rest-api/api-docs/playbacks.json [moved from rest-api/api-docs/playback.json with 96% similarity]
rest-api/resources.json

index 6693fb1..0257f81 100644 (file)
@@ -41,9 +41,9 @@ res_ari_sounds.so: ari/resource_sounds.o
 
 ari/resource_sounds.o: _ASTCFLAGS+=$(call MOD_ASTCFLAGS,res_ari_sounds)
 
-res_ari_playback.so: ari/resource_playback.o
+res_ari_playbacks.so: ari/resource_playbacks.o
 
-ari/resource_playback.o: _ASTCFLAGS+=$(call MOD_ASTCFLAGS,res_ari_playback)
+ari/resource_playbacks.o: _ASTCFLAGS+=$(call MOD_ASTCFLAGS,res_ari_playbacks)
 
 res_ari_events.so: ari/resource_events.o
 
similarity index 89%
rename from res/ari/resource_playback.c
rename to res/ari/resource_playbacks.c
index 30445ef..0dbfc05 100644 (file)
@@ -18,7 +18,7 @@
 
 /*! \file
  *
- * \brief /api-docs/playback.{format} implementation- Playback control resources
+ * \brief /api-docs/playbacks.{format} implementation- Playback control resources
  *
  * \author David M. Lee, II <dlee@digium.com>
  */
 ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #include "asterisk/stasis_app_playback.h"
-#include "resource_playback.h"
+#include "resource_playbacks.h"
 
-void ast_ari_playback_get(struct ast_variable *headers,
-       struct ast_ari_playback_get_args *args,
+void ast_ari_playbacks_get(struct ast_variable *headers,
+       struct ast_ari_playbacks_get_args *args,
        struct ast_ari_response *response)
 {
        RAII_VAR(struct stasis_app_playback *, playback, NULL, ao2_cleanup);
@@ -53,8 +53,8 @@ void ast_ari_playback_get(struct ast_variable *headers,
 
        ast_ari_response_ok(response, ast_json_ref(json));
 }
-void ast_ari_playback_stop(struct ast_variable *headers,
-       struct ast_ari_playback_stop_args *args,
+void ast_ari_playbacks_stop(struct ast_variable *headers,
+       struct ast_ari_playbacks_stop_args *args,
        struct ast_ari_response *response)
 {
        RAII_VAR(struct stasis_app_playback *, playback, NULL, ao2_cleanup);
@@ -84,8 +84,8 @@ void ast_ari_playback_stop(struct ast_variable *headers,
                return;
        }
 }
-void ast_ari_playback_control(struct ast_variable *headers,
-       struct ast_ari_playback_control_args *args,
+void ast_ari_playbacks_control(struct ast_variable *headers,
+       struct ast_ari_playbacks_control_args *args,
        struct ast_ari_response *response)
 {
        RAII_VAR(struct stasis_app_playback *, playback, NULL, ao2_cleanup);
similarity index 80%
rename from res/ari/resource_playback.h
rename to res/ari/resource_playbacks.h
index e3a5c55..375f8ef 100644 (file)
@@ -40,7 +40,7 @@
 #include "asterisk/ari.h"
 
 /*! \brief Argument struct for ast_ari_playback_get() */
-struct ast_ari_playback_get_args {
+struct ast_ari_playbacks_get_args {
        /*! \brief Playback's id */
        const char *playback_id;
 };
@@ -51,9 +51,9 @@ struct ast_ari_playback_get_args {
  * \param args Swagger parameters
  * \param[out] response HTTP response
  */
-void ast_ari_playback_get(struct ast_variable *headers, struct ast_ari_playback_get_args *args, struct ast_ari_response *response);
+void ast_ari_playbacks_get(struct ast_variable *headers, struct ast_ari_playbacks_get_args *args, struct ast_ari_response *response);
 /*! \brief Argument struct for ast_ari_playback_stop() */
-struct ast_ari_playback_stop_args {
+struct ast_ari_playbacks_stop_args {
        /*! \brief Playback's id */
        const char *playback_id;
 };
@@ -64,9 +64,9 @@ struct ast_ari_playback_stop_args {
  * \param args Swagger parameters
  * \param[out] response HTTP response
  */
-void ast_ari_playback_stop(struct ast_variable *headers, struct ast_ari_playback_stop_args *args, struct ast_ari_response *response);
+void ast_ari_playbacks_stop(struct ast_variable *headers, struct ast_ari_playbacks_stop_args *args, struct ast_ari_response *response);
 /*! \brief Argument struct for ast_ari_playback_control() */
-struct ast_ari_playback_control_args {
+struct ast_ari_playbacks_control_args {
        /*! \brief Playback's id */
        const char *playback_id;
        /*! \brief Operation to perform on the playback. */
@@ -79,6 +79,6 @@ struct ast_ari_playback_control_args {
  * \param args Swagger parameters
  * \param[out] response HTTP response
  */
-void ast_ari_playback_control(struct ast_variable *headers, struct ast_ari_playback_control_args *args, struct ast_ari_response *response);
+void ast_ari_playbacks_control(struct ast_variable *headers, struct ast_ari_playbacks_control_args *args, struct ast_ari_response *response);
 
 #endif /* _ASTERISK_RESOURCE_PLAYBACK_H */
similarity index 76%
rename from res/res_ari_playback.c
rename to res/res_ari_playbacks.c
index 1be3f07..5b6dc91 100644 (file)
@@ -44,7 +44,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 #include "asterisk/app.h"
 #include "asterisk/module.h"
 #include "asterisk/stasis_app.h"
-#include "ari/resource_playback.h"
+#include "ari/resource_playbacks.h"
 #if defined(AST_DEVMODE)
 #include "ari/ari_model_validators.h"
 #endif
@@ -52,17 +52,17 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 #define MAX_VALS 128
 
 /*!
- * \brief Parameter parsing callback for /playback/{playbackId}.
+ * \brief Parameter parsing callback for /playbacks/{playbackId}.
  * \param get_params GET parameters in the HTTP request.
  * \param path_vars Path variables extracted from the request.
  * \param headers HTTP headers.
  * \param[out] response Response to the HTTP request.
  */
-static void ast_ari_playback_get_cb(
+static void ast_ari_playbacks_get_cb(
        struct ast_variable *get_params, struct ast_variable *path_vars,
        struct ast_variable *headers, struct ast_ari_response *response)
 {
-       struct ast_ari_playback_get_args args = {};
+       struct ast_ari_playbacks_get_args args = {};
        struct ast_variable *i;
 #if defined(AST_DEVMODE)
        int is_valid;
@@ -75,7 +75,7 @@ static void ast_ari_playback_get_cb(
                } else
                {}
        }
-       ast_ari_playback_get(headers, &args, response);
+       ast_ari_playbacks_get(headers, &args, response);
 #if defined(AST_DEVMODE)
        code = response->response_code;
 
@@ -93,13 +93,13 @@ static void ast_ari_playback_get_cb(
                        is_valid = ast_ari_validate_playback(
                                response->message);
                } else {
-                       ast_log(LOG_ERROR, "Invalid error response %d for /playback/{playbackId}\n", code);
+                       ast_log(LOG_ERROR, "Invalid error response %d for /playbacks/{playbackId}\n", code);
                        is_valid = 0;
                }
        }
 
        if (!is_valid) {
-               ast_log(LOG_ERROR, "Response validation failed for /playback/{playbackId}\n");
+               ast_log(LOG_ERROR, "Response validation failed for /playbacks/{playbackId}\n");
                ast_ari_response_error(response, 500,
                        "Internal Server Error", "Response validation failed");
        }
@@ -109,17 +109,17 @@ fin: __attribute__((unused))
        return;
 }
 /*!
- * \brief Parameter parsing callback for /playback/{playbackId}.
+ * \brief Parameter parsing callback for /playbacks/{playbackId}.
  * \param get_params GET parameters in the HTTP request.
  * \param path_vars Path variables extracted from the request.
  * \param headers HTTP headers.
  * \param[out] response Response to the HTTP request.
  */
-static void ast_ari_playback_stop_cb(
+static void ast_ari_playbacks_stop_cb(
        struct ast_variable *get_params, struct ast_variable *path_vars,
        struct ast_variable *headers, struct ast_ari_response *response)
 {
-       struct ast_ari_playback_stop_args args = {};
+       struct ast_ari_playbacks_stop_args args = {};
        struct ast_variable *i;
 #if defined(AST_DEVMODE)
        int is_valid;
@@ -132,7 +132,7 @@ static void ast_ari_playback_stop_cb(
                } else
                {}
        }
-       ast_ari_playback_stop(headers, &args, response);
+       ast_ari_playbacks_stop(headers, &args, response);
 #if defined(AST_DEVMODE)
        code = response->response_code;
 
@@ -150,13 +150,13 @@ static void ast_ari_playback_stop_cb(
                        is_valid = ast_ari_validate_void(
                                response->message);
                } else {
-                       ast_log(LOG_ERROR, "Invalid error response %d for /playback/{playbackId}\n", code);
+                       ast_log(LOG_ERROR, "Invalid error response %d for /playbacks/{playbackId}\n", code);
                        is_valid = 0;
                }
        }
 
        if (!is_valid) {
-               ast_log(LOG_ERROR, "Response validation failed for /playback/{playbackId}\n");
+               ast_log(LOG_ERROR, "Response validation failed for /playbacks/{playbackId}\n");
                ast_ari_response_error(response, 500,
                        "Internal Server Error", "Response validation failed");
        }
@@ -166,17 +166,17 @@ fin: __attribute__((unused))
        return;
 }
 /*!
- * \brief Parameter parsing callback for /playback/{playbackId}/control.
+ * \brief Parameter parsing callback for /playbacks/{playbackId}/control.
  * \param get_params GET parameters in the HTTP request.
  * \param path_vars Path variables extracted from the request.
  * \param headers HTTP headers.
  * \param[out] response Response to the HTTP request.
  */
-static void ast_ari_playback_control_cb(
+static void ast_ari_playbacks_control_cb(
        struct ast_variable *get_params, struct ast_variable *path_vars,
        struct ast_variable *headers, struct ast_ari_response *response)
 {
-       struct ast_ari_playback_control_args args = {};
+       struct ast_ari_playbacks_control_args args = {};
        struct ast_variable *i;
 #if defined(AST_DEVMODE)
        int is_valid;
@@ -195,7 +195,7 @@ static void ast_ari_playback_control_cb(
                } else
                {}
        }
-       ast_ari_playback_control(headers, &args, response);
+       ast_ari_playbacks_control(headers, &args, response);
 #if defined(AST_DEVMODE)
        code = response->response_code;
 
@@ -215,13 +215,13 @@ static void ast_ari_playback_control_cb(
                        is_valid = ast_ari_validate_void(
                                response->message);
                } else {
-                       ast_log(LOG_ERROR, "Invalid error response %d for /playback/{playbackId}/control\n", code);
+                       ast_log(LOG_ERROR, "Invalid error response %d for /playbacks/{playbackId}/control\n", code);
                        is_valid = 0;
                }
        }
 
        if (!is_valid) {
-               ast_log(LOG_ERROR, "Response validation failed for /playback/{playbackId}/control\n");
+               ast_log(LOG_ERROR, "Response validation failed for /playbacks/{playbackId}/control\n");
                ast_ari_response_error(response, 500,
                        "Internal Server Error", "Response validation failed");
        }
@@ -231,46 +231,46 @@ fin: __attribute__((unused))
        return;
 }
 
-/*! \brief REST handler for /api-docs/playback.{format} */
-static struct stasis_rest_handlers playback_playbackId_control = {
+/*! \brief REST handler for /api-docs/playbacks.{format} */
+static struct stasis_rest_handlers playbacks_playbackId_control = {
        .path_segment = "control",
        .callbacks = {
-               [AST_HTTP_POST] = ast_ari_playback_control_cb,
+               [AST_HTTP_POST] = ast_ari_playbacks_control_cb,
        },
        .num_children = 0,
        .children = {  }
 };
-/*! \brief REST handler for /api-docs/playback.{format} */
-static struct stasis_rest_handlers playback_playbackId = {
+/*! \brief REST handler for /api-docs/playbacks.{format} */
+static struct stasis_rest_handlers playbacks_playbackId = {
        .path_segment = "playbackId",
        .is_wildcard = 1,
        .callbacks = {
-               [AST_HTTP_GET] = ast_ari_playback_get_cb,
-               [AST_HTTP_DELETE] = ast_ari_playback_stop_cb,
+               [AST_HTTP_GET] = ast_ari_playbacks_get_cb,
+               [AST_HTTP_DELETE] = ast_ari_playbacks_stop_cb,
        },
        .num_children = 1,
-       .children = { &playback_playbackId_control, }
+       .children = { &playbacks_playbackId_control, }
 };
-/*! \brief REST handler for /api-docs/playback.{format} */
-static struct stasis_rest_handlers playback = {
-       .path_segment = "playback",
+/*! \brief REST handler for /api-docs/playbacks.{format} */
+static struct stasis_rest_handlers playbacks = {
+       .path_segment = "playbacks",
        .callbacks = {
        },
        .num_children = 1,
-       .children = { &playback_playbackId, }
+       .children = { &playbacks_playbackId, }
 };
 
 static int load_module(void)
 {
        int res = 0;
        stasis_app_ref();
-       res |= ast_ari_add_handler(&playback);
+       res |= ast_ari_add_handler(&playbacks);
        return res;
 }
 
 static int unload_module(void)
 {
-       ast_ari_remove_handler(&playback);
+       ast_ari_remove_handler(&playbacks);
        stasis_app_unref();
        return 0;
 }
similarity index 96%
rename from rest-api/api-docs/playback.json
rename to rest-api/api-docs/playbacks.json
index 92810d3..2c621cf 100644 (file)
@@ -5,10 +5,10 @@
        "apiVersion": "0.0.1",
        "swaggerVersion": "1.1",
        "basePath": "http://localhost:8088/stasis",
-       "resourcePath": "/api-docs/playback.{format}",
+       "resourcePath": "/api-docs/playbacks.{format}",
        "apis": [
                {
-                       "path": "/playback/{playbackId}",
+                       "path": "/playbacks/{playbackId}",
                        "description": "Control object for a playback operation.",
                        "operations": [
                                {
@@ -58,7 +58,7 @@
                        ]
                },
                {
-                       "path": "/playback/{playbackId}/control",
+                       "path": "/playbacks/{playbackId}/control",
                        "description": "Control object for a playback operation.",
                        "operations": [
                                {
index 0bdf9de..7e0b793 100644 (file)
@@ -31,7 +31,7 @@
                        "description": "Sound resources"
                },
                {
-                       "path": "/api-docs/playback.{format}",
+                       "path": "/api-docs/playbacks.{format}",
                        "description": "Playback control resources"
                },
                {