| | | 1 | | |
| | | 2 | | |
| | | 3 | | /// <summary> |
| | | 4 | | /// Defines a rule for a named multipart part. |
| | | 5 | | /// </summary> |
| | | 6 | | [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = false, |
| | | 7 | | public sealed class KrPartAttribute : KestrunAnnotation |
| | | 8 | | { |
| | | 9 | | /// <summary> |
| | | 10 | | /// Gets or sets the description of the part. |
| | | 11 | | /// </summary> |
| | 37 | 12 | | public string? Description { get; set; } |
| | | 13 | | |
| | | 14 | | /// <summary> |
| | | 15 | | /// Gets or sets a value indicating whether the part is required. |
| | | 16 | | /// </summary> |
| | 94 | 17 | | public bool Required { get; set; } |
| | | 18 | | |
| | | 19 | | /// <summary> |
| | | 20 | | /// Gets or sets a value indicating whether multiple parts with the same name are allowed. |
| | | 21 | | /// </summary> |
| | 87 | 22 | | public bool AllowMultiple { get; set; } = true; |
| | | 23 | | |
| | | 24 | | /// <summary> |
| | | 25 | | /// Gets or sets the allowed content types for the part. |
| | | 26 | | /// </summary> |
| | 192 | 27 | | public string[] ContentTypes { get; set; } = []; |
| | | 28 | | |
| | | 29 | | /// <summary> |
| | | 30 | | /// Gets or sets the allowed file extensions for file parts. |
| | | 31 | | /// </summary> |
| | 86 | 32 | | public string[] Extensions { get; set; } = []; |
| | | 33 | | |
| | | 34 | | /// <summary> |
| | | 35 | | /// Gets or sets the maximum number of bytes allowed for the part. |
| | | 36 | | /// </summary> |
| | 113 | 37 | | public long MaxBytes { get; set; } |
| | | 38 | | |
| | | 39 | | /// <summary> |
| | | 40 | | /// Gets or sets the decode mode for the part. |
| | | 41 | | /// </summary> |
| | 37 | 42 | | public KrPartDecodeMode DecodeMode { get; set; } = KrPartDecodeMode.None; |
| | | 43 | | |
| | | 44 | | /// <summary> |
| | | 45 | | /// Gets or sets the destination path override for the part. |
| | | 46 | | /// </summary> |
| | 37 | 47 | | public string? DestinationPath { get; set; } |
| | | 48 | | |
| | | 49 | | /// <summary> |
| | | 50 | | /// Gets or sets a value indicating whether the part should be stored to disk. |
| | | 51 | | /// </summary> |
| | 86 | 52 | | public bool StoreToDisk { get; set; } = true; |
| | | 53 | | } |
| | | 54 | | |
| | | 55 | | /// <summary> |
| | | 56 | | /// Represents decode mode options for parts (scaffold only). |
| | | 57 | | /// </summary> |
| | | 58 | | public enum KrPartDecodeMode |
| | | 59 | | { |
| | | 60 | | /// <summary> |
| | | 61 | | /// No decoding. |
| | | 62 | | /// </summary> |
| | | 63 | | None, |
| | | 64 | | |
| | | 65 | | /// <summary> |
| | | 66 | | /// Decode as UTF-8 text. |
| | | 67 | | /// </summary> |
| | | 68 | | TextUtf8, |
| | | 69 | | |
| | | 70 | | /// <summary> |
| | | 71 | | /// Decode as JSON (placeholder). |
| | | 72 | | /// </summary> |
| | | 73 | | Json, |
| | | 74 | | |
| | | 75 | | /// <summary> |
| | | 76 | | /// Decode as Base64 (placeholder). |
| | | 77 | | /// </summary> |
| | | 78 | | Base64, |
| | | 79 | | |
| | | 80 | | /// <summary> |
| | | 81 | | /// Decode as Base64 URL (placeholder). |
| | | 82 | | /// </summary> |
| | | 83 | | Base64Url |
| | | 84 | | } |