/// <summary>Snippet for CreateAssessmentAsync</summary> public async Task CreateAssessmentRequestObjectAsync() { // Snippet: CreateAssessmentAsync(CreateAssessmentRequest, CallSettings) // Additional: CreateAssessmentAsync(CreateAssessmentRequest, CancellationToken) // Create client RecaptchaEnterpriseServiceV1Beta1Client recaptchaEnterpriseServiceV1Beta1Client = await RecaptchaEnterpriseServiceV1Beta1Client.CreateAsync(); // Initialize request argument(s) CreateAssessmentRequest request = new CreateAssessmentRequest { ParentAsProjectName = ProjectName.FromProject("[PROJECT]"), Assessment = new Assessment(), }; // Make the request Assessment response = await recaptchaEnterpriseServiceV1Beta1Client.CreateAssessmentAsync(request); // End snippet }
/// <summary>Snippet for CreateAssessmentAsync</summary> public async Task CreateAssessmentAsync() { // Snippet: CreateAssessmentAsync(string, Assessment, CallSettings) // Additional: CreateAssessmentAsync(string, Assessment, CancellationToken) // Create client RecaptchaEnterpriseServiceV1Beta1Client recaptchaEnterpriseServiceV1Beta1Client = await RecaptchaEnterpriseServiceV1Beta1Client.CreateAsync(); // Initialize request argument(s) string parent = "projects/[PROJECT]"; Assessment assessment = new Assessment(); // Make the request Assessment response = await recaptchaEnterpriseServiceV1Beta1Client.CreateAssessmentAsync(parent, assessment); // End snippet }
/// <summary>Snippet for UpdateKeyAsync</summary> public async Task UpdateKeyRequestObjectAsync() { // Snippet: UpdateKeyAsync(UpdateKeyRequest, CallSettings) // Additional: UpdateKeyAsync(UpdateKeyRequest, CancellationToken) // Create client RecaptchaEnterpriseServiceV1Beta1Client recaptchaEnterpriseServiceV1Beta1Client = await RecaptchaEnterpriseServiceV1Beta1Client.CreateAsync(); // Initialize request argument(s) UpdateKeyRequest request = new UpdateKeyRequest { Key = new Key(), UpdateMask = new FieldMask(), }; // Make the request Key response = await recaptchaEnterpriseServiceV1Beta1Client.UpdateKeyAsync(request); // End snippet }
/// <summary>Snippet for DeleteKeyAsync</summary> public async Task DeleteKeyRequestObjectAsync() { // Snippet: DeleteKeyAsync(DeleteKeyRequest, CallSettings) // Additional: DeleteKeyAsync(DeleteKeyRequest, CancellationToken) // Create client RecaptchaEnterpriseServiceV1Beta1Client recaptchaEnterpriseServiceV1Beta1Client = await RecaptchaEnterpriseServiceV1Beta1Client.CreateAsync(); // Initialize request argument(s) DeleteKeyRequest request = new DeleteKeyRequest { KeyName = KeyName.FromProjectKey("[PROJECT]", "[KEY]"), }; // Make the request await recaptchaEnterpriseServiceV1Beta1Client.DeleteKeyAsync(request); // End snippet }
/// <summary>Snippet for ListKeysAsync</summary> public async Task ListKeysRequestObjectAsync() { // Snippet: ListKeysAsync(ListKeysRequest, CallSettings) // Create client RecaptchaEnterpriseServiceV1Beta1Client recaptchaEnterpriseServiceV1Beta1Client = await RecaptchaEnterpriseServiceV1Beta1Client.CreateAsync(); // Initialize request argument(s) ListKeysRequest request = new ListKeysRequest { ParentAsProjectName = ProjectName.FromProject("[PROJECT]"), }; // Make the request PagedAsyncEnumerable <ListKeysResponse, Key> response = recaptchaEnterpriseServiceV1Beta1Client.ListKeysAsync(request); // Iterate over all response items, lazily performing RPCs as required await response.ForEachAsync((Key item) => { // Do something with each item Console.WriteLine(item); }); // Or iterate over pages (of server-defined size), performing one RPC per page await response.AsRawResponses().ForEachAsync((ListKeysResponse page) => { // Do something with each page of items Console.WriteLine("A page of results:"); foreach (Key item in page) { // Do something with each item Console.WriteLine(item); } }); // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required int pageSize = 10; Page <Key> singlePage = await response.ReadPageAsync(pageSize); // Do something with the page of items Console.WriteLine($"A page of {pageSize} results (unless it's the final page):"); foreach (Key item in singlePage) { // Do something with each item Console.WriteLine(item); } // Store the pageToken, for when the next page is required. string nextPageToken = singlePage.NextPageToken; // End snippet }
/// <summary>Snippet for AnnotateAssessmentAsync</summary> public async Task AnnotateAssessmentResourceNamesAsync() { // Snippet: AnnotateAssessmentAsync(AssessmentName, AnnotateAssessmentRequest.Types.Annotation, CallSettings) // Additional: AnnotateAssessmentAsync(AssessmentName, AnnotateAssessmentRequest.Types.Annotation, CancellationToken) // Create client RecaptchaEnterpriseServiceV1Beta1Client recaptchaEnterpriseServiceV1Beta1Client = await RecaptchaEnterpriseServiceV1Beta1Client.CreateAsync(); // Initialize request argument(s) AssessmentName name = AssessmentName.FromProjectAssessment("[PROJECT]", "[ASSESSMENT]"); AnnotateAssessmentRequest.Types.Annotation annotation = AnnotateAssessmentRequest.Types.Annotation.Unspecified; // Make the request AnnotateAssessmentResponse response = await recaptchaEnterpriseServiceV1Beta1Client.AnnotateAssessmentAsync(name, annotation); // End snippet }
/// <summary>Snippet for CreateAssessmentAsync</summary> public async Task CreateAssessmentResourceNamesAsync() { // Snippet: CreateAssessmentAsync(ProjectName, Assessment, CallSettings) // Additional: CreateAssessmentAsync(ProjectName, Assessment, CancellationToken) // Create client RecaptchaEnterpriseServiceV1Beta1Client recaptchaEnterpriseServiceV1Beta1Client = await RecaptchaEnterpriseServiceV1Beta1Client.CreateAsync(); // Initialize request argument(s) ProjectName parent = ProjectName.FromProject("[PROJECT]"); Assessment assessment = new Assessment(); // Make the request Assessment response = await recaptchaEnterpriseServiceV1Beta1Client.CreateAssessmentAsync(parent, assessment); // End snippet }
/// <summary>Snippet for AnnotateAssessmentAsync</summary> public async Task AnnotateAssessmentAsync_RequestObject() { // Snippet: AnnotateAssessmentAsync(AnnotateAssessmentRequest,CallSettings) // Additional: AnnotateAssessmentAsync(AnnotateAssessmentRequest,CancellationToken) // Create client RecaptchaEnterpriseServiceV1Beta1Client recaptchaEnterpriseServiceV1Beta1Client = await RecaptchaEnterpriseServiceV1Beta1Client.CreateAsync(); // Initialize request argument(s) AnnotateAssessmentRequest request = new AnnotateAssessmentRequest { AssessmentName = new AssessmentName("[PROJECT]", "[ASSESSMENT]"), Annotation = AnnotateAssessmentRequest.Types.Annotation.Unspecified, }; // Make the request AnnotateAssessmentResponse response = await recaptchaEnterpriseServiceV1Beta1Client.AnnotateAssessmentAsync(request); // End snippet }
/// <summary>Snippet for GetKeyAsync</summary> public async Task GetKeyAsync_RequestObject() { // Snippet: GetKeyAsync(GetKeyRequest, CallSettings) // Additional: GetKeyAsync(GetKeyRequest, CancellationToken) // Create client RecaptchaEnterpriseServiceV1Beta1Client recaptchaEnterpriseServiceV1Beta1Client = await RecaptchaEnterpriseServiceV1Beta1Client.CreateAsync(); // Initialize request argument(s) GetKeyRequest request = new GetKeyRequest { KeyName = new KeyName("[PROJECT]", "[KEY]"), }; // Make the request Key response = await recaptchaEnterpriseServiceV1Beta1Client.GetKeyAsync(request); // End snippet }