我retrofit2在我的Android应用程序中使用任何http/rest调用.现在我需要调用使用Amazon AWS API Gateway生成的api .
AWS文档说我应该生成客户端代码抛出API网关控制台并使用该类ApiClientFactory来构建请求:
ApiClientFactory factory = new ApiClientFactory();
// Use CognitoCachingCredentialsProvider to provide AWS credentials
// for the ApiClientFactory
AWSCredentialsProvider credentialsProvider = new CognitoCachingCredentialsProvider(
context, // activity context
"identityPoolId", // Cognito identity pool id
Regions.US_EAST_1 // region of Cognito identity pool
};
factory.credentialsProvider(credentialsProvider);
// Create an instance of your SDK (this should come from the generated code).
final MyApiClient client = factory.build(MyApiClient.class);
// Invoke a method (e.g., 'parentPath1Get(param1,body)') exposed …Run Code Online (Sandbox Code Playgroud)