diff --git a/src/Notify.Api.Indy.pas b/src/Notify.Api.Indy.pas index 64d3a6e..7d542fb 100644 --- a/src/Notify.Api.Indy.pas +++ b/src/Notify.Api.Indy.pas @@ -173,6 +173,15 @@ function TNotifyApiIndy.Config(const AValue: INotifyConfig): INotifyApi; begin Result := Self; FNotifyConfig := AValue; + + if AValue.ProxyServer <> '' then + begin + FIdHttp.ProxyParams.ProxyServer := AValue.ProxyServer; + FIdHttp.ProxyParams.ProxyUsername := AValue.ProxyUser; + FIdHttp.ProxyParams.ProxyPassword := AValue.ProxyPassword; + FIdHttp.ProxyParams.ProxyPort := AValue.ProxyPort; + end; + end; constructor TNotifyApiIndy.Create; diff --git a/src/Notify.Config.Contract.pas b/src/Notify.Config.Contract.pas index 2579ba6..cb650ad 100644 --- a/src/Notify.Config.Contract.pas +++ b/src/Notify.Config.Contract.pas @@ -24,6 +24,11 @@ interface function LogPath(const AValue: String): INotifyConfig; overload; function SubscriptionType: TNotifySubscriptionType; overload; function SubscriptionType(const AValue: TNotifySubscriptionType): INotifyConfig; overload; + function ProxyServer: string; overload; + function ProxyUser: string; overload; + function ProxyPassword: string; overload; + function ProxyPort: integer; overload; + function Proxy(const aProxyServer, aProxyUser, aProxyPassword: string; const aProxyPort: integer): INotifyConfig; overload; end; implementation diff --git a/src/Notify.Config.pas b/src/Notify.Config.pas index 9117930..7fa9309 100644 --- a/src/Notify.Config.pas +++ b/src/Notify.Config.pas @@ -17,6 +17,8 @@ TNotifyConfig = class sealed(TInterfacedObject, INotifyConfig) FSaveLog: Boolean; FLogPath: String; FSubscriptionType: TNotifySubscriptionType; + FProxyServer, FProxyUser, FProxyPassword: string; + FProxyPort: integer; public class function New: INotifyConfig; private @@ -37,6 +39,11 @@ TNotifyConfig = class sealed(TInterfacedObject, INotifyConfig) function LogPath(const AValue: String): INotifyConfig; overload; function SubscriptionType: TNotifySubscriptionType; overload; function SubscriptionType(const AValue: TNotifySubscriptionType): INotifyConfig; overload; + function ProxyServer: string; overload; + function ProxyUser: string; overload; + function ProxyPassword: string; overload; + function ProxyPort: integer; overload; + function Proxy(const aProxyServer, aProxyUser, aProxyPassword: string; const aProxyPort: integer): INotifyConfig; overload; end; implementation @@ -114,6 +121,34 @@ function TNotifyConfig.Password(const AValue: String): INotifyConfig; FPassword := AValue; end; +function TNotifyConfig.Proxy(const AProxyServer, AProxyUser, AProxyPassword: string; const aProxyPort: integer): INotifyConfig; +begin + FProxyServer := AProxyServer; + FProxyUser := AProxyUser; + FProxyPassword := AProxyPassword; + FProxyPort := AProxyPort; +end; + +function TNotifyConfig.ProxyPassword: string; +begin + Result := FProxyPassword; +end; + +function TNotifyConfig.ProxyPort: integer; +begin + Result := FProxyPort; +end; + +function TNotifyConfig.ProxyServer: string; +begin + Result := FProxyServer; +end; + +function TNotifyConfig.ProxyUser: string; +begin + Result := FProxyUser; +end; + function TNotifyConfig.SaveLog(const AValue: Boolean): INotifyConfig; begin Result := Self; diff --git a/src/Notify.Core.Contract.pas b/src/Notify.Core.Contract.pas index 71e0619..697b296 100644 --- a/src/Notify.Core.Contract.pas +++ b/src/Notify.Core.Contract.pas @@ -36,6 +36,7 @@ interface function Since(const AValue: String): INotifyCore; overload; function Scheduled(const AValue: Boolean): INotifyCore; overload; function Response: TNotifyApiResponse; + function Proxy(const AProxyServer, AProxyUser, AProxyPassword: String; const AProxyPort: Integer): INotifyCore; overload; end; INotifyCoreFacade = interface diff --git a/src/Notify.Core.pas b/src/Notify.Core.pas index 980b7ad..ae83d60 100644 --- a/src/Notify.Core.pas +++ b/src/Notify.Core.pas @@ -53,6 +53,7 @@ TNotifyCore = class sealed(TInterfacedObject, INotifyCore) function UserName(const AValue: String): INotifyCore; function Password(const AValue: String): INotifyCore; function BaseURL(const AValue: String): INotifyCore; + function Proxy(const aProxyServer, aProxyUser, aProxyPassword: string; const aProxyPort: integer): INotifyCore; function DisableFireBase(const AValue: Boolean): INotifyCore; function Notification(const ANotification: INotifyNotification): INotifyCore; overload; function Filter(const AFilterType: TNotifyFilter; const AValue: String): INotifyCore; @@ -344,6 +345,12 @@ function TNotifyCore.Poll(const AValue: Boolean): INotifyCore; FPoll := AValue; end; +function TNotifyCore.Proxy(const aProxyServer, aProxyUser, + aProxyPassword: string; const aProxyPort: integer): INotifyCore; +begin + FConfig.Proxy(aProxyServer, aProxyUser, aProxyPassword, aProxyPort); +end; + function TNotifyCore.Publish: INotifyCore; begin Result := Self;