Assets/Watson/Scripts/Services/LanguageTranslation/LanguageTranslation.cs
/// <summary>
/// Retrieve the translation models with optional filters.
/// </summary>
/// <param name="callback">The callback to invoke with the array of models.</param>
/// <param name="sourceFilter">Optional source language filter.</param>
/// <param name="targetFilter">Optional target language filter.</param>
/// <param name="defaults">Controls if we get default, non-default, or all models.</param>
/// <returns>Returns a true on success, false if it failed to submit the request.</returns>
Retrieve the translation models with optional filters.
Retrieve the translation models with optional filters .
public bool GetModels(GetModelsCallback callback,
            string sourceFilter = null,
            string targetFilter = null,
            TypeFilter defaults = TypeFilter.ALL)
        {
            if (callback == null)
                throw new ArgumentNullException("callback");
            RESTConnector connector = RESTConnector.GetConnector(SERVICE_ID, "/v2/models");
            if (connector == null)
                return false;
            GetModelsReq req = new GetModelsReq();
            req.Callback = callback;
            req.OnResponse = GetModelsResponse;
            if (!string.IsNullOrEmpty(sourceFilter))
                req.Parameters["source"] = sourceFilter;
            if (!string.IsNullOrEmpty(targetFilter))
                req.Parameters["target"] = targetFilter;
            if (defaults == TypeFilter.DEFAULT)
                req.Parameters["default"] = "true";
            else if (defaults == TypeFilter.NON_DEFAULT)
                req.Parameters["default"] = "false";
            return connector.Send(req);
        }
public bool GetModels ( GetModelsCallback callback , string sourceFilter = null , string targetFilter = null , TypeFilter defaults = TypeFilter . ALL ) { if ( callback == null ) throw new ArgumentNullException ( " " ) ; RESTConnector connector = RESTConnector . GetConnector ( SERVICE_ID , " " ) ; if ( connector == null ) return false ; GetModelsReq req = new GetModelsReq ( ) ; req . Callback = callback ; req . OnResponse = GetModelsResponse ; if ( ! string . IsNullOrEmpty ( sourceFilter ) ) req . Parameters [ " " ] = sourceFilter ; if ( ! string . IsNullOrEmpty ( targetFilter ) ) req . Parameters [ " " ] = targetFilter ; if ( defaults == TypeFilter . DEFAULT ) req . Parameters [ " " ] = " " ; else if ( defaults == TypeFilter . NON_DEFAULT ) req . Parameters [ " " ] = " " ; return connector . Send ( req ) ; }
Retrieve the translation models with optional filters.
Retrieve the translation models with optional filters .
Returns a true on success, false if it failed to submit the request.
Returns a true on success false if it failed to submit the request .
callback
GetModelsCallback
The callback to invoke with the array of models.
The callback to invoke with the array of models .
sourceFilter
string
Optional source language filter.
Optional source language filter .
targetFilter
string
Optional target language filter.
Optional target language filter .
defaults
TypeFilter
Controls if we get default, non-default, or all models.
Controls if we get default non - default or all models .