Skip to content

Commit

Permalink
Docs updates and List size constraints (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
jsmith authored Sep 18, 2024
1 parent 8d3ec69 commit e7e4ec8
Show file tree
Hide file tree
Showing 48 changed files with 345 additions and 324 deletions.
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,6 @@ You can install the Python package using `pip`:
pip install foundry-platform-sdk
```

Then, import the package:
```python
import foundry.v2
```

<a id="major-version-link"></a>
## API Versioning
Every endpoint of the Foundry API is versioned using a version number that appears in the URL. For example,
Expand Down Expand Up @@ -86,6 +81,8 @@ You can pass in the hostname and token as keyword arguments when
initializing the `UserTokenAuth`:

```python
import foundry

foundry_client = foundry.v2.FoundryClient(
auth=foundry.UserTokenAuth(
hostname="example.palantirfoundry.com",
Expand All @@ -107,6 +104,8 @@ the sign-in process using the `sign_in_as_service_user` method. As these service
automatically retry all operations one time if a `401` (Unauthorized) error is thrown after refreshing the token.

```python
import foundry

auth = foundry.ConfidentialClientAuth(
client_id=os.environ["CLIENT_ID"],
client_secret=os.environ["CLIENT_SECRET"],
Expand All @@ -124,6 +123,8 @@ auth.sign_in_as_service_user()
After creating the `ConfidentialClientAuth` object, pass it in to the `FoundryClient`,

```python
import foundry.v2

foundry_client = foundry.v2.FoundryClient(auth=auth, hostname="example.palantirfoundry.com")
```

Expand All @@ -135,7 +136,7 @@ purposes.

```python
from foundry.v1 import FoundryClient
from foundry import PalantirRPCException
import foundry
from pprint import pprint

foundry_client = FoundryClient(
Expand All @@ -158,7 +159,7 @@ try:
)
print("The create response:\n")
pprint(api_response)
except PalantirRPCException as e:
except foundry.PalantirRPCException as e:
print("HTTP error when calling Branch.create: %s\n" % e)

```
Expand Down Expand Up @@ -201,7 +202,7 @@ 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. All HTTP error exception classes inherit from `ApiException`.
When an HTTP error status is returned, a `PalantirRPCException` is thrown.

```python
from foundry import PalantirRPCException
Expand Down
7 changes: 7 additions & 0 deletions changelog/@unreleased/pr-22.v2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
type: improvement
improvement:
description: |-
- Docs updates including updating examples and fixing imports
- Adding size constraints around List types when applicable
links:
- https://github.com/palantir/foundry-platform-python/pull/22
20 changes: 10 additions & 10 deletions docs/v1/Datasets/Branch.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Name | Type | Description | Notes |

```python
from foundry.v1 import FoundryClient
from foundry import PalantirRPCException
import foundry
from pprint import pprint

foundry_client = FoundryClient(
Expand All @@ -52,7 +52,7 @@ try:
)
print("The create response:\n")
pprint(api_response)
except PalantirRPCException as e:
except foundry.PalantirRPCException as e:
print("HTTP error when calling Branch.create: %s\n" % e)

```
Expand Down Expand Up @@ -90,7 +90,7 @@ Name | Type | Description | Notes |

```python
from foundry.v1 import FoundryClient
from foundry import PalantirRPCException
import foundry
from pprint import pprint

foundry_client = FoundryClient(
Expand All @@ -110,7 +110,7 @@ try:
)
print("The delete response:\n")
pprint(api_response)
except PalantirRPCException as e:
except foundry.PalantirRPCException as e:
print("HTTP error when calling Branch.delete: %s\n" % e)

```
Expand Down Expand Up @@ -148,7 +148,7 @@ Name | Type | Description | Notes |

```python
from foundry.v1 import FoundryClient
from foundry import PalantirRPCException
import foundry
from pprint import pprint

foundry_client = FoundryClient(
Expand All @@ -168,7 +168,7 @@ try:
)
print("The get response:\n")
pprint(api_response)
except PalantirRPCException as e:
except foundry.PalantirRPCException as e:
print("HTTP error when calling Branch.get: %s\n" % e)

```
Expand Down Expand Up @@ -206,7 +206,7 @@ Name | Type | Description | Notes |

```python
from foundry.v1 import FoundryClient
from foundry import PalantirRPCException
import foundry
from pprint import pprint

foundry_client = FoundryClient(
Expand All @@ -225,7 +225,7 @@ try:
page_size=page_size,
):
pprint(branch)
except PalantirRPCException as e:
except foundry.PalantirRPCException as e:
print("HTTP error when calling Branch.list: %s\n" % e)

```
Expand Down Expand Up @@ -264,7 +264,7 @@ Name | Type | Description | Notes |

```python
from foundry.v1 import FoundryClient
from foundry import PalantirRPCException
import foundry
from pprint import pprint

foundry_client = FoundryClient(
Expand All @@ -287,7 +287,7 @@ try:
)
print("The page response:\n")
pprint(api_response)
except PalantirRPCException as e:
except foundry.PalantirRPCException as e:
print("HTTP error when calling Branch.page: %s\n" % e)

```
Expand Down
24 changes: 12 additions & 12 deletions docs/v1/Datasets/Dataset.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Name | Type | Description | Notes |

```python
from foundry.v1 import FoundryClient
from foundry import PalantirRPCException
import foundry
from pprint import pprint

foundry_client = FoundryClient(
Expand All @@ -46,7 +46,7 @@ try:
)
print("The create response:\n")
pprint(api_response)
except PalantirRPCException as e:
except foundry.PalantirRPCException as e:
print("HTTP error when calling Dataset.create: %s\n" % e)

```
Expand Down Expand Up @@ -83,7 +83,7 @@ Name | Type | Description | Notes |

```python
from foundry.v1 import FoundryClient
from foundry import PalantirRPCException
import foundry
from pprint import pprint

foundry_client = FoundryClient(
Expand All @@ -109,7 +109,7 @@ try:
)
print("The delete_schema response:\n")
pprint(api_response)
except PalantirRPCException as e:
except foundry.PalantirRPCException as e:
print("HTTP error when calling Dataset.delete_schema: %s\n" % e)

```
Expand Down Expand Up @@ -146,7 +146,7 @@ Name | Type | Description | Notes |

```python
from foundry.v1 import FoundryClient
from foundry import PalantirRPCException
import foundry
from pprint import pprint

foundry_client = FoundryClient(
Expand All @@ -163,7 +163,7 @@ try:
)
print("The get response:\n")
pprint(api_response)
except PalantirRPCException as e:
except foundry.PalantirRPCException as e:
print("HTTP error when calling Dataset.get: %s\n" % e)

```
Expand Down Expand Up @@ -200,7 +200,7 @@ Name | Type | Description | Notes |

```python
from foundry.v1 import FoundryClient
from foundry import PalantirRPCException
import foundry
from pprint import pprint

foundry_client = FoundryClient(
Expand All @@ -226,7 +226,7 @@ try:
)
print("The get_schema response:\n")
pprint(api_response)
except PalantirRPCException as e:
except foundry.PalantirRPCException as e:
print("HTTP error when calling Dataset.get_schema: %s\n" % e)

```
Expand Down Expand Up @@ -271,7 +271,7 @@ Name | Type | Description | Notes |

```python
from foundry.v1 import FoundryClient
from foundry import PalantirRPCException
import foundry
from pprint import pprint

foundry_client = FoundryClient(
Expand Down Expand Up @@ -306,7 +306,7 @@ try:
)
print("The read response:\n")
pprint(api_response)
except PalantirRPCException as e:
except foundry.PalantirRPCException as e:
print("HTTP error when calling Dataset.read: %s\n" % e)

```
Expand Down Expand Up @@ -400,7 +400,7 @@ Name | Type | Description | Notes |

```python
from foundry.v1 import FoundryClient
from foundry import PalantirRPCException
import foundry
from pprint import pprint

foundry_client = FoundryClient(
Expand All @@ -426,7 +426,7 @@ try:
)
print("The replace_schema response:\n")
pprint(api_response)
except PalantirRPCException as e:
except foundry.PalantirRPCException as e:
print("HTTP error when calling Dataset.replace_schema: %s\n" % e)

```
Expand Down
24 changes: 12 additions & 12 deletions docs/v1/Datasets/File.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Name | Type | Description | Notes |

```python
from foundry.v1 import FoundryClient
from foundry import PalantirRPCException
import foundry
from pprint import pprint

foundry_client = FoundryClient(
Expand All @@ -70,7 +70,7 @@ try:
)
print("The delete response:\n")
pprint(api_response)
except PalantirRPCException as e:
except foundry.PalantirRPCException as e:
print("HTTP error when calling File.delete: %s\n" % e)

```
Expand Down Expand Up @@ -132,7 +132,7 @@ Name | Type | Description | Notes |

```python
from foundry.v1 import FoundryClient
from foundry import PalantirRPCException
import foundry
from pprint import pprint

foundry_client = FoundryClient(
Expand Down Expand Up @@ -161,7 +161,7 @@ try:
)
print("The get response:\n")
pprint(api_response)
except PalantirRPCException as e:
except foundry.PalantirRPCException as e:
print("HTTP error when calling File.get: %s\n" % e)

```
Expand Down Expand Up @@ -225,7 +225,7 @@ Name | Type | Description | Notes |

```python
from foundry.v1 import FoundryClient
from foundry import PalantirRPCException
import foundry
from pprint import pprint

foundry_client = FoundryClient(
Expand Down Expand Up @@ -253,7 +253,7 @@ try:
start_transaction_rid=start_transaction_rid,
):
pprint(file)
except PalantirRPCException as e:
except foundry.PalantirRPCException as e:
print("HTTP error when calling File.list: %s\n" % e)

```
Expand Down Expand Up @@ -338,7 +338,7 @@ Name | Type | Description | Notes |

```python
from foundry.v1 import FoundryClient
from foundry import PalantirRPCException
import foundry
from pprint import pprint

foundry_client = FoundryClient(
Expand Down Expand Up @@ -370,7 +370,7 @@ try:
)
print("The page response:\n")
pprint(api_response)
except PalantirRPCException as e:
except foundry.PalantirRPCException as e:
print("HTTP error when calling File.page: %s\n" % e)

```
Expand Down Expand Up @@ -433,7 +433,7 @@ Name | Type | Description | Notes |

```python
from foundry.v1 import FoundryClient
from foundry import PalantirRPCException
import foundry
from pprint import pprint

foundry_client = FoundryClient(
Expand Down Expand Up @@ -462,7 +462,7 @@ try:
)
print("The read response:\n")
pprint(api_response)
except PalantirRPCException as e:
except foundry.PalantirRPCException as e:
print("HTTP error when calling File.read: %s\n" % e)

```
Expand Down Expand Up @@ -521,7 +521,7 @@ Name | Type | Description | Notes |

```python
from foundry.v1 import FoundryClient
from foundry import PalantirRPCException
import foundry
from pprint import pprint

foundry_client = FoundryClient(
Expand Down Expand Up @@ -553,7 +553,7 @@ try:
)
print("The upload response:\n")
pprint(api_response)
except PalantirRPCException as e:
except foundry.PalantirRPCException as e:
print("HTTP error when calling File.upload: %s\n" % e)

```
Expand Down
Loading

0 comments on commit e7e4ec8

Please sign in to comment.