Skip to content

sajari/sdk-dotnet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Com.Sajari.Sdk - the C# library for the Search.io API

Search.io offers a search and discovery service with Neuralsearch®, the world's first instant AI search technology. Businesses of all sizes use Search.io to build site search and discovery solutions that maximize e-commerce revenue, optimize on-site customer experience, and scale their online presence.

This C# SDK is automatically generated by the OpenAPI Generator project:

  • API version: v4
  • SDK version: 5.1.0
  • Build package: org.openapitools.codegen.languages.CSharpNetCoreClientCodegen For more information, please visit https://www.search.io/company/contact

Frameworks supported

  • .NET Core >=1.0
  • .NET Framework >=4.6
  • Mono/Xamarin >=vNext

Dependencies

The DLLs included in the package may not be the latest version. We recommend using NuGet to obtain the latest version of the packages:

Install-Package RestSharp
Install-Package Newtonsoft.Json
Install-Package JsonSubTypes
Install-Package System.ComponentModel.Annotations

NOTE: RestSharp versions greater than 105.1.0 have a bug which causes file uploads to fail. See RestSharp#742. NOTE: RestSharp for .Net Core creates a new socket for each api call, which can lead to a socket exhaustion problem. See RestSharp#1406.

Installation

Generate the DLL using your preferred tool (e.g. dotnet build)

Then include the DLL (under the bin folder) in the C# project, and use the namespaces:

using Com.Sajari.Sdk.Api;
using Com.Sajari.Sdk.Client;
using Com.Sajari.Sdk.Model;

Usage

To use the API client with a HTTP proxy, setup a System.Net.WebProxy

Configuration c = new Configuration();
System.Net.WebProxy webProxy = new System.Net.WebProxy("http://myProxyUrl:80/");
webProxy.Credentials = System.Net.CredentialCache.DefaultCredentials;
c.Proxy = webProxy;

Getting Started

using System.Collections.Generic;
using System.Diagnostics;
using Com.Sajari.Sdk.Api;
using Com.Sajari.Sdk.Client;
using Com.Sajari.Sdk.Model;

namespace Example
{
    public class Example
    {
        public static void Main()
        {

            Configuration config = new Configuration();
            config.BasePath = "https://api.search.io";
            // Configure HTTP basic authorization: BasicAuth
            config.Username = "YOUR_USERNAME";
            config.Password = "YOUR_PASSWORD";

            var apiInstance = new CollectionsApi(config);
            var collectionId = "collectionId_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\\-]*$`.
            var collection = new Collection(); // Collection | Details of the collection to create.
            var accountId = "accountId_example";  // string | The account that owns the collection, e.g. `1618535966441231024`. (optional) 

            try
            {
                // Create collection
                Collection result = apiInstance.CreateCollection(collectionId, collection, accountId);
                Debug.WriteLine(result);
            }
            catch (ApiException e)
            {
                Debug.Print("Exception when calling CollectionsApi.CreateCollection: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }

        }
    }
}

Documentation for API Endpoints

All URIs are relative to https://api.search.io

Class Method HTTP request Description
CollectionsApi CreateCollection POST /v4/collections Create collection
CollectionsApi DeleteCollection DELETE /v4/collections/{collection_id} Delete collection
CollectionsApi Experiment POST /v4/collections/{collection_id}:experiment Experiment
CollectionsApi GetCollection GET /v4/collections/{collection_id} Get collection
CollectionsApi ListCollections GET /v4/collections List collections
CollectionsApi QueryCollection POST /v4/collections/{collection_id}:query Query collection
CollectionsApi QueryCollection2 POST /v4/collections/{collection_id}:queryCollection Query collection
CollectionsApi TrackEvent POST /v4/collections/{collection_id}:trackEvent Track event
CollectionsApi UpdateCollection PATCH /v4/collections/{collection_id} Update collection
EventsApi SendEvent POST /v4/events:send Send event
EventsApi SendEvent2 POST /v4/events:sendEvent Send event
PipelinesApi CreatePipeline POST /v4/collections/{collection_id}/pipelines Create pipeline
PipelinesApi GeneratePipelines POST /v4/collections/{collection_id}:generatePipelines Generate pipelines
PipelinesApi GetDefaultPipeline GET /v4/collections/{collection_id}:getDefaultPipeline Get default pipeline
PipelinesApi GetDefaultVersion GET /v4/collections/{collection_id}/pipelines/{type}/{name}:getDefaultVersion Get default pipeline version
PipelinesApi GetPipeline GET /v4/collections/{collection_id}/pipelines/{type}/{name}/{version} Get pipeline
PipelinesApi ListPipelines GET /v4/collections/{collection_id}/pipelines List pipelines
PipelinesApi SetDefaultPipeline POST /v4/collections/{collection_id}:setDefaultPipeline Set default pipeline
PipelinesApi SetDefaultVersion POST /v4/collections/{collection_id}/pipelines/{type}/{name}:setDefaultVersion Set default pipeline version
PromotionsApi CreatePromotion POST /v4/collections/{collection_id}/promotions Create promotion
PromotionsApi DeletePromotion DELETE /v4/collections/{collection_id}/promotions/{promotion_id} Delete promotion
PromotionsApi GetPromotion GET /v4/collections/{collection_id}/promotions/{promotion_id} Get promotion
PromotionsApi ListPromotions GET /v4/collections/{collection_id}/promotions List promotions
PromotionsApi UpdatePromotion PATCH /v4/collections/{collection_id}/promotions/{promotion_id} Update promotion
RecordsApi BatchUpdateRecords POST /v4/collections/{collection_id}/records:batchUpdate Batch update records
RecordsApi BatchUpsertRecords POST /v4/collections/{collection_id}/records:batchUpsert Batch upsert records
RecordsApi DeleteRecord POST /v4/collections/{collection_id}/records:delete Delete record
RecordsApi GetRecord POST /v4/collections/{collection_id}/records:get Get record
RecordsApi UpdateRecord POST /v4/collections/{collection_id}/records:update Update record
RecordsApi UpsertRecord POST /v4/collections/{collection_id}/records:upsert Upsert record
RedirectsApi CreateRedirect POST /v4/collections/{collection_id}/redirects Create redirect
RedirectsApi DeleteRedirect DELETE /v4/collections/{collection_id}/redirects/{redirect_id} Delete redirect
RedirectsApi GetRedirect GET /v4/collections/{collection_id}/redirects/{redirect_id} Get redirect
RedirectsApi ListRedirects GET /v4/collections/{collection_id}/redirects List redirects
RedirectsApi UpdateRedirect PATCH /v4/collections/{collection_id}/redirects/{redirect_id} Update redirect
SchemaApi BatchCreateSchemaFields POST /v4/collections/{collection_id}/schemaFields:batchCreate Batch create schema fields
SchemaApi CreateSchemaField POST /v4/collections/{collection_id}/schemaFields Create schema field
SchemaApi DeleteSchemaField DELETE /v4/collections/{collection_id}/schemaFields/{schema_field_name} Delete schema field
SchemaApi ListSchemaFields GET /v4/collections/{collection_id}/schemaFields List schema fields
SchemaApi UpdateSchemaField PATCH /v4/collections/{collection_id}/schemaFields/{schema_field_name} Update schema field

Documentation for Models

Documentation for Authorization

BasicAuth

  • Type: HTTP basic authentication