Table of Contents

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

resourceId long

ID of the resource to update permissions for.

resourceType ResourceType

Type of the resource to update permissions for.

accessLevel AccessLevel

Target access level for the resource.

Allowed values: Viewer or Admin

revokePermissions bool

If set to true will completely revoke access permissions from the resource, instead of update.

Exceptions

ArgumentNullException

When resourceType is null.

ArgumentOutOfRangeException

When resourceId is 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

Allowed values: Viewer or Admin

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

bool

true means a revocation of access permissions from the resource, instead of updating them.

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.