/// <summary> /// Add an object to this index. /// </summary> /// <param name="content">The object you want to add to the index.</param> /// <param name="token"></param> /// <returns>An object that contains an "abtestID" attribute.</returns> public Task <JObject> AddABTestAsync(object content, CancellationToken token = default(CancellationToken)) { return(_client.ExecuteRequest(AlgoliaClient.callType.Analytics, "POST", "/2/abtests", content, token, null)); }
/// <summary> /// Add an object to this index. /// </summary> /// <param name="content">The object you want to add to the index.</param> /// <param name="objectId">Optional objectID you want to attribute to this object (if the attribute already exists the old object will be overwritten).</param> /// <returns>An object that contains an "objectID" attribute.</returns> public Task <JObject> AddObjectAsync(object content, string objectId = null) { if (string.IsNullOrWhiteSpace(objectId)) { return(_client.ExecuteRequest(AlgoliaClient.callType.Write, "POST", string.Format("/1/indexes/{0}", _urlIndexName), content)); } else { return(_client.ExecuteRequest(AlgoliaClient.callType.Write, "PUT", string.Format("/1/indexes/{0}/{1}", _urlIndexName, Uri.EscapeDataString(objectId)), content)); } }