|
| 1 | +/* |
| 2 | + * Copyright 2025 Google LLC |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * https://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + */ |
| 16 | + |
| 17 | +// Auto-generated code. Do not edit. |
| 18 | + |
| 19 | +using System; |
| 20 | +using System.Text.Json; |
| 21 | +using System.Text.Json.Serialization; |
| 22 | +using Google.GenAI.Serialization; |
| 23 | + |
| 24 | +namespace Google.GenAI.Types { |
| 25 | + /// <summary> |
| 26 | + /// Media resolution for the input media. |
| 27 | + /// </summary> |
| 28 | + |
| 29 | + public record PartMediaResolution { |
| 30 | + /// <summary> |
| 31 | + /// The tokenization quality used for given media. |
| 32 | + /// </summary> |
| 33 | + [JsonPropertyName("level")] |
| 34 | + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] |
| 35 | + public PartMediaResolutionLevel ? Level { get; set; } |
| 36 | + |
| 37 | + /// <summary> |
| 38 | + /// Specifies the required sequence length for media tokenization. |
| 39 | + /// </summary> |
| 40 | + [JsonPropertyName("numTokens")] |
| 41 | + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] |
| 42 | + public int |
| 43 | + ? NumTokens { |
| 44 | + get; set; |
| 45 | + } |
| 46 | + |
| 47 | + /// <summary> |
| 48 | + /// Deserializes a JSON string to a PartMediaResolution object. |
| 49 | + /// </summary> |
| 50 | + /// <param name="jsonString">The JSON string to deserialize.</param> |
| 51 | + /// <param name="options">Optional JsonSerializerOptions.</param> |
| 52 | + /// <returns>The deserialized PartMediaResolution object, or null if deserialization |
| 53 | + /// fails.</returns> |
| 54 | + public static PartMediaResolution |
| 55 | + ? FromJson(string jsonString, JsonSerializerOptions? options = null) { |
| 56 | + try { |
| 57 | + return JsonSerializer.Deserialize<PartMediaResolution>(jsonString, options); |
| 58 | + } catch (JsonException e) { |
| 59 | + Console.Error.WriteLine($"Error deserializing JSON: {e.ToString()}"); |
| 60 | + return null; |
| 61 | + } |
| 62 | + } |
| 63 | + } |
| 64 | +} |
0 commit comments