/// <summary>Synchronously send the RecommendItemsToUser request</summary> /// <param name="request">Request to be sent</param> /// <returns>Response from the API</returns> public RecommendationResponse Send(RecommendItemsToUser request) { var task = Task.Run(async() => await SendAsync(request)); var result = task.WaitAndUnwrapException(); return(result); }
/// <summary>Synchronously send the RecommendItemsToUser request</summary> /// <param name="request">Request to be sent</param> /// <returns>Response from the API</returns> public RecommendationResponse Send(RecommendItemsToUser request) { var task = SendAsync(request); RaiseExceptionOnFault(task); return(task.Result); }
public void TestRecommendItemsToUser() { RecommendItemsToUser req; Request req2; RecommendationResponse resp; // it 'recommends' req = new RecommendItemsToUser("entity_id", 9); resp = client.Send(req); // it 'recommends to previously nonexisting entity with cascadeCreate' req = new RecommendItemsToUser("nonexisting", 9, cascadeCreate: true); resp = client.Send(req); // it 'recommends with expert settings' req = new RecommendItemsToUser("nonexisting2", 9, cascadeCreate: true, expertSettings: new Dictionary <string, object>() { }); resp = client.Send(req); }
/// <summary>Send the RecommendItemsToUser request</summary> /// <param name="request">Request to be sent</param> /// <returns>Response from the API</returns> public async Task <RecommendationResponse> SendAsync(RecommendItemsToUser request) { var json = await SendRequestAsync(request).ConfigureAwait(false); return(ParseResponse(json, request)); }
/// <summary>Parse JSON response</summary> /// <param name="json">JSON string from the API</param> /// <param name="request">Request sent to the API</param> /// <returns>Parsed response</returns> protected RecommendationResponse ParseResponse(string json, RecommendItemsToUser request) { return(JsonConvert.DeserializeObject <RecommendationResponse>(json)); }
/// <summary>Send the RecommendItemsToUser request</summary> /// <param name="request">Request to be sent</param> /// <returns>Response from the API</returns> public RecommendationResponse Send(RecommendItemsToUser request) { var json = SendRequest(request); return(ParseResponse(json, request)); }