com.xiaomi.infra.galaxy.rpc.thrift.AuthService Maven / Gradle / Ivy
/**
* Autogenerated by Thrift Compiler (0.9.2)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package com.xiaomi.infra.galaxy.rpc.thrift;
import libthrift091.scheme.IScheme;
import libthrift091.scheme.SchemeFactory;
import libthrift091.scheme.StandardScheme;
import libthrift091.scheme.TupleScheme;
import libthrift091.protocol.TTupleProtocol;
import libthrift091.protocol.TProtocolException;
import libthrift091.EncodingUtils;
import libthrift091.TException;
import libthrift091.async.AsyncMethodCallback;
import libthrift091.server.AbstractNonblockingServer.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import javax.annotation.Generated;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2016-6-16")
public class AuthService {
/**
* 授权相关接口(目前尚未开放)
*/
public interface Iface extends com.xiaomi.infra.galaxy.rpc.thrift.BaseService.Iface {
/**
* 通过第三方认证系统换发Storage Access Token,采用App Secret登录无需此过程
*
* @param xiaomiAppId
* @param appUserAuthProvider
* @param authToken
*/
public Credential createCredential(String xiaomiAppId, AppUserAuthProvider appUserAuthProvider, String authToken) throws com.xiaomi.infra.galaxy.rpc.thrift.ServiceException, libthrift091.TException;
}
public interface AsyncIface extends com.xiaomi.infra.galaxy.rpc.thrift.BaseService .AsyncIface {
public void createCredential(String xiaomiAppId, AppUserAuthProvider appUserAuthProvider, String authToken, libthrift091.async.AsyncMethodCallback resultHandler) throws libthrift091.TException;
}
public static class Client extends com.xiaomi.infra.galaxy.rpc.thrift.BaseService.Client implements Iface {
public static class Factory implements libthrift091.TServiceClientFactory {
public Factory() {}
public Client getClient(libthrift091.protocol.TProtocol prot) {
return new Client(prot);
}
public Client getClient(libthrift091.protocol.TProtocol iprot, libthrift091.protocol.TProtocol oprot) {
return new Client(iprot, oprot);
}
}
public Client(libthrift091.protocol.TProtocol prot)
{
super(prot, prot);
}
public Client(libthrift091.protocol.TProtocol iprot, libthrift091.protocol.TProtocol oprot) {
super(iprot, oprot);
}
public Credential createCredential(String xiaomiAppId, AppUserAuthProvider appUserAuthProvider, String authToken) throws com.xiaomi.infra.galaxy.rpc.thrift.ServiceException, libthrift091.TException
{
send_createCredential(xiaomiAppId, appUserAuthProvider, authToken);
return recv_createCredential();
}
public void send_createCredential(String xiaomiAppId, AppUserAuthProvider appUserAuthProvider, String authToken) throws libthrift091.TException
{
createCredential_args args = new createCredential_args();
args.setXiaomiAppId(xiaomiAppId);
args.setAppUserAuthProvider(appUserAuthProvider);
args.setAuthToken(authToken);
sendBase("createCredential", args);
}
public Credential recv_createCredential() throws com.xiaomi.infra.galaxy.rpc.thrift.ServiceException, libthrift091.TException
{
createCredential_result result = new createCredential_result();
receiveBase(result, "createCredential");
if (result.isSetSuccess()) {
return result.success;
}
if (result.se != null) {
throw result.se;
}
throw new libthrift091.TApplicationException(libthrift091.TApplicationException.MISSING_RESULT, "createCredential failed: unknown result");
}
}
public static class AsyncClient extends com.xiaomi.infra.galaxy.rpc.thrift.BaseService.AsyncClient implements AsyncIface {
public static class Factory implements libthrift091.async.TAsyncClientFactory {
private libthrift091.async.TAsyncClientManager clientManager;
private libthrift091.protocol.TProtocolFactory protocolFactory;
public Factory(libthrift091.async.TAsyncClientManager clientManager, libthrift091.protocol.TProtocolFactory protocolFactory) {
this.clientManager = clientManager;
this.protocolFactory = protocolFactory;
}
public AsyncClient getAsyncClient(libthrift091.transport.TNonblockingTransport transport) {
return new AsyncClient(protocolFactory, clientManager, transport);
}
}
public AsyncClient(libthrift091.protocol.TProtocolFactory protocolFactory, libthrift091.async.TAsyncClientManager clientManager, libthrift091.transport.TNonblockingTransport transport) {
super(protocolFactory, clientManager, transport);
}
public void createCredential(String xiaomiAppId, AppUserAuthProvider appUserAuthProvider, String authToken, libthrift091.async.AsyncMethodCallback resultHandler) throws libthrift091.TException {
checkReady();
createCredential_call method_call = new createCredential_call(xiaomiAppId, appUserAuthProvider, authToken, resultHandler, this, ___protocolFactory, ___transport);
this.___currentMethod = method_call;
___manager.call(method_call);
}
public static class createCredential_call extends libthrift091.async.TAsyncMethodCall {
private String xiaomiAppId;
private AppUserAuthProvider appUserAuthProvider;
private String authToken;
public createCredential_call(String xiaomiAppId, AppUserAuthProvider appUserAuthProvider, String authToken, libthrift091.async.AsyncMethodCallback resultHandler, libthrift091.async.TAsyncClient client, libthrift091.protocol.TProtocolFactory protocolFactory, libthrift091.transport.TNonblockingTransport transport) throws libthrift091.TException {
super(client, protocolFactory, transport, resultHandler, false);
this.xiaomiAppId = xiaomiAppId;
this.appUserAuthProvider = appUserAuthProvider;
this.authToken = authToken;
}
public void write_args(libthrift091.protocol.TProtocol prot) throws libthrift091.TException {
prot.writeMessageBegin(new libthrift091.protocol.TMessage("createCredential", libthrift091.protocol.TMessageType.CALL, 0));
createCredential_args args = new createCredential_args();
args.setXiaomiAppId(xiaomiAppId);
args.setAppUserAuthProvider(appUserAuthProvider);
args.setAuthToken(authToken);
args.write(prot);
prot.writeMessageEnd();
}
public Credential getResult() throws com.xiaomi.infra.galaxy.rpc.thrift.ServiceException, libthrift091.TException {
if (getState() != libthrift091.async.TAsyncMethodCall.State.RESPONSE_READ) {
throw new IllegalStateException("Method call not finished!");
}
libthrift091.transport.TMemoryInputTransport memoryTransport = new libthrift091.transport.TMemoryInputTransport(getFrameBuffer().array());
libthrift091.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
return (new Client(prot)).recv_createCredential();
}
}
}
public static class Processor extends com.xiaomi.infra.galaxy.rpc.thrift.BaseService.Processor implements libthrift091.TProcessor {
private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName());
public Processor(I iface) {
super(iface, getProcessMap(new HashMap>()));
}
protected Processor(I iface, Map> processMap) {
super(iface, getProcessMap(processMap));
}
private static Map> getProcessMap(Map> processMap) {
processMap.put("createCredential", new createCredential());
return processMap;
}
public static class createCredential extends libthrift091.ProcessFunction {
public createCredential() {
super("createCredential");
}
public createCredential_args getEmptyArgsInstance() {
return new createCredential_args();
}
protected boolean isOneway() {
return false;
}
public createCredential_result getResult(I iface, createCredential_args args) throws libthrift091.TException {
createCredential_result result = new createCredential_result();
try {
result.success = iface.createCredential(args.xiaomiAppId, args.appUserAuthProvider, args.authToken);
} catch (com.xiaomi.infra.galaxy.rpc.thrift.ServiceException se) {
result.se = se;
}
return result;
}
}
}
public static class AsyncProcessor extends com.xiaomi.infra.galaxy.rpc.thrift.BaseService.AsyncProcessor {
private static final Logger LOGGER = LoggerFactory.getLogger(AsyncProcessor.class.getName());
public AsyncProcessor(I iface) {
super(iface, getProcessMap(new HashMap>()));
}
protected AsyncProcessor(I iface, Map> processMap) {
super(iface, getProcessMap(processMap));
}
private static Map> getProcessMap(Map> processMap) {
processMap.put("createCredential", new createCredential());
return processMap;
}
public static class createCredential extends libthrift091.AsyncProcessFunction {
public createCredential() {
super("createCredential");
}
public createCredential_args getEmptyArgsInstance() {
return new createCredential_args();
}
public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
final libthrift091.AsyncProcessFunction fcall = this;
return new AsyncMethodCallback() {
public void onComplete(Credential o) {
createCredential_result result = new createCredential_result();
result.success = o;
try {
fcall.sendResponse(fb,result, libthrift091.protocol.TMessageType.REPLY,seqid);
return;
} catch (Exception e) {
LOGGER.error("Exception writing to internal frame buffer", e);
}
fb.close();
}
public void onError(Exception e) {
byte msgType = libthrift091.protocol.TMessageType.REPLY;
libthrift091.TBase msg;
createCredential_result result = new createCredential_result();
if (e instanceof com.xiaomi.infra.galaxy.rpc.thrift.ServiceException) {
result.se = (com.xiaomi.infra.galaxy.rpc.thrift.ServiceException) e;
result.setSeIsSet(true);
msg = result;
}
else
{
msgType = libthrift091.protocol.TMessageType.EXCEPTION;
msg = (libthrift091.TBase)new libthrift091.TApplicationException(libthrift091.TApplicationException.INTERNAL_ERROR, e.getMessage());
}
try {
fcall.sendResponse(fb,msg,msgType,seqid);
return;
} catch (Exception ex) {
LOGGER.error("Exception writing to internal frame buffer", ex);
}
fb.close();
}
};
}
protected boolean isOneway() {
return false;
}
public void start(I iface, createCredential_args args, libthrift091.async.AsyncMethodCallback resultHandler) throws TException {
iface.createCredential(args.xiaomiAppId, args.appUserAuthProvider, args.authToken,resultHandler);
}
}
}
public static class createCredential_args implements libthrift091.TBase, java.io.Serializable, Cloneable, Comparable {
private static final libthrift091.protocol.TStruct STRUCT_DESC = new libthrift091.protocol.TStruct("createCredential_args");
private static final libthrift091.protocol.TField XIAOMI_APP_ID_FIELD_DESC = new libthrift091.protocol.TField("xiaomiAppId", libthrift091.protocol.TType.STRING, (short)1);
private static final libthrift091.protocol.TField APP_USER_AUTH_PROVIDER_FIELD_DESC = new libthrift091.protocol.TField("appUserAuthProvider", libthrift091.protocol.TType.I32, (short)2);
private static final libthrift091.protocol.TField AUTH_TOKEN_FIELD_DESC = new libthrift091.protocol.TField("authToken", libthrift091.protocol.TType.STRING, (short)3);
private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new createCredential_argsStandardSchemeFactory());
schemes.put(TupleScheme.class, new createCredential_argsTupleSchemeFactory());
}
public String xiaomiAppId; // required
/**
*
* @see AppUserAuthProvider
*/
public AppUserAuthProvider appUserAuthProvider; // required
public String authToken; // required
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements libthrift091.TFieldIdEnum {
XIAOMI_APP_ID((short)1, "xiaomiAppId"),
/**
*
* @see AppUserAuthProvider
*/
APP_USER_AUTH_PROVIDER((short)2, "appUserAuthProvider"),
AUTH_TOKEN((short)3, "authToken");
private static final Map byName = new HashMap();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
byName.put(field.getFieldName(), field);
}
}
/**
* Find the _Fields constant that matches fieldId, or null if its not found.
*/
public static _Fields findByThriftId(int fieldId) {
switch(fieldId) {
case 1: // XIAOMI_APP_ID
return XIAOMI_APP_ID;
case 2: // APP_USER_AUTH_PROVIDER
return APP_USER_AUTH_PROVIDER;
case 3: // AUTH_TOKEN
return AUTH_TOKEN;
default:
return null;
}
}
/**
* Find the _Fields constant that matches fieldId, throwing an exception
* if it is not found.
*/
public static _Fields findByThriftIdOrThrow(int fieldId) {
_Fields fields = findByThriftId(fieldId);
if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
return fields;
}
/**
* Find the _Fields constant that matches name, or null if its not found.
*/
public static _Fields findByName(String name) {
return byName.get(name);
}
private final short _thriftId;
private final String _fieldName;
_Fields(short thriftId, String fieldName) {
_thriftId = thriftId;
_fieldName = fieldName;
}
public short getThriftFieldId() {
return _thriftId;
}
public String getFieldName() {
return _fieldName;
}
}
// isset id assignments
public static final Map<_Fields, libthrift091.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, libthrift091.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, libthrift091.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.XIAOMI_APP_ID, new libthrift091.meta_data.FieldMetaData("xiaomiAppId", libthrift091.TFieldRequirementType.DEFAULT,
new libthrift091.meta_data.FieldValueMetaData(libthrift091.protocol.TType.STRING)));
tmpMap.put(_Fields.APP_USER_AUTH_PROVIDER, new libthrift091.meta_data.FieldMetaData("appUserAuthProvider", libthrift091.TFieldRequirementType.DEFAULT,
new libthrift091.meta_data.EnumMetaData(libthrift091.protocol.TType.ENUM, AppUserAuthProvider.class)));
tmpMap.put(_Fields.AUTH_TOKEN, new libthrift091.meta_data.FieldMetaData("authToken", libthrift091.TFieldRequirementType.DEFAULT,
new libthrift091.meta_data.FieldValueMetaData(libthrift091.protocol.TType.STRING)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
libthrift091.meta_data.FieldMetaData.addStructMetaDataMap(createCredential_args.class, metaDataMap);
}
public createCredential_args() {
}
public createCredential_args(
String xiaomiAppId,
AppUserAuthProvider appUserAuthProvider,
String authToken)
{
this();
this.xiaomiAppId = xiaomiAppId;
this.appUserAuthProvider = appUserAuthProvider;
this.authToken = authToken;
}
/**
* Performs a deep copy on other.
*/
public createCredential_args(createCredential_args other) {
if (other.isSetXiaomiAppId()) {
this.xiaomiAppId = other.xiaomiAppId;
}
if (other.isSetAppUserAuthProvider()) {
this.appUserAuthProvider = other.appUserAuthProvider;
}
if (other.isSetAuthToken()) {
this.authToken = other.authToken;
}
}
public createCredential_args deepCopy() {
return new createCredential_args(this);
}
@Override
public void clear() {
this.xiaomiAppId = null;
this.appUserAuthProvider = null;
this.authToken = null;
}
public String getXiaomiAppId() {
return this.xiaomiAppId;
}
public createCredential_args setXiaomiAppId(String xiaomiAppId) {
this.xiaomiAppId = xiaomiAppId;
return this;
}
public void unsetXiaomiAppId() {
this.xiaomiAppId = null;
}
/** Returns true if field xiaomiAppId is set (has been assigned a value) and false otherwise */
public boolean isSetXiaomiAppId() {
return this.xiaomiAppId != null;
}
public void setXiaomiAppIdIsSet(boolean value) {
if (!value) {
this.xiaomiAppId = null;
}
}
/**
*
* @see AppUserAuthProvider
*/
public AppUserAuthProvider getAppUserAuthProvider() {
return this.appUserAuthProvider;
}
/**
*
* @see AppUserAuthProvider
*/
public createCredential_args setAppUserAuthProvider(AppUserAuthProvider appUserAuthProvider) {
this.appUserAuthProvider = appUserAuthProvider;
return this;
}
public void unsetAppUserAuthProvider() {
this.appUserAuthProvider = null;
}
/** Returns true if field appUserAuthProvider is set (has been assigned a value) and false otherwise */
public boolean isSetAppUserAuthProvider() {
return this.appUserAuthProvider != null;
}
public void setAppUserAuthProviderIsSet(boolean value) {
if (!value) {
this.appUserAuthProvider = null;
}
}
public String getAuthToken() {
return this.authToken;
}
public createCredential_args setAuthToken(String authToken) {
this.authToken = authToken;
return this;
}
public void unsetAuthToken() {
this.authToken = null;
}
/** Returns true if field authToken is set (has been assigned a value) and false otherwise */
public boolean isSetAuthToken() {
return this.authToken != null;
}
public void setAuthTokenIsSet(boolean value) {
if (!value) {
this.authToken = null;
}
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case XIAOMI_APP_ID:
if (value == null) {
unsetXiaomiAppId();
} else {
setXiaomiAppId((String)value);
}
break;
case APP_USER_AUTH_PROVIDER:
if (value == null) {
unsetAppUserAuthProvider();
} else {
setAppUserAuthProvider((AppUserAuthProvider)value);
}
break;
case AUTH_TOKEN:
if (value == null) {
unsetAuthToken();
} else {
setAuthToken((String)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case XIAOMI_APP_ID:
return getXiaomiAppId();
case APP_USER_AUTH_PROVIDER:
return getAppUserAuthProvider();
case AUTH_TOKEN:
return getAuthToken();
}
throw new IllegalStateException();
}
/** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
case XIAOMI_APP_ID:
return isSetXiaomiAppId();
case APP_USER_AUTH_PROVIDER:
return isSetAppUserAuthProvider();
case AUTH_TOKEN:
return isSetAuthToken();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof createCredential_args)
return this.equals((createCredential_args)that);
return false;
}
public boolean equals(createCredential_args that) {
if (that == null)
return false;
boolean this_present_xiaomiAppId = true && this.isSetXiaomiAppId();
boolean that_present_xiaomiAppId = true && that.isSetXiaomiAppId();
if (this_present_xiaomiAppId || that_present_xiaomiAppId) {
if (!(this_present_xiaomiAppId && that_present_xiaomiAppId))
return false;
if (!this.xiaomiAppId.equals(that.xiaomiAppId))
return false;
}
boolean this_present_appUserAuthProvider = true && this.isSetAppUserAuthProvider();
boolean that_present_appUserAuthProvider = true && that.isSetAppUserAuthProvider();
if (this_present_appUserAuthProvider || that_present_appUserAuthProvider) {
if (!(this_present_appUserAuthProvider && that_present_appUserAuthProvider))
return false;
if (!this.appUserAuthProvider.equals(that.appUserAuthProvider))
return false;
}
boolean this_present_authToken = true && this.isSetAuthToken();
boolean that_present_authToken = true && that.isSetAuthToken();
if (this_present_authToken || that_present_authToken) {
if (!(this_present_authToken && that_present_authToken))
return false;
if (!this.authToken.equals(that.authToken))
return false;
}
return true;
}
@Override
public int hashCode() {
List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy