internal ModelOperationInfo(string operationId, DocumentOperationStatus status, int? percentCompleted, DateTimeOffset createdOn, DateTimeOffset lastUpdatedOn, DocumentOperationKind kind, string resourceLocation) { OperationId = operationId; Status = status; PercentCompleted = percentCompleted; CreatedOn = createdOn; LastUpdatedOn = lastUpdatedOn; Kind = kind; ResourceLocation = resourceLocation; }
internal static ModelOperationInfo DeserializeModelOperationInfo(JsonElement element) { string operationId = default; DocumentOperationStatus status = default; Optional <int> percentCompleted = default; DateTimeOffset createdDateTime = default; DateTimeOffset lastUpdatedDateTime = default; DocumentOperationKind kind = default; string resourceLocation = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("operationId")) { operationId = property.Value.GetString(); continue; } if (property.NameEquals("status")) { status = property.Value.GetString().ToDocumentOperationStatus(); continue; } if (property.NameEquals("percentCompleted")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } percentCompleted = property.Value.GetInt32(); continue; } if (property.NameEquals("createdDateTime")) { createdDateTime = property.Value.GetDateTimeOffset("O"); continue; } if (property.NameEquals("lastUpdatedDateTime")) { lastUpdatedDateTime = property.Value.GetDateTimeOffset("O"); continue; } if (property.NameEquals("kind")) { kind = new DocumentOperationKind(property.Value.GetString()); continue; } if (property.NameEquals("resourceLocation")) { resourceLocation = property.Value.GetString(); continue; } } return(new ModelOperationInfo(operationId, status, Optional.ToNullable(percentCompleted), createdDateTime, lastUpdatedDateTime, kind, resourceLocation)); }
internal ModelOperationInfo(string operationId, DocumentOperationStatus status, int?percentCompleted, DateTimeOffset createdOn, DateTimeOffset lastUpdatedOn, DocumentOperationKind kind, string resourceLocation, string apiVersion, IReadOnlyDictionary <string, string> tags) { OperationId = operationId; Status = status; PercentCompleted = percentCompleted; CreatedOn = createdOn; LastUpdatedOn = lastUpdatedOn; Kind = kind; ResourceLocation = resourceLocation; ApiVersion = apiVersion; Tags = tags; }
internal ModelOperationInfo(string operationId, DocumentOperationStatus status, DateTimeOffset createdOn, DateTimeOffset lastUpdatedOn, DocumentOperationKind kind, string resourceLocation) { if (operationId == null) { throw new ArgumentNullException(nameof(operationId)); } if (resourceLocation == null) { throw new ArgumentNullException(nameof(resourceLocation)); } OperationId = operationId; Status = status; CreatedOn = createdOn; LastUpdatedOn = lastUpdatedOn; Kind = kind; ResourceLocation = resourceLocation; }
/// <summary> /// Initializes a new instance of ModelOperation. Used by the <see cref="DocumentAnalysisModelFactory"/>. /// </summary> internal ModelOperation(string operationId, DocumentOperationStatus status, int?percentCompleted, DateTimeOffset createdOn, DateTimeOffset lastUpdatedOn, DocumentOperationKind kind, string resourceLocation, string apiVersion, IReadOnlyDictionary <string, string> tags, ResponseError error, DocumentModel result) : base(operationId, status, percentCompleted, createdOn, lastUpdatedOn, kind, resourceLocation, apiVersion, tags) { _mockError = error; Result = result; }
internal static ModelOperation DeserializeModelOperation(JsonElement element) { Optional <JsonElement> error = default; Optional <DocumentModel> result = default; string operationId = default; DocumentOperationStatus status = default; Optional <int> percentCompleted = default; DateTimeOffset createdDateTime = default; DateTimeOffset lastUpdatedDateTime = default; DocumentOperationKind kind = default; string resourceLocation = default; Optional <string> apiVersion = default; Optional <IReadOnlyDictionary <string, string> > tags = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("error")) { error = property.Value.Clone(); continue; } if (property.NameEquals("result")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } result = DocumentModel.DeserializeDocumentModel(property.Value); continue; } if (property.NameEquals("operationId")) { operationId = property.Value.GetString(); continue; } if (property.NameEquals("status")) { status = property.Value.GetString().ToDocumentOperationStatus(); continue; } if (property.NameEquals("percentCompleted")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } percentCompleted = property.Value.GetInt32(); continue; } if (property.NameEquals("createdDateTime")) { createdDateTime = property.Value.GetDateTimeOffset("O"); continue; } if (property.NameEquals("lastUpdatedDateTime")) { lastUpdatedDateTime = property.Value.GetDateTimeOffset("O"); continue; } if (property.NameEquals("kind")) { kind = new DocumentOperationKind(property.Value.GetString()); continue; } if (property.NameEquals("resourceLocation")) { resourceLocation = property.Value.GetString(); continue; } if (property.NameEquals("apiVersion")) { apiVersion = property.Value.GetString(); continue; } if (property.NameEquals("tags")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } Dictionary <string, string> dictionary = new Dictionary <string, string>(); foreach (var property0 in property.Value.EnumerateObject()) { dictionary.Add(property0.Name, property0.Value.GetString()); } tags = dictionary; continue; } } return(new ModelOperation(operationId, status, Optional.ToNullable(percentCompleted), createdDateTime, lastUpdatedDateTime, kind, resourceLocation, apiVersion.Value, Optional.ToDictionary(tags), error, result.Value)); }
internal ModelOperation(string operationId, DocumentOperationStatus status, DateTimeOffset createdOn, DateTimeOffset lastUpdatedOn, DocumentOperationKind kind, string resourceLocation) : base(operationId, status, createdOn, lastUpdatedOn, kind, resourceLocation) { if (operationId == null) { throw new ArgumentNullException(nameof(operationId)); } if (resourceLocation == null) { throw new ArgumentNullException(nameof(resourceLocation)); } }
internal ModelOperation(string operationId, DocumentOperationStatus status, int?percentCompleted, DateTimeOffset createdOn, DateTimeOffset lastUpdatedOn, DocumentOperationKind kind, string resourceLocation, JsonElement error, DocumentModel result) : base(operationId, status, percentCompleted, createdOn, lastUpdatedOn, kind, resourceLocation) { _error = error; Result = result; }