示例#1
0
        internal static PhoneNumberOperation DeserializePhoneNumberOperation(JsonElement element)
        {
            PhoneNumberOperationStatus    status           = default;
            Optional <string>             resourceLocation = default;
            DateTimeOffset                createdDateTime  = default;
            Optional <CommunicationError> error            = default;
            string id = default;
            PhoneNumberOperationType  operationType      = default;
            Optional <DateTimeOffset> lastActionDateTime = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("status"))
                {
                    status = new PhoneNumberOperationStatus(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("resourceLocation"))
                {
                    resourceLocation = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("createdDateTime"))
                {
                    createdDateTime = property.Value.GetDateTimeOffset("O");
                    continue;
                }
                if (property.NameEquals("error"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    error = CommunicationError.DeserializeCommunicationError(property.Value);
                    continue;
                }
                if (property.NameEquals("id"))
                {
                    id = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("operationType"))
                {
                    operationType = new PhoneNumberOperationType(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("lastActionDateTime"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    lastActionDateTime = property.Value.GetDateTimeOffset("O");
                    continue;
                }
            }
            return(new PhoneNumberOperation(status, resourceLocation.Value, createdDateTime, error.Value, id, operationType, Optional.ToNullable(lastActionDateTime)));
        }
示例#2
0
 internal PhoneNumberOperation(PhoneNumberOperationStatus status, string resourceLocation, DateTimeOffset createdDateTime, CommunicationError error, string id, PhoneNumberOperationType operationType, DateTimeOffset?lastActionDateTime)
 {
     Status           = status;
     ResourceLocation = resourceLocation;
     CreatedDateTime  = createdDateTime;
     Error            = error;
     Id                 = id;
     OperationType      = operationType;
     LastActionDateTime = lastActionDateTime;
 }
示例#3
0
        internal PhoneNumberOperation(PhoneNumberOperationStatus status, DateTimeOffset createdDateTime, string id, PhoneNumberOperationType operationType)
        {
            if (id == null)
            {
                throw new ArgumentNullException(nameof(id));
            }

            Status          = status;
            CreatedDateTime = createdDateTime;
            Id            = id;
            OperationType = operationType;
        }