Пример #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FacebookAdapter"/> class using an existing Facebook client.
 /// </summary>
 /// /// <param name="facebookClient">Client used to interact with the Facebook API.</param>
 /// <param name="options">Options for the Facebook Adapter.</param>
 /// <param name="logger">The logger this adapter should use.</param>
 /// <exception cref="ArgumentNullException"><paramref name="options"/> is null.</exception>
 public FacebookAdapter(FacebookClientWrapper facebookClient, FacebookAdapterOptions options, ILogger logger = null)
 {
     _options        = options ?? new FacebookAdapterOptions();
     _facebookClient = facebookClient ?? throw new ArgumentNullException(nameof(facebookClient));
     _logger         = logger ?? NullLogger.Instance;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="FacebookClientWrapper"/> class.
 /// </summary>
 /// <param name="options">An object containing API credentials, a webhook verification token, and other options.</param>
 public FacebookClientWrapper(FacebookAdapterOptions options)
 {
     _options = options ?? throw new ArgumentNullException(nameof(options));
 }
Пример #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FacebookAdapter"/> class using configuration settings.
 /// </summary>
 /// <param name="configuration">An <see cref="IConfiguration"/> instance.</param>
 /// <remarks>
 /// The adapter uses these configuration keys:
 /// - `VerifyToken`, the token to respond to the initial verification request.
 /// - `AppSecret`, the secret used to validate incoming webhooks.
 /// - `AccessToken`, an access token for the bot.
 /// </remarks>
 /// <param name="options">An instance of <see cref="FacebookAdapterOptions"/>.</param>
 /// <param name="logger">The logger this adapter should use.</param>
 public FacebookAdapter(IConfiguration configuration, FacebookAdapterOptions options = null, ILogger logger = null)
     : this(new FacebookClientWrapper(new FacebookClientWrapperOptions(configuration[FacebookVerifyTokenSettingKey], configuration[FacebookAppSecretSettingKey], configuration[FacebookAccessTokenSettingKey])), options, logger)
 {
 }