Esempio n. 1
0
        public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems)
        {
            AmazonTranslateConfig config = new AmazonTranslateConfig();

            config.RegionEndpoint = region;
            ConfigureClient(config);
            AmazonTranslateClient client = new AmazonTranslateClient(creds, config);

            ListTextTranslationJobsResponse resp = new ListTextTranslationJobsResponse();

            do
            {
                ListTextTranslationJobsRequest req = new ListTextTranslationJobsRequest
                {
                    NextToken = resp.NextToken
                    ,
                    MaxResults = maxItems
                };

                resp = client.ListTextTranslationJobs(req);
                CheckError(resp.HttpStatusCode, "200");

                foreach (var obj in resp.TextTranslationJobPropertiesList)
                {
                    AddObject(obj);
                }
            }while (!string.IsNullOrEmpty(resp.NextToken));
        }
Esempio n. 2
0
        internal virtual ListTextTranslationJobsResponse ListTextTranslationJobs(ListTextTranslationJobsRequest request)
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = ListTextTranslationJobsRequestMarshaller.Instance;
            options.ResponseUnmarshaller = ListTextTranslationJobsResponseUnmarshaller.Instance;

            return(Invoke <ListTextTranslationJobsResponse>(request, options));
        }
Esempio n. 3
0
        /// <summary>
        /// Initiates the asynchronous execution of the ListTextTranslationJobs operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the ListTextTranslationJobs operation on AmazonTranslateClient.</param>
        /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
        /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
        ///          procedure using the AsyncState property.</param>
        ///
        /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndListTextTranslationJobs
        ///         operation.</returns>
        /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/translate-2017-07-01/ListTextTranslationJobs">REST API Reference for ListTextTranslationJobs Operation</seealso>
        public virtual IAsyncResult BeginListTextTranslationJobs(ListTextTranslationJobsRequest request, AsyncCallback callback, object state)
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = ListTextTranslationJobsRequestMarshaller.Instance;
            options.ResponseUnmarshaller = ListTextTranslationJobsResponseUnmarshaller.Instance;

            return(BeginInvoke(request, options, callback, state));
        }
        /// <summary>
        /// List Amazon Translate text translation jobs.
        /// </summary>
        /// <param name="client">The initialized Amazon Translate client object.</param>
        /// <param name="request">An Amazon Translate
        /// ListTextTranslationJobsRequest object detailing which text
        /// translation jobs are of interest.</param>
        public static async Task ListJobsAsync(
            AmazonTranslateClient client,
            ListTextTranslationJobsRequest request)
        {
            ListTextTranslationJobsResponse response;

            do
            {
                response = await client.ListTextTranslationJobsAsync(request);

                ShowTranslationJobDetails(response.TextTranslationJobPropertiesList);

                request.NextToken = response.NextToken;
            }while (response.NextToken is not null);
        }
        public static async Task Main()
        {
            var client = new AmazonTranslateClient();
            var filter = new TextTranslationJobFilter
            {
                JobStatus = "COMPLETED",
            };

            var request = new ListTextTranslationJobsRequest
            {
                MaxResults = 10,
                Filter     = filter,
            };

            await ListJobsAsync(client, request);
        }
Esempio n. 6
0
        /// <summary>
        /// Gets a list of the batch translation jobs that you have submitted.
        /// </summary>
        /// <param name="request">Container for the necessary parameters to execute the ListTextTranslationJobs service method.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        ///
        /// <returns>The response from the ListTextTranslationJobs service method, as returned by Translate.</returns>
        /// <exception cref="Amazon.Translate.Model.InternalServerException">
        /// An internal server error occurred. Retry your request.
        /// </exception>
        /// <exception cref="Amazon.Translate.Model.InvalidFilterException">
        /// The filter specified for the operation is invalid. Specify a different filter.
        /// </exception>
        /// <exception cref="Amazon.Translate.Model.InvalidRequestException">
        /// The request that you made is invalid. Check your request to determine why it's invalid
        /// and then retry the request.
        /// </exception>
        /// <exception cref="Amazon.Translate.Model.TooManyRequestsException">
        /// You have made too many requests within a short period of time. Wait for a short time
        /// and then try your request again.
        /// </exception>
        /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/translate-2017-07-01/ListTextTranslationJobs">REST API Reference for ListTextTranslationJobs Operation</seealso>
        public virtual Task <ListTextTranslationJobsResponse> ListTextTranslationJobsAsync(ListTextTranslationJobsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = ListTextTranslationJobsRequestMarshaller.Instance;
            options.ResponseUnmarshaller = ListTextTranslationJobsResponseUnmarshaller.Instance;

            return(InvokeAsync <ListTextTranslationJobsResponse>(request, options, cancellationToken));
        }