mirror of https://github.com/Squidex/squidex.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
62 lines
1.7 KiB
62 lines
1.7 KiB
// ==========================================================================
|
|
// AppClient.cs
|
|
// Squidex Headless CMS
|
|
// ==========================================================================
|
|
// Copyright (c) Squidex Group
|
|
// All rights reserved.
|
|
// ==========================================================================
|
|
|
|
using System.Diagnostics.Contracts;
|
|
using Squidex.Infrastructure;
|
|
|
|
namespace Squidex.Domain.Apps.Core.Apps
|
|
{
|
|
public sealed class AppClient
|
|
{
|
|
private readonly string secret;
|
|
private readonly string name;
|
|
private readonly AppClientPermission permission;
|
|
|
|
public string Name
|
|
{
|
|
get { return name; }
|
|
}
|
|
|
|
public string Secret
|
|
{
|
|
get { return secret; }
|
|
}
|
|
|
|
public AppClientPermission Permission
|
|
{
|
|
get { return permission; }
|
|
}
|
|
|
|
public AppClient(string name, string secret, AppClientPermission permission)
|
|
{
|
|
Guard.NotNullOrEmpty(name, nameof(name));
|
|
Guard.NotNullOrEmpty(secret, nameof(secret));
|
|
Guard.Enum(permission, nameof(permission));
|
|
|
|
this.name = name;
|
|
this.secret = secret;
|
|
this.permission = permission;
|
|
}
|
|
|
|
[Pure]
|
|
public AppClient Update(AppClientPermission newPermission)
|
|
{
|
|
Guard.Enum(newPermission, nameof(newPermission));
|
|
|
|
return new AppClient(name, secret, newPermission);
|
|
}
|
|
|
|
[Pure]
|
|
public AppClient Rename(string newName)
|
|
{
|
|
Guard.NotNullOrEmpty(newName, nameof(newName));
|
|
|
|
return new AppClient(newName, secret, permission);
|
|
}
|
|
}
|
|
}
|
|
|