GithubHelp home page GithubHelp logo

isabella232 / datasift-dotnet Goto Github PK

View Code? Open in Web Editor NEW

This project forked from datasift/datasift-dotnet

0.0 0.0 0.0 10.52 MB

The official .NET API library for DataSift.

License: MIT License

C# 99.99% Batchfile 0.01%

datasift-dotnet's Introduction

DataSift .NET Client Library

This is the official .NET library for accessing Datasift.

Please log any library issues inside this GitHub repository.

Getting Started

To get started choose one of our quick start guides:

Installation

1) Sign-up to DataSift

You can sign up to DataSift for free at http://datasift.com.

Once you've registered you can find your username and API key on your Dashboard.

2) Reference DataSift library

The easiest way to use this library is via Nuget.

You can install the package using the Package Manager Console in Visual Studio.

    Install-Package Datasift.net 

Of course you could also download this source code and reference the DataSift project in your solution.

Usage: REST API Calls

    var client = new DataSiftClient("YOUR_USERNAME", "YOUR_APIKEY");
    var compiled = client.Compile("interaction.content contains \"music\"");
    Console.WriteLine("Compiled to {0}, DPU = {1}", compiled.Data.hash, compiled.Data.dpu);

See the DataSiftExamples project for some simple example usage.

Usage: Streaming Data

    class Program
    {
        private static DataSiftClient _client = null;
        private static DataSift.Streaming.DataSiftStream _stream = null;

        static void Main(string[] args)
        {
            // Create a new client
            _client = new DataSiftClient("YOUR_USERNAME", "YOUR_APIKEY");

            // Declare event handlers
            _stream.OnConnect += stream_OnConnect;
            _stream.OnMessage += stream_OnMessage;
            _stream.OnDataSiftMessage += stream_OnDataSiftMessage;

            // Connect
            _stream = _client.Connect();
        }

        static void stream_OnConnect()
        {
            Console.WriteLine("Connected.");

            // Compile and subscribe to a stream
            var compiled = _client.Compile("interaction.content contains \"football\"");
            Console.WriteLine("Compiled stream to {0}, DPU = {1}", compiled.Data.hash, compiled.Data.dpu);
            _stream.Subscribe(compiled.Data.hash);
        }

        static void stream_OnMessage(string hash, dynamic message)
        {
            Console.WriteLine("New interaction received on stream " + hash);
            Console.WriteLine(JsonConvert.SerializeObject(message) + "\n");
        }

        static void stream_OnDataSiftMessage(DataSift.Enum.DataSiftMessageStatus status, string message)
        {
            switch (status)
            {
                case DataSiftMessageStatus.Warning:
                    Console.WriteLine("WARNING: " + message);
                    break;
                case DataSiftMessageStatus.Failure:
                    Console.WriteLine("FAILURE: " + message);
                    break;
                case DataSiftMessageStatus.Success:
                    Console.WriteLine("SUCCESS: " + message);
                    break;
            }
        }
    }

See the DataSiftExamples project for some simple example usage.

Requirements

This library has been tested with the following frameworks:

  • .NET Framework 4.5

License

All code contained in this repository is Copyright MediaSift Ltd.

This code is released under the BSD license. Please see the LICENSE file for more details.

Change Log

  • 1.6.0 - Moved library to use v1.6 of the DataSift API, updated to use TLS v1.2.
  • 1.5.2 - Updated to v105 of RestSharp dependency
  • 1.5.1 - Added support for the Reference Data API.
  • 1.5.0 - Moved library to use v1.5 of the DataSift API, including support for Media Strategies API.
  • 1.4.0 - Moved library to use v1.4 of the DataSift API, including task endpoints.
  • 1.3.2 - Added 'analyze_queries' limit for identities.
  • 1.3.1 - Fixed format validation for PYLON recording ids.
  • 1.3.0 - Moved library to use v1.3 of the DataSift API, including pylon/update endpoint.
  • 1.2.4 - Added support for /pylon/sample endpoint
  • 1.2.3 - Added support for /account/usage endpoint
  • 1.2.2 - Changes to allow inheritance of client
  • 1.2.1 - Added support for ODP ingestion endpoint
  • 1.2.0 - Moved library to use v1.2 of the DataSift API
  • 1.1.2 - Fixed Nuget issue
  • 1.1.1 - PYLON GA Release
  • 1.1.0 - Added Pylon endpoints
  • 1.0.4 - Fixed Code Contract packaging issue (another!)
  • 1.0.3 - Fixed Code Contract packaging issue
  • 1.0.2 - Fixed issue 17 - Fixed unsubscribing from a stream
  • 1.0.0 - Completed rewrite of library

datasift-dotnet's People

Contributors

aszac avatar dugjason avatar jonparish avatar richcaudle avatar zcourts avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.