/// <summary>
        /// Delete a specific model by it's ID.
        /// </summary>
        /// <param name="model_id">The model to delete.</param>
        /// <param name="callback">The DeleteModel callback.</param>
        /// <returns></returns>
        public bool DeleteModel(DeleteModelCallback callback, string model_id)
        {
            if (string.IsNullOrEmpty(model_id))
            {
                throw new ArgumentNullException("model_id");
            }
            if (callback == null)
            {
                throw new ArgumentNullException("callback");
            }

            RESTConnector connector = RESTConnector.GetConnector(Credentials, "/v2/models/");

            if (connector == null)
            {
                return(false);
            }

            DeleteModelReq req = new DeleteModelReq();

            req.Callback   = callback;
            req.Function   = WWW.EscapeURL(model_id);
            req.OnResponse = DeleteModelResponse;
            req.Delete     = true;
            return(connector.Send(req));
        }
Exemple #2
0
        /// <summary>
        /// Delete a specific model by it's ID.
        /// </summary>
        /// <param name="successCallback">The success callback.</param>
        /// <param name="failCallback">The fail callback.</param>
        /// <param name="model_id">The model to delete.</param>
        /// <returns></returns>
        public bool DeleteModel(SuccessCallback <DeleteModelResult> successCallback, FailCallback failCallback, string model_id, Dictionary <string, object> customData = null)
        {
            if (successCallback == null)
            {
                throw new ArgumentNullException("successCallback");
            }
            if (failCallback == null)
            {
                throw new ArgumentNullException("failCallback");
            }
            if (string.IsNullOrEmpty(model_id))
            {
                throw new ArgumentNullException("model_id");
            }

            RESTConnector connector = RESTConnector.GetConnector(Credentials, "/v2/models/");

            if (connector == null)
            {
                return(false);
            }

            DeleteModelReq req = new DeleteModelReq();

            req.SuccessCallback = successCallback;
            req.FailCallback    = failCallback;
            req.CustomData      = customData == null ? new Dictionary <string, object>() : customData;
            req.Function        = WWW.EscapeURL(model_id);
            req.OnResponse      = DeleteModelResponse;
            req.Delete          = true;
            return(connector.Send(req));
        }
Exemple #3
0
        /// <summary>
        /// Delete a specific model by it's ID.
        /// </summary>
        /// <param name="successCallback">The success callback.</param>
        /// <param name="failCallback">The fail callback.</param>
        /// <param name="model_id">The model to delete.</param>
        /// <returns></returns>
        public bool DeleteModel(SuccessCallback <DeleteModelResult> successCallback, FailCallback failCallback, string model_id, Dictionary <string, object> customData = null)
        {
            if (successCallback == null)
            {
                throw new ArgumentNullException("successCallback");
            }
            if (failCallback == null)
            {
                throw new ArgumentNullException("failCallback");
            }
            if (string.IsNullOrEmpty(model_id))
            {
                throw new ArgumentNullException("model_id");
            }

            RESTConnector connector = RESTConnector.GetConnector(Credentials, "/v3/models/");

            if (connector == null)
            {
                return(false);
            }

            DeleteModelReq req = new DeleteModelReq();

            req.Parameters["version"]  = VersionDate;
            req.SuccessCallback        = successCallback;
            req.FailCallback           = failCallback;
            req.HttpMethod             = UnityWebRequest.kHttpVerbDELETE;
            req.DisableSslVerification = DisableSslVerification;
            req.CustomData             = customData == null ? new Dictionary <string, object>() : customData;
            if (req.CustomData.ContainsKey(Constants.String.CUSTOM_REQUEST_HEADERS))
            {
                foreach (KeyValuePair <string, string> kvp in req.CustomData[Constants.String.CUSTOM_REQUEST_HEADERS] as Dictionary <string, string> )
                {
                    req.Headers.Add(kvp.Key, kvp.Value);
                }
            }
            req.Function   = UnityWebRequest.EscapeURL(model_id);
            req.OnResponse = DeleteModelResponse;
            req.Headers["X-IBMCloud-SDK-Analytics"] = "service_name=language_translator;service_version=v3;operation_id=DeleteModel";
            return(connector.Send(req));
        }
Exemple #4
0
        /// <summary>
        /// Delete a specific model by it's ID.
        /// </summary>
        /// <param name="successCallback">The success callback.</param>
        /// <param name="failCallback">The fail callback.</param>
        /// <param name="model_id">The model to delete.</param>
        /// <returns></returns>
        public bool DeleteModel(SuccessCallback <DeleteModelResult> successCallback, FailCallback failCallback, string model_id, Dictionary <string, object> customData = null)
        {
            if (successCallback == null)
            {
                throw new ArgumentNullException("successCallback");
            }
            if (failCallback == null)
            {
                throw new ArgumentNullException("failCallback");
            }
            if (string.IsNullOrEmpty(model_id))
            {
                throw new ArgumentNullException("model_id");
            }

            RESTConnector connector = RESTConnector.GetConnector(Credentials, "/v3/models/");

            if (connector == null)
            {
                return(false);
            }

            DeleteModelReq req = new DeleteModelReq();

            req.Parameters["version"] = VersionDate;
            req.SuccessCallback       = successCallback;
            req.FailCallback          = failCallback;
            req.CustomData            = customData == null ? new Dictionary <string, object>() : customData;
            if (req.CustomData.ContainsKey(Constants.String.CUSTOM_REQUEST_HEADERS))
            {
                foreach (KeyValuePair <string, string> kvp in req.CustomData[Constants.String.CUSTOM_REQUEST_HEADERS] as Dictionary <string, string> )
                {
                    req.Headers.Add(kvp.Key, kvp.Value);
                }
            }
            req.Function   = WWW.EscapeURL(model_id);
            req.OnResponse = DeleteModelResponse;
            req.Delete     = true;
            return(connector.Send(req));
        }