net.accelbyte.sdk.api.iam.operations.users.PlatformLink Maven / Gradle / Ivy
Show all versions of sdk Show documentation
/*
* Copyright (c) 2022 AccelByte Inc. All Rights Reserved
* This is licensed software from AccelByte Inc, for limitations
* and restrictions contact your company contract manager.
*
* Code generated. DO NOT EDIT.
*/
package net.accelbyte.sdk.api.iam.operations.users;
import java.io.*;
import java.util.*;
import lombok.Builder;
import lombok.Getter;
import lombok.Setter;
import net.accelbyte.sdk.core.HttpResponseException;
import net.accelbyte.sdk.core.Operation;
import net.accelbyte.sdk.core.util.Helper;
/**
* PlatformLink
*
* ## The endpoint is going to be deprecated
*
*
Endpoint migration guide
*
*
* Substitute endpoint: /iam/v3/public/namespaces/{namespace}/users/me/platforms/{platformId}
* [POST]
*
*
Required permission 'NAMESPACE:{namespace}:USER:{userId} [UPDATE]'.
*
*
Prerequisite: Platform client configuration need to be added to database for specific
* platformId. Namespace service URL need to be specified (refer to required environment variables).
*
*
## Supported platforms:
*
*
* steam : The ticketâs value is the authentication code returned by Steam.
*
*
* steamopenid : Steam's user authentication method using OpenID 2.0. The ticket's value is URL
* generated by Steam on web authentication
*
*
* facebook : The ticketâs value is the authorization code returned by Facebook OAuth
*
*
* google : The ticketâs value is the authorization code returned by Google OAuth
*
*
* oculus : The ticketâs value is a string composed of Oculus's user ID and the nonce
* separated by a colon (:).
*
*
* twitch : The ticketâs value is the authorization code returned by Twitch OAuth.
*
*
* android : The ticket's value is the Androidâs device ID
*
*
* ios : The ticket's value is the iOSâs device ID.
*
*
* apple : The ticketâs value is the authorization code returned by Apple OAuth.
*
*
* device : Every device that doesânt run Android and iOS is categorized as a device
* platform. The ticket's value is the deviceâs ID.
*
*
* discord : The ticketâs value is the authorization code returned by Discord OAuth.
*
* @deprecated
*/
@Deprecated
@Getter
@Setter
public class PlatformLink extends Operation {
/** generated field's value */
private String path = "/iam/namespaces/{namespace}/users/{userId}/platforms/{platformId}/link";
private String method = "POST";
private List consumes = Arrays.asList("application/x-www-form-urlencoded");
private List produces = Arrays.asList("application/json");
private String locationQuery = null;
/** fields as input parameter */
private String namespace;
private String platformId;
private String userId;
private String ticket;
/**
* @param namespace required
* @param platformId required
* @param userId required
* @param ticket required
*/
@Builder
// @deprecated 2022-08-29 - All args constructor may cause problems. Use builder instead.
@Deprecated
public PlatformLink(String namespace, String platformId, String userId, String ticket) {
this.namespace = namespace;
this.platformId = platformId;
this.userId = userId;
this.ticket = ticket;
securities.add("Bearer");
}
@Override
public Map getPathParams() {
Map pathParams = new HashMap<>();
if (this.namespace != null) {
pathParams.put("namespace", this.namespace);
}
if (this.platformId != null) {
pathParams.put("platformId", this.platformId);
}
if (this.userId != null) {
pathParams.put("userId", this.userId);
}
return pathParams;
}
@Override
public Map getFormParams() {
Map formDataParams = new HashMap<>();
if (this.ticket != null) {
formDataParams.put("ticket", this.ticket);
}
return formDataParams;
}
@Override
public boolean isValid() {
if (this.namespace == null) {
return false;
}
if (this.platformId == null) {
return false;
}
if (this.userId == null) {
return false;
}
if (this.ticket == null) {
return false;
}
return true;
}
public void handleEmptyResponse(int code, String contentType, InputStream payload)
throws HttpResponseException, IOException {
if (code != 204) {
final String json = Helper.convertInputStreamToString(payload);
throw new HttpResponseException(code, json);
}
}
}