ali-hm / BtApiClient

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

BtApiClient - the C# library for the behTIME Public API

project:

  • API version: v1
  • SDK version: 1.0.0
  • Build package: io.swagger.codegen.languages.CSharpClientCodegen

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, Or Use the DLLs in the bin.zip package of release and use the namespaces:

using BtApiClient.Api;
using BtApiClient.Client;
using BtApiClient.Model;

Getting Started

To Use each method you should get a token using PublicApiAuthenticate method. Once you get a token you can use it to call other methods. The token can be used for 30 minutes and when you get INVALID_TOKEN for the result of a api call you can renew it using PublicApiAuthenticate method.

using System;
using System.Diagnostics;
using BtApiClient.Api;
using BtApiClient.Client;
using BtApiClient.Model;

namespace Example
{
    public class Example
    {
        public void main()
        {

            var apiInstance = new PublicApiApi();
            var username = "SampleUsername";  // string | UserName
            var password = "SamplePassword";  // string | Password
            var clientInfo = null;  // Object | a dictionary (or json object) like information of client. could be {}
            var clientLanguage = "fa";  // string | could be fa,en (optional) 
            var oldToken = null;  // string | old token to be renewed (optional) 

            try
            {
                // Authenticate user and Generate a token to be used with other api calls
                PublicApiAuthenticateResult result = apiInstance.PublicApiAuthenticate(username, password, clientInfo, clientLanguage, oldToken);
                Debug.WriteLine(result);

                // Get All Projects that the user has access
                var token = result.Token;  // string | 
                var startIndex = 0;  // int? | it is used for paging. could be 0 to start from first
                var pageSize = 50;  // int? | should be greater than 0
                var searchTitle = null;  // string |  (optional) 
                var onlyActive = true;  // bool? |  (optional) 

                
                ApiListResultApiProjectModel result = apiInstance.PublicApiGetProjects(token, startIndex, pageSize, searchTitle, onlyActive);
                Debug.WriteLine(result);

            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling PublicApiApi.PublicApiAuthenticate: " + e.Message );
            }

        }
    }
}

Documentation for API Endpoints

All URIs are relative to https://app.behtime.ir

Class Method HTTP request Description
PublicApiApi PublicApiAddTask POST /papi/addTask Add a task
PublicApiApi PublicApiAuthenticate POST /papi/authenticate Authenticate user and Generate a token to be used with other api calls
PublicApiApi PublicApiGetProjectTasks POST /papi/projectTasks Get Project Tasks
PublicApiApi PublicApiGetProjects POST /papi/projects Get All Projects that the user has access
PublicApiApi PublicApiGetTaskCategories POST /papi/taskcategories Get Task Categories
PublicApiApi PublicApiGetUsers POST /papi/users Get All Users

Documentation for Models

Documentation for Authorization

All endpoints do not require authorization.

About


Languages

Language:C# 98.3%Language:Shell 1.4%Language:Batchfile 0.3%