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

Latest commit

 

History

History
53 lines (44 loc) · 2.41 KB

GetChatApiInstances.md

File metadata and controls

53 lines (44 loc) · 2.41 KB

Getting a collection of ChatApi instances.

Implementation note
This method is available in both synchronous and asynchronous implementations.

Response

Parameter Description The data type of the parameter
InstanceCollection Collection of instances ChatApiInstanceCollection

Parameters of the ChatApiInstanceCollection

Parameter Description The data type of the parameter
Name The name of the instance
Can be empty
String
ApiUrl Link for accessing the server String
PaidTill End date of the paid period DateTime
Instance The unique identifier of the instance String
IsActive An indicator of the activity instance Boolean
TypeInstance Instance type ChatApiInstanceType
PaymentsCount Number of paid months Integer

Example

using System;

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

using ChatApi.Instances;
using ChatApi.Instances.Models;
using ChatApi.Instances.Connect;

using ChatApi.Instances.Requests;
using ChatApi.Instances.Requests.Interfaces;
using ChatApi.Instances.Responses.Interfaces;

namespace ChatApiClient
{
    internal static class Program
    {
        internal static void Main()
        {
            IChatApiInstanceConnect connect = new ChatApiInstanceConnect("ApiKey");
            IChatApiInstanceOperations instanceOperations = new ChatApiInstanceOperations(connect);
            
            IChatApiResponse<IChatApiInstanceCollectionResponse?> chatApiResponse = instanceOperations.GetChatApiInstances();
            if (!chatApiResponse.IsSuccess) throw chatApiResponse.Exception!;

            var response = chatApiResponse.GetResult();
            Console.WriteLine(response?.PrintMembers());
        }
    }
}