コード例 #1
0
 internal USProgramBrief(Guid id, ProgramBriefStatus?status, string number, IList <ReviewNote> reviewNotes, IList <ShortCodeCost> costs, DateTimeOffset?submissionDate, DateTimeOffset?statusUpdatedDate, ProgramDetails programDetails, CompanyInformation companyInformation, MessageDetails messageDetails, TrafficDetails trafficDetails)
 {
     Id                 = id;
     Status             = status;
     Number             = number;
     ReviewNotes        = reviewNotes;
     Costs              = costs;
     SubmissionDate     = submissionDate;
     StatusUpdatedDate  = statusUpdatedDate;
     ProgramDetails     = programDetails;
     CompanyInformation = companyInformation;
     MessageDetails     = messageDetails;
     TrafficDetails     = trafficDetails;
 }
コード例 #2
0
        internal static USProgramBrief DeserializeUSProgramBrief(JsonElement element)
        {
            Guid id = default;
            Optional <ProgramBriefStatus>     status             = default;
            Optional <string>                 number             = default;
            Optional <IList <ReviewNote> >    reviewNotes        = default;
            Optional <IList <ShortCodeCost> > costs              = default;
            Optional <DateTimeOffset>         submissionDate     = default;
            Optional <DateTimeOffset>         statusUpdatedDate  = default;
            Optional <ProgramDetails>         programDetails     = default;
            Optional <CompanyInformation>     companyInformation = default;
            Optional <MessageDetails>         messageDetails     = default;
            Optional <TrafficDetails>         trafficDetails     = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("id"))
                {
                    id = property.Value.GetGuid();
                    continue;
                }
                if (property.NameEquals("status"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    status = new ProgramBriefStatus(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("number"))
                {
                    number = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("reviewNotes"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <ReviewNote> array = new List <ReviewNote>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(ReviewNote.DeserializeReviewNote(item));
                    }
                    reviewNotes = array;
                    continue;
                }
                if (property.NameEquals("costs"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <ShortCodeCost> array = new List <ShortCodeCost>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(ShortCodeCost.DeserializeShortCodeCost(item));
                    }
                    costs = array;
                    continue;
                }
                if (property.NameEquals("submissionDate"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    submissionDate = property.Value.GetDateTimeOffset("O");
                    continue;
                }
                if (property.NameEquals("statusUpdatedDate"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    statusUpdatedDate = property.Value.GetDateTimeOffset("O");
                    continue;
                }
                if (property.NameEquals("programDetails"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    programDetails = ProgramDetails.DeserializeProgramDetails(property.Value);
                    continue;
                }
                if (property.NameEquals("companyInformation"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    companyInformation = CompanyInformation.DeserializeCompanyInformation(property.Value);
                    continue;
                }
                if (property.NameEquals("messageDetails"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    messageDetails = MessageDetails.DeserializeMessageDetails(property.Value);
                    continue;
                }
                if (property.NameEquals("trafficDetails"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    trafficDetails = TrafficDetails.DeserializeTrafficDetails(property.Value);
                    continue;
                }
            }
            return(new USProgramBrief(id, Optional.ToNullable(status), number.Value, Optional.ToList(reviewNotes), Optional.ToList(costs), Optional.ToNullable(submissionDate), Optional.ToNullable(statusUpdatedDate), programDetails.Value, companyInformation.Value, messageDetails.Value, trafficDetails.Value));
        }