Skip to content

Commit 96289de

Browse files
authored
Merge pull request #1 from NarrativeScience/test-client-package
Stitch Connect API client
2 parents 7c0352c + 1444f0b commit 96289de

File tree

127 files changed

+13276
-54
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

127 files changed

+13276
-54
lines changed

.flake8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ ignore = E203,E501,E731,W503,W605
88
import-order-style = google
99
# Packages added in this list should be added to the setup.cfg file as well
1010
application-import-names =
11-
my_package_name
11+
stitch_connect_client
1212
exclude =
1313
*vendor*
1414
.venv

.gitignore

Lines changed: 64 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,64 @@
1-
.DS_Store
2-
.venv*
3-
.vscode
4-
**/__pycache__/
5-
**/.cache/
6-
**/.tox
7-
**/*.coverage
8-
**/*.egg-info
9-
**/*.pyc
10-
**/dist
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
env/
12+
build/
13+
develop-eggs/
14+
dist/
15+
downloads/
16+
eggs/
17+
.eggs/
18+
lib/
19+
lib64/
20+
parts/
21+
sdist/
22+
var/
23+
*.egg-info/
24+
.installed.cfg
25+
*.egg
26+
27+
# PyInstaller
28+
# Usually these files are written by a python script from a template
29+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
30+
*.manifest
31+
*.spec
32+
33+
# Installer logs
34+
pip-log.txt
35+
pip-delete-this-directory.txt
36+
37+
# Unit test / coverage reports
38+
htmlcov/
39+
.tox/
40+
.coverage
41+
.coverage.*
42+
.cache
43+
nosetests.xml
44+
coverage.xml
45+
*,cover
46+
.hypothesis/
47+
venv/
48+
.python-version
49+
50+
# Translations
51+
*.mo
52+
*.pot
53+
54+
# Django stuff:
55+
*.log
56+
57+
# Sphinx documentation
58+
docs/_build/
59+
60+
# PyBuilder
61+
target/
62+
63+
#Ipython Notebook
64+
.ipynb_checkpoints

.openapi-generator-ignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# OpenAPI Generator Ignore
2+
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
3+
4+
# Use this file to prevent files from being overwritten by the generator.
5+
# The patterns follow closely to .gitignore or .dockerignore.
6+
7+
# As an example, the C# client generator defines ApiClient.cs.
8+
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
9+
#ApiClient.cs
10+
11+
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
12+
#foo/*/qux
13+
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
14+
15+
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
16+
#foo/**/qux
17+
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
18+
19+
# You can also negate patterns with an exclamation (!).
20+
# For example, you can ignore all files in a docs folder with the file extension .md:
21+
#docs/*.md
22+
# Then explicitly reverse the ignore rule for a single file:
23+
#!docs/README.md

.openapi-generator/VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
4.2.2

.travis.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# ref: https://docs.travis-ci.com/user/languages/python
2+
language: python
3+
python:
4+
- "2.7"
5+
- "3.2"
6+
- "3.3"
7+
- "3.4"
8+
- "3.5"
9+
#- "3.5-dev" # 3.5 development branch
10+
#- "nightly" # points to the latest development branch e.g. 3.6-dev
11+
# command to install dependencies
12+
install: "pip install -r requirements.txt"
13+
# command to run tests
14+
script: nosetests

README.md

Lines changed: 116 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,126 @@
1-
# my-package-name
1+
# stitch_connect_client
22

3-
[![](https://img.shields.io/pypi/v/my-package-name.svg)](https://pypi.org/pypi/my-package-name/) [![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)
3+
[![](https://img.shields.io/pypi/v/stitch_connect_client.svg)](https://pypi.org/pypi/stitch_connect_client/) [![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)
44

5-
<!-- Short description of the package -->
5+
https://www.stitchdata.com/docs/developers/stitch-connect/api
66

7-
Features:
7+
This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
88

9-
- <!-- list of features -->
9+
- API version: 0.1
10+
- Package version: 0.1.1
11+
- Build package: org.openapitools.codegen.languages.PythonClientCodegen
1012

1113
Table of Contents:
1214

1315
- [Installation](#installation)
1416
- [Guide](#guide)
17+
- [Documentation for API Endpoints](#documentation-for-api-endpoints)
18+
- [Documentation for Models](#documentation-for-models)
19+
- [Documentation for Authorization](#documentation-for-authorization)
1520
- [Development](#development)
1621

1722
## Installation
1823

19-
my-package-name requires Python 3.6 or above.
24+
This package requires Python 3.6 or above.
2025

2126
```bash
22-
pip install my-package-name
27+
pip install stitch_connect_client
2328
```
2429

2530
## Guide
2631

27-
<!-- Subsections explaining how to use the package -->
32+
```python
33+
import stitch_connect_client
34+
from stitch_connect_client.rest import ApiException
35+
36+
37+
configuration = stitch_connect_client.Configuration()
38+
# Configure Bearer authorization: bearerAuth
39+
configuration.access_token = 'YOUR_BEARER_TOKEN'
40+
41+
# Defining host is optional and default to https://api.stitchdata.com
42+
configuration.host = "https://api.stitchdata.com"
43+
# Create an instance of the API class
44+
api_instance = stitch_connect_client.DestinationsApi(stitch_connect_client.ApiClient(configuration))
45+
create_destination_body = stitch_connect_client.CreateDestinationBody() # CreateDestinationBody | Object containing type and properties of a destination
46+
47+
try:
48+
# Creates a new destination. Only a single destination is supported per Stitch client account.
49+
api_response = api_instance.create_destination(create_destination_body)
50+
print(api_response)
51+
except ApiException as e:
52+
print(f"Exception when calling DestinationsApi->create_destination: {e}")
53+
54+
```
55+
56+
## Documentation for API Endpoints
57+
58+
All URIs are relative to *https://api.stitchdata.com*
59+
60+
Class | Method | HTTP request | Description
61+
------------ | ------------- | ------------- | -------------
62+
*DestinationsApi* | [**create_destination**](docs/DestinationsApi.md#create_destination) | **POST** /v4/destinations | Creates a new destination. Only a single destination is supported per Stitch client account.
63+
*DestinationsApi* | [**delete_destination**](docs/DestinationsApi.md#delete_destination) | **DELETE** /v4/destinations/{destination_id} | Deletes an existing destination. Note: Stitch requires a destination to replicate data. Replication will be paused until a new destination is created and has a successful connection.
64+
*DestinationsApi* | [**get_destination_types**](docs/DestinationsApi.md#get_destination_types) | **GET** /v4/destination-types | Retrieves general information about the configuration required for all supported destination types.
65+
*DestinationsApi* | [**get_destinations**](docs/DestinationsApi.md#get_destinations) | **GET** /v4/destinations | Lists the destination currently in use for a Stitch account. Only a single data warehouse is supported per Stitch client account.
66+
*DestinationsApi* | [**update_destination**](docs/DestinationsApi.md#update_destination) | **PUT** /v4/destinations/{destination_id} | Updates an existing destination. Modifications to the type attribute are not supported.
67+
*SourcesApi* | [**create_source**](docs/SourcesApi.md#create_source) | **POST** /v4/sources | Creates a source object, which is the first step in setting up a new data source. After the source object is created, additional configuration steps must be completed.
68+
*SourcesApi* | [**delete_source**](docs/SourcesApi.md#delete_source) | **DELETE** /v4/sources/{source_id} | Deletes an existing data source.
69+
*SourcesApi* | [**get_last_connection_check**](docs/SourcesApi.md#get_last_connection_check) | **GET** /v4/sources/{source_id}/last-connection-check | Retrieves the last connection check for a source by the source’s unique identifier.
70+
*SourcesApi* | [**get_source**](docs/SourcesApi.md#get_source) | **GET** /v4/sources/{source_id} | Retrieves a previously created data source by its unique identifier. This endpoint can be used to retrieve an active, paused, or deleted source.
71+
*SourcesApi* | [**get_sources**](docs/SourcesApi.md#get_sources) | **GET** /v4/sources | Lists the sources for an account, including active, paused, and deleted sources.
72+
*SourcesApi* | [**start_replication**](docs/SourcesApi.md#start_replication) | **POST** /v4/sources/{source_id}/sync | Manually starts a replication job for a source using the source’s unique identifier.
73+
*SourcesApi* | [**update_source**](docs/SourcesApi.md#update_source) | **PUT** /v4/sources/{source_id} | Updates an existing data source.
74+
*StreamsApi* | [**get_stream_schema**](docs/StreamsApi.md#get_stream_schema) | **GET** /v4/sources/{source_id}/streams/{stream_id} | Retrieves the schema for a source’s stream by the source and stream’s unique identifiers.
75+
*StreamsApi* | [**get_streams**](docs/StreamsApi.md#get_streams) | **GET** /v4/sources/{source_id}/streams | Lists the available streams for a source.
76+
*StreamsApi* | [**update_stream_metadata**](docs/StreamsApi.md#update_stream_metadata) | **PUT** /v4/sources/{source_id}/streams/metadata | Updates the metadata for streams and fields. This endpoint is used to define the metadata properties returned in the Stream Schema object’s non-discoverable-metadata-keys property.
77+
78+
79+
## Documentation for Models
80+
81+
- [AzureDestinationFormProperties](docs/AzureDestinationFormProperties.md)
82+
- [ConnectionCheck](docs/ConnectionCheck.md)
83+
- [ConnectionDetails](docs/ConnectionDetails.md)
84+
- [ConnectionStep](docs/ConnectionStep.md)
85+
- [ConnectionStepProps](docs/ConnectionStepProps.md)
86+
- [ConnectionStepPropsAnyOf](docs/ConnectionStepPropsAnyOf.md)
87+
- [ConnectionStepPropsJsonSchema](docs/ConnectionStepPropsJsonSchema.md)
88+
- [CreateDestinationBody](docs/CreateDestinationBody.md)
89+
- [CreateSourceBody](docs/CreateSourceBody.md)
90+
- [Destination](docs/Destination.md)
91+
- [DestinationFormProperties](docs/DestinationFormProperties.md)
92+
- [DestinationReportCard](docs/DestinationReportCard.md)
93+
- [ErrorObject](docs/ErrorObject.md)
94+
- [ErrorObjectError](docs/ErrorObjectError.md)
95+
- [FieldLevelMetadata](docs/FieldLevelMetadata.md)
96+
- [ForcedReplicationMethod](docs/ForcedReplicationMethod.md)
97+
- [HookNotification](docs/HookNotification.md)
98+
- [HookNotificationConfig](docs/HookNotificationConfig.md)
99+
- [Metadata](docs/Metadata.md)
100+
- [MetadataObject](docs/MetadataObject.md)
101+
- [ReplicationJob](docs/ReplicationJob.md)
102+
- [S3DestinationFormProperties](docs/S3DestinationFormProperties.md)
103+
- [SalesforceSourceFormProperties](docs/SalesforceSourceFormProperties.md)
104+
- [Source](docs/Source.md)
105+
- [SourceFormProperties](docs/SourceFormProperties.md)
106+
- [SourceReportCard](docs/SourceReportCard.md)
107+
- [Stream](docs/Stream.md)
108+
- [StreamLevelMetadata](docs/StreamLevelMetadata.md)
109+
- [StreamSchema](docs/StreamSchema.md)
110+
- [UpdateSourceBody](docs/UpdateSourceBody.md)
111+
112+
113+
## Documentation for Authorization
114+
115+
116+
#### bearerAuth
117+
118+
- **Type**: Bearer authentication
119+
28120

29121
## Development
30122

31-
To develop my-package-name, install dependencies and enable the pre-commit hook:
123+
To develop `stitch_connect_client`, install dependencies and enable the pre-commit hook:
32124

33125
```bash
34126
pip install pre-commit tox
@@ -40,3 +132,18 @@ To run tests:
40132
```bash
41133
tox
42134
```
135+
136+
To regenerate the client, run:
137+
138+
```bash
139+
npx openapi-generator generate \
140+
-i https://raw.githubusercontent.com/NarrativeScience/stitch-connect-openapi/master/openapi.yml \
141+
-g python \
142+
-o . \
143+
--library asyncio \
144+
--package-name stitch_connect_client \
145+
--git-user-id NarrativeScience \
146+
--git-repo-id stitch_connect_client \
147+
-p packageVersion=0.1.1 \
148+
-t templates
149+
```
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# AzureDestinationFormProperties
2+
3+
A Azure SQL Data Warehouse connection writes data to a Azure SQL Data Warehouse database and corresponds to destination type: azure_sqldw.
4+
## Properties
5+
Name | Type | Description | Notes
6+
------------ | ------------- | ------------- | -------------
7+
**azure_storage_account_token** | **str** | An Azure Storage Access Key. This is used to access Azure Blob Storage, which Stitch uses to stage data for Polybase before loading it into an Azure SQL Data Warehouse destination. | [optional]
8+
**azure_storage_sas_url** | **str** | An Azure Blob service Shared Access Signature (SAS) URL, which is used to grant Stitch restricted access to Azure Storage resources. These resources are used to load data into an Azure SQL Data Warehouse destination. | [optional]
9+
**database** | **str** | The name of the logical database to connect to. | [optional]
10+
11+
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
12+
13+

docs/ConnectionCheck.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# ConnectionCheck
2+
3+
A Connection Check object shows the results from a test of a connection’s parameters. This is a test performed by Stitch that checks the configuration of a source’s connection parameters. The nature of the test varies by connection type.
4+
## Properties
5+
Name | Type | Description | Notes
6+
------------ | ------------- | ------------- | -------------
7+
**name** | **str** | The name of the connection check job. | [optional]
8+
**mode** | **object** | This value will always be &#x60;check&#x60;. | [optional]
9+
10+
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
11+
12+

docs/ConnectionDetails.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# ConnectionDetails
2+
3+
Contained in a Source or Destination Report Card object, the Details object contains information about a connection type’s availability within Stitch.
4+
## Properties
5+
Name | Type | Description | Notes
6+
------------ | ------------- | ------------- | -------------
7+
**access** | **bool** | Indicates whether the Stitch client who made the request has access to the connection. This value is based on the connection’s pricing_tier and pipeline_state. If the Stitch client is using a plan that doesn’t meet the pricing_tier requirement, the access value will be false. For example: If pricing_tier: enterprise,the Stitch client must be on an Enterprise plan to access the source. All connections with a pipeline_state value of deprecated will also have an access value of false. | [optional]
8+
**default_scheduling_interval** | **int** | Applicable only to source report cards. The default frequency_in_minutes value for the source. | [optional]
9+
**pricing_tier** | **str** | Indicates the type of Stitch plan required to use the connection. Possible values are: standard - Any Stitch plan can use the connection. premium - A Standard Stitch plan is required to use the connection. enterprise - An Enterprise Stitch plan is required to use the connection. | [optional]
10+
**default_start_date** | **str** | Applicable only to source report cards. The default start_date value for the source. | [optional]
11+
**pipeline_state** | **str** | The connection type’s release status in Stitch. Possible values are: alpha - The connection is in development and is not available in Stitch. beta - The connection is in open or closed beta and is available in Stitch. released - The connection is in general release and available in Stitch. deprecated - The connection has been deprecated and is no longer available in Stitch. | [optional]
12+
**protocol** | **str** | The type of the connection. For example: snowflake or platform.facebook | [optional]
13+
14+
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
15+
16+

docs/ConnectionStep.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# ConnectionStep
2+
3+
Contained in a Source or Destination Report Card object, the Connection Steps object contains the steps necessary to configure a data source or destination.
4+
## Properties
5+
Name | Type | Description | Notes
6+
------------ | ------------- | ------------- | -------------
7+
**type** | **str** | The type of step | [optional]
8+
**properties** | [**list[ConnectionStepProps]**](ConnectionStepProps.md) | The destination connection type. For example: postgres or redshift | [optional]
9+
10+
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
11+
12+

0 commit comments

Comments
 (0)