unit Chilkat.Upload;

{
  Pascal wrapper for Chilkat Upload.
  Auto-generated by PascalWrapperGenerator -- do not edit manually.
}

{$IFDEF FPC}
  {$MODE DELPHI}
{$ENDIF}

interface

uses
  SysUtils,
  Chilkat.Base;

type

  { TUpload wraps CkUpload via the C bridge layer. }
  TUpload = class(TChilkatBase)
  private
    FOnAbortCheck: TChilkatAbortCheckEvent;
    FOnPercentDone: TChilkatPercentDoneEvent;
    FOnProgressInfo: TChilkatProgressInfoEvent;
    function  GetLastErrorHtml: string;
    function  GetLastErrorText: string;
    function  GetLastErrorXml: string;
    function  GetVersion: string;
    function  GetDebugLogFilePath: string;
    procedure SetDebugLogFilePath(AValue: string);
    function  GetVerboseLogging: Boolean;
    procedure SetVerboseLogging(AValue: Boolean);
    function  GetLastMethodSuccess: Boolean;
    procedure SetLastMethodSuccess(AValue: Boolean);
    function  GetBandwidthThrottleUp: Integer;
    procedure SetBandwidthThrottleUp(AValue: Integer);
    function  GetChunkSize: Integer;
    procedure SetChunkSize(AValue: Integer);
    function  GetClientIpAddress: string;
    procedure SetClientIpAddress(AValue: string);
    function  GetExpect100Continue: Boolean;
    procedure SetExpect100Continue(AValue: Boolean);
    function  GetHeartbeatMs: Integer;
    procedure SetHeartbeatMs(AValue: Integer);
    function  GetHostname: string;
    procedure SetHostname(AValue: string);
    function  GetIdleTimeoutMs: Integer;
    procedure SetIdleTimeoutMs(AValue: Integer);
    function  GetLogin: string;
    procedure SetLogin(AValue: string);
    function  GetNumBytesSent: LongWord;
    function  GetPassword: string;
    procedure SetPassword(AValue: string);
    function  GetPath: string;
    procedure SetPath(AValue: string);
    function  GetPercentDoneScale: Integer;
    procedure SetPercentDoneScale(AValue: Integer);
    function  GetPercentUploaded: LongWord;
    function  GetPort: Integer;
    procedure SetPort(AValue: Integer);
    function  GetPreferIpv6: Boolean;
    procedure SetPreferIpv6(AValue: Boolean);
    function  GetProxyDomain: string;
    procedure SetProxyDomain(AValue: string);
    function  GetProxyLogin: string;
    procedure SetProxyLogin(AValue: string);
    function  GetProxyPassword: string;
    procedure SetProxyPassword(AValue: string);
    function  GetProxyPort: Integer;
    procedure SetProxyPort(AValue: Integer);
    function  GetResponseHeader: string;
    function  GetResponseStatus: Integer;
    function  GetSsl: Boolean;
    procedure SetSsl(AValue: Boolean);
    function  GetTotalUploadSize: LongWord;
    function  GetUploadInProgress: Boolean;
    function  GetUploadSuccess: Boolean;
    function  GetTlsPinSet: string;
    procedure SetTlsPinSet(AValue: string);
    function  GetSslAllowedCiphers: string;
    procedure SetSslAllowedCiphers(AValue: string);
    function  GetSslProtocol: string;
    procedure SetSslProtocol(AValue: string);
    function  GetAbortCurrent: Boolean;
    procedure SetAbortCurrent(AValue: Boolean);
    function  GetResponseBodyStr: string;
    function  GetCurrentFilename: string;
    procedure SetOnAbortCheck(AValue: TChilkatAbortCheckEvent);
    procedure SetOnPercentDone(AValue: TChilkatPercentDoneEvent);
    procedure SetOnProgressInfo(AValue: TChilkatProgressInfoEvent);
  public
    constructor Create;
    destructor  Destroy; override;

    property LastErrorHtml: string read GetLastErrorHtml;
    property LastErrorText: string read GetLastErrorText;
    property LastErrorXml: string read GetLastErrorXml;
    property Version: string read GetVersion;
    property DebugLogFilePath: string read GetDebugLogFilePath write SetDebugLogFilePath;
    property VerboseLogging: Boolean read GetVerboseLogging write SetVerboseLogging;
    property LastMethodSuccess: Boolean read GetLastMethodSuccess write SetLastMethodSuccess;
    property BandwidthThrottleUp: Integer read GetBandwidthThrottleUp write SetBandwidthThrottleUp;
    property ChunkSize: Integer read GetChunkSize write SetChunkSize;
    property ClientIpAddress: string read GetClientIpAddress write SetClientIpAddress;
    property Expect100Continue: Boolean read GetExpect100Continue write SetExpect100Continue;
    property HeartbeatMs: Integer read GetHeartbeatMs write SetHeartbeatMs;
    property Hostname: string read GetHostname write SetHostname;
    property IdleTimeoutMs: Integer read GetIdleTimeoutMs write SetIdleTimeoutMs;
    property Login: string read GetLogin write SetLogin;
    property NumBytesSent: LongWord read GetNumBytesSent;
    property Password: string read GetPassword write SetPassword;
    property Path: string read GetPath write SetPath;
    property PercentDoneScale: Integer read GetPercentDoneScale write SetPercentDoneScale;
    property PercentUploaded: LongWord read GetPercentUploaded;
    property Port: Integer read GetPort write SetPort;
    property PreferIpv6: Boolean read GetPreferIpv6 write SetPreferIpv6;
    property ProxyDomain: string read GetProxyDomain write SetProxyDomain;
    property ProxyLogin: string read GetProxyLogin write SetProxyLogin;
    property ProxyPassword: string read GetProxyPassword write SetProxyPassword;
    property ProxyPort: Integer read GetProxyPort write SetProxyPort;
    property ResponseHeader: string read GetResponseHeader;
    property ResponseStatus: Integer read GetResponseStatus;
    property Ssl: Boolean read GetSsl write SetSsl;
    property TotalUploadSize: LongWord read GetTotalUploadSize;
    property UploadInProgress: Boolean read GetUploadInProgress;
    property UploadSuccess: Boolean read GetUploadSuccess;
    property TlsPinSet: string read GetTlsPinSet write SetTlsPinSet;
    property SslAllowedCiphers: string read GetSslAllowedCiphers write SetSslAllowedCiphers;
    property SslProtocol: string read GetSslProtocol write SetSslProtocol;
    property AbortCurrent: Boolean read GetAbortCurrent write SetAbortCurrent;
    property ResponseBodyStr: string read GetResponseBodyStr;
    property CurrentFilename: string read GetCurrentFilename;

    { Event callbacks.  Return True from OnAbortCheck / OnPercentDone
      to abort the running method.  Callbacks are invoked on the
      thread that called the Chilkat method.  The HeartbeatMs
      property controls the AbortCheck frequency. }
    property OnAbortCheck: TChilkatAbortCheckEvent read FOnAbortCheck write SetOnAbortCheck;
    property OnPercentDone: TChilkatPercentDoneEvent read FOnPercentDone write SetOnPercentDone;
    property OnProgressInfo: TChilkatProgressInfoEvent read FOnProgressInfo write SetOnProgressInfo;

    procedure AbortUpload;
    procedure AddCustomHeader(const name: string; const value: string);
    procedure AddFileReference(const name: string; const filename: string);
    procedure AddParam(const name: string; const value: string);
    function  BeginUpload: Boolean;
    function  BlockingUpload: Boolean;
    procedure ClearFileReferences;
    procedure ClearParams;
    procedure SleepMs(millisec: Integer);
  end;

implementation

uses
  CkDllLoader,
  Chilkat.Utils;

{ ---- C bridge function pointer types ---- }
type
  TCkUpload_Create  = function(): Pointer; cdecl;
  TCkUpload_Dispose = procedure(handle: Pointer); cdecl;
  TCkBridgeAbortCheckCb   = function(userData: Pointer): Integer; cdecl;
  TCkBridgePercentDoneCb  = function(pctDone: Integer; userData: Pointer): Integer; cdecl;
  TCkBridgeProgressInfoCb = procedure(name: PAnsiChar; value: PAnsiChar; userData: Pointer); cdecl;
  TCkUpload_SetAbortCheckCallback   = procedure(handle: Pointer; cb: TCkBridgeAbortCheckCb; userData: Pointer); cdecl;
  TCkUpload_SetPercentDoneCallback  = procedure(handle: Pointer; cb: TCkBridgePercentDoneCb; userData: Pointer); cdecl;
  TCkUpload_SetProgressInfoCallback = procedure(handle: Pointer; cb: TCkBridgeProgressInfoCb; userData: Pointer); cdecl;
  TCkUpload_get_LastErrorHtml = function(handle: Pointer): PAnsiChar; cdecl;
  TCkUpload_get_LastErrorText = function(handle: Pointer): PAnsiChar; cdecl;
  TCkUpload_get_LastErrorXml = function(handle: Pointer): PAnsiChar; cdecl;
  TCkUpload_get_Version = function(handle: Pointer): PAnsiChar; cdecl;
  TCkUpload_get_DebugLogFilePath = function(handle: Pointer): PAnsiChar; cdecl;
  TCkUpload_put_DebugLogFilePath = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkUpload_get_VerboseLogging = function(handle: Pointer): LongBool; cdecl;
  TCkUpload_put_VerboseLogging = procedure(handle: Pointer; value: LongBool); cdecl;
  TCkUpload_get_LastMethodSuccess = function(handle: Pointer): LongBool; cdecl;
  TCkUpload_put_LastMethodSuccess = procedure(handle: Pointer; value: LongBool); cdecl;
  TCkUpload_get_BandwidthThrottleUp = function(handle: Pointer): Integer; cdecl;
  TCkUpload_put_BandwidthThrottleUp = procedure(handle: Pointer; value: Integer); cdecl;
  TCkUpload_get_ChunkSize = function(handle: Pointer): Integer; cdecl;
  TCkUpload_put_ChunkSize = procedure(handle: Pointer; value: Integer); cdecl;
  TCkUpload_get_ClientIpAddress = function(handle: Pointer): PAnsiChar; cdecl;
  TCkUpload_put_ClientIpAddress = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkUpload_get_Expect100Continue = function(handle: Pointer): LongBool; cdecl;
  TCkUpload_put_Expect100Continue = procedure(handle: Pointer; value: LongBool); cdecl;
  TCkUpload_get_HeartbeatMs = function(handle: Pointer): Integer; cdecl;
  TCkUpload_put_HeartbeatMs = procedure(handle: Pointer; value: Integer); cdecl;
  TCkUpload_get_Hostname = function(handle: Pointer): PAnsiChar; cdecl;
  TCkUpload_put_Hostname = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkUpload_get_IdleTimeoutMs = function(handle: Pointer): Integer; cdecl;
  TCkUpload_put_IdleTimeoutMs = procedure(handle: Pointer; value: Integer); cdecl;
  TCkUpload_get_Login = function(handle: Pointer): PAnsiChar; cdecl;
  TCkUpload_put_Login = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkUpload_get_NumBytesSent = function(handle: Pointer): LongWord; cdecl;
  TCkUpload_get_Password = function(handle: Pointer): PAnsiChar; cdecl;
  TCkUpload_put_Password = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkUpload_get_Path = function(handle: Pointer): PAnsiChar; cdecl;
  TCkUpload_put_Path = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkUpload_get_PercentDoneScale = function(handle: Pointer): Integer; cdecl;
  TCkUpload_put_PercentDoneScale = procedure(handle: Pointer; value: Integer); cdecl;
  TCkUpload_get_PercentUploaded = function(handle: Pointer): LongWord; cdecl;
  TCkUpload_get_Port = function(handle: Pointer): Integer; cdecl;
  TCkUpload_put_Port = procedure(handle: Pointer; value: Integer); cdecl;
  TCkUpload_get_PreferIpv6 = function(handle: Pointer): LongBool; cdecl;
  TCkUpload_put_PreferIpv6 = procedure(handle: Pointer; value: LongBool); cdecl;
  TCkUpload_get_ProxyDomain = function(handle: Pointer): PAnsiChar; cdecl;
  TCkUpload_put_ProxyDomain = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkUpload_get_ProxyLogin = function(handle: Pointer): PAnsiChar; cdecl;
  TCkUpload_put_ProxyLogin = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkUpload_get_ProxyPassword = function(handle: Pointer): PAnsiChar; cdecl;
  TCkUpload_put_ProxyPassword = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkUpload_get_ProxyPort = function(handle: Pointer): Integer; cdecl;
  TCkUpload_put_ProxyPort = procedure(handle: Pointer; value: Integer); cdecl;
  TCkUpload_get_ResponseHeader = function(handle: Pointer): PAnsiChar; cdecl;
  TCkUpload_get_ResponseStatus = function(handle: Pointer): Integer; cdecl;
  TCkUpload_get_Ssl = function(handle: Pointer): LongBool; cdecl;
  TCkUpload_put_Ssl = procedure(handle: Pointer; value: LongBool); cdecl;
  TCkUpload_get_TotalUploadSize = function(handle: Pointer): LongWord; cdecl;
  TCkUpload_get_UploadInProgress = function(handle: Pointer): LongBool; cdecl;
  TCkUpload_get_UploadSuccess = function(handle: Pointer): LongBool; cdecl;
  TCkUpload_get_TlsPinSet = function(handle: Pointer): PAnsiChar; cdecl;
  TCkUpload_put_TlsPinSet = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkUpload_get_SslAllowedCiphers = function(handle: Pointer): PAnsiChar; cdecl;
  TCkUpload_put_SslAllowedCiphers = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkUpload_get_SslProtocol = function(handle: Pointer): PAnsiChar; cdecl;
  TCkUpload_put_SslProtocol = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkUpload_get_AbortCurrent = function(handle: Pointer): LongBool; cdecl;
  TCkUpload_put_AbortCurrent = procedure(handle: Pointer; value: LongBool); cdecl;
  TCkUpload_get_ResponseBodyStr = function(handle: Pointer): PAnsiChar; cdecl;
  TCkUpload_get_CurrentFilename = function(handle: Pointer): PAnsiChar; cdecl;
  TCkUpload_AbortUpload = procedure(handle: Pointer); cdecl;
  TCkUpload_AddCustomHeader = procedure(handle: Pointer; name: PAnsiChar; value: PAnsiChar); cdecl;
  TCkUpload_AddFileReference = procedure(handle: Pointer; name: PAnsiChar; filename: PAnsiChar); cdecl;
  TCkUpload_AddParam = procedure(handle: Pointer; name: PAnsiChar; value: PAnsiChar); cdecl;
  TCkUpload_BeginUpload = function(handle: Pointer): LongBool; cdecl;
  TCkUpload_BlockingUpload = function(handle: Pointer): LongBool; cdecl;
  TCkUpload_ClearFileReferences = procedure(handle: Pointer); cdecl;
  TCkUpload_ClearParams = procedure(handle: Pointer); cdecl;
  TCkUpload_SleepMs = procedure(handle: Pointer; millisec: Integer); cdecl;

{ ---- C bridge function pointer variables ---- }
var
  CkUpload_Create:  TCkUpload_Create  = nil;
  CkUpload_Dispose: TCkUpload_Dispose = nil;
  CkUpload_SetAbortCheckCallback:   TCkUpload_SetAbortCheckCallback   = nil;
  CkUpload_SetPercentDoneCallback:  TCkUpload_SetPercentDoneCallback  = nil;
  CkUpload_SetProgressInfoCallback: TCkUpload_SetProgressInfoCallback = nil;
  CkUpload_get_LastErrorHtml: TCkUpload_get_LastErrorHtml = nil;
  CkUpload_get_LastErrorText: TCkUpload_get_LastErrorText = nil;
  CkUpload_get_LastErrorXml: TCkUpload_get_LastErrorXml = nil;
  CkUpload_get_Version: TCkUpload_get_Version = nil;
  CkUpload_get_DebugLogFilePath: TCkUpload_get_DebugLogFilePath = nil;
  CkUpload_put_DebugLogFilePath: TCkUpload_put_DebugLogFilePath = nil;
  CkUpload_get_VerboseLogging: TCkUpload_get_VerboseLogging = nil;
  CkUpload_put_VerboseLogging: TCkUpload_put_VerboseLogging = nil;
  CkUpload_get_LastMethodSuccess: TCkUpload_get_LastMethodSuccess = nil;
  CkUpload_put_LastMethodSuccess: TCkUpload_put_LastMethodSuccess = nil;
  CkUpload_get_BandwidthThrottleUp: TCkUpload_get_BandwidthThrottleUp = nil;
  CkUpload_put_BandwidthThrottleUp: TCkUpload_put_BandwidthThrottleUp = nil;
  CkUpload_get_ChunkSize: TCkUpload_get_ChunkSize = nil;
  CkUpload_put_ChunkSize: TCkUpload_put_ChunkSize = nil;
  CkUpload_get_ClientIpAddress: TCkUpload_get_ClientIpAddress = nil;
  CkUpload_put_ClientIpAddress: TCkUpload_put_ClientIpAddress = nil;
  CkUpload_get_Expect100Continue: TCkUpload_get_Expect100Continue = nil;
  CkUpload_put_Expect100Continue: TCkUpload_put_Expect100Continue = nil;
  CkUpload_get_HeartbeatMs: TCkUpload_get_HeartbeatMs = nil;
  CkUpload_put_HeartbeatMs: TCkUpload_put_HeartbeatMs = nil;
  CkUpload_get_Hostname: TCkUpload_get_Hostname = nil;
  CkUpload_put_Hostname: TCkUpload_put_Hostname = nil;
  CkUpload_get_IdleTimeoutMs: TCkUpload_get_IdleTimeoutMs = nil;
  CkUpload_put_IdleTimeoutMs: TCkUpload_put_IdleTimeoutMs = nil;
  CkUpload_get_Login: TCkUpload_get_Login = nil;
  CkUpload_put_Login: TCkUpload_put_Login = nil;
  CkUpload_get_NumBytesSent: TCkUpload_get_NumBytesSent = nil;
  CkUpload_get_Password: TCkUpload_get_Password = nil;
  CkUpload_put_Password: TCkUpload_put_Password = nil;
  CkUpload_get_Path: TCkUpload_get_Path = nil;
  CkUpload_put_Path: TCkUpload_put_Path = nil;
  CkUpload_get_PercentDoneScale: TCkUpload_get_PercentDoneScale = nil;
  CkUpload_put_PercentDoneScale: TCkUpload_put_PercentDoneScale = nil;
  CkUpload_get_PercentUploaded: TCkUpload_get_PercentUploaded = nil;
  CkUpload_get_Port: TCkUpload_get_Port = nil;
  CkUpload_put_Port: TCkUpload_put_Port = nil;
  CkUpload_get_PreferIpv6: TCkUpload_get_PreferIpv6 = nil;
  CkUpload_put_PreferIpv6: TCkUpload_put_PreferIpv6 = nil;
  CkUpload_get_ProxyDomain: TCkUpload_get_ProxyDomain = nil;
  CkUpload_put_ProxyDomain: TCkUpload_put_ProxyDomain = nil;
  CkUpload_get_ProxyLogin: TCkUpload_get_ProxyLogin = nil;
  CkUpload_put_ProxyLogin: TCkUpload_put_ProxyLogin = nil;
  CkUpload_get_ProxyPassword: TCkUpload_get_ProxyPassword = nil;
  CkUpload_put_ProxyPassword: TCkUpload_put_ProxyPassword = nil;
  CkUpload_get_ProxyPort: TCkUpload_get_ProxyPort = nil;
  CkUpload_put_ProxyPort: TCkUpload_put_ProxyPort = nil;
  CkUpload_get_ResponseHeader: TCkUpload_get_ResponseHeader = nil;
  CkUpload_get_ResponseStatus: TCkUpload_get_ResponseStatus = nil;
  CkUpload_get_Ssl: TCkUpload_get_Ssl = nil;
  CkUpload_put_Ssl: TCkUpload_put_Ssl = nil;
  CkUpload_get_TotalUploadSize: TCkUpload_get_TotalUploadSize = nil;
  CkUpload_get_UploadInProgress: TCkUpload_get_UploadInProgress = nil;
  CkUpload_get_UploadSuccess: TCkUpload_get_UploadSuccess = nil;
  CkUpload_get_TlsPinSet: TCkUpload_get_TlsPinSet = nil;
  CkUpload_put_TlsPinSet: TCkUpload_put_TlsPinSet = nil;
  CkUpload_get_SslAllowedCiphers: TCkUpload_get_SslAllowedCiphers = nil;
  CkUpload_put_SslAllowedCiphers: TCkUpload_put_SslAllowedCiphers = nil;
  CkUpload_get_SslProtocol: TCkUpload_get_SslProtocol = nil;
  CkUpload_put_SslProtocol: TCkUpload_put_SslProtocol = nil;
  CkUpload_get_AbortCurrent: TCkUpload_get_AbortCurrent = nil;
  CkUpload_put_AbortCurrent: TCkUpload_put_AbortCurrent = nil;
  CkUpload_get_ResponseBodyStr: TCkUpload_get_ResponseBodyStr = nil;
  CkUpload_get_CurrentFilename: TCkUpload_get_CurrentFilename = nil;
  CkUpload_AbortUpload: TCkUpload_AbortUpload = nil;
  CkUpload_AddCustomHeader: TCkUpload_AddCustomHeader = nil;
  CkUpload_AddFileReference: TCkUpload_AddFileReference = nil;
  CkUpload_AddParam: TCkUpload_AddParam = nil;
  CkUpload_BeginUpload: TCkUpload_BeginUpload = nil;
  CkUpload_BlockingUpload: TCkUpload_BlockingUpload = nil;
  CkUpload_ClearFileReferences: TCkUpload_ClearFileReferences = nil;
  CkUpload_ClearParams: TCkUpload_ClearParams = nil;
  CkUpload_SleepMs: TCkUpload_SleepMs = nil;

constructor TUpload.Create;
begin
  inherited Create;
  FHandle := CkUpload_Create();
end;

destructor TUpload.Destroy;
begin
  if FHandle <> nil then
    CkUpload_Dispose(FHandle);
  FHandle := nil;
  inherited;
end;

{ ---- Event callback thunks ---- }
{ Standalone cdecl functions registered with the C bridge.  The bridge
  passes back the userData pointer, which carries the Pascal object
  instance.  A non-zero return value aborts the running method. }

function TUpload_AbortCheckThunk(userData: Pointer): Integer; cdecl;
var
  obj: TUpload;
begin
  Result := 0;
  obj := TUpload(userData);
  if Assigned(obj) and Assigned(obj.FOnAbortCheck) then
    if obj.FOnAbortCheck(obj) then Result := 1;
end;

function TUpload_PercentDoneThunk(pctDone: Integer; userData: Pointer): Integer; cdecl;
var
  obj: TUpload;
begin
  Result := 0;
  obj := TUpload(userData);
  if Assigned(obj) and Assigned(obj.FOnPercentDone) then
    if obj.FOnPercentDone(obj, pctDone) then Result := 1;
end;

procedure TUpload_ProgressInfoThunk(name: PAnsiChar; value: PAnsiChar; userData: Pointer); cdecl;
var
  obj: TUpload;
begin
  obj := TUpload(userData);
  if Assigned(obj) and Assigned(obj.FOnProgressInfo) then
    obj.FOnProgressInfo(obj, CkToStr(name), CkToStr(value));
end;

procedure TUpload.SetOnAbortCheck(AValue: TChilkatAbortCheckEvent);
begin
  FOnAbortCheck := AValue;
  if Assigned(AValue) then
    CkUpload_SetAbortCheckCallback(FHandle, @TUpload_AbortCheckThunk, Self)
  else
    CkUpload_SetAbortCheckCallback(FHandle, nil, nil);
end;

procedure TUpload.SetOnPercentDone(AValue: TChilkatPercentDoneEvent);
begin
  FOnPercentDone := AValue;
  if Assigned(AValue) then
    CkUpload_SetPercentDoneCallback(FHandle, @TUpload_PercentDoneThunk, Self)
  else
    CkUpload_SetPercentDoneCallback(FHandle, nil, nil);
end;

procedure TUpload.SetOnProgressInfo(AValue: TChilkatProgressInfoEvent);
begin
  FOnProgressInfo := AValue;
  if Assigned(AValue) then
    CkUpload_SetProgressInfoCallback(FHandle, @TUpload_ProgressInfoThunk, Self)
  else
    CkUpload_SetProgressInfoCallback(FHandle, nil, nil);
end;

function TUpload.GetLastErrorHtml: string;
begin
  Result := CkToStr(CkUpload_get_LastErrorHtml(FHandle));
end;

function TUpload.GetLastErrorText: string;
begin
  Result := CkToStr(CkUpload_get_LastErrorText(FHandle));
end;

function TUpload.GetLastErrorXml: string;
begin
  Result := CkToStr(CkUpload_get_LastErrorXml(FHandle));
end;

function TUpload.GetVersion: string;
begin
  Result := CkToStr(CkUpload_get_Version(FHandle));
end;

function TUpload.GetDebugLogFilePath: string;
begin
  Result := CkToStr(CkUpload_get_DebugLogFilePath(FHandle));
end;

procedure TUpload.SetDebugLogFilePath(AValue: string);
begin
  CkUpload_put_DebugLogFilePath(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function TUpload.GetVerboseLogging: Boolean;
begin
  Result := Boolean(CkUpload_get_VerboseLogging(FHandle));
end;

procedure TUpload.SetVerboseLogging(AValue: Boolean);
begin
  CkUpload_put_VerboseLogging(FHandle, LongBool(AValue));
end;

function TUpload.GetLastMethodSuccess: Boolean;
begin
  Result := Boolean(CkUpload_get_LastMethodSuccess(FHandle));
end;

procedure TUpload.SetLastMethodSuccess(AValue: Boolean);
begin
  CkUpload_put_LastMethodSuccess(FHandle, LongBool(AValue));
end;

function TUpload.GetBandwidthThrottleUp: Integer;
begin
  Result := CkUpload_get_BandwidthThrottleUp(FHandle);
end;

procedure TUpload.SetBandwidthThrottleUp(AValue: Integer);
begin
  CkUpload_put_BandwidthThrottleUp(FHandle, AValue);
end;

function TUpload.GetChunkSize: Integer;
begin
  Result := CkUpload_get_ChunkSize(FHandle);
end;

procedure TUpload.SetChunkSize(AValue: Integer);
begin
  CkUpload_put_ChunkSize(FHandle, AValue);
end;

function TUpload.GetClientIpAddress: string;
begin
  Result := CkToStr(CkUpload_get_ClientIpAddress(FHandle));
end;

procedure TUpload.SetClientIpAddress(AValue: string);
begin
  CkUpload_put_ClientIpAddress(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function TUpload.GetExpect100Continue: Boolean;
begin
  Result := Boolean(CkUpload_get_Expect100Continue(FHandle));
end;

procedure TUpload.SetExpect100Continue(AValue: Boolean);
begin
  CkUpload_put_Expect100Continue(FHandle, LongBool(AValue));
end;

function TUpload.GetHeartbeatMs: Integer;
begin
  Result := CkUpload_get_HeartbeatMs(FHandle);
end;

procedure TUpload.SetHeartbeatMs(AValue: Integer);
begin
  CkUpload_put_HeartbeatMs(FHandle, AValue);
end;

function TUpload.GetHostname: string;
begin
  Result := CkToStr(CkUpload_get_Hostname(FHandle));
end;

procedure TUpload.SetHostname(AValue: string);
begin
  CkUpload_put_Hostname(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function TUpload.GetIdleTimeoutMs: Integer;
begin
  Result := CkUpload_get_IdleTimeoutMs(FHandle);
end;

procedure TUpload.SetIdleTimeoutMs(AValue: Integer);
begin
  CkUpload_put_IdleTimeoutMs(FHandle, AValue);
end;

function TUpload.GetLogin: string;
begin
  Result := CkToStr(CkUpload_get_Login(FHandle));
end;

procedure TUpload.SetLogin(AValue: string);
begin
  CkUpload_put_Login(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function TUpload.GetNumBytesSent: LongWord;
begin
  Result := CkUpload_get_NumBytesSent(FHandle);
end;

function TUpload.GetPassword: string;
begin
  Result := CkToStr(CkUpload_get_Password(FHandle));
end;

procedure TUpload.SetPassword(AValue: string);
begin
  CkUpload_put_Password(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function TUpload.GetPath: string;
begin
  Result := CkToStr(CkUpload_get_Path(FHandle));
end;

procedure TUpload.SetPath(AValue: string);
begin
  CkUpload_put_Path(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function TUpload.GetPercentDoneScale: Integer;
begin
  Result := CkUpload_get_PercentDoneScale(FHandle);
end;

procedure TUpload.SetPercentDoneScale(AValue: Integer);
begin
  CkUpload_put_PercentDoneScale(FHandle, AValue);
end;

function TUpload.GetPercentUploaded: LongWord;
begin
  Result := CkUpload_get_PercentUploaded(FHandle);
end;

function TUpload.GetPort: Integer;
begin
  Result := CkUpload_get_Port(FHandle);
end;

procedure TUpload.SetPort(AValue: Integer);
begin
  CkUpload_put_Port(FHandle, AValue);
end;

function TUpload.GetPreferIpv6: Boolean;
begin
  Result := Boolean(CkUpload_get_PreferIpv6(FHandle));
end;

procedure TUpload.SetPreferIpv6(AValue: Boolean);
begin
  CkUpload_put_PreferIpv6(FHandle, LongBool(AValue));
end;

function TUpload.GetProxyDomain: string;
begin
  Result := CkToStr(CkUpload_get_ProxyDomain(FHandle));
end;

procedure TUpload.SetProxyDomain(AValue: string);
begin
  CkUpload_put_ProxyDomain(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function TUpload.GetProxyLogin: string;
begin
  Result := CkToStr(CkUpload_get_ProxyLogin(FHandle));
end;

procedure TUpload.SetProxyLogin(AValue: string);
begin
  CkUpload_put_ProxyLogin(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function TUpload.GetProxyPassword: string;
begin
  Result := CkToStr(CkUpload_get_ProxyPassword(FHandle));
end;

procedure TUpload.SetProxyPassword(AValue: string);
begin
  CkUpload_put_ProxyPassword(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function TUpload.GetProxyPort: Integer;
begin
  Result := CkUpload_get_ProxyPort(FHandle);
end;

procedure TUpload.SetProxyPort(AValue: Integer);
begin
  CkUpload_put_ProxyPort(FHandle, AValue);
end;

function TUpload.GetResponseHeader: string;
begin
  Result := CkToStr(CkUpload_get_ResponseHeader(FHandle));
end;

function TUpload.GetResponseStatus: Integer;
begin
  Result := CkUpload_get_ResponseStatus(FHandle);
end;

function TUpload.GetSsl: Boolean;
begin
  Result := Boolean(CkUpload_get_Ssl(FHandle));
end;

procedure TUpload.SetSsl(AValue: Boolean);
begin
  CkUpload_put_Ssl(FHandle, LongBool(AValue));
end;

function TUpload.GetTotalUploadSize: LongWord;
begin
  Result := CkUpload_get_TotalUploadSize(FHandle);
end;

function TUpload.GetUploadInProgress: Boolean;
begin
  Result := Boolean(CkUpload_get_UploadInProgress(FHandle));
end;

function TUpload.GetUploadSuccess: Boolean;
begin
  Result := Boolean(CkUpload_get_UploadSuccess(FHandle));
end;

function TUpload.GetTlsPinSet: string;
begin
  Result := CkToStr(CkUpload_get_TlsPinSet(FHandle));
end;

procedure TUpload.SetTlsPinSet(AValue: string);
begin
  CkUpload_put_TlsPinSet(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function TUpload.GetSslAllowedCiphers: string;
begin
  Result := CkToStr(CkUpload_get_SslAllowedCiphers(FHandle));
end;

procedure TUpload.SetSslAllowedCiphers(AValue: string);
begin
  CkUpload_put_SslAllowedCiphers(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function TUpload.GetSslProtocol: string;
begin
  Result := CkToStr(CkUpload_get_SslProtocol(FHandle));
end;

procedure TUpload.SetSslProtocol(AValue: string);
begin
  CkUpload_put_SslProtocol(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function TUpload.GetAbortCurrent: Boolean;
begin
  Result := Boolean(CkUpload_get_AbortCurrent(FHandle));
end;

procedure TUpload.SetAbortCurrent(AValue: Boolean);
begin
  CkUpload_put_AbortCurrent(FHandle, LongBool(AValue));
end;

function TUpload.GetResponseBodyStr: string;
begin
  Result := CkToStr(CkUpload_get_ResponseBodyStr(FHandle));
end;

function TUpload.GetCurrentFilename: string;
begin
  Result := CkToStr(CkUpload_get_CurrentFilename(FHandle));
end;

procedure TUpload.AbortUpload;
begin
  CkUpload_AbortUpload(FHandle);
end;

procedure TUpload.AddCustomHeader(const name: string; const value: string);
begin
  CkUpload_AddCustomHeader(FHandle, PAnsiChar(StrToCk(name)), PAnsiChar(StrToCk(value)));
end;

procedure TUpload.AddFileReference(const name: string; const filename: string);
begin
  CkUpload_AddFileReference(FHandle, PAnsiChar(StrToCk(name)), PAnsiChar(StrToCk(filename)));
end;

procedure TUpload.AddParam(const name: string; const value: string);
begin
  CkUpload_AddParam(FHandle, PAnsiChar(StrToCk(name)), PAnsiChar(StrToCk(value)));
end;

function TUpload.BeginUpload: Boolean;
begin
  Result := Boolean(CkUpload_BeginUpload(FHandle));
end;

function TUpload.BlockingUpload: Boolean;
begin
  Result := Boolean(CkUpload_BlockingUpload(FHandle));
end;

procedure TUpload.ClearFileReferences;
begin
  CkUpload_ClearFileReferences(FHandle);
end;

procedure TUpload.ClearParams;
begin
  CkUpload_ClearParams(FHandle);
end;

procedure TUpload.SleepMs(millisec: Integer);
begin
  CkUpload_SleepMs(FHandle, millisec);
end;

initialization
  Chilkat_GetProcedureAddress(CkUpload_Create,  'CkUpload_Create');
  Chilkat_GetProcedureAddress(CkUpload_Dispose, 'CkUpload_Dispose');
  Chilkat_GetProcedureAddress(CkUpload_SetAbortCheckCallback, 'CkUpload_SetAbortCheckCallback');
  Chilkat_GetProcedureAddress(CkUpload_SetPercentDoneCallback, 'CkUpload_SetPercentDoneCallback');
  Chilkat_GetProcedureAddress(CkUpload_SetProgressInfoCallback, 'CkUpload_SetProgressInfoCallback');
  Chilkat_GetProcedureAddress(CkUpload_get_LastErrorHtml, 'CkUpload_get_LastErrorHtml');
  Chilkat_GetProcedureAddress(CkUpload_get_LastErrorText, 'CkUpload_get_LastErrorText');
  Chilkat_GetProcedureAddress(CkUpload_get_LastErrorXml, 'CkUpload_get_LastErrorXml');
  Chilkat_GetProcedureAddress(CkUpload_get_Version, 'CkUpload_get_Version');
  Chilkat_GetProcedureAddress(CkUpload_get_DebugLogFilePath, 'CkUpload_get_DebugLogFilePath');
  Chilkat_GetProcedureAddress(CkUpload_put_DebugLogFilePath, 'CkUpload_put_DebugLogFilePath');
  Chilkat_GetProcedureAddress(CkUpload_get_VerboseLogging, 'CkUpload_get_VerboseLogging');
  Chilkat_GetProcedureAddress(CkUpload_put_VerboseLogging, 'CkUpload_put_VerboseLogging');
  Chilkat_GetProcedureAddress(CkUpload_get_LastMethodSuccess, 'CkUpload_get_LastMethodSuccess');
  Chilkat_GetProcedureAddress(CkUpload_put_LastMethodSuccess, 'CkUpload_put_LastMethodSuccess');
  Chilkat_GetProcedureAddress(CkUpload_get_BandwidthThrottleUp, 'CkUpload_get_BandwidthThrottleUp');
  Chilkat_GetProcedureAddress(CkUpload_put_BandwidthThrottleUp, 'CkUpload_put_BandwidthThrottleUp');
  Chilkat_GetProcedureAddress(CkUpload_get_ChunkSize, 'CkUpload_get_ChunkSize');
  Chilkat_GetProcedureAddress(CkUpload_put_ChunkSize, 'CkUpload_put_ChunkSize');
  Chilkat_GetProcedureAddress(CkUpload_get_ClientIpAddress, 'CkUpload_get_ClientIpAddress');
  Chilkat_GetProcedureAddress(CkUpload_put_ClientIpAddress, 'CkUpload_put_ClientIpAddress');
  Chilkat_GetProcedureAddress(CkUpload_get_Expect100Continue, 'CkUpload_get_Expect100Continue');
  Chilkat_GetProcedureAddress(CkUpload_put_Expect100Continue, 'CkUpload_put_Expect100Continue');
  Chilkat_GetProcedureAddress(CkUpload_get_HeartbeatMs, 'CkUpload_get_HeartbeatMs');
  Chilkat_GetProcedureAddress(CkUpload_put_HeartbeatMs, 'CkUpload_put_HeartbeatMs');
  Chilkat_GetProcedureAddress(CkUpload_get_Hostname, 'CkUpload_get_Hostname');
  Chilkat_GetProcedureAddress(CkUpload_put_Hostname, 'CkUpload_put_Hostname');
  Chilkat_GetProcedureAddress(CkUpload_get_IdleTimeoutMs, 'CkUpload_get_IdleTimeoutMs');
  Chilkat_GetProcedureAddress(CkUpload_put_IdleTimeoutMs, 'CkUpload_put_IdleTimeoutMs');
  Chilkat_GetProcedureAddress(CkUpload_get_Login, 'CkUpload_get_Login');
  Chilkat_GetProcedureAddress(CkUpload_put_Login, 'CkUpload_put_Login');
  Chilkat_GetProcedureAddress(CkUpload_get_NumBytesSent, 'CkUpload_get_NumBytesSent');
  Chilkat_GetProcedureAddress(CkUpload_get_Password, 'CkUpload_get_Password');
  Chilkat_GetProcedureAddress(CkUpload_put_Password, 'CkUpload_put_Password');
  Chilkat_GetProcedureAddress(CkUpload_get_Path, 'CkUpload_get_Path');
  Chilkat_GetProcedureAddress(CkUpload_put_Path, 'CkUpload_put_Path');
  Chilkat_GetProcedureAddress(CkUpload_get_PercentDoneScale, 'CkUpload_get_PercentDoneScale');
  Chilkat_GetProcedureAddress(CkUpload_put_PercentDoneScale, 'CkUpload_put_PercentDoneScale');
  Chilkat_GetProcedureAddress(CkUpload_get_PercentUploaded, 'CkUpload_get_PercentUploaded');
  Chilkat_GetProcedureAddress(CkUpload_get_Port, 'CkUpload_get_Port');
  Chilkat_GetProcedureAddress(CkUpload_put_Port, 'CkUpload_put_Port');
  Chilkat_GetProcedureAddress(CkUpload_get_PreferIpv6, 'CkUpload_get_PreferIpv6');
  Chilkat_GetProcedureAddress(CkUpload_put_PreferIpv6, 'CkUpload_put_PreferIpv6');
  Chilkat_GetProcedureAddress(CkUpload_get_ProxyDomain, 'CkUpload_get_ProxyDomain');
  Chilkat_GetProcedureAddress(CkUpload_put_ProxyDomain, 'CkUpload_put_ProxyDomain');
  Chilkat_GetProcedureAddress(CkUpload_get_ProxyLogin, 'CkUpload_get_ProxyLogin');
  Chilkat_GetProcedureAddress(CkUpload_put_ProxyLogin, 'CkUpload_put_ProxyLogin');
  Chilkat_GetProcedureAddress(CkUpload_get_ProxyPassword, 'CkUpload_get_ProxyPassword');
  Chilkat_GetProcedureAddress(CkUpload_put_ProxyPassword, 'CkUpload_put_ProxyPassword');
  Chilkat_GetProcedureAddress(CkUpload_get_ProxyPort, 'CkUpload_get_ProxyPort');
  Chilkat_GetProcedureAddress(CkUpload_put_ProxyPort, 'CkUpload_put_ProxyPort');
  Chilkat_GetProcedureAddress(CkUpload_get_ResponseHeader, 'CkUpload_get_ResponseHeader');
  Chilkat_GetProcedureAddress(CkUpload_get_ResponseStatus, 'CkUpload_get_ResponseStatus');
  Chilkat_GetProcedureAddress(CkUpload_get_Ssl, 'CkUpload_get_Ssl');
  Chilkat_GetProcedureAddress(CkUpload_put_Ssl, 'CkUpload_put_Ssl');
  Chilkat_GetProcedureAddress(CkUpload_get_TotalUploadSize, 'CkUpload_get_TotalUploadSize');
  Chilkat_GetProcedureAddress(CkUpload_get_UploadInProgress, 'CkUpload_get_UploadInProgress');
  Chilkat_GetProcedureAddress(CkUpload_get_UploadSuccess, 'CkUpload_get_UploadSuccess');
  Chilkat_GetProcedureAddress(CkUpload_get_TlsPinSet, 'CkUpload_get_TlsPinSet');
  Chilkat_GetProcedureAddress(CkUpload_put_TlsPinSet, 'CkUpload_put_TlsPinSet');
  Chilkat_GetProcedureAddress(CkUpload_get_SslAllowedCiphers, 'CkUpload_get_SslAllowedCiphers');
  Chilkat_GetProcedureAddress(CkUpload_put_SslAllowedCiphers, 'CkUpload_put_SslAllowedCiphers');
  Chilkat_GetProcedureAddress(CkUpload_get_SslProtocol, 'CkUpload_get_SslProtocol');
  Chilkat_GetProcedureAddress(CkUpload_put_SslProtocol, 'CkUpload_put_SslProtocol');
  Chilkat_GetProcedureAddress(CkUpload_get_AbortCurrent, 'CkUpload_get_AbortCurrent');
  Chilkat_GetProcedureAddress(CkUpload_put_AbortCurrent, 'CkUpload_put_AbortCurrent');
  Chilkat_GetProcedureAddress(CkUpload_get_ResponseBodyStr, 'CkUpload_get_ResponseBodyStr');
  Chilkat_GetProcedureAddress(CkUpload_get_CurrentFilename, 'CkUpload_get_CurrentFilename');
  Chilkat_GetProcedureAddress(CkUpload_AbortUpload, 'CkUpload_AbortUpload');
  Chilkat_GetProcedureAddress(CkUpload_AddCustomHeader, 'CkUpload_AddCustomHeader');
  Chilkat_GetProcedureAddress(CkUpload_AddFileReference, 'CkUpload_AddFileReference');
  Chilkat_GetProcedureAddress(CkUpload_AddParam, 'CkUpload_AddParam');
  Chilkat_GetProcedureAddress(CkUpload_BeginUpload, 'CkUpload_BeginUpload');
  Chilkat_GetProcedureAddress(CkUpload_BlockingUpload, 'CkUpload_BlockingUpload');
  Chilkat_GetProcedureAddress(CkUpload_ClearFileReferences, 'CkUpload_ClearFileReferences');
  Chilkat_GetProcedureAddress(CkUpload_ClearParams, 'CkUpload_ClearParams');
  Chilkat_GetProcedureAddress(CkUpload_SleepMs, 'CkUpload_SleepMs');

end.
