SparkTeam

Provides access to an instance of a team

e.g.

var team = Spark.getTeams().getTeam(myTeamId);

getOwnerId

signature getOwnerId()

returns string

Gets the playerId of the player who owns this team.

example

var ownerId = Spark.getTeams().getTeam(myTeamId).getOwnerId();

getTeamId

signature getTeamId()

returns string

Gets the teamId of this team.

example

var teamId = Spark.getTeams().getTeam(myTeamId).getTeamId();

getTeamName

signature getTeamName()

returns string

Gets the name of this team.

example

var teamName = Spark.getTeams().getTeam(myTeamId).getTeamName();

getTeamType

signature getTeamType()

returns string

Gets the teamType of this team.

example

var teamType = Spark.getTeams().getTeam(myTeamId).getTeamType();

getMemberIds

signature getMemberIds()

returns string[]

Gets an array containing the playerIds of the members of this team.

example

var memberIds = Spark.getTeams().getTeam(myTeamId).getMemberIds();

setOwnerId

signature setOwnerId(string playerId)

returns boolean

Updates the ownerId of this team.

Returns true if the ownerId was successfully updated, otherwise false.

example

var success = Spark.getTeams().getTeam(myTeamId).setOwnerId(newOwnerId);

setTeamName

signature setTeamName(string teamName)

returns boolean

Sets the name of this team.

example

var success = Spark.getTeams().getTeam(myTeamId).setTeamName("TeamName");

addMembers

signature addMembers(string[] playerIds)

returns void

Adds the given playerIds as members to this team.

example

Spark.getTeams().getTeam(myTeamId).addMembers(myPlayerId1, myPlayerId2);

removeMembers

signature removeMembers(string[] playerIds)

returns void

Removes the given playerIds from the list of members of this team.

example

Spark.getTeams().getTeam(myTeamId).removeMembers(myPlayerId1, myPlayerId2);

drop

signature drop()

returns boolean

Drops this team instance, deleting the underlying team data.

Returns true if the team has been dropped.

example

var success = Spark.getTeams().getTeam(myTeamId).drop();

listChatMessages

signature listChatMessages(number count, number offset)

returns ChatMessage[]

Lists the last

count
chat messages for this team, starting from the
offset
th message, most recent first.

example

var history = Spark.getTeams().getTeam(myTeamId).listChatMessages(50, 0);

getChatMessage

signature getChatMessage(string chatMessageId)

returns JSON

Get a message from the chat history by its id.

example

var message = Spark.getTeams().getTeam(myTeamId).getChatMessage(chatMessageId);

deleteChatMessage

signature deleteChatMessage(string chatMessageId)

returns boolean

Delete a message from the chat history by its id.

Returns true if the message has been removed from the chat history.

example

var success = Spark.getTeams().getTeam(myTeamId).deleteChatMessage(chatMessageId);

addAchievement

signature addAchievement(string achievementShortCode)

returns boolean

Add an achievement to this team (and its players).

Returns true if the achievement was added to the team or any of its players.

example

var success = Spark.getTeams().getTeam(myTeamId).addAchievement(achievementShortCode);

removeAchievement

signature removeAchievement(string achievementShortCode)

returns boolean

Remove an achievement from this team (and its players).

Returns true if the achievement was removed from the team or any of its players.

example

var success = Spark.getTeams().getTeam(myTeamId).removeAchievement(achievementShortCode);
Did this page help you? Please enter your feedback below. For questions about using this part of the platform, please contact support here