DropTeamRequest

Allows a player to drop a team.

View interactive version here

Request Parameters

Parameter Required Type Description
ownerId No string The team owner to find, used in combination with teamType. If not supplied the current players id will be used
teamId No string The teamId to find (may be null if teamType supplied)
teamType No string The teamType to find, used in combination with the current player, or the player defined by ownerId

Response Parameters

A response to a drop team request

Parameter Type Description
scriptData ScriptData A JSON Map of any data added either to the Request or the Response by your Cloud Code

Nested types

ScriptData

A collection of arbitrary data that can be added to a message via a Cloud Code script.

Parameter Type Description
myKey string An arbitrary data key
myValue JSON An arbitrary data value.

Error Codes

Key Value Description
teamId|teamType REQUIRED Both teamId and teamType have not been provided
team INVALID The teamId or the teamType do not match an existing team
team NOT_MEMBER The current player is not a member of the team they are requesting to leave
team NOT_ONWER The user is not the owner of the team
teamType CANNOT_DROP_MANDATORY_TEAM The team has an ownership of 1 (Mandatory) so cannot be dropped
teamType&&ownerId NOT_UNIQUE The ownerId / teamType combination has multiple teams related to it

Code Samples

C#

    using GameSparks.Api;
    using GameSparks.Api.Requests;
    using GameSparks.Api.Responses;
    ...
    new DropTeamRequest()
        .SetOwnerId(ownerId)
        .SetTeamId(teamId)
        .SetTeamType(teamType)
        .Send((response) => {
        GSData scriptData = response.ScriptData; 
        });

ActionScript 3

    import com.gamesparks.*;
    import com.gamesparks.api.requests.*;
    import com.gamesparks.api.responses.*;
    import com.gamesparks.api.types.*;
    ...

    gs.getRequestBuilder()
        .createDropTeamRequest()
        .setOwnerId(ownerId)
        .setTeamId(teamId)
        .setTeamType(teamType)
        .send(function(response:com.gamesparks.api.responses.DropTeamResponse):void {
        var scriptData:ScriptData = response.getScriptData(); 
        });

Objective-C

    #import "GS.h"
    #import "GSAPI.h"
    ...
    GSDropTeamRequest* request = [[GSDropTeamRequest alloc] init];
    [request setOwnerId:ownerId;
    [request setTeamId:teamId;
    [request setTeamType:teamType;
    [request setCallback:^ (GSDropTeamResponse* response) {
    NSDictionary* scriptData = [response getScriptData]; 
    }];
    [gs send:request];

C++


    #include <GameSparks/generated/GSRequests.h>
    using namespace GameSparks::Core;
    using namespace GameSparks::Api::Responses;
    using namespace GameSparks::Api::Requests;
    ...

    void DropTeamRequest_Response(GS& gsInstance, const DropTeamResponse& response) {
    GSData scriptData = response.getScriptData(); 
    }
    ......

    DropTeamRequest request(gsInstance);
    request.SetOwnerId(ownerId)
    request.SetTeamId(teamId)
    request.SetTeamType(teamType)
    request.Send(DropTeamRequest_Response);

Java

import com.gamesparks.sdk.api.autogen.GSRequestBuilder.DropTeamRequest;
import com.gamesparks.sdk.api.autogen.GSResponseBuilder.DropTeamResponse;
import com.gamesparks.sdk.api.autogen.GSTypes.*;
import com.gamesparks.sdk.api.GSEventListener;

...
gs.getRequestBuilder().createDropTeamRequest()
    .setOwnerId(ownerId)
    .setTeamId(teamId)
    .setTeamType(teamType)
    .send(new GSEventListener<DropTeamResponse>() {
        @Override
        public void onEvent(DropTeamResponse response) {
            GSData scriptData = response.getScriptData(); 
        }
    });

Cloud Code


    var request = new SparkRequests.DropTeamRequest();
    request.ownerId = ...;
    request.teamId = ...;
    request.teamType = ...;
    var response = request.Send();

var scriptData = response.scriptData; 
Did this page help you? Please enter your feedback below. For questions about using this part of the platform, please contact support here