Skip to content

WazapIO/client-csharp

Repository files navigation

WhatsAPI - the C# library for the WhatsAPI Go

The V2 of WhatsAPI Go

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

  • API version: 2.0
  • SDK version: 1.0.0
  • Build package: org.openapitools.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, and use the namespaces:

using WhatsAPI.whatsapi;
using WhatsAPI.Client;
using WhatsAPI.models;

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 WhatsAPI.csproj

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

Getting Started

using System.Collections.Generic;
using System.Diagnostics;
using WhatsAPI.whatsapi;
using WhatsAPI.Client;
using WhatsAPI.models;

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

            Configuration.Default.BasePath = "/api";
            // Configure API key authorization: ApiKeyAuth
            Configuration.Default.ApiKey.Add("Authorization", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // Configuration.Default.ApiKeyPrefix.Add("Authorization", "Bearer");

            var apiInstance = new BusinessManagementApi(Configuration.Default);
            var instanceKey = "instanceKey_example";  // string | Instance key

            try
            {
                // Fetches the catlog.
                APIResponse result = apiInstance.FetchCatlog(instanceKey);
                Debug.WriteLine(result);
            }
            catch (ApiException e)
            {
                Debug.Print("Exception when calling BusinessManagementApi.FetchCatlog: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }

        }
    }
}

Documentation for API Endpoints

All URIs are relative to /api

Class Method HTTP request Description
BusinessManagementApi FetchCatlog GET /instances/{instance_key}/business/catalog Fetches the catlog.
BusinessManagementApi SendPaymentRequest POST /instances/{instance_key}/business/payment-request Send a payment request.
GroupManagementApi AddParticipant POST /instances/{instance_key}/groups/{group_id}/participants/add Add participant.
GroupManagementApi CreateGroup POST /instances/{instance_key}/groups/create Create group.
GroupManagementApi DemoteParticipant PUT /instances/{instance_key}/groups/{group_id}/participants/demote Demote participant.
GroupManagementApi GetAdminGroups GET /instances/{instance_key}/groups/admin Get admin groups.
GroupManagementApi GetAllGroups GET /instances/{instance_key}/groups/ Get all groups.
GroupManagementApi GetAllParticipants GET /instances/{instance_key}/groups/{group_id}/participants Get all participants.
GroupManagementApi GetGroup GET /instances/{instance_key}/groups/{group_id} Get group.
GroupManagementApi GetGroupFromInviteLink GET /instances/{instance_key}/groups/invite-info Get group from invite link.
GroupManagementApi GetGroupInviteCode GET /instances/{instance_key}/groups/{group_id}/invite-code Get group invite code.
GroupManagementApi JoinGroupWithLink GET /instances/{instance_key}/groups/join Join group with invite code.
GroupManagementApi LeaveGroup DELETE /instances/{instance_key}/groups/{group_id}/ Leaves the group.
GroupManagementApi PromoteParticipant PUT /instances/{instance_key}/groups/{group_id}/participants/promote Promote participant.
GroupManagementApi RemoveParticipant DELETE /instances/{instance_key}/groups/{group_id}/participants/remove Remove participant.
GroupManagementApi SetGroupAnnounce PUT /instances/{instance_key}/groups/{group_id}/announce Set group announce.
GroupManagementApi SetGroupDescription PUT /instances/{instance_key}/groups/{group_id}/description Set group description.
GroupManagementApi SetGroupLocked PUT /instances/{instance_key}/groups/{group_id}/lock Set group locked.
GroupManagementApi SetGroupName PUT /instances/{instance_key}/groups/{group_id}/name Set group name.
GroupManagementApi SetGroupPicture PUT /instances/{instance_key}/groups/{group_id}/profile-pic Set group picture.
InstanceApi ChangeWebhookUrl PUT /instances/{instance_key}/webhook Change Webhook url.
InstanceApi CreateInstance POST /instances/create Creates a new instance key.
InstanceApi DeleteInstance DELETE /instances/{instance_key}/delete Delete Instance.
InstanceApi GetContacts GET /instances/{instance_key}/contacts Get contacts.
InstanceApi GetInstance GET /instances/{instance_key}/ Get Instance.
InstanceApi GetQrCode GET /instances/{instance_key}/qrcode Get QrCode.
InstanceApi ListInstances GET /instances/list Get all instances.
InstanceApi LogoutInstance DELETE /instances/{instance_key}/logout Logout Instance.
MessageSendingApi SendAudio POST /instances/{instance_key}/send/audio Send raw audio.
MessageSendingApi SendButtonMessage POST /instances/{instance_key}/send/buttons Send a button message.
MessageSendingApi SendButtonWithMedia POST /instances/{instance_key}/send/button-media Send a button message with a media header.
MessageSendingApi SendContact POST /instances/{instance_key}/send/contact Send a contact message.
MessageSendingApi SendDocument POST /instances/{instance_key}/send/document Send raw document.
MessageSendingApi SendGroupInvite POST /instances/{instance_key}/send/group-invite Send a group invite message
MessageSendingApi SendImage POST /instances/{instance_key}/send/image Send raw image.
MessageSendingApi SendListMessage POST /instances/{instance_key}/send/list Send a List message.
MessageSendingApi SendLocation POST /instances/{instance_key}/send/location Send a location message.
MessageSendingApi SendMediaMessage POST /instances/{instance_key}/send/media Send a media message.
MessageSendingApi SendPollMessage POST /instances/{instance_key}/send/poll Send a Poll message.
MessageSendingApi SendTemplate POST /instances/{instance_key}/send/template Send a template message.
MessageSendingApi SendTemplateWithMedia POST /instances/{instance_key}/send/template-media Send a template message with media.
MessageSendingApi SendTextMessage POST /instances/{instance_key}/send/text Send a text message.
MessageSendingApi SendVideo POST /instances/{instance_key}/send/video Send raw video.
MessageSendingApi UploadMedia POST /instances/{instance_key}/send/upload Upload media.
MessageSendingApi UploadMediaFromUrl POST /instances/{instance_key}/send/upload-url Upload media from url.
MiscellaneousApi DownloadMedia POST /instances/{instance_key}/misc/download Download media
MiscellaneousApi GetProfilePic GET /instances/{instance_key}/misc/profile-pic Get profile pic.
MiscellaneousApi GetUsersInfo POST /instances/{instance_key}/misc/user-info Fetches the users info.
MiscellaneousApi SetChatPresence POST /instances/{instance_key}/misc/chat-presence Set chat presence
MiscellaneousApi UpdateProfilePic PUT /instances/{instance_key}/misc/profile-pic Update profile picture

Documentation for Models

Documentation for Authorization

ApiKeyAuth

  • Type: API key

  • API key parameter name: Authorization

  • Location: HTTP header

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages