2017-05-08 14:08:44 -04:00
|
|
|
|
using System;
|
|
|
|
|
|
using Bit.Core.Models.Table;
|
2017-05-08 22:14:01 -04:00
|
|
|
|
using System.Collections.Generic;
|
2017-05-11 11:41:13 -04:00
|
|
|
|
using Bit.Core.Models.Data;
|
|
|
|
|
|
using System.Linq;
|
2017-05-08 14:08:44 -04:00
|
|
|
|
|
|
|
|
|
|
namespace Bit.Core.Models.Api
|
|
|
|
|
|
{
|
|
|
|
|
|
public class GroupResponseModel : ResponseModel
|
|
|
|
|
|
{
|
|
|
|
|
|
public GroupResponseModel(Group group, string obj = "group")
|
|
|
|
|
|
: base(obj)
|
|
|
|
|
|
{
|
2020-03-27 14:36:37 -04:00
|
|
|
|
if (group == null)
|
2017-05-08 14:08:44 -04:00
|
|
|
|
{
|
|
|
|
|
|
throw new ArgumentNullException(nameof(group));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Id = group.Id.ToString();
|
|
|
|
|
|
OrganizationId = group.OrganizationId.ToString();
|
|
|
|
|
|
Name = group.Name;
|
2017-05-10 12:17:10 -04:00
|
|
|
|
AccessAll = group.AccessAll;
|
2017-05-12 14:02:33 -04:00
|
|
|
|
ExternalId = group.ExternalId;
|
2017-05-08 14:08:44 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public string Id { get; set; }
|
|
|
|
|
|
public string OrganizationId { get; set; }
|
|
|
|
|
|
public string Name { get; set; }
|
2017-05-10 12:17:10 -04:00
|
|
|
|
public bool AccessAll { get; set; }
|
2017-05-12 14:02:33 -04:00
|
|
|
|
public string ExternalId { get; set; }
|
2017-05-08 14:08:44 -04:00
|
|
|
|
}
|
2017-05-08 22:14:01 -04:00
|
|
|
|
|
|
|
|
|
|
public class GroupDetailsResponseModel : GroupResponseModel
|
|
|
|
|
|
{
|
2017-05-11 11:41:13 -04:00
|
|
|
|
public GroupDetailsResponseModel(Group group, IEnumerable<SelectionReadOnly> collections)
|
2017-05-08 22:14:01 -04:00
|
|
|
|
: base(group, "groupDetails")
|
|
|
|
|
|
{
|
2017-05-11 11:41:13 -04:00
|
|
|
|
Collections = collections.Select(c => new SelectionReadOnlyResponseModel(c));
|
2017-05-08 22:14:01 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
2017-05-11 11:41:13 -04:00
|
|
|
|
public IEnumerable<SelectionReadOnlyResponseModel> Collections { get; set; }
|
2017-05-08 22:14:01 -04:00
|
|
|
|
}
|
2017-05-08 14:08:44 -04:00
|
|
|
|
}
|