Assets/Watson/Scripts/Services/VisualRecognition/VisualRecognition.cs
/// <summary>
/// Create a new collection of images to search. You can create a maximum of 5 collections.
/// </summary>
/// <param name="callback">The callback.</param>
/// <param name="name">The name of the created collection.</param>
/// <param name="customData">Optional custom data.</param>
/// <returns>Returns true if succeess, false if failure.</returns>
Create a new collection of images to search. You can create a maximum of 5 collections.
Create a new collection of images to search . You can create a maximum of 5 collections .
public bool CreateCollection(OnCreateCollection callback, string name, string customData = null)
        {
            if (callback == null)
                throw new ArgumentNullException("callback");
            if (string.IsNullOrEmpty(name))
                throw new ArgumentNullException("name");
            if (string.IsNullOrEmpty(mp_ApiKey))
                mp_ApiKey = Config.Instance.GetAPIKey(SERVICE_ID);
            if (string.IsNullOrEmpty(mp_ApiKey))
                throw new WatsonException("No API Key was found!");
            RESTConnector connector = RESTConnector.GetConnector(SERVICE_ID, SERVICE_COLLECTIONS);
            if (connector == null)
                return false;
            CreateCollectionReq req = new CreateCollectionReq();
            req.Callback = callback;
            req.Name = name;
            req.Data = customData;
            req.Parameters["api_key"] = mp_ApiKey;
            req.Parameters["version"] = VisualRecognitionVersion.Version;
            req.Forms = new Dictionary<string, RESTConnector.Form>();
            req.Forms["name"] = new RESTConnector.Form(name);
            req.Forms["disregard"] = new RESTConnector.Form(new byte[4]);
            req.Timeout = 20.0f * 60.0f;
            req.OnResponse = OnCreateCollectionResp;
            return connector.Send(req);
        }
public bool CreateCollection ( OnCreateCollection callback , string name , string customData = null ) { if ( callback == null ) throw new ArgumentNullException ( " " ) ; if ( string . IsNullOrEmpty ( name ) ) throw new ArgumentNullException ( " " ) ; if ( string . IsNullOrEmpty ( mp_ApiKey ) ) mp_ApiKey = Config . Instance . GetAPIKey ( SERVICE_ID ) ; if ( string . IsNullOrEmpty ( mp_ApiKey ) ) throw new WatsonException ( " " ) ; RESTConnector connector = RESTConnector . GetConnector ( SERVICE_ID , SERVICE_COLLECTIONS ) ; if ( connector == null ) return false ; CreateCollectionReq req = new CreateCollectionReq ( ) ; req . Callback = callback ; req . Name = name ; req . Data = customData ; req . Parameters [ " " ] = mp_ApiKey ; req . Parameters [ " " ] = VisualRecognitionVersion . Version ; req . Forms = new Dictionary < string , RESTConnector . Form > ( ) ; req . Forms [ " " ] = new RESTConnector . Form ( name ) ; req . Forms [ " " ] = new RESTConnector . Form ( new byte [ 4 ] ) ; req . Timeout = 20.0f * 60.0f ; req . OnResponse = OnCreateCollectionResp ; return connector . Send ( req ) ; }
Create a new collection of images to search.
Create a new collection of images to search .
Returns true if succeess, false if failure.
Returns true if succeess false if failure .
callback
OnCreateCollection
None
name
string
The name of the created collection.
The name of the created collection .
customData
string
Optional custom data.
Optional custom data .