libkazv
Kazv::BaseJob Class Reference

#include <basejob.hpp>

Inherited by Kazv::Api::Add3PIDJob, Kazv::Api::BanJob, Kazv::Api::Bind3PIDJob, Kazv::Api::ChangePasswordJob, Kazv::Api::CheckUsernameAvailabilityJob, Kazv::Api::ClaimKeysJob, Kazv::Api::CreateRoomJob, Kazv::Api::DeactivateAccountJob, Kazv::Api::DefineFilterJob, Kazv::Api::Delete3pidFromAccountJob, Kazv::Api::DeleteDeviceJob, Kazv::Api::DeleteDevicesJob, Kazv::Api::DeletePushRuleJob, Kazv::Api::DeleteRoomAliasJob, Kazv::Api::DeleteRoomTagJob, Kazv::Api::ForgetRoomJob, Kazv::Api::GetAccount3PIDsJob, Kazv::Api::GetAccountDataJob, Kazv::Api::GetAccountDataPerRoomJob, Kazv::Api::GetAvatarUrlJob, Kazv::Api::GetCapabilitiesJob, Kazv::Api::GetConfigJob, Kazv::Api::GetContentJob, Kazv::Api::GetContentOverrideNameJob, Kazv::Api::GetContentThumbnailJob, Kazv::Api::GetDeviceJob, Kazv::Api::GetDevicesJob, Kazv::Api::GetDisplayNameJob, Kazv::Api::GetEventContextJob, Kazv::Api::GetEventsJob, Kazv::Api::GetFilterJob, Kazv::Api::GetJoinedMembersByRoomJob, Kazv::Api::GetJoinedRoomsJob, Kazv::Api::GetKeysChangesJob, Kazv::Api::GetLocalAliasesJob, Kazv::Api::GetLoginFlowsJob, Kazv::Api::GetMembersByRoomJob, Kazv::Api::GetNotificationsJob, Kazv::Api::GetOneEventJob, Kazv::Api::GetOneRoomEventJob, Kazv::Api::GetPresenceJob, Kazv::Api::GetProtocolMetadataJob, Kazv::Api::GetProtocolsJob, Kazv::Api::GetPublicRoomsJob, Kazv::Api::GetPushRuleActionsJob, Kazv::Api::GetPushRuleJob, Kazv::Api::GetPushRulesJob, Kazv::Api::GetPushersJob, Kazv::Api::GetRelatingEventsJob, Kazv::Api::GetRelatingEventsWithRelTypeAndEventTypeJob, Kazv::Api::GetRelatingEventsWithRelTypeJob, Kazv::Api::GetRoomEventsJob, Kazv::Api::GetRoomIdByAliasJob, Kazv::Api::GetRoomStateJob, Kazv::Api::GetRoomStateWithKeyJob, Kazv::Api::GetRoomTagsJob, Kazv::Api::GetRoomVisibilityOnDirectoryJob, Kazv::Api::GetSpaceHierarchyJob, Kazv::Api::GetTokenOwnerJob, Kazv::Api::GetTurnServerJob, Kazv::Api::GetUrlPreviewJob, Kazv::Api::GetUserProfileJob, Kazv::Api::GetVersionsJob, Kazv::Api::GetWellknownJob, Kazv::Api::GetWhoIsJob, Kazv::Api::InitialSyncJob, Kazv::Api::InviteBy3PIDJob, Kazv::Api::InviteUserJob, Kazv::Api::IsPushRuleEnabledJob, Kazv::Api::JoinRoomByIdJob, Kazv::Api::JoinRoomJob, Kazv::Api::KickJob, Kazv::Api::KnockRoomJob, Kazv::Api::LeaveRoomJob, Kazv::Api::LoginJob, Kazv::Api::LogoutAllJob, Kazv::Api::LogoutJob, Kazv::Api::PeekEventsJob, Kazv::Api::Post3PIDsJob, Kazv::Api::PostPusherJob, Kazv::Api::PostReceiptJob, Kazv::Api::QueryKeysJob, Kazv::Api::QueryLocationByAliasJob, Kazv::Api::QueryLocationByProtocolJob, Kazv::Api::QueryPublicRoomsJob, Kazv::Api::QueryUserByIDJob, Kazv::Api::QueryUserByProtocolJob, Kazv::Api::RedactEventJob, Kazv::Api::RedirectToIdPJob, Kazv::Api::RedirectToSSOJob, Kazv::Api::RefreshJob, Kazv::Api::RegisterJob, Kazv::Api::RegistrationTokenValidityJob, Kazv::Api::ReportContentJob, Kazv::Api::RequestOpenIdTokenJob, Kazv::Api::RequestTokenTo3PIDEmailJob, Kazv::Api::RequestTokenTo3PIDMSISDNJob, Kazv::Api::RequestTokenToRegisterEmailJob, Kazv::Api::RequestTokenToRegisterMSISDNJob, Kazv::Api::RequestTokenToResetPasswordEmailJob, Kazv::Api::RequestTokenToResetPasswordMSISDNJob, Kazv::Api::RoomInitialSyncJob, Kazv::Api::SearchJob, Kazv::Api::SearchUserDirectoryJob, Kazv::Api::SendMessageJob, Kazv::Api::SendToDeviceJob, Kazv::Api::SetAccountDataJob, Kazv::Api::SetAccountDataPerRoomJob, Kazv::Api::SetAvatarUrlJob, Kazv::Api::SetDisplayNameJob, Kazv::Api::SetPresenceJob, Kazv::Api::SetPushRuleActionsJob, Kazv::Api::SetPushRuleEnabledJob, Kazv::Api::SetPushRuleJob, Kazv::Api::SetReadMarkerJob, Kazv::Api::SetRoomAliasJob, Kazv::Api::SetRoomStateWithKeyJob, Kazv::Api::SetRoomTagJob, Kazv::Api::SetRoomVisibilityOnDirectoryJob, Kazv::Api::SetTypingJob, Kazv::Api::SyncJob, Kazv::Api::UnbanJob, Kazv::Api::Unbind3pidFromAccountJob, Kazv::Api::UpdateAppserviceRoomDirectoryVisibilityJob, Kazv::Api::UpdateDeviceJob, Kazv::Api::UpgradeRoomJob, Kazv::Api::UploadContentJob, Kazv::Api::UploadCrossSigningKeysJob, Kazv::Api::UploadCrossSigningSignaturesJob, and Kazv::Api::UploadKeysJob.

Collaboration diagram for Kazv::BaseJob:

Classes

struct  Delete
 
struct  Get
 
struct  Post
 
struct  Private
 
struct  Put
 
class  Query
 

Public Types

enum  ReturnType { Json , File }
 
using Method = std::variant< Get, Post, Put, Delete >
 
using Body = ::Kazv::Body
 
using BytesBody = ::Kazv::BytesBody
 
using JsonBody = ::Kazv::JsonBody
 
using EmptyBody = ::Kazv::EmptyBody
 
using Header = ::Kazv::Header
 
using Response = ::Kazv::Response
 

Public Member Functions

 BaseJob (std::string serverUrl, std::string requestUrl, Method method, std::string jobId, std::string token={}, ReturnType returnType=ReturnType::Json, Body body=EmptyBody{}, Query query={}, Header header={}, std::optional< FileDesc > responseFile=std::nullopt)
 
 ~BaseJob ()
 
bool shouldReturnJson () const
 
std::string url () const
 
Body requestBody () const
 
Header requestHeader () const
 
ReturnType returnType () const
 
Query requestQuery () const
 returns the non-encoded query as an array of pairs More...
 
Method requestMethod () const
 
Response genResponse (Response r) const
 
BaseJob withData (JsonWrap j) &&
 
BaseJob withData (JsonWrap j) const &
 
BaseJob withQueue (std::string id, JobQueuePolicy policy=AlwaysContinue) &&
 
BaseJob withQueue (std::string id, JobQueuePolicy policy=AlwaysContinue) const &
 
json dataJson (const std::string &key) const
 
std::string dataStr (const std::string &key) const
 
std::string jobId () const
 
std::optional< std::string > queueId () const
 
JobQueuePolicy queuePolicy () const
 
std::optional< FileDescresponseFile () const
 

Static Public Member Functions

static bool contentTypeMatches (immer::array< std::string > expected, std::string actual)
 

Static Public Attributes

static Get GET {}
 
static Post POST {}
 
static Put PUT {}
 
static Delete DELETE {}
 

Protected Member Functions

void attachData (JsonWrap data)
 

Friends

bool operator== (BaseJob a, BaseJob b)
 

Member Typedef Documentation

◆ Body

◆ BytesBody

◆ EmptyBody

◆ Header

◆ JsonBody

◆ Method

using Kazv::BaseJob::Method = std::variant<Get, Post, Put, Delete>

◆ Response

Member Enumeration Documentation

◆ ReturnType

Enumerator
Json 
File 

Constructor & Destructor Documentation

◆ BaseJob()

Kazv::BaseJob::BaseJob ( std::string  serverUrl,
std::string  requestUrl,
Method  method,
std::string  jobId,
std::string  token = {},
ReturnType  returnType = ReturnType::Json,
Body  body = EmptyBody{},
Query  query = {},
Header  header = {},
std::optional< FileDesc responseFile = std::nullopt 
)

◆ ~BaseJob()

Kazv::BaseJob::~BaseJob ( )
default

Member Function Documentation

◆ attachData()

void Kazv::BaseJob::attachData ( JsonWrap  data)
protected

◆ contentTypeMatches()

bool Kazv::BaseJob::contentTypeMatches ( immer::array< std::string >  expected,
std::string  actual 
)
static

◆ dataJson()

json Kazv::BaseJob::dataJson ( const std::string &  key) const

◆ dataStr()

std::string Kazv::BaseJob::dataStr ( const std::string &  key) const

◆ genResponse()

Response Kazv::BaseJob::genResponse ( Response  r) const

◆ jobId()

std::string Kazv::BaseJob::jobId ( ) const

◆ queueId()

std::optional< std::string > Kazv::BaseJob::queueId ( ) const

◆ queuePolicy()

JobQueuePolicy Kazv::BaseJob::queuePolicy ( ) const

◆ requestBody()

auto Kazv::BaseJob::requestBody ( ) const

◆ requestHeader()

auto Kazv::BaseJob::requestHeader ( ) const

◆ requestMethod()

auto Kazv::BaseJob::requestMethod ( ) const

◆ requestQuery()

auto Kazv::BaseJob::requestQuery ( ) const

returns the non-encoded query as an array of pairs

◆ responseFile()

std::optional< FileDesc > Kazv::BaseJob::responseFile ( ) const

◆ returnType()

auto Kazv::BaseJob::returnType ( ) const

◆ shouldReturnJson()

bool Kazv::BaseJob::shouldReturnJson ( ) const

◆ url()

std::string Kazv::BaseJob::url ( ) const

◆ withData() [1/2]

BaseJob Kazv::BaseJob::withData ( JsonWrap  j) &&

◆ withData() [2/2]

BaseJob Kazv::BaseJob::withData ( JsonWrap  j) const &

◆ withQueue() [1/2]

BaseJob Kazv::BaseJob::withQueue ( std::string  id,
JobQueuePolicy  policy = AlwaysContinue 
) &&

◆ withQueue() [2/2]

BaseJob Kazv::BaseJob::withQueue ( std::string  id,
JobQueuePolicy  policy = AlwaysContinue 
) const &

Friends And Related Function Documentation

◆ operator==

bool operator== ( BaseJob  a,
BaseJob  b 
)
friend

Member Data Documentation

◆ DELETE

BaseJob::Delete Kazv::BaseJob::DELETE {}
static

◆ GET

BaseJob::Get Kazv::BaseJob::GET {}
static

◆ POST

BaseJob::Post Kazv::BaseJob::POST {}
static

◆ PUT

BaseJob::Put Kazv::BaseJob::PUT {}
static

The documentation for this class was generated from the following files: