File size: 1,485 Bytes
8c763fb | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | // Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
#nullable enable
using System.Collections.Generic;
namespace Microsoft.PowerShell.Commands
{
/// <summary>
/// FormObject used in HtmlWebResponseObject.
/// </summary>
public class FormObject
{
/// <summary>
/// Gets the Id property.
/// </summary>
public string Id { get; }
/// <summary>
/// Gets the Method property.
/// </summary>
public string Method { get; }
/// <summary>
/// Gets the Action property.
/// </summary>
public string Action { get; }
/// <summary>
/// Gets the Fields property.
/// </summary>
public Dictionary<string, string> Fields { get; }
/// <summary>
/// Initializes a new instance of the <see cref="FormObject"/> class.
/// </summary>
/// <param name="id"></param>
/// <param name="method"></param>
/// <param name="action"></param>
public FormObject(string id, string method, string action)
{
Id = id;
Method = method;
Action = action;
Fields = new Dictionary<string, string>();
}
internal void AddField(string key, string value)
{
if (key is not null && !Fields.TryGetValue(key, out string? _))
{
Fields[key] = value;
}
}
}
}
|