Skip to content

dadapush/dadapush-csharp-client

Repository files navigation

Com.DaDaPush.Client - the C# library for the DaDaPush Public API

DaDaPush: Real-time Notifications App

Send real-time notifications through our API without coding and maintaining your own app for iOS or Android devices.

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

  • API version: v1
  • SDK version: 1.0.0
  • Build package: org.openapitools.codegen.languages.CSharpClientCodegen For more information, please visit https://www.dadapush.com

Frameworks supported

  • .NET 4.0 or later
  • Windows Phone 7.1 (Mango)

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

NOTE: RestSharp versions greater than 105.1.0 have a bug which causes file uploads to fail. See RestSharp#742

Installation

Run the following command to generate the DLL

  • [Mac/Linux] /bin/sh build.sh
  • [Windows] build.bat

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

using Com.DaDaPush.Client.Api;
using Com.DaDaPush.Client.Client;
using Com.DaDaPush.Client.Model;

Packaging

A .nuspec is included with the project. You can follow the Nuget quickstart to create and publish packages.

This .nuspec uses placeholders from the .csproj, so build the .csproj directly:

nuget pack -Build -OutputDirectory out Com.DaDaPush.Client.csproj

Then, publish to a local feed or other host and consume the new package via Nuget as usual.

Getting Started

using System.Diagnostics;
using Com.DaDaPush.Client.Api;
using Com.DaDaPush.Client.Client;
using Com.DaDaPush.Client.Model;

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

            Configuration.Default.BasePath = "https://www.dadapush.com";
            var apiInstance = new DaDaPushMessageApi(Configuration.Default);
            var body = new MessagePushRequest(); // MessagePushRequest | body
            var xChannelToken = xChannelToken_example;  // string | see: https://www.dadapush.com/channel/list (optional) 

            try
            {
                // push Message to a Channel
                ResultOfMessagePushResponse result = apiInstance.CreateMessage(body, xChannelToken);
                Debug.WriteLine(result);
            }
            catch (ApiException e)
            {
                Debug.Print("Exception when calling DaDaPushMessageApi.CreateMessage: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }

        }
    }
}

Documentation for API Endpoints

All URIs are relative to https://www.dadapush.com

Class Method HTTP request Description
DaDaPushMessageApi CreateMessage POST /api/v1/message push Message to a Channel
DaDaPushMessageApi DeleteMessage DELETE /api/v1/message/{messageId} delete a Channel Message
DaDaPushMessageApi GetMessage GET /api/v1/message/{messageId} get a Channel Message
DaDaPushMessageApi GetMessages GET /api/v1/messages get Message List

Documentation for Models