Skip to content

Commit

Permalink
Excavator: Upgrade API Version
Browse files Browse the repository at this point in the history
  • Loading branch information
svc-excavator-bot committed Jan 26, 2025
1 parent 7a0493a commit 448a2a9
Showing 111 changed files with 31,020 additions and 410 deletions.
64 changes: 47 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -202,27 +202,61 @@ the [Pydantic error documentation](https://docs.pydantic.dev/latest/errors/error
experience. See [Static Type Analysis](#static-types) below for more information.

### HTTP exceptions
When an HTTP error status is returned, a `PalantirRPCException` is thrown.
When an HTTP error status is returned, a `PalantirRPCException` is thrown. There are several
subclasses that be caught for more specific conditions, all of which inherit from
`PalantirRPCException`.


| Status Code | Error Class |
| ----------- | -------------------------- |
| 400 | `BadRequestError` |
| 401 | `UnauthorizedError` |
| 403 | `PermissionDeniedError` |
| 404 | `NotFoundError` |
| 422 | `UnprocessableEntityError` |
| 429 | `RateLimitError` |
| >=500,<600 | `InternalServerError` |
| Other | `PalantirRPCException` |

```python
from foundry import PalantirRPCException
from foundry import NotFoundError
from foundry import RateLimitError


try:
api_response = foundry_client.datasets.Transaction.abort(dataset_rid, transaction_rid)
...
except NotFoundError as e:
print("Dataset or Transaction not found", e)
except RateLimitError as e:
print("We are aborting too many Transactions", e)
except PalantirRPCException as e:
print("Another HTTP exception occurred: " + str(e))
print("Another HTTP exception occurred", e)
```

This exception will have the following properties. See the [Foundry API docs](https://www.palantir.com/docs/foundry/api/general/overview/errors) for details about the Foundry error information.
All HTTP exceptions will have the following properties. See the [Foundry API docs](https://www.palantir.com/docs/foundry/api/general/overview/errors) for details about the Foundry error information.

| Property | Type | Description |
| ----------------- | -----------------------| ------------------------------------------------------------------------------------------------------------------------------ |
| name | str | The Palantir error name. See the [Foundry API docs](https://www.palantir.com/docs/foundry/api/general/overview/errors). |
| error_instance_id | str | The Palantir error instance ID. See the [Foundry API docs](https://www.palantir.com/docs/foundry/api/general/overview/errors). |
| parameters | Dict[str, Any] | The Palantir error parameters. See the [Foundry API docs](https://www.palantir.com/docs/foundry/api/general/overview/errors). |

### Other exceptions
There are a handful of other exception classes that could be thrown when instantiating or using a client.

| ErrorClass | Thrown Directly | Description |
| ------------------------ | --------------- | --------------------------------------------------------------------------------------------------------------------------------- |
| NotAuthenticated | Yes | You used either `ConfidentialClientAuth` or `PublicClientAuth` to make an API call without going through the OAuth process first. |
| ConnectionError | Yes | An issue occurred when connecting to the server. This also catches both `ProxyError` and `SSLError`. |
| ProxyError | Yes | An issue occurred when connecting to or authenticating with a proxy server. |
| SSLError | Yes | An SSL error occurred when connecting to the server. |
| TimeoutError | No | The request timed out. This catches both `ConnectTimeout` and `ReadTimeout`. |
| ConnectTimeout | Yes | The request timed out when attempting to connect to the server. |
| ReadTimeout | Yes | The server did not send any data in the allotted amount of time. |
| StreamConsumedError | Yes | The content of the given stream has already been consumed. |
| SDKInternalError | Yes | An unexpected issue occurred and should be reported. |

<a id="pagination"></a>
## Pagination
@@ -251,26 +285,20 @@ while page.next_page_token:

<a id="binary-streaming"></a>
## Streaming
This SDK supports optionally streaming binary data using a flag in the method definition.
This SDK supports streaming binary data using a separate streaming client accessible under
`with_streaming_response` on each Resource. To ensure the stream is closed, you need to use a context
manager when making a request with this client.

```python
# Non-streaming response
with open("profile_picture.png", "rb") as f:
with open("profile_picture.png", "wb") as f:
f.write(foundry_client.admin.User.profile_picture(user_id))

# Streaming response
with open("profile_picture.png", "rb") as f:
for chunk in foundry_client.admin.User.profile_picture(user_id, stream=True):
f.write(chunk)
```

This flag is available on all endpoints which return binary data. Additionally, you can set a desired `chunk_size` to read into memory before
the next chunk is given to you. By default, this value is set to None and chunks will be returned to you as they are received from the host.

```python
with open("profile_picture.png", "rb") as f:
for chunk in foundry_client.admin.User.profile_picture(user_id, stream=True, chunk_size=1024):
f.write(chunk)
with open("profile_picture.png", "wb") as f:
with foundry_client.admin.User.with_streaming_response.profile_picture(user_id) as response:
for chunk in response.iter_bytes():
f.write(chunk)
```

<a id="static-types"></a>
@@ -1401,6 +1429,7 @@ Namespace | Resource | Operation | HTTP request |
- [SearchJsonQueryV2Dict](docs/v2/models/SearchJsonQueryV2Dict.md)
- [SearchObjectsResponseV2](docs/v2/models/SearchObjectsResponseV2.md)
- [SearchObjectsResponseV2Dict](docs/v2/models/SearchObjectsResponseV2Dict.md)
- [SearchOrderByType](docs/v2/models/SearchOrderByType.md)
- [SearchOrderByV2Dict](docs/v2/models/SearchOrderByV2Dict.md)
- [SearchOrderingV2Dict](docs/v2/models/SearchOrderingV2Dict.md)
- [SelectedPropertyApiName](docs/v2/models/SelectedPropertyApiName.md)
@@ -1811,6 +1840,7 @@ Namespace | Resource | Operation | HTTP request |
- [SearchObjectsResponse](docs/v1/models/SearchObjectsResponse.md)
- [SearchObjectsResponseDict](docs/v1/models/SearchObjectsResponseDict.md)
- [SearchOrderByDict](docs/v1/models/SearchOrderByDict.md)
- [SearchOrderByType](docs/v1/models/SearchOrderByType.md)
- [SearchOrderingDict](docs/v1/models/SearchOrderingDict.md)
- [SelectedPropertyApiName](docs/v1/models/SelectedPropertyApiName.md)
- [SharedPropertyTypeApiName](docs/v1/models/SharedPropertyTypeApiName.md)
11 changes: 11 additions & 0 deletions docs/v1/ontologies/models/SearchOrderByType.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# SearchOrderByType

SearchOrderByType

| **Value** |
| --------- |
| `"fields"` |
| `"relevance"` |


[[Back to Model list]](../../../../README.md#models-v1-link) [[Back to API list]](../../../../README.md#apis-v1-link) [[Back to README]](../../../../README.md)
11 changes: 11 additions & 0 deletions docs/v2/ontologies/models/SearchOrderByType.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# SearchOrderByType

SearchOrderByType

| **Value** |
| --------- |
| `"fields"` |
| `"relevance"` |


[[Back to Model list]](../../../../README.md#models-v2-link) [[Back to API list]](../../../../README.md#apis-v2-link) [[Back to README]](../../../../README.md)
3 changes: 2 additions & 1 deletion docs/v2/ontologies/models/SearchOrderByV2Dict.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# SearchOrderByV2Dict

Specifies the ordering of search results by a field and an ordering direction.
Specifies the ordering of search results by a field and an ordering direction or by relevance if scores are required in a nearestNeighbors query. By default `orderType` is set to `fields`.

## Properties
| Name | Type | Required | Description |
| ------------ | ------------- | ------------- | ------------- |
**orderType** | NotRequired[SearchOrderByType] | No | |
**fields** | List[SearchOrderingV2Dict] | Yes | |


35 changes: 34 additions & 1 deletion foundry/__init__.py
Original file line number Diff line number Diff line change
@@ -13,12 +13,32 @@
# limitations under the License.


from foundry._core import ApiResponse
from foundry._core import ConfidentialClientAuth
from foundry._core import Config
from foundry._core import ResourceIterator
from foundry._core import StreamedApiResponse
from foundry._core import StreamingContextManager
from foundry._core import UserTokenAuth
from foundry._errors import BadRequestError
from foundry._errors import ConnectionError
from foundry._errors import ConnectTimeout
from foundry._errors import EnvironmentNotConfigured
from foundry._errors import InternalServerError
from foundry._errors import NotAuthenticated
from foundry._errors import NotFoundError
from foundry._errors import PalantirException
from foundry._errors import PalantirRPCException
from foundry._errors import PermissionDeniedError
from foundry._errors import ProxyError
from foundry._errors import RateLimitError
from foundry._errors import ReadTimeout
from foundry._errors import SDKInternalError
from foundry._errors import SSLError
from foundry._errors import StreamConsumedError
from foundry._errors import TimeoutError
from foundry._errors import UnauthorizedError
from foundry._errors import UnprocessableEntityError

# The OpenAPI document version from the spec information
# See https://swagger.io/specification/#info-object
@@ -36,7 +56,20 @@
"ConfidentialClientAuth",
"UserTokenAuth",
"Config",
"NotAuthenticated",
"PalantirException",
"EnvironmentNotConfigured",
"NotAuthenticated",
"ConnectionError",
"ProxyError",
"SSLError",
"PalantirRPCException",
"BadRequestError",
"UnauthorizedError",
"PermissionDeniedError",
"NotFoundError",
"UnprocessableEntityError",
"RateLimitError",
"InternalServerError",
"SDKInternalError",
"StreamConsumedError",
]
3 changes: 3 additions & 0 deletions foundry/_core/__init__.py
Original file line number Diff line number Diff line change
@@ -14,7 +14,10 @@


from foundry._core.api_client import ApiClient
from foundry._core.api_client import ApiResponse
from foundry._core.api_client import RequestInfo
from foundry._core.api_client import StreamedApiResponse
from foundry._core.api_client import StreamingContextManager
from foundry._core.auth_utils import Auth
from foundry._core.binary_stream import BinaryStream
from foundry._core.confidential_client_auth import ConfidentialClientAuth
Loading

0 comments on commit 448a2a9

Please sign in to comment.