Skip to content

Commit

Permalink
add support for update and delete schema field (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
jkaho authored May 4, 2022
1 parent b0e84d1 commit 8e71b7d
Show file tree
Hide file tree
Showing 37 changed files with 1,799 additions and 33 deletions.
6 changes: 6 additions & 0 deletions .openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ docs/BatchUpsertRecordsResponseError.md
docs/BatchUpsertRecordsResponseKey.md
docs/BatchUpsertRecordsResponseVariables.md
docs/Collection.md
docs/CollectionType.md
docs/CollectionsApi.md
docs/DeleteRecordRequest.md
docs/Error.md
Expand All @@ -26,10 +27,12 @@ docs/ExperimentRequestPipeline.md
docs/ExperimentResponse.md
docs/GeneratePipelinesRequest.md
docs/GeneratePipelinesResponse.md
docs/GetCollectionRequestView.md
docs/GetDefaultPipelineResponse.md
docs/GetDefaultVersionRequestView.md
docs/GetPipelineRequestView.md
docs/GetRecordRequest.md
docs/ListCollectionsRequestView.md
docs/ListCollectionsResponse.md
docs/ListPipelinesRequestView.md
docs/ListPipelinesResponse.md
Expand Down Expand Up @@ -122,6 +125,7 @@ sajari_client/model/batch_upsert_records_response_error.py
sajari_client/model/batch_upsert_records_response_key.py
sajari_client/model/batch_upsert_records_response_variables.py
sajari_client/model/collection.py
sajari_client/model/collection_type.py
sajari_client/model/delete_record_request.py
sajari_client/model/error.py
sajari_client/model/event.py
Expand All @@ -130,10 +134,12 @@ sajari_client/model/experiment_request_pipeline.py
sajari_client/model/experiment_response.py
sajari_client/model/generate_pipelines_request.py
sajari_client/model/generate_pipelines_response.py
sajari_client/model/get_collection_request_view.py
sajari_client/model/get_default_pipeline_response.py
sajari_client/model/get_default_version_request_view.py
sajari_client/model/get_pipeline_request_view.py
sajari_client/model/get_record_request.py
sajari_client/model/list_collections_request_view.py
sajari_client/model/list_collections_response.py
sajari_client/model/list_pipelines_request_view.py
sajari_client/model/list_pipelines_response.py
Expand Down
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,11 @@ collection = Collection(
],
display_name="display_name_example",
) # Collection | Details of the collection to create.
account_id = "Account-Id_example" # str | The account that owns the collection, e.g. `1618535966441231024`. (optional)

try:
# Create collection
api_response = api_instance.create_collection(collection_id, collection)
api_response = api_instance.create_collection(collection_id, collection, account_id=account_id)
pprint(api_response)
except sajari_client.ApiException as e:
print("Exception when calling CollectionsApi->create_collection: %s\n" % e)
Expand Down Expand Up @@ -140,7 +141,9 @@ Class | Method | HTTP request | Description
*RedirectsApi* | [**update_redirect**](docs/RedirectsApi.md#update_redirect) | **PATCH** /v4/collections/{collection_id}/redirects/{redirect_id} | Update redirect
*SchemaApi* | [**batch_create_schema_fields**](docs/SchemaApi.md#batch_create_schema_fields) | **POST** /v4/collections/{collection_id}/schemaFields:batchCreate | Batch create schema fields
*SchemaApi* | [**create_schema_field**](docs/SchemaApi.md#create_schema_field) | **POST** /v4/collections/{collection_id}/schemaFields | Create schema field
*SchemaApi* | [**delete_schema_field**](docs/SchemaApi.md#delete_schema_field) | **DELETE** /v4/collections/{collection_id}/schemaFields/{schema_field_name} | Delete schema field
*SchemaApi* | [**list_schema_fields**](docs/SchemaApi.md#list_schema_fields) | **GET** /v4/collections/{collection_id}/schemaFields | List schema fields
*SchemaApi* | [**update_schema_field**](docs/SchemaApi.md#update_schema_field) | **PATCH** /v4/collections/{collection_id}/schemaFields/{schema_field_name} | Update schema field


## Documentation For Models
Expand All @@ -161,6 +164,7 @@ Class | Method | HTTP request | Description
- [BatchUpsertRecordsResponseKey](docs/BatchUpsertRecordsResponseKey.md)
- [BatchUpsertRecordsResponseVariables](docs/BatchUpsertRecordsResponseVariables.md)
- [Collection](docs/Collection.md)
- [CollectionType](docs/CollectionType.md)
- [DeleteRecordRequest](docs/DeleteRecordRequest.md)
- [Error](docs/Error.md)
- [Event](docs/Event.md)
Expand All @@ -169,10 +173,12 @@ Class | Method | HTTP request | Description
- [ExperimentResponse](docs/ExperimentResponse.md)
- [GeneratePipelinesRequest](docs/GeneratePipelinesRequest.md)
- [GeneratePipelinesResponse](docs/GeneratePipelinesResponse.md)
- [GetCollectionRequestView](docs/GetCollectionRequestView.md)
- [GetDefaultPipelineResponse](docs/GetDefaultPipelineResponse.md)
- [GetDefaultVersionRequestView](docs/GetDefaultVersionRequestView.md)
- [GetPipelineRequestView](docs/GetPipelineRequestView.md)
- [GetRecordRequest](docs/GetRecordRequest.md)
- [ListCollectionsRequestView](docs/ListCollectionsRequestView.md)
- [ListCollectionsResponse](docs/ListCollectionsResponse.md)
- [ListPipelinesRequestView](docs/ListPipelinesRequestView.md)
- [ListPipelinesResponse](docs/ListPipelinesResponse.md)
Expand Down
2 changes: 1 addition & 1 deletion docs/Collection.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Name | Type | Description | Notes
**display_name** | **str** | The collection's display name. You can change this at any time. |
**account_id** | **str** | Output only. The ID of the account that owns this collection. | [optional] [readonly]
**authorized_query_domains** | **[str]** | The list of authorized query domains for the collection. Client-side / browser requests to the [QueryCollection](/docs/api#operation/QueryCollection) call can be made by any authorized query domain or any of its subdomains. This allows your interface to make search requests without having to provide an API key in the client-side request. | [optional]
**create_time** | **datetime** | Output only. Time the collection was created. | [optional] [readonly]
**create_time** | **datetime** | Output only. The time the collection was created. | [optional] [readonly]
**id** | **str** | Output only. The collection's ID. | [optional] [readonly]
**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]

Expand Down
12 changes: 12 additions & 0 deletions docs/CollectionType.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# CollectionType

- TYPE_UNSPECIFIED: Type not specified. - WEBSITE: The type for website collections. - SHOPIFY: The type for the collection backing a Shopify account. - CUSTOM: The legacy custom type.

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**value** | **str** | - TYPE_UNSPECIFIED: Type not specified. - WEBSITE: The type for website collections. - SHOPIFY: The type for the collection backing a Shopify account. - CUSTOM: The legacy custom type. | defaults to "TYPE_UNSPECIFIED", must be one of ["TYPE_UNSPECIFIED", "WEBSITE", "SHOPIFY", "CUSTOM", ]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)


47 changes: 44 additions & 3 deletions docs/CollectionsApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ with sajari_client.ApiClient(configuration) as api_client:
],
display_name="display_name_example",
) # Collection | Details of the collection to create.
account_id = "Account-Id_example" # str | The account that owns the collection, e.g. `1618535966441231024`. (optional)

# example passing only required values which don't have defaults set
try:
Expand All @@ -69,6 +70,15 @@ with sajari_client.ApiClient(configuration) as api_client:
pprint(api_response)
except sajari_client.ApiException as e:
print("Exception when calling CollectionsApi->create_collection: %s\n" % e)

# example passing only required values which don't have defaults set
# and optional values
try:
# Create collection
api_response = api_instance.create_collection(collection_id, collection, account_id=account_id)
pprint(api_response)
except sajari_client.ApiException as e:
print("Exception when calling CollectionsApi->create_collection: %s\n" % e)
```


Expand All @@ -78,6 +88,7 @@ Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**collection_id** | **str**| The ID to use for the collection. This must start with an alphanumeric character followed by one or more alphanumeric or `-` characters. Strictly speaking, it must match the regular expression: `^[A-Za-z][A-Za-z0-9\\-]*$`. |
**collection** | [**Collection**](Collection.md)| Details of the collection to create. |
**account_id** | **str**| The account that owns the collection, e.g. `1618535966441231024`. | [optional]

### Return type

Expand Down Expand Up @@ -147,6 +158,7 @@ with sajari_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = collections_api.CollectionsApi(api_client)
collection_id = "collection_id_example" # str | The collection to delete, e.g. `my-collection`.
account_id = "Account-Id_example" # str | The account that owns the collection, e.g. `1618535966441231024`. (optional)

# example passing only required values which don't have defaults set
try:
Expand All @@ -155,6 +167,15 @@ with sajari_client.ApiClient(configuration) as api_client:
pprint(api_response)
except sajari_client.ApiException as e:
print("Exception when calling CollectionsApi->delete_collection: %s\n" % e)

# example passing only required values which don't have defaults set
# and optional values
try:
# Delete collection
api_response = api_instance.delete_collection(collection_id, account_id=account_id)
pprint(api_response)
except sajari_client.ApiException as e:
print("Exception when calling CollectionsApi->delete_collection: %s\n" % e)
```


Expand All @@ -163,6 +184,7 @@ with sajari_client.ApiClient(configuration) as api_client:
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**collection_id** | **str**| The collection to delete, e.g. `my-collection`. |
**account_id** | **str**| The account that owns the collection, e.g. `1618535966441231024`. | [optional]

### Return type

Expand Down Expand Up @@ -434,6 +456,8 @@ with sajari_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = collections_api.CollectionsApi(api_client)
collection_id = "collection_id_example" # str | The collection to retrieve, e.g. `my-collection`.
account_id = "Account-Id_example" # str | The account that owns the collection, e.g. `1618535966441231024`. (optional)
view = "VIEW_UNSPECIFIED" # str | The amount of information to include in the retrieved pipeline. - VIEW_UNSPECIFIED: The default / unset value. The API defaults to the `BASIC` view. - BASIC: Include basic information including display name and domains. This is the default value (for both [ListCollections](/docs/api#operation/ListCollections) and [GetCollection](/docs/api#operation/GetCollection)). - FULL: Include the information from `BASIC`, plus full collection details like disk usage. (optional) if omitted the server will use the default value of "VIEW_UNSPECIFIED"

# example passing only required values which don't have defaults set
try:
Expand All @@ -442,6 +466,15 @@ with sajari_client.ApiClient(configuration) as api_client:
pprint(api_response)
except sajari_client.ApiException as e:
print("Exception when calling CollectionsApi->get_collection: %s\n" % e)

# example passing only required values which don't have defaults set
# and optional values
try:
# Get collection
api_response = api_instance.get_collection(collection_id, account_id=account_id, view=view)
pprint(api_response)
except sajari_client.ApiException as e:
print("Exception when calling CollectionsApi->get_collection: %s\n" % e)
```


Expand All @@ -450,6 +483,8 @@ with sajari_client.ApiClient(configuration) as api_client:
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**collection_id** | **str**| The collection to retrieve, e.g. `my-collection`. |
**account_id** | **str**| The account that owns the collection, e.g. `1618535966441231024`. | [optional]
**view** | **str**| The amount of information to include in the retrieved pipeline. - VIEW_UNSPECIFIED: The default / unset value. The API defaults to the `BASIC` view. - BASIC: Include basic information including display name and domains. This is the default value (for both [ListCollections](/docs/api#operation/ListCollections) and [GetCollection](/docs/api#operation/GetCollection)). - FULL: Include the information from `BASIC`, plus full collection details like disk usage. | [optional] if omitted the server will use the default value of "VIEW_UNSPECIFIED"

### Return type

Expand Down Expand Up @@ -517,14 +552,16 @@ configuration = sajari_client.Configuration(
with sajari_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = collections_api.CollectionsApi(api_client)
account_id = "Account-Id_example" # str | The account that owns this set of collections, e.g. `1618535966441231024`. (optional)
page_size = 1 # int | The maximum number of collections to return. The service may return fewer than this value. If unspecified, at most 50 collections are returned. The maximum value is 100; values above 100 are coerced to 100. (optional)
page_token = "page_token_example" # str | A page token, received from a previous [ListCollections](/docs/api#operation/ListCollections) call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to [ListCollections](/docs/api#operation/ListCollections) must match the call that provided the page token. (optional)
view = "VIEW_UNSPECIFIED" # str | The amount of information to include in each retrieved collection. - VIEW_UNSPECIFIED: The default / unset value. The API defaults to the `BASIC` view. - BASIC: Include basic information including display name and domains. This is the default value (for both [ListCollections](/docs/api#operation/ListCollections) and [GetCollection](/docs/api#operation/GetCollection)). - FULL: Include the information from `BASIC`, plus full collection details like disk usage. (optional) if omitted the server will use the default value of "VIEW_UNSPECIFIED"

# example passing only required values which don't have defaults set
# and optional values
try:
# List collections
api_response = api_instance.list_collections(page_size=page_size, page_token=page_token)
api_response = api_instance.list_collections(account_id=account_id, page_size=page_size, page_token=page_token, view=view)
pprint(api_response)
except sajari_client.ApiException as e:
print("Exception when calling CollectionsApi->list_collections: %s\n" % e)
Expand All @@ -535,8 +572,10 @@ with sajari_client.ApiClient(configuration) as api_client:

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**account_id** | **str**| The account that owns this set of collections, e.g. `1618535966441231024`. | [optional]
**page_size** | **int**| The maximum number of collections to return. The service may return fewer than this value. If unspecified, at most 50 collections are returned. The maximum value is 100; values above 100 are coerced to 100. | [optional]
**page_token** | **str**| A page token, received from a previous [ListCollections](/docs/api#operation/ListCollections) call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to [ListCollections](/docs/api#operation/ListCollections) must match the call that provided the page token. | [optional]
**view** | **str**| The amount of information to include in each retrieved collection. - VIEW_UNSPECIFIED: The default / unset value. The API defaults to the `BASIC` view. - BASIC: Include basic information including display name and domains. This is the default value (for both [ListCollections](/docs/api#operation/ListCollections) and [GetCollection](/docs/api#operation/GetCollection)). - FULL: Include the information from `BASIC`, plus full collection details like disk usage. | [optional] if omitted the server will use the default value of "VIEW_UNSPECIFIED"

### Return type

Expand Down Expand Up @@ -789,7 +828,7 @@ Name | Type | Description | Notes
Track event

Track an analytics event when a user interacts with an object returned by a [QueryCollection](/docs/api/#operation/QueryCollection) request. An analytics event can be tracked for the following objects: - Results - Promotion banners - Redirects Note: You must pass an `Account-Id` header.
Track an analytics event when a user interacts with an object returned by a [QueryCollection](/docs/api/#operation/QueryCollection) request. An analytics event can be tracked for the following objects: - Results - Promotion banners - Redirects When tracking redirect events, set `type` to `redirect`. Note: You must pass an `Account-Id` header.

### Example

Expand Down Expand Up @@ -927,6 +966,7 @@ with sajari_client.ApiClient(configuration) as api_client:
],
display_name="display_name_example",
) # Collection | The details of the collection to update.
account_id = "Account-Id_example" # str | The account that owns the collection, e.g. `1618535966441231024`. (optional)
update_mask = "update_mask_example" # str | The list of fields to update, separated by a comma, e.g. `authorized_query_domains,display_name`. Each field should be in snake case. For each field that you want to update, provide a corresponding value in the collection object containing the new value. (optional)

# example passing only required values which don't have defaults set
Expand All @@ -941,7 +981,7 @@ with sajari_client.ApiClient(configuration) as api_client:
# and optional values
try:
# Update collection
api_response = api_instance.update_collection(collection_id, collection, update_mask=update_mask)
api_response = api_instance.update_collection(collection_id, collection, account_id=account_id, update_mask=update_mask)
pprint(api_response)
except sajari_client.ApiException as e:
print("Exception when calling CollectionsApi->update_collection: %s\n" % e)
Expand All @@ -954,6 +994,7 @@ Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**collection_id** | **str**| The collection to update, e.g. `my-collection`. |
**collection** | [**Collection**](Collection.md)| The details of the collection to update. |
**account_id** | **str**| The account that owns the collection, e.g. `1618535966441231024`. | [optional]
**update_mask** | **str**| The list of fields to update, separated by a comma, e.g. `authorized_query_domains,display_name`. Each field should be in snake case. For each field that you want to update, provide a corresponding value in the collection object containing the new value. | [optional]

### Return type
Expand Down
2 changes: 1 addition & 1 deletion docs/Event.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ An analytics event that relates to a query made on a collection.
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**query_id** | **str** | The query identifier. |
**type** | **str** | The type of event, e.g. `click`, `purchase`, `add_to_cart`. |
**type** | **str** | The type of event, e.g. `click`, `redirect`, `purchase`, `add_to_cart`. |
**banner_id** | **str** | The identifier of the promotion banner the event is about. | [optional]
**metadata** | **{str: ({str: (bool, date, datetime, dict, float, int, list, str, none_type)},)}** | An object made up of field-value pairs that contains additional metadata to record with the event. | [optional]
**redirect_id** | **str** | The identifier of the redirect the event is about. | [optional]
Expand Down
Loading

0 comments on commit 8e71b7d

Please sign in to comment.