public LRSResponse DeleteState(StateDocument state) { var queryParams = new Dictionary<String, String>(); queryParams.Add("stateId", state.id); queryParams.Add("activityId", state.activity.id.ToString()); queryParams.Add("agent", state.agent.ToJSON(version)); if (state.registration != null) { queryParams.Add("registration", state.registration.ToString()); } return DeleteDocument("activities/state", queryParams); }
public StateLRSResponse RetrieveState(String id, Activity activity, Agent agent, Nullable<Guid> registration = null) { var r = new StateLRSResponse(); var queryParams = new Dictionary<String, String>(); queryParams.Add("stateId", id); queryParams.Add("activityId", activity.id.ToString()); queryParams.Add("agent", agent.ToJSON(version)); var state = new StateDocument(); state.id = id; state.activity = activity; state.agent = agent; if (registration != null) { queryParams.Add("registration", registration.ToString()); state.registration = registration; } var resp = GetDocument("activities/state", queryParams, state); if (resp.status != HttpStatusCode.OK && resp.status != HttpStatusCode.NotFound) { r.success = false; r.httpException = resp.ex; r.SetErrMsgFromBytes(resp.content); return r; } r.success = true; r.content = state; return r; }
public void TestDeleteState() { var doc = new StateDocument(); doc.activity = activity; doc.agent = agent; doc.id = "test"; LRSResponse lrsRes = lrs.DeleteState(doc); Assert.IsTrue(lrsRes.success); }
public LRSResponse SaveState(StateDocument state) { var queryParams = new Dictionary<String, String>(); queryParams.Add("stateId", state.id); queryParams.Add("activityId", state.activity.id.ToString()); queryParams.Add("agent", state.agent.ToJSON(version)); return SaveDocument("activities/state", queryParams, state); }
public void TestSaveState() { var doc = new StateDocument(); doc.activity = activity; doc.agent = agent; doc.id = "test"; doc.content = System.Text.Encoding.UTF8.GetBytes("Test value"); LRSResponse lrsRes = lrs.SaveState(doc); Assert.IsTrue(lrsRes.success); }