Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[formrecognizer] regenerate on latest #20867

Merged
merged 2 commits into from
Sep 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ def begin_analyze_document(self, model, document, **kwargs):
"prebuilt-document", "prebuilt-layout".
:param document: JPEG, PNG, PDF, TIFF, or BMP type file stream or bytes.
:type document: bytes or IO[bytes]
:keyword list[str] pages: Custom page numbers for multi-page documents(PDF/TIFF). Input the page numbers
:keyword str pages: Custom page numbers for multi-page documents(PDF/TIFF). Input the page numbers
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

latest swagger makes the change from list[str] to str. Since we're mostly just exposing the generated code here, we can do that change and discuss design later in beta2

and/or ranges of pages you want to get in the result. For a range of pages, use a hyphen, like
`pages=["1-3", "5-6"]`. Separate each page number or range with a comma.
`pages="1-3, 5-6"`. Separate each page number or range with a comma.
:keyword str locale: Locale of the document. Supported locales include: en-US, en-AU, en-CA, en-GB,
and en-IN.
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
Expand Down Expand Up @@ -139,9 +139,9 @@ def begin_analyze_document_from_url(self, model, document_url, **kwargs):
"prebuilt-document", "prebuilt-layout".
:param str document_url: The URL of the document to analyze. The input must be a valid, encoded URL
of one of the supported formats: JPEG, PNG, PDF, TIFF, or BMP.
:keyword list[str] pages: Custom page numbers for multi-page documents(PDF/TIFF). Input the page numbers
:keyword str pages: Custom page numbers for multi-page documents(PDF/TIFF). Input the page numbers
and/or ranges of pages you want to get in the result. For a range of pages, use a hyphen, like
`pages=["1-3", "5-6"]`. Separate each page number or range with a comma.
`pages="1-3, 5-6"`. Separate each page number or range with a comma.
:keyword str locale: Locale of the document. Supported locales include: en-US, en-AU, en-CA, en-GB,
and en-IN.
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@
from azure.core.polling import LROPoller
from azure.core.polling.base_polling import LROBasePolling
from azure.core.pipeline import Pipeline
from ._generated.models import (
CopyRequest,
CopyAuthorizationResult,
)
from ._helpers import TransportWrapper
from ._api_versions import FormRecognizerApiVersion
from ._models import (
Expand Down Expand Up @@ -423,10 +419,10 @@ def _copy_callback(raw_response, _, headers): # pylint: disable=unused-argument

return self._client.begin_copy_custom_model( # type: ignore
model_id=model_id,
copy_request=CopyRequest(
copy_request=self._generated_models.CopyRequest(
target_resource_id=target["resourceId"],
target_resource_region=target["resourceRegion"],
copy_authorization=CopyAuthorizationResult(
copy_authorization=self._generated_models.CopyAuthorizationResult(
access_token=target["accessToken"],
model_id=target["modelId"],
expiration_date_time_ticks=target["expirationDateTimeTicks"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ class FormRecognizerClientConfiguration(Configuration):
:param credential: Credential needed for the client to connect to Azure.
:type credential: ~azure.core.credentials.TokenCredential
:param endpoint: Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus2.api.cognitive.microsoft.com).
:param endpoint: Supported Cognitive Services endpoints (protocol and hostname, for
example: https://westus2.api.cognitive.microsoft.com).
:type endpoint: str
"""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ class FormRecognizerClient(FormRecognizerClientOperationsMixin, MultiApiClientMi

:param credential: Credential needed for the client to connect to Azure.
:type credential: ~azure.core.credentials.TokenCredential
:param endpoint: Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus2.api.cognitive.microsoft.com).
:param endpoint: Supported Cognitive Services endpoints (protocol and hostname, for
example: https://westus2.api.cognitive.microsoft.com).
:type endpoint: str
:param api_version: API version to use if no profile is provided, or if missing in profile.
:type api_version: str
Expand All @@ -60,28 +61,6 @@ class FormRecognizerClient(FormRecognizerClientOperationsMixin, MultiApiClientMi
LATEST_PROFILE = ProfileDefinition({
_PROFILE_TAG: {
None: DEFAULT_API_VERSION,
'begin_analyze_business_card_async': '2.1',
'begin_analyze_id_document_async': '2.1',
'begin_analyze_invoice_async': '2.1',
'begin_analyze_layout_async': '2.1',
'begin_analyze_receipt_async': '2.1',
'begin_analyze_with_custom_model': '2.1',
'begin_compose_custom_models_async': '2.1',
'begin_copy_custom_model': '2.1',
'begin_train_custom_model_async': '2.1',
'delete_custom_model': '2.1',
'generate_model_copy_authorization': '2.1',
'get_analyze_business_card_result': '2.1',
'get_analyze_form_result': '2.1',
'get_analyze_id_document_result': '2.1',
'get_analyze_invoice_result': '2.1',
'get_analyze_layout_result': '2.1',
'get_analyze_receipt_result': '2.1',
'get_custom_model': '2.1',
'get_custom_model_copy_result': '2.1',
'get_custom_models': '2.1',
'list_custom_models': '2.1',
'train_custom_model_async': '2.0',
}},
_PROFILE_TAG + " latest"
)
Expand Down Expand Up @@ -117,19 +96,19 @@ def _models_dict(cls, api_version):
def models(cls, api_version=DEFAULT_API_VERSION):
"""Module depends on the API version:

* 2021-09-30-preview: :mod:`v2021_09_30_preview.models<azure.ai.formrecognizer.v2021_09_30_preview.models>`
* 2.0: :mod:`v2_0.models<azure.ai.formrecognizer.v2_0.models>`
* 2.1: :mod:`v2_1.models<azure.ai.formrecognizer.v2_1.models>`
* 2021-09-30-preview: :mod:`v3_0_preview_1.models<azure.ai.formrecognizer.v3_0_preview_1.models>`
"""
if api_version == '2.0':
if api_version == '2021-09-30-preview':
from .v2021_09_30_preview import models
return models
elif api_version == '2.0':
from .v2_0 import models
return models
elif api_version == '2.1':
from .v2_1 import models
return models
elif api_version == '2021-09-30-preview':
from .v3_0_preview_1 import models
return models
raise ValueError("API version {} is not available".format(api_version))

def close(self):
Expand Down
Loading