public async Task <AgentProfileLRSResponse> RetrieveAgentProfile(string id, Agent agent) { var r = new AgentProfileLRSResponse(); var queryParams = new Dictionary <string, string>(); queryParams.Add("profileId", id); queryParams.Add("agent", agent.ToJSON(version)); var profile = new AgentProfileDocument(); profile.id = id; profile.agent = agent; var resp = await GetDocument("agents/profile", queryParams, profile); 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 = new AgentProfileDocument(); r.content.content = resp?.content; r.content.contentType = resp?.contentType; r.content.etag = resp?.etag; return(r); }
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; return(r); }
public async Task <ProfileKeysLRSResponse> RetrieveAgentProfileIds(Agent agent) { var queryParams = new Dictionary <string, string>(); queryParams.Add("agent", agent.ToJSON(version)); return(await GetProfileKeys("agents/profile", queryParams)); }
// TODO: since param public ProfileKeysLRSResponse RetrieveAgentProfileIds(Agent agent) { var queryParams = new Dictionary <String, String>(); queryParams.Add("agent", agent.ToJSON(version)); return(GetProfileKeys("agents/profile", queryParams)); }
public void TestEmptyCtr() { var obj = new Agent(); Assert.IsInstanceOf<Agent>(obj); Assert.IsNull(obj.mbox); StringAssert.AreEqualIgnoringCase("{\"objectType\":\"Agent\"}", obj.ToJSON()); }
public async Task <ProfileKeysLRSResponse> RetrieveStateIds(Activity activity, Agent agent, Guid?registration = null) { var queryParams = new Dictionary <string, string>(); queryParams.Add("activityId", activity.id); queryParams.Add("agent", agent.ToJSON(version)); if (registration != null) { queryParams.Add("registration", registration.ToString()); } return(await GetProfileKeys("activities/state", queryParams)); }
public LRSResponse ClearState(Activity activity, Agent agent, Nullable <Guid> registration = null) { var queryParams = new Dictionary <String, String>(); queryParams.Add("activityId", activity.id.ToString()); queryParams.Add("agent", agent.ToJSON(version)); if (registration != null) { queryParams.Add("registration", registration.ToString()); } return(DeleteDocument("activities/state", queryParams)); }
// TODO: since param public ProfileKeysLRSResponse RetrieveStateIds(Activity activity, Agent agent, Nullable <Guid> registration = null) { var queryParams = new Dictionary <String, String>(); queryParams.Add("activityId", activity.id.ToString()); queryParams.Add("agent", agent.ToJSON(version)); if (registration != null) { queryParams.Add("registration", registration.ToString()); } return(GetProfileKeys("activities/state", queryParams)); }
/// <summary> /// To the parameter map. /// </summary> /// <param name="version">The version.</param> /// <returns>Dictionary<System.String, System.String>.</returns> public Dictionary <string, string> ToParameterMap(TCAPIVersion version) { var result = new Dictionary <string, string>(); if (Agent != null) { result.Add("agent", Agent.ToJSON(version)); } if (VerbId != null) { result.Add("verb", VerbId.ToString()); } if (ActivityId != null) { result.Add("activity", ActivityId); } if (Registration != null) { result.Add("registration", Registration.Value.ToString()); } if (RelatedActivities != null) { result.Add("related_activities", RelatedActivities.Value.ToString()); } if (RelatedAgents != null) { result.Add("related_agents", RelatedAgents.Value.ToString()); } if (Since != null) { result.Add("since", Since.Value.ToString(ISO_DATE_TIME_FORMAT)); } if (Until != null) { result.Add("until", Until.Value.ToString(ISO_DATE_TIME_FORMAT)); } if (Limit != null) { result.Add("limit", Limit.ToString()); } if (Format != null) { result.Add("format", Format.ToString()); } if (Ascending != null) { result.Add("ascending", Ascending.Value.ToString()); } return(result); }
public async Task <LRSResponse> ClearState(Activity activity, Agent agent, Guid?registration = null) { var queryParams = new Dictionary <string, string>(); queryParams.Add("activityId", activity.id); queryParams.Add("agent", agent.ToJSON(version)); if (registration != null) { queryParams.Add("registration", registration.ToString()); } return(await DeleteDocument("activities/state", queryParams)); }
public AgentProfileLRSResponse RetrieveAgentProfile(String id, Agent agent) { var r = new AgentProfileLRSResponse(); var queryParams = new Dictionary<String, String>(); queryParams.Add("profileId", id); queryParams.Add("agent", agent.ToJSON(version)); var profile = new AgentProfileDocument(); profile.id = id; profile.agent = agent; var resp = GetDocument("agents/profile", queryParams, profile); 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 = profile; return r; }
// TODO: since param public ProfileKeysLRSResponse RetrieveAgentProfileIds(Agent agent) { var queryParams = new Dictionary<String, String>(); queryParams.Add("agent", agent.ToJSON(version)); return GetProfileKeys("agents/profile", queryParams); }
public LRSResponse ClearState(Activity activity, Agent agent, Nullable<Guid> registration = null) { var queryParams = new Dictionary<String, String>(); queryParams.Add("activityId", activity.id.ToString()); queryParams.Add("agent", agent.ToJSON(version)); if (registration != null) { queryParams.Add("registration", 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; }
// TODO: since param public ProfileKeysLRSResponse RetrieveStateIds(Activity activity, Agent agent, Nullable<Guid> registration = null) { var queryParams = new Dictionary<String, String>(); queryParams.Add("activityId", activity.id.ToString()); queryParams.Add("agent", agent.ToJSON(version)); if (registration != null) { queryParams.Add("registration", registration.ToString()); } return GetProfileKeys("activities/state", queryParams); }