From eb7d6a8e111872b6e87bee87e116bb92ce01b987 Mon Sep 17 00:00:00 2001 From: Brent Shaffer Date: Tue, 17 Dec 2024 21:41:23 +0000 Subject: [PATCH] chore!: promote DataLabeling to v2 --- .repo-metadata-full.json | 2 +- DataLabeling/.OwlBot.yaml | 4 +- DataLabeling/README.md | 5 +- DataLabeling/owlbot.py | 53 +- DataLabeling/src/V1beta1/AnnotatedDataset.php | 20 +- .../src/V1beta1/AnnotatedDatasetMetadata.php | 2 +- DataLabeling/src/V1beta1/Annotation.php | 10 +- .../src/V1beta1/AnnotationMetadata.php | 2 +- DataLabeling/src/V1beta1/AnnotationSpec.php | 4 +- .../src/V1beta1/AnnotationSpecSet.php | 6 +- DataLabeling/src/V1beta1/Attempt.php | 2 +- DataLabeling/src/V1beta1/BigQuerySource.php | 18 +- .../V1beta1/BoundingBoxEvaluationOptions.php | 10 +- .../src/V1beta1/BoundingPolyConfig.php | 4 +- .../src/V1beta1/ClassificationMetadata.php | 2 +- .../src/V1beta1/ClassificationMetrics.php | 4 +- .../Client/DataLabelingServiceClient.php | 79 +- .../ConfusionMatrix/ConfusionMatrixEntry.php | 6 +- .../src/V1beta1/ConfusionMatrix/Row.php | 4 +- .../ConfusionMatrix_ConfusionMatrixEntry.php | 16 - .../src/V1beta1/ConfusionMatrix_Row.php | 16 - .../CreateAnnotationSpecSetRequest.php | 4 +- .../src/V1beta1/CreateDatasetRequest.php | 4 +- .../V1beta1/CreateEvaluationJobRequest.php | 4 +- .../src/V1beta1/CreateInstructionMetadata.php | 4 +- .../src/V1beta1/CreateInstructionRequest.php | 4 +- DataLabeling/src/V1beta1/CsvInstruction.php | 2 +- DataLabeling/src/V1beta1/DataItem.php | 2 +- .../src/V1beta1/DataLabelingServiceClient.php | 36 - .../V1beta1/DataLabelingServiceGrpcClient.php | 566 ---- DataLabeling/src/V1beta1/Dataset.php | 10 +- .../V1beta1/DeleteAnnotatedDatasetRequest.php | 2 +- .../DeleteAnnotationSpecSetRequest.php | 2 +- .../src/V1beta1/DeleteDatasetRequest.php | 2 +- .../V1beta1/DeleteEvaluationJobRequest.php | 2 +- .../src/V1beta1/DeleteInstructionRequest.php | 2 +- DataLabeling/src/V1beta1/Evaluation.php | 14 +- DataLabeling/src/V1beta1/EvaluationJob.php | 44 +- .../src/V1beta1/EvaluationJob/State.php | 2 - .../src/V1beta1/EvaluationJobAlertConfig.php | 4 +- .../src/V1beta1/EvaluationJobConfig.php | 20 +- .../src/V1beta1/EvaluationJob_State.php | 16 - DataLabeling/src/V1beta1/Example.php | 2 +- .../V1beta1/ExportDataOperationMetadata.php | 4 +- .../V1beta1/ExportDataOperationResponse.php | 10 +- .../src/V1beta1/ExportDataRequest.php | 10 +- .../Gapic/DataLabelingServiceGapicClient.php | 2740 ----------------- DataLabeling/src/V1beta1/GcsDestination.php | 4 +- .../src/V1beta1/GcsFolderDestination.php | 2 +- DataLabeling/src/V1beta1/GcsSource.php | 4 +- .../V1beta1/GetAnnotatedDatasetRequest.php | 2 +- .../V1beta1/GetAnnotationSpecSetRequest.php | 2 +- .../src/V1beta1/GetDataItemRequest.php | 2 +- .../src/V1beta1/GetDatasetRequest.php | 2 +- .../src/V1beta1/GetEvaluationJobRequest.php | 2 +- .../src/V1beta1/GetEvaluationRequest.php | 2 +- .../src/V1beta1/GetExampleRequest.php | 4 +- .../src/V1beta1/GetInstructionRequest.php | 2 +- .../src/V1beta1/HumanAnnotationConfig.php | 16 +- .../V1beta1/ImageBoundingPolyAnnotation.php | 2 +- .../V1beta1/ImageClassificationAnnotation.php | 2 +- .../src/V1beta1/ImageClassificationConfig.php | 6 +- DataLabeling/src/V1beta1/ImagePayload.php | 8 +- .../src/V1beta1/ImagePolylineAnnotation.php | 2 +- .../V1beta1/ImageSegmentationAnnotation.php | 4 +- .../V1beta1/ImportDataOperationMetadata.php | 4 +- .../V1beta1/ImportDataOperationResponse.php | 6 +- .../src/V1beta1/ImportDataRequest.php | 6 +- DataLabeling/src/V1beta1/InputConfig.php | 6 +- DataLabeling/src/V1beta1/Instruction.php | 14 +- ...LabelImageBoundingBoxOperationMetadata.php | 2 +- ...abelImageBoundingPolyOperationMetadata.php | 2 +- ...elImageClassificationOperationMetadata.php | 2 +- ...geOrientedBoundingBoxOperationMetadata.php | 2 +- .../LabelImagePolylineOperationMetadata.php | 2 +- .../src/V1beta1/LabelImageRequest.php | 6 +- .../src/V1beta1/LabelImageRequest/Feature.php | 2 - .../src/V1beta1/LabelImageRequest_Feature.php | 16 - ...abelImageSegmentationOperationMetadata.php | 2 +- .../src/V1beta1/LabelOperationMetadata.php | 4 +- ...belTextClassificationOperationMetadata.php | 2 +- ...lTextEntityExtractionOperationMetadata.php | 2 +- DataLabeling/src/V1beta1/LabelTextRequest.php | 6 +- .../src/V1beta1/LabelTextRequest/Feature.php | 2 - .../src/V1beta1/LabelTextRequest_Feature.php | 16 - ...elVideoClassificationOperationMetadata.php | 2 +- .../LabelVideoEventOperationMetadata.php | 2 +- ...lVideoObjectDetectionOperationMetadata.php | 2 +- ...elVideoObjectTrackingOperationMetadata.php | 2 +- .../src/V1beta1/LabelVideoRequest.php | 6 +- .../src/V1beta1/LabelVideoRequest/Feature.php | 2 - .../src/V1beta1/LabelVideoRequest_Feature.php | 16 - .../V1beta1/ListAnnotatedDatasetsRequest.php | 8 +- .../V1beta1/ListAnnotatedDatasetsResponse.php | 2 +- .../V1beta1/ListAnnotationSpecSetsRequest.php | 8 +- .../ListAnnotationSpecSetsResponse.php | 2 +- .../src/V1beta1/ListDataItemsRequest.php | 8 +- .../src/V1beta1/ListDataItemsResponse.php | 2 +- .../src/V1beta1/ListDatasetsRequest.php | 8 +- .../src/V1beta1/ListDatasetsResponse.php | 2 +- .../src/V1beta1/ListEvaluationJobsRequest.php | 8 +- .../V1beta1/ListEvaluationJobsResponse.php | 2 +- .../src/V1beta1/ListExamplesRequest.php | 8 +- .../src/V1beta1/ListExamplesResponse.php | 2 +- .../src/V1beta1/ListInstructionsRequest.php | 8 +- .../src/V1beta1/ListInstructionsResponse.php | 2 +- DataLabeling/src/V1beta1/NormalizedVertex.php | 4 +- .../src/V1beta1/ObjectDetectionConfig.php | 4 +- .../src/V1beta1/ObjectDetectionMetrics.php | 2 +- .../src/V1beta1/ObjectTrackingConfig.php | 2 +- .../src/V1beta1/ObjectTrackingFrame.php | 2 +- DataLabeling/src/V1beta1/OperatorMetadata.php | 6 +- .../src/V1beta1/PauseEvaluationJobRequest.php | 2 +- DataLabeling/src/V1beta1/PdfInstruction.php | 2 +- DataLabeling/src/V1beta1/PolylineConfig.php | 4 +- DataLabeling/src/V1beta1/PrCurve.php | 6 +- .../PrCurve/ConfidenceMetricsEntry.php | 30 +- .../PrCurve_ConfidenceMetricsEntry.php | 16 - .../V1beta1/ResumeEvaluationJobRequest.php | 2 +- .../src/V1beta1/SearchEvaluationsRequest.php | 8 +- .../src/V1beta1/SearchEvaluationsResponse.php | 2 +- .../SearchExampleComparisonsRequest.php | 6 +- .../SearchExampleComparisonsResponse.php | 2 +- .../ExampleComparison.php | 4 +- ...eComparisonsResponse_ExampleComparison.php | 16 - .../src/V1beta1/SegmentationConfig.php | 4 +- DataLabeling/src/V1beta1/SentimentConfig.php | 2 +- .../src/V1beta1/SequentialSegment.php | 4 +- .../V1beta1/TextClassificationAnnotation.php | 2 +- .../src/V1beta1/TextClassificationConfig.php | 6 +- .../TextEntityExtractionAnnotation.php | 4 +- .../V1beta1/TextEntityExtractionConfig.php | 2 +- DataLabeling/src/V1beta1/TextMetadata.php | 2 +- DataLabeling/src/V1beta1/TextPayload.php | 2 +- DataLabeling/src/V1beta1/TimeSegment.php | 4 +- .../V1beta1/UpdateEvaluationJobRequest.php | 4 +- DataLabeling/src/V1beta1/Vertex.php | 4 +- .../V1beta1/VideoClassificationAnnotation.php | 4 +- .../src/V1beta1/VideoClassificationConfig.php | 2 +- .../AnnotationSpecSetConfig.php | 6 +- ...ficationConfig_AnnotationSpecSetConfig.php | 16 - .../src/V1beta1/VideoEventAnnotation.php | 4 +- .../V1beta1/VideoObjectTrackingAnnotation.php | 4 +- DataLabeling/src/V1beta1/VideoPayload.php | 8 +- DataLabeling/src/V1beta1/VideoThumbnail.php | 4 +- .../Client/DataLabelingServiceClientTest.php | 818 ++--- .../V1beta1/DataLabelingServiceClientTest.php | 2710 ---------------- 147 files changed, 833 insertions(+), 6958 deletions(-) delete mode 100644 DataLabeling/src/V1beta1/ConfusionMatrix_ConfusionMatrixEntry.php delete mode 100644 DataLabeling/src/V1beta1/ConfusionMatrix_Row.php delete mode 100644 DataLabeling/src/V1beta1/DataLabelingServiceClient.php delete mode 100644 DataLabeling/src/V1beta1/DataLabelingServiceGrpcClient.php delete mode 100644 DataLabeling/src/V1beta1/EvaluationJob_State.php delete mode 100644 DataLabeling/src/V1beta1/Gapic/DataLabelingServiceGapicClient.php delete mode 100644 DataLabeling/src/V1beta1/LabelImageRequest_Feature.php delete mode 100644 DataLabeling/src/V1beta1/LabelTextRequest_Feature.php delete mode 100644 DataLabeling/src/V1beta1/LabelVideoRequest_Feature.php delete mode 100644 DataLabeling/src/V1beta1/PrCurve_ConfidenceMetricsEntry.php delete mode 100644 DataLabeling/src/V1beta1/SearchExampleComparisonsResponse_ExampleComparison.php delete mode 100644 DataLabeling/src/V1beta1/VideoClassificationConfig_AnnotationSpecSetConfig.php delete mode 100644 DataLabeling/tests/Unit/V1beta1/DataLabelingServiceClientTest.php diff --git a/.repo-metadata-full.json b/.repo-metadata-full.json index 47293b0e4b2a..81c117889550 100644 --- a/.repo-metadata-full.json +++ b/.repo-metadata-full.json @@ -501,7 +501,7 @@ "DataLabeling": { "language": "php", "distribution_name": "google/cloud-datalabeling", - "release_level": "preview", + "release_level": "stable", "client_documentation": "https://cloud.google.com/php/docs/reference/cloud-datalabeling/latest", "library_type": "GAPIC_AUTO", "api_shortname": "datalabeling" diff --git a/DataLabeling/.OwlBot.yaml b/DataLabeling/.OwlBot.yaml index de79abf0d676..dc8ae3f52ec8 100644 --- a/DataLabeling/.OwlBot.yaml +++ b/DataLabeling/.OwlBot.yaml @@ -1,4 +1,4 @@ deep-copy-regex: - - source: /google/cloud/datalabeling/v1beta1/.*-php/(.*) - dest: /owl-bot-staging/DataLabeling/v1beta1/$1 + - source: /google/cloud/datalabeling/(v1beta1)/.*-php/(.*) + dest: /owl-bot-staging/DataLabeling/$1/$2 api-name: DataLabeling diff --git a/DataLabeling/README.md b/DataLabeling/README.md index dcbf26606833..e0900e9e2da6 100644 --- a/DataLabeling/README.md +++ b/DataLabeling/README.md @@ -36,9 +36,8 @@ for more information about the debugging tools. ### Version -This component is considered beta. As such, it should be expected to be mostly -stable and we're working towards a release candidate. We will address issues -and requests with a higher priority. +This component is considered GA (generally available). As such, it will not introduce backwards-incompatible changes in +any minor or patch releases. We will address issues and requests with the highest priority. ### Next Steps diff --git a/DataLabeling/owlbot.py b/DataLabeling/owlbot.py index d75dfe4a75c5..aea839af0fc4 100644 --- a/DataLabeling/owlbot.py +++ b/DataLabeling/owlbot.py @@ -1,4 +1,4 @@ -# Copyright 2021 Google LLC +# Copyright 2024 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -32,34 +32,25 @@ php.owlbot_main(src=src, dest=dest) -# Change the wording for the deprecation warning. +# remove class_alias code s.replace( - 'src/*/*_*.php', - r'will be removed in the next major release', - 'will be removed in a future release') - -### [START] protoc backwards compatibility fixes - -# roll back to private properties. -s.replace( - "src/**/V*/**/*.php", - r"Generated from protobuf field ([^\n]{0,})\n\s{5}\*/\n\s{4}protected \$", - r"""Generated from protobuf field \1 - */ - private $""") - -# Replace "Unwrapped" with "Value" for method names. -s.replace( - "src/**/V*/**/*.php", - r"public function ([s|g]\w{3,})Unwrapped", - r"public function \1Value" -) - -### [END] protoc backwards compatibility fixes - -# fix relative cloud.google.com links -s.replace( - "src/**/V*/**/*.php", - r"(.{0,})\]\((/.{0,})\)", - r"\1](https://cloud.google.com\2)" -) + "src/V*/**/*.php", + r"^// Adding a class alias for backwards compatibility with the previous class name.$" + + "\n" + + r"^class_alias\(.*\);$" + + "\n", + '') + +# format generated clients +subprocess.run([ + 'npm', + 'exec', + '--yes', + '--package=@prettier/plugin-php@^0.16', + '--', + 'prettier', + '**/Client/*', + '--write', + '--parser=php', + '--single-quote', + '--print-width=120']) diff --git a/DataLabeling/src/V1beta1/AnnotatedDataset.php b/DataLabeling/src/V1beta1/AnnotatedDataset.php index e03c0f50ced6..e012b9fff11c 100644 --- a/DataLabeling/src/V1beta1/AnnotatedDataset.php +++ b/DataLabeling/src/V1beta1/AnnotatedDataset.php @@ -24,7 +24,7 @@ class AnnotatedDataset extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1; */ - private $name = ''; + protected $name = ''; /** * Output only. The display name of the AnnotatedDataset. It is specified in * HumanAnnotationConfig when user starts a labeling task. Maximum of 64 @@ -32,7 +32,7 @@ class AnnotatedDataset extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string display_name = 2; */ - private $display_name = ''; + protected $display_name = ''; /** * Output only. The description of the AnnotatedDataset. It is specified in * HumanAnnotationConfig when user starts a labeling task. Maximum of 10000 @@ -40,51 +40,51 @@ class AnnotatedDataset extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string description = 9; */ - private $description = ''; + protected $description = ''; /** * Output only. Source of the annotation. * * Generated from protobuf field .google.cloud.datalabeling.v1beta1.AnnotationSource annotation_source = 3; */ - private $annotation_source = 0; + protected $annotation_source = 0; /** * Output only. Type of the annotation. It is specified when starting labeling * task. * * Generated from protobuf field .google.cloud.datalabeling.v1beta1.AnnotationType annotation_type = 8; */ - private $annotation_type = 0; + protected $annotation_type = 0; /** * Output only. Number of examples in the annotated dataset. * * Generated from protobuf field int64 example_count = 4; */ - private $example_count = 0; + protected $example_count = 0; /** * Output only. Number of examples that have annotation in the annotated * dataset. * * Generated from protobuf field int64 completed_example_count = 5; */ - private $completed_example_count = 0; + protected $completed_example_count = 0; /** * Output only. Per label statistics. * * Generated from protobuf field .google.cloud.datalabeling.v1beta1.LabelStats label_stats = 6; */ - private $label_stats = null; + protected $label_stats = null; /** * Output only. Time the AnnotatedDataset was created. * * Generated from protobuf field .google.protobuf.Timestamp create_time = 7; */ - private $create_time = null; + protected $create_time = null; /** * Output only. Additional information about AnnotatedDataset. * * Generated from protobuf field .google.cloud.datalabeling.v1beta1.AnnotatedDatasetMetadata metadata = 10; */ - private $metadata = null; + protected $metadata = null; /** * Output only. The names of any related resources that are blocking changes * to the annotated dataset. diff --git a/DataLabeling/src/V1beta1/AnnotatedDatasetMetadata.php b/DataLabeling/src/V1beta1/AnnotatedDatasetMetadata.php index be61680a880b..d22eb4f7bd4b 100644 --- a/DataLabeling/src/V1beta1/AnnotatedDatasetMetadata.php +++ b/DataLabeling/src/V1beta1/AnnotatedDatasetMetadata.php @@ -21,7 +21,7 @@ class AnnotatedDatasetMetadata extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.datalabeling.v1beta1.HumanAnnotationConfig human_annotation_config = 1; */ - private $human_annotation_config = null; + protected $human_annotation_config = null; protected $annotation_request_config; /** diff --git a/DataLabeling/src/V1beta1/Annotation.php b/DataLabeling/src/V1beta1/Annotation.php index 1124a1c0ee7e..21536133f786 100644 --- a/DataLabeling/src/V1beta1/Annotation.php +++ b/DataLabeling/src/V1beta1/Annotation.php @@ -23,33 +23,33 @@ class Annotation extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1; */ - private $name = ''; + protected $name = ''; /** * Output only. The source of the annotation. * * Generated from protobuf field .google.cloud.datalabeling.v1beta1.AnnotationSource annotation_source = 2; */ - private $annotation_source = 0; + protected $annotation_source = 0; /** * Output only. This is the actual annotation value, e.g classification, * bounding box values are stored here. * * Generated from protobuf field .google.cloud.datalabeling.v1beta1.AnnotationValue annotation_value = 3; */ - private $annotation_value = null; + protected $annotation_value = null; /** * Output only. Annotation metadata, including information like votes * for labels. * * Generated from protobuf field .google.cloud.datalabeling.v1beta1.AnnotationMetadata annotation_metadata = 4; */ - private $annotation_metadata = null; + protected $annotation_metadata = null; /** * Output only. Sentiment for this annotation. * * Generated from protobuf field .google.cloud.datalabeling.v1beta1.AnnotationSentiment annotation_sentiment = 6; */ - private $annotation_sentiment = 0; + protected $annotation_sentiment = 0; /** * Constructor. diff --git a/DataLabeling/src/V1beta1/AnnotationMetadata.php b/DataLabeling/src/V1beta1/AnnotationMetadata.php index fbd17cf75bff..dc04eabc27c5 100644 --- a/DataLabeling/src/V1beta1/AnnotationMetadata.php +++ b/DataLabeling/src/V1beta1/AnnotationMetadata.php @@ -20,7 +20,7 @@ class AnnotationMetadata extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.datalabeling.v1beta1.OperatorMetadata operator_metadata = 2; */ - private $operator_metadata = null; + protected $operator_metadata = null; /** * Constructor. diff --git a/DataLabeling/src/V1beta1/AnnotationSpec.php b/DataLabeling/src/V1beta1/AnnotationSpec.php index d60d5324d08a..56aa5f9b0443 100644 --- a/DataLabeling/src/V1beta1/AnnotationSpec.php +++ b/DataLabeling/src/V1beta1/AnnotationSpec.php @@ -23,14 +23,14 @@ class AnnotationSpec extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string display_name = 1; */ - private $display_name = ''; + protected $display_name = ''; /** * Optional. User-provided description of the annotation specification. * The description can be up to 10,000 characters long. * * Generated from protobuf field string description = 2; */ - private $description = ''; + protected $description = ''; /** * Constructor. diff --git a/DataLabeling/src/V1beta1/AnnotationSpecSet.php b/DataLabeling/src/V1beta1/AnnotationSpecSet.php index 6db39bb694ca..26c87217a48c 100644 --- a/DataLabeling/src/V1beta1/AnnotationSpecSet.php +++ b/DataLabeling/src/V1beta1/AnnotationSpecSet.php @@ -23,21 +23,21 @@ class AnnotationSpecSet extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1; */ - private $name = ''; + protected $name = ''; /** * Required. The display name for AnnotationSpecSet that you define when you * create it. Maximum of 64 characters. * * Generated from protobuf field string display_name = 2; */ - private $display_name = ''; + protected $display_name = ''; /** * Optional. User-provided description of the annotation specification set. * The description can be up to 10,000 characters long. * * Generated from protobuf field string description = 3; */ - private $description = ''; + protected $description = ''; /** * Required. The array of AnnotationSpecs that you define when you create the * AnnotationSpecSet. These are the possible labels for the labeling task. diff --git a/DataLabeling/src/V1beta1/Attempt.php b/DataLabeling/src/V1beta1/Attempt.php index 2c7be8b5636a..704b16927696 100644 --- a/DataLabeling/src/V1beta1/Attempt.php +++ b/DataLabeling/src/V1beta1/Attempt.php @@ -18,7 +18,7 @@ class Attempt extends \Google\Protobuf\Internal\Message /** * Generated from protobuf field .google.protobuf.Timestamp attempt_time = 1; */ - private $attempt_time = null; + protected $attempt_time = null; /** * Details of errors that occurred. * diff --git a/DataLabeling/src/V1beta1/BigQuerySource.php b/DataLabeling/src/V1beta1/BigQuerySource.php index c632d01d8f2a..20d6ae4a7f8e 100644 --- a/DataLabeling/src/V1beta1/BigQuerySource.php +++ b/DataLabeling/src/V1beta1/BigQuerySource.php @@ -24,15 +24,15 @@ class BigQuerySource extends \Google\Protobuf\Internal\Message * [EvaluationJob][google.cloud.datalabeling.v1beta1.EvaluationJob]. If you specify the URI of a table that already exists, * it must have the * [correct - * schema](https://cloud.google.com/ml-engine/docs/continuous-evaluation/create-job#table-schema). + * schema](/ml-engine/docs/continuous-evaluation/create-job#table-schema). * Provide the table URI in the following format: * "bq://{your_project_id}/{your_dataset_name}/{your_table_name}" * [Learn - * more](https://cloud.google.com/ml-engine/docs/continuous-evaluation/create-job#table-schema). + * more](/ml-engine/docs/continuous-evaluation/create-job#table-schema). * * Generated from protobuf field string input_uri = 1; */ - private $input_uri = ''; + protected $input_uri = ''; /** * Constructor. @@ -47,11 +47,11 @@ class BigQuerySource extends \Google\Protobuf\Internal\Message * [EvaluationJob][google.cloud.datalabeling.v1beta1.EvaluationJob]. If you specify the URI of a table that already exists, * it must have the * [correct - * schema](https://cloud.google.com/ml-engine/docs/continuous-evaluation/create-job#table-schema). + * schema](/ml-engine/docs/continuous-evaluation/create-job#table-schema). * Provide the table URI in the following format: * "bq://{your_project_id}/{your_dataset_name}/{your_table_name}" * [Learn - * more](https://cloud.google.com/ml-engine/docs/continuous-evaluation/create-job#table-schema). + * more](/ml-engine/docs/continuous-evaluation/create-job#table-schema). * } */ public function __construct($data = NULL) { @@ -66,11 +66,11 @@ public function __construct($data = NULL) { * [EvaluationJob][google.cloud.datalabeling.v1beta1.EvaluationJob]. If you specify the URI of a table that already exists, * it must have the * [correct - * schema](https://cloud.google.com/ml-engine/docs/continuous-evaluation/create-job#table-schema). + * schema](/ml-engine/docs/continuous-evaluation/create-job#table-schema). * Provide the table URI in the following format: * "bq://{your_project_id}/{your_dataset_name}/{your_table_name}" * [Learn - * more](https://cloud.google.com/ml-engine/docs/continuous-evaluation/create-job#table-schema). + * more](/ml-engine/docs/continuous-evaluation/create-job#table-schema). * * Generated from protobuf field string input_uri = 1; * @return string @@ -87,11 +87,11 @@ public function getInputUri() * [EvaluationJob][google.cloud.datalabeling.v1beta1.EvaluationJob]. If you specify the URI of a table that already exists, * it must have the * [correct - * schema](https://cloud.google.com/ml-engine/docs/continuous-evaluation/create-job#table-schema). + * schema](/ml-engine/docs/continuous-evaluation/create-job#table-schema). * Provide the table URI in the following format: * "bq://{your_project_id}/{your_dataset_name}/{your_table_name}" * [Learn - * more](https://cloud.google.com/ml-engine/docs/continuous-evaluation/create-job#table-schema). + * more](/ml-engine/docs/continuous-evaluation/create-job#table-schema). * * Generated from protobuf field string input_uri = 1; * @param string $var diff --git a/DataLabeling/src/V1beta1/BoundingBoxEvaluationOptions.php b/DataLabeling/src/V1beta1/BoundingBoxEvaluationOptions.php index 95de0ce04997..b9c2729d47b1 100644 --- a/DataLabeling/src/V1beta1/BoundingBoxEvaluationOptions.php +++ b/DataLabeling/src/V1beta1/BoundingBoxEvaluationOptions.php @@ -18,13 +18,13 @@ class BoundingBoxEvaluationOptions extends \Google\Protobuf\Internal\Message /** * Minimum * [intersection-over-union - * (IOU)](https://cloud.google.com/vision/automl/object-detection/docs/evaluate#intersection-over-union) + * (IOU)](/vision/automl/object-detection/docs/evaluate#intersection-over-union) * required for 2 bounding boxes to be considered a match. This must be a * number between 0 and 1. * * Generated from protobuf field float iou_threshold = 1; */ - private $iou_threshold = 0.0; + protected $iou_threshold = 0.0; /** * Constructor. @@ -35,7 +35,7 @@ class BoundingBoxEvaluationOptions extends \Google\Protobuf\Internal\Message * @type float $iou_threshold * Minimum * [intersection-over-union - * (IOU)](https://cloud.google.com/vision/automl/object-detection/docs/evaluate#intersection-over-union) + * (IOU)](/vision/automl/object-detection/docs/evaluate#intersection-over-union) * required for 2 bounding boxes to be considered a match. This must be a * number between 0 and 1. * } @@ -48,7 +48,7 @@ public function __construct($data = NULL) { /** * Minimum * [intersection-over-union - * (IOU)](https://cloud.google.com/vision/automl/object-detection/docs/evaluate#intersection-over-union) + * (IOU)](/vision/automl/object-detection/docs/evaluate#intersection-over-union) * required for 2 bounding boxes to be considered a match. This must be a * number between 0 and 1. * @@ -63,7 +63,7 @@ public function getIouThreshold() /** * Minimum * [intersection-over-union - * (IOU)](https://cloud.google.com/vision/automl/object-detection/docs/evaluate#intersection-over-union) + * (IOU)](/vision/automl/object-detection/docs/evaluate#intersection-over-union) * required for 2 bounding boxes to be considered a match. This must be a * number between 0 and 1. * diff --git a/DataLabeling/src/V1beta1/BoundingPolyConfig.php b/DataLabeling/src/V1beta1/BoundingPolyConfig.php index ff72f6fa8b90..0a9386496b2e 100644 --- a/DataLabeling/src/V1beta1/BoundingPolyConfig.php +++ b/DataLabeling/src/V1beta1/BoundingPolyConfig.php @@ -20,13 +20,13 @@ class BoundingPolyConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string annotation_spec_set = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $annotation_spec_set = ''; + protected $annotation_spec_set = ''; /** * Optional. Instruction message showed on contributors UI. * * Generated from protobuf field string instruction_message = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $instruction_message = ''; + protected $instruction_message = ''; /** * Constructor. diff --git a/DataLabeling/src/V1beta1/ClassificationMetadata.php b/DataLabeling/src/V1beta1/ClassificationMetadata.php index d6ae4c43cf4b..696a2bf723b8 100644 --- a/DataLabeling/src/V1beta1/ClassificationMetadata.php +++ b/DataLabeling/src/V1beta1/ClassificationMetadata.php @@ -20,7 +20,7 @@ class ClassificationMetadata extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool is_multi_label = 1; */ - private $is_multi_label = false; + protected $is_multi_label = false; /** * Constructor. diff --git a/DataLabeling/src/V1beta1/ClassificationMetrics.php b/DataLabeling/src/V1beta1/ClassificationMetrics.php index 53a5b96bdc16..cff5ebc4f7e0 100644 --- a/DataLabeling/src/V1beta1/ClassificationMetrics.php +++ b/DataLabeling/src/V1beta1/ClassificationMetrics.php @@ -21,13 +21,13 @@ class ClassificationMetrics extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.datalabeling.v1beta1.PrCurve pr_curve = 1; */ - private $pr_curve = null; + protected $pr_curve = null; /** * Confusion matrix of predicted labels vs. ground truth labels. * * Generated from protobuf field .google.cloud.datalabeling.v1beta1.ConfusionMatrix confusion_matrix = 2; */ - private $confusion_matrix = null; + protected $confusion_matrix = null; /** * Constructor. diff --git a/DataLabeling/src/V1beta1/Client/DataLabelingServiceClient.php b/DataLabeling/src/V1beta1/Client/DataLabelingServiceClient.php index d3d539b399f9..93cf701e803c 100644 --- a/DataLabeling/src/V1beta1/Client/DataLabelingServiceClient.php +++ b/DataLabeling/src/V1beta1/Client/DataLabelingServiceClient.php @@ -1,6 +1,6 @@ descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : []; + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : []; $operation = new OperationResponse($operationName, $this->getOperationsClient(), $options); $operation->reload(); return $operation; } + /** + * Create the default operation client for the service. + * + * @param array $options ClientOptions for the client. + * + * @return OperationsClient + */ + private function createOperationsClient(array $options) + { + // Unset client-specific configuration options + unset($options['serviceName'], $options['clientConfig'], $options['descriptorsConfigPath']); + + if (isset($options['operationsClient'])) { + return $options['operationsClient']; + } + + return new OperationsClient($options); + } + /** * Formats a string containing the fully-qualified path to represent a * annotated_dataset resource. @@ -347,8 +365,12 @@ public static function evaluationJobName(string $project, string $evaluationJob) * * @experimental */ - public static function exampleName(string $project, string $dataset, string $annotatedDataset, string $example): string - { + public static function exampleName( + string $project, + string $dataset, + string $annotatedDataset, + string $example + ): string { return self::getPathTemplate('example')->render([ 'project' => $project, 'dataset' => $dataset, @@ -413,8 +435,8 @@ public static function projectName(string $project): string * listed, then parseName will check each of the supported templates, and return * the first match. * - * @param string $formattedName The formatted name string - * @param ?string $template Optional name of template to match + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match * * @return array An associative array from name component IDs to component values. * @@ -422,7 +444,7 @@ public static function projectName(string $project): string * * @experimental */ - public static function parseName(string $formattedName, ?string $template = null): array + public static function parseName(string $formattedName, string $template = null): array { return self::parseFormattedName($formattedName, $template); } @@ -477,9 +499,6 @@ public static function parseName(string $formattedName, ?string $template = null * @type callable $clientCertSource * A callable which returns the client cert as a string. This can be used to * provide a certificate and private key to the transport layer for mTLS. - * @type false|LoggerInterface $logger - * A PSR-3 compliant logger. If set to false, logging is disabled, ignoring the - * 'GOOGLE_SDK_PHP_LOGGING' environment flag * } * * @throws ValidationException @@ -528,8 +547,10 @@ public function __call($method, $args) * * @experimental */ - public function createAnnotationSpecSet(CreateAnnotationSpecSetRequest $request, array $callOptions = []): AnnotationSpecSet - { + public function createAnnotationSpecSet( + CreateAnnotationSpecSetRequest $request, + array $callOptions = [] + ): AnnotationSpecSet { return $this->startApiCall('CreateAnnotationSpecSet', $request, $callOptions)->wait(); } @@ -834,8 +855,10 @@ public function getAnnotatedDataset(GetAnnotatedDatasetRequest $request, array $ * * @experimental */ - public function getAnnotationSpecSet(GetAnnotationSpecSetRequest $request, array $callOptions = []): AnnotationSpecSet - { + public function getAnnotationSpecSet( + GetAnnotationSpecSetRequest $request, + array $callOptions = [] + ): AnnotationSpecSet { return $this->startApiCall('GetAnnotationSpecSet', $request, $callOptions)->wait(); } @@ -1152,8 +1175,10 @@ public function labelVideo(LabelVideoRequest $request, array $callOptions = []): * * @experimental */ - public function listAnnotatedDatasets(ListAnnotatedDatasetsRequest $request, array $callOptions = []): PagedListResponse - { + public function listAnnotatedDatasets( + ListAnnotatedDatasetsRequest $request, + array $callOptions = [] + ): PagedListResponse { return $this->startApiCall('ListAnnotatedDatasets', $request, $callOptions); } @@ -1181,8 +1206,10 @@ public function listAnnotatedDatasets(ListAnnotatedDatasetsRequest $request, arr * * @experimental */ - public function listAnnotationSpecSets(ListAnnotationSpecSetsRequest $request, array $callOptions = []): PagedListResponse - { + public function listAnnotationSpecSets( + ListAnnotationSpecSetsRequest $request, + array $callOptions = [] + ): PagedListResponse { return $this->startApiCall('ListAnnotationSpecSets', $request, $callOptions); } @@ -1440,8 +1467,10 @@ public function searchEvaluations(SearchEvaluationsRequest $request, array $call * * @experimental */ - public function searchExampleComparisons(SearchExampleComparisonsRequest $request, array $callOptions = []): PagedListResponse - { + public function searchExampleComparisons( + SearchExampleComparisonsRequest $request, + array $callOptions = [] + ): PagedListResponse { return $this->startApiCall('SearchExampleComparisons', $request, $callOptions); } diff --git a/DataLabeling/src/V1beta1/ConfusionMatrix/ConfusionMatrixEntry.php b/DataLabeling/src/V1beta1/ConfusionMatrix/ConfusionMatrixEntry.php index b5ccd86d38e6..af57f2fa3e92 100644 --- a/DataLabeling/src/V1beta1/ConfusionMatrix/ConfusionMatrixEntry.php +++ b/DataLabeling/src/V1beta1/ConfusionMatrix/ConfusionMatrixEntry.php @@ -18,14 +18,14 @@ class ConfusionMatrixEntry extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.datalabeling.v1beta1.AnnotationSpec annotation_spec = 1; */ - private $annotation_spec = null; + protected $annotation_spec = null; /** * Number of items predicted to have this label. (The ground truth label for * these items is the `Row.annotationSpec` of this entry's parent.) * * Generated from protobuf field int32 item_count = 2; */ - private $item_count = 0; + protected $item_count = 0; /** * Constructor. @@ -111,6 +111,4 @@ public function setItemCount($var) } -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(ConfusionMatrixEntry::class, \Google\Cloud\DataLabeling\V1beta1\ConfusionMatrix_ConfusionMatrixEntry::class); diff --git a/DataLabeling/src/V1beta1/ConfusionMatrix/Row.php b/DataLabeling/src/V1beta1/ConfusionMatrix/Row.php index e60203957885..637ecbf45962 100644 --- a/DataLabeling/src/V1beta1/ConfusionMatrix/Row.php +++ b/DataLabeling/src/V1beta1/ConfusionMatrix/Row.php @@ -21,7 +21,7 @@ class Row extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.datalabeling.v1beta1.AnnotationSpec annotation_spec = 1; */ - private $annotation_spec = null; + protected $annotation_spec = null; /** * A list of the confusion matrix entries. One entry for each possible * predicted label. @@ -114,6 +114,4 @@ public function setEntries($var) } -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(Row::class, \Google\Cloud\DataLabeling\V1beta1\ConfusionMatrix_Row::class); diff --git a/DataLabeling/src/V1beta1/ConfusionMatrix_ConfusionMatrixEntry.php b/DataLabeling/src/V1beta1/ConfusionMatrix_ConfusionMatrixEntry.php deleted file mode 100644 index 364bbd675e65..000000000000 --- a/DataLabeling/src/V1beta1/ConfusionMatrix_ConfusionMatrixEntry.php +++ /dev/null @@ -1,16 +0,0 @@ -string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Required. Annotation spec set to create. Annotation specs must be included. * Only one annotation spec will be accepted for annotation specs with same @@ -29,7 +29,7 @@ class CreateAnnotationSpecSetRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.datalabeling.v1beta1.AnnotationSpecSet annotation_spec_set = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $annotation_spec_set = null; + protected $annotation_spec_set = null; /** * @param string $parent Required. AnnotationSpecSet resource parent, format: diff --git a/DataLabeling/src/V1beta1/CreateDatasetRequest.php b/DataLabeling/src/V1beta1/CreateDatasetRequest.php index c18ce558f4a4..75087473921a 100644 --- a/DataLabeling/src/V1beta1/CreateDatasetRequest.php +++ b/DataLabeling/src/V1beta1/CreateDatasetRequest.php @@ -21,13 +21,13 @@ class CreateDatasetRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Required. The dataset to be created. * * Generated from protobuf field .google.cloud.datalabeling.v1beta1.Dataset dataset = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $dataset = null; + protected $dataset = null; /** * @param string $parent Required. Dataset resource parent, format: diff --git a/DataLabeling/src/V1beta1/CreateEvaluationJobRequest.php b/DataLabeling/src/V1beta1/CreateEvaluationJobRequest.php index 9fa7efa1e631..c9532025cb1c 100644 --- a/DataLabeling/src/V1beta1/CreateEvaluationJobRequest.php +++ b/DataLabeling/src/V1beta1/CreateEvaluationJobRequest.php @@ -21,13 +21,13 @@ class CreateEvaluationJobRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Required. The evaluation job to create. * * Generated from protobuf field .google.cloud.datalabeling.v1beta1.EvaluationJob job = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $job = null; + protected $job = null; /** * @param string $parent Required. Evaluation job resource parent. Format: diff --git a/DataLabeling/src/V1beta1/CreateInstructionMetadata.php b/DataLabeling/src/V1beta1/CreateInstructionMetadata.php index 527aa2c1ccbd..82a4855269ee 100644 --- a/DataLabeling/src/V1beta1/CreateInstructionMetadata.php +++ b/DataLabeling/src/V1beta1/CreateInstructionMetadata.php @@ -21,7 +21,7 @@ class CreateInstructionMetadata extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string instruction = 1; */ - private $instruction = ''; + protected $instruction = ''; /** * Partial failures encountered. * E.g. single files that couldn't be read. @@ -35,7 +35,7 @@ class CreateInstructionMetadata extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Timestamp create_time = 3; */ - private $create_time = null; + protected $create_time = null; /** * Constructor. diff --git a/DataLabeling/src/V1beta1/CreateInstructionRequest.php b/DataLabeling/src/V1beta1/CreateInstructionRequest.php index 919befc4c3da..a9bc34ed41d8 100644 --- a/DataLabeling/src/V1beta1/CreateInstructionRequest.php +++ b/DataLabeling/src/V1beta1/CreateInstructionRequest.php @@ -21,13 +21,13 @@ class CreateInstructionRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Required. Instruction of how to perform the labeling task. * * Generated from protobuf field .google.cloud.datalabeling.v1beta1.Instruction instruction = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $instruction = null; + protected $instruction = null; /** * @param string $parent Required. Instruction resource parent, format: diff --git a/DataLabeling/src/V1beta1/CsvInstruction.php b/DataLabeling/src/V1beta1/CsvInstruction.php index be33714cd2b4..f09bba67bd93 100644 --- a/DataLabeling/src/V1beta1/CsvInstruction.php +++ b/DataLabeling/src/V1beta1/CsvInstruction.php @@ -21,7 +21,7 @@ class CsvInstruction extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string gcs_file_uri = 1; */ - private $gcs_file_uri = ''; + protected $gcs_file_uri = ''; /** * Constructor. diff --git a/DataLabeling/src/V1beta1/DataItem.php b/DataLabeling/src/V1beta1/DataItem.php index f33b9ee3c167..e31b674176d6 100644 --- a/DataLabeling/src/V1beta1/DataItem.php +++ b/DataLabeling/src/V1beta1/DataItem.php @@ -21,7 +21,7 @@ class DataItem extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1; */ - private $name = ''; + protected $name = ''; protected $payload; /** diff --git a/DataLabeling/src/V1beta1/DataLabelingServiceClient.php b/DataLabeling/src/V1beta1/DataLabelingServiceClient.php deleted file mode 100644 index 44be44f9a939..000000000000 --- a/DataLabeling/src/V1beta1/DataLabelingServiceClient.php +++ /dev/null @@ -1,36 +0,0 @@ -_simpleRequest('/google.cloud.datalabeling.v1beta1.DataLabelingService/CreateDataset', - $argument, - ['\Google\Cloud\DataLabeling\V1beta1\Dataset', 'decode'], - $metadata, $options); - } - - /** - * Gets dataset by resource name. - * @param \Google\Cloud\DataLabeling\V1beta1\GetDatasetRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function GetDataset(\Google\Cloud\DataLabeling\V1beta1\GetDatasetRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.datalabeling.v1beta1.DataLabelingService/GetDataset', - $argument, - ['\Google\Cloud\DataLabeling\V1beta1\Dataset', 'decode'], - $metadata, $options); - } - - /** - * Lists datasets under a project. Pagination is supported. - * @param \Google\Cloud\DataLabeling\V1beta1\ListDatasetsRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ListDatasets(\Google\Cloud\DataLabeling\V1beta1\ListDatasetsRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.datalabeling.v1beta1.DataLabelingService/ListDatasets', - $argument, - ['\Google\Cloud\DataLabeling\V1beta1\ListDatasetsResponse', 'decode'], - $metadata, $options); - } - - /** - * Deletes a dataset by resource name. - * @param \Google\Cloud\DataLabeling\V1beta1\DeleteDatasetRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function DeleteDataset(\Google\Cloud\DataLabeling\V1beta1\DeleteDatasetRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.datalabeling.v1beta1.DataLabelingService/DeleteDataset', - $argument, - ['\Google\Protobuf\GPBEmpty', 'decode'], - $metadata, $options); - } - - /** - * Imports data into dataset based on source locations defined in request. - * It can be called multiple times for the same dataset. Each dataset can - * only have one long running operation running on it. For example, no - * labeling task (also long running operation) can be started while - * importing is still ongoing. Vice versa. - * @param \Google\Cloud\DataLabeling\V1beta1\ImportDataRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ImportData(\Google\Cloud\DataLabeling\V1beta1\ImportDataRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.datalabeling.v1beta1.DataLabelingService/ImportData', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Exports data and annotations from dataset. - * @param \Google\Cloud\DataLabeling\V1beta1\ExportDataRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ExportData(\Google\Cloud\DataLabeling\V1beta1\ExportDataRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.datalabeling.v1beta1.DataLabelingService/ExportData', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Gets a data item in a dataset by resource name. This API can be - * called after data are imported into dataset. - * @param \Google\Cloud\DataLabeling\V1beta1\GetDataItemRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function GetDataItem(\Google\Cloud\DataLabeling\V1beta1\GetDataItemRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.datalabeling.v1beta1.DataLabelingService/GetDataItem', - $argument, - ['\Google\Cloud\DataLabeling\V1beta1\DataItem', 'decode'], - $metadata, $options); - } - - /** - * Lists data items in a dataset. This API can be called after data - * are imported into dataset. Pagination is supported. - * @param \Google\Cloud\DataLabeling\V1beta1\ListDataItemsRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ListDataItems(\Google\Cloud\DataLabeling\V1beta1\ListDataItemsRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.datalabeling.v1beta1.DataLabelingService/ListDataItems', - $argument, - ['\Google\Cloud\DataLabeling\V1beta1\ListDataItemsResponse', 'decode'], - $metadata, $options); - } - - /** - * Gets an annotated dataset by resource name. - * @param \Google\Cloud\DataLabeling\V1beta1\GetAnnotatedDatasetRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function GetAnnotatedDataset(\Google\Cloud\DataLabeling\V1beta1\GetAnnotatedDatasetRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.datalabeling.v1beta1.DataLabelingService/GetAnnotatedDataset', - $argument, - ['\Google\Cloud\DataLabeling\V1beta1\AnnotatedDataset', 'decode'], - $metadata, $options); - } - - /** - * Lists annotated datasets for a dataset. Pagination is supported. - * @param \Google\Cloud\DataLabeling\V1beta1\ListAnnotatedDatasetsRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ListAnnotatedDatasets(\Google\Cloud\DataLabeling\V1beta1\ListAnnotatedDatasetsRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.datalabeling.v1beta1.DataLabelingService/ListAnnotatedDatasets', - $argument, - ['\Google\Cloud\DataLabeling\V1beta1\ListAnnotatedDatasetsResponse', 'decode'], - $metadata, $options); - } - - /** - * Deletes an annotated dataset by resource name. - * @param \Google\Cloud\DataLabeling\V1beta1\DeleteAnnotatedDatasetRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function DeleteAnnotatedDataset(\Google\Cloud\DataLabeling\V1beta1\DeleteAnnotatedDatasetRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.datalabeling.v1beta1.DataLabelingService/DeleteAnnotatedDataset', - $argument, - ['\Google\Protobuf\GPBEmpty', 'decode'], - $metadata, $options); - } - - /** - * Starts a labeling task for image. The type of image labeling task is - * configured by feature in the request. - * @param \Google\Cloud\DataLabeling\V1beta1\LabelImageRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function LabelImage(\Google\Cloud\DataLabeling\V1beta1\LabelImageRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.datalabeling.v1beta1.DataLabelingService/LabelImage', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Starts a labeling task for video. The type of video labeling task is - * configured by feature in the request. - * @param \Google\Cloud\DataLabeling\V1beta1\LabelVideoRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function LabelVideo(\Google\Cloud\DataLabeling\V1beta1\LabelVideoRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.datalabeling.v1beta1.DataLabelingService/LabelVideo', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Starts a labeling task for text. The type of text labeling task is - * configured by feature in the request. - * @param \Google\Cloud\DataLabeling\V1beta1\LabelTextRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function LabelText(\Google\Cloud\DataLabeling\V1beta1\LabelTextRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.datalabeling.v1beta1.DataLabelingService/LabelText', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Gets an example by resource name, including both data and annotation. - * @param \Google\Cloud\DataLabeling\V1beta1\GetExampleRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function GetExample(\Google\Cloud\DataLabeling\V1beta1\GetExampleRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.datalabeling.v1beta1.DataLabelingService/GetExample', - $argument, - ['\Google\Cloud\DataLabeling\V1beta1\Example', 'decode'], - $metadata, $options); - } - - /** - * Lists examples in an annotated dataset. Pagination is supported. - * @param \Google\Cloud\DataLabeling\V1beta1\ListExamplesRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ListExamples(\Google\Cloud\DataLabeling\V1beta1\ListExamplesRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.datalabeling.v1beta1.DataLabelingService/ListExamples', - $argument, - ['\Google\Cloud\DataLabeling\V1beta1\ListExamplesResponse', 'decode'], - $metadata, $options); - } - - /** - * Creates an annotation spec set by providing a set of labels. - * @param \Google\Cloud\DataLabeling\V1beta1\CreateAnnotationSpecSetRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function CreateAnnotationSpecSet(\Google\Cloud\DataLabeling\V1beta1\CreateAnnotationSpecSetRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.datalabeling.v1beta1.DataLabelingService/CreateAnnotationSpecSet', - $argument, - ['\Google\Cloud\DataLabeling\V1beta1\AnnotationSpecSet', 'decode'], - $metadata, $options); - } - - /** - * Gets an annotation spec set by resource name. - * @param \Google\Cloud\DataLabeling\V1beta1\GetAnnotationSpecSetRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function GetAnnotationSpecSet(\Google\Cloud\DataLabeling\V1beta1\GetAnnotationSpecSetRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.datalabeling.v1beta1.DataLabelingService/GetAnnotationSpecSet', - $argument, - ['\Google\Cloud\DataLabeling\V1beta1\AnnotationSpecSet', 'decode'], - $metadata, $options); - } - - /** - * Lists annotation spec sets for a project. Pagination is supported. - * @param \Google\Cloud\DataLabeling\V1beta1\ListAnnotationSpecSetsRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ListAnnotationSpecSets(\Google\Cloud\DataLabeling\V1beta1\ListAnnotationSpecSetsRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.datalabeling.v1beta1.DataLabelingService/ListAnnotationSpecSets', - $argument, - ['\Google\Cloud\DataLabeling\V1beta1\ListAnnotationSpecSetsResponse', 'decode'], - $metadata, $options); - } - - /** - * Deletes an annotation spec set by resource name. - * @param \Google\Cloud\DataLabeling\V1beta1\DeleteAnnotationSpecSetRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function DeleteAnnotationSpecSet(\Google\Cloud\DataLabeling\V1beta1\DeleteAnnotationSpecSetRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.datalabeling.v1beta1.DataLabelingService/DeleteAnnotationSpecSet', - $argument, - ['\Google\Protobuf\GPBEmpty', 'decode'], - $metadata, $options); - } - - /** - * Creates an instruction for how data should be labeled. - * @param \Google\Cloud\DataLabeling\V1beta1\CreateInstructionRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function CreateInstruction(\Google\Cloud\DataLabeling\V1beta1\CreateInstructionRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.datalabeling.v1beta1.DataLabelingService/CreateInstruction', - $argument, - ['\Google\LongRunning\Operation', 'decode'], - $metadata, $options); - } - - /** - * Gets an instruction by resource name. - * @param \Google\Cloud\DataLabeling\V1beta1\GetInstructionRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function GetInstruction(\Google\Cloud\DataLabeling\V1beta1\GetInstructionRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.datalabeling.v1beta1.DataLabelingService/GetInstruction', - $argument, - ['\Google\Cloud\DataLabeling\V1beta1\Instruction', 'decode'], - $metadata, $options); - } - - /** - * Lists instructions for a project. Pagination is supported. - * @param \Google\Cloud\DataLabeling\V1beta1\ListInstructionsRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ListInstructions(\Google\Cloud\DataLabeling\V1beta1\ListInstructionsRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.datalabeling.v1beta1.DataLabelingService/ListInstructions', - $argument, - ['\Google\Cloud\DataLabeling\V1beta1\ListInstructionsResponse', 'decode'], - $metadata, $options); - } - - /** - * Deletes an instruction object by resource name. - * @param \Google\Cloud\DataLabeling\V1beta1\DeleteInstructionRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function DeleteInstruction(\Google\Cloud\DataLabeling\V1beta1\DeleteInstructionRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.datalabeling.v1beta1.DataLabelingService/DeleteInstruction', - $argument, - ['\Google\Protobuf\GPBEmpty', 'decode'], - $metadata, $options); - } - - /** - * Gets an evaluation by resource name (to search, use - * [projects.evaluations.search][google.cloud.datalabeling.v1beta1.DataLabelingService.SearchEvaluations]). - * @param \Google\Cloud\DataLabeling\V1beta1\GetEvaluationRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function GetEvaluation(\Google\Cloud\DataLabeling\V1beta1\GetEvaluationRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.datalabeling.v1beta1.DataLabelingService/GetEvaluation', - $argument, - ['\Google\Cloud\DataLabeling\V1beta1\Evaluation', 'decode'], - $metadata, $options); - } - - /** - * Searches [evaluations][google.cloud.datalabeling.v1beta1.Evaluation] within a project. - * @param \Google\Cloud\DataLabeling\V1beta1\SearchEvaluationsRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function SearchEvaluations(\Google\Cloud\DataLabeling\V1beta1\SearchEvaluationsRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.datalabeling.v1beta1.DataLabelingService/SearchEvaluations', - $argument, - ['\Google\Cloud\DataLabeling\V1beta1\SearchEvaluationsResponse', 'decode'], - $metadata, $options); - } - - /** - * Searches example comparisons from an evaluation. The return format is a - * list of example comparisons that show ground truth and prediction(s) for - * a single input. Search by providing an evaluation ID. - * @param \Google\Cloud\DataLabeling\V1beta1\SearchExampleComparisonsRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function SearchExampleComparisons(\Google\Cloud\DataLabeling\V1beta1\SearchExampleComparisonsRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.datalabeling.v1beta1.DataLabelingService/SearchExampleComparisons', - $argument, - ['\Google\Cloud\DataLabeling\V1beta1\SearchExampleComparisonsResponse', 'decode'], - $metadata, $options); - } - - /** - * Creates an evaluation job. - * @param \Google\Cloud\DataLabeling\V1beta1\CreateEvaluationJobRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function CreateEvaluationJob(\Google\Cloud\DataLabeling\V1beta1\CreateEvaluationJobRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.datalabeling.v1beta1.DataLabelingService/CreateEvaluationJob', - $argument, - ['\Google\Cloud\DataLabeling\V1beta1\EvaluationJob', 'decode'], - $metadata, $options); - } - - /** - * Updates an evaluation job. You can only update certain fields of the job's - * [EvaluationJobConfig][google.cloud.datalabeling.v1beta1.EvaluationJobConfig]: `humanAnnotationConfig.instruction`, - * `exampleCount`, and `exampleSamplePercentage`. - * - * If you want to change any other aspect of the evaluation job, you must - * delete the job and create a new one. - * @param \Google\Cloud\DataLabeling\V1beta1\UpdateEvaluationJobRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function UpdateEvaluationJob(\Google\Cloud\DataLabeling\V1beta1\UpdateEvaluationJobRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.datalabeling.v1beta1.DataLabelingService/UpdateEvaluationJob', - $argument, - ['\Google\Cloud\DataLabeling\V1beta1\EvaluationJob', 'decode'], - $metadata, $options); - } - - /** - * Gets an evaluation job by resource name. - * @param \Google\Cloud\DataLabeling\V1beta1\GetEvaluationJobRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function GetEvaluationJob(\Google\Cloud\DataLabeling\V1beta1\GetEvaluationJobRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.datalabeling.v1beta1.DataLabelingService/GetEvaluationJob', - $argument, - ['\Google\Cloud\DataLabeling\V1beta1\EvaluationJob', 'decode'], - $metadata, $options); - } - - /** - * Pauses an evaluation job. Pausing an evaluation job that is already in a - * `PAUSED` state is a no-op. - * @param \Google\Cloud\DataLabeling\V1beta1\PauseEvaluationJobRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function PauseEvaluationJob(\Google\Cloud\DataLabeling\V1beta1\PauseEvaluationJobRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.datalabeling.v1beta1.DataLabelingService/PauseEvaluationJob', - $argument, - ['\Google\Protobuf\GPBEmpty', 'decode'], - $metadata, $options); - } - - /** - * Resumes a paused evaluation job. A deleted evaluation job can't be resumed. - * Resuming a running or scheduled evaluation job is a no-op. - * @param \Google\Cloud\DataLabeling\V1beta1\ResumeEvaluationJobRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ResumeEvaluationJob(\Google\Cloud\DataLabeling\V1beta1\ResumeEvaluationJobRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.datalabeling.v1beta1.DataLabelingService/ResumeEvaluationJob', - $argument, - ['\Google\Protobuf\GPBEmpty', 'decode'], - $metadata, $options); - } - - /** - * Stops and deletes an evaluation job. - * @param \Google\Cloud\DataLabeling\V1beta1\DeleteEvaluationJobRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function DeleteEvaluationJob(\Google\Cloud\DataLabeling\V1beta1\DeleteEvaluationJobRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.datalabeling.v1beta1.DataLabelingService/DeleteEvaluationJob', - $argument, - ['\Google\Protobuf\GPBEmpty', 'decode'], - $metadata, $options); - } - - /** - * Lists all evaluation jobs within a project with possible filters. - * Pagination is supported. - * @param \Google\Cloud\DataLabeling\V1beta1\ListEvaluationJobsRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - * @return \Grpc\UnaryCall - */ - public function ListEvaluationJobs(\Google\Cloud\DataLabeling\V1beta1\ListEvaluationJobsRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/google.cloud.datalabeling.v1beta1.DataLabelingService/ListEvaluationJobs', - $argument, - ['\Google\Cloud\DataLabeling\V1beta1\ListEvaluationJobsResponse', 'decode'], - $metadata, $options); - } - -} diff --git a/DataLabeling/src/V1beta1/Dataset.php b/DataLabeling/src/V1beta1/Dataset.php index adeb2811daea..e4038875b2cc 100644 --- a/DataLabeling/src/V1beta1/Dataset.php +++ b/DataLabeling/src/V1beta1/Dataset.php @@ -22,26 +22,26 @@ class Dataset extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1; */ - private $name = ''; + protected $name = ''; /** * Required. The display name of the dataset. Maximum of 64 characters. * * Generated from protobuf field string display_name = 2; */ - private $display_name = ''; + protected $display_name = ''; /** * Optional. User-provided description of the annotation specification set. * The description can be up to 10000 characters long. * * Generated from protobuf field string description = 3; */ - private $description = ''; + protected $description = ''; /** * Output only. Time the dataset is created. * * Generated from protobuf field .google.protobuf.Timestamp create_time = 4; */ - private $create_time = null; + protected $create_time = null; /** * Output only. This is populated with the original input configs * where ImportData is called. It is available only after the clients @@ -62,7 +62,7 @@ class Dataset extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int64 data_item_count = 7; */ - private $data_item_count = 0; + protected $data_item_count = 0; /** * Constructor. diff --git a/DataLabeling/src/V1beta1/DeleteAnnotatedDatasetRequest.php b/DataLabeling/src/V1beta1/DeleteAnnotatedDatasetRequest.php index 0ea041bd3748..160af21e48a1 100644 --- a/DataLabeling/src/V1beta1/DeleteAnnotatedDatasetRequest.php +++ b/DataLabeling/src/V1beta1/DeleteAnnotatedDatasetRequest.php @@ -22,7 +22,7 @@ class DeleteAnnotatedDatasetRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * Constructor. diff --git a/DataLabeling/src/V1beta1/DeleteAnnotationSpecSetRequest.php b/DataLabeling/src/V1beta1/DeleteAnnotationSpecSetRequest.php index b716be238531..bb72eee746d7 100644 --- a/DataLabeling/src/V1beta1/DeleteAnnotationSpecSetRequest.php +++ b/DataLabeling/src/V1beta1/DeleteAnnotationSpecSetRequest.php @@ -21,7 +21,7 @@ class DeleteAnnotationSpecSetRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. AnnotationSpec resource name, format: diff --git a/DataLabeling/src/V1beta1/DeleteDatasetRequest.php b/DataLabeling/src/V1beta1/DeleteDatasetRequest.php index 6ecfa33b05d9..5b6379e210ba 100644 --- a/DataLabeling/src/V1beta1/DeleteDatasetRequest.php +++ b/DataLabeling/src/V1beta1/DeleteDatasetRequest.php @@ -21,7 +21,7 @@ class DeleteDatasetRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. Dataset resource name, format: diff --git a/DataLabeling/src/V1beta1/DeleteEvaluationJobRequest.php b/DataLabeling/src/V1beta1/DeleteEvaluationJobRequest.php index 36717ee41a8c..4ced56c8aafb 100644 --- a/DataLabeling/src/V1beta1/DeleteEvaluationJobRequest.php +++ b/DataLabeling/src/V1beta1/DeleteEvaluationJobRequest.php @@ -21,7 +21,7 @@ class DeleteEvaluationJobRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. Name of the evaluation job that is going to be deleted. Format: diff --git a/DataLabeling/src/V1beta1/DeleteInstructionRequest.php b/DataLabeling/src/V1beta1/DeleteInstructionRequest.php index a6ff7a5b98cd..3adc3a7cef1c 100644 --- a/DataLabeling/src/V1beta1/DeleteInstructionRequest.php +++ b/DataLabeling/src/V1beta1/DeleteInstructionRequest.php @@ -21,7 +21,7 @@ class DeleteInstructionRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. Instruction resource name, format: diff --git a/DataLabeling/src/V1beta1/Evaluation.php b/DataLabeling/src/V1beta1/Evaluation.php index 03ec7f10def2..401d7697a072 100644 --- a/DataLabeling/src/V1beta1/Evaluation.php +++ b/DataLabeling/src/V1beta1/Evaluation.php @@ -23,33 +23,33 @@ class Evaluation extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1; */ - private $name = ''; + protected $name = ''; /** * Output only. Options used in the evaluation job that created this * evaluation. * * Generated from protobuf field .google.cloud.datalabeling.v1beta1.EvaluationConfig config = 2; */ - private $config = null; + protected $config = null; /** * Output only. Timestamp for when the evaluation job that created this * evaluation ran. * * Generated from protobuf field .google.protobuf.Timestamp evaluation_job_run_time = 3; */ - private $evaluation_job_run_time = null; + protected $evaluation_job_run_time = null; /** * Output only. Timestamp for when this evaluation was created. * * Generated from protobuf field .google.protobuf.Timestamp create_time = 4; */ - private $create_time = null; + protected $create_time = null; /** * Output only. Metrics comparing predictions to ground truth labels. * * Generated from protobuf field .google.cloud.datalabeling.v1beta1.EvaluationMetrics evaluation_metrics = 5; */ - private $evaluation_metrics = null; + protected $evaluation_metrics = null; /** * Output only. Type of task that the model version being evaluated performs, * as defined in the @@ -58,7 +58,7 @@ class Evaluation extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.datalabeling.v1beta1.AnnotationType annotation_type = 6; */ - private $annotation_type = 0; + protected $annotation_type = 0; /** * Output only. The number of items in the ground truth dataset that were used * for this evaluation. Only populated when the evaulation is for certain @@ -66,7 +66,7 @@ class Evaluation extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int64 evaluated_item_count = 7; */ - private $evaluated_item_count = 0; + protected $evaluated_item_count = 0; /** * Constructor. diff --git a/DataLabeling/src/V1beta1/EvaluationJob.php b/DataLabeling/src/V1beta1/EvaluationJob.php index 21f30ea741d8..6c9701155249 100644 --- a/DataLabeling/src/V1beta1/EvaluationJob.php +++ b/DataLabeling/src/V1beta1/EvaluationJob.php @@ -11,7 +11,7 @@ /** * Defines an evaluation job that runs periodically to generate * [Evaluations][google.cloud.datalabeling.v1beta1.Evaluation]. [Creating an evaluation - * job](https://cloud.google.com/ml-engine/docs/continuous-evaluation/create-job) is the starting point + * job](/ml-engine/docs/continuous-evaluation/create-job) is the starting point * for using continuous evaluation. * * Generated from protobuf message google.cloud.datalabeling.v1beta1.EvaluationJob @@ -25,37 +25,37 @@ class EvaluationJob extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1; */ - private $name = ''; + protected $name = ''; /** * Required. Description of the job. The description can be up to 25,000 * characters long. * * Generated from protobuf field string description = 2; */ - private $description = ''; + protected $description = ''; /** * Output only. Describes the current state of the job. * * Generated from protobuf field .google.cloud.datalabeling.v1beta1.EvaluationJob.State state = 3; */ - private $state = 0; + protected $state = 0; /** * Required. Describes the interval at which the job runs. This interval must * be at least 1 day, and it is rounded to the nearest day. For example, if * you specify a 50-hour interval, the job runs every 2 days. * You can provide the schedule in - * [crontab format](https://cloud.google.com/scheduler/docs/configuring/cron-job-schedules) or in an + * [crontab format](/scheduler/docs/configuring/cron-job-schedules) or in an * [English-like - * format](https://cloud.google.com/appengine/docs/standard/python/config/cronref#schedule_format). + * format](/appengine/docs/standard/python/config/cronref#schedule_format). * Regardless of what you specify, the job will run at 10:00 AM UTC. Only the * interval from this schedule is used, not the specific time of day. * * Generated from protobuf field string schedule = 4; */ - private $schedule = ''; + protected $schedule = ''; /** * Required. The [AI Platform Prediction model - * version](https://cloud.google.com/ml-engine/docs/prediction-overview) to be evaluated. Prediction + * version](/ml-engine/docs/prediction-overview) to be evaluated. Prediction * input and output is sampled from this model version. When creating an * evaluation job, specify the model version in the following format: * "projects/{project_id}/models/{model_name}/versions/{version_name}" @@ -63,13 +63,13 @@ class EvaluationJob extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string model_version = 5; */ - private $model_version = ''; + protected $model_version = ''; /** * Required. Configuration details for the evaluation job. * * Generated from protobuf field .google.cloud.datalabeling.v1beta1.EvaluationJobConfig evaluation_job_config = 6; */ - private $evaluation_job_config = null; + protected $evaluation_job_config = null; /** * Required. Name of the [AnnotationSpecSet][google.cloud.datalabeling.v1beta1.AnnotationSpecSet] describing all the * labels that your machine learning model outputs. You must create this @@ -79,7 +79,7 @@ class EvaluationJob extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string annotation_spec_set = 7; */ - private $annotation_spec_set = ''; + protected $annotation_spec_set = ''; /** * Required. Whether you want Data Labeling Service to provide ground truth * labels for prediction input. If you want the service to assign human @@ -89,7 +89,7 @@ class EvaluationJob extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool label_missing_ground_truth = 8; */ - private $label_missing_ground_truth = false; + protected $label_missing_ground_truth = false; /** * Output only. Every time the evaluation job runs and an error occurs, the * failed attempt is appended to this array. @@ -102,7 +102,7 @@ class EvaluationJob extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Timestamp create_time = 10; */ - private $create_time = null; + protected $create_time = null; /** * Constructor. @@ -124,14 +124,14 @@ class EvaluationJob extends \Google\Protobuf\Internal\Message * be at least 1 day, and it is rounded to the nearest day. For example, if * you specify a 50-hour interval, the job runs every 2 days. * You can provide the schedule in - * [crontab format](https://cloud.google.com/scheduler/docs/configuring/cron-job-schedules) or in an + * [crontab format](/scheduler/docs/configuring/cron-job-schedules) or in an * [English-like - * format](https://cloud.google.com/appengine/docs/standard/python/config/cronref#schedule_format). + * format](/appengine/docs/standard/python/config/cronref#schedule_format). * Regardless of what you specify, the job will run at 10:00 AM UTC. Only the * interval from this schedule is used, not the specific time of day. * @type string $model_version * Required. The [AI Platform Prediction model - * version](https://cloud.google.com/ml-engine/docs/prediction-overview) to be evaluated. Prediction + * version](/ml-engine/docs/prediction-overview) to be evaluated. Prediction * input and output is sampled from this model version. When creating an * evaluation job, specify the model version in the following format: * "projects/{project_id}/models/{model_name}/versions/{version_name}" @@ -251,9 +251,9 @@ public function setState($var) * be at least 1 day, and it is rounded to the nearest day. For example, if * you specify a 50-hour interval, the job runs every 2 days. * You can provide the schedule in - * [crontab format](https://cloud.google.com/scheduler/docs/configuring/cron-job-schedules) or in an + * [crontab format](/scheduler/docs/configuring/cron-job-schedules) or in an * [English-like - * format](https://cloud.google.com/appengine/docs/standard/python/config/cronref#schedule_format). + * format](/appengine/docs/standard/python/config/cronref#schedule_format). * Regardless of what you specify, the job will run at 10:00 AM UTC. Only the * interval from this schedule is used, not the specific time of day. * @@ -270,9 +270,9 @@ public function getSchedule() * be at least 1 day, and it is rounded to the nearest day. For example, if * you specify a 50-hour interval, the job runs every 2 days. * You can provide the schedule in - * [crontab format](https://cloud.google.com/scheduler/docs/configuring/cron-job-schedules) or in an + * [crontab format](/scheduler/docs/configuring/cron-job-schedules) or in an * [English-like - * format](https://cloud.google.com/appengine/docs/standard/python/config/cronref#schedule_format). + * format](/appengine/docs/standard/python/config/cronref#schedule_format). * Regardless of what you specify, the job will run at 10:00 AM UTC. Only the * interval from this schedule is used, not the specific time of day. * @@ -290,7 +290,7 @@ public function setSchedule($var) /** * Required. The [AI Platform Prediction model - * version](https://cloud.google.com/ml-engine/docs/prediction-overview) to be evaluated. Prediction + * version](/ml-engine/docs/prediction-overview) to be evaluated. Prediction * input and output is sampled from this model version. When creating an * evaluation job, specify the model version in the following format: * "projects/{project_id}/models/{model_name}/versions/{version_name}" @@ -306,7 +306,7 @@ public function getModelVersion() /** * Required. The [AI Platform Prediction model - * version](https://cloud.google.com/ml-engine/docs/prediction-overview) to be evaluated. Prediction + * version](/ml-engine/docs/prediction-overview) to be evaluated. Prediction * input and output is sampled from this model version. When creating an * evaluation job, specify the model version in the following format: * "projects/{project_id}/models/{model_name}/versions/{version_name}" diff --git a/DataLabeling/src/V1beta1/EvaluationJob/State.php b/DataLabeling/src/V1beta1/EvaluationJob/State.php index e988d35a98fb..d954c89da0fe 100644 --- a/DataLabeling/src/V1beta1/EvaluationJob/State.php +++ b/DataLabeling/src/V1beta1/EvaluationJob/State.php @@ -99,6 +99,4 @@ public static function value($name) } } -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(State::class, \Google\Cloud\DataLabeling\V1beta1\EvaluationJob_State::class); diff --git a/DataLabeling/src/V1beta1/EvaluationJobAlertConfig.php b/DataLabeling/src/V1beta1/EvaluationJobAlertConfig.php index 5c65d59e25e8..1c9f2473e9a0 100644 --- a/DataLabeling/src/V1beta1/EvaluationJobAlertConfig.php +++ b/DataLabeling/src/V1beta1/EvaluationJobAlertConfig.php @@ -21,7 +21,7 @@ class EvaluationJobAlertConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string email = 1; */ - private $email = ''; + protected $email = ''; /** * Required. A number between 0 and 1 that describes a minimum mean average * precision threshold. When the evaluation job runs, if it calculates that @@ -31,7 +31,7 @@ class EvaluationJobAlertConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field double min_acceptable_mean_average_precision = 2; */ - private $min_acceptable_mean_average_precision = 0.0; + protected $min_acceptable_mean_average_precision = 0.0; /** * Constructor. diff --git a/DataLabeling/src/V1beta1/EvaluationJobConfig.php b/DataLabeling/src/V1beta1/EvaluationJobConfig.php index 51092e69eb1c..c3970c45a30f 100644 --- a/DataLabeling/src/V1beta1/EvaluationJobConfig.php +++ b/DataLabeling/src/V1beta1/EvaluationJobConfig.php @@ -29,7 +29,7 @@ class EvaluationJobConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.datalabeling.v1beta1.InputConfig input_config = 1; */ - private $input_config = null; + protected $input_config = null; /** * Required. Details for calculating evaluation metrics and creating * [Evaulations][google.cloud.datalabeling.v1beta1.Evaluation]. If your model version performs image object @@ -39,7 +39,7 @@ class EvaluationJobConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.datalabeling.v1beta1.EvaluationConfig evaluation_config = 2; */ - private $evaluation_config = null; + protected $evaluation_config = null; /** * Optional. Details for human annotation of your data. If you set * [labelMissingGroundTruth][google.cloud.datalabeling.v1beta1.EvaluationJob.label_missing_ground_truth] to @@ -51,7 +51,7 @@ class EvaluationJobConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.datalabeling.v1beta1.HumanAnnotationConfig human_annotation_config = 3; */ - private $human_annotation_config = null; + protected $human_annotation_config = null; /** * Required. Prediction keys that tell Data Labeling Service where to find the * data for evaluation in your BigQuery table. When the service samples @@ -68,7 +68,7 @@ class EvaluationJobConfig extends \Google\Protobuf\Internal\Message * * `bounding_box_json_key`: the bounding box key for prediction output. * Required if your model version perform image object detection. * Learn [how to configure prediction - * keys](https://cloud.google.com/ml-engine/docs/continuous-evaluation/create-job#prediction-keys). + * keys](/ml-engine/docs/continuous-evaluation/create-job#prediction-keys). * * Generated from protobuf field map bigquery_import_keys = 9; */ @@ -82,7 +82,7 @@ class EvaluationJobConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 example_count = 10; */ - private $example_count = 0; + protected $example_count = 0; /** * Required. Fraction of predictions to sample and save to BigQuery during * each [evaluation interval][google.cloud.datalabeling.v1beta1.EvaluationJob.schedule]. For example, 0.1 means @@ -90,7 +90,7 @@ class EvaluationJobConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field double example_sample_percentage = 11; */ - private $example_sample_percentage = 0.0; + protected $example_sample_percentage = 0.0; /** * Optional. Configuration details for evaluation job alerts. Specify this * field if you want to receive email alerts if the evaluation job finds that @@ -98,7 +98,7 @@ class EvaluationJobConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.datalabeling.v1beta1.EvaluationJobAlertConfig evaluation_job_alert_config = 13; */ - private $evaluation_job_alert_config = null; + protected $evaluation_job_alert_config = null; protected $human_annotation_request_config; /** @@ -165,7 +165,7 @@ class EvaluationJobConfig extends \Google\Protobuf\Internal\Message * * `bounding_box_json_key`: the bounding box key for prediction output. * Required if your model version perform image object detection. * Learn [how to configure prediction - * keys](https://cloud.google.com/ml-engine/docs/continuous-evaluation/create-job#prediction-keys). + * keys](/ml-engine/docs/continuous-evaluation/create-job#prediction-keys). * @type int $example_count * Required. The maximum number of predictions to sample and save to BigQuery * during each [evaluation interval][google.cloud.datalabeling.v1beta1.EvaluationJob.schedule]. This limit @@ -464,7 +464,7 @@ public function setHumanAnnotationConfig($var) * * `bounding_box_json_key`: the bounding box key for prediction output. * Required if your model version perform image object detection. * Learn [how to configure prediction - * keys](https://cloud.google.com/ml-engine/docs/continuous-evaluation/create-job#prediction-keys). + * keys](/ml-engine/docs/continuous-evaluation/create-job#prediction-keys). * * Generated from protobuf field map bigquery_import_keys = 9; * @return \Google\Protobuf\Internal\MapField @@ -490,7 +490,7 @@ public function getBigqueryImportKeys() * * `bounding_box_json_key`: the bounding box key for prediction output. * Required if your model version perform image object detection. * Learn [how to configure prediction - * keys](https://cloud.google.com/ml-engine/docs/continuous-evaluation/create-job#prediction-keys). + * keys](/ml-engine/docs/continuous-evaluation/create-job#prediction-keys). * * Generated from protobuf field map bigquery_import_keys = 9; * @param array|\Google\Protobuf\Internal\MapField $var diff --git a/DataLabeling/src/V1beta1/EvaluationJob_State.php b/DataLabeling/src/V1beta1/EvaluationJob_State.php deleted file mode 100644 index 3c946f916c7e..000000000000 --- a/DataLabeling/src/V1beta1/EvaluationJob_State.php +++ /dev/null @@ -1,16 +0,0 @@ -string name = 1; */ - private $name = ''; + protected $name = ''; /** * Output only. Annotations for the piece of data in Example. * One piece of data can have multiple annotations. diff --git a/DataLabeling/src/V1beta1/ExportDataOperationMetadata.php b/DataLabeling/src/V1beta1/ExportDataOperationMetadata.php index 83c0f9580eaf..8924c2b8acac 100644 --- a/DataLabeling/src/V1beta1/ExportDataOperationMetadata.php +++ b/DataLabeling/src/V1beta1/ExportDataOperationMetadata.php @@ -21,7 +21,7 @@ class ExportDataOperationMetadata extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string dataset = 1; */ - private $dataset = ''; + protected $dataset = ''; /** * Output only. Partial failures encountered. * E.g. single files that couldn't be read. @@ -35,7 +35,7 @@ class ExportDataOperationMetadata extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Timestamp create_time = 3; */ - private $create_time = null; + protected $create_time = null; /** * Constructor. diff --git a/DataLabeling/src/V1beta1/ExportDataOperationResponse.php b/DataLabeling/src/V1beta1/ExportDataOperationResponse.php index 480e255bc934..bb2e7220def0 100644 --- a/DataLabeling/src/V1beta1/ExportDataOperationResponse.php +++ b/DataLabeling/src/V1beta1/ExportDataOperationResponse.php @@ -21,31 +21,31 @@ class ExportDataOperationResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string dataset = 1; */ - private $dataset = ''; + protected $dataset = ''; /** * Output only. Total number of examples requested to export * * Generated from protobuf field int32 total_count = 2; */ - private $total_count = 0; + protected $total_count = 0; /** * Output only. Number of examples exported successfully. * * Generated from protobuf field int32 export_count = 3; */ - private $export_count = 0; + protected $export_count = 0; /** * Output only. Statistic infos of labels in the exported dataset. * * Generated from protobuf field .google.cloud.datalabeling.v1beta1.LabelStats label_stats = 4; */ - private $label_stats = null; + protected $label_stats = null; /** * Output only. output_config in the ExportData request. * * Generated from protobuf field .google.cloud.datalabeling.v1beta1.OutputConfig output_config = 5; */ - private $output_config = null; + protected $output_config = null; /** * Constructor. diff --git a/DataLabeling/src/V1beta1/ExportDataRequest.php b/DataLabeling/src/V1beta1/ExportDataRequest.php index 190912b7f317..0915bfef0f7b 100644 --- a/DataLabeling/src/V1beta1/ExportDataRequest.php +++ b/DataLabeling/src/V1beta1/ExportDataRequest.php @@ -21,7 +21,7 @@ class ExportDataRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * Required. Annotated dataset resource name. DataItem in * Dataset and their annotations in specified annotated dataset will be @@ -31,26 +31,26 @@ class ExportDataRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string annotated_dataset = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $annotated_dataset = ''; + protected $annotated_dataset = ''; /** * Optional. Filter is not supported at this moment. * * Generated from protobuf field string filter = 3 [(.google.api.field_behavior) = OPTIONAL]; */ - private $filter = ''; + protected $filter = ''; /** * Required. Specify the output destination. * * Generated from protobuf field .google.cloud.datalabeling.v1beta1.OutputConfig output_config = 4 [(.google.api.field_behavior) = REQUIRED]; */ - private $output_config = null; + protected $output_config = null; /** * Email of the user who started the export task and should be notified by * email. If empty no notification will be sent. * * Generated from protobuf field string user_email_address = 5; */ - private $user_email_address = ''; + protected $user_email_address = ''; /** * @param string $name Required. Dataset resource name, format: diff --git a/DataLabeling/src/V1beta1/Gapic/DataLabelingServiceGapicClient.php b/DataLabeling/src/V1beta1/Gapic/DataLabelingServiceGapicClient.php deleted file mode 100644 index bce8fba34d19..000000000000 --- a/DataLabeling/src/V1beta1/Gapic/DataLabelingServiceGapicClient.php +++ /dev/null @@ -1,2740 +0,0 @@ -projectName('[PROJECT]'); - * $annotationSpecSet = new AnnotationSpecSet(); - * $response = $dataLabelingServiceClient->createAnnotationSpecSet($formattedParent, $annotationSpecSet); - * } finally { - * $dataLabelingServiceClient->close(); - * } - * ``` - * - * Many parameters require resource names to be formatted in a particular way. To - * assist with these names, this class includes a format method for each type of - * name, and additionally a parseName method to extract the individual identifiers - * contained within formatted names that are returned by the API. - * - * @experimental - * - * @deprecated Please use the new service client {@see \Google\Cloud\DataLabeling\V1beta1\Client\DataLabelingServiceClient}. - */ -class DataLabelingServiceGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.datalabeling.v1beta1.DataLabelingService'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'datalabeling.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'datalabeling.UNIVERSE_DOMAIN'; - - /** The default port of the service. */ - const DEFAULT_SERVICE_PORT = 443; - - /** The name of the code generator, to be included in the agent header. */ - const CODEGEN_NAME = 'gapic'; - - /** The default scopes required by the service. */ - public static $serviceScopes = [ - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private static $annotatedDatasetNameTemplate; - - private static $annotationSpecSetNameTemplate; - - private static $dataItemNameTemplate; - - private static $datasetNameTemplate; - - private static $evaluationNameTemplate; - - private static $evaluationJobNameTemplate; - - private static $exampleNameTemplate; - - private static $instructionNameTemplate; - - private static $projectNameTemplate; - - private static $pathTemplateMap; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/data_labeling_service_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/data_labeling_service_descriptor_config.php', - 'gcpApiConfigPath' => __DIR__ . '/../resources/data_labeling_service_grpc_config.json', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/data_labeling_service_rest_client_config.php', - ], - ], - ]; - } - - private static function getAnnotatedDatasetNameTemplate() - { - if (self::$annotatedDatasetNameTemplate == null) { - self::$annotatedDatasetNameTemplate = new PathTemplate('projects/{project}/datasets/{dataset}/annotatedDatasets/{annotated_dataset}'); - } - - return self::$annotatedDatasetNameTemplate; - } - - private static function getAnnotationSpecSetNameTemplate() - { - if (self::$annotationSpecSetNameTemplate == null) { - self::$annotationSpecSetNameTemplate = new PathTemplate('projects/{project}/annotationSpecSets/{annotation_spec_set}'); - } - - return self::$annotationSpecSetNameTemplate; - } - - private static function getDataItemNameTemplate() - { - if (self::$dataItemNameTemplate == null) { - self::$dataItemNameTemplate = new PathTemplate('projects/{project}/datasets/{dataset}/dataItems/{data_item}'); - } - - return self::$dataItemNameTemplate; - } - - private static function getDatasetNameTemplate() - { - if (self::$datasetNameTemplate == null) { - self::$datasetNameTemplate = new PathTemplate('projects/{project}/datasets/{dataset}'); - } - - return self::$datasetNameTemplate; - } - - private static function getEvaluationNameTemplate() - { - if (self::$evaluationNameTemplate == null) { - self::$evaluationNameTemplate = new PathTemplate('projects/{project}/datasets/{dataset}/evaluations/{evaluation}'); - } - - return self::$evaluationNameTemplate; - } - - private static function getEvaluationJobNameTemplate() - { - if (self::$evaluationJobNameTemplate == null) { - self::$evaluationJobNameTemplate = new PathTemplate('projects/{project}/evaluationJobs/{evaluation_job}'); - } - - return self::$evaluationJobNameTemplate; - } - - private static function getExampleNameTemplate() - { - if (self::$exampleNameTemplate == null) { - self::$exampleNameTemplate = new PathTemplate('projects/{project}/datasets/{dataset}/annotatedDatasets/{annotated_dataset}/examples/{example}'); - } - - return self::$exampleNameTemplate; - } - - private static function getInstructionNameTemplate() - { - if (self::$instructionNameTemplate == null) { - self::$instructionNameTemplate = new PathTemplate('projects/{project}/instructions/{instruction}'); - } - - return self::$instructionNameTemplate; - } - - private static function getProjectNameTemplate() - { - if (self::$projectNameTemplate == null) { - self::$projectNameTemplate = new PathTemplate('projects/{project}'); - } - - return self::$projectNameTemplate; - } - - private static function getPathTemplateMap() - { - if (self::$pathTemplateMap == null) { - self::$pathTemplateMap = [ - 'annotatedDataset' => self::getAnnotatedDatasetNameTemplate(), - 'annotationSpecSet' => self::getAnnotationSpecSetNameTemplate(), - 'dataItem' => self::getDataItemNameTemplate(), - 'dataset' => self::getDatasetNameTemplate(), - 'evaluation' => self::getEvaluationNameTemplate(), - 'evaluationJob' => self::getEvaluationJobNameTemplate(), - 'example' => self::getExampleNameTemplate(), - 'instruction' => self::getInstructionNameTemplate(), - 'project' => self::getProjectNameTemplate(), - ]; - } - - return self::$pathTemplateMap; - } - - /** - * Formats a string containing the fully-qualified path to represent a - * annotated_dataset resource. - * - * @param string $project - * @param string $dataset - * @param string $annotatedDataset - * - * @return string The formatted annotated_dataset resource. - * - * @experimental - */ - public static function annotatedDatasetName($project, $dataset, $annotatedDataset) - { - return self::getAnnotatedDatasetNameTemplate()->render([ - 'project' => $project, - 'dataset' => $dataset, - 'annotated_dataset' => $annotatedDataset, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * annotation_spec_set resource. - * - * @param string $project - * @param string $annotationSpecSet - * - * @return string The formatted annotation_spec_set resource. - * - * @experimental - */ - public static function annotationSpecSetName($project, $annotationSpecSet) - { - return self::getAnnotationSpecSetNameTemplate()->render([ - 'project' => $project, - 'annotation_spec_set' => $annotationSpecSet, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a data_item - * resource. - * - * @param string $project - * @param string $dataset - * @param string $dataItem - * - * @return string The formatted data_item resource. - * - * @experimental - */ - public static function dataItemName($project, $dataset, $dataItem) - { - return self::getDataItemNameTemplate()->render([ - 'project' => $project, - 'dataset' => $dataset, - 'data_item' => $dataItem, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a dataset - * resource. - * - * @param string $project - * @param string $dataset - * - * @return string The formatted dataset resource. - * - * @experimental - */ - public static function datasetName($project, $dataset) - { - return self::getDatasetNameTemplate()->render([ - 'project' => $project, - 'dataset' => $dataset, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a evaluation - * resource. - * - * @param string $project - * @param string $dataset - * @param string $evaluation - * - * @return string The formatted evaluation resource. - * - * @experimental - */ - public static function evaluationName($project, $dataset, $evaluation) - { - return self::getEvaluationNameTemplate()->render([ - 'project' => $project, - 'dataset' => $dataset, - 'evaluation' => $evaluation, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * evaluation_job resource. - * - * @param string $project - * @param string $evaluationJob - * - * @return string The formatted evaluation_job resource. - * - * @experimental - */ - public static function evaluationJobName($project, $evaluationJob) - { - return self::getEvaluationJobNameTemplate()->render([ - 'project' => $project, - 'evaluation_job' => $evaluationJob, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a example - * resource. - * - * @param string $project - * @param string $dataset - * @param string $annotatedDataset - * @param string $example - * - * @return string The formatted example resource. - * - * @experimental - */ - public static function exampleName($project, $dataset, $annotatedDataset, $example) - { - return self::getExampleNameTemplate()->render([ - 'project' => $project, - 'dataset' => $dataset, - 'annotated_dataset' => $annotatedDataset, - 'example' => $example, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a instruction - * resource. - * - * @param string $project - * @param string $instruction - * - * @return string The formatted instruction resource. - * - * @experimental - */ - public static function instructionName($project, $instruction) - { - return self::getInstructionNameTemplate()->render([ - 'project' => $project, - 'instruction' => $instruction, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a project - * resource. - * - * @param string $project - * - * @return string The formatted project resource. - * - * @experimental - */ - public static function projectName($project) - { - return self::getProjectNameTemplate()->render([ - 'project' => $project, - ]); - } - - /** - * Parses a formatted name string and returns an associative array of the components in the name. - * The following name formats are supported: - * Template: Pattern - * - annotatedDataset: projects/{project}/datasets/{dataset}/annotatedDatasets/{annotated_dataset} - * - annotationSpecSet: projects/{project}/annotationSpecSets/{annotation_spec_set} - * - dataItem: projects/{project}/datasets/{dataset}/dataItems/{data_item} - * - dataset: projects/{project}/datasets/{dataset} - * - evaluation: projects/{project}/datasets/{dataset}/evaluations/{evaluation} - * - evaluationJob: projects/{project}/evaluationJobs/{evaluation_job} - * - example: projects/{project}/datasets/{dataset}/annotatedDatasets/{annotated_dataset}/examples/{example} - * - instruction: projects/{project}/instructions/{instruction} - * - project: projects/{project} - * - * The optional $template argument can be supplied to specify a particular pattern, - * and must match one of the templates listed above. If no $template argument is - * provided, or if the $template argument does not match one of the templates - * listed, then parseName will check each of the supported templates, and return - * the first match. - * - * @param string $formattedName The formatted name string - * @param string $template Optional name of template to match - * - * @return array An associative array from name component IDs to component values. - * - * @throws ValidationException If $formattedName could not be matched. - * - * @experimental - */ - public static function parseName($formattedName, $template = null) - { - $templateMap = self::getPathTemplateMap(); - if ($template) { - if (!isset($templateMap[$template])) { - throw new ValidationException("Template name $template does not exist"); - } - - return $templateMap[$template]->match($formattedName); - } - - foreach ($templateMap as $templateName => $pathTemplate) { - try { - return $pathTemplate->match($formattedName); - } catch (ValidationException $ex) { - // Swallow the exception to continue trying other path templates - } - } - - throw new ValidationException("Input did not match any known format. Input: $formattedName"); - } - - /** - * Return an OperationsClient object with the same endpoint as $this. - * - * @return OperationsClient - * - * @experimental - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** - * Resume an existing long running operation that was previously started by a long - * running API method. If $methodName is not provided, or does not match a long - * running API method, then the operation can still be resumed, but the - * OperationResponse object will not deserialize the final response. - * - * @param string $operationName The name of the long running operation - * @param string $methodName The name of the method used to start the operation - * - * @return OperationResponse - * - * @experimental - */ - public function resumeOperation($operationName, $methodName = null) - { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : []; - $operation = new OperationResponse($operationName, $this->getOperationsClient(), $options); - $operation->reload(); - return $operation; - } - - /** - * Constructor. - * - * @param array $options { - * Optional. Options for configuring the service API wrapper. - * - * @type string $apiEndpoint - * The address of the API remote host. May optionally include the port, formatted - * as ":". Default 'datalabeling.googleapis.com:443'. - * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials - * The credentials to be used by the client to authorize API calls. This option - * accepts either a path to a credentials file, or a decoded credentials file as a - * PHP array. - * *Advanced usage*: In addition, this option can also accept a pre-constructed - * {@see \Google\Auth\FetchAuthTokenInterface} object or - * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these - * objects are provided, any settings in $credentialsConfig will be ignored. - * @type array $credentialsConfig - * Options used to configure credentials, including auth token caching, for the - * client. For a full list of supporting configuration options, see - * {@see \Google\ApiCore\CredentialsWrapper::build()} . - * @type bool $disableRetries - * Determines whether or not retries defined by the client configuration should be - * disabled. Defaults to `false`. - * @type string|array $clientConfig - * Client method configuration, including retry settings. This option can be either - * a path to a JSON file, or a PHP array containing the decoded JSON data. By - * default this settings points to the default client config file, which is - * provided in the resources folder. - * @type string|TransportInterface $transport - * The transport used for executing network requests. May be either the string - * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. - * *Advanced usage*: Additionally, it is possible to pass in an already - * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note - * that when this object is provided, any settings in $transportConfig, and any - * $apiEndpoint setting, will be ignored. - * @type array $transportConfig - * Configuration options that will be used to construct the transport. Options for - * each supported transport type should be passed in a key for that transport. For - * example: - * $transportConfig = [ - * 'grpc' => [...], - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and - * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the - * supported options. - * @type callable $clientCertSource - * A callable which returns the client cert as a string. This can be used to - * provide a certificate and private key to the transport layer for mTLS. - * } - * - * @throws ValidationException - * - * @experimental - */ - public function __construct(array $options = []) - { - $clientOptions = $this->buildClientOptions($options); - $this->setClientOptions($clientOptions); - $this->operationsClient = $this->createOperationsClient($clientOptions); - } - - /** - * Creates an annotation spec set by providing a set of labels. - * - * Sample code: - * ``` - * $dataLabelingServiceClient = new DataLabelingServiceClient(); - * try { - * $formattedParent = $dataLabelingServiceClient->projectName('[PROJECT]'); - * $annotationSpecSet = new AnnotationSpecSet(); - * $response = $dataLabelingServiceClient->createAnnotationSpecSet($formattedParent, $annotationSpecSet); - * } finally { - * $dataLabelingServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. AnnotationSpecSet resource parent, format: - * projects/{project_id} - * @param AnnotationSpecSet $annotationSpecSet Required. Annotation spec set to create. Annotation specs must be included. - * Only one annotation spec will be accepted for annotation specs with same - * display_name. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\DataLabeling\V1beta1\AnnotationSpecSet - * - * @throws ApiException if the remote call fails - * - * @experimental - */ - public function createAnnotationSpecSet($parent, $annotationSpecSet, array $optionalArgs = []) - { - $request = new CreateAnnotationSpecSetRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setAnnotationSpecSet($annotationSpecSet); - $requestParamHeaders['parent'] = $parent; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('CreateAnnotationSpecSet', AnnotationSpecSet::class, $optionalArgs, $request)->wait(); - } - - /** - * Creates dataset. If success return a Dataset resource. - * - * Sample code: - * ``` - * $dataLabelingServiceClient = new DataLabelingServiceClient(); - * try { - * $formattedParent = $dataLabelingServiceClient->projectName('[PROJECT]'); - * $dataset = new Dataset(); - * $response = $dataLabelingServiceClient->createDataset($formattedParent, $dataset); - * } finally { - * $dataLabelingServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. Dataset resource parent, format: - * projects/{project_id} - * @param Dataset $dataset Required. The dataset to be created. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\DataLabeling\V1beta1\Dataset - * - * @throws ApiException if the remote call fails - * - * @experimental - */ - public function createDataset($parent, $dataset, array $optionalArgs = []) - { - $request = new CreateDatasetRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setDataset($dataset); - $requestParamHeaders['parent'] = $parent; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('CreateDataset', Dataset::class, $optionalArgs, $request)->wait(); - } - - /** - * Creates an evaluation job. - * - * Sample code: - * ``` - * $dataLabelingServiceClient = new DataLabelingServiceClient(); - * try { - * $formattedParent = $dataLabelingServiceClient->projectName('[PROJECT]'); - * $job = new EvaluationJob(); - * $response = $dataLabelingServiceClient->createEvaluationJob($formattedParent, $job); - * } finally { - * $dataLabelingServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. Evaluation job resource parent. Format: - * "projects/{project_id}" - * @param EvaluationJob $job Required. The evaluation job to create. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\DataLabeling\V1beta1\EvaluationJob - * - * @throws ApiException if the remote call fails - * - * @experimental - */ - public function createEvaluationJob($parent, $job, array $optionalArgs = []) - { - $request = new CreateEvaluationJobRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setJob($job); - $requestParamHeaders['parent'] = $parent; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('CreateEvaluationJob', EvaluationJob::class, $optionalArgs, $request)->wait(); - } - - /** - * Creates an instruction for how data should be labeled. - * - * Sample code: - * ``` - * $dataLabelingServiceClient = new DataLabelingServiceClient(); - * try { - * $formattedParent = $dataLabelingServiceClient->projectName('[PROJECT]'); - * $instruction = new Instruction(); - * $operationResponse = $dataLabelingServiceClient->createInstruction($formattedParent, $instruction); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $dataLabelingServiceClient->createInstruction($formattedParent, $instruction); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $dataLabelingServiceClient->resumeOperation($operationName, 'createInstruction'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $dataLabelingServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. Instruction resource parent, format: - * projects/{project_id} - * @param Instruction $instruction Required. Instruction of how to perform the labeling task. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - * - * @experimental - */ - public function createInstruction($parent, $instruction, array $optionalArgs = []) - { - $request = new CreateInstructionRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setInstruction($instruction); - $requestParamHeaders['parent'] = $parent; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('CreateInstruction', $optionalArgs, $request, $this->getOperationsClient())->wait(); - } - - /** - * Deletes an annotated dataset by resource name. - * - * Sample code: - * ``` - * $dataLabelingServiceClient = new DataLabelingServiceClient(); - * try { - * $formattedName = $dataLabelingServiceClient->annotatedDatasetName('[PROJECT]', '[DATASET]', '[ANNOTATED_DATASET]'); - * $dataLabelingServiceClient->deleteAnnotatedDataset($formattedName); - * } finally { - * $dataLabelingServiceClient->close(); - * } - * ``` - * - * @param string $name Required. Name of the annotated dataset to delete, format: - * projects/{project_id}/datasets/{dataset_id}/annotatedDatasets/ - * {annotated_dataset_id} - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @throws ApiException if the remote call fails - * - * @experimental - */ - public function deleteAnnotatedDataset($name, array $optionalArgs = []) - { - $request = new DeleteAnnotatedDatasetRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('DeleteAnnotatedDataset', GPBEmpty::class, $optionalArgs, $request)->wait(); - } - - /** - * Deletes an annotation spec set by resource name. - * - * Sample code: - * ``` - * $dataLabelingServiceClient = new DataLabelingServiceClient(); - * try { - * $formattedName = $dataLabelingServiceClient->annotationSpecSetName('[PROJECT]', '[ANNOTATION_SPEC_SET]'); - * $dataLabelingServiceClient->deleteAnnotationSpecSet($formattedName); - * } finally { - * $dataLabelingServiceClient->close(); - * } - * ``` - * - * @param string $name Required. AnnotationSpec resource name, format: - * `projects/{project_id}/annotationSpecSets/{annotation_spec_set_id}`. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @throws ApiException if the remote call fails - * - * @experimental - */ - public function deleteAnnotationSpecSet($name, array $optionalArgs = []) - { - $request = new DeleteAnnotationSpecSetRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('DeleteAnnotationSpecSet', GPBEmpty::class, $optionalArgs, $request)->wait(); - } - - /** - * Deletes a dataset by resource name. - * - * Sample code: - * ``` - * $dataLabelingServiceClient = new DataLabelingServiceClient(); - * try { - * $formattedName = $dataLabelingServiceClient->datasetName('[PROJECT]', '[DATASET]'); - * $dataLabelingServiceClient->deleteDataset($formattedName); - * } finally { - * $dataLabelingServiceClient->close(); - * } - * ``` - * - * @param string $name Required. Dataset resource name, format: - * projects/{project_id}/datasets/{dataset_id} - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @throws ApiException if the remote call fails - * - * @experimental - */ - public function deleteDataset($name, array $optionalArgs = []) - { - $request = new DeleteDatasetRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('DeleteDataset', GPBEmpty::class, $optionalArgs, $request)->wait(); - } - - /** - * Stops and deletes an evaluation job. - * - * Sample code: - * ``` - * $dataLabelingServiceClient = new DataLabelingServiceClient(); - * try { - * $formattedName = $dataLabelingServiceClient->evaluationJobName('[PROJECT]', '[EVALUATION_JOB]'); - * $dataLabelingServiceClient->deleteEvaluationJob($formattedName); - * } finally { - * $dataLabelingServiceClient->close(); - * } - * ``` - * - * @param string $name Required. Name of the evaluation job that is going to be deleted. Format: - * - * "projects/{project_id}/evaluationJobs/{evaluation_job_id}" - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @throws ApiException if the remote call fails - * - * @experimental - */ - public function deleteEvaluationJob($name, array $optionalArgs = []) - { - $request = new DeleteEvaluationJobRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('DeleteEvaluationJob', GPBEmpty::class, $optionalArgs, $request)->wait(); - } - - /** - * Deletes an instruction object by resource name. - * - * Sample code: - * ``` - * $dataLabelingServiceClient = new DataLabelingServiceClient(); - * try { - * $formattedName = $dataLabelingServiceClient->instructionName('[PROJECT]', '[INSTRUCTION]'); - * $dataLabelingServiceClient->deleteInstruction($formattedName); - * } finally { - * $dataLabelingServiceClient->close(); - * } - * ``` - * - * @param string $name Required. Instruction resource name, format: - * projects/{project_id}/instructions/{instruction_id} - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @throws ApiException if the remote call fails - * - * @experimental - */ - public function deleteInstruction($name, array $optionalArgs = []) - { - $request = new DeleteInstructionRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('DeleteInstruction', GPBEmpty::class, $optionalArgs, $request)->wait(); - } - - /** - * Exports data and annotations from dataset. - * - * Sample code: - * ``` - * $dataLabelingServiceClient = new DataLabelingServiceClient(); - * try { - * $formattedName = $dataLabelingServiceClient->datasetName('[PROJECT]', '[DATASET]'); - * $formattedAnnotatedDataset = $dataLabelingServiceClient->annotatedDatasetName('[PROJECT]', '[DATASET]', '[ANNOTATED_DATASET]'); - * $outputConfig = new OutputConfig(); - * $operationResponse = $dataLabelingServiceClient->exportData($formattedName, $formattedAnnotatedDataset, $outputConfig); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $dataLabelingServiceClient->exportData($formattedName, $formattedAnnotatedDataset, $outputConfig); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $dataLabelingServiceClient->resumeOperation($operationName, 'exportData'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $dataLabelingServiceClient->close(); - * } - * ``` - * - * @param string $name Required. Dataset resource name, format: - * projects/{project_id}/datasets/{dataset_id} - * @param string $annotatedDataset Required. Annotated dataset resource name. DataItem in - * Dataset and their annotations in specified annotated dataset will be - * exported. It's in format of - * projects/{project_id}/datasets/{dataset_id}/annotatedDatasets/ - * {annotated_dataset_id} - * @param OutputConfig $outputConfig Required. Specify the output destination. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * Optional. Filter is not supported at this moment. - * @type string $userEmailAddress - * Email of the user who started the export task and should be notified by - * email. If empty no notification will be sent. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - * - * @experimental - */ - public function exportData($name, $annotatedDataset, $outputConfig, array $optionalArgs = []) - { - $request = new ExportDataRequest(); - $requestParamHeaders = []; - $request->setName($name); - $request->setAnnotatedDataset($annotatedDataset); - $request->setOutputConfig($outputConfig); - $requestParamHeaders['name'] = $name; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['userEmailAddress'])) { - $request->setUserEmailAddress($optionalArgs['userEmailAddress']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('ExportData', $optionalArgs, $request, $this->getOperationsClient())->wait(); - } - - /** - * Gets an annotated dataset by resource name. - * - * Sample code: - * ``` - * $dataLabelingServiceClient = new DataLabelingServiceClient(); - * try { - * $formattedName = $dataLabelingServiceClient->annotatedDatasetName('[PROJECT]', '[DATASET]', '[ANNOTATED_DATASET]'); - * $response = $dataLabelingServiceClient->getAnnotatedDataset($formattedName); - * } finally { - * $dataLabelingServiceClient->close(); - * } - * ``` - * - * @param string $name Required. Name of the annotated dataset to get, format: - * projects/{project_id}/datasets/{dataset_id}/annotatedDatasets/ - * {annotated_dataset_id} - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\DataLabeling\V1beta1\AnnotatedDataset - * - * @throws ApiException if the remote call fails - * - * @experimental - */ - public function getAnnotatedDataset($name, array $optionalArgs = []) - { - $request = new GetAnnotatedDatasetRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('GetAnnotatedDataset', AnnotatedDataset::class, $optionalArgs, $request)->wait(); - } - - /** - * Gets an annotation spec set by resource name. - * - * Sample code: - * ``` - * $dataLabelingServiceClient = new DataLabelingServiceClient(); - * try { - * $formattedName = $dataLabelingServiceClient->annotationSpecSetName('[PROJECT]', '[ANNOTATION_SPEC_SET]'); - * $response = $dataLabelingServiceClient->getAnnotationSpecSet($formattedName); - * } finally { - * $dataLabelingServiceClient->close(); - * } - * ``` - * - * @param string $name Required. AnnotationSpecSet resource name, format: - * projects/{project_id}/annotationSpecSets/{annotation_spec_set_id} - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\DataLabeling\V1beta1\AnnotationSpecSet - * - * @throws ApiException if the remote call fails - * - * @experimental - */ - public function getAnnotationSpecSet($name, array $optionalArgs = []) - { - $request = new GetAnnotationSpecSetRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('GetAnnotationSpecSet', AnnotationSpecSet::class, $optionalArgs, $request)->wait(); - } - - /** - * Gets a data item in a dataset by resource name. This API can be - * called after data are imported into dataset. - * - * Sample code: - * ``` - * $dataLabelingServiceClient = new DataLabelingServiceClient(); - * try { - * $formattedName = $dataLabelingServiceClient->dataItemName('[PROJECT]', '[DATASET]', '[DATA_ITEM]'); - * $response = $dataLabelingServiceClient->getDataItem($formattedName); - * } finally { - * $dataLabelingServiceClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the data item to get, format: - * projects/{project_id}/datasets/{dataset_id}/dataItems/{data_item_id} - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\DataLabeling\V1beta1\DataItem - * - * @throws ApiException if the remote call fails - * - * @experimental - */ - public function getDataItem($name, array $optionalArgs = []) - { - $request = new GetDataItemRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('GetDataItem', DataItem::class, $optionalArgs, $request)->wait(); - } - - /** - * Gets dataset by resource name. - * - * Sample code: - * ``` - * $dataLabelingServiceClient = new DataLabelingServiceClient(); - * try { - * $formattedName = $dataLabelingServiceClient->datasetName('[PROJECT]', '[DATASET]'); - * $response = $dataLabelingServiceClient->getDataset($formattedName); - * } finally { - * $dataLabelingServiceClient->close(); - * } - * ``` - * - * @param string $name Required. Dataset resource name, format: - * projects/{project_id}/datasets/{dataset_id} - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\DataLabeling\V1beta1\Dataset - * - * @throws ApiException if the remote call fails - * - * @experimental - */ - public function getDataset($name, array $optionalArgs = []) - { - $request = new GetDatasetRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('GetDataset', Dataset::class, $optionalArgs, $request)->wait(); - } - - /** - * Gets an evaluation by resource name (to search, use - * [projects.evaluations.search][google.cloud.datalabeling.v1beta1.DataLabelingService.SearchEvaluations]). - * - * Sample code: - * ``` - * $dataLabelingServiceClient = new DataLabelingServiceClient(); - * try { - * $formattedName = $dataLabelingServiceClient->evaluationName('[PROJECT]', '[DATASET]', '[EVALUATION]'); - * $response = $dataLabelingServiceClient->getEvaluation($formattedName); - * } finally { - * $dataLabelingServiceClient->close(); - * } - * ``` - * - * @param string $name Required. Name of the evaluation. Format: - * - * "projects/{project_id}/datasets/{dataset_id}/evaluations/{evaluation_id}' - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\DataLabeling\V1beta1\Evaluation - * - * @throws ApiException if the remote call fails - * - * @experimental - */ - public function getEvaluation($name, array $optionalArgs = []) - { - $request = new GetEvaluationRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('GetEvaluation', Evaluation::class, $optionalArgs, $request)->wait(); - } - - /** - * Gets an evaluation job by resource name. - * - * Sample code: - * ``` - * $dataLabelingServiceClient = new DataLabelingServiceClient(); - * try { - * $formattedName = $dataLabelingServiceClient->evaluationJobName('[PROJECT]', '[EVALUATION_JOB]'); - * $response = $dataLabelingServiceClient->getEvaluationJob($formattedName); - * } finally { - * $dataLabelingServiceClient->close(); - * } - * ``` - * - * @param string $name Required. Name of the evaluation job. Format: - * - * "projects/{project_id}/evaluationJobs/{evaluation_job_id}" - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\DataLabeling\V1beta1\EvaluationJob - * - * @throws ApiException if the remote call fails - * - * @experimental - */ - public function getEvaluationJob($name, array $optionalArgs = []) - { - $request = new GetEvaluationJobRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('GetEvaluationJob', EvaluationJob::class, $optionalArgs, $request)->wait(); - } - - /** - * Gets an example by resource name, including both data and annotation. - * - * Sample code: - * ``` - * $dataLabelingServiceClient = new DataLabelingServiceClient(); - * try { - * $formattedName = $dataLabelingServiceClient->exampleName('[PROJECT]', '[DATASET]', '[ANNOTATED_DATASET]', '[EXAMPLE]'); - * $response = $dataLabelingServiceClient->getExample($formattedName); - * } finally { - * $dataLabelingServiceClient->close(); - * } - * ``` - * - * @param string $name Required. Name of example, format: - * projects/{project_id}/datasets/{dataset_id}/annotatedDatasets/ - * {annotated_dataset_id}/examples/{example_id} - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * Optional. An expression for filtering Examples. Filter by - * annotation_spec.display_name is supported. Format - * "annotation_spec.display_name = {display_name}" - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\DataLabeling\V1beta1\Example - * - * @throws ApiException if the remote call fails - * - * @experimental - */ - public function getExample($name, array $optionalArgs = []) - { - $request = new GetExampleRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('GetExample', Example::class, $optionalArgs, $request)->wait(); - } - - /** - * Gets an instruction by resource name. - * - * Sample code: - * ``` - * $dataLabelingServiceClient = new DataLabelingServiceClient(); - * try { - * $formattedName = $dataLabelingServiceClient->instructionName('[PROJECT]', '[INSTRUCTION]'); - * $response = $dataLabelingServiceClient->getInstruction($formattedName); - * } finally { - * $dataLabelingServiceClient->close(); - * } - * ``` - * - * @param string $name Required. Instruction resource name, format: - * projects/{project_id}/instructions/{instruction_id} - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\DataLabeling\V1beta1\Instruction - * - * @throws ApiException if the remote call fails - * - * @experimental - */ - public function getInstruction($name, array $optionalArgs = []) - { - $request = new GetInstructionRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('GetInstruction', Instruction::class, $optionalArgs, $request)->wait(); - } - - /** - * Imports data into dataset based on source locations defined in request. - * It can be called multiple times for the same dataset. Each dataset can - * only have one long running operation running on it. For example, no - * labeling task (also long running operation) can be started while - * importing is still ongoing. Vice versa. - * - * Sample code: - * ``` - * $dataLabelingServiceClient = new DataLabelingServiceClient(); - * try { - * $formattedName = $dataLabelingServiceClient->datasetName('[PROJECT]', '[DATASET]'); - * $inputConfig = new InputConfig(); - * $operationResponse = $dataLabelingServiceClient->importData($formattedName, $inputConfig); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $dataLabelingServiceClient->importData($formattedName, $inputConfig); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $dataLabelingServiceClient->resumeOperation($operationName, 'importData'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $dataLabelingServiceClient->close(); - * } - * ``` - * - * @param string $name Required. Dataset resource name, format: - * projects/{project_id}/datasets/{dataset_id} - * @param InputConfig $inputConfig Required. Specify the input source of the data. - * @param array $optionalArgs { - * Optional. - * - * @type string $userEmailAddress - * Email of the user who started the import task and should be notified by - * email. If empty no notification will be sent. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - * - * @experimental - */ - public function importData($name, $inputConfig, array $optionalArgs = []) - { - $request = new ImportDataRequest(); - $requestParamHeaders = []; - $request->setName($name); - $request->setInputConfig($inputConfig); - $requestParamHeaders['name'] = $name; - if (isset($optionalArgs['userEmailAddress'])) { - $request->setUserEmailAddress($optionalArgs['userEmailAddress']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('ImportData', $optionalArgs, $request, $this->getOperationsClient())->wait(); - } - - /** - * Starts a labeling task for image. The type of image labeling task is - * configured by feature in the request. - * - * Sample code: - * ``` - * $dataLabelingServiceClient = new DataLabelingServiceClient(); - * try { - * $formattedParent = $dataLabelingServiceClient->datasetName('[PROJECT]', '[DATASET]'); - * $basicConfig = new HumanAnnotationConfig(); - * $feature = Feature::FEATURE_UNSPECIFIED; - * $operationResponse = $dataLabelingServiceClient->labelImage($formattedParent, $basicConfig, $feature); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $dataLabelingServiceClient->labelImage($formattedParent, $basicConfig, $feature); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $dataLabelingServiceClient->resumeOperation($operationName, 'labelImage'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $dataLabelingServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. Name of the dataset to request labeling task, format: - * projects/{project_id}/datasets/{dataset_id} - * @param HumanAnnotationConfig $basicConfig Required. Basic human annotation config. - * @param int $feature Required. The type of image labeling task. - * For allowed values, use constants defined on {@see \Google\Cloud\DataLabeling\V1beta1\LabelImageRequest\Feature} - * @param array $optionalArgs { - * Optional. - * - * @type ImageClassificationConfig $imageClassificationConfig - * Configuration for image classification task. - * One of image_classification_config, bounding_poly_config, - * polyline_config and segmentation_config are required. - * @type BoundingPolyConfig $boundingPolyConfig - * Configuration for bounding box and bounding poly task. - * One of image_classification_config, bounding_poly_config, - * polyline_config and segmentation_config are required. - * @type PolylineConfig $polylineConfig - * Configuration for polyline task. - * One of image_classification_config, bounding_poly_config, - * polyline_config and segmentation_config are required. - * @type SegmentationConfig $segmentationConfig - * Configuration for segmentation task. - * One of image_classification_config, bounding_poly_config, - * polyline_config and segmentation_config are required. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - * - * @experimental - */ - public function labelImage($parent, $basicConfig, $feature, array $optionalArgs = []) - { - $request = new LabelImageRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setBasicConfig($basicConfig); - $request->setFeature($feature); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['imageClassificationConfig'])) { - $request->setImageClassificationConfig($optionalArgs['imageClassificationConfig']); - } - - if (isset($optionalArgs['boundingPolyConfig'])) { - $request->setBoundingPolyConfig($optionalArgs['boundingPolyConfig']); - } - - if (isset($optionalArgs['polylineConfig'])) { - $request->setPolylineConfig($optionalArgs['polylineConfig']); - } - - if (isset($optionalArgs['segmentationConfig'])) { - $request->setSegmentationConfig($optionalArgs['segmentationConfig']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('LabelImage', $optionalArgs, $request, $this->getOperationsClient())->wait(); - } - - /** - * Starts a labeling task for text. The type of text labeling task is - * configured by feature in the request. - * - * Sample code: - * ``` - * $dataLabelingServiceClient = new DataLabelingServiceClient(); - * try { - * $formattedParent = $dataLabelingServiceClient->datasetName('[PROJECT]', '[DATASET]'); - * $basicConfig = new HumanAnnotationConfig(); - * $feature = Feature::FEATURE_UNSPECIFIED; - * $operationResponse = $dataLabelingServiceClient->labelText($formattedParent, $basicConfig, $feature); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $dataLabelingServiceClient->labelText($formattedParent, $basicConfig, $feature); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $dataLabelingServiceClient->resumeOperation($operationName, 'labelText'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $dataLabelingServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. Name of the data set to request labeling task, format: - * projects/{project_id}/datasets/{dataset_id} - * @param HumanAnnotationConfig $basicConfig Required. Basic human annotation config. - * @param int $feature Required. The type of text labeling task. - * For allowed values, use constants defined on {@see \Google\Cloud\DataLabeling\V1beta1\LabelTextRequest\Feature} - * @param array $optionalArgs { - * Optional. - * - * @type TextClassificationConfig $textClassificationConfig - * Configuration for text classification task. - * One of text_classification_config and text_entity_extraction_config - * is required. - * @type TextEntityExtractionConfig $textEntityExtractionConfig - * Configuration for entity extraction task. - * One of text_classification_config and text_entity_extraction_config - * is required. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - * - * @experimental - */ - public function labelText($parent, $basicConfig, $feature, array $optionalArgs = []) - { - $request = new LabelTextRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setBasicConfig($basicConfig); - $request->setFeature($feature); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['textClassificationConfig'])) { - $request->setTextClassificationConfig($optionalArgs['textClassificationConfig']); - } - - if (isset($optionalArgs['textEntityExtractionConfig'])) { - $request->setTextEntityExtractionConfig($optionalArgs['textEntityExtractionConfig']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('LabelText', $optionalArgs, $request, $this->getOperationsClient())->wait(); - } - - /** - * Starts a labeling task for video. The type of video labeling task is - * configured by feature in the request. - * - * Sample code: - * ``` - * $dataLabelingServiceClient = new DataLabelingServiceClient(); - * try { - * $formattedParent = $dataLabelingServiceClient->datasetName('[PROJECT]', '[DATASET]'); - * $basicConfig = new HumanAnnotationConfig(); - * $feature = Feature::FEATURE_UNSPECIFIED; - * $operationResponse = $dataLabelingServiceClient->labelVideo($formattedParent, $basicConfig, $feature); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $dataLabelingServiceClient->labelVideo($formattedParent, $basicConfig, $feature); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $dataLabelingServiceClient->resumeOperation($operationName, 'labelVideo'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $dataLabelingServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. Name of the dataset to request labeling task, format: - * projects/{project_id}/datasets/{dataset_id} - * @param HumanAnnotationConfig $basicConfig Required. Basic human annotation config. - * @param int $feature Required. The type of video labeling task. - * For allowed values, use constants defined on {@see \Google\Cloud\DataLabeling\V1beta1\LabelVideoRequest\Feature} - * @param array $optionalArgs { - * Optional. - * - * @type VideoClassificationConfig $videoClassificationConfig - * Configuration for video classification task. - * One of video_classification_config, object_detection_config, - * object_tracking_config and event_config is required. - * @type ObjectDetectionConfig $objectDetectionConfig - * Configuration for video object detection task. - * One of video_classification_config, object_detection_config, - * object_tracking_config and event_config is required. - * @type ObjectTrackingConfig $objectTrackingConfig - * Configuration for video object tracking task. - * One of video_classification_config, object_detection_config, - * object_tracking_config and event_config is required. - * @type EventConfig $eventConfig - * Configuration for video event task. - * One of video_classification_config, object_detection_config, - * object_tracking_config and event_config is required. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - * - * @experimental - */ - public function labelVideo($parent, $basicConfig, $feature, array $optionalArgs = []) - { - $request = new LabelVideoRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setBasicConfig($basicConfig); - $request->setFeature($feature); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['videoClassificationConfig'])) { - $request->setVideoClassificationConfig($optionalArgs['videoClassificationConfig']); - } - - if (isset($optionalArgs['objectDetectionConfig'])) { - $request->setObjectDetectionConfig($optionalArgs['objectDetectionConfig']); - } - - if (isset($optionalArgs['objectTrackingConfig'])) { - $request->setObjectTrackingConfig($optionalArgs['objectTrackingConfig']); - } - - if (isset($optionalArgs['eventConfig'])) { - $request->setEventConfig($optionalArgs['eventConfig']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('LabelVideo', $optionalArgs, $request, $this->getOperationsClient())->wait(); - } - - /** - * Lists annotated datasets for a dataset. Pagination is supported. - * - * Sample code: - * ``` - * $dataLabelingServiceClient = new DataLabelingServiceClient(); - * try { - * $formattedParent = $dataLabelingServiceClient->datasetName('[PROJECT]', '[DATASET]'); - * // Iterate over pages of elements - * $pagedResponse = $dataLabelingServiceClient->listAnnotatedDatasets($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $dataLabelingServiceClient->listAnnotatedDatasets($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $dataLabelingServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. Name of the dataset to list annotated datasets, format: - * projects/{project_id}/datasets/{dataset_id} - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * Optional. Filter is not supported at this moment. - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - * - * @experimental - */ - public function listAnnotatedDatasets($parent, array $optionalArgs = []) - { - $request = new ListAnnotatedDatasetsRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('ListAnnotatedDatasets', $optionalArgs, ListAnnotatedDatasetsResponse::class, $request); - } - - /** - * Lists annotation spec sets for a project. Pagination is supported. - * - * Sample code: - * ``` - * $dataLabelingServiceClient = new DataLabelingServiceClient(); - * try { - * $formattedParent = $dataLabelingServiceClient->projectName('[PROJECT]'); - * // Iterate over pages of elements - * $pagedResponse = $dataLabelingServiceClient->listAnnotationSpecSets($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $dataLabelingServiceClient->listAnnotationSpecSets($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $dataLabelingServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. Parent of AnnotationSpecSet resource, format: - * projects/{project_id} - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * Optional. Filter is not supported at this moment. - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - * - * @experimental - */ - public function listAnnotationSpecSets($parent, array $optionalArgs = []) - { - $request = new ListAnnotationSpecSetsRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('ListAnnotationSpecSets', $optionalArgs, ListAnnotationSpecSetsResponse::class, $request); - } - - /** - * Lists data items in a dataset. This API can be called after data - * are imported into dataset. Pagination is supported. - * - * Sample code: - * ``` - * $dataLabelingServiceClient = new DataLabelingServiceClient(); - * try { - * $formattedParent = $dataLabelingServiceClient->datasetName('[PROJECT]', '[DATASET]'); - * // Iterate over pages of elements - * $pagedResponse = $dataLabelingServiceClient->listDataItems($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $dataLabelingServiceClient->listDataItems($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $dataLabelingServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. Name of the dataset to list data items, format: - * projects/{project_id}/datasets/{dataset_id} - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * Optional. Filter is not supported at this moment. - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - * - * @experimental - */ - public function listDataItems($parent, array $optionalArgs = []) - { - $request = new ListDataItemsRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('ListDataItems', $optionalArgs, ListDataItemsResponse::class, $request); - } - - /** - * Lists datasets under a project. Pagination is supported. - * - * Sample code: - * ``` - * $dataLabelingServiceClient = new DataLabelingServiceClient(); - * try { - * $formattedParent = $dataLabelingServiceClient->projectName('[PROJECT]'); - * // Iterate over pages of elements - * $pagedResponse = $dataLabelingServiceClient->listDatasets($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $dataLabelingServiceClient->listDatasets($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $dataLabelingServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. Dataset resource parent, format: - * projects/{project_id} - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * Optional. Filter on dataset is not supported at this moment. - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - * - * @experimental - */ - public function listDatasets($parent, array $optionalArgs = []) - { - $request = new ListDatasetsRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('ListDatasets', $optionalArgs, ListDatasetsResponse::class, $request); - } - - /** - * Lists all evaluation jobs within a project with possible filters. - * Pagination is supported. - * - * Sample code: - * ``` - * $dataLabelingServiceClient = new DataLabelingServiceClient(); - * try { - * $formattedParent = $dataLabelingServiceClient->projectName('[PROJECT]'); - * // Iterate over pages of elements - * $pagedResponse = $dataLabelingServiceClient->listEvaluationJobs($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $dataLabelingServiceClient->listEvaluationJobs($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $dataLabelingServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. Evaluation job resource parent. Format: - * "projects/{project_id}" - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * Optional. You can filter the jobs to list by model_id (also known as - * model_name, as described in - * [EvaluationJob.modelVersion][google.cloud.datalabeling.v1beta1.EvaluationJob.model_version]) or by - * evaluation job state (as described in [EvaluationJob.state][google.cloud.datalabeling.v1beta1.EvaluationJob.state]). To filter - * by both criteria, use the `AND` operator or the `OR` operator. For example, - * you can use the following string for your filter: - * "evaluation_job.model_id = {model_name} AND - * evaluation_job.state = {evaluation_job_state}" - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - * - * @experimental - */ - public function listEvaluationJobs($parent, array $optionalArgs = []) - { - $request = new ListEvaluationJobsRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('ListEvaluationJobs', $optionalArgs, ListEvaluationJobsResponse::class, $request); - } - - /** - * Lists examples in an annotated dataset. Pagination is supported. - * - * Sample code: - * ``` - * $dataLabelingServiceClient = new DataLabelingServiceClient(); - * try { - * $formattedParent = $dataLabelingServiceClient->annotatedDatasetName('[PROJECT]', '[DATASET]', '[ANNOTATED_DATASET]'); - * // Iterate over pages of elements - * $pagedResponse = $dataLabelingServiceClient->listExamples($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $dataLabelingServiceClient->listExamples($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $dataLabelingServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. Example resource parent. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * Optional. An expression for filtering Examples. For annotated datasets that - * have annotation spec set, filter by - * annotation_spec.display_name is supported. Format - * "annotation_spec.display_name = {display_name}" - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - * - * @experimental - */ - public function listExamples($parent, array $optionalArgs = []) - { - $request = new ListExamplesRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('ListExamples', $optionalArgs, ListExamplesResponse::class, $request); - } - - /** - * Lists instructions for a project. Pagination is supported. - * - * Sample code: - * ``` - * $dataLabelingServiceClient = new DataLabelingServiceClient(); - * try { - * $formattedParent = $dataLabelingServiceClient->projectName('[PROJECT]'); - * // Iterate over pages of elements - * $pagedResponse = $dataLabelingServiceClient->listInstructions($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $dataLabelingServiceClient->listInstructions($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $dataLabelingServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. Instruction resource parent, format: - * projects/{project_id} - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * Optional. Filter is not supported at this moment. - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - * - * @experimental - */ - public function listInstructions($parent, array $optionalArgs = []) - { - $request = new ListInstructionsRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('ListInstructions', $optionalArgs, ListInstructionsResponse::class, $request); - } - - /** - * Pauses an evaluation job. Pausing an evaluation job that is already in a - * `PAUSED` state is a no-op. - * - * Sample code: - * ``` - * $dataLabelingServiceClient = new DataLabelingServiceClient(); - * try { - * $formattedName = $dataLabelingServiceClient->evaluationJobName('[PROJECT]', '[EVALUATION_JOB]'); - * $dataLabelingServiceClient->pauseEvaluationJob($formattedName); - * } finally { - * $dataLabelingServiceClient->close(); - * } - * ``` - * - * @param string $name Required. Name of the evaluation job that is going to be paused. Format: - * - * "projects/{project_id}/evaluationJobs/{evaluation_job_id}" - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @throws ApiException if the remote call fails - * - * @experimental - */ - public function pauseEvaluationJob($name, array $optionalArgs = []) - { - $request = new PauseEvaluationJobRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('PauseEvaluationJob', GPBEmpty::class, $optionalArgs, $request)->wait(); - } - - /** - * Resumes a paused evaluation job. A deleted evaluation job can't be resumed. - * Resuming a running or scheduled evaluation job is a no-op. - * - * Sample code: - * ``` - * $dataLabelingServiceClient = new DataLabelingServiceClient(); - * try { - * $formattedName = $dataLabelingServiceClient->evaluationJobName('[PROJECT]', '[EVALUATION_JOB]'); - * $dataLabelingServiceClient->resumeEvaluationJob($formattedName); - * } finally { - * $dataLabelingServiceClient->close(); - * } - * ``` - * - * @param string $name Required. Name of the evaluation job that is going to be resumed. Format: - * - * "projects/{project_id}/evaluationJobs/{evaluation_job_id}" - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @throws ApiException if the remote call fails - * - * @experimental - */ - public function resumeEvaluationJob($name, array $optionalArgs = []) - { - $request = new ResumeEvaluationJobRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('ResumeEvaluationJob', GPBEmpty::class, $optionalArgs, $request)->wait(); - } - - /** - * Searches [evaluations][google.cloud.datalabeling.v1beta1.Evaluation] within a project. - * - * Sample code: - * ``` - * $dataLabelingServiceClient = new DataLabelingServiceClient(); - * try { - * $formattedParent = $dataLabelingServiceClient->evaluationName('[PROJECT]', '[DATASET]', '[EVALUATION]'); - * // Iterate over pages of elements - * $pagedResponse = $dataLabelingServiceClient->searchEvaluations($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $dataLabelingServiceClient->searchEvaluations($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $dataLabelingServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. Evaluation search parent (project ID). Format: - * "projects/{project_id}" - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * Optional. To search evaluations, you can filter by the following: - * - * * evaluation_job.evaluation_job_id (the last part of - * [EvaluationJob.name][google.cloud.datalabeling.v1beta1.EvaluationJob.name]) - * * evaluation_job.model_id (the {model_name} portion - * of [EvaluationJob.modelVersion][google.cloud.datalabeling.v1beta1.EvaluationJob.model_version]) - * * evaluation_job.evaluation_job_run_time_start (Minimum - * threshold for the - * [evaluationJobRunTime][google.cloud.datalabeling.v1beta1.Evaluation.evaluation_job_run_time] that created - * the evaluation) - * * evaluation_job.evaluation_job_run_time_end (Maximum - * threshold for the - * [evaluationJobRunTime][google.cloud.datalabeling.v1beta1.Evaluation.evaluation_job_run_time] that created - * the evaluation) - * * evaluation_job.job_state ([EvaluationJob.state][google.cloud.datalabeling.v1beta1.EvaluationJob.state]) - * * annotation_spec.display_name (the Evaluation contains a - * metric for the annotation spec with this - * [displayName][google.cloud.datalabeling.v1beta1.AnnotationSpec.display_name]) - * - * To filter by multiple critiera, use the `AND` operator or the `OR` - * operator. The following examples shows a string that filters by several - * critiera: - * - * "evaluation_job.evaluation_job_id = - * {evaluation_job_id} AND evaluation_job.model_id = - * {model_name} AND - * evaluation_job.evaluation_job_run_time_start = - * {timestamp_1} AND - * evaluation_job.evaluation_job_run_time_end = - * {timestamp_2} AND annotation_spec.display_name = - * {display_name}" - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - * - * @experimental - */ - public function searchEvaluations($parent, array $optionalArgs = []) - { - $request = new SearchEvaluationsRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('SearchEvaluations', $optionalArgs, SearchEvaluationsResponse::class, $request); - } - - /** - * Searches example comparisons from an evaluation. The return format is a - * list of example comparisons that show ground truth and prediction(s) for - * a single input. Search by providing an evaluation ID. - * - * Sample code: - * ``` - * $dataLabelingServiceClient = new DataLabelingServiceClient(); - * try { - * $formattedParent = $dataLabelingServiceClient->evaluationName('[PROJECT]', '[DATASET]', '[EVALUATION]'); - * // Iterate over pages of elements - * $pagedResponse = $dataLabelingServiceClient->searchExampleComparisons($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $dataLabelingServiceClient->searchExampleComparisons($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $dataLabelingServiceClient->close(); - * } - * ``` - * - * @param string $parent Required. Name of the [Evaluation][google.cloud.datalabeling.v1beta1.Evaluation] resource to search for example - * comparisons from. Format: - * - * "projects/{project_id}/datasets/{dataset_id}/evaluations/{evaluation_id}" - * @param array $optionalArgs { - * Optional. - * - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - * - * @experimental - */ - public function searchExampleComparisons($parent, array $optionalArgs = []) - { - $request = new SearchExampleComparisonsRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('SearchExampleComparisons', $optionalArgs, SearchExampleComparisonsResponse::class, $request); - } - - /** - * Updates an evaluation job. You can only update certain fields of the job's - * [EvaluationJobConfig][google.cloud.datalabeling.v1beta1.EvaluationJobConfig]: `humanAnnotationConfig.instruction`, - * `exampleCount`, and `exampleSamplePercentage`. - * - * If you want to change any other aspect of the evaluation job, you must - * delete the job and create a new one. - * - * Sample code: - * ``` - * $dataLabelingServiceClient = new DataLabelingServiceClient(); - * try { - * $evaluationJob = new EvaluationJob(); - * $response = $dataLabelingServiceClient->updateEvaluationJob($evaluationJob); - * } finally { - * $dataLabelingServiceClient->close(); - * } - * ``` - * - * @param EvaluationJob $evaluationJob Required. Evaluation job that is going to be updated. - * @param array $optionalArgs { - * Optional. - * - * @type FieldMask $updateMask - * Optional. Mask for which fields to update. You can only provide the - * following fields: - * - * * `evaluationJobConfig.humanAnnotationConfig.instruction` - * * `evaluationJobConfig.exampleCount` - * * `evaluationJobConfig.exampleSamplePercentage` - * - * You can provide more than one of these fields by separating them with - * commas. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\DataLabeling\V1beta1\EvaluationJob - * - * @throws ApiException if the remote call fails - * - * @experimental - */ - public function updateEvaluationJob($evaluationJob, array $optionalArgs = []) - { - $request = new UpdateEvaluationJobRequest(); - $requestParamHeaders = []; - $request->setEvaluationJob($evaluationJob); - $requestParamHeaders['evaluation_job.name'] = $evaluationJob->getName(); - if (isset($optionalArgs['updateMask'])) { - $request->setUpdateMask($optionalArgs['updateMask']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('UpdateEvaluationJob', EvaluationJob::class, $optionalArgs, $request)->wait(); - } -} diff --git a/DataLabeling/src/V1beta1/GcsDestination.php b/DataLabeling/src/V1beta1/GcsDestination.php index 68014590cbc1..9492eedb1f10 100644 --- a/DataLabeling/src/V1beta1/GcsDestination.php +++ b/DataLabeling/src/V1beta1/GcsDestination.php @@ -21,7 +21,7 @@ class GcsDestination extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string output_uri = 1; */ - private $output_uri = ''; + protected $output_uri = ''; /** * Required. The format of the gcs destination. Only "text/csv" and * "application/json" @@ -29,7 +29,7 @@ class GcsDestination extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string mime_type = 2; */ - private $mime_type = ''; + protected $mime_type = ''; /** * Constructor. diff --git a/DataLabeling/src/V1beta1/GcsFolderDestination.php b/DataLabeling/src/V1beta1/GcsFolderDestination.php index c197afc26499..1740f911ebfa 100644 --- a/DataLabeling/src/V1beta1/GcsFolderDestination.php +++ b/DataLabeling/src/V1beta1/GcsFolderDestination.php @@ -20,7 +20,7 @@ class GcsFolderDestination extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string output_folder_uri = 1; */ - private $output_folder_uri = ''; + protected $output_folder_uri = ''; /** * Constructor. diff --git a/DataLabeling/src/V1beta1/GcsSource.php b/DataLabeling/src/V1beta1/GcsSource.php index c8254717e4fd..989dacb08315 100644 --- a/DataLabeling/src/V1beta1/GcsSource.php +++ b/DataLabeling/src/V1beta1/GcsSource.php @@ -21,13 +21,13 @@ class GcsSource extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string input_uri = 1; */ - private $input_uri = ''; + protected $input_uri = ''; /** * Required. The format of the source file. Only "text/csv" is supported. * * Generated from protobuf field string mime_type = 2; */ - private $mime_type = ''; + protected $mime_type = ''; /** * Constructor. diff --git a/DataLabeling/src/V1beta1/GetAnnotatedDatasetRequest.php b/DataLabeling/src/V1beta1/GetAnnotatedDatasetRequest.php index 61db39c8958a..ae34125b0d67 100644 --- a/DataLabeling/src/V1beta1/GetAnnotatedDatasetRequest.php +++ b/DataLabeling/src/V1beta1/GetAnnotatedDatasetRequest.php @@ -22,7 +22,7 @@ class GetAnnotatedDatasetRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. Name of the annotated dataset to get, format: diff --git a/DataLabeling/src/V1beta1/GetAnnotationSpecSetRequest.php b/DataLabeling/src/V1beta1/GetAnnotationSpecSetRequest.php index ec888645d6f2..14a3f0e13069 100644 --- a/DataLabeling/src/V1beta1/GetAnnotationSpecSetRequest.php +++ b/DataLabeling/src/V1beta1/GetAnnotationSpecSetRequest.php @@ -21,7 +21,7 @@ class GetAnnotationSpecSetRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. AnnotationSpecSet resource name, format: diff --git a/DataLabeling/src/V1beta1/GetDataItemRequest.php b/DataLabeling/src/V1beta1/GetDataItemRequest.php index 64cf5bed8eee..5e29efb4393c 100644 --- a/DataLabeling/src/V1beta1/GetDataItemRequest.php +++ b/DataLabeling/src/V1beta1/GetDataItemRequest.php @@ -21,7 +21,7 @@ class GetDataItemRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. The name of the data item to get, format: diff --git a/DataLabeling/src/V1beta1/GetDatasetRequest.php b/DataLabeling/src/V1beta1/GetDatasetRequest.php index ce15722e551d..d31d221b435d 100644 --- a/DataLabeling/src/V1beta1/GetDatasetRequest.php +++ b/DataLabeling/src/V1beta1/GetDatasetRequest.php @@ -21,7 +21,7 @@ class GetDatasetRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. Dataset resource name, format: diff --git a/DataLabeling/src/V1beta1/GetEvaluationJobRequest.php b/DataLabeling/src/V1beta1/GetEvaluationJobRequest.php index c8679c91079e..3affe84d1ff3 100644 --- a/DataLabeling/src/V1beta1/GetEvaluationJobRequest.php +++ b/DataLabeling/src/V1beta1/GetEvaluationJobRequest.php @@ -21,7 +21,7 @@ class GetEvaluationJobRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. Name of the evaluation job. Format: diff --git a/DataLabeling/src/V1beta1/GetEvaluationRequest.php b/DataLabeling/src/V1beta1/GetEvaluationRequest.php index fe3dae048735..1c92caa2c03f 100644 --- a/DataLabeling/src/V1beta1/GetEvaluationRequest.php +++ b/DataLabeling/src/V1beta1/GetEvaluationRequest.php @@ -21,7 +21,7 @@ class GetEvaluationRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. Name of the evaluation. Format: diff --git a/DataLabeling/src/V1beta1/GetExampleRequest.php b/DataLabeling/src/V1beta1/GetExampleRequest.php index a501296de8e5..b2a1eea87017 100644 --- a/DataLabeling/src/V1beta1/GetExampleRequest.php +++ b/DataLabeling/src/V1beta1/GetExampleRequest.php @@ -22,7 +22,7 @@ class GetExampleRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * Optional. An expression for filtering Examples. Filter by * annotation_spec.display_name is supported. Format @@ -30,7 +30,7 @@ class GetExampleRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string filter = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $filter = ''; + protected $filter = ''; /** * @param string $name Required. Name of example, format: diff --git a/DataLabeling/src/V1beta1/GetInstructionRequest.php b/DataLabeling/src/V1beta1/GetInstructionRequest.php index 8c69ffdefbb8..8f7c6fe37e13 100644 --- a/DataLabeling/src/V1beta1/GetInstructionRequest.php +++ b/DataLabeling/src/V1beta1/GetInstructionRequest.php @@ -21,7 +21,7 @@ class GetInstructionRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. Instruction resource name, format: diff --git a/DataLabeling/src/V1beta1/HumanAnnotationConfig.php b/DataLabeling/src/V1beta1/HumanAnnotationConfig.php index fd9235dff9af..6adac2ffc2a5 100644 --- a/DataLabeling/src/V1beta1/HumanAnnotationConfig.php +++ b/DataLabeling/src/V1beta1/HumanAnnotationConfig.php @@ -20,7 +20,7 @@ class HumanAnnotationConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string instruction = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $instruction = ''; + protected $instruction = ''; /** * Required. A human-readable name for AnnotatedDataset defined by * users. Maximum of 64 characters @@ -28,21 +28,21 @@ class HumanAnnotationConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string annotated_dataset_display_name = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $annotated_dataset_display_name = ''; + protected $annotated_dataset_display_name = ''; /** * Optional. A human-readable description for AnnotatedDataset. * The description can be up to 10000 characters long. * * Generated from protobuf field string annotated_dataset_description = 3 [(.google.api.field_behavior) = OPTIONAL]; */ - private $annotated_dataset_description = ''; + protected $annotated_dataset_description = ''; /** * Optional. A human-readable label used to logically group labeling tasks. * This string must match the regular expression `[a-zA-Z\\d_-]{0,128}`. * * Generated from protobuf field string label_group = 4 [(.google.api.field_behavior) = OPTIONAL]; */ - private $label_group = ''; + protected $label_group = ''; /** * Optional. The Language of this question, as a * [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt). @@ -52,7 +52,7 @@ class HumanAnnotationConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string language_code = 5 [(.google.api.field_behavior) = OPTIONAL]; */ - private $language_code = ''; + protected $language_code = ''; /** * Optional. Replication of questions. Each question will be sent to up to * this number of contributors to label. Aggregated answers will be returned. @@ -61,14 +61,14 @@ class HumanAnnotationConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 replica_count = 6 [(.google.api.field_behavior) = OPTIONAL]; */ - private $replica_count = 0; + protected $replica_count = 0; /** * Optional. Maximum duration for contributors to answer a question. Maximum * is 3600 seconds. Default is 3600 seconds. * * Generated from protobuf field .google.protobuf.Duration question_duration = 7 [(.google.api.field_behavior) = OPTIONAL]; */ - private $question_duration = null; + protected $question_duration = null; /** * Optional. If you want your own labeling contributors to manage and work on * this labeling request, you can set these contributors here. We will give @@ -85,7 +85,7 @@ class HumanAnnotationConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string user_email_address = 10; */ - private $user_email_address = ''; + protected $user_email_address = ''; /** * Constructor. diff --git a/DataLabeling/src/V1beta1/ImageBoundingPolyAnnotation.php b/DataLabeling/src/V1beta1/ImageBoundingPolyAnnotation.php index e8d02d7322be..9b31588650d8 100644 --- a/DataLabeling/src/V1beta1/ImageBoundingPolyAnnotation.php +++ b/DataLabeling/src/V1beta1/ImageBoundingPolyAnnotation.php @@ -21,7 +21,7 @@ class ImageBoundingPolyAnnotation extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.datalabeling.v1beta1.AnnotationSpec annotation_spec = 1; */ - private $annotation_spec = null; + protected $annotation_spec = null; protected $bounded_area; /** diff --git a/DataLabeling/src/V1beta1/ImageClassificationAnnotation.php b/DataLabeling/src/V1beta1/ImageClassificationAnnotation.php index 2259c5601b6f..522950443eed 100644 --- a/DataLabeling/src/V1beta1/ImageClassificationAnnotation.php +++ b/DataLabeling/src/V1beta1/ImageClassificationAnnotation.php @@ -20,7 +20,7 @@ class ImageClassificationAnnotation extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.datalabeling.v1beta1.AnnotationSpec annotation_spec = 1; */ - private $annotation_spec = null; + protected $annotation_spec = null; /** * Constructor. diff --git a/DataLabeling/src/V1beta1/ImageClassificationConfig.php b/DataLabeling/src/V1beta1/ImageClassificationConfig.php index 95321dc8e1ea..237680137543 100644 --- a/DataLabeling/src/V1beta1/ImageClassificationConfig.php +++ b/DataLabeling/src/V1beta1/ImageClassificationConfig.php @@ -20,20 +20,20 @@ class ImageClassificationConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string annotation_spec_set = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $annotation_spec_set = ''; + protected $annotation_spec_set = ''; /** * Optional. If allow_multi_label is true, contributors are able to choose * multiple labels for one image. * * Generated from protobuf field bool allow_multi_label = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $allow_multi_label = false; + protected $allow_multi_label = false; /** * Optional. The type of how to aggregate answers. * * Generated from protobuf field .google.cloud.datalabeling.v1beta1.StringAggregationType answer_aggregation_type = 3 [(.google.api.field_behavior) = OPTIONAL]; */ - private $answer_aggregation_type = 0; + protected $answer_aggregation_type = 0; /** * Constructor. diff --git a/DataLabeling/src/V1beta1/ImagePayload.php b/DataLabeling/src/V1beta1/ImagePayload.php index 987844de1b73..b26af09c7f2a 100644 --- a/DataLabeling/src/V1beta1/ImagePayload.php +++ b/DataLabeling/src/V1beta1/ImagePayload.php @@ -20,25 +20,25 @@ class ImagePayload extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string mime_type = 1; */ - private $mime_type = ''; + protected $mime_type = ''; /** * A byte string of a thumbnail image. * * Generated from protobuf field bytes image_thumbnail = 2; */ - private $image_thumbnail = ''; + protected $image_thumbnail = ''; /** * Image uri from the user bucket. * * Generated from protobuf field string image_uri = 3; */ - private $image_uri = ''; + protected $image_uri = ''; /** * Signed uri of the image file in the service bucket. * * Generated from protobuf field string signed_uri = 4; */ - private $signed_uri = ''; + protected $signed_uri = ''; /** * Constructor. diff --git a/DataLabeling/src/V1beta1/ImagePolylineAnnotation.php b/DataLabeling/src/V1beta1/ImagePolylineAnnotation.php index 6f4fdbd42226..774e2c8b6216 100644 --- a/DataLabeling/src/V1beta1/ImagePolylineAnnotation.php +++ b/DataLabeling/src/V1beta1/ImagePolylineAnnotation.php @@ -20,7 +20,7 @@ class ImagePolylineAnnotation extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.datalabeling.v1beta1.AnnotationSpec annotation_spec = 1; */ - private $annotation_spec = null; + protected $annotation_spec = null; protected $poly; /** diff --git a/DataLabeling/src/V1beta1/ImageSegmentationAnnotation.php b/DataLabeling/src/V1beta1/ImageSegmentationAnnotation.php index eaa7308fe590..4e315d173fb5 100644 --- a/DataLabeling/src/V1beta1/ImageSegmentationAnnotation.php +++ b/DataLabeling/src/V1beta1/ImageSegmentationAnnotation.php @@ -28,13 +28,13 @@ class ImageSegmentationAnnotation extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string mime_type = 2; */ - private $mime_type = ''; + protected $mime_type = ''; /** * A byte string of a full image's color map. * * Generated from protobuf field bytes image_bytes = 3; */ - private $image_bytes = ''; + protected $image_bytes = ''; /** * Constructor. diff --git a/DataLabeling/src/V1beta1/ImportDataOperationMetadata.php b/DataLabeling/src/V1beta1/ImportDataOperationMetadata.php index 8637d0bc86c5..663673ebe19d 100644 --- a/DataLabeling/src/V1beta1/ImportDataOperationMetadata.php +++ b/DataLabeling/src/V1beta1/ImportDataOperationMetadata.php @@ -21,7 +21,7 @@ class ImportDataOperationMetadata extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string dataset = 1; */ - private $dataset = ''; + protected $dataset = ''; /** * Output only. Partial failures encountered. * E.g. single files that couldn't be read. @@ -35,7 +35,7 @@ class ImportDataOperationMetadata extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Timestamp create_time = 3; */ - private $create_time = null; + protected $create_time = null; /** * Constructor. diff --git a/DataLabeling/src/V1beta1/ImportDataOperationResponse.php b/DataLabeling/src/V1beta1/ImportDataOperationResponse.php index 1ec7b92f2a1a..06562e94e114 100644 --- a/DataLabeling/src/V1beta1/ImportDataOperationResponse.php +++ b/DataLabeling/src/V1beta1/ImportDataOperationResponse.php @@ -20,19 +20,19 @@ class ImportDataOperationResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string dataset = 1; */ - private $dataset = ''; + protected $dataset = ''; /** * Output only. Total number of examples requested to import * * Generated from protobuf field int32 total_count = 2; */ - private $total_count = 0; + protected $total_count = 0; /** * Output only. Number of examples imported successfully. * * Generated from protobuf field int32 import_count = 3; */ - private $import_count = 0; + protected $import_count = 0; /** * Constructor. diff --git a/DataLabeling/src/V1beta1/ImportDataRequest.php b/DataLabeling/src/V1beta1/ImportDataRequest.php index e111bf578aec..8669a9519411 100644 --- a/DataLabeling/src/V1beta1/ImportDataRequest.php +++ b/DataLabeling/src/V1beta1/ImportDataRequest.php @@ -21,20 +21,20 @@ class ImportDataRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * Required. Specify the input source of the data. * * Generated from protobuf field .google.cloud.datalabeling.v1beta1.InputConfig input_config = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $input_config = null; + protected $input_config = null; /** * Email of the user who started the import task and should be notified by * email. If empty no notification will be sent. * * Generated from protobuf field string user_email_address = 3; */ - private $user_email_address = ''; + protected $user_email_address = ''; /** * @param string $name Required. Dataset resource name, format: diff --git a/DataLabeling/src/V1beta1/InputConfig.php b/DataLabeling/src/V1beta1/InputConfig.php index 7992eeda7946..8c94000e9540 100644 --- a/DataLabeling/src/V1beta1/InputConfig.php +++ b/DataLabeling/src/V1beta1/InputConfig.php @@ -20,7 +20,7 @@ class InputConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.datalabeling.v1beta1.DataType data_type = 1; */ - private $data_type = 0; + protected $data_type = 0; /** * Optional. The type of annotation to be performed on this data. You must * specify this field if you are using this InputConfig in an @@ -28,7 +28,7 @@ class InputConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.datalabeling.v1beta1.AnnotationType annotation_type = 3; */ - private $annotation_type = 0; + protected $annotation_type = 0; /** * Optional. Metadata about annotations for the input. You must specify this * field if you are using this InputConfig in an [EvaluationJob][google.cloud.datalabeling.v1beta1.EvaluationJob] for a @@ -36,7 +36,7 @@ class InputConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.datalabeling.v1beta1.ClassificationMetadata classification_metadata = 4; */ - private $classification_metadata = null; + protected $classification_metadata = null; protected $data_type_metadata; protected $source; diff --git a/DataLabeling/src/V1beta1/Instruction.php b/DataLabeling/src/V1beta1/Instruction.php index 31c340697047..39c27cfa7b13 100644 --- a/DataLabeling/src/V1beta1/Instruction.php +++ b/DataLabeling/src/V1beta1/Instruction.php @@ -22,38 +22,38 @@ class Instruction extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1; */ - private $name = ''; + protected $name = ''; /** * Required. The display name of the instruction. Maximum of 64 characters. * * Generated from protobuf field string display_name = 2; */ - private $display_name = ''; + protected $display_name = ''; /** * Optional. User-provided description of the instruction. * The description can be up to 10000 characters long. * * Generated from protobuf field string description = 3; */ - private $description = ''; + protected $description = ''; /** * Output only. Creation time of instruction. * * Generated from protobuf field .google.protobuf.Timestamp create_time = 4; */ - private $create_time = null; + protected $create_time = null; /** * Output only. Last update time of instruction. * * Generated from protobuf field .google.protobuf.Timestamp update_time = 5; */ - private $update_time = null; + protected $update_time = null; /** * Required. The data type of this instruction. * * Generated from protobuf field .google.cloud.datalabeling.v1beta1.DataType data_type = 6; */ - private $data_type = 0; + protected $data_type = 0; /** * Deprecated: this instruction format is not supported any more. * Instruction from a CSV file, such as for classification task. @@ -71,7 +71,7 @@ class Instruction extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.datalabeling.v1beta1.PdfInstruction pdf_instruction = 9; */ - private $pdf_instruction = null; + protected $pdf_instruction = null; /** * Output only. The names of any related resources that are blocking changes * to the instruction. diff --git a/DataLabeling/src/V1beta1/LabelImageBoundingBoxOperationMetadata.php b/DataLabeling/src/V1beta1/LabelImageBoundingBoxOperationMetadata.php index d78eb3320ce2..0e78b9d73bec 100644 --- a/DataLabeling/src/V1beta1/LabelImageBoundingBoxOperationMetadata.php +++ b/DataLabeling/src/V1beta1/LabelImageBoundingBoxOperationMetadata.php @@ -20,7 +20,7 @@ class LabelImageBoundingBoxOperationMetadata extends \Google\Protobuf\Internal\M * * Generated from protobuf field .google.cloud.datalabeling.v1beta1.HumanAnnotationConfig basic_config = 1; */ - private $basic_config = null; + protected $basic_config = null; /** * Constructor. diff --git a/DataLabeling/src/V1beta1/LabelImageBoundingPolyOperationMetadata.php b/DataLabeling/src/V1beta1/LabelImageBoundingPolyOperationMetadata.php index f443edfc25b1..d768199bbbf8 100644 --- a/DataLabeling/src/V1beta1/LabelImageBoundingPolyOperationMetadata.php +++ b/DataLabeling/src/V1beta1/LabelImageBoundingPolyOperationMetadata.php @@ -20,7 +20,7 @@ class LabelImageBoundingPolyOperationMetadata extends \Google\Protobuf\Internal\ * * Generated from protobuf field .google.cloud.datalabeling.v1beta1.HumanAnnotationConfig basic_config = 1; */ - private $basic_config = null; + protected $basic_config = null; /** * Constructor. diff --git a/DataLabeling/src/V1beta1/LabelImageClassificationOperationMetadata.php b/DataLabeling/src/V1beta1/LabelImageClassificationOperationMetadata.php index ef04a42cdc8f..34e50c9b6f44 100644 --- a/DataLabeling/src/V1beta1/LabelImageClassificationOperationMetadata.php +++ b/DataLabeling/src/V1beta1/LabelImageClassificationOperationMetadata.php @@ -20,7 +20,7 @@ class LabelImageClassificationOperationMetadata extends \Google\Protobuf\Interna * * Generated from protobuf field .google.cloud.datalabeling.v1beta1.HumanAnnotationConfig basic_config = 1; */ - private $basic_config = null; + protected $basic_config = null; /** * Constructor. diff --git a/DataLabeling/src/V1beta1/LabelImageOrientedBoundingBoxOperationMetadata.php b/DataLabeling/src/V1beta1/LabelImageOrientedBoundingBoxOperationMetadata.php index b8b0b24e0850..97eca6c0568c 100644 --- a/DataLabeling/src/V1beta1/LabelImageOrientedBoundingBoxOperationMetadata.php +++ b/DataLabeling/src/V1beta1/LabelImageOrientedBoundingBoxOperationMetadata.php @@ -20,7 +20,7 @@ class LabelImageOrientedBoundingBoxOperationMetadata extends \Google\Protobuf\In * * Generated from protobuf field .google.cloud.datalabeling.v1beta1.HumanAnnotationConfig basic_config = 1; */ - private $basic_config = null; + protected $basic_config = null; /** * Constructor. diff --git a/DataLabeling/src/V1beta1/LabelImagePolylineOperationMetadata.php b/DataLabeling/src/V1beta1/LabelImagePolylineOperationMetadata.php index 3b7b590be816..4d13edfb5ffb 100644 --- a/DataLabeling/src/V1beta1/LabelImagePolylineOperationMetadata.php +++ b/DataLabeling/src/V1beta1/LabelImagePolylineOperationMetadata.php @@ -20,7 +20,7 @@ class LabelImagePolylineOperationMetadata extends \Google\Protobuf\Internal\Mess * * Generated from protobuf field .google.cloud.datalabeling.v1beta1.HumanAnnotationConfig basic_config = 1; */ - private $basic_config = null; + protected $basic_config = null; /** * Constructor. diff --git a/DataLabeling/src/V1beta1/LabelImageRequest.php b/DataLabeling/src/V1beta1/LabelImageRequest.php index e71b0dad1785..23de606b7732 100644 --- a/DataLabeling/src/V1beta1/LabelImageRequest.php +++ b/DataLabeling/src/V1beta1/LabelImageRequest.php @@ -21,19 +21,19 @@ class LabelImageRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Required. Basic human annotation config. * * Generated from protobuf field .google.cloud.datalabeling.v1beta1.HumanAnnotationConfig basic_config = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $basic_config = null; + protected $basic_config = null; /** * Required. The type of image labeling task. * * Generated from protobuf field .google.cloud.datalabeling.v1beta1.LabelImageRequest.Feature feature = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $feature = 0; + protected $feature = 0; protected $request_config; /** diff --git a/DataLabeling/src/V1beta1/LabelImageRequest/Feature.php b/DataLabeling/src/V1beta1/LabelImageRequest/Feature.php index 7b9821bc9357..a416fc7732d4 100644 --- a/DataLabeling/src/V1beta1/LabelImageRequest/Feature.php +++ b/DataLabeling/src/V1beta1/LabelImageRequest/Feature.php @@ -89,6 +89,4 @@ public static function value($name) } } -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(Feature::class, \Google\Cloud\DataLabeling\V1beta1\LabelImageRequest_Feature::class); diff --git a/DataLabeling/src/V1beta1/LabelImageRequest_Feature.php b/DataLabeling/src/V1beta1/LabelImageRequest_Feature.php deleted file mode 100644 index 4e6d877137c5..000000000000 --- a/DataLabeling/src/V1beta1/LabelImageRequest_Feature.php +++ /dev/null @@ -1,16 +0,0 @@ -.google.cloud.datalabeling.v1beta1.HumanAnnotationConfig basic_config = 1; */ - private $basic_config = null; + protected $basic_config = null; /** * Constructor. diff --git a/DataLabeling/src/V1beta1/LabelOperationMetadata.php b/DataLabeling/src/V1beta1/LabelOperationMetadata.php index 48d01237353f..df4e7ab3acab 100644 --- a/DataLabeling/src/V1beta1/LabelOperationMetadata.php +++ b/DataLabeling/src/V1beta1/LabelOperationMetadata.php @@ -21,7 +21,7 @@ class LabelOperationMetadata extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 progress_percent = 1; */ - private $progress_percent = 0; + protected $progress_percent = 0; /** * Output only. Partial failures encountered. * E.g. single files that couldn't be read. @@ -35,7 +35,7 @@ class LabelOperationMetadata extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Timestamp create_time = 16; */ - private $create_time = null; + protected $create_time = null; protected $details; /** diff --git a/DataLabeling/src/V1beta1/LabelTextClassificationOperationMetadata.php b/DataLabeling/src/V1beta1/LabelTextClassificationOperationMetadata.php index 0337f0bea9ca..36f1556cfc3a 100644 --- a/DataLabeling/src/V1beta1/LabelTextClassificationOperationMetadata.php +++ b/DataLabeling/src/V1beta1/LabelTextClassificationOperationMetadata.php @@ -20,7 +20,7 @@ class LabelTextClassificationOperationMetadata extends \Google\Protobuf\Internal * * Generated from protobuf field .google.cloud.datalabeling.v1beta1.HumanAnnotationConfig basic_config = 1; */ - private $basic_config = null; + protected $basic_config = null; /** * Constructor. diff --git a/DataLabeling/src/V1beta1/LabelTextEntityExtractionOperationMetadata.php b/DataLabeling/src/V1beta1/LabelTextEntityExtractionOperationMetadata.php index bed8d87bce1f..70571a3bc30d 100644 --- a/DataLabeling/src/V1beta1/LabelTextEntityExtractionOperationMetadata.php +++ b/DataLabeling/src/V1beta1/LabelTextEntityExtractionOperationMetadata.php @@ -20,7 +20,7 @@ class LabelTextEntityExtractionOperationMetadata extends \Google\Protobuf\Intern * * Generated from protobuf field .google.cloud.datalabeling.v1beta1.HumanAnnotationConfig basic_config = 1; */ - private $basic_config = null; + protected $basic_config = null; /** * Constructor. diff --git a/DataLabeling/src/V1beta1/LabelTextRequest.php b/DataLabeling/src/V1beta1/LabelTextRequest.php index 92f90b20b48b..92f1569ba63c 100644 --- a/DataLabeling/src/V1beta1/LabelTextRequest.php +++ b/DataLabeling/src/V1beta1/LabelTextRequest.php @@ -21,19 +21,19 @@ class LabelTextRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Required. Basic human annotation config. * * Generated from protobuf field .google.cloud.datalabeling.v1beta1.HumanAnnotationConfig basic_config = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $basic_config = null; + protected $basic_config = null; /** * Required. The type of text labeling task. * * Generated from protobuf field .google.cloud.datalabeling.v1beta1.LabelTextRequest.Feature feature = 6 [(.google.api.field_behavior) = REQUIRED]; */ - private $feature = 0; + protected $feature = 0; protected $request_config; /** diff --git a/DataLabeling/src/V1beta1/LabelTextRequest/Feature.php b/DataLabeling/src/V1beta1/LabelTextRequest/Feature.php index 2673ca332fa7..0ca7226a3c1e 100644 --- a/DataLabeling/src/V1beta1/LabelTextRequest/Feature.php +++ b/DataLabeling/src/V1beta1/LabelTextRequest/Feature.php @@ -57,6 +57,4 @@ public static function value($name) } } -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(Feature::class, \Google\Cloud\DataLabeling\V1beta1\LabelTextRequest_Feature::class); diff --git a/DataLabeling/src/V1beta1/LabelTextRequest_Feature.php b/DataLabeling/src/V1beta1/LabelTextRequest_Feature.php deleted file mode 100644 index 68488ba8dde9..000000000000 --- a/DataLabeling/src/V1beta1/LabelTextRequest_Feature.php +++ /dev/null @@ -1,16 +0,0 @@ -.google.cloud.datalabeling.v1beta1.HumanAnnotationConfig basic_config = 1; */ - private $basic_config = null; + protected $basic_config = null; /** * Constructor. diff --git a/DataLabeling/src/V1beta1/LabelVideoEventOperationMetadata.php b/DataLabeling/src/V1beta1/LabelVideoEventOperationMetadata.php index 6e95da0b9b97..021d458b0a72 100644 --- a/DataLabeling/src/V1beta1/LabelVideoEventOperationMetadata.php +++ b/DataLabeling/src/V1beta1/LabelVideoEventOperationMetadata.php @@ -20,7 +20,7 @@ class LabelVideoEventOperationMetadata extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.datalabeling.v1beta1.HumanAnnotationConfig basic_config = 1; */ - private $basic_config = null; + protected $basic_config = null; /** * Constructor. diff --git a/DataLabeling/src/V1beta1/LabelVideoObjectDetectionOperationMetadata.php b/DataLabeling/src/V1beta1/LabelVideoObjectDetectionOperationMetadata.php index d4ced8a4d507..3608a847bff9 100644 --- a/DataLabeling/src/V1beta1/LabelVideoObjectDetectionOperationMetadata.php +++ b/DataLabeling/src/V1beta1/LabelVideoObjectDetectionOperationMetadata.php @@ -20,7 +20,7 @@ class LabelVideoObjectDetectionOperationMetadata extends \Google\Protobuf\Intern * * Generated from protobuf field .google.cloud.datalabeling.v1beta1.HumanAnnotationConfig basic_config = 1; */ - private $basic_config = null; + protected $basic_config = null; /** * Constructor. diff --git a/DataLabeling/src/V1beta1/LabelVideoObjectTrackingOperationMetadata.php b/DataLabeling/src/V1beta1/LabelVideoObjectTrackingOperationMetadata.php index 4046b1852078..67617479a63c 100644 --- a/DataLabeling/src/V1beta1/LabelVideoObjectTrackingOperationMetadata.php +++ b/DataLabeling/src/V1beta1/LabelVideoObjectTrackingOperationMetadata.php @@ -20,7 +20,7 @@ class LabelVideoObjectTrackingOperationMetadata extends \Google\Protobuf\Interna * * Generated from protobuf field .google.cloud.datalabeling.v1beta1.HumanAnnotationConfig basic_config = 1; */ - private $basic_config = null; + protected $basic_config = null; /** * Constructor. diff --git a/DataLabeling/src/V1beta1/LabelVideoRequest.php b/DataLabeling/src/V1beta1/LabelVideoRequest.php index 79aca15869e1..463b290b7125 100644 --- a/DataLabeling/src/V1beta1/LabelVideoRequest.php +++ b/DataLabeling/src/V1beta1/LabelVideoRequest.php @@ -21,19 +21,19 @@ class LabelVideoRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Required. Basic human annotation config. * * Generated from protobuf field .google.cloud.datalabeling.v1beta1.HumanAnnotationConfig basic_config = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $basic_config = null; + protected $basic_config = null; /** * Required. The type of video labeling task. * * Generated from protobuf field .google.cloud.datalabeling.v1beta1.LabelVideoRequest.Feature feature = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $feature = 0; + protected $feature = 0; protected $request_config; /** diff --git a/DataLabeling/src/V1beta1/LabelVideoRequest/Feature.php b/DataLabeling/src/V1beta1/LabelVideoRequest/Feature.php index c112694561a8..82605ffcecb7 100644 --- a/DataLabeling/src/V1beta1/LabelVideoRequest/Feature.php +++ b/DataLabeling/src/V1beta1/LabelVideoRequest/Feature.php @@ -71,6 +71,4 @@ public static function value($name) } } -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(Feature::class, \Google\Cloud\DataLabeling\V1beta1\LabelVideoRequest_Feature::class); diff --git a/DataLabeling/src/V1beta1/LabelVideoRequest_Feature.php b/DataLabeling/src/V1beta1/LabelVideoRequest_Feature.php deleted file mode 100644 index 5f4a9ca9a61b..000000000000 --- a/DataLabeling/src/V1beta1/LabelVideoRequest_Feature.php +++ /dev/null @@ -1,16 +0,0 @@ -string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Optional. Filter is not supported at this moment. * * Generated from protobuf field string filter = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $filter = ''; + protected $filter = ''; /** * Optional. Requested page size. Server may return fewer results than * requested. Default value is 100. * * Generated from protobuf field int32 page_size = 3 [(.google.api.field_behavior) = OPTIONAL]; */ - private $page_size = 0; + protected $page_size = 0; /** * Optional. A token identifying a page of results for the server to return. * Typically obtained by @@ -44,7 +44,7 @@ class ListAnnotatedDatasetsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string page_token = 4 [(.google.api.field_behavior) = OPTIONAL]; */ - private $page_token = ''; + protected $page_token = ''; /** * @param string $parent Required. Name of the dataset to list annotated datasets, format: diff --git a/DataLabeling/src/V1beta1/ListAnnotatedDatasetsResponse.php b/DataLabeling/src/V1beta1/ListAnnotatedDatasetsResponse.php index cff1717e4d22..365a1b31a552 100644 --- a/DataLabeling/src/V1beta1/ListAnnotatedDatasetsResponse.php +++ b/DataLabeling/src/V1beta1/ListAnnotatedDatasetsResponse.php @@ -26,7 +26,7 @@ class ListAnnotatedDatasetsResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Constructor. diff --git a/DataLabeling/src/V1beta1/ListAnnotationSpecSetsRequest.php b/DataLabeling/src/V1beta1/ListAnnotationSpecSetsRequest.php index b4f725d4597c..5b5ff8a089a9 100644 --- a/DataLabeling/src/V1beta1/ListAnnotationSpecSetsRequest.php +++ b/DataLabeling/src/V1beta1/ListAnnotationSpecSetsRequest.php @@ -21,20 +21,20 @@ class ListAnnotationSpecSetsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Optional. Filter is not supported at this moment. * * Generated from protobuf field string filter = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $filter = ''; + protected $filter = ''; /** * Optional. Requested page size. Server may return fewer results than * requested. Default value is 100. * * Generated from protobuf field int32 page_size = 3 [(.google.api.field_behavior) = OPTIONAL]; */ - private $page_size = 0; + protected $page_size = 0; /** * Optional. A token identifying a page of results for the server to return. * Typically obtained by @@ -44,7 +44,7 @@ class ListAnnotationSpecSetsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string page_token = 4 [(.google.api.field_behavior) = OPTIONAL]; */ - private $page_token = ''; + protected $page_token = ''; /** * @param string $parent Required. Parent of AnnotationSpecSet resource, format: diff --git a/DataLabeling/src/V1beta1/ListAnnotationSpecSetsResponse.php b/DataLabeling/src/V1beta1/ListAnnotationSpecSetsResponse.php index d8432b1cbcf3..64910e94073a 100644 --- a/DataLabeling/src/V1beta1/ListAnnotationSpecSetsResponse.php +++ b/DataLabeling/src/V1beta1/ListAnnotationSpecSetsResponse.php @@ -26,7 +26,7 @@ class ListAnnotationSpecSetsResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Constructor. diff --git a/DataLabeling/src/V1beta1/ListDataItemsRequest.php b/DataLabeling/src/V1beta1/ListDataItemsRequest.php index f6391306e38b..039ad64d9bdd 100644 --- a/DataLabeling/src/V1beta1/ListDataItemsRequest.php +++ b/DataLabeling/src/V1beta1/ListDataItemsRequest.php @@ -21,20 +21,20 @@ class ListDataItemsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Optional. Filter is not supported at this moment. * * Generated from protobuf field string filter = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $filter = ''; + protected $filter = ''; /** * Optional. Requested page size. Server may return fewer results than * requested. Default value is 100. * * Generated from protobuf field int32 page_size = 3 [(.google.api.field_behavior) = OPTIONAL]; */ - private $page_size = 0; + protected $page_size = 0; /** * Optional. A token identifying a page of results for the server to return. * Typically obtained by @@ -44,7 +44,7 @@ class ListDataItemsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string page_token = 4 [(.google.api.field_behavior) = OPTIONAL]; */ - private $page_token = ''; + protected $page_token = ''; /** * @param string $parent Required. Name of the dataset to list data items, format: diff --git a/DataLabeling/src/V1beta1/ListDataItemsResponse.php b/DataLabeling/src/V1beta1/ListDataItemsResponse.php index 9b9f30f42534..a7d70de7f57e 100644 --- a/DataLabeling/src/V1beta1/ListDataItemsResponse.php +++ b/DataLabeling/src/V1beta1/ListDataItemsResponse.php @@ -26,7 +26,7 @@ class ListDataItemsResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Constructor. diff --git a/DataLabeling/src/V1beta1/ListDatasetsRequest.php b/DataLabeling/src/V1beta1/ListDatasetsRequest.php index e24e98eba5a2..dd83c03f1a91 100644 --- a/DataLabeling/src/V1beta1/ListDatasetsRequest.php +++ b/DataLabeling/src/V1beta1/ListDatasetsRequest.php @@ -21,20 +21,20 @@ class ListDatasetsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Optional. Filter on dataset is not supported at this moment. * * Generated from protobuf field string filter = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $filter = ''; + protected $filter = ''; /** * Optional. Requested page size. Server may return fewer results than * requested. Default value is 100. * * Generated from protobuf field int32 page_size = 3 [(.google.api.field_behavior) = OPTIONAL]; */ - private $page_size = 0; + protected $page_size = 0; /** * Optional. A token identifying a page of results for the server to return. * Typically obtained by @@ -44,7 +44,7 @@ class ListDatasetsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string page_token = 4 [(.google.api.field_behavior) = OPTIONAL]; */ - private $page_token = ''; + protected $page_token = ''; /** * @param string $parent Required. Dataset resource parent, format: diff --git a/DataLabeling/src/V1beta1/ListDatasetsResponse.php b/DataLabeling/src/V1beta1/ListDatasetsResponse.php index bc1193ea36b5..0b639265609d 100644 --- a/DataLabeling/src/V1beta1/ListDatasetsResponse.php +++ b/DataLabeling/src/V1beta1/ListDatasetsResponse.php @@ -26,7 +26,7 @@ class ListDatasetsResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Constructor. diff --git a/DataLabeling/src/V1beta1/ListEvaluationJobsRequest.php b/DataLabeling/src/V1beta1/ListEvaluationJobsRequest.php index 7d9f4727cc78..c2c6dc22971a 100644 --- a/DataLabeling/src/V1beta1/ListEvaluationJobsRequest.php +++ b/DataLabeling/src/V1beta1/ListEvaluationJobsRequest.php @@ -21,7 +21,7 @@ class ListEvaluationJobsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Optional. You can filter the jobs to list by model_id (also known as * model_name, as described in @@ -34,14 +34,14 @@ class ListEvaluationJobsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string filter = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $filter = ''; + protected $filter = ''; /** * Optional. Requested page size. Server may return fewer results than * requested. Default value is 100. * * Generated from protobuf field int32 page_size = 3 [(.google.api.field_behavior) = OPTIONAL]; */ - private $page_size = 0; + protected $page_size = 0; /** * Optional. A token identifying a page of results for the server to return. * Typically obtained by the @@ -51,7 +51,7 @@ class ListEvaluationJobsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string page_token = 4 [(.google.api.field_behavior) = OPTIONAL]; */ - private $page_token = ''; + protected $page_token = ''; /** * @param string $parent Required. Evaluation job resource parent. Format: diff --git a/DataLabeling/src/V1beta1/ListEvaluationJobsResponse.php b/DataLabeling/src/V1beta1/ListEvaluationJobsResponse.php index a03880e58bd2..f03b54c026f4 100644 --- a/DataLabeling/src/V1beta1/ListEvaluationJobsResponse.php +++ b/DataLabeling/src/V1beta1/ListEvaluationJobsResponse.php @@ -26,7 +26,7 @@ class ListEvaluationJobsResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Constructor. diff --git a/DataLabeling/src/V1beta1/ListExamplesRequest.php b/DataLabeling/src/V1beta1/ListExamplesRequest.php index 72dde00bf404..5f25583a9ba2 100644 --- a/DataLabeling/src/V1beta1/ListExamplesRequest.php +++ b/DataLabeling/src/V1beta1/ListExamplesRequest.php @@ -20,7 +20,7 @@ class ListExamplesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Optional. An expression for filtering Examples. For annotated datasets that * have annotation spec set, filter by @@ -29,14 +29,14 @@ class ListExamplesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string filter = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $filter = ''; + protected $filter = ''; /** * Optional. Requested page size. Server may return fewer results than * requested. Default value is 100. * * Generated from protobuf field int32 page_size = 3 [(.google.api.field_behavior) = OPTIONAL]; */ - private $page_size = 0; + protected $page_size = 0; /** * Optional. A token identifying a page of results for the server to return. * Typically obtained by @@ -46,7 +46,7 @@ class ListExamplesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string page_token = 4 [(.google.api.field_behavior) = OPTIONAL]; */ - private $page_token = ''; + protected $page_token = ''; /** * @param string $parent Required. Example resource parent. Please see diff --git a/DataLabeling/src/V1beta1/ListExamplesResponse.php b/DataLabeling/src/V1beta1/ListExamplesResponse.php index 3982004ed105..0ed6324a41e2 100644 --- a/DataLabeling/src/V1beta1/ListExamplesResponse.php +++ b/DataLabeling/src/V1beta1/ListExamplesResponse.php @@ -26,7 +26,7 @@ class ListExamplesResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Constructor. diff --git a/DataLabeling/src/V1beta1/ListInstructionsRequest.php b/DataLabeling/src/V1beta1/ListInstructionsRequest.php index 3e8cdaf25252..63b65035385c 100644 --- a/DataLabeling/src/V1beta1/ListInstructionsRequest.php +++ b/DataLabeling/src/V1beta1/ListInstructionsRequest.php @@ -21,20 +21,20 @@ class ListInstructionsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Optional. Filter is not supported at this moment. * * Generated from protobuf field string filter = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $filter = ''; + protected $filter = ''; /** * Optional. Requested page size. Server may return fewer results than * requested. Default value is 100. * * Generated from protobuf field int32 page_size = 3 [(.google.api.field_behavior) = OPTIONAL]; */ - private $page_size = 0; + protected $page_size = 0; /** * Optional. A token identifying a page of results for the server to return. * Typically obtained by @@ -44,7 +44,7 @@ class ListInstructionsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string page_token = 4 [(.google.api.field_behavior) = OPTIONAL]; */ - private $page_token = ''; + protected $page_token = ''; /** * @param string $parent Required. Instruction resource parent, format: diff --git a/DataLabeling/src/V1beta1/ListInstructionsResponse.php b/DataLabeling/src/V1beta1/ListInstructionsResponse.php index 39527081aa88..46de5977d03c 100644 --- a/DataLabeling/src/V1beta1/ListInstructionsResponse.php +++ b/DataLabeling/src/V1beta1/ListInstructionsResponse.php @@ -26,7 +26,7 @@ class ListInstructionsResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Constructor. diff --git a/DataLabeling/src/V1beta1/NormalizedVertex.php b/DataLabeling/src/V1beta1/NormalizedVertex.php index 431a61392507..c2b51a63958b 100644 --- a/DataLabeling/src/V1beta1/NormalizedVertex.php +++ b/DataLabeling/src/V1beta1/NormalizedVertex.php @@ -22,13 +22,13 @@ class NormalizedVertex extends \Google\Protobuf\Internal\Message * * Generated from protobuf field float x = 1; */ - private $x = 0.0; + protected $x = 0.0; /** * Y coordinate. * * Generated from protobuf field float y = 2; */ - private $y = 0.0; + protected $y = 0.0; /** * Constructor. diff --git a/DataLabeling/src/V1beta1/ObjectDetectionConfig.php b/DataLabeling/src/V1beta1/ObjectDetectionConfig.php index 9975ad78bdc5..d09dfe597d33 100644 --- a/DataLabeling/src/V1beta1/ObjectDetectionConfig.php +++ b/DataLabeling/src/V1beta1/ObjectDetectionConfig.php @@ -24,13 +24,13 @@ class ObjectDetectionConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string annotation_spec_set = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $annotation_spec_set = ''; + protected $annotation_spec_set = ''; /** * Required. Number of frames per second to be extracted from the video. * * Generated from protobuf field double extraction_frame_rate = 3 [(.google.api.field_behavior) = REQUIRED]; */ - private $extraction_frame_rate = 0.0; + protected $extraction_frame_rate = 0.0; /** * Constructor. diff --git a/DataLabeling/src/V1beta1/ObjectDetectionMetrics.php b/DataLabeling/src/V1beta1/ObjectDetectionMetrics.php index 7187f7c2dfa0..b3c7e5f320a7 100644 --- a/DataLabeling/src/V1beta1/ObjectDetectionMetrics.php +++ b/DataLabeling/src/V1beta1/ObjectDetectionMetrics.php @@ -20,7 +20,7 @@ class ObjectDetectionMetrics extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.datalabeling.v1beta1.PrCurve pr_curve = 1; */ - private $pr_curve = null; + protected $pr_curve = null; /** * Constructor. diff --git a/DataLabeling/src/V1beta1/ObjectTrackingConfig.php b/DataLabeling/src/V1beta1/ObjectTrackingConfig.php index 7432b2ccac02..84d141c49154 100644 --- a/DataLabeling/src/V1beta1/ObjectTrackingConfig.php +++ b/DataLabeling/src/V1beta1/ObjectTrackingConfig.php @@ -20,7 +20,7 @@ class ObjectTrackingConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string annotation_spec_set = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $annotation_spec_set = ''; + protected $annotation_spec_set = ''; /** * Constructor. diff --git a/DataLabeling/src/V1beta1/ObjectTrackingFrame.php b/DataLabeling/src/V1beta1/ObjectTrackingFrame.php index 10711671ba93..3aa041cdfcde 100644 --- a/DataLabeling/src/V1beta1/ObjectTrackingFrame.php +++ b/DataLabeling/src/V1beta1/ObjectTrackingFrame.php @@ -20,7 +20,7 @@ class ObjectTrackingFrame extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Duration time_offset = 3; */ - private $time_offset = null; + protected $time_offset = null; protected $bounded_area; /** diff --git a/DataLabeling/src/V1beta1/OperatorMetadata.php b/DataLabeling/src/V1beta1/OperatorMetadata.php index 6239eca7b51d..4b7b47da33fd 100644 --- a/DataLabeling/src/V1beta1/OperatorMetadata.php +++ b/DataLabeling/src/V1beta1/OperatorMetadata.php @@ -22,19 +22,19 @@ class OperatorMetadata extends \Google\Protobuf\Internal\Message * * Generated from protobuf field float score = 1; */ - private $score = 0.0; + protected $score = 0.0; /** * The total number of contributors that answer this question. * * Generated from protobuf field int32 total_votes = 2; */ - private $total_votes = 0; + protected $total_votes = 0; /** * The total number of contributors that choose this label. * * Generated from protobuf field int32 label_votes = 3; */ - private $label_votes = 0; + protected $label_votes = 0; /** * Comments from contributors. * diff --git a/DataLabeling/src/V1beta1/PauseEvaluationJobRequest.php b/DataLabeling/src/V1beta1/PauseEvaluationJobRequest.php index e4b220b443d0..6f325f975b43 100644 --- a/DataLabeling/src/V1beta1/PauseEvaluationJobRequest.php +++ b/DataLabeling/src/V1beta1/PauseEvaluationJobRequest.php @@ -21,7 +21,7 @@ class PauseEvaluationJobRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. Name of the evaluation job that is going to be paused. Format: diff --git a/DataLabeling/src/V1beta1/PdfInstruction.php b/DataLabeling/src/V1beta1/PdfInstruction.php index 444f2b5d5509..00bb0aca31d0 100644 --- a/DataLabeling/src/V1beta1/PdfInstruction.php +++ b/DataLabeling/src/V1beta1/PdfInstruction.php @@ -20,7 +20,7 @@ class PdfInstruction extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string gcs_file_uri = 1; */ - private $gcs_file_uri = ''; + protected $gcs_file_uri = ''; /** * Constructor. diff --git a/DataLabeling/src/V1beta1/PolylineConfig.php b/DataLabeling/src/V1beta1/PolylineConfig.php index 13f3ab665997..e9141edfded2 100644 --- a/DataLabeling/src/V1beta1/PolylineConfig.php +++ b/DataLabeling/src/V1beta1/PolylineConfig.php @@ -20,13 +20,13 @@ class PolylineConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string annotation_spec_set = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $annotation_spec_set = ''; + protected $annotation_spec_set = ''; /** * Optional. Instruction message showed on contributors UI. * * Generated from protobuf field string instruction_message = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $instruction_message = ''; + protected $instruction_message = ''; /** * Constructor. diff --git a/DataLabeling/src/V1beta1/PrCurve.php b/DataLabeling/src/V1beta1/PrCurve.php index 398db5777e7d..1bd0202e6e49 100644 --- a/DataLabeling/src/V1beta1/PrCurve.php +++ b/DataLabeling/src/V1beta1/PrCurve.php @@ -20,14 +20,14 @@ class PrCurve extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.datalabeling.v1beta1.AnnotationSpec annotation_spec = 1; */ - private $annotation_spec = null; + protected $annotation_spec = null; /** * Area under the precision-recall curve. Not to be confused with area under * a receiver operating characteristic (ROC) curve. * * Generated from protobuf field float area_under_curve = 2; */ - private $area_under_curve = 0.0; + protected $area_under_curve = 0.0; /** * Entries that make up the precision-recall graph. Each entry is a "point" on * the graph drawn for a different `confidence_threshold`. @@ -40,7 +40,7 @@ class PrCurve extends \Google\Protobuf\Internal\Message * * Generated from protobuf field float mean_average_precision = 4; */ - private $mean_average_precision = 0.0; + protected $mean_average_precision = 0.0; /** * Constructor. diff --git a/DataLabeling/src/V1beta1/PrCurve/ConfidenceMetricsEntry.php b/DataLabeling/src/V1beta1/PrCurve/ConfidenceMetricsEntry.php index 1381d4d1ee45..745f61162fef 100644 --- a/DataLabeling/src/V1beta1/PrCurve/ConfidenceMetricsEntry.php +++ b/DataLabeling/src/V1beta1/PrCurve/ConfidenceMetricsEntry.php @@ -21,66 +21,66 @@ class ConfidenceMetricsEntry extends \Google\Protobuf\Internal\Message * threshold. * For image object detection (bounding box) tasks, this is the * [intersection-over-union - * (IOU)](https://cloud.google.com/vision/automl/object-detection/docs/evaluate#intersection-over-union) + * (IOU)](/vision/automl/object-detection/docs/evaluate#intersection-over-union) * threshold for the context of this point on the PR curve. * * Generated from protobuf field float confidence_threshold = 1; */ - private $confidence_threshold = 0.0; + protected $confidence_threshold = 0.0; /** * Recall value. * * Generated from protobuf field float recall = 2; */ - private $recall = 0.0; + protected $recall = 0.0; /** * Precision value. * * Generated from protobuf field float precision = 3; */ - private $precision = 0.0; + protected $precision = 0.0; /** * Harmonic mean of recall and precision. * * Generated from protobuf field float f1_score = 4; */ - private $f1_score = 0.0; + protected $f1_score = 0.0; /** * Recall value for entries with label that has highest score. * * Generated from protobuf field float recall_at1 = 5; */ - private $recall_at1 = 0.0; + protected $recall_at1 = 0.0; /** * Precision value for entries with label that has highest score. * * Generated from protobuf field float precision_at1 = 6; */ - private $precision_at1 = 0.0; + protected $precision_at1 = 0.0; /** * The harmonic mean of [recall_at1][google.cloud.datalabeling.v1beta1.PrCurve.ConfidenceMetricsEntry.recall_at1] and [precision_at1][google.cloud.datalabeling.v1beta1.PrCurve.ConfidenceMetricsEntry.precision_at1]. * * Generated from protobuf field float f1_score_at1 = 7; */ - private $f1_score_at1 = 0.0; + protected $f1_score_at1 = 0.0; /** * Recall value for entries with label that has highest 5 scores. * * Generated from protobuf field float recall_at5 = 8; */ - private $recall_at5 = 0.0; + protected $recall_at5 = 0.0; /** * Precision value for entries with label that has highest 5 scores. * * Generated from protobuf field float precision_at5 = 9; */ - private $precision_at5 = 0.0; + protected $precision_at5 = 0.0; /** * The harmonic mean of [recall_at5][google.cloud.datalabeling.v1beta1.PrCurve.ConfidenceMetricsEntry.recall_at5] and [precision_at5][google.cloud.datalabeling.v1beta1.PrCurve.ConfidenceMetricsEntry.precision_at5]. * * Generated from protobuf field float f1_score_at5 = 10; */ - private $f1_score_at5 = 0.0; + protected $f1_score_at5 = 0.0; /** * Constructor. @@ -96,7 +96,7 @@ class ConfidenceMetricsEntry extends \Google\Protobuf\Internal\Message * threshold. * For image object detection (bounding box) tasks, this is the * [intersection-over-union - * (IOU)](https://cloud.google.com/vision/automl/object-detection/docs/evaluate#intersection-over-union) + * (IOU)](/vision/automl/object-detection/docs/evaluate#intersection-over-union) * threshold for the context of this point on the PR curve. * @type float $recall * Recall value. @@ -131,7 +131,7 @@ public function __construct($data = NULL) { * threshold. * For image object detection (bounding box) tasks, this is the * [intersection-over-union - * (IOU)](https://cloud.google.com/vision/automl/object-detection/docs/evaluate#intersection-over-union) + * (IOU)](/vision/automl/object-detection/docs/evaluate#intersection-over-union) * threshold for the context of this point on the PR curve. * * Generated from protobuf field float confidence_threshold = 1; @@ -150,7 +150,7 @@ public function getConfidenceThreshold() * threshold. * For image object detection (bounding box) tasks, this is the * [intersection-over-union - * (IOU)](https://cloud.google.com/vision/automl/object-detection/docs/evaluate#intersection-over-union) + * (IOU)](/vision/automl/object-detection/docs/evaluate#intersection-over-union) * threshold for the context of this point on the PR curve. * * Generated from protobuf field float confidence_threshold = 1; @@ -401,6 +401,4 @@ public function setF1ScoreAt5($var) } -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(ConfidenceMetricsEntry::class, \Google\Cloud\DataLabeling\V1beta1\PrCurve_ConfidenceMetricsEntry::class); diff --git a/DataLabeling/src/V1beta1/PrCurve_ConfidenceMetricsEntry.php b/DataLabeling/src/V1beta1/PrCurve_ConfidenceMetricsEntry.php deleted file mode 100644 index d5320a234dae..000000000000 --- a/DataLabeling/src/V1beta1/PrCurve_ConfidenceMetricsEntry.php +++ /dev/null @@ -1,16 +0,0 @@ -string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $name = ''; + protected $name = ''; /** * @param string $name Required. Name of the evaluation job that is going to be resumed. Format: diff --git a/DataLabeling/src/V1beta1/SearchEvaluationsRequest.php b/DataLabeling/src/V1beta1/SearchEvaluationsRequest.php index e53f3d107197..8539f107c451 100644 --- a/DataLabeling/src/V1beta1/SearchEvaluationsRequest.php +++ b/DataLabeling/src/V1beta1/SearchEvaluationsRequest.php @@ -21,7 +21,7 @@ class SearchEvaluationsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Optional. To search evaluations, you can filter by the following: * * evaluation_job.evaluation_job_id (the last part of @@ -54,14 +54,14 @@ class SearchEvaluationsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string filter = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $filter = ''; + protected $filter = ''; /** * Optional. Requested page size. Server may return fewer results than * requested. Default value is 100. * * Generated from protobuf field int32 page_size = 3 [(.google.api.field_behavior) = OPTIONAL]; */ - private $page_size = 0; + protected $page_size = 0; /** * Optional. A token identifying a page of results for the server to return. * Typically obtained by the @@ -72,7 +72,7 @@ class SearchEvaluationsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string page_token = 4 [(.google.api.field_behavior) = OPTIONAL]; */ - private $page_token = ''; + protected $page_token = ''; /** * @param string $parent Required. Evaluation search parent (project ID). Format: diff --git a/DataLabeling/src/V1beta1/SearchEvaluationsResponse.php b/DataLabeling/src/V1beta1/SearchEvaluationsResponse.php index 45a08f518620..2257c8400386 100644 --- a/DataLabeling/src/V1beta1/SearchEvaluationsResponse.php +++ b/DataLabeling/src/V1beta1/SearchEvaluationsResponse.php @@ -26,7 +26,7 @@ class SearchEvaluationsResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Constructor. diff --git a/DataLabeling/src/V1beta1/SearchExampleComparisonsRequest.php b/DataLabeling/src/V1beta1/SearchExampleComparisonsRequest.php index 50d139021b13..6d78e9b7cfa3 100644 --- a/DataLabeling/src/V1beta1/SearchExampleComparisonsRequest.php +++ b/DataLabeling/src/V1beta1/SearchExampleComparisonsRequest.php @@ -22,14 +22,14 @@ class SearchExampleComparisonsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $parent = ''; + protected $parent = ''; /** * Optional. Requested page size. Server may return fewer results than * requested. Default value is 100. * * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $page_size = 0; + protected $page_size = 0; /** * Optional. A token identifying a page of results for the server to return. * Typically obtained by the @@ -40,7 +40,7 @@ class SearchExampleComparisonsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; */ - private $page_token = ''; + protected $page_token = ''; /** * @param string $parent Required. Name of the [Evaluation][google.cloud.datalabeling.v1beta1.Evaluation] resource to search for example diff --git a/DataLabeling/src/V1beta1/SearchExampleComparisonsResponse.php b/DataLabeling/src/V1beta1/SearchExampleComparisonsResponse.php index c6e761cf604e..cf5d7cc924bc 100644 --- a/DataLabeling/src/V1beta1/SearchExampleComparisonsResponse.php +++ b/DataLabeling/src/V1beta1/SearchExampleComparisonsResponse.php @@ -26,7 +26,7 @@ class SearchExampleComparisonsResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string next_page_token = 2; */ - private $next_page_token = ''; + protected $next_page_token = ''; /** * Constructor. diff --git a/DataLabeling/src/V1beta1/SearchExampleComparisonsResponse/ExampleComparison.php b/DataLabeling/src/V1beta1/SearchExampleComparisonsResponse/ExampleComparison.php index d7411628252d..1ca6f9e0a4cf 100644 --- a/DataLabeling/src/V1beta1/SearchExampleComparisonsResponse/ExampleComparison.php +++ b/DataLabeling/src/V1beta1/SearchExampleComparisonsResponse/ExampleComparison.php @@ -21,7 +21,7 @@ class ExampleComparison extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.datalabeling.v1beta1.Example ground_truth_example = 1; */ - private $ground_truth_example = null; + protected $ground_truth_example = null; /** * Predictions by the model for the input. * @@ -110,6 +110,4 @@ public function setModelCreatedExamples($var) } -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(ExampleComparison::class, \Google\Cloud\DataLabeling\V1beta1\SearchExampleComparisonsResponse_ExampleComparison::class); diff --git a/DataLabeling/src/V1beta1/SearchExampleComparisonsResponse_ExampleComparison.php b/DataLabeling/src/V1beta1/SearchExampleComparisonsResponse_ExampleComparison.php deleted file mode 100644 index edd7362d8d7b..000000000000 --- a/DataLabeling/src/V1beta1/SearchExampleComparisonsResponse_ExampleComparison.php +++ /dev/null @@ -1,16 +0,0 @@ -string annotation_spec_set = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $annotation_spec_set = ''; + protected $annotation_spec_set = ''; /** * Instruction message showed on labelers UI. * * Generated from protobuf field string instruction_message = 2; */ - private $instruction_message = ''; + protected $instruction_message = ''; /** * Constructor. diff --git a/DataLabeling/src/V1beta1/SentimentConfig.php b/DataLabeling/src/V1beta1/SentimentConfig.php index 29079ae72af1..66bafb024f0d 100644 --- a/DataLabeling/src/V1beta1/SentimentConfig.php +++ b/DataLabeling/src/V1beta1/SentimentConfig.php @@ -22,7 +22,7 @@ class SentimentConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool enable_label_sentiment_selection = 1; */ - private $enable_label_sentiment_selection = false; + protected $enable_label_sentiment_selection = false; /** * Constructor. diff --git a/DataLabeling/src/V1beta1/SequentialSegment.php b/DataLabeling/src/V1beta1/SequentialSegment.php index a05578d0fad9..2a0075bcabb8 100644 --- a/DataLabeling/src/V1beta1/SequentialSegment.php +++ b/DataLabeling/src/V1beta1/SequentialSegment.php @@ -20,13 +20,13 @@ class SequentialSegment extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 start = 1; */ - private $start = 0; + protected $start = 0; /** * End position (exclusive). * * Generated from protobuf field int32 end = 2; */ - private $end = 0; + protected $end = 0; /** * Constructor. diff --git a/DataLabeling/src/V1beta1/TextClassificationAnnotation.php b/DataLabeling/src/V1beta1/TextClassificationAnnotation.php index f3ca1e8d3fec..b1eaff8a1696 100644 --- a/DataLabeling/src/V1beta1/TextClassificationAnnotation.php +++ b/DataLabeling/src/V1beta1/TextClassificationAnnotation.php @@ -20,7 +20,7 @@ class TextClassificationAnnotation extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.datalabeling.v1beta1.AnnotationSpec annotation_spec = 1; */ - private $annotation_spec = null; + protected $annotation_spec = null; /** * Constructor. diff --git a/DataLabeling/src/V1beta1/TextClassificationConfig.php b/DataLabeling/src/V1beta1/TextClassificationConfig.php index 281a8b530277..0b4c1aaa98f9 100644 --- a/DataLabeling/src/V1beta1/TextClassificationConfig.php +++ b/DataLabeling/src/V1beta1/TextClassificationConfig.php @@ -21,19 +21,19 @@ class TextClassificationConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool allow_multi_label = 1 [(.google.api.field_behavior) = OPTIONAL]; */ - private $allow_multi_label = false; + protected $allow_multi_label = false; /** * Required. Annotation spec set resource name. * * Generated from protobuf field string annotation_spec_set = 2 [(.google.api.field_behavior) = REQUIRED]; */ - private $annotation_spec_set = ''; + protected $annotation_spec_set = ''; /** * Optional. Configs for sentiment selection. * * Generated from protobuf field .google.cloud.datalabeling.v1beta1.SentimentConfig sentiment_config = 3 [(.google.api.field_behavior) = OPTIONAL]; */ - private $sentiment_config = null; + protected $sentiment_config = null; /** * Constructor. diff --git a/DataLabeling/src/V1beta1/TextEntityExtractionAnnotation.php b/DataLabeling/src/V1beta1/TextEntityExtractionAnnotation.php index 1dc04061545a..8f22e9aa6875 100644 --- a/DataLabeling/src/V1beta1/TextEntityExtractionAnnotation.php +++ b/DataLabeling/src/V1beta1/TextEntityExtractionAnnotation.php @@ -20,13 +20,13 @@ class TextEntityExtractionAnnotation extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.datalabeling.v1beta1.AnnotationSpec annotation_spec = 1; */ - private $annotation_spec = null; + protected $annotation_spec = null; /** * Position of the entity. * * Generated from protobuf field .google.cloud.datalabeling.v1beta1.SequentialSegment sequential_segment = 2; */ - private $sequential_segment = null; + protected $sequential_segment = null; /** * Constructor. diff --git a/DataLabeling/src/V1beta1/TextEntityExtractionConfig.php b/DataLabeling/src/V1beta1/TextEntityExtractionConfig.php index 10e8fcb87d46..cbc071fd1357 100644 --- a/DataLabeling/src/V1beta1/TextEntityExtractionConfig.php +++ b/DataLabeling/src/V1beta1/TextEntityExtractionConfig.php @@ -20,7 +20,7 @@ class TextEntityExtractionConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string annotation_spec_set = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $annotation_spec_set = ''; + protected $annotation_spec_set = ''; /** * Constructor. diff --git a/DataLabeling/src/V1beta1/TextMetadata.php b/DataLabeling/src/V1beta1/TextMetadata.php index eaab8af9b289..e67e402f7f6e 100644 --- a/DataLabeling/src/V1beta1/TextMetadata.php +++ b/DataLabeling/src/V1beta1/TextMetadata.php @@ -22,7 +22,7 @@ class TextMetadata extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string language_code = 1; */ - private $language_code = ''; + protected $language_code = ''; /** * Constructor. diff --git a/DataLabeling/src/V1beta1/TextPayload.php b/DataLabeling/src/V1beta1/TextPayload.php index d25e5fe52bb1..c4f346a933fa 100644 --- a/DataLabeling/src/V1beta1/TextPayload.php +++ b/DataLabeling/src/V1beta1/TextPayload.php @@ -20,7 +20,7 @@ class TextPayload extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string text_content = 1; */ - private $text_content = ''; + protected $text_content = ''; /** * Constructor. diff --git a/DataLabeling/src/V1beta1/TimeSegment.php b/DataLabeling/src/V1beta1/TimeSegment.php index b40f46aceee2..6f59a49c5585 100644 --- a/DataLabeling/src/V1beta1/TimeSegment.php +++ b/DataLabeling/src/V1beta1/TimeSegment.php @@ -21,14 +21,14 @@ class TimeSegment extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Duration start_time_offset = 1; */ - private $start_time_offset = null; + protected $start_time_offset = null; /** * End of the time segment (exclusive), represented as the duration since the * example start. * * Generated from protobuf field .google.protobuf.Duration end_time_offset = 2; */ - private $end_time_offset = null; + protected $end_time_offset = null; /** * Constructor. diff --git a/DataLabeling/src/V1beta1/UpdateEvaluationJobRequest.php b/DataLabeling/src/V1beta1/UpdateEvaluationJobRequest.php index dcefb85f98b0..abf4463e9857 100644 --- a/DataLabeling/src/V1beta1/UpdateEvaluationJobRequest.php +++ b/DataLabeling/src/V1beta1/UpdateEvaluationJobRequest.php @@ -20,7 +20,7 @@ class UpdateEvaluationJobRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.datalabeling.v1beta1.EvaluationJob evaluation_job = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $evaluation_job = null; + protected $evaluation_job = null; /** * Optional. Mask for which fields to update. You can only provide the * following fields: @@ -32,7 +32,7 @@ class UpdateEvaluationJobRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $update_mask = null; + protected $update_mask = null; /** * @param \Google\Cloud\DataLabeling\V1beta1\EvaluationJob $evaluationJob Required. Evaluation job that is going to be updated. diff --git a/DataLabeling/src/V1beta1/Vertex.php b/DataLabeling/src/V1beta1/Vertex.php index cf5efb4b1099..3242364c8b35 100644 --- a/DataLabeling/src/V1beta1/Vertex.php +++ b/DataLabeling/src/V1beta1/Vertex.php @@ -21,13 +21,13 @@ class Vertex extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 x = 1; */ - private $x = 0; + protected $x = 0; /** * Y coordinate. * * Generated from protobuf field int32 y = 2; */ - private $y = 0; + protected $y = 0; /** * Constructor. diff --git a/DataLabeling/src/V1beta1/VideoClassificationAnnotation.php b/DataLabeling/src/V1beta1/VideoClassificationAnnotation.php index 42ffa44c5e75..5c1ae3bd2d38 100644 --- a/DataLabeling/src/V1beta1/VideoClassificationAnnotation.php +++ b/DataLabeling/src/V1beta1/VideoClassificationAnnotation.php @@ -20,13 +20,13 @@ class VideoClassificationAnnotation extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.datalabeling.v1beta1.TimeSegment time_segment = 1; */ - private $time_segment = null; + protected $time_segment = null; /** * Label of the segment specified by time_segment. * * Generated from protobuf field .google.cloud.datalabeling.v1beta1.AnnotationSpec annotation_spec = 2; */ - private $annotation_spec = null; + protected $annotation_spec = null; /** * Constructor. diff --git a/DataLabeling/src/V1beta1/VideoClassificationConfig.php b/DataLabeling/src/V1beta1/VideoClassificationConfig.php index eec543619067..a1c4c7e2b2ee 100644 --- a/DataLabeling/src/V1beta1/VideoClassificationConfig.php +++ b/DataLabeling/src/V1beta1/VideoClassificationConfig.php @@ -35,7 +35,7 @@ class VideoClassificationConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool apply_shot_detection = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $apply_shot_detection = false; + protected $apply_shot_detection = false; /** * Constructor. diff --git a/DataLabeling/src/V1beta1/VideoClassificationConfig/AnnotationSpecSetConfig.php b/DataLabeling/src/V1beta1/VideoClassificationConfig/AnnotationSpecSetConfig.php index 646de87c68b9..8deb53c90399 100644 --- a/DataLabeling/src/V1beta1/VideoClassificationConfig/AnnotationSpecSetConfig.php +++ b/DataLabeling/src/V1beta1/VideoClassificationConfig/AnnotationSpecSetConfig.php @@ -20,14 +20,14 @@ class AnnotationSpecSetConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string annotation_spec_set = 1 [(.google.api.field_behavior) = REQUIRED]; */ - private $annotation_spec_set = ''; + protected $annotation_spec_set = ''; /** * Optional. If allow_multi_label is true, contributors are able to * choose multiple labels from one annotation spec set. * * Generated from protobuf field bool allow_multi_label = 2 [(.google.api.field_behavior) = OPTIONAL]; */ - private $allow_multi_label = false; + protected $allow_multi_label = false; /** * Constructor. @@ -103,6 +103,4 @@ public function setAllowMultiLabel($var) } -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(AnnotationSpecSetConfig::class, \Google\Cloud\DataLabeling\V1beta1\VideoClassificationConfig_AnnotationSpecSetConfig::class); diff --git a/DataLabeling/src/V1beta1/VideoClassificationConfig_AnnotationSpecSetConfig.php b/DataLabeling/src/V1beta1/VideoClassificationConfig_AnnotationSpecSetConfig.php deleted file mode 100644 index bf1990e0a4fc..000000000000 --- a/DataLabeling/src/V1beta1/VideoClassificationConfig_AnnotationSpecSetConfig.php +++ /dev/null @@ -1,16 +0,0 @@ -.google.cloud.datalabeling.v1beta1.AnnotationSpec annotation_spec = 1; */ - private $annotation_spec = null; + protected $annotation_spec = null; /** * The time segment of the video to which the annotation applies. * * Generated from protobuf field .google.cloud.datalabeling.v1beta1.TimeSegment time_segment = 2; */ - private $time_segment = null; + protected $time_segment = null; /** * Constructor. diff --git a/DataLabeling/src/V1beta1/VideoObjectTrackingAnnotation.php b/DataLabeling/src/V1beta1/VideoObjectTrackingAnnotation.php index 30389fa87c9d..509a9a7497e3 100644 --- a/DataLabeling/src/V1beta1/VideoObjectTrackingAnnotation.php +++ b/DataLabeling/src/V1beta1/VideoObjectTrackingAnnotation.php @@ -20,13 +20,13 @@ class VideoObjectTrackingAnnotation extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.datalabeling.v1beta1.AnnotationSpec annotation_spec = 1; */ - private $annotation_spec = null; + protected $annotation_spec = null; /** * The time segment of the video to which object tracking applies. * * Generated from protobuf field .google.cloud.datalabeling.v1beta1.TimeSegment time_segment = 2; */ - private $time_segment = null; + protected $time_segment = null; /** * The list of frames where this object track appears. * diff --git a/DataLabeling/src/V1beta1/VideoPayload.php b/DataLabeling/src/V1beta1/VideoPayload.php index ddf4ca9ec1e9..91358573d532 100644 --- a/DataLabeling/src/V1beta1/VideoPayload.php +++ b/DataLabeling/src/V1beta1/VideoPayload.php @@ -20,13 +20,13 @@ class VideoPayload extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string mime_type = 1; */ - private $mime_type = ''; + protected $mime_type = ''; /** * Video uri from the user bucket. * * Generated from protobuf field string video_uri = 2; */ - private $video_uri = ''; + protected $video_uri = ''; /** * The list of video thumbnails. * @@ -38,13 +38,13 @@ class VideoPayload extends \Google\Protobuf\Internal\Message * * Generated from protobuf field float frame_rate = 4; */ - private $frame_rate = 0.0; + protected $frame_rate = 0.0; /** * Signed uri of the video file in the service bucket. * * Generated from protobuf field string signed_uri = 5; */ - private $signed_uri = ''; + protected $signed_uri = ''; /** * Constructor. diff --git a/DataLabeling/src/V1beta1/VideoThumbnail.php b/DataLabeling/src/V1beta1/VideoThumbnail.php index 8e10c0fa48ce..c8fdcc0a70c4 100644 --- a/DataLabeling/src/V1beta1/VideoThumbnail.php +++ b/DataLabeling/src/V1beta1/VideoThumbnail.php @@ -20,14 +20,14 @@ class VideoThumbnail extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bytes thumbnail = 1; */ - private $thumbnail = ''; + protected $thumbnail = ''; /** * Time offset relative to the beginning of the video, corresponding to the * video frame where the thumbnail has been extracted from. * * Generated from protobuf field .google.protobuf.Duration time_offset = 2; */ - private $time_offset = null; + protected $time_offset = null; /** * Constructor. diff --git a/DataLabeling/tests/Unit/V1beta1/Client/DataLabelingServiceClientTest.php b/DataLabeling/tests/Unit/V1beta1/Client/DataLabelingServiceClientTest.php index 85fe58cd0f3f..e6a02ab19d72 100644 --- a/DataLabeling/tests/Unit/V1beta1/Client/DataLabelingServiceClientTest.php +++ b/DataLabeling/tests/Unit/V1beta1/Client/DataLabelingServiceClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return DataLabelingServiceClient */ @@ -150,7 +152,10 @@ public function createAnnotationSpecSetTest() $this->assertSame(1, count($actualRequests)); $actualFuncCall = $actualRequests[0]->getFuncCall(); $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.datalabeling.v1beta1.DataLabelingService/CreateAnnotationSpecSet', $actualFuncCall); + $this->assertSame( + '/google.cloud.datalabeling.v1beta1.DataLabelingService/CreateAnnotationSpecSet', + $actualFuncCall + ); $actualValue = $actualRequestObject->getParent(); $this->assertProtobufEquals($formattedParent, $actualValue); $actualValue = $actualRequestObject->getAnnotationSpecSet(); @@ -169,12 +174,15 @@ public function createAnnotationSpecSetExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->projectName('[PROJECT]'); @@ -217,9 +225,7 @@ public function createDatasetTest() // Mock request $formattedParent = $gapicClient->projectName('[PROJECT]'); $dataset = new Dataset(); - $request = (new CreateDatasetRequest()) - ->setParent($formattedParent) - ->setDataset($dataset); + $request = (new CreateDatasetRequest())->setParent($formattedParent)->setDataset($dataset); $response = $gapicClient->createDataset($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -245,19 +251,20 @@ public function createDatasetExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->projectName('[PROJECT]'); $dataset = new Dataset(); - $request = (new CreateDatasetRequest()) - ->setParent($formattedParent) - ->setDataset($dataset); + $request = (new CreateDatasetRequest())->setParent($formattedParent)->setDataset($dataset); try { $gapicClient->createDataset($request); // If the $gapicClient method call did not throw, fail the test @@ -297,16 +304,17 @@ public function createEvaluationJobTest() // Mock request $formattedParent = $gapicClient->projectName('[PROJECT]'); $job = new EvaluationJob(); - $request = (new CreateEvaluationJobRequest()) - ->setParent($formattedParent) - ->setJob($job); + $request = (new CreateEvaluationJobRequest())->setParent($formattedParent)->setJob($job); $response = $gapicClient->createEvaluationJob($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); $this->assertSame(1, count($actualRequests)); $actualFuncCall = $actualRequests[0]->getFuncCall(); $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.datalabeling.v1beta1.DataLabelingService/CreateEvaluationJob', $actualFuncCall); + $this->assertSame( + '/google.cloud.datalabeling.v1beta1.DataLabelingService/CreateEvaluationJob', + $actualFuncCall + ); $actualValue = $actualRequestObject->getParent(); $this->assertProtobufEquals($formattedParent, $actualValue); $actualValue = $actualRequestObject->getJob(); @@ -325,19 +333,20 @@ public function createEvaluationJobExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->projectName('[PROJECT]'); $job = new EvaluationJob(); - $request = (new CreateEvaluationJobRequest()) - ->setParent($formattedParent) - ->setJob($job); + $request = (new CreateEvaluationJobRequest())->setParent($formattedParent)->setJob($job); try { $gapicClient->createEvaluationJob($request); // If the $gapicClient method call did not throw, fail the test @@ -389,9 +398,7 @@ public function createInstructionTest() // Mock request $formattedParent = $gapicClient->projectName('[PROJECT]'); $instruction = new Instruction(); - $request = (new CreateInstructionRequest()) - ->setParent($formattedParent) - ->setInstruction($instruction); + $request = (new CreateInstructionRequest())->setParent($formattedParent)->setInstruction($instruction); $response = $gapicClient->createInstruction($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -401,7 +408,10 @@ public function createInstructionTest() $this->assertSame(0, count($operationsRequestsEmpty)); $actualApiFuncCall = $apiRequests[0]->getFuncCall(); $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.datalabeling.v1beta1.DataLabelingService/CreateInstruction', $actualApiFuncCall); + $this->assertSame( + '/google.cloud.datalabeling.v1beta1.DataLabelingService/CreateInstruction', + $actualApiFuncCall + ); $actualValue = $actualApiRequestObject->getParent(); $this->assertProtobufEquals($formattedParent, $actualValue); $actualValue = $actualApiRequestObject->getInstruction(); @@ -449,19 +459,20 @@ public function createInstructionExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->projectName('[PROJECT]'); $instruction = new Instruction(); - $request = (new CreateInstructionRequest()) - ->setParent($formattedParent) - ->setInstruction($instruction); + $request = (new CreateInstructionRequest())->setParent($formattedParent)->setInstruction($instruction); $response = $gapicClient->createInstruction($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -497,14 +508,16 @@ public function deleteAnnotatedDatasetTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->annotatedDatasetName('[PROJECT]', '[DATASET]', '[ANNOTATED_DATASET]'); - $request = (new DeleteAnnotatedDatasetRequest()) - ->setName($formattedName); + $request = (new DeleteAnnotatedDatasetRequest())->setName($formattedName); $gapicClient->deleteAnnotatedDataset($request); $actualRequests = $transport->popReceivedCalls(); $this->assertSame(1, count($actualRequests)); $actualFuncCall = $actualRequests[0]->getFuncCall(); $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.datalabeling.v1beta1.DataLabelingService/DeleteAnnotatedDataset', $actualFuncCall); + $this->assertSame( + '/google.cloud.datalabeling.v1beta1.DataLabelingService/DeleteAnnotatedDataset', + $actualFuncCall + ); $actualValue = $actualRequestObject->getName(); $this->assertProtobufEquals($formattedName, $actualValue); $this->assertTrue($transport->isExhausted()); @@ -521,17 +534,19 @@ public function deleteAnnotatedDatasetExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->annotatedDatasetName('[PROJECT]', '[DATASET]', '[ANNOTATED_DATASET]'); - $request = (new DeleteAnnotatedDatasetRequest()) - ->setName($formattedName); + $request = (new DeleteAnnotatedDatasetRequest())->setName($formattedName); try { $gapicClient->deleteAnnotatedDataset($request); // If the $gapicClient method call did not throw, fail the test @@ -558,14 +573,16 @@ public function deleteAnnotationSpecSetTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->annotationSpecSetName('[PROJECT]', '[ANNOTATION_SPEC_SET]'); - $request = (new DeleteAnnotationSpecSetRequest()) - ->setName($formattedName); + $request = (new DeleteAnnotationSpecSetRequest())->setName($formattedName); $gapicClient->deleteAnnotationSpecSet($request); $actualRequests = $transport->popReceivedCalls(); $this->assertSame(1, count($actualRequests)); $actualFuncCall = $actualRequests[0]->getFuncCall(); $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.datalabeling.v1beta1.DataLabelingService/DeleteAnnotationSpecSet', $actualFuncCall); + $this->assertSame( + '/google.cloud.datalabeling.v1beta1.DataLabelingService/DeleteAnnotationSpecSet', + $actualFuncCall + ); $actualValue = $actualRequestObject->getName(); $this->assertProtobufEquals($formattedName, $actualValue); $this->assertTrue($transport->isExhausted()); @@ -582,17 +599,19 @@ public function deleteAnnotationSpecSetExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->annotationSpecSetName('[PROJECT]', '[ANNOTATION_SPEC_SET]'); - $request = (new DeleteAnnotationSpecSetRequest()) - ->setName($formattedName); + $request = (new DeleteAnnotationSpecSetRequest())->setName($formattedName); try { $gapicClient->deleteAnnotationSpecSet($request); // If the $gapicClient method call did not throw, fail the test @@ -619,8 +638,7 @@ public function deleteDatasetTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->datasetName('[PROJECT]', '[DATASET]'); - $request = (new DeleteDatasetRequest()) - ->setName($formattedName); + $request = (new DeleteDatasetRequest())->setName($formattedName); $gapicClient->deleteDataset($request); $actualRequests = $transport->popReceivedCalls(); $this->assertSame(1, count($actualRequests)); @@ -643,17 +661,19 @@ public function deleteDatasetExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->datasetName('[PROJECT]', '[DATASET]'); - $request = (new DeleteDatasetRequest()) - ->setName($formattedName); + $request = (new DeleteDatasetRequest())->setName($formattedName); try { $gapicClient->deleteDataset($request); // If the $gapicClient method call did not throw, fail the test @@ -680,14 +700,16 @@ public function deleteEvaluationJobTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->evaluationJobName('[PROJECT]', '[EVALUATION_JOB]'); - $request = (new DeleteEvaluationJobRequest()) - ->setName($formattedName); + $request = (new DeleteEvaluationJobRequest())->setName($formattedName); $gapicClient->deleteEvaluationJob($request); $actualRequests = $transport->popReceivedCalls(); $this->assertSame(1, count($actualRequests)); $actualFuncCall = $actualRequests[0]->getFuncCall(); $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.datalabeling.v1beta1.DataLabelingService/DeleteEvaluationJob', $actualFuncCall); + $this->assertSame( + '/google.cloud.datalabeling.v1beta1.DataLabelingService/DeleteEvaluationJob', + $actualFuncCall + ); $actualValue = $actualRequestObject->getName(); $this->assertProtobufEquals($formattedName, $actualValue); $this->assertTrue($transport->isExhausted()); @@ -704,17 +726,19 @@ public function deleteEvaluationJobExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->evaluationJobName('[PROJECT]', '[EVALUATION_JOB]'); - $request = (new DeleteEvaluationJobRequest()) - ->setName($formattedName); + $request = (new DeleteEvaluationJobRequest())->setName($formattedName); try { $gapicClient->deleteEvaluationJob($request); // If the $gapicClient method call did not throw, fail the test @@ -741,8 +765,7 @@ public function deleteInstructionTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->instructionName('[PROJECT]', '[INSTRUCTION]'); - $request = (new DeleteInstructionRequest()) - ->setName($formattedName); + $request = (new DeleteInstructionRequest())->setName($formattedName); $gapicClient->deleteInstruction($request); $actualRequests = $transport->popReceivedCalls(); $this->assertSame(1, count($actualRequests)); @@ -765,17 +788,19 @@ public function deleteInstructionExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->instructionName('[PROJECT]', '[INSTRUCTION]'); - $request = (new DeleteInstructionRequest()) - ->setName($formattedName); + $request = (new DeleteInstructionRequest())->setName($formattedName); try { $gapicClient->deleteInstruction($request); // If the $gapicClient method call did not throw, fail the test @@ -826,7 +851,11 @@ public function exportDataTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedName = $gapicClient->datasetName('[PROJECT]', '[DATASET]'); - $formattedAnnotatedDataset = $gapicClient->annotatedDatasetName('[PROJECT]', '[DATASET]', '[ANNOTATED_DATASET]'); + $formattedAnnotatedDataset = $gapicClient->annotatedDatasetName( + '[PROJECT]', + '[DATASET]', + '[ANNOTATED_DATASET]' + ); $outputConfig = new OutputConfig(); $request = (new ExportDataRequest()) ->setName($formattedName) @@ -891,16 +920,23 @@ public function exportDataExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->datasetName('[PROJECT]', '[DATASET]'); - $formattedAnnotatedDataset = $gapicClient->annotatedDatasetName('[PROJECT]', '[DATASET]', '[ANNOTATED_DATASET]'); + $formattedAnnotatedDataset = $gapicClient->annotatedDatasetName( + '[PROJECT]', + '[DATASET]', + '[ANNOTATED_DATASET]' + ); $outputConfig = new OutputConfig(); $request = (new ExportDataRequest()) ->setName($formattedName) @@ -951,15 +987,17 @@ public function getAnnotatedDatasetTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->annotatedDatasetName('[PROJECT]', '[DATASET]', '[ANNOTATED_DATASET]'); - $request = (new GetAnnotatedDatasetRequest()) - ->setName($formattedName); + $request = (new GetAnnotatedDatasetRequest())->setName($formattedName); $response = $gapicClient->getAnnotatedDataset($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); $this->assertSame(1, count($actualRequests)); $actualFuncCall = $actualRequests[0]->getFuncCall(); $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.datalabeling.v1beta1.DataLabelingService/GetAnnotatedDataset', $actualFuncCall); + $this->assertSame( + '/google.cloud.datalabeling.v1beta1.DataLabelingService/GetAnnotatedDataset', + $actualFuncCall + ); $actualValue = $actualRequestObject->getName(); $this->assertProtobufEquals($formattedName, $actualValue); $this->assertTrue($transport->isExhausted()); @@ -976,17 +1014,19 @@ public function getAnnotatedDatasetExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->annotatedDatasetName('[PROJECT]', '[DATASET]', '[ANNOTATED_DATASET]'); - $request = (new GetAnnotatedDatasetRequest()) - ->setName($formattedName); + $request = (new GetAnnotatedDatasetRequest())->setName($formattedName); try { $gapicClient->getAnnotatedDataset($request); // If the $gapicClient method call did not throw, fail the test @@ -1019,15 +1059,17 @@ public function getAnnotationSpecSetTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->annotationSpecSetName('[PROJECT]', '[ANNOTATION_SPEC_SET]'); - $request = (new GetAnnotationSpecSetRequest()) - ->setName($formattedName); + $request = (new GetAnnotationSpecSetRequest())->setName($formattedName); $response = $gapicClient->getAnnotationSpecSet($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); $this->assertSame(1, count($actualRequests)); $actualFuncCall = $actualRequests[0]->getFuncCall(); $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.datalabeling.v1beta1.DataLabelingService/GetAnnotationSpecSet', $actualFuncCall); + $this->assertSame( + '/google.cloud.datalabeling.v1beta1.DataLabelingService/GetAnnotationSpecSet', + $actualFuncCall + ); $actualValue = $actualRequestObject->getName(); $this->assertProtobufEquals($formattedName, $actualValue); $this->assertTrue($transport->isExhausted()); @@ -1044,17 +1086,19 @@ public function getAnnotationSpecSetExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->annotationSpecSetName('[PROJECT]', '[ANNOTATION_SPEC_SET]'); - $request = (new GetAnnotationSpecSetRequest()) - ->setName($formattedName); + $request = (new GetAnnotationSpecSetRequest())->setName($formattedName); try { $gapicClient->getAnnotationSpecSet($request); // If the $gapicClient method call did not throw, fail the test @@ -1083,8 +1127,7 @@ public function getDataItemTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->dataItemName('[PROJECT]', '[DATASET]', '[DATA_ITEM]'); - $request = (new GetDataItemRequest()) - ->setName($formattedName); + $request = (new GetDataItemRequest())->setName($formattedName); $response = $gapicClient->getDataItem($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -1108,17 +1151,19 @@ public function getDataItemExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->dataItemName('[PROJECT]', '[DATASET]', '[DATA_ITEM]'); - $request = (new GetDataItemRequest()) - ->setName($formattedName); + $request = (new GetDataItemRequest())->setName($formattedName); try { $gapicClient->getDataItem($request); // If the $gapicClient method call did not throw, fail the test @@ -1153,8 +1198,7 @@ public function getDatasetTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->datasetName('[PROJECT]', '[DATASET]'); - $request = (new GetDatasetRequest()) - ->setName($formattedName); + $request = (new GetDatasetRequest())->setName($formattedName); $response = $gapicClient->getDataset($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -1178,17 +1222,19 @@ public function getDatasetExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->datasetName('[PROJECT]', '[DATASET]'); - $request = (new GetDatasetRequest()) - ->setName($formattedName); + $request = (new GetDatasetRequest())->setName($formattedName); try { $gapicClient->getDataset($request); // If the $gapicClient method call did not throw, fail the test @@ -1219,8 +1265,7 @@ public function getEvaluationTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->evaluationName('[PROJECT]', '[DATASET]', '[EVALUATION]'); - $request = (new GetEvaluationRequest()) - ->setName($formattedName); + $request = (new GetEvaluationRequest())->setName($formattedName); $response = $gapicClient->getEvaluation($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -1244,17 +1289,19 @@ public function getEvaluationExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->evaluationName('[PROJECT]', '[DATASET]', '[EVALUATION]'); - $request = (new GetEvaluationRequest()) - ->setName($formattedName); + $request = (new GetEvaluationRequest())->setName($formattedName); try { $gapicClient->getEvaluation($request); // If the $gapicClient method call did not throw, fail the test @@ -1293,8 +1340,7 @@ public function getEvaluationJobTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->evaluationJobName('[PROJECT]', '[EVALUATION_JOB]'); - $request = (new GetEvaluationJobRequest()) - ->setName($formattedName); + $request = (new GetEvaluationJobRequest())->setName($formattedName); $response = $gapicClient->getEvaluationJob($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -1318,17 +1364,19 @@ public function getEvaluationJobExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->evaluationJobName('[PROJECT]', '[EVALUATION_JOB]'); - $request = (new GetEvaluationJobRequest()) - ->setName($formattedName); + $request = (new GetEvaluationJobRequest())->setName($formattedName); try { $gapicClient->getEvaluationJob($request); // If the $gapicClient method call did not throw, fail the test @@ -1357,8 +1405,7 @@ public function getExampleTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->exampleName('[PROJECT]', '[DATASET]', '[ANNOTATED_DATASET]', '[EXAMPLE]'); - $request = (new GetExampleRequest()) - ->setName($formattedName); + $request = (new GetExampleRequest())->setName($formattedName); $response = $gapicClient->getExample($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -1382,17 +1429,19 @@ public function getExampleExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->exampleName('[PROJECT]', '[DATASET]', '[ANNOTATED_DATASET]', '[EXAMPLE]'); - $request = (new GetExampleRequest()) - ->setName($formattedName); + $request = (new GetExampleRequest())->setName($formattedName); try { $gapicClient->getExample($request); // If the $gapicClient method call did not throw, fail the test @@ -1425,8 +1474,7 @@ public function getInstructionTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->instructionName('[PROJECT]', '[INSTRUCTION]'); - $request = (new GetInstructionRequest()) - ->setName($formattedName); + $request = (new GetInstructionRequest())->setName($formattedName); $response = $gapicClient->getInstruction($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -1450,17 +1498,19 @@ public function getInstructionExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->instructionName('[PROJECT]', '[INSTRUCTION]'); - $request = (new GetInstructionRequest()) - ->setName($formattedName); + $request = (new GetInstructionRequest())->setName($formattedName); try { $gapicClient->getInstruction($request); // If the $gapicClient method call did not throw, fail the test @@ -1512,9 +1562,7 @@ public function importDataTest() // Mock request $formattedName = $gapicClient->datasetName('[PROJECT]', '[DATASET]'); $inputConfig = new InputConfig(); - $request = (new ImportDataRequest()) - ->setName($formattedName) - ->setInputConfig($inputConfig); + $request = (new ImportDataRequest())->setName($formattedName)->setInputConfig($inputConfig); $response = $gapicClient->importData($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1572,19 +1620,20 @@ public function importDataExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->datasetName('[PROJECT]', '[DATASET]'); $inputConfig = new InputConfig(); - $request = (new ImportDataRequest()) - ->setName($formattedName) - ->setInputConfig($inputConfig); + $request = (new ImportDataRequest())->setName($formattedName)->setInputConfig($inputConfig); $response = $gapicClient->importData($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1717,12 +1766,15 @@ public function labelImageExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->datasetName('[PROJECT]', '[DATASET]'); @@ -1868,12 +1920,15 @@ public function labelTextExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->datasetName('[PROJECT]', '[DATASET]'); @@ -2019,12 +2074,15 @@ public function labelVideoExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->datasetName('[PROJECT]', '[DATASET]'); @@ -2071,17 +2129,14 @@ public function listAnnotatedDatasetsTest() // Mock response $nextPageToken = ''; $annotatedDatasetsElement = new AnnotatedDataset(); - $annotatedDatasets = [ - $annotatedDatasetsElement, - ]; + $annotatedDatasets = [$annotatedDatasetsElement]; $expectedResponse = new ListAnnotatedDatasetsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setAnnotatedDatasets($annotatedDatasets); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->datasetName('[PROJECT]', '[DATASET]'); - $request = (new ListAnnotatedDatasetsRequest()) - ->setParent($formattedParent); + $request = (new ListAnnotatedDatasetsRequest())->setParent($formattedParent); $response = $gapicClient->listAnnotatedDatasets($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -2091,7 +2146,10 @@ public function listAnnotatedDatasetsTest() $this->assertSame(1, count($actualRequests)); $actualFuncCall = $actualRequests[0]->getFuncCall(); $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.datalabeling.v1beta1.DataLabelingService/ListAnnotatedDatasets', $actualFuncCall); + $this->assertSame( + '/google.cloud.datalabeling.v1beta1.DataLabelingService/ListAnnotatedDatasets', + $actualFuncCall + ); $actualValue = $actualRequestObject->getParent(); $this->assertProtobufEquals($formattedParent, $actualValue); $this->assertTrue($transport->isExhausted()); @@ -2108,17 +2166,19 @@ public function listAnnotatedDatasetsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->datasetName('[PROJECT]', '[DATASET]'); - $request = (new ListAnnotatedDatasetsRequest()) - ->setParent($formattedParent); + $request = (new ListAnnotatedDatasetsRequest())->setParent($formattedParent); try { $gapicClient->listAnnotatedDatasets($request); // If the $gapicClient method call did not throw, fail the test @@ -2143,17 +2203,14 @@ public function listAnnotationSpecSetsTest() // Mock response $nextPageToken = ''; $annotationSpecSetsElement = new AnnotationSpecSet(); - $annotationSpecSets = [ - $annotationSpecSetsElement, - ]; + $annotationSpecSets = [$annotationSpecSetsElement]; $expectedResponse = new ListAnnotationSpecSetsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setAnnotationSpecSets($annotationSpecSets); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->projectName('[PROJECT]'); - $request = (new ListAnnotationSpecSetsRequest()) - ->setParent($formattedParent); + $request = (new ListAnnotationSpecSetsRequest())->setParent($formattedParent); $response = $gapicClient->listAnnotationSpecSets($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -2163,7 +2220,10 @@ public function listAnnotationSpecSetsTest() $this->assertSame(1, count($actualRequests)); $actualFuncCall = $actualRequests[0]->getFuncCall(); $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.datalabeling.v1beta1.DataLabelingService/ListAnnotationSpecSets', $actualFuncCall); + $this->assertSame( + '/google.cloud.datalabeling.v1beta1.DataLabelingService/ListAnnotationSpecSets', + $actualFuncCall + ); $actualValue = $actualRequestObject->getParent(); $this->assertProtobufEquals($formattedParent, $actualValue); $this->assertTrue($transport->isExhausted()); @@ -2180,17 +2240,19 @@ public function listAnnotationSpecSetsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->projectName('[PROJECT]'); - $request = (new ListAnnotationSpecSetsRequest()) - ->setParent($formattedParent); + $request = (new ListAnnotationSpecSetsRequest())->setParent($formattedParent); try { $gapicClient->listAnnotationSpecSets($request); // If the $gapicClient method call did not throw, fail the test @@ -2215,17 +2277,14 @@ public function listDataItemsTest() // Mock response $nextPageToken = ''; $dataItemsElement = new DataItem(); - $dataItems = [ - $dataItemsElement, - ]; + $dataItems = [$dataItemsElement]; $expectedResponse = new ListDataItemsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setDataItems($dataItems); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->datasetName('[PROJECT]', '[DATASET]'); - $request = (new ListDataItemsRequest()) - ->setParent($formattedParent); + $request = (new ListDataItemsRequest())->setParent($formattedParent); $response = $gapicClient->listDataItems($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -2252,17 +2311,19 @@ public function listDataItemsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->datasetName('[PROJECT]', '[DATASET]'); - $request = (new ListDataItemsRequest()) - ->setParent($formattedParent); + $request = (new ListDataItemsRequest())->setParent($formattedParent); try { $gapicClient->listDataItems($request); // If the $gapicClient method call did not throw, fail the test @@ -2287,17 +2348,14 @@ public function listDatasetsTest() // Mock response $nextPageToken = ''; $datasetsElement = new Dataset(); - $datasets = [ - $datasetsElement, - ]; + $datasets = [$datasetsElement]; $expectedResponse = new ListDatasetsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setDatasets($datasets); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->projectName('[PROJECT]'); - $request = (new ListDatasetsRequest()) - ->setParent($formattedParent); + $request = (new ListDatasetsRequest())->setParent($formattedParent); $response = $gapicClient->listDatasets($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -2324,17 +2382,19 @@ public function listDatasetsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->projectName('[PROJECT]'); - $request = (new ListDatasetsRequest()) - ->setParent($formattedParent); + $request = (new ListDatasetsRequest())->setParent($formattedParent); try { $gapicClient->listDatasets($request); // If the $gapicClient method call did not throw, fail the test @@ -2359,17 +2419,14 @@ public function listEvaluationJobsTest() // Mock response $nextPageToken = ''; $evaluationJobsElement = new EvaluationJob(); - $evaluationJobs = [ - $evaluationJobsElement, - ]; + $evaluationJobs = [$evaluationJobsElement]; $expectedResponse = new ListEvaluationJobsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setEvaluationJobs($evaluationJobs); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->projectName('[PROJECT]'); - $request = (new ListEvaluationJobsRequest()) - ->setParent($formattedParent); + $request = (new ListEvaluationJobsRequest())->setParent($formattedParent); $response = $gapicClient->listEvaluationJobs($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -2396,17 +2453,19 @@ public function listEvaluationJobsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->projectName('[PROJECT]'); - $request = (new ListEvaluationJobsRequest()) - ->setParent($formattedParent); + $request = (new ListEvaluationJobsRequest())->setParent($formattedParent); try { $gapicClient->listEvaluationJobs($request); // If the $gapicClient method call did not throw, fail the test @@ -2431,17 +2490,14 @@ public function listExamplesTest() // Mock response $nextPageToken = ''; $examplesElement = new Example(); - $examples = [ - $examplesElement, - ]; + $examples = [$examplesElement]; $expectedResponse = new ListExamplesResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setExamples($examples); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->annotatedDatasetName('[PROJECT]', '[DATASET]', '[ANNOTATED_DATASET]'); - $request = (new ListExamplesRequest()) - ->setParent($formattedParent); + $request = (new ListExamplesRequest())->setParent($formattedParent); $response = $gapicClient->listExamples($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -2468,17 +2524,19 @@ public function listExamplesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->annotatedDatasetName('[PROJECT]', '[DATASET]', '[ANNOTATED_DATASET]'); - $request = (new ListExamplesRequest()) - ->setParent($formattedParent); + $request = (new ListExamplesRequest())->setParent($formattedParent); try { $gapicClient->listExamples($request); // If the $gapicClient method call did not throw, fail the test @@ -2503,17 +2561,14 @@ public function listInstructionsTest() // Mock response $nextPageToken = ''; $instructionsElement = new Instruction(); - $instructions = [ - $instructionsElement, - ]; + $instructions = [$instructionsElement]; $expectedResponse = new ListInstructionsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setInstructions($instructions); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->projectName('[PROJECT]'); - $request = (new ListInstructionsRequest()) - ->setParent($formattedParent); + $request = (new ListInstructionsRequest())->setParent($formattedParent); $response = $gapicClient->listInstructions($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -2540,17 +2595,19 @@ public function listInstructionsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->projectName('[PROJECT]'); - $request = (new ListInstructionsRequest()) - ->setParent($formattedParent); + $request = (new ListInstructionsRequest())->setParent($formattedParent); try { $gapicClient->listInstructions($request); // If the $gapicClient method call did not throw, fail the test @@ -2577,8 +2634,7 @@ public function pauseEvaluationJobTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->evaluationJobName('[PROJECT]', '[EVALUATION_JOB]'); - $request = (new PauseEvaluationJobRequest()) - ->setName($formattedName); + $request = (new PauseEvaluationJobRequest())->setName($formattedName); $gapicClient->pauseEvaluationJob($request); $actualRequests = $transport->popReceivedCalls(); $this->assertSame(1, count($actualRequests)); @@ -2601,17 +2657,19 @@ public function pauseEvaluationJobExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->evaluationJobName('[PROJECT]', '[EVALUATION_JOB]'); - $request = (new PauseEvaluationJobRequest()) - ->setName($formattedName); + $request = (new PauseEvaluationJobRequest())->setName($formattedName); try { $gapicClient->pauseEvaluationJob($request); // If the $gapicClient method call did not throw, fail the test @@ -2638,14 +2696,16 @@ public function resumeEvaluationJobTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->evaluationJobName('[PROJECT]', '[EVALUATION_JOB]'); - $request = (new ResumeEvaluationJobRequest()) - ->setName($formattedName); + $request = (new ResumeEvaluationJobRequest())->setName($formattedName); $gapicClient->resumeEvaluationJob($request); $actualRequests = $transport->popReceivedCalls(); $this->assertSame(1, count($actualRequests)); $actualFuncCall = $actualRequests[0]->getFuncCall(); $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.datalabeling.v1beta1.DataLabelingService/ResumeEvaluationJob', $actualFuncCall); + $this->assertSame( + '/google.cloud.datalabeling.v1beta1.DataLabelingService/ResumeEvaluationJob', + $actualFuncCall + ); $actualValue = $actualRequestObject->getName(); $this->assertProtobufEquals($formattedName, $actualValue); $this->assertTrue($transport->isExhausted()); @@ -2662,17 +2722,19 @@ public function resumeEvaluationJobExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->evaluationJobName('[PROJECT]', '[EVALUATION_JOB]'); - $request = (new ResumeEvaluationJobRequest()) - ->setName($formattedName); + $request = (new ResumeEvaluationJobRequest())->setName($formattedName); try { $gapicClient->resumeEvaluationJob($request); // If the $gapicClient method call did not throw, fail the test @@ -2697,17 +2759,14 @@ public function searchEvaluationsTest() // Mock response $nextPageToken = ''; $evaluationsElement = new Evaluation(); - $evaluations = [ - $evaluationsElement, - ]; + $evaluations = [$evaluationsElement]; $expectedResponse = new SearchEvaluationsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setEvaluations($evaluations); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->evaluationName('[PROJECT]', '[DATASET]', '[EVALUATION]'); - $request = (new SearchEvaluationsRequest()) - ->setParent($formattedParent); + $request = (new SearchEvaluationsRequest())->setParent($formattedParent); $response = $gapicClient->searchEvaluations($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -2734,17 +2793,19 @@ public function searchEvaluationsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->evaluationName('[PROJECT]', '[DATASET]', '[EVALUATION]'); - $request = (new SearchEvaluationsRequest()) - ->setParent($formattedParent); + $request = (new SearchEvaluationsRequest())->setParent($formattedParent); try { $gapicClient->searchEvaluations($request); // If the $gapicClient method call did not throw, fail the test @@ -2769,17 +2830,14 @@ public function searchExampleComparisonsTest() // Mock response $nextPageToken = ''; $exampleComparisonsElement = new ExampleComparison(); - $exampleComparisons = [ - $exampleComparisonsElement, - ]; + $exampleComparisons = [$exampleComparisonsElement]; $expectedResponse = new SearchExampleComparisonsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setExampleComparisons($exampleComparisons); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->evaluationName('[PROJECT]', '[DATASET]', '[EVALUATION]'); - $request = (new SearchExampleComparisonsRequest()) - ->setParent($formattedParent); + $request = (new SearchExampleComparisonsRequest())->setParent($formattedParent); $response = $gapicClient->searchExampleComparisons($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -2789,7 +2847,10 @@ public function searchExampleComparisonsTest() $this->assertSame(1, count($actualRequests)); $actualFuncCall = $actualRequests[0]->getFuncCall(); $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.datalabeling.v1beta1.DataLabelingService/SearchExampleComparisons', $actualFuncCall); + $this->assertSame( + '/google.cloud.datalabeling.v1beta1.DataLabelingService/SearchExampleComparisons', + $actualFuncCall + ); $actualValue = $actualRequestObject->getParent(); $this->assertProtobufEquals($formattedParent, $actualValue); $this->assertTrue($transport->isExhausted()); @@ -2806,17 +2867,19 @@ public function searchExampleComparisonsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->evaluationName('[PROJECT]', '[DATASET]', '[EVALUATION]'); - $request = (new SearchExampleComparisonsRequest()) - ->setParent($formattedParent); + $request = (new SearchExampleComparisonsRequest())->setParent($formattedParent); try { $gapicClient->searchExampleComparisons($request); // If the $gapicClient method call did not throw, fail the test @@ -2855,15 +2918,17 @@ public function updateEvaluationJobTest() $transport->addResponse($expectedResponse); // Mock request $evaluationJob = new EvaluationJob(); - $request = (new UpdateEvaluationJobRequest()) - ->setEvaluationJob($evaluationJob); + $request = (new UpdateEvaluationJobRequest())->setEvaluationJob($evaluationJob); $response = $gapicClient->updateEvaluationJob($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); $this->assertSame(1, count($actualRequests)); $actualFuncCall = $actualRequests[0]->getFuncCall(); $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.datalabeling.v1beta1.DataLabelingService/UpdateEvaluationJob', $actualFuncCall); + $this->assertSame( + '/google.cloud.datalabeling.v1beta1.DataLabelingService/UpdateEvaluationJob', + $actualFuncCall + ); $actualValue = $actualRequestObject->getEvaluationJob(); $this->assertProtobufEquals($evaluationJob, $actualValue); $this->assertTrue($transport->isExhausted()); @@ -2880,17 +2945,19 @@ public function updateEvaluationJobExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $evaluationJob = new EvaluationJob(); - $request = (new UpdateEvaluationJobRequest()) - ->setEvaluationJob($evaluationJob); + $request = (new UpdateEvaluationJobRequest())->setEvaluationJob($evaluationJob); try { $gapicClient->updateEvaluationJob($request); // If the $gapicClient method call did not throw, fail the test @@ -2933,7 +3000,10 @@ public function createAnnotationSpecSetAsyncTest() $this->assertSame(1, count($actualRequests)); $actualFuncCall = $actualRequests[0]->getFuncCall(); $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.datalabeling.v1beta1.DataLabelingService/CreateAnnotationSpecSet', $actualFuncCall); + $this->assertSame( + '/google.cloud.datalabeling.v1beta1.DataLabelingService/CreateAnnotationSpecSet', + $actualFuncCall + ); $actualValue = $actualRequestObject->getParent(); $this->assertProtobufEquals($formattedParent, $actualValue); $actualValue = $actualRequestObject->getAnnotationSpecSet(); diff --git a/DataLabeling/tests/Unit/V1beta1/DataLabelingServiceClientTest.php b/DataLabeling/tests/Unit/V1beta1/DataLabelingServiceClientTest.php deleted file mode 100644 index 5345c4498455..000000000000 --- a/DataLabeling/tests/Unit/V1beta1/DataLabelingServiceClientTest.php +++ /dev/null @@ -1,2710 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return DataLabelingServiceClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new DataLabelingServiceClient($options); - } - - /** @test */ - public function createAnnotationSpecSetTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name = 'name3373707'; - $displayName = 'displayName1615086568'; - $description = 'description-1724546052'; - $expectedResponse = new AnnotationSpecSet(); - $expectedResponse->setName($name); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setDescription($description); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->projectName('[PROJECT]'); - $annotationSpecSet = new AnnotationSpecSet(); - $response = $gapicClient->createAnnotationSpecSet($formattedParent, $annotationSpecSet); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.datalabeling.v1beta1.DataLabelingService/CreateAnnotationSpecSet', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualRequestObject->getAnnotationSpecSet(); - $this->assertProtobufEquals($annotationSpecSet, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function createAnnotationSpecSetExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->projectName('[PROJECT]'); - $annotationSpecSet = new AnnotationSpecSet(); - try { - $gapicClient->createAnnotationSpecSet($formattedParent, $annotationSpecSet); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function createDatasetTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name = 'name3373707'; - $displayName = 'displayName1615086568'; - $description = 'description-1724546052'; - $dataItemCount = 2014260376; - $expectedResponse = new Dataset(); - $expectedResponse->setName($name); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setDescription($description); - $expectedResponse->setDataItemCount($dataItemCount); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->projectName('[PROJECT]'); - $dataset = new Dataset(); - $response = $gapicClient->createDataset($formattedParent, $dataset); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.datalabeling.v1beta1.DataLabelingService/CreateDataset', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualRequestObject->getDataset(); - $this->assertProtobufEquals($dataset, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function createDatasetExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->projectName('[PROJECT]'); - $dataset = new Dataset(); - try { - $gapicClient->createDataset($formattedParent, $dataset); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function createEvaluationJobTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name = 'name3373707'; - $description = 'description-1724546052'; - $schedule = 'schedule-697920873'; - $modelVersion = 'modelVersion-1669102142'; - $annotationSpecSet = 'annotationSpecSet1881405678'; - $labelMissingGroundTruth = false; - $expectedResponse = new EvaluationJob(); - $expectedResponse->setName($name); - $expectedResponse->setDescription($description); - $expectedResponse->setSchedule($schedule); - $expectedResponse->setModelVersion($modelVersion); - $expectedResponse->setAnnotationSpecSet($annotationSpecSet); - $expectedResponse->setLabelMissingGroundTruth($labelMissingGroundTruth); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->projectName('[PROJECT]'); - $job = new EvaluationJob(); - $response = $gapicClient->createEvaluationJob($formattedParent, $job); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.datalabeling.v1beta1.DataLabelingService/CreateEvaluationJob', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualRequestObject->getJob(); - $this->assertProtobufEquals($job, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function createEvaluationJobExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->projectName('[PROJECT]'); - $job = new EvaluationJob(); - try { - $gapicClient->createEvaluationJob($formattedParent, $job); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function createInstructionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/createInstructionTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $displayName = 'displayName1615086568'; - $description = 'description-1724546052'; - $expectedResponse = new Instruction(); - $expectedResponse->setName($name); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setDescription($description); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/createInstructionTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->projectName('[PROJECT]'); - $instruction = new Instruction(); - $response = $gapicClient->createInstruction($formattedParent, $instruction); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.datalabeling.v1beta1.DataLabelingService/CreateInstruction', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getInstruction(); - $this->assertProtobufEquals($instruction, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createInstructionTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function createInstructionExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/createInstructionTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->projectName('[PROJECT]'); - $instruction = new Instruction(); - $response = $gapicClient->createInstruction($formattedParent, $instruction); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createInstructionTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteAnnotatedDatasetTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new GPBEmpty(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->annotatedDatasetName('[PROJECT]', '[DATASET]', '[ANNOTATED_DATASET]'); - $gapicClient->deleteAnnotatedDataset($formattedName); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.datalabeling.v1beta1.DataLabelingService/DeleteAnnotatedDataset', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteAnnotatedDatasetExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->annotatedDatasetName('[PROJECT]', '[DATASET]', '[ANNOTATED_DATASET]'); - try { - $gapicClient->deleteAnnotatedDataset($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteAnnotationSpecSetTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new GPBEmpty(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->annotationSpecSetName('[PROJECT]', '[ANNOTATION_SPEC_SET]'); - $gapicClient->deleteAnnotationSpecSet($formattedName); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.datalabeling.v1beta1.DataLabelingService/DeleteAnnotationSpecSet', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteAnnotationSpecSetExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->annotationSpecSetName('[PROJECT]', '[ANNOTATION_SPEC_SET]'); - try { - $gapicClient->deleteAnnotationSpecSet($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteDatasetTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new GPBEmpty(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->datasetName('[PROJECT]', '[DATASET]'); - $gapicClient->deleteDataset($formattedName); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.datalabeling.v1beta1.DataLabelingService/DeleteDataset', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteDatasetExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->datasetName('[PROJECT]', '[DATASET]'); - try { - $gapicClient->deleteDataset($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteEvaluationJobTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new GPBEmpty(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->evaluationJobName('[PROJECT]', '[EVALUATION_JOB]'); - $gapicClient->deleteEvaluationJob($formattedName); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.datalabeling.v1beta1.DataLabelingService/DeleteEvaluationJob', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteEvaluationJobExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->evaluationJobName('[PROJECT]', '[EVALUATION_JOB]'); - try { - $gapicClient->deleteEvaluationJob($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteInstructionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new GPBEmpty(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->instructionName('[PROJECT]', '[INSTRUCTION]'); - $gapicClient->deleteInstruction($formattedName); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.datalabeling.v1beta1.DataLabelingService/DeleteInstruction', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteInstructionExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->instructionName('[PROJECT]', '[INSTRUCTION]'); - try { - $gapicClient->deleteInstruction($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function exportDataTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/exportDataTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $dataset = 'dataset1443214456'; - $totalCount = 407761836; - $exportCount = 529256252; - $expectedResponse = new ExportDataOperationResponse(); - $expectedResponse->setDataset($dataset); - $expectedResponse->setTotalCount($totalCount); - $expectedResponse->setExportCount($exportCount); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/exportDataTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->datasetName('[PROJECT]', '[DATASET]'); - $formattedAnnotatedDataset = $gapicClient->annotatedDatasetName('[PROJECT]', '[DATASET]', '[ANNOTATED_DATASET]'); - $outputConfig = new OutputConfig(); - $response = $gapicClient->exportData($formattedName, $formattedAnnotatedDataset, $outputConfig); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.datalabeling.v1beta1.DataLabelingService/ExportData', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $actualValue = $actualApiRequestObject->getAnnotatedDataset(); - $this->assertProtobufEquals($formattedAnnotatedDataset, $actualValue); - $actualValue = $actualApiRequestObject->getOutputConfig(); - $this->assertProtobufEquals($outputConfig, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/exportDataTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function exportDataExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/exportDataTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->datasetName('[PROJECT]', '[DATASET]'); - $formattedAnnotatedDataset = $gapicClient->annotatedDatasetName('[PROJECT]', '[DATASET]', '[ANNOTATED_DATASET]'); - $outputConfig = new OutputConfig(); - $response = $gapicClient->exportData($formattedName, $formattedAnnotatedDataset, $outputConfig); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/exportDataTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function getAnnotatedDatasetTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $displayName = 'displayName1615086568'; - $description = 'description-1724546052'; - $exampleCount = 1517063674; - $completedExampleCount = 612567290; - $expectedResponse = new AnnotatedDataset(); - $expectedResponse->setName($name2); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setDescription($description); - $expectedResponse->setExampleCount($exampleCount); - $expectedResponse->setCompletedExampleCount($completedExampleCount); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->annotatedDatasetName('[PROJECT]', '[DATASET]', '[ANNOTATED_DATASET]'); - $response = $gapicClient->getAnnotatedDataset($formattedName); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.datalabeling.v1beta1.DataLabelingService/GetAnnotatedDataset', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getAnnotatedDatasetExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->annotatedDatasetName('[PROJECT]', '[DATASET]', '[ANNOTATED_DATASET]'); - try { - $gapicClient->getAnnotatedDataset($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getAnnotationSpecSetTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $displayName = 'displayName1615086568'; - $description = 'description-1724546052'; - $expectedResponse = new AnnotationSpecSet(); - $expectedResponse->setName($name2); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setDescription($description); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->annotationSpecSetName('[PROJECT]', '[ANNOTATION_SPEC_SET]'); - $response = $gapicClient->getAnnotationSpecSet($formattedName); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.datalabeling.v1beta1.DataLabelingService/GetAnnotationSpecSet', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getAnnotationSpecSetExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->annotationSpecSetName('[PROJECT]', '[ANNOTATION_SPEC_SET]'); - try { - $gapicClient->getAnnotationSpecSet($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getDataItemTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $expectedResponse = new DataItem(); - $expectedResponse->setName($name2); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->dataItemName('[PROJECT]', '[DATASET]', '[DATA_ITEM]'); - $response = $gapicClient->getDataItem($formattedName); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.datalabeling.v1beta1.DataLabelingService/GetDataItem', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getDataItemExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->dataItemName('[PROJECT]', '[DATASET]', '[DATA_ITEM]'); - try { - $gapicClient->getDataItem($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getDatasetTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $displayName = 'displayName1615086568'; - $description = 'description-1724546052'; - $dataItemCount = 2014260376; - $expectedResponse = new Dataset(); - $expectedResponse->setName($name2); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setDescription($description); - $expectedResponse->setDataItemCount($dataItemCount); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->datasetName('[PROJECT]', '[DATASET]'); - $response = $gapicClient->getDataset($formattedName); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.datalabeling.v1beta1.DataLabelingService/GetDataset', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getDatasetExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->datasetName('[PROJECT]', '[DATASET]'); - try { - $gapicClient->getDataset($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getEvaluationTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $evaluatedItemCount = 358077111; - $expectedResponse = new Evaluation(); - $expectedResponse->setName($name2); - $expectedResponse->setEvaluatedItemCount($evaluatedItemCount); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->evaluationName('[PROJECT]', '[DATASET]', '[EVALUATION]'); - $response = $gapicClient->getEvaluation($formattedName); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.datalabeling.v1beta1.DataLabelingService/GetEvaluation', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getEvaluationExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->evaluationName('[PROJECT]', '[DATASET]', '[EVALUATION]'); - try { - $gapicClient->getEvaluation($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getEvaluationJobTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $description = 'description-1724546052'; - $schedule = 'schedule-697920873'; - $modelVersion = 'modelVersion-1669102142'; - $annotationSpecSet = 'annotationSpecSet1881405678'; - $labelMissingGroundTruth = false; - $expectedResponse = new EvaluationJob(); - $expectedResponse->setName($name2); - $expectedResponse->setDescription($description); - $expectedResponse->setSchedule($schedule); - $expectedResponse->setModelVersion($modelVersion); - $expectedResponse->setAnnotationSpecSet($annotationSpecSet); - $expectedResponse->setLabelMissingGroundTruth($labelMissingGroundTruth); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->evaluationJobName('[PROJECT]', '[EVALUATION_JOB]'); - $response = $gapicClient->getEvaluationJob($formattedName); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.datalabeling.v1beta1.DataLabelingService/GetEvaluationJob', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getEvaluationJobExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->evaluationJobName('[PROJECT]', '[EVALUATION_JOB]'); - try { - $gapicClient->getEvaluationJob($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExampleTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $expectedResponse = new Example(); - $expectedResponse->setName($name2); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->exampleName('[PROJECT]', '[DATASET]', '[ANNOTATED_DATASET]', '[EXAMPLE]'); - $response = $gapicClient->getExample($formattedName); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.datalabeling.v1beta1.DataLabelingService/GetExample', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExampleExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->exampleName('[PROJECT]', '[DATASET]', '[ANNOTATED_DATASET]', '[EXAMPLE]'); - try { - $gapicClient->getExample($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getInstructionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $displayName = 'displayName1615086568'; - $description = 'description-1724546052'; - $expectedResponse = new Instruction(); - $expectedResponse->setName($name2); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setDescription($description); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->instructionName('[PROJECT]', '[INSTRUCTION]'); - $response = $gapicClient->getInstruction($formattedName); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.datalabeling.v1beta1.DataLabelingService/GetInstruction', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getInstructionExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->instructionName('[PROJECT]', '[INSTRUCTION]'); - try { - $gapicClient->getInstruction($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function importDataTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/importDataTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $dataset = 'dataset1443214456'; - $totalCount = 407761836; - $importCount = 1721296907; - $expectedResponse = new ImportDataOperationResponse(); - $expectedResponse->setDataset($dataset); - $expectedResponse->setTotalCount($totalCount); - $expectedResponse->setImportCount($importCount); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/importDataTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->datasetName('[PROJECT]', '[DATASET]'); - $inputConfig = new InputConfig(); - $response = $gapicClient->importData($formattedName, $inputConfig); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.datalabeling.v1beta1.DataLabelingService/ImportData', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $actualValue = $actualApiRequestObject->getInputConfig(); - $this->assertProtobufEquals($inputConfig, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/importDataTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function importDataExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/importDataTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->datasetName('[PROJECT]', '[DATASET]'); - $inputConfig = new InputConfig(); - $response = $gapicClient->importData($formattedName, $inputConfig); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/importDataTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function labelImageTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/labelImageTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $displayName = 'displayName1615086568'; - $description = 'description-1724546052'; - $exampleCount = 1517063674; - $completedExampleCount = 612567290; - $expectedResponse = new AnnotatedDataset(); - $expectedResponse->setName($name); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setDescription($description); - $expectedResponse->setExampleCount($exampleCount); - $expectedResponse->setCompletedExampleCount($completedExampleCount); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/labelImageTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->datasetName('[PROJECT]', '[DATASET]'); - $basicConfig = new HumanAnnotationConfig(); - $basicConfigInstruction = 'basicConfigInstruction-1726324386'; - $basicConfig->setInstruction($basicConfigInstruction); - $basicConfigAnnotatedDatasetDisplayName = 'basicConfigAnnotatedDatasetDisplayName568435293'; - $basicConfig->setAnnotatedDatasetDisplayName($basicConfigAnnotatedDatasetDisplayName); - $feature = Feature::FEATURE_UNSPECIFIED; - $response = $gapicClient->labelImage($formattedParent, $basicConfig, $feature); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.datalabeling.v1beta1.DataLabelingService/LabelImage', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getBasicConfig(); - $this->assertProtobufEquals($basicConfig, $actualValue); - $actualValue = $actualApiRequestObject->getFeature(); - $this->assertProtobufEquals($feature, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/labelImageTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function labelImageExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/labelImageTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->datasetName('[PROJECT]', '[DATASET]'); - $basicConfig = new HumanAnnotationConfig(); - $basicConfigInstruction = 'basicConfigInstruction-1726324386'; - $basicConfig->setInstruction($basicConfigInstruction); - $basicConfigAnnotatedDatasetDisplayName = 'basicConfigAnnotatedDatasetDisplayName568435293'; - $basicConfig->setAnnotatedDatasetDisplayName($basicConfigAnnotatedDatasetDisplayName); - $feature = Feature::FEATURE_UNSPECIFIED; - $response = $gapicClient->labelImage($formattedParent, $basicConfig, $feature); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/labelImageTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function labelTextTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/labelTextTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $displayName = 'displayName1615086568'; - $description = 'description-1724546052'; - $exampleCount = 1517063674; - $completedExampleCount = 612567290; - $expectedResponse = new AnnotatedDataset(); - $expectedResponse->setName($name); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setDescription($description); - $expectedResponse->setExampleCount($exampleCount); - $expectedResponse->setCompletedExampleCount($completedExampleCount); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/labelTextTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->datasetName('[PROJECT]', '[DATASET]'); - $basicConfig = new HumanAnnotationConfig(); - $basicConfigInstruction = 'basicConfigInstruction-1726324386'; - $basicConfig->setInstruction($basicConfigInstruction); - $basicConfigAnnotatedDatasetDisplayName = 'basicConfigAnnotatedDatasetDisplayName568435293'; - $basicConfig->setAnnotatedDatasetDisplayName($basicConfigAnnotatedDatasetDisplayName); - $feature = \Google\Cloud\DataLabeling\V1beta1\LabelTextRequest\Feature::FEATURE_UNSPECIFIED; - $response = $gapicClient->labelText($formattedParent, $basicConfig, $feature); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.datalabeling.v1beta1.DataLabelingService/LabelText', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getBasicConfig(); - $this->assertProtobufEquals($basicConfig, $actualValue); - $actualValue = $actualApiRequestObject->getFeature(); - $this->assertProtobufEquals($feature, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/labelTextTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function labelTextExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/labelTextTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->datasetName('[PROJECT]', '[DATASET]'); - $basicConfig = new HumanAnnotationConfig(); - $basicConfigInstruction = 'basicConfigInstruction-1726324386'; - $basicConfig->setInstruction($basicConfigInstruction); - $basicConfigAnnotatedDatasetDisplayName = 'basicConfigAnnotatedDatasetDisplayName568435293'; - $basicConfig->setAnnotatedDatasetDisplayName($basicConfigAnnotatedDatasetDisplayName); - $feature = \Google\Cloud\DataLabeling\V1beta1\LabelTextRequest\Feature::FEATURE_UNSPECIFIED; - $response = $gapicClient->labelText($formattedParent, $basicConfig, $feature); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/labelTextTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function labelVideoTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/labelVideoTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $displayName = 'displayName1615086568'; - $description = 'description-1724546052'; - $exampleCount = 1517063674; - $completedExampleCount = 612567290; - $expectedResponse = new AnnotatedDataset(); - $expectedResponse->setName($name); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setDescription($description); - $expectedResponse->setExampleCount($exampleCount); - $expectedResponse->setCompletedExampleCount($completedExampleCount); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/labelVideoTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->datasetName('[PROJECT]', '[DATASET]'); - $basicConfig = new HumanAnnotationConfig(); - $basicConfigInstruction = 'basicConfigInstruction-1726324386'; - $basicConfig->setInstruction($basicConfigInstruction); - $basicConfigAnnotatedDatasetDisplayName = 'basicConfigAnnotatedDatasetDisplayName568435293'; - $basicConfig->setAnnotatedDatasetDisplayName($basicConfigAnnotatedDatasetDisplayName); - $feature = \Google\Cloud\DataLabeling\V1beta1\LabelVideoRequest\Feature::FEATURE_UNSPECIFIED; - $response = $gapicClient->labelVideo($formattedParent, $basicConfig, $feature); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.datalabeling.v1beta1.DataLabelingService/LabelVideo', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getBasicConfig(); - $this->assertProtobufEquals($basicConfig, $actualValue); - $actualValue = $actualApiRequestObject->getFeature(); - $this->assertProtobufEquals($feature, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/labelVideoTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function labelVideoExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/labelVideoTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->datasetName('[PROJECT]', '[DATASET]'); - $basicConfig = new HumanAnnotationConfig(); - $basicConfigInstruction = 'basicConfigInstruction-1726324386'; - $basicConfig->setInstruction($basicConfigInstruction); - $basicConfigAnnotatedDatasetDisplayName = 'basicConfigAnnotatedDatasetDisplayName568435293'; - $basicConfig->setAnnotatedDatasetDisplayName($basicConfigAnnotatedDatasetDisplayName); - $feature = \Google\Cloud\DataLabeling\V1beta1\LabelVideoRequest\Feature::FEATURE_UNSPECIFIED; - $response = $gapicClient->labelVideo($formattedParent, $basicConfig, $feature); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/labelVideoTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function listAnnotatedDatasetsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $annotatedDatasetsElement = new AnnotatedDataset(); - $annotatedDatasets = [ - $annotatedDatasetsElement, - ]; - $expectedResponse = new ListAnnotatedDatasetsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setAnnotatedDatasets($annotatedDatasets); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->datasetName('[PROJECT]', '[DATASET]'); - $response = $gapicClient->listAnnotatedDatasets($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getAnnotatedDatasets()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.datalabeling.v1beta1.DataLabelingService/ListAnnotatedDatasets', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listAnnotatedDatasetsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->datasetName('[PROJECT]', '[DATASET]'); - try { - $gapicClient->listAnnotatedDatasets($formattedParent); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listAnnotationSpecSetsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $annotationSpecSetsElement = new AnnotationSpecSet(); - $annotationSpecSets = [ - $annotationSpecSetsElement, - ]; - $expectedResponse = new ListAnnotationSpecSetsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setAnnotationSpecSets($annotationSpecSets); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->projectName('[PROJECT]'); - $response = $gapicClient->listAnnotationSpecSets($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getAnnotationSpecSets()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.datalabeling.v1beta1.DataLabelingService/ListAnnotationSpecSets', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listAnnotationSpecSetsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->projectName('[PROJECT]'); - try { - $gapicClient->listAnnotationSpecSets($formattedParent); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listDataItemsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $dataItemsElement = new DataItem(); - $dataItems = [ - $dataItemsElement, - ]; - $expectedResponse = new ListDataItemsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setDataItems($dataItems); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->datasetName('[PROJECT]', '[DATASET]'); - $response = $gapicClient->listDataItems($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getDataItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.datalabeling.v1beta1.DataLabelingService/ListDataItems', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listDataItemsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->datasetName('[PROJECT]', '[DATASET]'); - try { - $gapicClient->listDataItems($formattedParent); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listDatasetsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $datasetsElement = new Dataset(); - $datasets = [ - $datasetsElement, - ]; - $expectedResponse = new ListDatasetsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setDatasets($datasets); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->projectName('[PROJECT]'); - $response = $gapicClient->listDatasets($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getDatasets()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.datalabeling.v1beta1.DataLabelingService/ListDatasets', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listDatasetsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->projectName('[PROJECT]'); - try { - $gapicClient->listDatasets($formattedParent); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listEvaluationJobsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $evaluationJobsElement = new EvaluationJob(); - $evaluationJobs = [ - $evaluationJobsElement, - ]; - $expectedResponse = new ListEvaluationJobsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setEvaluationJobs($evaluationJobs); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->projectName('[PROJECT]'); - $response = $gapicClient->listEvaluationJobs($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getEvaluationJobs()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.datalabeling.v1beta1.DataLabelingService/ListEvaluationJobs', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listEvaluationJobsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->projectName('[PROJECT]'); - try { - $gapicClient->listEvaluationJobs($formattedParent); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExamplesTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $examplesElement = new Example(); - $examples = [ - $examplesElement, - ]; - $expectedResponse = new ListExamplesResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setExamples($examples); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->annotatedDatasetName('[PROJECT]', '[DATASET]', '[ANNOTATED_DATASET]'); - $response = $gapicClient->listExamples($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getExamples()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.datalabeling.v1beta1.DataLabelingService/ListExamples', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExamplesExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->annotatedDatasetName('[PROJECT]', '[DATASET]', '[ANNOTATED_DATASET]'); - try { - $gapicClient->listExamples($formattedParent); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listInstructionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $instructionsElement = new Instruction(); - $instructions = [ - $instructionsElement, - ]; - $expectedResponse = new ListInstructionsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setInstructions($instructions); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->projectName('[PROJECT]'); - $response = $gapicClient->listInstructions($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getInstructions()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.datalabeling.v1beta1.DataLabelingService/ListInstructions', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listInstructionsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->projectName('[PROJECT]'); - try { - $gapicClient->listInstructions($formattedParent); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function pauseEvaluationJobTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new GPBEmpty(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->evaluationJobName('[PROJECT]', '[EVALUATION_JOB]'); - $gapicClient->pauseEvaluationJob($formattedName); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.datalabeling.v1beta1.DataLabelingService/PauseEvaluationJob', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function pauseEvaluationJobExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->evaluationJobName('[PROJECT]', '[EVALUATION_JOB]'); - try { - $gapicClient->pauseEvaluationJob($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function resumeEvaluationJobTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new GPBEmpty(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->evaluationJobName('[PROJECT]', '[EVALUATION_JOB]'); - $gapicClient->resumeEvaluationJob($formattedName); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.datalabeling.v1beta1.DataLabelingService/ResumeEvaluationJob', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function resumeEvaluationJobExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->evaluationJobName('[PROJECT]', '[EVALUATION_JOB]'); - try { - $gapicClient->resumeEvaluationJob($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function searchEvaluationsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $evaluationsElement = new Evaluation(); - $evaluations = [ - $evaluationsElement, - ]; - $expectedResponse = new SearchEvaluationsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setEvaluations($evaluations); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->evaluationName('[PROJECT]', '[DATASET]', '[EVALUATION]'); - $response = $gapicClient->searchEvaluations($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getEvaluations()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.datalabeling.v1beta1.DataLabelingService/SearchEvaluations', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function searchEvaluationsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->evaluationName('[PROJECT]', '[DATASET]', '[EVALUATION]'); - try { - $gapicClient->searchEvaluations($formattedParent); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function searchExampleComparisonsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $exampleComparisonsElement = new ExampleComparison(); - $exampleComparisons = [ - $exampleComparisonsElement, - ]; - $expectedResponse = new SearchExampleComparisonsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setExampleComparisons($exampleComparisons); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->evaluationName('[PROJECT]', '[DATASET]', '[EVALUATION]'); - $response = $gapicClient->searchExampleComparisons($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getExampleComparisons()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.datalabeling.v1beta1.DataLabelingService/SearchExampleComparisons', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function searchExampleComparisonsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->evaluationName('[PROJECT]', '[DATASET]', '[EVALUATION]'); - try { - $gapicClient->searchExampleComparisons($formattedParent); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function updateEvaluationJobTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name = 'name3373707'; - $description = 'description-1724546052'; - $schedule = 'schedule-697920873'; - $modelVersion = 'modelVersion-1669102142'; - $annotationSpecSet = 'annotationSpecSet1881405678'; - $labelMissingGroundTruth = false; - $expectedResponse = new EvaluationJob(); - $expectedResponse->setName($name); - $expectedResponse->setDescription($description); - $expectedResponse->setSchedule($schedule); - $expectedResponse->setModelVersion($modelVersion); - $expectedResponse->setAnnotationSpecSet($annotationSpecSet); - $expectedResponse->setLabelMissingGroundTruth($labelMissingGroundTruth); - $transport->addResponse($expectedResponse); - // Mock request - $evaluationJob = new EvaluationJob(); - $response = $gapicClient->updateEvaluationJob($evaluationJob); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.datalabeling.v1beta1.DataLabelingService/UpdateEvaluationJob', $actualFuncCall); - $actualValue = $actualRequestObject->getEvaluationJob(); - $this->assertProtobufEquals($evaluationJob, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function updateEvaluationJobExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $evaluationJob = new EvaluationJob(); - try { - $gapicClient->updateEvaluationJob($evaluationJob); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } -}