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

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

            return(response);
        }
        public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems)
        {
            AmazonChimeConfig config = new AmazonChimeConfig();

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

            ListPhoneNumbersResponse resp = new ListPhoneNumbersResponse();

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

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

                foreach (var obj in resp.PhoneNumbers)
                {
                    AddObject(obj);
                }
            }while (!string.IsNullOrEmpty(resp.NextToken));
        }
        public static ListPhoneNumbersResponse Unmarshall(UnmarshallerContext _ctx)
        {
            ListPhoneNumbersResponse listPhoneNumbersResponse = new ListPhoneNumbersResponse();

            listPhoneNumbersResponse.HttpResponse   = _ctx.HttpResponse;
            listPhoneNumbersResponse.Code           = _ctx.StringValue("ListPhoneNumbers.Code");
            listPhoneNumbersResponse.HttpStatusCode = _ctx.IntegerValue("ListPhoneNumbers.HttpStatusCode");
            listPhoneNumbersResponse.Message        = _ctx.StringValue("ListPhoneNumbers.Message");
            listPhoneNumbersResponse.PageNumber     = _ctx.IntegerValue("ListPhoneNumbers.PageNumber");
            listPhoneNumbersResponse.PageSize       = _ctx.IntegerValue("ListPhoneNumbers.PageSize");
            listPhoneNumbersResponse.RequestId      = _ctx.StringValue("ListPhoneNumbers.RequestId");

            ListPhoneNumbersResponse.ListPhoneNumbers_Data data = new ListPhoneNumbersResponse.ListPhoneNumbers_Data();
            data.PageNumber = _ctx.IntegerValue("ListPhoneNumbers.Data.PageNumber");
            data.PageSize   = _ctx.IntegerValue("ListPhoneNumbers.Data.PageSize");
            data.TotalCount = _ctx.IntegerValue("ListPhoneNumbers.Data.TotalCount");

            List <ListPhoneNumbersResponse.ListPhoneNumbers_Data.ListPhoneNumbers_PhoneNumber> data_list = new List <ListPhoneNumbersResponse.ListPhoneNumbers_Data.ListPhoneNumbers_PhoneNumber>();

            for (int i = 0; i < _ctx.Length("ListPhoneNumbers.Data.List.Length"); i++)
            {
                ListPhoneNumbersResponse.ListPhoneNumbers_Data.ListPhoneNumbers_PhoneNumber phoneNumber = new ListPhoneNumbersResponse.ListPhoneNumbers_Data.ListPhoneNumbers_PhoneNumber();
                phoneNumber.Active          = _ctx.BooleanValue("ListPhoneNumbers.Data.List[" + i + "].Active");
                phoneNumber.City            = _ctx.StringValue("ListPhoneNumbers.Data.List[" + i + "].City");
                phoneNumber.ContactFlowId   = _ctx.StringValue("ListPhoneNumbers.Data.List[" + i + "].ContactFlowId");
                phoneNumber.ContactFlowName = _ctx.StringValue("ListPhoneNumbers.Data.List[" + i + "].ContactFlowName");
                phoneNumber.InstanceId      = _ctx.StringValue("ListPhoneNumbers.Data.List[" + i + "].InstanceId");
                phoneNumber.Number          = _ctx.StringValue("ListPhoneNumbers.Data.List[" + i + "].Number");
                phoneNumber.Province        = _ctx.StringValue("ListPhoneNumbers.Data.List[" + i + "].Province");
                phoneNumber.Usage           = _ctx.StringValue("ListPhoneNumbers.Data.List[" + i + "].Usage");
                phoneNumber.UserId          = _ctx.StringValue("ListPhoneNumbers.Data.List[" + i + "].UserId");
                phoneNumber.Provider        = _ctx.StringValue("ListPhoneNumbers.Data.List[" + i + "].Provider");
                phoneNumber.Tags            = _ctx.StringValue("ListPhoneNumbers.Data.List[" + i + "].Tags");
                phoneNumber.CreateTime      = _ctx.StringValue("ListPhoneNumbers.Data.List[" + i + "].CreateTime");

                List <ListPhoneNumbersResponse.ListPhoneNumbers_Data.ListPhoneNumbers_PhoneNumber.ListPhoneNumbers_SkillGroup> phoneNumber_skillGroups = new List <ListPhoneNumbersResponse.ListPhoneNumbers_Data.ListPhoneNumbers_PhoneNumber.ListPhoneNumbers_SkillGroup>();
                for (int j = 0; j < _ctx.Length("ListPhoneNumbers.Data.List[" + i + "].SkillGroups.Length"); j++)
                {
                    ListPhoneNumbersResponse.ListPhoneNumbers_Data.ListPhoneNumbers_PhoneNumber.ListPhoneNumbers_SkillGroup skillGroup = new ListPhoneNumbersResponse.ListPhoneNumbers_Data.ListPhoneNumbers_PhoneNumber.ListPhoneNumbers_SkillGroup();
                    skillGroup.DisplayName  = _ctx.StringValue("ListPhoneNumbers.Data.List[" + i + "].SkillGroups[" + j + "].DisplayName");
                    skillGroup.InstanceId   = _ctx.StringValue("ListPhoneNumbers.Data.List[" + i + "].SkillGroups[" + j + "].InstanceId");
                    skillGroup.Name         = _ctx.StringValue("ListPhoneNumbers.Data.List[" + i + "].SkillGroups[" + j + "].Name");
                    skillGroup.SkillGroupId = _ctx.StringValue("ListPhoneNumbers.Data.List[" + i + "].SkillGroups[" + j + "].SkillGroupId");

                    phoneNumber_skillGroups.Add(skillGroup);
                }
                phoneNumber.SkillGroups = phoneNumber_skillGroups;

                data_list.Add(phoneNumber);
            }
            data.List = data_list;
            listPhoneNumbersResponse.Data = data;

            return(listPhoneNumbersResponse);
        }
Пример #4
0
        public static ListPhoneNumbersResponse Unmarshall(UnmarshallerContext context)
        {
            ListPhoneNumbersResponse listPhoneNumbersResponse = new ListPhoneNumbersResponse();

            listPhoneNumbersResponse.HttpResponse   = context.HttpResponse;
            listPhoneNumbersResponse.RequestId      = context.StringValue("ListPhoneNumbers.RequestId");
            listPhoneNumbersResponse.Success        = context.BooleanValue("ListPhoneNumbers.Success");
            listPhoneNumbersResponse.Code           = context.StringValue("ListPhoneNumbers.Code");
            listPhoneNumbersResponse.Message        = context.StringValue("ListPhoneNumbers.Message");
            listPhoneNumbersResponse.HttpStatusCode = context.IntegerValue("ListPhoneNumbers.HttpStatusCode");

            List <ListPhoneNumbersResponse.ListPhoneNumbers_PhoneNumber> listPhoneNumbersResponse_phoneNumbers = new List <ListPhoneNumbersResponse.ListPhoneNumbers_PhoneNumber>();

            for (int i = 0; i < context.Length("ListPhoneNumbers.PhoneNumbers.Length"); i++)
            {
                ListPhoneNumbersResponse.ListPhoneNumbers_PhoneNumber phoneNumber = new ListPhoneNumbersResponse.ListPhoneNumbers_PhoneNumber();
                phoneNumber.PhoneNumberId          = context.StringValue("ListPhoneNumbers.PhoneNumbers[" + i + "].PhoneNumberId");
                phoneNumber.InstanceId             = context.StringValue("ListPhoneNumbers.PhoneNumbers[" + i + "].InstanceId");
                phoneNumber.Number                 = context.StringValue("ListPhoneNumbers.PhoneNumbers[" + i + "].Number");
                phoneNumber.PhoneNumberDescription = context.StringValue("ListPhoneNumbers.PhoneNumbers[" + i + "].PhoneNumberDescription");
                phoneNumber.TestOnly               = context.BooleanValue("ListPhoneNumbers.PhoneNumbers[" + i + "].TestOnly");
                phoneNumber.RemainingTime          = context.IntegerValue("ListPhoneNumbers.PhoneNumbers[" + i + "].RemainingTime");
                phoneNumber.AllowOutbound          = context.BooleanValue("ListPhoneNumbers.PhoneNumbers[" + i + "].AllowOutbound");
                phoneNumber.Usage    = context.StringValue("ListPhoneNumbers.PhoneNumbers[" + i + "].Usage");
                phoneNumber.Trunks   = context.IntegerValue("ListPhoneNumbers.PhoneNumbers[" + i + "].Trunks");
                phoneNumber.Province = context.StringValue("ListPhoneNumbers.PhoneNumbers[" + i + "].Province");
                phoneNumber.City     = context.StringValue("ListPhoneNumbers.PhoneNumbers[" + i + "].City");

                ListPhoneNumbersResponse.ListPhoneNumbers_PhoneNumber.ListPhoneNumbers_ContactFlow contactFlow = new ListPhoneNumbersResponse.ListPhoneNumbers_PhoneNumber.ListPhoneNumbers_ContactFlow();
                contactFlow.ContactFlowId          = context.StringValue("ListPhoneNumbers.PhoneNumbers[" + i + "].ContactFlow.ContactFlowId");
                contactFlow.InstanceId             = context.StringValue("ListPhoneNumbers.PhoneNumbers[" + i + "].ContactFlow.InstanceId");
                contactFlow.ContactFlowName        = context.StringValue("ListPhoneNumbers.PhoneNumbers[" + i + "].ContactFlow.ContactFlowName");
                contactFlow.ContactFlowDescription = context.StringValue("ListPhoneNumbers.PhoneNumbers[" + i + "].ContactFlow.ContactFlowDescription");
                contactFlow.Type        = context.StringValue("ListPhoneNumbers.PhoneNumbers[" + i + "].ContactFlow.Type");
                phoneNumber.ContactFlow = contactFlow;

                listPhoneNumbersResponse_phoneNumbers.Add(phoneNumber);
            }
            listPhoneNumbersResponse.PhoneNumbers = listPhoneNumbersResponse_phoneNumbers;

            return(listPhoneNumbersResponse);
        }
Пример #5
0
        public static ListPhoneNumbersResponse Unmarshall(UnmarshallerContext context)
        {
            ListPhoneNumbersResponse listPhoneNumbersResponse = new ListPhoneNumbersResponse();

            listPhoneNumbersResponse.HttpResponse   = context.HttpResponse;
            listPhoneNumbersResponse.RequestId      = context.StringValue("ListPhoneNumbers.RequestId");
            listPhoneNumbersResponse.Success        = context.BooleanValue("ListPhoneNumbers.Success");
            listPhoneNumbersResponse.Code           = context.StringValue("ListPhoneNumbers.Code");
            listPhoneNumbersResponse.Message        = context.StringValue("ListPhoneNumbers.Message");
            listPhoneNumbersResponse.HttpStatusCode = context.IntegerValue("ListPhoneNumbers.HttpStatusCode");

            List <ListPhoneNumbersResponse.ListPhoneNumbers_PhoneNumber> listPhoneNumbersResponse_phoneNumbers = new List <ListPhoneNumbersResponse.ListPhoneNumbers_PhoneNumber>();

            for (int i = 0; i < context.Length("ListPhoneNumbers.PhoneNumbers.Length"); i++)
            {
                ListPhoneNumbersResponse.ListPhoneNumbers_PhoneNumber phoneNumber = new ListPhoneNumbersResponse.ListPhoneNumbers_PhoneNumber();
                phoneNumber.PhoneNumberId          = context.StringValue("ListPhoneNumbers.PhoneNumbers[" + i + "].PhoneNumberId");
                phoneNumber.InstanceId             = context.StringValue("ListPhoneNumbers.PhoneNumbers[" + i + "].InstanceId");
                phoneNumber.Number                 = context.StringValue("ListPhoneNumbers.PhoneNumbers[" + i + "].Number");
                phoneNumber.PhoneNumberDescription = context.StringValue("ListPhoneNumbers.PhoneNumbers[" + i + "].PhoneNumberDescription");
                phoneNumber.TestOnly               = context.BooleanValue("ListPhoneNumbers.PhoneNumbers[" + i + "].TestOnly");
                phoneNumber.RemainingTime          = context.IntegerValue("ListPhoneNumbers.PhoneNumbers[" + i + "].RemainingTime");
                phoneNumber.AllowOutbound          = context.BooleanValue("ListPhoneNumbers.PhoneNumbers[" + i + "].AllowOutbound");
                phoneNumber.Usage    = context.StringValue("ListPhoneNumbers.PhoneNumbers[" + i + "].Usage");
                phoneNumber.Trunks   = context.IntegerValue("ListPhoneNumbers.PhoneNumbers[" + i + "].Trunks");
                phoneNumber.Province = context.StringValue("ListPhoneNumbers.PhoneNumbers[" + i + "].Province");
                phoneNumber.City     = context.StringValue("ListPhoneNumbers.PhoneNumbers[" + i + "].City");
                phoneNumber.Assignee = context.StringValue("ListPhoneNumbers.PhoneNumbers[" + i + "].Assignee");

                ListPhoneNumbersResponse.ListPhoneNumbers_PhoneNumber.ListPhoneNumbers_ContactFlow contactFlow = new ListPhoneNumbersResponse.ListPhoneNumbers_PhoneNumber.ListPhoneNumbers_ContactFlow();
                contactFlow.ContactFlowId          = context.StringValue("ListPhoneNumbers.PhoneNumbers[" + i + "].ContactFlow.ContactFlowId");
                contactFlow.InstanceId             = context.StringValue("ListPhoneNumbers.PhoneNumbers[" + i + "].ContactFlow.InstanceId");
                contactFlow.ContactFlowName        = context.StringValue("ListPhoneNumbers.PhoneNumbers[" + i + "].ContactFlow.ContactFlowName");
                contactFlow.ContactFlowDescription = context.StringValue("ListPhoneNumbers.PhoneNumbers[" + i + "].ContactFlow.ContactFlowDescription");
                contactFlow.Type        = context.StringValue("ListPhoneNumbers.PhoneNumbers[" + i + "].ContactFlow.Type");
                phoneNumber.ContactFlow = contactFlow;

                ListPhoneNumbersResponse.ListPhoneNumbers_PhoneNumber.ListPhoneNumbers_PrivacyNumber privacyNumber = new ListPhoneNumbersResponse.ListPhoneNumbers_PhoneNumber.ListPhoneNumbers_PrivacyNumber();
                privacyNumber.PoolId         = context.StringValue("ListPhoneNumbers.PhoneNumbers[" + i + "].PrivacyNumber.PoolId");
                privacyNumber.Type           = context.StringValue("ListPhoneNumbers.PhoneNumbers[" + i + "].PrivacyNumber.Type");
                privacyNumber.TelX           = context.StringValue("ListPhoneNumbers.PhoneNumbers[" + i + "].PrivacyNumber.TelX");
                privacyNumber.PoolName       = context.StringValue("ListPhoneNumbers.PhoneNumbers[" + i + "].PrivacyNumber.PoolName");
                privacyNumber.PhoneNumber    = context.StringValue("ListPhoneNumbers.PhoneNumbers[" + i + "].PrivacyNumber.PhoneNumber");
                privacyNumber.Extra          = context.StringValue("ListPhoneNumbers.PhoneNumbers[" + i + "].PrivacyNumber.Extra");
                privacyNumber.BizId          = context.StringValue("ListPhoneNumbers.PhoneNumbers[" + i + "].PrivacyNumber.BizId");
                privacyNumber.SubId          = context.StringValue("ListPhoneNumbers.PhoneNumbers[" + i + "].PrivacyNumber.SubId");
                privacyNumber.RegionNameCity = context.StringValue("ListPhoneNumbers.PhoneNumbers[" + i + "].PrivacyNumber.RegionNameCity");
                phoneNumber.PrivacyNumber    = privacyNumber;

                List <ListPhoneNumbersResponse.ListPhoneNumbers_PhoneNumber.ListPhoneNumbers_SkillGroup> phoneNumber_skillGroups = new List <ListPhoneNumbersResponse.ListPhoneNumbers_PhoneNumber.ListPhoneNumbers_SkillGroup>();
                for (int j = 0; j < context.Length("ListPhoneNumbers.PhoneNumbers[" + i + "].SkillGroups.Length"); j++)
                {
                    ListPhoneNumbersResponse.ListPhoneNumbers_PhoneNumber.ListPhoneNumbers_SkillGroup skillGroup = new ListPhoneNumbersResponse.ListPhoneNumbers_PhoneNumber.ListPhoneNumbers_SkillGroup();
                    skillGroup.SkillGroupId   = context.StringValue("ListPhoneNumbers.PhoneNumbers[" + i + "].SkillGroups[" + j + "].SkillGroupId");
                    skillGroup.SkillGroupName = context.StringValue("ListPhoneNumbers.PhoneNumbers[" + i + "].SkillGroups[" + j + "].SkillGroupName");

                    phoneNumber_skillGroups.Add(skillGroup);
                }
                phoneNumber.SkillGroups = phoneNumber_skillGroups;

                listPhoneNumbersResponse_phoneNumbers.Add(phoneNumber);
            }
            listPhoneNumbersResponse.PhoneNumbers = listPhoneNumbersResponse_phoneNumbers;

            return(listPhoneNumbersResponse);
        }