mirror of
https://github.com/bitwarden/mobile
synced 2026-01-05 18:13:36 +00:00
updates
This commit is contained in:
@@ -5,6 +5,5 @@ namespace Bit.App.Models.Api
|
||||
public class ApiError
|
||||
{
|
||||
public string Message { get; set; }
|
||||
public HttpStatusCode StatusCode { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
|
||||
namespace Bit.App.Models.Api
|
||||
{
|
||||
@@ -9,19 +10,26 @@ namespace Bit.App.Models.Api
|
||||
public bool Succeeded { get; private set; }
|
||||
public T Result { get; set; }
|
||||
public IEnumerable<ApiError> Errors => m_errors;
|
||||
public HttpStatusCode StatusCode { get; private set; }
|
||||
|
||||
public static ApiResult<T> Success(T result)
|
||||
public static ApiResult<T> Success(T result, HttpStatusCode statusCode)
|
||||
{
|
||||
return new ApiResult<T>
|
||||
{
|
||||
Succeeded = true,
|
||||
Result = result
|
||||
Result = result,
|
||||
StatusCode = statusCode
|
||||
};
|
||||
}
|
||||
|
||||
public static ApiResult<T> Failed(params ApiError[] errors)
|
||||
public static ApiResult<T> Failed(HttpStatusCode statusCode, params ApiError[] errors)
|
||||
{
|
||||
var result = new ApiResult<T> { Succeeded = false };
|
||||
var result = new ApiResult<T>
|
||||
{
|
||||
Succeeded = false,
|
||||
StatusCode = statusCode
|
||||
};
|
||||
|
||||
if(errors != null)
|
||||
{
|
||||
result.m_errors.AddRange(errors);
|
||||
|
||||
@@ -10,10 +10,11 @@ namespace Bit.App.Models.Data
|
||||
public FolderData()
|
||||
{ }
|
||||
|
||||
public FolderData(Folder folder)
|
||||
public FolderData(Folder folder, string userId)
|
||||
{
|
||||
Id = folder.Id;
|
||||
ServerId = folder.ServerId;
|
||||
UserId = userId;
|
||||
Name = folder.Name?.EncryptedString;
|
||||
}
|
||||
|
||||
@@ -21,6 +22,7 @@ namespace Bit.App.Models.Data
|
||||
[AutoIncrement]
|
||||
public int Id { get; set; }
|
||||
public string ServerId { get; set; }
|
||||
public string UserId { get; set; }
|
||||
public string Name { get; set; }
|
||||
public DateTime RevisionDateTime { get; set; } = DateTime.UtcNow;
|
||||
|
||||
|
||||
@@ -10,12 +10,13 @@ namespace Bit.App.Models.Data
|
||||
public SiteData()
|
||||
{ }
|
||||
|
||||
public SiteData(Site site)
|
||||
public SiteData(Site site, string userId)
|
||||
{
|
||||
Id = site.Id;
|
||||
ServerId = site.ServerId;
|
||||
FolderId = site.FolderId;
|
||||
ServerFolderId = site.ServerFolderId;
|
||||
UserId = userId;
|
||||
Name = site.Name?.EncryptedString;
|
||||
Uri = site.Uri?.EncryptedString;
|
||||
Username = site.Username?.EncryptedString;
|
||||
@@ -29,6 +30,7 @@ namespace Bit.App.Models.Data
|
||||
public string ServerId { get; set; }
|
||||
public int? FolderId { get; set; }
|
||||
public string ServerFolderId { get; set; }
|
||||
public string UserId { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Uri { get; set; }
|
||||
public string Username { get; set; }
|
||||
|
||||
@@ -21,9 +21,9 @@ namespace Bit.App.Models
|
||||
Name = response.Name != null ? new CipherString(response.Name) : null;
|
||||
}
|
||||
|
||||
public FolderData ToFolderData()
|
||||
public FolderData ToFolderData(string userId)
|
||||
{
|
||||
return new FolderData(this);
|
||||
return new FolderData(this, userId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,9 +39,9 @@ namespace Bit.App.Models
|
||||
public CipherString Password { get; set; }
|
||||
public CipherString Notes { get; set; }
|
||||
|
||||
public SiteData ToSiteData()
|
||||
public SiteData ToSiteData(string userId)
|
||||
{
|
||||
return new SiteData(this);
|
||||
return new SiteData(this, userId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user