/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the personalize-runtime-2018-05-22.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Net;
using Amazon.PersonalizeRuntime.Model;
using Amazon.PersonalizeRuntime.Model.Internal.MarshallTransformations;
using Amazon.PersonalizeRuntime.Internal;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Auth;
using Amazon.Runtime.Internal.Transform;
namespace Amazon.PersonalizeRuntime
{
///
/// Implementation for accessing PersonalizeRuntime
///
///
///
public partial class AmazonPersonalizeRuntimeClient : AmazonServiceClient, IAmazonPersonalizeRuntime
{
private static IServiceMetadata serviceMetadata = new AmazonPersonalizeRuntimeMetadata();
#region Constructors
///
/// Constructs AmazonPersonalizeRuntimeClient with the credentials loaded from the application's
/// default configuration, and if unsuccessful from the Instance Profile service on an EC2 instance.
///
/// Example App.config with credentials set.
///
/// <?xml version="1.0" encoding="utf-8" ?>
/// <configuration>
/// <appSettings>
/// <add key="AWSProfileName" value="AWS Default"/>
/// </appSettings>
/// </configuration>
///
///
///
public AmazonPersonalizeRuntimeClient()
: base(FallbackCredentialsFactory.GetCredentials(), new AmazonPersonalizeRuntimeConfig()) { }
///
/// Constructs AmazonPersonalizeRuntimeClient with the credentials loaded from the application's
/// default configuration, and if unsuccessful from the Instance Profile service on an EC2 instance.
///
/// Example App.config with credentials set.
///
/// <?xml version="1.0" encoding="utf-8" ?>
/// <configuration>
/// <appSettings>
/// <add key="AWSProfileName" value="AWS Default"/>
/// </appSettings>
/// </configuration>
///
///
///
/// The region to connect.
public AmazonPersonalizeRuntimeClient(RegionEndpoint region)
: base(FallbackCredentialsFactory.GetCredentials(), new AmazonPersonalizeRuntimeConfig{RegionEndpoint = region}) { }
///
/// Constructs AmazonPersonalizeRuntimeClient with the credentials loaded from the application's
/// default configuration, and if unsuccessful from the Instance Profile service on an EC2 instance.
///
/// Example App.config with credentials set.
///
/// <?xml version="1.0" encoding="utf-8" ?>
/// <configuration>
/// <appSettings>
/// <add key="AWSProfileName" value="AWS Default"/>
/// </appSettings>
/// </configuration>
///
///
///
/// The AmazonPersonalizeRuntimeClient Configuration Object
public AmazonPersonalizeRuntimeClient(AmazonPersonalizeRuntimeConfig config)
: base(FallbackCredentialsFactory.GetCredentials(config), config){}
///
/// Constructs AmazonPersonalizeRuntimeClient with AWS Credentials
///
/// AWS Credentials
public AmazonPersonalizeRuntimeClient(AWSCredentials credentials)
: this(credentials, new AmazonPersonalizeRuntimeConfig())
{
}
///
/// Constructs AmazonPersonalizeRuntimeClient with AWS Credentials
///
/// AWS Credentials
/// The region to connect.
public AmazonPersonalizeRuntimeClient(AWSCredentials credentials, RegionEndpoint region)
: this(credentials, new AmazonPersonalizeRuntimeConfig{RegionEndpoint = region})
{
}
///
/// Constructs AmazonPersonalizeRuntimeClient with AWS Credentials and an
/// AmazonPersonalizeRuntimeClient Configuration object.
///
/// AWS Credentials
/// The AmazonPersonalizeRuntimeClient Configuration Object
public AmazonPersonalizeRuntimeClient(AWSCredentials credentials, AmazonPersonalizeRuntimeConfig clientConfig)
: base(credentials, clientConfig)
{
}
///
/// Constructs AmazonPersonalizeRuntimeClient with AWS Access Key ID and AWS Secret Key
///
/// AWS Access Key ID
/// AWS Secret Access Key
public AmazonPersonalizeRuntimeClient(string awsAccessKeyId, string awsSecretAccessKey)
: this(awsAccessKeyId, awsSecretAccessKey, new AmazonPersonalizeRuntimeConfig())
{
}
///
/// Constructs AmazonPersonalizeRuntimeClient with AWS Access Key ID and AWS Secret Key
///
/// AWS Access Key ID
/// AWS Secret Access Key
/// The region to connect.
public AmazonPersonalizeRuntimeClient(string awsAccessKeyId, string awsSecretAccessKey, RegionEndpoint region)
: this(awsAccessKeyId, awsSecretAccessKey, new AmazonPersonalizeRuntimeConfig() {RegionEndpoint=region})
{
}
///
/// Constructs AmazonPersonalizeRuntimeClient with AWS Access Key ID, AWS Secret Key and an
/// AmazonPersonalizeRuntimeClient Configuration object.
///
/// AWS Access Key ID
/// AWS Secret Access Key
/// The AmazonPersonalizeRuntimeClient Configuration Object
public AmazonPersonalizeRuntimeClient(string awsAccessKeyId, string awsSecretAccessKey, AmazonPersonalizeRuntimeConfig clientConfig)
: base(awsAccessKeyId, awsSecretAccessKey, clientConfig)
{
}
///
/// Constructs AmazonPersonalizeRuntimeClient with AWS Access Key ID and AWS Secret Key
///
/// AWS Access Key ID
/// AWS Secret Access Key
/// AWS Session Token
public AmazonPersonalizeRuntimeClient(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken)
: this(awsAccessKeyId, awsSecretAccessKey, awsSessionToken, new AmazonPersonalizeRuntimeConfig())
{
}
///
/// Constructs AmazonPersonalizeRuntimeClient with AWS Access Key ID and AWS Secret Key
///
/// AWS Access Key ID
/// AWS Secret Access Key
/// AWS Session Token
/// The region to connect.
public AmazonPersonalizeRuntimeClient(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken, RegionEndpoint region)
: this(awsAccessKeyId, awsSecretAccessKey, awsSessionToken, new AmazonPersonalizeRuntimeConfig{RegionEndpoint = region})
{
}
///
/// Constructs AmazonPersonalizeRuntimeClient with AWS Access Key ID, AWS Secret Key and an
/// AmazonPersonalizeRuntimeClient Configuration object.
///
/// AWS Access Key ID
/// AWS Secret Access Key
/// AWS Session Token
/// The AmazonPersonalizeRuntimeClient Configuration Object
public AmazonPersonalizeRuntimeClient(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken, AmazonPersonalizeRuntimeConfig clientConfig)
: base(awsAccessKeyId, awsSecretAccessKey, awsSessionToken, clientConfig)
{
}
#endregion
#region Overrides
///
/// Creates the signer for the service.
///
protected override AbstractAWSSigner CreateSigner()
{
return new AWS4Signer();
}
///
/// Customize the pipeline
///
///
protected override void CustomizeRuntimePipeline(RuntimePipeline pipeline)
{
pipeline.RemoveHandler();
pipeline.AddHandlerAfter(new AmazonPersonalizeRuntimeEndpointResolver());
}
///
/// Capture metadata for the service.
///
protected override IServiceMetadata ServiceMetadata
{
get
{
return serviceMetadata;
}
}
#endregion
#region Dispose
///
/// Disposes the service client.
///
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
}
#endregion
#region GetPersonalizedRanking
///
/// Re-ranks a list of recommended items for the given user. The first item in the list
/// is deemed the most likely item to be of interest to the user.
///
///
///
/// The solution backing the campaign must have been created using a recipe of type PERSONALIZED_RANKING.
///
///
///
/// Container for the necessary parameters to execute the GetPersonalizedRanking service method.
///
/// The response from the GetPersonalizedRanking service method, as returned by PersonalizeRuntime.
///
/// Provide a valid value for the field or parameter.
///
///
/// The specified resource does not exist.
///
/// REST API Reference for GetPersonalizedRanking Operation
public virtual GetPersonalizedRankingResponse GetPersonalizedRanking(GetPersonalizedRankingRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = GetPersonalizedRankingRequestMarshaller.Instance;
options.ResponseUnmarshaller = GetPersonalizedRankingResponseUnmarshaller.Instance;
return Invoke(request, options);
}
///
/// Initiates the asynchronous execution of the GetPersonalizedRanking operation.
///
///
/// Container for the necessary parameters to execute the GetPersonalizedRanking operation on AmazonPersonalizeRuntimeClient.
/// An AsyncCallback delegate that is invoked when the operation completes.
/// A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.
///
/// An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndGetPersonalizedRanking
/// operation.
/// REST API Reference for GetPersonalizedRanking Operation
public virtual IAsyncResult BeginGetPersonalizedRanking(GetPersonalizedRankingRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = GetPersonalizedRankingRequestMarshaller.Instance;
options.ResponseUnmarshaller = GetPersonalizedRankingResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
///
/// Finishes the asynchronous execution of the GetPersonalizedRanking operation.
///
///
/// The IAsyncResult returned by the call to BeginGetPersonalizedRanking.
///
/// Returns a GetPersonalizedRankingResult from PersonalizeRuntime.
/// REST API Reference for GetPersonalizedRanking Operation
public virtual GetPersonalizedRankingResponse EndGetPersonalizedRanking(IAsyncResult asyncResult)
{
return EndInvoke(asyncResult);
}
#endregion
#region GetRecommendations
///
/// Returns a list of recommended items. For campaigns, the campaign's Amazon Resource
/// Name (ARN) is required and the required user and item input depends on the recipe
/// type used to create the solution backing the campaign as follows:
///
/// -
///
/// USER_PERSONALIZATION -
userId
required, itemId
not used
///
/// -
///
/// RELATED_ITEMS -
itemId
required, userId
not used
///
///
///
/// Campaigns that are backed by a solution created using a recipe of type PERSONALIZED_RANKING
/// use the API.
///
///
///
/// For recommenders, the recommender's ARN is required and the required item and user
/// input depends on the use case (domain-based recipe) backing the recommender. For information
/// on use case requirements see Choosing
/// recommender use cases.
///
///
/// Container for the necessary parameters to execute the GetRecommendations service method.
///
/// The response from the GetRecommendations service method, as returned by PersonalizeRuntime.
///
/// Provide a valid value for the field or parameter.
///
///
/// The specified resource does not exist.
///
/// REST API Reference for GetRecommendations Operation
public virtual GetRecommendationsResponse GetRecommendations(GetRecommendationsRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = GetRecommendationsRequestMarshaller.Instance;
options.ResponseUnmarshaller = GetRecommendationsResponseUnmarshaller.Instance;
return Invoke(request, options);
}
///
/// Initiates the asynchronous execution of the GetRecommendations operation.
///
///
/// Container for the necessary parameters to execute the GetRecommendations operation on AmazonPersonalizeRuntimeClient.
/// An AsyncCallback delegate that is invoked when the operation completes.
/// A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.
///
/// An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndGetRecommendations
/// operation.
/// REST API Reference for GetRecommendations Operation
public virtual IAsyncResult BeginGetRecommendations(GetRecommendationsRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = GetRecommendationsRequestMarshaller.Instance;
options.ResponseUnmarshaller = GetRecommendationsResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
///
/// Finishes the asynchronous execution of the GetRecommendations operation.
///
///
/// The IAsyncResult returned by the call to BeginGetRecommendations.
///
/// Returns a GetRecommendationsResult from PersonalizeRuntime.
/// REST API Reference for GetRecommendations Operation
public virtual GetRecommendationsResponse EndGetRecommendations(IAsyncResult asyncResult)
{
return EndInvoke(asyncResult);
}
#endregion
}
}