internal Option(string displayName, int addressId, AddressType? addressType, Model.Link[] links)
        {
            if (string.IsNullOrWhiteSpace(displayName)) throw new ArgumentNullException("displayName");
            if (links == null) throw new ArgumentNullException("links");

            DisplayName = displayName;
            AddressId = addressId;
            AddressType = addressType;
            
            var newLinks = new List<Model.Link>();

            foreach (Model.Link link in links)
            {
                Model.Link newLink;

                switch (link.Rel)
                {
                    case "next":
                        newLink = new Model.PostcodeLookup.Link(link.Rel, link.Href);
                        break;
                    default:
                        newLink = link;
                        break;
                }

                newLinks.Add(newLink);
            }

            Links = newLinks.ToArray();
        }
        internal Response(ReturnCode result,
                          string postcode,
                          int? addressId,
                          AddressType? addressType,
                          MatchLevel matchLevel,
                          string[] postalAddress,
                          AddressElement[] postalAddressElements,
                          string[] geographicAddress,
                          AddressElement[] geographicAddressElements,
                          string[] vanityAddress,
                          AddressElement[] vanityAddressElements,
                          ReformattedAddressResult? reformattedAddressResult,
                          string[] reformattedAddress,
                          int totalOptions,
                          Option[] options,
                          Request input,
                          Model.Link[] links
            )
        {
            if (links == null) throw new ArgumentNullException("links");

            Result = result;
            Postcode = postcode;
            AddressId = addressId;
            AddressType = addressType;
            MatchLevel = matchLevel;
            PostalAddress = postalAddress;
            PostalAddressElements = postalAddressElements;
            GeographicAddress = geographicAddress;
            GeographicAddressElements = geographicAddressElements;
            VanityAddress = vanityAddress;
            VanityAddressElements = vanityAddressElements;
            ReformattedAddressResult = reformattedAddressResult;
            ReformattedAddress = reformattedAddress;
            TotalOptions = totalOptions;
            Options = options;
            Input = input;

            var newLinks = new List<Model.Link>();

            foreach (Model.Link link in links)
            {
                Model.Link newLink;

                switch (link.Rel)
                {
                    case "self":
                        newLink = new Model.PostcodeLookup.Link(link.Rel, link.Href);
                        break;
                    default:
                        newLink = link;
                        break;
                }

                newLinks.Add(newLink);
            }

            Links = newLinks.ToArray();
        }
Exemplo n.º 3
0
        internal Option(string displayName, int addressId, AddressType?addressType, Model.Link[] links)
        {
            if (string.IsNullOrWhiteSpace(displayName))
            {
                throw new ArgumentNullException("displayName");
            }
            if (links == null)
            {
                throw new ArgumentNullException("links");
            }

            DisplayName = displayName;
            AddressId   = addressId;
            AddressType = addressType;

            var newLinks = new List <Model.Link>();

            foreach (Model.Link link in links)
            {
                Model.Link newLink;

                switch (link.Rel)
                {
                case "next":
                    newLink = new Model.PostcodeLookup.Link(link.Rel, link.Href);
                    break;

                default:
                    newLink = link;
                    break;
                }

                newLinks.Add(newLink);
            }

            Links = newLinks.ToArray();
        }
Exemplo n.º 4
0
        internal Response(ReturnCode result,
                          string postcode,
                          int?addressId,
                          AddressType?addressType,
                          MatchLevel matchLevel,
                          string[] postalAddress,
                          AddressElement[] postalAddressElements,
                          string[] geographicAddress,
                          AddressElement[] geographicAddressElements,
                          string[] vanityAddress,
                          AddressElement[] vanityAddressElements,
                          ReformattedAddressResult?reformattedAddressResult,
                          string[] reformattedAddress,
                          int totalOptions,
                          Option[] options,
                          Request input,
                          Model.Link[] links
                          )
        {
            if (links == null)
            {
                throw new ArgumentNullException("links");
            }

            Result                    = result;
            Postcode                  = postcode;
            AddressId                 = addressId;
            AddressType               = addressType;
            MatchLevel                = matchLevel;
            PostalAddress             = postalAddress;
            PostalAddressElements     = postalAddressElements;
            GeographicAddress         = geographicAddress;
            GeographicAddressElements = geographicAddressElements;
            VanityAddress             = vanityAddress;
            VanityAddressElements     = vanityAddressElements;
            ReformattedAddressResult  = reformattedAddressResult;
            ReformattedAddress        = reformattedAddress;
            TotalOptions              = totalOptions;
            Options                   = options;
            Input = input;

            var newLinks = new List <Model.Link>();

            foreach (Model.Link link in links)
            {
                Model.Link newLink;

                switch (link.Rel)
                {
                case "self":
                    newLink = new Model.PostcodeLookup.Link(link.Rel, link.Href);
                    break;

                default:
                    newLink = link;
                    break;
                }

                newLinks.Add(newLink);
            }

            Links = newLinks.ToArray();
        }