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 ;
2023-06-27 23:49:38 +02:00
using System.Threading ;
2019-04-16 17:07:44 +02:00
using System.Threading.Tasks ;
2023-08-17 21:19:35 +02:00
using Bit.Core.Enums ;
2023-11-07 13:15:32 +01:00
using Bit.Core.Models.Data ;
2019-04-16 17:07:44 +02:00
using Bit.Core.Models.Request ;
using Bit.Core.Models.Response ;
2024-02-08 20:05:26 +01:00
using DeviceType = Bit . Core . Enums . DeviceType ;
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 ) ;
2023-04-17 16:35:50 +02:00
Task < VerifyMasterPasswordResponse > 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 ) ;
2024-04-12 20:52:39 +02:00
Task < bool > HasUnassignedCiphersAsync ( ) ;
2019-04-16 17:07:44 +02:00
Task RefreshIdentityTokenAsync ( ) ;
2023-08-17 21:19:35 +02:00
Task < SsoPrevalidateResponse > PreValidateSsoAsync ( string identifier ) ;
2019-04-16 17:07:44 +02:00
Task < TResponse > SendAsync < TRequest , TResponse > ( HttpMethod method , string path ,
2023-09-25 17:28:58 +02:00
TRequest body , bool authed , bool hasResponse , Action < HttpRequestMessage > alterRequest , bool logoutOnUnauthorized = true , bool sendToIdentity = false ) ;
2023-06-27 23:49:38 +02:00
Task < HttpResponseMessage > SendAsync ( HttpRequestMessage requestMessage , CancellationToken cancellationToken = default ) ;
2023-11-07 13:15:32 +01:00
void SetUrls ( EnvironmentUrlData 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 ) ;
2023-04-17 16:35:50 +02:00
Task PostPasswordAsync ( PasswordRequest 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 ) ;
2023-08-17 21:19:35 +02:00
Task < KeyConnectorUserKeyResponse > GetMasterKeyFromKeyConnectorAsync ( string keyConnectorUrl ) ;
Task PostMasterKeyToKeyConnectorAsync ( string keyConnectorUrl , KeyConnectorUserKeyRequest request ) ;
Task PostSetKeyConnectorKeyAsync ( SetKeyConnectorKeyRequest request ) ;
Task PostConvertToKeyConnectorAsync ( ) ;
Task PostLeaveOrganizationAsync ( 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-11-15 18:36:21 +01:00
Task < List < PasswordlessLoginResponse > > GetAuthRequestAsync ( ) ;
2022-09-26 19:27:57 +02:00
Task < PasswordlessLoginResponse > GetAuthRequestAsync ( string id ) ;
2022-11-09 17:25:48 +01:00
Task < PasswordlessLoginResponse > GetAuthResponseAsync ( string id , string accessCode ) ;
2022-09-26 19:27:57 +02:00
Task < PasswordlessLoginResponse > PutAuthRequestAsync ( string id , string key , string masterPasswordHash , string deviceIdentifier , bool requestApproved ) ;
2023-08-17 21:19:35 +02:00
Task < PasswordlessLoginResponse > PostCreateRequestAsync ( PasswordlessCreateLoginRequest passwordlessCreateLoginRequest , AuthRequestType authRequestType ) ;
2022-10-29 00:10:41 +02:00
Task < bool > GetKnownDeviceAsync ( string email , string deviceIdentifier ) ;
2023-08-17 21:19:35 +02:00
Task < DeviceResponse > GetDeviceByIdentifierAsync ( string deviceIdentifier ) ;
Task < DeviceResponse > UpdateTrustedDeviceKeysAsync ( string deviceIdentifier , TrustedDeviceKeysRequest deviceRequest ) ;
2023-02-20 15:49:20 +01:00
Task < OrganizationDomainSsoDetailsResponse > GetOrgDomainSsoDetailsAsync ( string email ) ;
2023-08-17 21:19:35 +02:00
Task < bool > GetDevicesExistenceByTypes ( DeviceType [ ] deviceTypes ) ;
2023-05-19 13:42:41 +02:00
Task < ConfigResponse > GetConfigsAsync ( ) ;
2023-06-27 23:49:38 +02:00
Task < string > GetFastmailAccountIdAsync ( string apiKey ) ;
2019-04-12 05:57:05 +02:00
}
}