コード例 #1
0
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            SearchUsersResponse response = new SearchUsersResponse();

            context.Read();
            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("NextToken", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.NextToken = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("TotalCount", targetDepth))
                {
                    var unmarshaller = IntUnmarshaller.Instance;
                    response.TotalCount = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("Users", targetDepth))
                {
                    var unmarshaller = new ListUnmarshaller <UserData, UserDataUnmarshaller>(UserDataUnmarshaller.Instance);
                    response.Users = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return(response);
        }
コード例 #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="email"></param>
        /// <returns></returns>
        public List <SearchUsersResponse> SearchUsers(string email)
        {
            object[] param = { email };

            var dbCommand         = _db.GetCommand("dbo.GET_SEARCH_USER", param);
            var userDetailsReader = _db.ExecuteReader(dbCommand);

            if (userDetailsReader == null)
            {
                throw new Exception();
            }

            SearchUsersResponse userDetails = null;

            var userDetailsList = new List <SearchUsersResponse>();

            while (userDetailsReader.Read())
            {
                userDetails = new SearchUsersResponse
                {
                    providerName = Convert.ToString(userDetailsReader["providername"]),
                    email        = Convert.ToString(userDetailsReader["email"]),
                    providerId   = Convert.ToInt32(userDetailsReader["providerid"]),
                    imageUrl     = Convert.ToString(userDetailsReader["imageurl"]),
                };
                userDetailsList.Add(userDetails);
            }

            return(userDetailsList);
        }
コード例 #3
0
        public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems)
        {
            AmazonAlexaForBusinessConfig config = new AmazonAlexaForBusinessConfig();

            config.RegionEndpoint = region;
            ConfigureClient(config);
            AmazonAlexaForBusinessClient client = new AmazonAlexaForBusinessClient(creds, config);

            SearchUsersResponse resp = new SearchUsersResponse();

            do
            {
                SearchUsersRequest req = new SearchUsersRequest
                {
                    NextToken = resp.NextToken
                    ,
                    MaxResults = maxItems
                };

                resp = client.SearchUsers(req);
                CheckError(resp.HttpStatusCode, "200");

                foreach (var obj in resp.Users)
                {
                    AddObject(obj);
                }
            }while (!string.IsNullOrEmpty(resp.NextToken));
        }
コード例 #4
0
        public async Task <SearchUsersResponse> SearchAsync([FromBody] SearchUsersRequest request)
        {
            var fixture = new Fixture();
            var random  = new Random();

            var ret = new SearchUsersResponse();

            var allUsers = fixture.CreateMany <SearchUsersSingleModel>(random.Next(5, 100));

            ret.Users = allUsers.Take(request.Count).ToList();
            ret.Count = allUsers.Count();

            return(ret);
        }
コード例 #5
0
 public static void Fill(SearchUsersResponse respose)
 {
 }