Skip to content

C API: Award items

Items a game defines and unlocks for its signed-in players, who then wear them in their 360sona wardrobe: custom items: award items.

sona_award_def_defaults

void sona_award_def_defaults(sona_award_def *d);
Parameter and type Meaning
d
sona_award_def *
The sona_award_def to fill with the defaults (required)

Returns Nothing.

Example:

sona_award_def x_award_def;
sona_award_def_defaults(&x_award_def);
sona_award_def_defaults(&x_award_def);

size set and everything else zero.

sona_award_define

sona_result sona_award_define(sona_ctx *ctx, const sona_award_def *d,
                              uint32_t *ticket);
Parameter and type Meaning
ctx
sona_ctx *
The context (required)
d
const sona_award_def *
The options, a sona_award_def (required)
ticket
uint32_t *
Receives a ticket for sona_award_poll (required)

Returns SONA_OK. Errors SONA_E_ARGUMENT, SONA_E_LIMIT, SONA_E_MEMORY, SONA_E_IO, SONA_E_APP (what each means).

Defines an award item for an app with the app's developer key (a tool's call, never a shipped game's). It goes to config.check_host through the ctx's HTTP layer and gives a ticket: sona_award_poll after sona_update says how it went.

sona_award_unlock

sona_result sona_award_unlock(sona_ctx *ctx, const char *player_token,
                              const char *key, uint32_t *ticket);
Parameter and type Meaning
ctx
sona_ctx *
The context (required)
player_token
const char *
The signed-in player's access token (required)
key
const char *
The award's key (required)
ticket
uint32_t *
Receives a ticket for sona_award_poll (required)

Returns SONA_OK. Errors SONA_E_ARGUMENT, SONA_E_LIMIT, SONA_E_MEMORY, SONA_E_IO, SONA_E_APP (what each means).

player_token: the signed-in player's access token (Sign in with 360sona).

sona_award_poll

sona_result sona_award_poll(sona_ctx *ctx, uint32_t ticket);
Parameter and type Meaning
ctx
sona_ctx *
The context (required)
ticket
uint32_t
The ticket the request gave

Returns SONA_OK, SONA_PENDING while it is still working. Errors SONA_E_ARGUMENT, SONA_E_NOT_FOUND, SONA_E_LIMIT, SONA_E_IO, SONA_E_GATE, SONA_E_APP (what each means).

Example:

sona_result result = sona_award_poll(ctx, 0);
if (result != SONA_OK) printf("sona_award_poll: %s\n",
    sona_result_name(result));

SONA_PENDING while it runs, then its result once: SONA_OK, SONA_E_NOT_FOUND (no such award), SONA_E_APP (a wrong key or token, or no awards scope), SONA_E_ARGUMENT (refused; see sona_last_error), SONA_E_LIMIT, SONA_E_GATE or SONA_E_IO.

This page as Markdown · All the docs as one file (llms-full.txt)