@@ -5649,6 +5649,99 @@ private void OnCreateStopwordListResponse(RESTConnector.Request req, RESTConnect
56495649 }
56505650 }
56515651
5652+ public bool GetStopwordListStatus ( SuccessCallback < TokenDictStatusResponse > successCallback , FailCallback failCallback , string environmentID , string collectionId , Dictionary < string , object > customData = null )
5653+ {
5654+ if ( successCallback == null )
5655+ throw new ArgumentNullException ( "successCallback" ) ;
5656+ if ( failCallback == null )
5657+ throw new ArgumentNullException ( "failCallback" ) ;
5658+ if ( string . IsNullOrEmpty ( environmentID ) )
5659+ throw new ArgumentNullException ( "environmentID" ) ;
5660+ if ( string . IsNullOrEmpty ( collectionId ) )
5661+ throw new ArgumentNullException ( "collectionId" ) ;
5662+
5663+ GetStopwordListStatusRequest req = new GetStopwordListStatusRequest ( ) ;
5664+ req . SuccessCallback = successCallback ;
5665+ req . FailCallback = failCallback ;
5666+ req . HttpMethod = UnityWebRequest . kHttpVerbGET ;
5667+ req . DisableSslVerification = DisableSslVerification ;
5668+ req . CustomData = customData == null ? new Dictionary < string , object > ( ) : customData ;
5669+ req . Headers [ "Content-Type" ] = "application/json" ;
5670+ if ( req . CustomData . ContainsKey ( Constants . String . CUSTOM_REQUEST_HEADERS ) )
5671+ {
5672+ foreach ( KeyValuePair < string , string > kvp in req . CustomData [ Constants . String . CUSTOM_REQUEST_HEADERS ] as Dictionary < string , string > )
5673+ {
5674+ req . Headers . Add ( kvp . Key , kvp . Value ) ;
5675+ }
5676+ }
5677+ req . Parameters [ "version" ] = VersionDate ;
5678+ req . OnResponse = OnGetStopwordListStatusResponse ;
5679+ req . Headers [ "X-IBMCloud-SDK-Analytics" ] = "service_name=discovery;service_version=v1;operation_id=GetStopwordListStatus" ;
5680+
5681+ RESTConnector connector = RESTConnector . GetConnector ( Credentials , string . Format ( "/v1/environments/{0}/collections/{1}/word_lists/stopwords" , environmentID , collectionId ) ) ;
5682+ if ( connector == null )
5683+ return false ;
5684+
5685+ return connector . Send ( req ) ;
5686+ }
5687+
5688+ private class GetStopwordListStatusRequest : RESTConnector . Request
5689+ {
5690+ /// <summary>
5691+ /// The success callback.
5692+ /// </summary>
5693+ public SuccessCallback < TokenDictStatusResponse > SuccessCallback { get ; set ; }
5694+ /// <summary>
5695+ /// The fail callback.
5696+ /// </summary>
5697+ public FailCallback FailCallback { get ; set ; }
5698+ /// <summary>
5699+ /// Custom data.
5700+ /// </summary>
5701+ public Dictionary < string , object > CustomData { get ; set ; }
5702+ }
5703+
5704+ private void OnGetStopwordListStatusResponse ( RESTConnector . Request req , RESTConnector . Response resp )
5705+ {
5706+ TokenDictStatusResponse result = new TokenDictStatusResponse ( ) ;
5707+ fsData data = null ;
5708+ Dictionary < string , object > customData = ( ( GetStopwordListStatusRequest ) req ) . CustomData ;
5709+ customData . Add ( Constants . String . RESPONSE_HEADERS , resp . Headers ) ;
5710+
5711+ if ( resp . Success )
5712+ {
5713+ try
5714+ {
5715+ fsResult r = fsJsonParser . Parse ( Encoding . UTF8 . GetString ( resp . Data ) , out data ) ;
5716+ if ( ! r . Succeeded )
5717+ throw new WatsonException ( r . FormattedMessages ) ;
5718+
5719+ object obj = result ;
5720+ r = _serializer . TryDeserialize ( data , obj . GetType ( ) , ref obj ) ;
5721+ if ( ! r . Succeeded )
5722+ throw new WatsonException ( r . FormattedMessages ) ;
5723+
5724+ customData . Add ( "json" , data ) ;
5725+ }
5726+ catch ( Exception e )
5727+ {
5728+ Log . Error ( "Discovery.OnGetStopwordListStatusResponse()" , "OnGetStopwordListStatusResponse Exception: {0}" , e . ToString ( ) ) ;
5729+ resp . Success = false ;
5730+ }
5731+ }
5732+
5733+ if ( resp . Success )
5734+ {
5735+ if ( ( ( GetStopwordListStatusRequest ) req ) . SuccessCallback != null )
5736+ ( ( GetStopwordListStatusRequest ) req ) . SuccessCallback ( result , customData ) ;
5737+ }
5738+ else
5739+ {
5740+ if ( ( ( GetStopwordListStatusRequest ) req ) . FailCallback != null )
5741+ ( ( GetStopwordListStatusRequest ) req ) . FailCallback ( resp . Error , customData ) ;
5742+ }
5743+ }
5744+
56525745 /// <summary>
56535746 /// Delete a custom stopword list.
56545747 ///
0 commit comments