Class UpdatePermissionsRequestItem
- Namespace
- Mailtrap.AccountAccesses.Requests
- Assembly
- Mailtrap.Abstractions.dll
Represents permissions details for account access update request.
public sealed record UpdatePermissionsRequestItem : IValidatable, IEquatable<UpdatePermissionsRequestItem>
- Inheritance
-
UpdatePermissionsRequestItem
- Implements
Constructors
UpdatePermissionsRequestItem(long, ResourceType, AccessLevel, bool)
Primary instance constructor.
public UpdatePermissionsRequestItem(long resourceId, ResourceType resourceType, AccessLevel accessLevel, bool revokePermissions = false)
Parameters
resourceIdlongID of the resource to update permissions for.
resourceTypeResourceTypeType of the resource to update permissions for.
accessLevelAccessLevelTarget access level for the resource.
revokePermissionsboolIf set to true will completely revoke access permissions from the resource, instead of update.
Exceptions
- ArgumentNullException
When
resourceTypeis null.- ArgumentOutOfRangeException
When
resourceIdis less than or equal to zero.
Properties
AccessLevel
Gets the resource access level.
[JsonPropertyName("access_level")]
[JsonPropertyOrder(3)]
public AccessLevel AccessLevel { get; }
Property Value
- AccessLevel
Access level for resource.
Remarks
ResourceId
Gets the resource identifier.
[JsonPropertyName("resource_id")]
[JsonPropertyOrder(1)]
public long ResourceId { get; }
Property Value
- long
Resource identifier.
ResourceType
Gets the resource type.
[JsonPropertyName("resource_type")]
[JsonPropertyOrder(2)]
public ResourceType ResourceType { get; }
Property Value
- ResourceType
Resource type.
Revoke
Gets the flag indicating whether to revoke resource permissions.
If set to true will completely revoke access permissions from the resource, instead of update.
[JsonPropertyName("_destroy")]
[JsonPropertyOrder(4)]
public bool Revoke { get; }
Property Value
Remarks
Has a priority over AccessLevel.
If set to true, the AccessLevel value will be ignored.
Methods
Validate()
Validates the current instance.
public ValidationResult Validate()
Returns
- ValidationResult
Object containing validation errors, if any.