/// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            ListUsersInGroupResponse response = new ListUsersInGroupResponse();

            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("Users", targetDepth))
                {
                    var unmarshaller = new ListUnmarshaller <UserType, UserTypeUnmarshaller>(UserTypeUnmarshaller.Instance);
                    response.Users = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return(response);
        }
Example #2
0
        private async Task <object> GetAllUsersAsync(string pUserPool)
        {
            AmazonCognitoIdentityProviderClient provider =
                new AmazonCognitoIdentityProviderClient(RegionEndpoint.USEast2);

            ListUsersRequest vRequest = new ListUsersRequest
            {
                UserPoolId = pUserPool
            };
            ListUsersInGroupResponse vGroupResponse = await provider.ListUsersInGroupAsync(new ListUsersInGroupRequest
            {
                GroupName  = ADMIN_GROUP,
                UserPoolId = pUserPool
            });

            ListUsersResponse vResponse = await provider.ListUsersAsync(vRequest);

            var vReturn = new
            {
                Admins   = vGroupResponse.Users,
                AllUsers = vResponse.Users
            };

            return(vReturn);
        }