-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
313 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace ZoomNet | ||
{ | ||
/// <summary> | ||
/// Interface for connection information. | ||
/// </summary> | ||
public interface IConnectionInfo | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
namespace ZoomNet | ||
{ | ||
/// <summary> | ||
/// Connect using JWT. | ||
/// </summary> | ||
public class JwtConnectionInfo : IConnectionInfo | ||
{ | ||
/// <summary> | ||
/// Gets the API Key. | ||
/// </summary> | ||
public string ApiKey { get; } | ||
|
||
/// <summary> | ||
/// Gets the API Secret. | ||
/// </summary> | ||
public string ApiSecret { get; } | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="JwtConnectionInfo"/> class. | ||
/// </summary> | ||
/// <param name="apiKey">Your JWT app API Key.</param> | ||
/// <param name="apiSecret">Your JWT app API Secret.</param> | ||
public JwtConnectionInfo(string apiKey, string apiSecret) | ||
{ | ||
ApiKey = apiKey; | ||
ApiSecret = apiSecret; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using System.Runtime.Serialization; | ||
|
||
namespace ZoomNet.Models | ||
{ | ||
/// <summary> | ||
/// Enumeration to indicate the OAuth grant type. | ||
/// </summary> | ||
public enum OAuthGrantType | ||
{ | ||
/// <summary> | ||
/// Authorization code. This is the most commonly used grant type for Zoom APIs. | ||
/// </summary> | ||
[EnumMember(Value = "authorization_code")] | ||
AuthorizationCode, | ||
|
||
/// <summary> | ||
/// Client Credentials. | ||
/// </summary> | ||
[EnumMember(Value = "client_credentials")] | ||
ClientCredentials | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
using System; | ||
using ZoomNet.Models; | ||
|
||
namespace ZoomNet | ||
{ | ||
/// <summary> | ||
/// Connect using OAuth. | ||
/// </summary> | ||
public class OAuthConnectionInfo : IConnectionInfo | ||
{ | ||
/// <summary> | ||
/// Gets the client id. | ||
/// </summary> | ||
public string ClientId { get; } | ||
|
||
/// <summary> | ||
/// Gets the client secret. | ||
/// </summary> | ||
public string ClientSecret { get; } | ||
|
||
/// <summary> | ||
/// Gets the grant type. | ||
/// </summary> | ||
public OAuthGrantType GrantType { get; } | ||
|
||
/// <summary> | ||
/// Gets the authorization code. | ||
/// </summary> | ||
/// <remarks>This value is relevant only if the grant type is "AuthorizationCode".</remarks> | ||
public string AuthorizationCode { get; } | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="OAuthConnectionInfo"/> class. | ||
/// </summary> | ||
/// <remarks> | ||
/// This constructor is used to get access token for APIs that do not | ||
/// need a user’s permission, but rather a service’s permission. | ||
/// Within the realm of Zoom APIs, Client Credentials grant should be | ||
/// used to get access token from the Chatbot Service in order to use | ||
/// the "Send Chatbot Messages API". See the "Using OAuth 2.0 / Client | ||
/// Credentials" section in the "Using Zoom APIs" document for more details | ||
/// (https://marketplace.zoom.us/docs/api-reference/using-zoom-apis). | ||
/// </remarks> | ||
/// <param name="clientId">Your Client Id.</param> | ||
/// <param name="clientSecret">Your Client Secret.</param> | ||
public OAuthConnectionInfo(string clientId, string clientSecret) | ||
{ | ||
ClientId = clientId ?? throw new ArgumentNullException(nameof(clientId)); | ||
ClientSecret = clientSecret ?? throw new ArgumentNullException(nameof(clientSecret)); | ||
GrantType = OAuthGrantType.ClientCredentials; | ||
} | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="OAuthConnectionInfo"/> class. | ||
/// </summary> | ||
/// <remarks> | ||
/// This is the most commonly used grant type for Zoom APIs. | ||
/// </remarks> | ||
/// <param name="clientId">Your Client Id.</param> | ||
/// <param name="clientSecret">Your Client Secret.</param> | ||
/// <param name="authorizationCode">The authorization code.</param> | ||
public OAuthConnectionInfo(string clientId, string clientSecret, string authorizationCode) | ||
{ | ||
ClientId = clientId ?? throw new ArgumentNullException(nameof(clientId)); | ||
ClientSecret = clientSecret ?? throw new ArgumentNullException(nameof(clientSecret)); | ||
AuthorizationCode = authorizationCode ?? throw new ArgumentNullException(nameof(authorizationCode)); | ||
GrantType = OAuthGrantType.AuthorizationCode; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.