Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 52 additions & 3 deletions interface/include/nakama-cpp/satori/HardcodedLowLevelSatoriAPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ struct SAuthenticateRequest {
// Optional custom properties to update with this call.
// If not set, properties are left as they are on the server.
std::unordered_map<std::string, std::string> custom_properties;
// Optional no_session modifies the request to only create/update
// an identity without creating a new session. If set to 'true'
// the response won't include a token and a refresh token.
bool no_session = false;
};

// A single event. Usually, but not necessarily, part of a batch.
Expand All @@ -64,6 +68,14 @@ struct SEvent {
std::string value;
// The time when the event was triggered on the producer side. Unit is unix time milliseconds
Nakama::NTimestamp timestamp;
// The identity id associated with the event. Ignored if the event is published as part of a session.
std::string identity_id;
// The session id associated with the event. Ignored if the event is published as part of a session.
std::string session_id;
// The session issued at associated with the event. Ignored if the event is published as part of a session.
int64_t session_issued_at;
// The session expires at associated with the event. Ignored if the event is published as part of a session.
int64_t session_expires_at;
};

// Publish an event to the server
Expand All @@ -78,6 +90,8 @@ struct SExperiment {
std::string name;
// Value associated with this Experiment.
std::string value;
// The labels associated with this experiment.
std::vector<std::string> labels;
};

// All experiments that this identity is involved with.
Expand Down Expand Up @@ -106,6 +120,8 @@ struct SFlag {
bool condition_changed = false;
// The origin of change on the flag value returned.
SValueChangeReason change_reason;
// The labels associated with this flag.
std::vector<std::string> labels;
};

// All flags available to the identity
Expand Down Expand Up @@ -141,6 +157,8 @@ struct SFlagOverride {
std::string flag_name;
// The list of configuration that affect the value of the flag.
std::vector<SValue> overrides;
// The labels associated with this flag.
std::vector<std::string> labels;
};

// All flags available to the identity and their value overrides
Expand All @@ -151,20 +169,43 @@ struct SFlagOverrideList {

// Request to get all experiments data.
struct SGetExperimentsRequest {
// Experiment names; if empty string all experiments are returned.
// Experiment names; if empty string, all experiments are returned based on the remaining filters.
std::vector<std::string> names;
// Label names that must be defined for each Experiment; if empty string, all experiments are returned based on the
// remaining filters.
std::vector<std::string> labels;
};

// Request to get all flags data.
struct SGetFlagsRequest {
// Flag names; if empty string all flags are returned.
// Flag names; if empty string, all flags are returned based on the remaining filters.
std::vector<std::string> names;
// Label names that must be defined for each Flag; if empty string, all flags are returned based on the remaining
// filters.
std::vector<std::string> labels;
};

// Request to get all live events.
struct SGetLiveEventsRequest {
// Live event names; if empty string all live events are returned.
// Live event names; if empty string, all live events are returned based on the remaining filters.
std::vector<std::string> names;
// Label names that must be defined for each Live Event; if empty string, all live events are returned based on the
// remaining filters.
std::vector<std::string> labels;
// The maximum number of past event runs to return for each live event.
int32_t past_run_count;
// The maximum number of future event runs to return for each live event.
int32_t future_run_count;
// Start time of the time window filter to apply.
int64_t start_time_sec;
// End time of the time window filter to apply.
int64_t end_time_sec;
};

// Request to join a 'explicit join' live event.
struct SJoinLiveEventRequest {
// Live event id to join.
std::string id;
};

// Enrich/replace the current session with a new ID.
Expand All @@ -181,6 +222,8 @@ struct SIdentifyRequest {

// A single live event.
struct SLiveEvent {
// The status variants of a live event.
enum SStatus { UNKNOWN = 0, ACTIVE = 1, UPCOMING = 2, TERMINATED = 3 };
// Name.
std::string name;
// Description.
Expand All @@ -201,12 +244,18 @@ struct SLiveEvent {
int64_t duration_sec;
// Reset CRON schedule, if configured.
std::string reset_cron;
// The status of this live event run.
SStatus status;
// The labels associated with this live event.
std::vector<std::string> labels;
};

// List of Live events.
struct SLiveEventList {
// Live events.
std::vector<SLiveEvent> live_events;
// Live events that require explicit join.
std::vector<SLiveEvent> explicit_join_live_events;
};

// Properties associated with an identity.
Expand Down
63 changes: 41 additions & 22 deletions interface/include/nakama-cpp/satori/SClientInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,52 +77,71 @@ class NAKAMA_API SClientInterface {

virtual std::future<void> postEventAsync(SSessionPtr session, const std::vector<SEvent>& events) = 0;

virtual void serverEvent(
const std::vector<SEvent>& events,
std::function<void()> successCallback = nullptr,
Nakama::ErrorCallback errorCallback = nullptr) = 0;

virtual std::future<void> serverEventAsync(const std::vector<SEvent>& events) = 0;

virtual void getExperiments(
SSessionPtr session,
const std::vector<std::string>& names,
const SGetExperimentsRequest& request = SGetExperimentsRequest(),
std::function<void(SExperimentList)> successCallback = nullptr,
Nakama::ErrorCallback errorCallback = nullptr) = 0;

virtual std::future<SExperimentList>
getExperimentsAsync(SSessionPtr session, const std::vector<std::string>& names) = 0;
getExperimentsAsync(SSessionPtr session, const SGetExperimentsRequest& request = SGetExperimentsRequest()) = 0;

virtual void getFlags(
const std::string& httpKey,
const SGetFlagsRequest& request = SGetFlagsRequest(),
std::function<void(SFlagList)> successCallback = nullptr,
Nakama::ErrorCallback errorCallback = nullptr) = 0;

virtual std::future<SFlagList> getFlagsAsync(const std::string& httpKey, const SGetFlagsRequest& request = SGetFlagsRequest()) = 0;

virtual void getFlags(
SSessionPtr session,
const std::vector<std::string>& names = {},
const SGetFlagsRequest& request = SGetFlagsRequest(),
std::function<void(SFlagList)> successCallback = nullptr,
Nakama::ErrorCallback errorCallback = nullptr) = 0;

virtual std::future<SFlagList> getFlagsAsync(SSessionPtr session, const std::vector<std::string>& names = {}) = 0;
virtual std::future<SFlagList> getFlagsAsync(SSessionPtr session, const SGetFlagsRequest& request = SGetFlagsRequest()) = 0;

virtual void getFlagOverrides(
const std::string& httpKey,
const SGetFlagsRequest& request = SGetFlagsRequest(),
std::function<void(SFlagOverrideList)> successCallback = nullptr,
Nakama::ErrorCallback errorCallback = nullptr) = 0;

virtual std::future<SFlagOverrideList>
getFlagOverridesAsync(const std::string& httpKey, const SGetFlagsRequest& request = SGetFlagsRequest()) = 0;

virtual void getFlagOverrides(
SSessionPtr session,
const std::vector<std::string>& names = {},
const SGetFlagsRequest& request = SGetFlagsRequest(),
std::function<void(SFlagOverrideList)> successCallback = nullptr,
Nakama::ErrorCallback errorCallback = nullptr) = 0;

virtual std::future<SFlagOverrideList>
getFlagOverridesAsync(SSessionPtr session, const std::vector<std::string>& names = {}) = 0;

/**
* Request to get all live events.
*
* @param session The session of the user.
* @param liveEventNames Live event names; if empty string all live events are returned.
*/
getFlagOverridesAsync(SSessionPtr session, const SGetFlagsRequest& request = SGetFlagsRequest()) = 0;

virtual void getLiveEvents(
SSessionPtr session,
const std::vector<std::string>& liveEventNames = {},
const SGetLiveEventsRequest& request = SGetLiveEventsRequest(),
std::function<void(SLiveEventList)> successCallback = nullptr,
Nakama::ErrorCallback errorCallback = nullptr) = 0;

/**
* Fetch one or more users by id, usernames, and Facebook ids.
*
* @param session The session of the user.
* @param liveEventNames Live event names; if empty string all live events are returned.
*/
virtual std::future<SLiveEventList>
getLiveEventsAsync(SSessionPtr session, const std::vector<std::string>& liveEventNames = {}) = 0;
virtual std::future<SLiveEventList> getLiveEventsAsync(SSessionPtr session, const SGetLiveEventsRequest& request = SGetLiveEventsRequest()) = 0;

virtual void joinLiveEvent(
SSessionPtr session,
const std::string& id,
std::function<void()> successCallback = nullptr,
Nakama::ErrorCallback errorCallback = nullptr) = 0;

virtual std::future<void> joinLiveEventAsync(SSessionPtr session, const std::string& id) = 0;

virtual void identify(
SSessionPtr session,
Expand Down
Loading
Loading