Exemplo n.º 1
0
        // TODO: since param
        public async Task <ProfileKeysLrsResponse> RetrieveAgentProfileIdsAsync(Agent agent)
        {
            var queryParams = new Dictionary <string, string>
            {
                { "agent", agent.ToJson(Version) }
            };

            return(await GetProfileKeys("agents/profile", queryParams));
        }
Exemplo n.º 2
0
        public async Task <LrsResponse> ClearStateAsync(Activity activity, Agent agent, Guid?registration = null)
        {
            var queryParams = new Dictionary <string, string>
            {
                { "activityId", activity.Id },
                { "agent", agent.ToJson(Version) }
            };

            if (registration != null)
            {
                queryParams.Add("registration", registration.ToString());
            }

            return(await DeleteDocument("activities/state", queryParams));
        }
Exemplo n.º 3
0
        // TODO: since param
        public async Task <ProfileKeysLrsResponse> RetrieveStateIdsAsync(Activity activity, Agent agent,
                                                                         Guid?registration = null)
        {
            var queryParams = new Dictionary <string, string>
            {
                { "activityId", activity.Id },
                { "agent", agent.ToJson(Version) }
            };

            if (registration != null)
            {
                queryParams.Add("registration", registration.ToString());
            }

            return(await GetProfileKeys("activities/state", queryParams));
        }
Exemplo n.º 4
0
        public async Task <StateLrsResponse> RetrieveStateAsync(string id, Activity activity, Agent agent,
                                                                Guid?registration = null)
        {
            var r = new StateLrsResponse();

            var queryParams = new Dictionary <string, string>
            {
                { "stateId", id },
                { "activityId", activity.Id },
                { "agent", agent.ToJson(Version) }
            };

            var state = new StateDocument
            {
                Id       = id,
                Activity = activity,
                Agent    = agent
            };

            if (registration != null)
            {
                queryParams.Add("registration", registration.ToString());
                state.Registration = registration;
            }

            var resp = await 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);
        }
Exemplo n.º 5
0
        public async Task <AgentProfileLrsResponse> RetrieveAgentProfileAsync(string id, Agent agent)
        {
            var r = new AgentProfileLrsResponse();

            var queryParams = new Dictionary <string, string>
            {
                { "profileId", id },
                { "agent", agent.ToJson(Version) }
            };

            var profile = new AgentProfileDocument
            {
                Id    = id,
                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);
            }

            profile.Content     = resp.Content;
            profile.ContentType = resp.ContentType;
            profile.Etag        = resp.Etag;

            r.Success = true;
            r.Content = profile;

            return(r);
        }