This repository was archived by the owner on May 8, 2020. It is now read-only.
Repository navigation
Expand file tree
/
Copy pathLeanKitIntegrationFactory.cs
More file actions
81 lines (74 loc) · 3.73 KB
/
Copy pathLeanKitIntegrationFactory.cs
File metadata and controls
81 lines (74 loc) · 3.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
//------------------------------------------------------------------------------
// <copyright company="LeanKit Inc.">
// Copyright (c) LeanKit Inc. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
using System;
using LeanKit.API.Client.Library.TransferObjects;
namespace LeanKit.API.Client.Library
{
public class LeanKitIntegrationFactory : ILeanKitIntegrationFactory
{
/// <summary>
/// Factory method that creates and returns the <see cref="LeanKitIntegration" /> implementation using the
/// LeanKitClient created with the default <see cref="IRestCommandProcessor" />.
/// </summary>
/// <remarks>
/// The default implementation of the <see cref="IRestCommandProcessor" /> uses RestSharp.
/// </remarks>
/// <param name="boardId">The Identity of the Board that will be watched and modified.</param>
/// <param name="accountAuth">The account authentication information used to connect to the LeanKit API.</param>
/// <returns>The <see cref="ILeanKitIntegration" /> used to monitor and modify the specified board. </returns>
public ILeanKitIntegration Create(long boardId, ILeanKitAccountAuth accountAuth)
{
var clientFactory = new LeanKitClientFactory();
var apiClient = clientFactory.Create(accountAuth);
return new LeanKitIntegration(boardId, apiClient);
}
public ILeanKitIntegration Create(long boardId, ILeanKitAccountAuth accountAuth, IntegrationSettings settings)
{
var clientFactory = new LeanKitClientFactory();
var apiClient = clientFactory.Create(accountAuth);
return new LeanKitIntegration(boardId, apiClient, settings);
}
/// <summary>
/// Factory method that creates and returns the <see cref="LeanKitIntegration" /> implementation using the
/// LeanKitClient passed into the method.
/// </summary>
/// <remarks>
/// This method should be used for consumers that would like to override the default
/// <see cref="IRestCommandProcessor" />.
/// </remarks>
/// <param name="boardId">The Identity of the Board that will be watched and modified.</param>
/// <param name="apiClient">The <see cref="ILeanKitApi" /> implementation used to communicate with the LeanKit API.</param>
/// <returns></returns>
public ILeanKitIntegration Create(long boardId, ILeanKitApi apiClient)
{
return new LeanKitIntegration(boardId, apiClient);
}
/// <summary>
/// Factory method that creates and returns the <see cref="LeanKitIntegration" /> implementation using the
/// LeanKitClient created with the default <see cref="IRestCommandProcessor" />.
/// </summary>
/// <remarks>
/// The default implementation of the <see cref="IRestCommandProcessor" /> uses RestSharp.
/// </remarks>
/// <param name="boardId">The Identity of the Board that will be watched and modified.</param>
/// <param name="accountAuth">The account authentication information used to connect to the LeanKit API.</param>
/// <returns>The <see cref="ILeanKitIntegration" /> used to monitor and modify the specified board. </returns>
[Obsolete("This is deprecated. Please use ILeanKitAccountAuth instead.")]
public ILeanKitIntegration Create(long boardId, LeanKitAccountAuth accountAuth)
{
var clientFactory = new LeanKitClientFactory();
var apiClient = clientFactory.Create(accountAuth);
return new LeanKitIntegration(boardId, apiClient);
}
[Obsolete("This is deprecated. Please use ILeanKitAccountAuth instead.")]
public ILeanKitIntegration Create(long boardId, LeanKitAccountAuth accountAuth, IntegrationSettings settings)
{
var clientFactory = new LeanKitClientFactory();
var apiClient = clientFactory.Create(accountAuth);
return new LeanKitIntegration(boardId, apiClient, settings);
}
}
}