Exemple #1
0
        /// <summary>
        /// Get a full description of a specified method.
        /// </summary>
        /// <param name="method_name">Fully-qualified (should start with "services/") name of a method.</param>
        public ApiMethodFull GetMethod(string method_name)
        {
            var json         = GetResponse(this.currentInstallation.base_url + "services/apiref/method?name=" + method_name);
            var jmethod      = JObject.Parse(json);
            var jauthoptions = (JObject)jmethod["auth_options"];
            var method       = new ApiMethodFull {
                name = (string)jmethod["name"],
                brief_description         = (string)jmethod["brief_description"],
                description               = (string)jmethod["description"],
                returns                   = (string)jmethod["returns"],
                ref_url                   = (string)jmethod["ref_url"],
                auth_options_consumer     = (string)jauthoptions["consumer"],
                auth_options_token        = (string)jauthoptions["token"],
                auth_options_ssl_required = (bool)jauthoptions["ssl_required"]
            };

            foreach (JObject jarg in (JArray)jmethod["arguments"])
            {
                method.arguments.Add(new ApiMethodArgument {
                    name          = (string)jarg["name"],
                    is_required   = (bool)jarg["is_required"],
                    description   = (string)jarg["description"],
                    default_value = jarg["default_value"].ToString()
                });
            }
            return(method);
        }
Exemple #2
0
 /// <summary>
 /// Get a full description of a specified method.
 /// </summary>
 /// <param name="method_name">Fully-qualified (should start with "services/") name of a method.</param>
 public ApiMethodFull GetMethod(string method_name)
 {
     var json = GetResponse(this.currentInstallation.base_url + "services/apiref/method?name=" + method_name);
     var jmethod = JObject.Parse(json);
     var jauthoptions = (JObject)jmethod["auth_options"];
     var method = new ApiMethodFull {
         name = (string)jmethod["name"],
         brief_description = (string)jmethod["brief_description"],
         description = (string)jmethod["description"],
         returns = (string)jmethod["returns"],
         ref_url = (string)jmethod["ref_url"],
         auth_options_consumer = (string)jauthoptions["consumer"],
         auth_options_token = (string)jauthoptions["token"],
         auth_options_ssl_required = (bool)jauthoptions["ssl_required"]
     };
     foreach (JObject jarg in (JArray)jmethod["arguments"])
     {
         method.arguments.Add(new ApiMethodArgument {
             name = (string)jarg["name"],
             is_required = (bool)jarg["is_required"],
             description = (string)jarg["description"],
             default_value = jarg["default_value"].ToString()
         });
     }
     return method;
 }