microsoft/teams.net
Publicmirrored fromhttps://github.com/microsoft/teams.netAvailable
Libraries/Microsoft.Teams.Api/Clients/ApiClient.cs
67lines · modecode
| 1 | // Copyright (c) Microsoft Corporation. All rights reserved. |
| 2 | // Licensed under the MIT License. |
| 3 | |
| 4 | using Microsoft.Teams.Common.Http; |
| 5 | |
| 6 | namespace Microsoft.Teams.Api.Clients; |
| 7 | |
| 8 | public class ApiClient : Client |
| 9 | { |
| 10 | public virtual string ServiceUrl { get; } |
| 11 | public virtual BotClient Bots { get; } |
| 12 | public virtual ConversationClient Conversations { get; } |
| 13 | public virtual UserClient Users { get; } |
| 14 | public virtual TeamClient Teams { get; } |
| 15 | public virtual MeetingClient Meetings { get; } |
| 16 | |
| 17 | public ApiClient(string serviceUrl, CancellationToken cancellationToken = default) : base(cancellationToken) |
| 18 | { |
| 19 | ServiceUrl = serviceUrl; |
| 20 | Bots = new BotClient(_http, cancellationToken); |
| 21 | Conversations = new ConversationClient(serviceUrl, _http, cancellationToken); |
| 22 | Users = new UserClient(_http, cancellationToken); |
| 23 | Teams = new TeamClient(serviceUrl, _http, cancellationToken); |
| 24 | Meetings = new MeetingClient(serviceUrl, _http, cancellationToken); |
| 25 | } |
| 26 | |
| 27 | public ApiClient(string serviceUrl, IHttpClient client, CancellationToken cancellationToken = default) : base(client, cancellationToken) |
| 28 | { |
| 29 | ServiceUrl = serviceUrl; |
| 30 | Bots = new BotClient(_http, cancellationToken); |
| 31 | Conversations = new ConversationClient(serviceUrl, _http, cancellationToken); |
| 32 | Users = new UserClient(_http, cancellationToken); |
| 33 | Teams = new TeamClient(serviceUrl, _http, cancellationToken); |
| 34 | Meetings = new MeetingClient(serviceUrl, _http, cancellationToken); |
| 35 | } |
| 36 | |
| 37 | public ApiClient(string serviceUrl, IHttpClientOptions options, CancellationToken cancellationToken = default) : base(options, cancellationToken) |
| 38 | { |
| 39 | ServiceUrl = serviceUrl; |
| 40 | Bots = new BotClient(_http, cancellationToken); |
| 41 | Conversations = new ConversationClient(serviceUrl, _http, cancellationToken); |
| 42 | Users = new UserClient(_http, cancellationToken); |
| 43 | Teams = new TeamClient(serviceUrl, _http, cancellationToken); |
| 44 | Meetings = new MeetingClient(serviceUrl, _http, cancellationToken); |
| 45 | } |
| 46 | |
| 47 | public ApiClient(string serviceUrl, IHttpClientFactory factory, CancellationToken cancellationToken = default) : base(factory, cancellationToken) |
| 48 | { |
| 49 | ServiceUrl = serviceUrl; |
| 50 | Bots = new BotClient(_http, cancellationToken); |
| 51 | Conversations = new ConversationClient(serviceUrl, _http, cancellationToken); |
| 52 | Users = new UserClient(_http, cancellationToken); |
| 53 | Teams = new TeamClient(serviceUrl, _http, cancellationToken); |
| 54 | Meetings = new MeetingClient(serviceUrl, _http, cancellationToken); |
| 55 | } |
| 56 | |
| 57 | public ApiClient(ApiClient client) : base() |
| 58 | { |
| 59 | ServiceUrl = client.ServiceUrl; |
| 60 | Bots = client.Bots; |
| 61 | Conversations = client.Conversations; |
| 62 | Users = client.Users; |
| 63 | Teams = client.Teams; |
| 64 | Meetings = client.Meetings; |
| 65 | _cancellationToken = client._cancellationToken; |
| 66 | } |
| 67 | } |