mirror of
https://github.com/streetwriters/notesnook-sync-server.git
synced 2026-02-12 19:22:45 +00:00
open source Notesnook API
This commit is contained in:
10
Notesnook.API/Interfaces/IEncrypted.cs
Normal file
10
Notesnook.API/Interfaces/IEncrypted.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
namespace Notesnook.API.Interfaces
|
||||
{
|
||||
public interface IEncrypted
|
||||
{
|
||||
string Cipher { get; set; }
|
||||
string IV { get; set; }
|
||||
long Length { get; set; }
|
||||
string Salt { get; set; }
|
||||
}
|
||||
}
|
||||
14
Notesnook.API/Interfaces/IMonograph.cs
Normal file
14
Notesnook.API/Interfaces/IMonograph.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using Notesnook.API.Models;
|
||||
using Streetwriters.Common.Interfaces;
|
||||
|
||||
namespace Notesnook.API.Interfaces
|
||||
{
|
||||
public interface IMonograph : IDocument
|
||||
{
|
||||
string Title { get; set; }
|
||||
string UserId { get; set; }
|
||||
byte[] CompressedContent { get; set; }
|
||||
EncryptedData EncryptedContent { get; set; }
|
||||
long DatePublished { get; set; }
|
||||
}
|
||||
}
|
||||
21
Notesnook.API/Interfaces/IS3Service.cs
Normal file
21
Notesnook.API/Interfaces/IS3Service.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Amazon.S3.Model;
|
||||
using Notesnook.API.Models;
|
||||
using Notesnook.API.Models.Responses;
|
||||
using Streetwriters.Common.Interfaces;
|
||||
|
||||
namespace Notesnook.API.Interfaces
|
||||
{
|
||||
public interface IS3Service
|
||||
{
|
||||
Task DeleteObjectAsync(string userId, string name);
|
||||
Task DeleteDirectoryAsync(string userId);
|
||||
Task<long?> GetObjectSizeAsync(string userId, string name);
|
||||
string GetUploadObjectUrl(string userId, string name);
|
||||
string GetDownloadObjectUrl(string userId, string name);
|
||||
Task<MultipartUploadMeta> StartMultipartUploadAsync(string userId, string name, int parts, string uploadId = null);
|
||||
Task AbortMultipartUploadAsync(string userId, string name, string uploadId);
|
||||
Task CompleteMultipartUploadAsync(string userId, CompleteMultipartUploadRequest uploadRequest);
|
||||
}
|
||||
}
|
||||
24
Notesnook.API/Interfaces/ISyncItem.cs
Normal file
24
Notesnook.API/Interfaces/ISyncItem.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System.Text.Json.Serialization;
|
||||
using MongoDB.Bson.Serialization.Attributes;
|
||||
using MongoDB.Bson.Serialization.Serializers;
|
||||
using Notesnook.API.Models;
|
||||
using Streetwriters.Common.Attributes;
|
||||
using Streetwriters.Common.Converters;
|
||||
using Streetwriters.Common.Interfaces;
|
||||
|
||||
namespace Notesnook.API.Interfaces
|
||||
{
|
||||
[BsonSerializer(typeof(ImpliedImplementationInterfaceSerializer<ISyncItem, SyncItem>))]
|
||||
[JsonInterfaceConverter(typeof(InterfaceConverter<ISyncItem, SyncItem>))]
|
||||
public interface ISyncItem
|
||||
{
|
||||
long DateSynced
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
string UserId { get; set; }
|
||||
string Algorithm { get; set; }
|
||||
string IV { get; set; }
|
||||
}
|
||||
}
|
||||
21
Notesnook.API/Interfaces/ISyncItemsRepositoryAccessor.cs
Normal file
21
Notesnook.API/Interfaces/ISyncItemsRepositoryAccessor.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using Notesnook.API.Models;
|
||||
using Notesnook.API.Repositories;
|
||||
using Streetwriters.Common.Models;
|
||||
using Streetwriters.Data.Repositories;
|
||||
|
||||
namespace Notesnook.API.Interfaces
|
||||
{
|
||||
public interface ISyncItemsRepositoryAccessor
|
||||
{
|
||||
SyncItemsRepository<Note> Notes { get; }
|
||||
SyncItemsRepository<Notebook> Notebooks { get; }
|
||||
SyncItemsRepository<Shortcut> Shortcuts { get; }
|
||||
SyncItemsRepository<Reminder> Reminders { get; }
|
||||
SyncItemsRepository<Relation> Relations { get; }
|
||||
SyncItemsRepository<Content> Contents { get; }
|
||||
SyncItemsRepository<Setting> Settings { get; }
|
||||
SyncItemsRepository<Attachment> Attachments { get; }
|
||||
Repository<UserSettings> UsersSettings { get; }
|
||||
Repository<Monograph> Monographs { get; }
|
||||
}
|
||||
}
|
||||
16
Notesnook.API/Interfaces/IUserService.cs
Normal file
16
Notesnook.API/Interfaces/IUserService.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Notesnook.API.Models.Responses;
|
||||
using Streetwriters.Common.Interfaces;
|
||||
|
||||
namespace Notesnook.API.Interfaces
|
||||
{
|
||||
public interface IUserService
|
||||
{
|
||||
Task CreateUserAsync();
|
||||
Task<bool> DeleteUserAsync(string userId, string jti);
|
||||
Task<bool> ResetUserAsync(string userId, bool removeAttachments);
|
||||
Task<UserResponse> GetUserAsync(bool repair = true);
|
||||
Task SetUserAttachmentsKeyAsync(string userId, IEncrypted key);
|
||||
}
|
||||
}
|
||||
23
Notesnook.API/Interfaces/IUserSettings.cs
Normal file
23
Notesnook.API/Interfaces/IUserSettings.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using Notesnook.API.Models;
|
||||
using Streetwriters.Common.Interfaces;
|
||||
using Streetwriters.Common.Models;
|
||||
|
||||
namespace Notesnook.API.Interfaces
|
||||
{
|
||||
public interface IUserSettings : IDocument
|
||||
{
|
||||
string UserId { get; set; }
|
||||
|
||||
long LastSynced
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
EncryptedData VaultKey
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
string Salt { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user