public void PostAndDeleteTests() { if (!_redisConnectionString.IsNotNullOrEmpty()) { return; } var rest = new Rest(_redisConnectionString); var testPath1 = "home:test1"; var testPath2 = "home:test2"; var testData = new GeoResult() { City = "London", Country_Code = "GB", Country_Name = "United Kingdom" }; var testDataInStream = StringUtils.GenerateStreamFromString(testData.JsonSerialize()); var result1 = rest.Post <GeoResult>(testPath1, testData); Assert.True(result1?.City == "London"); Assert.True(rest.Delete <bool>(testPath1)); var result2 = rest.Post <Stream>(testPath2, testDataInStream); Assert.True(result2?.Length > 0); Assert.True(rest.Delete <bool>(testPath2)); }
public void Delete(string id) { try { if (ApiUrl == string.Empty) { throw new Exception(Errors.ERR_REFM_MISSING_APIURL); } var uriBuilder = new UriBuilder(ApiUrl + "/entities/id/" + id); if (DevKey != string.Empty) { uriBuilder.Query = "subscription-key=" + DevKey; } Rest.Delete(uriBuilder.Uri); } catch (Exception err) { var errString = string.Format(Errors.ERR_REFM_ENTITY_NOT_DELETED, id) + ", " + err.Message; if (err.InnerException != null) { errString += ", " + err.InnerException.Message; } throw new Exception(errString); } }
private static void DeleteDevice(string deviceId) { var uri = _deviceApi + $@"/manifests/id/{deviceId}"; var uriBuilder = new UriBuilder(uri) { Query = _devSubKey }; Rest.Delete(uriBuilder.Uri); }
public async Task <bool> DeleteBin(string binId) { bool isSuccessful = false; var url = $"https://postb.in/api/bin/{binId}"; var result = await Rest.Delete(url) .WithTrackingIndicator("RB1003") .WithSuccessAction(res => { isSuccessful = true; }) .ExecuteAsync(); return(isSuccessful); }
public override void RemoveNotification(string id) { Rest.Delete(Address + Url.Notifications, id); }
public override void RemoveResource(string id) { Rest.Delete(Address + Url.Resources, id); }
public override void RemoveDevice(string id) { Rest.Delete(Address + Url.Devices, id); }
public override void RemoveActivity(string id) { Rest.Delete(Address + Url.Activities, id); }
public override void RemoveUser(string id) { Rest.Delete(Address + Url.Users, id); }
public bool Delete(int id) { var response = Rest.Delete <T>($"{BaseEndpoint}/{id}"); return(response.StatusCode == HttpStatusCode.NoContent || response.StatusCode == HttpStatusCode.NotFound); }