Skip to content
This repository was archived by the owner on Dec 18, 2023. It is now read-only.

Latest commit

 

History

History
38 lines (30 loc) · 1.12 KB

File metadata and controls

38 lines (30 loc) · 1.12 KB

Getting a QR code.

Implementation notes
Returns a QR code image file in png format.
This method is only available in the asynchronous implementation.

Example

using System;

using ChatApi.Core.Connect;
using ChatApi.Core.Connect.Interfaces;

using ChatApi.WA.Account;
using ChatApi.WA.Account.Requests;

using ChatApiClient.Properties;
namespace ChatApiClient
{
    internal class Program
    {
        internal static IWhatsAppConnect Connect { get; set; }

        internal static async Task Main()
        {
            // put your chat-api's data
            Connect = new WhatsAppConnect(WhatsApp_Server, WhatsApp_Instance, WhatsApp_Token); 
            IAccountOperation accountOperation = new AccountOperation(connect);

            IChatApiResponse<IQrCodeResponse?>? chatApiResponse = await accountOperation.GetQrCodeAsync().ConfigureAwait(true);

            if (!chatApiResponse.IsSuccess) throw chatApiResponse.Exception!;
            var response = chatApiResponse.GetResult();
            
            Console.WriteLine(response?.PrintMembers());
        }
    }
}