Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable-WriteCore-for-Azure.AI.Translation.Document-2 #47055

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions sdk/translation/Azure.AI.Translation.Document/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

### Features Added

- Exposed `JsonModelWriteCore` for model serialization procedure.

### Breaking Changes

### Bugs Fixed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ internal DocumentStatusResult() { }
public System.Uri TranslatedDocumentUri { get { throw null; } }
public string TranslatedToLanguageCode { get { throw null; } }
public float TranslationProgressPercentage { get { throw null; } }
protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { }
Azure.AI.Translation.Document.DocumentStatusResult System.ClientModel.Primitives.IJsonModel<Azure.AI.Translation.Document.DocumentStatusResult>.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
void System.ClientModel.Primitives.IJsonModel<Azure.AI.Translation.Document.DocumentStatusResult>.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { }
Azure.AI.Translation.Document.DocumentStatusResult System.ClientModel.Primitives.IPersistableModel<Azure.AI.Translation.Document.DocumentStatusResult>.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
Expand All @@ -35,8 +36,9 @@ public DocumentTranslateContent(Azure.AI.Translation.Document.MultipartFormFileD
public DocumentTranslateContent(Azure.AI.Translation.Document.MultipartFormFileData document, System.Collections.Generic.IList<Azure.AI.Translation.Document.MultipartFormFileData> glossaries) { }
public Azure.AI.Translation.Document.MultipartFormFileData MultipartDocument { get { throw null; } }
public System.Collections.Generic.IList<Azure.AI.Translation.Document.MultipartFormFileData> MultipartGlossary { get { throw null; } }
void global::System.ClientModel.Primitives.IJsonModel<Azure.AI.Translation.Document.DocumentTranslateContent>.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { }
protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { }
Azure.AI.Translation.Document.DocumentTranslateContent System.ClientModel.Primitives.IJsonModel<Azure.AI.Translation.Document.DocumentTranslateContent>.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
void System.ClientModel.Primitives.IJsonModel<Azure.AI.Translation.Document.DocumentTranslateContent>.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { }
Azure.AI.Translation.Document.DocumentTranslateContent System.ClientModel.Primitives.IPersistableModel<Azure.AI.Translation.Document.DocumentTranslateContent>.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
string System.ClientModel.Primitives.IPersistableModel<Azure.AI.Translation.Document.DocumentTranslateContent>.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
System.BinaryData System.ClientModel.Primitives.IPersistableModel<Azure.AI.Translation.Document.DocumentTranslateContent>.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
Expand Down Expand Up @@ -129,6 +131,7 @@ internal DocumentTranslationFileFormat() { }
public string Format { get { throw null; } }
public System.Collections.Generic.IReadOnlyList<string> FormatVersions { get { throw null; } }
public Azure.AI.Translation.Document.FileFormatType? Type { get { throw null; } }
protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { }
Azure.AI.Translation.Document.DocumentTranslationFileFormat System.ClientModel.Primitives.IJsonModel<Azure.AI.Translation.Document.DocumentTranslationFileFormat>.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
void System.ClientModel.Primitives.IJsonModel<Azure.AI.Translation.Document.DocumentTranslationFileFormat>.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { }
Azure.AI.Translation.Document.DocumentTranslationFileFormat System.ClientModel.Primitives.IPersistableModel<Azure.AI.Translation.Document.DocumentTranslationFileFormat>.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
Expand All @@ -143,6 +146,7 @@ public DocumentTranslationInput(System.Uri sourceUri, System.Uri targetUri, stri
public Azure.AI.Translation.Document.StorageInputUriKind? StorageUriKind { get { throw null; } set { } }
public System.Collections.Generic.IList<Azure.AI.Translation.Document.TranslationTarget> Targets { get { throw null; } }
public void AddTarget(System.Uri targetUri, string languageCode, Azure.AI.Translation.Document.TranslationGlossary glossary = null, string categoryId = null) { }
protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { }
Azure.AI.Translation.Document.DocumentTranslationInput System.ClientModel.Primitives.IJsonModel<Azure.AI.Translation.Document.DocumentTranslationInput>.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
void System.ClientModel.Primitives.IJsonModel<Azure.AI.Translation.Document.DocumentTranslationInput>.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { }
Azure.AI.Translation.Document.DocumentTranslationInput System.ClientModel.Primitives.IPersistableModel<Azure.AI.Translation.Document.DocumentTranslationInput>.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
Expand Down Expand Up @@ -285,6 +289,7 @@ public partial class SupportedFileFormats : System.ClientModel.Primitives.IJsonM
{
internal SupportedFileFormats() { }
public System.Collections.Generic.IReadOnlyList<Azure.AI.Translation.Document.DocumentTranslationFileFormat> Value { get { throw null; } }
protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { }
Azure.AI.Translation.Document.SupportedFileFormats System.ClientModel.Primitives.IJsonModel<Azure.AI.Translation.Document.SupportedFileFormats>.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
void System.ClientModel.Primitives.IJsonModel<Azure.AI.Translation.Document.SupportedFileFormats>.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { }
Azure.AI.Translation.Document.SupportedFileFormats System.ClientModel.Primitives.IPersistableModel<Azure.AI.Translation.Document.SupportedFileFormats>.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
Expand All @@ -295,6 +300,7 @@ public partial class TranslationBatch : System.ClientModel.Primitives.IJsonModel
{
public TranslationBatch(System.Collections.Generic.IEnumerable<Azure.AI.Translation.Document.DocumentTranslationInput> inputs) { }
public System.Collections.Generic.IList<Azure.AI.Translation.Document.DocumentTranslationInput> Inputs { get { throw null; } }
protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { }
Azure.AI.Translation.Document.TranslationBatch System.ClientModel.Primitives.IJsonModel<Azure.AI.Translation.Document.TranslationBatch>.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
void System.ClientModel.Primitives.IJsonModel<Azure.AI.Translation.Document.TranslationBatch>.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { }
Azure.AI.Translation.Document.TranslationBatch System.ClientModel.Primitives.IPersistableModel<Azure.AI.Translation.Document.TranslationBatch>.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
Expand All @@ -318,6 +324,7 @@ public TranslationGlossary(System.Uri glossaryUri, string format) { }
public string FormatVersion { get { throw null; } set { } }
public System.Uri GlossaryUri { get { throw null; } }
public Azure.AI.Translation.Document.TranslationStorageSource? StorageSource { get { throw null; } set { } }
protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { }
Azure.AI.Translation.Document.TranslationGlossary System.ClientModel.Primitives.IJsonModel<Azure.AI.Translation.Document.TranslationGlossary>.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
void System.ClientModel.Primitives.IJsonModel<Azure.AI.Translation.Document.TranslationGlossary>.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { }
Azure.AI.Translation.Document.TranslationGlossary System.ClientModel.Primitives.IPersistableModel<Azure.AI.Translation.Document.TranslationGlossary>.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
Expand All @@ -333,6 +340,7 @@ public TranslationSource(System.Uri sourceUri, string languageCode = null, strin
public System.Uri SourceUri { get { throw null; } }
public Azure.AI.Translation.Document.TranslationStorageSource? StorageSource { get { throw null; } set { } }
public string Suffix { get { throw null; } set { } }
protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { }
Azure.AI.Translation.Document.TranslationSource System.ClientModel.Primitives.IJsonModel<Azure.AI.Translation.Document.TranslationSource>.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
void System.ClientModel.Primitives.IJsonModel<Azure.AI.Translation.Document.TranslationSource>.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { }
Azure.AI.Translation.Document.TranslationSource System.ClientModel.Primitives.IPersistableModel<Azure.AI.Translation.Document.TranslationSource>.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
Expand All @@ -354,6 +362,7 @@ internal TranslationStatusResult() { }
public System.DateTimeOffset LastModified { get { throw null; } }
public Azure.AI.Translation.Document.DocumentTranslationStatus Status { get { throw null; } }
public long TotalCharactersCharged { get { throw null; } }
protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { }
Azure.AI.Translation.Document.TranslationStatusResult System.ClientModel.Primitives.IJsonModel<Azure.AI.Translation.Document.TranslationStatusResult>.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
void System.ClientModel.Primitives.IJsonModel<Azure.AI.Translation.Document.TranslationStatusResult>.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { }
Azure.AI.Translation.Document.TranslationStatusResult System.ClientModel.Primitives.IPersistableModel<Azure.AI.Translation.Document.TranslationStatusResult>.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
Expand Down Expand Up @@ -385,6 +394,7 @@ public TranslationTarget(System.Uri targetUri, string languageCode) { }
public string LanguageCode { get { throw null; } }
public Azure.AI.Translation.Document.TranslationStorageSource? StorageSource { get { throw null; } set { } }
public System.Uri TargetUri { get { throw null; } }
protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { }
Azure.AI.Translation.Document.TranslationTarget System.ClientModel.Primitives.IJsonModel<Azure.AI.Translation.Document.TranslationTarget>.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
void System.ClientModel.Primitives.IJsonModel<Azure.AI.Translation.Document.TranslationTarget>.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { }
Azure.AI.Translation.Document.TranslationTarget System.ClientModel.Primitives.IPersistableModel<Azure.AI.Translation.Document.TranslationTarget>.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,16 @@ internal virtual MultipartFormDataRequestContent ToMultipartRequestContent()
return content;
}

void global::System.ClientModel.Primitives.IJsonModel<global::Azure.AI.Translation.Document.DocumentTranslateContent>.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options)
/// <param name="writer"> The JSON writer. </param>
/// <param name="options"> The client options for reading and writing models. </param>
protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options)
{
var format = options.Format == "W" ? ((IPersistableModel<DocumentTranslateContent>)this).GetFormatFromOptions(options) : options.Format;
if (format != "J")
{
throw new FormatException($"The model {nameof(DocumentTranslateContent)} does not support writing '{format}' format.");
}

writer.WriteStartObject();
writer.WritePropertyName("document"u8);
#if NET6_0_OR_GREATER
writer.WriteRawValue(global::System.BinaryData.FromStream(Document));
Expand Down Expand Up @@ -82,7 +83,6 @@ internal virtual MultipartFormDataRequestContent ToMultipartRequestContent()
#endif
}
}
writer.WriteEndObject();
}

internal static DocumentTranslateContent DeserializeDocumentTranslateContent(JsonElement element, ModelReaderWriterOptions options = null)
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading