2019-04-16 17:07:44 +02:00
using System ;
2019-04-17 23:10:21 +02:00
using System.Collections.Generic ;
2019-04-16 17:07:44 +02:00
using System.Net.Http ;
using System.Threading.Tasks ;
2022-08-26 20:32:02 +02:00
using Bit.Core.Enums ;
2019-04-16 17:07:44 +02:00
using Bit.Core.Models.Domain ;
using Bit.Core.Models.Request ;
using Bit.Core.Models.Response ;
2019-04-12 05:57:05 +02:00
namespace Bit.Core.Abstractions
{
public interface IApiService
{
2019-04-16 17:07:44 +02:00
string ApiBaseUrl { get ; set ; }
string IdentityBaseUrl { get ; set ; }
2019-06-25 22:36:21 +02:00
string EventsBaseUrl { get ; set ; }
2019-04-16 17:07:44 +02:00
bool UrlsSet { get ; }
Task DeleteCipherAsync ( string id ) ;
Task DeleteCipherAttachmentAsync ( string id , string attachmentId ) ;
Task DeleteFolderAsync ( string id ) ;
Task < IdentityTokenResponse > DoRefreshTokenAsync ( ) ;
Task < long > GetAccountRevisionDateAsync ( ) ;
Task < string > GetActiveBearerTokenAsync ( ) ;
Task < CipherResponse > GetCipherAsync ( string id ) ;
Task < FolderResponse > GetFolderAsync ( string id ) ;
Task < ProfileResponse > GetProfileAsync ( ) ;
2019-04-17 18:12:43 +02:00
Task < SyncResponse > GetSyncAsync ( ) ;
2019-04-16 17:07:44 +02:00
Task PostAccountKeysAsync ( KeysRequest request ) ;
2020-09-03 18:30:40 +02:00
Task PostAccountVerifyPasswordAsync ( PasswordVerificationRequest request ) ;
2021-11-11 02:46:48 +01:00
Task PostAccountRequestOTP ( ) ;
Task PostAccountVerifyOTPAsync ( VerifyOTPRequest request ) ;
2019-04-16 17:07:44 +02:00
Task < CipherResponse > PostCipherAsync ( CipherRequest request ) ;
Task < CipherResponse > PostCipherCreateAsync ( CipherCreateRequest request ) ;
Task < FolderResponse > PostFolderAsync ( FolderRequest request ) ;
2021-08-04 21:47:23 +02:00
Task < IdentityResponse > PostIdentityTokenAsync ( TokenRequest request ) ;
2019-04-16 17:07:44 +02:00
Task PostPasswordHintAsync ( PasswordHintRequest request ) ;
2020-09-03 18:30:40 +02:00
Task SetPasswordAsync ( SetPasswordRequest request ) ;
2019-04-16 17:07:44 +02:00
Task < PreloginResponse > PostPreloginAsync ( PreloginRequest request ) ;
Task PostRegisterAsync ( RegisterRequest request ) ;
Task < CipherResponse > PutCipherAsync ( string id , CipherRequest request ) ;
Task PutCipherCollectionsAsync ( string id , CipherCollectionsRequest request ) ;
Task < FolderResponse > PutFolderAsync ( string id , FolderRequest request ) ;
Task < CipherResponse > PutShareCipherAsync ( string id , CipherShareRequest request ) ;
2020-05-20 19:35:20 +02:00
Task PutDeleteCipherAsync ( string id ) ;
2021-01-08 15:53:45 +01:00
Task < CipherResponse > PutRestoreCipherAsync ( string id ) ;
2019-04-16 17:07:44 +02:00
Task RefreshIdentityTokenAsync ( ) ;
2022-06-27 21:53:15 +02:00
Task < SsoPrevalidateResponse > PreValidateSso ( string identifier ) ;
2019-04-16 17:07:44 +02:00
Task < TResponse > SendAsync < TRequest , TResponse > ( HttpMethod method , string path ,
2022-01-24 17:25:46 +01:00
TRequest body , bool authed , bool hasResponse , bool logoutOnUnauthorized = true ) ;
2019-04-16 17:07:44 +02:00
void SetUrls ( EnvironmentUrls urls ) ;
2021-03-31 01:42:43 +02:00
[Obsolete("Mar 25 2021: This method has been deprecated in favor of direct uploads. This method still exists for backward compatibility with old server versions.")]
Task < CipherResponse > PostCipherAttachmentLegacyAsync ( string id , MultipartFormDataContent data ) ;
Task < AttachmentUploadDataResponse > PostCipherAttachmentAsync ( string id , AttachmentRequest request ) ;
Task < AttachmentResponse > GetAttachmentData ( string cipherId , string attachmentId ) ;
2019-04-16 23:21:04 +02:00
Task PostShareCipherAttachmentAsync ( string id , string attachmentId , MultipartFormDataContent data ,
string organizationId ) ;
2021-03-31 01:42:43 +02:00
Task < AttachmentUploadDataResponse > RenewAttachmentUploadUrlAsync ( string id , string attachmentId ) ;
Task PostAttachmentFileAsync ( string id , string attachmentId , MultipartFormDataContent data ) ;
2019-04-17 23:10:21 +02:00
Task < List < BreachAccountResponse > > GetHibpBreachAsync ( string username ) ;
2019-05-27 16:28:38 +02:00
Task PostTwoFactorEmailAsync ( TwoFactorEmailRequest request ) ;
2019-05-28 18:01:55 +02:00
Task PutDeviceTokenAsync ( string identifier , DeviceTokenRequest request ) ;
2019-07-11 15:30:25 +02:00
Task PostEventsCollectAsync ( IEnumerable < EventRequest > request ) ;
2021-09-24 20:14:26 +02:00
Task PutUpdateTempPasswordAsync ( UpdateTempPasswordRequest request ) ;
2021-11-24 20:09:39 +01:00
Task DeleteAccountAsync ( DeleteAccountRequest request ) ;
2021-09-08 19:43:24 +02:00
Task < OrganizationKeysResponse > GetOrganizationKeysAsync ( string id ) ;
2021-09-15 19:27:27 +02:00
Task < OrganizationAutoEnrollStatusResponse > GetOrganizationAutoEnrollStatusAsync ( string identifier ) ;
2021-09-08 19:43:24 +02:00
Task PutOrganizationUserResetPasswordEnrollmentAsync ( string orgId , string userId ,
OrganizationUserResetPasswordEnrollmentRequest request ) ;
2021-11-11 02:46:48 +01:00
Task < KeyConnectorUserKeyResponse > GetUserKeyFromKeyConnector ( string keyConnectorUrl ) ;
Task PostUserKeyToKeyConnector ( string keyConnectorUrl , KeyConnectorUserKeyRequest request ) ;
Task PostSetKeyConnectorKey ( SetKeyConnectorKeyRequest request ) ;
Task PostConvertToKeyConnector ( ) ;
Task PostLeaveOrganization ( string id ) ;
2021-01-25 21:27:38 +01:00
Task < SendResponse > GetSendAsync ( string id ) ;
Task < SendResponse > PostSendAsync ( SendRequest request ) ;
2021-03-29 16:45:04 +02:00
Task < SendFileUploadDataResponse > PostFileTypeSendAsync ( SendRequest request ) ;
Task PostSendFileAsync ( string sendId , string fileId , MultipartFormDataContent data ) ;
[Obsolete("Mar 25 2021: This method has been deprecated in favor of direct uploads. This method still exists for backward compatibility with old server versions.")]
2021-01-25 21:27:38 +01:00
Task < SendResponse > PostSendFileAsync ( MultipartFormDataContent data ) ;
2021-03-29 16:45:04 +02:00
Task < SendFileUploadDataResponse > RenewFileUploadUrlAsync ( string sendId , string fileId ) ;
2021-01-25 21:27:38 +01:00
Task < SendResponse > PutSendAsync ( string id , SendRequest request ) ;
Task < SendResponse > PutSendRemovePasswordAsync ( string id ) ;
Task DeleteSendAsync ( string id ) ;
2022-08-26 20:32:02 +02:00
Task < string > GetUsernameFromAsync ( ForwardedEmailServiceType service , UsernameGeneratorConfig config ) ;
2019-04-12 05:57:05 +02:00
}
}