Skip to content

Commit

Permalink
add support for update and delete schema field (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
jkaho authored May 4, 2022
1 parent 77ffe1c commit 0660880
Show file tree
Hide file tree
Showing 38 changed files with 783 additions and 86 deletions.
17 changes: 9 additions & 8 deletions .openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,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 @@ -30,10 +31,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 @@ lib/sdk_ruby/models/batch_upsert_records_response_error.rb
lib/sdk_ruby/models/batch_upsert_records_response_key.rb
lib/sdk_ruby/models/batch_upsert_records_response_variables.rb
lib/sdk_ruby/models/collection.rb
lib/sdk_ruby/models/collection_type.rb
lib/sdk_ruby/models/delete_record_request.rb
lib/sdk_ruby/models/error.rb
lib/sdk_ruby/models/event.rb
Expand All @@ -130,10 +134,12 @@ lib/sdk_ruby/models/experiment_request_pipeline.rb
lib/sdk_ruby/models/experiment_response.rb
lib/sdk_ruby/models/generate_pipelines_request.rb
lib/sdk_ruby/models/generate_pipelines_response.rb
lib/sdk_ruby/models/get_collection_request_view.rb
lib/sdk_ruby/models/get_default_pipeline_response.rb
lib/sdk_ruby/models/get_default_version_request_view.rb
lib/sdk_ruby/models/get_pipeline_request_view.rb
lib/sdk_ruby/models/get_record_request.rb
lib/sdk_ruby/models/list_collections_request_view.rb
lib/sdk_ruby/models/list_collections_response.rb
lib/sdk_ruby/models/list_pipelines_request_view.rb
lib/sdk_ruby/models/list_pipelines_response.rb
Expand Down Expand Up @@ -194,12 +200,7 @@ lib/sdk_ruby/version.rb
sdk_ruby.gemspec
spec/api_client_spec.rb
spec/configuration_spec.rb
spec/models/banner_spec.rb
spec/models/event_spec.rb
spec/models/experiment_request_pipeline_spec.rb
spec/models/experiment_request_spec.rb
spec/models/experiment_response_spec.rb
spec/models/list_promotions_request_promotion_view_spec.rb
spec/models/promotion_pin_mode_spec.rb
spec/models/text_position_spec.rb
spec/models/collection_type_spec.rb
spec/models/get_collection_request_view_spec.rb
spec/models/list_collections_request_view_spec.rb
spec/spec_helper.rb
18 changes: 13 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Search.io offers a search and discovery service with Neuralsearch®, the world's
This SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:

- API version: v4
- Package version: 5.0.0
- Package version: 5.1.0
- Build package: org.openapitools.codegen.languages.RubyClientCodegen
For more information, please visit [https://www.search.io/company/contact](https://www.search.io/company/contact)

Expand All @@ -24,16 +24,16 @@ gem build sdk_ruby.gemspec
Then either install the gem locally:

```shell
gem install ./sdk_ruby-5.0.0.gem
gem install ./sdk_ruby-5.1.0.gem
```

(for development, run `gem install --dev ./sdk_ruby-5.0.0.gem` to install the development dependencies)
(for development, run `gem install --dev ./sdk_ruby-5.1.0.gem` to install the development dependencies)

or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/).

Finally add this to the Gemfile:

gem 'sdk_ruby', '~> 5.0.0'
gem 'sdk_ruby', '~> 5.1.0'

### Install from Git

Expand Down Expand Up @@ -67,10 +67,13 @@ end
api_instance = SajariAPIClient::CollectionsApi.new
collection_id = 'collection_id_example' # String | 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 = SajariAPIClient::Collection.new({display_name: 'display_name_example'}) # Collection | Details of the collection to create.
opts = {
account_id: 'account_id_example' # String | The account that owns the collection, e.g. `1618535966441231024`.
}

begin
#Create collection
result = api_instance.create_collection(collection_id, collection)
result = api_instance.create_collection(collection_id, collection, opts)
p result
rescue SajariAPIClient::ApiError => e
puts "Exception when calling CollectionsApi->create_collection: #{e}"
Expand Down Expand Up @@ -121,7 +124,9 @@ Class | Method | HTTP request | Description
*SajariAPIClient::RedirectsApi* | [**update_redirect**](docs/RedirectsApi.md#update_redirect) | **PATCH** /v4/collections/{collection_id}/redirects/{redirect_id} | Update redirect
*SajariAPIClient::SchemaApi* | [**batch_create_schema_fields**](docs/SchemaApi.md#batch_create_schema_fields) | **POST** /v4/collections/{collection_id}/schemaFields:batchCreate | Batch create schema fields
*SajariAPIClient::SchemaApi* | [**create_schema_field**](docs/SchemaApi.md#create_schema_field) | **POST** /v4/collections/{collection_id}/schemaFields | Create schema field
*SajariAPIClient::SchemaApi* | [**delete_schema_field**](docs/SchemaApi.md#delete_schema_field) | **DELETE** /v4/collections/{collection_id}/schemaFields/{schema_field_name} | Delete schema field
*SajariAPIClient::SchemaApi* | [**list_schema_fields**](docs/SchemaApi.md#list_schema_fields) | **GET** /v4/collections/{collection_id}/schemaFields | List schema fields
*SajariAPIClient::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 @@ -142,6 +147,7 @@ Class | Method | HTTP request | Description
- [SajariAPIClient::BatchUpsertRecordsResponseKey](docs/BatchUpsertRecordsResponseKey.md)
- [SajariAPIClient::BatchUpsertRecordsResponseVariables](docs/BatchUpsertRecordsResponseVariables.md)
- [SajariAPIClient::Collection](docs/Collection.md)
- [SajariAPIClient::CollectionType](docs/CollectionType.md)
- [SajariAPIClient::DeleteRecordRequest](docs/DeleteRecordRequest.md)
- [SajariAPIClient::Error](docs/Error.md)
- [SajariAPIClient::Event](docs/Event.md)
Expand All @@ -150,10 +156,12 @@ Class | Method | HTTP request | Description
- [SajariAPIClient::ExperimentResponse](docs/ExperimentResponse.md)
- [SajariAPIClient::GeneratePipelinesRequest](docs/GeneratePipelinesRequest.md)
- [SajariAPIClient::GeneratePipelinesResponse](docs/GeneratePipelinesResponse.md)
- [SajariAPIClient::GetCollectionRequestView](docs/GetCollectionRequestView.md)
- [SajariAPIClient::GetDefaultPipelineResponse](docs/GetDefaultPipelineResponse.md)
- [SajariAPIClient::GetDefaultVersionRequestView](docs/GetDefaultVersionRequestView.md)
- [SajariAPIClient::GetPipelineRequestView](docs/GetPipelineRequestView.md)
- [SajariAPIClient::GetRecordRequest](docs/GetRecordRequest.md)
- [SajariAPIClient::ListCollectionsRequestView](docs/ListCollectionsRequestView.md)
- [SajariAPIClient::ListCollectionsResponse](docs/ListCollectionsResponse.md)
- [SajariAPIClient::ListPipelinesRequestView](docs/ListPipelinesRequestView.md)
- [SajariAPIClient::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 @@ -6,7 +6,7 @@
| ---- | ---- | ----------- | ----- |
| **account_id** | **String** | Output only. The ID of the account that owns this collection. | [optional][readonly] |
| **authorized_query_domains** | **Array<String>** | 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** | **Time** | Output only. Time the collection was created. | [optional][readonly] |
| **create_time** | **Time** | Output only. The time the collection was created. | [optional][readonly] |
| **display_name** | **String** | The collection's display name. You can change this at any time. | |
| **id** | **String** | Output only. The collection's ID. | [optional][readonly] |

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

## Properties

| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |

## Example

```ruby
require 'sdk_ruby'

instance = SajariAPIClient::CollectionType.new()
```

48 changes: 34 additions & 14 deletions docs/CollectionsApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ All URIs are relative to *https://api.search.io*

## create_collection

> <Collection> create_collection(collection_id, collection)
> <Collection> create_collection(collection_id, collection, opts)
Create collection

Expand All @@ -38,10 +38,13 @@ end
api_instance = SajariAPIClient::CollectionsApi.new
collection_id = 'collection_id_example' # String | 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 = SajariAPIClient::Collection.new({display_name: 'display_name_example'}) # Collection | Details of the collection to create.
opts = {
account_id: 'account_id_example' # String | The account that owns the collection, e.g. `1618535966441231024`.
}

begin
# Create collection
result = api_instance.create_collection(collection_id, collection)
result = api_instance.create_collection(collection_id, collection, opts)
p result
rescue SajariAPIClient::ApiError => e
puts "Error when calling CollectionsApi->create_collection: #{e}"
Expand All @@ -52,12 +55,12 @@ end

This returns an Array which contains the response data, status code and headers.

> <Array(<Collection>, Integer, Hash)> create_collection_with_http_info(collection_id, collection)
> <Array(<Collection>, Integer, Hash)> create_collection_with_http_info(collection_id, collection, opts)
```ruby
begin
# Create collection
data, status_code, headers = api_instance.create_collection_with_http_info(collection_id, collection)
data, status_code, headers = api_instance.create_collection_with_http_info(collection_id, collection, opts)
p status_code # => 2xx
p headers # => { ... }
p data # => <Collection>
Expand All @@ -72,6 +75,7 @@ end
| ---- | ---- | ----------- | ----- |
| **collection_id** | **String** | The ID to use for the collection. This must start with an alphanumeric character followed by one or more alphanumeric or &#x60;-&#x60; characters. Strictly speaking, it must match the regular expression: &#x60;^[A-Za-z][A-Za-z0-9\\-]*$&#x60;. | |
| **collection** | [**Collection**](Collection.md) | Details of the collection to create. | |
| **account_id** | **String** | The account that owns the collection, e.g. &#x60;1618535966441231024&#x60;. | [optional] |

### Return type

Expand All @@ -89,7 +93,7 @@ end

## delete_collection

> Object delete_collection(collection_id)
> Object delete_collection(collection_id, opts)
Delete collection

Expand All @@ -109,10 +113,13 @@ end

api_instance = SajariAPIClient::CollectionsApi.new
collection_id = 'collection_id_example' # String | The collection to delete, e.g. `my-collection`.
opts = {
account_id: 'account_id_example' # String | The account that owns the collection, e.g. `1618535966441231024`.
}

begin
# Delete collection
result = api_instance.delete_collection(collection_id)
result = api_instance.delete_collection(collection_id, opts)
p result
rescue SajariAPIClient::ApiError => e
puts "Error when calling CollectionsApi->delete_collection: #{e}"
Expand All @@ -123,12 +130,12 @@ end

This returns an Array which contains the response data, status code and headers.

> <Array(Object, Integer, Hash)> delete_collection_with_http_info(collection_id)
> <Array(Object, Integer, Hash)> delete_collection_with_http_info(collection_id, opts)
```ruby
begin
# Delete collection
data, status_code, headers = api_instance.delete_collection_with_http_info(collection_id)
data, status_code, headers = api_instance.delete_collection_with_http_info(collection_id, opts)
p status_code # => 2xx
p headers # => { ... }
p data # => Object
Expand All @@ -142,6 +149,7 @@ end
| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |
| **collection_id** | **String** | The collection to delete, e.g. &#x60;my-collection&#x60;. | |
| **account_id** | **String** | The account that owns the collection, e.g. &#x60;1618535966441231024&#x60;. | [optional] |

### Return type

Expand Down Expand Up @@ -231,7 +239,7 @@ end

## get_collection

> <Collection> get_collection(collection_id)
> <Collection> get_collection(collection_id, opts)
Get collection

Expand All @@ -251,10 +259,14 @@ end

api_instance = SajariAPIClient::CollectionsApi.new
collection_id = 'collection_id_example' # String | The collection to retrieve, e.g. `my-collection`.
opts = {
account_id: 'account_id_example', # String | The account that owns the collection, e.g. `1618535966441231024`.
view: 'VIEW_UNSPECIFIED' # String | 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.
}

begin
# Get collection
result = api_instance.get_collection(collection_id)
result = api_instance.get_collection(collection_id, opts)
p result
rescue SajariAPIClient::ApiError => e
puts "Error when calling CollectionsApi->get_collection: #{e}"
Expand All @@ -265,12 +277,12 @@ end

This returns an Array which contains the response data, status code and headers.

> <Array(<Collection>, Integer, Hash)> get_collection_with_http_info(collection_id)
> <Array(<Collection>, Integer, Hash)> get_collection_with_http_info(collection_id, opts)
```ruby
begin
# Get collection
data, status_code, headers = api_instance.get_collection_with_http_info(collection_id)
data, status_code, headers = api_instance.get_collection_with_http_info(collection_id, opts)
p status_code # => 2xx
p headers # => { ... }
p data # => <Collection>
Expand All @@ -284,6 +296,8 @@ end
| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |
| **collection_id** | **String** | The collection to retrieve, e.g. &#x60;my-collection&#x60;. | |
| **account_id** | **String** | The account that owns the collection, e.g. &#x60;1618535966441231024&#x60;. | [optional] |
| **view** | **String** | The amount of information to include in the retrieved pipeline. - VIEW_UNSPECIFIED: The default / unset value. The API defaults to the &#x60;BASIC&#x60; 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 &#x60;BASIC&#x60;, plus full collection details like disk usage. | [optional][default to &#39;VIEW_UNSPECIFIED&#39;] |

### Return type

Expand Down Expand Up @@ -321,8 +335,10 @@ end

api_instance = SajariAPIClient::CollectionsApi.new
opts = {
account_id: 'account_id_example', # String | The account that owns this set of collections, e.g. `1618535966441231024`.
page_size: 56, # Integer | 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.
page_token: 'page_token_example' # String | 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.
page_token: 'page_token_example', # String | 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.
view: 'VIEW_UNSPECIFIED' # String | 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.
}

begin
Expand Down Expand Up @@ -356,8 +372,10 @@ end

| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |
| **account_id** | **String** | The account that owns this set of collections, e.g. &#x60;1618535966441231024&#x60;. | [optional] |
| **page_size** | **Integer** | 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** | **String** | 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** | **String** | The amount of information to include in each retrieved collection. - VIEW_UNSPECIFIED: The default / unset value. The API defaults to the &#x60;BASIC&#x60; 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 &#x60;BASIC&#x60;, plus full collection details like disk usage. | [optional][default to &#39;VIEW_UNSPECIFIED&#39;] |

### Return type

Expand Down Expand Up @@ -527,7 +545,7 @@ end
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.

### Examples

Expand Down Expand Up @@ -619,6 +637,7 @@ api_instance = SajariAPIClient::CollectionsApi.new
collection_id = 'collection_id_example' # String | The collection to update, e.g. `my-collection`.
collection = SajariAPIClient::Collection.new({display_name: 'display_name_example'}) # Collection | The details of the collection to update.
opts = {
account_id: 'account_id_example', # String | The account that owns the collection, e.g. `1618535966441231024`.
update_mask: 'update_mask_example' # String | 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.
}

Expand Down Expand Up @@ -655,6 +674,7 @@ end
| ---- | ---- | ----------- | ----- |
| **collection_id** | **String** | The collection to update, e.g. &#x60;my-collection&#x60;. | |
| **collection** | [**Collection**](Collection.md) | The details of the collection to update. | |
| **account_id** | **String** | The account that owns the collection, e.g. &#x60;1618535966441231024&#x60;. | [optional] |
| **update_mask** | **String** | The list of fields to update, separated by a comma, e.g. &#x60;authorized_query_domains,display_name&#x60;. 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
Loading

0 comments on commit 0660880

Please sign in to comment.