unit Chilkat.HttpRequest;

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

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

interface

uses
  SysUtils,
  Chilkat.Base;

type

  { THttpRequest wraps CkHttpRequest via the C bridge layer. }
  THttpRequest = class(TChilkatBase)
  private
    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  GetBoundary: string;
    procedure SetBoundary(AValue: string);
    function  GetCharset: string;
    procedure SetCharset(AValue: string);
    function  GetContentType: string;
    procedure SetContentType(AValue: string);
    function  GetEntireHeader: string;
    procedure SetEntireHeader(AValue: string);
    function  GetHttpVerb: string;
    procedure SetHttpVerb(AValue: string);
    function  GetHttpVersion: string;
    procedure SetHttpVersion(AValue: string);
    function  GetNumHeaderFields: Integer;
    function  GetNumParams: Integer;
    function  GetPath: string;
    procedure SetPath(AValue: string);
    function  GetSendCharset: Boolean;
    procedure SetSendCharset(AValue: Boolean);
  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 Boundary: string read GetBoundary write SetBoundary;
    property Charset: string read GetCharset write SetCharset;
    property ContentType: string read GetContentType write SetContentType;
    property EntireHeader: string read GetEntireHeader write SetEntireHeader;
    property HttpVerb: string read GetHttpVerb write SetHttpVerb;
    property HttpVersion: string read GetHttpVersion write SetHttpVersion;
    property NumHeaderFields: Integer read GetNumHeaderFields;
    property NumParams: Integer read GetNumParams;
    property Path: string read GetPath write SetPath;
    property SendCharset: Boolean read GetSendCharset write SetSendCharset;

    function  AddFileForUpload(const name: string; const filePath: string): Boolean;
    function  AddFileForUpload2(const name: string; const filePath: string; const contentType: string): Boolean;
    procedure AddHeader(const name: string; const value: string);
    procedure AddParam(const name: string; const value: string);
    function  AddStringForUpload(const name: string; const filename: string; const strData: string; const charset: string): Boolean;
    function  AddStringForUpload2(const name: string; const filename: string; const strData: string; const charset: string; const contentType: string): Boolean;
    function  AddSubHeader(index: Integer; const name: string; const value: string): Boolean;
    function  GenerateRequestText: string;
    function  GetHeaderField(const name: string): string;
    function  GetHeaderName(index: Integer): string;
    function  GetHeaderValue(index: Integer): string;
    function  GetParam(const name: string): string;
    function  GetParamName(index: Integer): string;
    function  GetParamValue(index: Integer): string;
    function  GetUrlEncodedParams: string;
    function  LoadBodyFromFile(const filePath: string): Boolean;
    function  LoadBodyFromString(const bodyStr: string; const charset: string): Boolean;
    procedure RemoveAllParams;
    function  RemoveHeader(const name: string): Boolean;
    procedure RemoveParam(const name: string);
    procedure SetFromUrl(const url: string);
    function  StreamBodyFromFile(const filePath: string): Boolean;
    function  StreamChunkFromFile(const path: string; const offset: string; const numBytes: string): Boolean;
    function  GenerateRequestFile(const path: string): Boolean;
    function  AddMwsSignature(const domain: string; const mwsSecretKey: string): Boolean;
    function  LoadBodyFromBd(requestBody: TChilkatBase): Boolean;
    function  LoadBodyFromSb(requestBody: TChilkatBase; const charset: string): Boolean;
    function  AddBdForUpload(const name: string; const remoteFilename: string; byteData: TChilkatBase; const contentType: string): Boolean;
  end;

implementation

uses
  CkDllLoader,
  Chilkat.Utils;

{ ---- C bridge function pointer types ---- }
type
  TCkHttpRequest_Create  = function(): Pointer; cdecl;
  TCkHttpRequest_Dispose = procedure(handle: Pointer); cdecl;
  TCkHttpRequest_get_LastErrorHtml = function(handle: Pointer): PAnsiChar; cdecl;
  TCkHttpRequest_get_LastErrorText = function(handle: Pointer): PAnsiChar; cdecl;
  TCkHttpRequest_get_LastErrorXml = function(handle: Pointer): PAnsiChar; cdecl;
  TCkHttpRequest_get_Version = function(handle: Pointer): PAnsiChar; cdecl;
  TCkHttpRequest_get_DebugLogFilePath = function(handle: Pointer): PAnsiChar; cdecl;
  TCkHttpRequest_put_DebugLogFilePath = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkHttpRequest_get_VerboseLogging = function(handle: Pointer): LongBool; cdecl;
  TCkHttpRequest_put_VerboseLogging = procedure(handle: Pointer; value: LongBool); cdecl;
  TCkHttpRequest_get_LastMethodSuccess = function(handle: Pointer): LongBool; cdecl;
  TCkHttpRequest_put_LastMethodSuccess = procedure(handle: Pointer; value: LongBool); cdecl;
  TCkHttpRequest_get_Boundary = function(handle: Pointer): PAnsiChar; cdecl;
  TCkHttpRequest_put_Boundary = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkHttpRequest_get_Charset = function(handle: Pointer): PAnsiChar; cdecl;
  TCkHttpRequest_put_Charset = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkHttpRequest_get_ContentType = function(handle: Pointer): PAnsiChar; cdecl;
  TCkHttpRequest_put_ContentType = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkHttpRequest_get_EntireHeader = function(handle: Pointer): PAnsiChar; cdecl;
  TCkHttpRequest_put_EntireHeader = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkHttpRequest_get_HttpVerb = function(handle: Pointer): PAnsiChar; cdecl;
  TCkHttpRequest_put_HttpVerb = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkHttpRequest_get_HttpVersion = function(handle: Pointer): PAnsiChar; cdecl;
  TCkHttpRequest_put_HttpVersion = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkHttpRequest_get_NumHeaderFields = function(handle: Pointer): Integer; cdecl;
  TCkHttpRequest_get_NumParams = function(handle: Pointer): Integer; cdecl;
  TCkHttpRequest_get_Path = function(handle: Pointer): PAnsiChar; cdecl;
  TCkHttpRequest_put_Path = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkHttpRequest_get_SendCharset = function(handle: Pointer): LongBool; cdecl;
  TCkHttpRequest_put_SendCharset = procedure(handle: Pointer; value: LongBool); cdecl;
  TCkHttpRequest_AddFileForUpload = function(handle: Pointer; name: PAnsiChar; filePath: PAnsiChar): LongBool; cdecl;
  TCkHttpRequest_AddFileForUpload2 = function(handle: Pointer; name: PAnsiChar; filePath: PAnsiChar; contentType: PAnsiChar): LongBool; cdecl;
  TCkHttpRequest_AddHeader = procedure(handle: Pointer; name: PAnsiChar; value: PAnsiChar); cdecl;
  TCkHttpRequest_AddParam = procedure(handle: Pointer; name: PAnsiChar; value: PAnsiChar); cdecl;
  TCkHttpRequest_AddStringForUpload = function(handle: Pointer; name: PAnsiChar; filename: PAnsiChar; strData: PAnsiChar; charset: PAnsiChar): LongBool; cdecl;
  TCkHttpRequest_AddStringForUpload2 = function(handle: Pointer; name: PAnsiChar; filename: PAnsiChar; strData: PAnsiChar; charset: PAnsiChar; contentType: PAnsiChar): LongBool; cdecl;
  TCkHttpRequest_AddSubHeader = function(handle: Pointer; index: Integer; name: PAnsiChar; value: PAnsiChar): LongBool; cdecl;
  TCkHttpRequest_GenerateRequestText = function(handle: Pointer): PAnsiChar; cdecl;
  TCkHttpRequest_GetHeaderField = function(handle: Pointer; name: PAnsiChar): PAnsiChar; cdecl;
  TCkHttpRequest_GetHeaderName = function(handle: Pointer; index: Integer): PAnsiChar; cdecl;
  TCkHttpRequest_GetHeaderValue = function(handle: Pointer; index: Integer): PAnsiChar; cdecl;
  TCkHttpRequest_GetParam = function(handle: Pointer; name: PAnsiChar): PAnsiChar; cdecl;
  TCkHttpRequest_GetParamName = function(handle: Pointer; index: Integer): PAnsiChar; cdecl;
  TCkHttpRequest_GetParamValue = function(handle: Pointer; index: Integer): PAnsiChar; cdecl;
  TCkHttpRequest_GetUrlEncodedParams = function(handle: Pointer): PAnsiChar; cdecl;
  TCkHttpRequest_LoadBodyFromFile = function(handle: Pointer; filePath: PAnsiChar): LongBool; cdecl;
  TCkHttpRequest_LoadBodyFromString = function(handle: Pointer; bodyStr: PAnsiChar; charset: PAnsiChar): LongBool; cdecl;
  TCkHttpRequest_RemoveAllParams = procedure(handle: Pointer); cdecl;
  TCkHttpRequest_RemoveHeader = function(handle: Pointer; name: PAnsiChar): LongBool; cdecl;
  TCkHttpRequest_RemoveParam = procedure(handle: Pointer; name: PAnsiChar); cdecl;
  TCkHttpRequest_SetFromUrl = procedure(handle: Pointer; url: PAnsiChar); cdecl;
  TCkHttpRequest_StreamBodyFromFile = function(handle: Pointer; filePath: PAnsiChar): LongBool; cdecl;
  TCkHttpRequest_StreamChunkFromFile = function(handle: Pointer; path: PAnsiChar; offset: PAnsiChar; numBytes: PAnsiChar): LongBool; cdecl;
  TCkHttpRequest_GenerateRequestFile = function(handle: Pointer; path: PAnsiChar): LongBool; cdecl;
  TCkHttpRequest_AddMwsSignature = function(handle: Pointer; domain: PAnsiChar; mwsSecretKey: PAnsiChar): LongBool; cdecl;
  TCkHttpRequest_LoadBodyFromBd = function(handle: Pointer; requestBody: Pointer): LongBool; cdecl;
  TCkHttpRequest_LoadBodyFromSb = function(handle: Pointer; requestBody: Pointer; charset: PAnsiChar): LongBool; cdecl;
  TCkHttpRequest_AddBdForUpload = function(handle: Pointer; name: PAnsiChar; remoteFilename: PAnsiChar; byteData: Pointer; contentType: PAnsiChar): LongBool; cdecl;

{ ---- C bridge function pointer variables ---- }
var
  CkHttpRequest_Create:  TCkHttpRequest_Create  = nil;
  CkHttpRequest_Dispose: TCkHttpRequest_Dispose = nil;
  CkHttpRequest_get_LastErrorHtml: TCkHttpRequest_get_LastErrorHtml = nil;
  CkHttpRequest_get_LastErrorText: TCkHttpRequest_get_LastErrorText = nil;
  CkHttpRequest_get_LastErrorXml: TCkHttpRequest_get_LastErrorXml = nil;
  CkHttpRequest_get_Version: TCkHttpRequest_get_Version = nil;
  CkHttpRequest_get_DebugLogFilePath: TCkHttpRequest_get_DebugLogFilePath = nil;
  CkHttpRequest_put_DebugLogFilePath: TCkHttpRequest_put_DebugLogFilePath = nil;
  CkHttpRequest_get_VerboseLogging: TCkHttpRequest_get_VerboseLogging = nil;
  CkHttpRequest_put_VerboseLogging: TCkHttpRequest_put_VerboseLogging = nil;
  CkHttpRequest_get_LastMethodSuccess: TCkHttpRequest_get_LastMethodSuccess = nil;
  CkHttpRequest_put_LastMethodSuccess: TCkHttpRequest_put_LastMethodSuccess = nil;
  CkHttpRequest_get_Boundary: TCkHttpRequest_get_Boundary = nil;
  CkHttpRequest_put_Boundary: TCkHttpRequest_put_Boundary = nil;
  CkHttpRequest_get_Charset: TCkHttpRequest_get_Charset = nil;
  CkHttpRequest_put_Charset: TCkHttpRequest_put_Charset = nil;
  CkHttpRequest_get_ContentType: TCkHttpRequest_get_ContentType = nil;
  CkHttpRequest_put_ContentType: TCkHttpRequest_put_ContentType = nil;
  CkHttpRequest_get_EntireHeader: TCkHttpRequest_get_EntireHeader = nil;
  CkHttpRequest_put_EntireHeader: TCkHttpRequest_put_EntireHeader = nil;
  CkHttpRequest_get_HttpVerb: TCkHttpRequest_get_HttpVerb = nil;
  CkHttpRequest_put_HttpVerb: TCkHttpRequest_put_HttpVerb = nil;
  CkHttpRequest_get_HttpVersion: TCkHttpRequest_get_HttpVersion = nil;
  CkHttpRequest_put_HttpVersion: TCkHttpRequest_put_HttpVersion = nil;
  CkHttpRequest_get_NumHeaderFields: TCkHttpRequest_get_NumHeaderFields = nil;
  CkHttpRequest_get_NumParams: TCkHttpRequest_get_NumParams = nil;
  CkHttpRequest_get_Path: TCkHttpRequest_get_Path = nil;
  CkHttpRequest_put_Path: TCkHttpRequest_put_Path = nil;
  CkHttpRequest_get_SendCharset: TCkHttpRequest_get_SendCharset = nil;
  CkHttpRequest_put_SendCharset: TCkHttpRequest_put_SendCharset = nil;
  CkHttpRequest_AddFileForUpload: TCkHttpRequest_AddFileForUpload = nil;
  CkHttpRequest_AddFileForUpload2: TCkHttpRequest_AddFileForUpload2 = nil;
  CkHttpRequest_AddHeader: TCkHttpRequest_AddHeader = nil;
  CkHttpRequest_AddParam: TCkHttpRequest_AddParam = nil;
  CkHttpRequest_AddStringForUpload: TCkHttpRequest_AddStringForUpload = nil;
  CkHttpRequest_AddStringForUpload2: TCkHttpRequest_AddStringForUpload2 = nil;
  CkHttpRequest_AddSubHeader: TCkHttpRequest_AddSubHeader = nil;
  CkHttpRequest_GenerateRequestText: TCkHttpRequest_GenerateRequestText = nil;
  CkHttpRequest_GetHeaderField: TCkHttpRequest_GetHeaderField = nil;
  CkHttpRequest_GetHeaderName: TCkHttpRequest_GetHeaderName = nil;
  CkHttpRequest_GetHeaderValue: TCkHttpRequest_GetHeaderValue = nil;
  CkHttpRequest_GetParam: TCkHttpRequest_GetParam = nil;
  CkHttpRequest_GetParamName: TCkHttpRequest_GetParamName = nil;
  CkHttpRequest_GetParamValue: TCkHttpRequest_GetParamValue = nil;
  CkHttpRequest_GetUrlEncodedParams: TCkHttpRequest_GetUrlEncodedParams = nil;
  CkHttpRequest_LoadBodyFromFile: TCkHttpRequest_LoadBodyFromFile = nil;
  CkHttpRequest_LoadBodyFromString: TCkHttpRequest_LoadBodyFromString = nil;
  CkHttpRequest_RemoveAllParams: TCkHttpRequest_RemoveAllParams = nil;
  CkHttpRequest_RemoveHeader: TCkHttpRequest_RemoveHeader = nil;
  CkHttpRequest_RemoveParam: TCkHttpRequest_RemoveParam = nil;
  CkHttpRequest_SetFromUrl: TCkHttpRequest_SetFromUrl = nil;
  CkHttpRequest_StreamBodyFromFile: TCkHttpRequest_StreamBodyFromFile = nil;
  CkHttpRequest_StreamChunkFromFile: TCkHttpRequest_StreamChunkFromFile = nil;
  CkHttpRequest_GenerateRequestFile: TCkHttpRequest_GenerateRequestFile = nil;
  CkHttpRequest_AddMwsSignature: TCkHttpRequest_AddMwsSignature = nil;
  CkHttpRequest_LoadBodyFromBd: TCkHttpRequest_LoadBodyFromBd = nil;
  CkHttpRequest_LoadBodyFromSb: TCkHttpRequest_LoadBodyFromSb = nil;
  CkHttpRequest_AddBdForUpload: TCkHttpRequest_AddBdForUpload = nil;

constructor THttpRequest.Create;
begin
  inherited Create;
  FHandle := CkHttpRequest_Create();
end;

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

function THttpRequest.GetLastErrorHtml: string;
begin
  Result := CkToStr(CkHttpRequest_get_LastErrorHtml(FHandle));
end;

function THttpRequest.GetLastErrorText: string;
begin
  Result := CkToStr(CkHttpRequest_get_LastErrorText(FHandle));
end;

function THttpRequest.GetLastErrorXml: string;
begin
  Result := CkToStr(CkHttpRequest_get_LastErrorXml(FHandle));
end;

function THttpRequest.GetVersion: string;
begin
  Result := CkToStr(CkHttpRequest_get_Version(FHandle));
end;

function THttpRequest.GetDebugLogFilePath: string;
begin
  Result := CkToStr(CkHttpRequest_get_DebugLogFilePath(FHandle));
end;

procedure THttpRequest.SetDebugLogFilePath(AValue: string);
begin
  CkHttpRequest_put_DebugLogFilePath(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function THttpRequest.GetVerboseLogging: Boolean;
begin
  Result := Boolean(CkHttpRequest_get_VerboseLogging(FHandle));
end;

procedure THttpRequest.SetVerboseLogging(AValue: Boolean);
begin
  CkHttpRequest_put_VerboseLogging(FHandle, LongBool(AValue));
end;

function THttpRequest.GetLastMethodSuccess: Boolean;
begin
  Result := Boolean(CkHttpRequest_get_LastMethodSuccess(FHandle));
end;

procedure THttpRequest.SetLastMethodSuccess(AValue: Boolean);
begin
  CkHttpRequest_put_LastMethodSuccess(FHandle, LongBool(AValue));
end;

function THttpRequest.GetBoundary: string;
begin
  Result := CkToStr(CkHttpRequest_get_Boundary(FHandle));
end;

procedure THttpRequest.SetBoundary(AValue: string);
begin
  CkHttpRequest_put_Boundary(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function THttpRequest.GetCharset: string;
begin
  Result := CkToStr(CkHttpRequest_get_Charset(FHandle));
end;

procedure THttpRequest.SetCharset(AValue: string);
begin
  CkHttpRequest_put_Charset(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function THttpRequest.GetContentType: string;
begin
  Result := CkToStr(CkHttpRequest_get_ContentType(FHandle));
end;

procedure THttpRequest.SetContentType(AValue: string);
begin
  CkHttpRequest_put_ContentType(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function THttpRequest.GetEntireHeader: string;
begin
  Result := CkToStr(CkHttpRequest_get_EntireHeader(FHandle));
end;

procedure THttpRequest.SetEntireHeader(AValue: string);
begin
  CkHttpRequest_put_EntireHeader(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function THttpRequest.GetHttpVerb: string;
begin
  Result := CkToStr(CkHttpRequest_get_HttpVerb(FHandle));
end;

procedure THttpRequest.SetHttpVerb(AValue: string);
begin
  CkHttpRequest_put_HttpVerb(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function THttpRequest.GetHttpVersion: string;
begin
  Result := CkToStr(CkHttpRequest_get_HttpVersion(FHandle));
end;

procedure THttpRequest.SetHttpVersion(AValue: string);
begin
  CkHttpRequest_put_HttpVersion(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function THttpRequest.GetNumHeaderFields: Integer;
begin
  Result := CkHttpRequest_get_NumHeaderFields(FHandle);
end;

function THttpRequest.GetNumParams: Integer;
begin
  Result := CkHttpRequest_get_NumParams(FHandle);
end;

function THttpRequest.GetPath: string;
begin
  Result := CkToStr(CkHttpRequest_get_Path(FHandle));
end;

procedure THttpRequest.SetPath(AValue: string);
begin
  CkHttpRequest_put_Path(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function THttpRequest.GetSendCharset: Boolean;
begin
  Result := Boolean(CkHttpRequest_get_SendCharset(FHandle));
end;

procedure THttpRequest.SetSendCharset(AValue: Boolean);
begin
  CkHttpRequest_put_SendCharset(FHandle, LongBool(AValue));
end;

function THttpRequest.AddFileForUpload(const name: string; const filePath: string): Boolean;
begin
  Result := Boolean(CkHttpRequest_AddFileForUpload(FHandle, PAnsiChar(StrToCk(name)), PAnsiChar(StrToCk(filePath))));
end;

function THttpRequest.AddFileForUpload2(const name: string; const filePath: string; const contentType: string): Boolean;
begin
  Result := Boolean(CkHttpRequest_AddFileForUpload2(FHandle, PAnsiChar(StrToCk(name)), PAnsiChar(StrToCk(filePath)), PAnsiChar(StrToCk(contentType))));
end;

procedure THttpRequest.AddHeader(const name: string; const value: string);
begin
  CkHttpRequest_AddHeader(FHandle, PAnsiChar(StrToCk(name)), PAnsiChar(StrToCk(value)));
end;

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

function THttpRequest.AddStringForUpload(const name: string; const filename: string; const strData: string; const charset: string): Boolean;
begin
  Result := Boolean(CkHttpRequest_AddStringForUpload(FHandle, PAnsiChar(StrToCk(name)), PAnsiChar(StrToCk(filename)), PAnsiChar(StrToCk(strData)), PAnsiChar(StrToCk(charset))));
end;

function THttpRequest.AddStringForUpload2(const name: string; const filename: string; const strData: string; const charset: string; const contentType: string): Boolean;
begin
  Result := Boolean(CkHttpRequest_AddStringForUpload2(FHandle, PAnsiChar(StrToCk(name)), PAnsiChar(StrToCk(filename)), PAnsiChar(StrToCk(strData)), PAnsiChar(StrToCk(charset)), PAnsiChar(StrToCk(contentType))));
end;

function THttpRequest.AddSubHeader(index: Integer; const name: string; const value: string): Boolean;
begin
  Result := Boolean(CkHttpRequest_AddSubHeader(FHandle, index, PAnsiChar(StrToCk(name)), PAnsiChar(StrToCk(value))));
end;

function THttpRequest.GenerateRequestText: string;
begin
  Result := CkToStr(CkHttpRequest_GenerateRequestText(FHandle));
end;

function THttpRequest.GetHeaderField(const name: string): string;
begin
  Result := CkToStr(CkHttpRequest_GetHeaderField(FHandle, PAnsiChar(StrToCk(name))));
end;

function THttpRequest.GetHeaderName(index: Integer): string;
begin
  Result := CkToStr(CkHttpRequest_GetHeaderName(FHandle, index));
end;

function THttpRequest.GetHeaderValue(index: Integer): string;
begin
  Result := CkToStr(CkHttpRequest_GetHeaderValue(FHandle, index));
end;

function THttpRequest.GetParam(const name: string): string;
begin
  Result := CkToStr(CkHttpRequest_GetParam(FHandle, PAnsiChar(StrToCk(name))));
end;

function THttpRequest.GetParamName(index: Integer): string;
begin
  Result := CkToStr(CkHttpRequest_GetParamName(FHandle, index));
end;

function THttpRequest.GetParamValue(index: Integer): string;
begin
  Result := CkToStr(CkHttpRequest_GetParamValue(FHandle, index));
end;

function THttpRequest.GetUrlEncodedParams: string;
begin
  Result := CkToStr(CkHttpRequest_GetUrlEncodedParams(FHandle));
end;

function THttpRequest.LoadBodyFromFile(const filePath: string): Boolean;
begin
  Result := Boolean(CkHttpRequest_LoadBodyFromFile(FHandle, PAnsiChar(StrToCk(filePath))));
end;

function THttpRequest.LoadBodyFromString(const bodyStr: string; const charset: string): Boolean;
begin
  Result := Boolean(CkHttpRequest_LoadBodyFromString(FHandle, PAnsiChar(StrToCk(bodyStr)), PAnsiChar(StrToCk(charset))));
end;

procedure THttpRequest.RemoveAllParams;
begin
  CkHttpRequest_RemoveAllParams(FHandle);
end;

function THttpRequest.RemoveHeader(const name: string): Boolean;
begin
  Result := Boolean(CkHttpRequest_RemoveHeader(FHandle, PAnsiChar(StrToCk(name))));
end;

procedure THttpRequest.RemoveParam(const name: string);
begin
  CkHttpRequest_RemoveParam(FHandle, PAnsiChar(StrToCk(name)));
end;

procedure THttpRequest.SetFromUrl(const url: string);
begin
  CkHttpRequest_SetFromUrl(FHandle, PAnsiChar(StrToCk(url)));
end;

function THttpRequest.StreamBodyFromFile(const filePath: string): Boolean;
begin
  Result := Boolean(CkHttpRequest_StreamBodyFromFile(FHandle, PAnsiChar(StrToCk(filePath))));
end;

function THttpRequest.StreamChunkFromFile(const path: string; const offset: string; const numBytes: string): Boolean;
begin
  Result := Boolean(CkHttpRequest_StreamChunkFromFile(FHandle, PAnsiChar(StrToCk(path)), PAnsiChar(StrToCk(offset)), PAnsiChar(StrToCk(numBytes))));
end;

function THttpRequest.GenerateRequestFile(const path: string): Boolean;
begin
  Result := Boolean(CkHttpRequest_GenerateRequestFile(FHandle, PAnsiChar(StrToCk(path))));
end;

function THttpRequest.AddMwsSignature(const domain: string; const mwsSecretKey: string): Boolean;
begin
  Result := Boolean(CkHttpRequest_AddMwsSignature(FHandle, PAnsiChar(StrToCk(domain)), PAnsiChar(StrToCk(mwsSecretKey))));
end;

function THttpRequest.LoadBodyFromBd(requestBody: TChilkatBase): Boolean;
begin
  Result := Boolean(CkHttpRequest_LoadBodyFromBd(FHandle, requestBody.Handle));
end;

function THttpRequest.LoadBodyFromSb(requestBody: TChilkatBase; const charset: string): Boolean;
begin
  Result := Boolean(CkHttpRequest_LoadBodyFromSb(FHandle, requestBody.Handle, PAnsiChar(StrToCk(charset))));
end;

function THttpRequest.AddBdForUpload(const name: string; const remoteFilename: string; byteData: TChilkatBase; const contentType: string): Boolean;
begin
  Result := Boolean(CkHttpRequest_AddBdForUpload(FHandle, PAnsiChar(StrToCk(name)), PAnsiChar(StrToCk(remoteFilename)), byteData.Handle, PAnsiChar(StrToCk(contentType))));
end;

initialization
  Chilkat_GetProcedureAddress(CkHttpRequest_Create,  'CkHttpRequest_Create');
  Chilkat_GetProcedureAddress(CkHttpRequest_Dispose, 'CkHttpRequest_Dispose');
  Chilkat_GetProcedureAddress(CkHttpRequest_get_LastErrorHtml, 'CkHttpRequest_get_LastErrorHtml');
  Chilkat_GetProcedureAddress(CkHttpRequest_get_LastErrorText, 'CkHttpRequest_get_LastErrorText');
  Chilkat_GetProcedureAddress(CkHttpRequest_get_LastErrorXml, 'CkHttpRequest_get_LastErrorXml');
  Chilkat_GetProcedureAddress(CkHttpRequest_get_Version, 'CkHttpRequest_get_Version');
  Chilkat_GetProcedureAddress(CkHttpRequest_get_DebugLogFilePath, 'CkHttpRequest_get_DebugLogFilePath');
  Chilkat_GetProcedureAddress(CkHttpRequest_put_DebugLogFilePath, 'CkHttpRequest_put_DebugLogFilePath');
  Chilkat_GetProcedureAddress(CkHttpRequest_get_VerboseLogging, 'CkHttpRequest_get_VerboseLogging');
  Chilkat_GetProcedureAddress(CkHttpRequest_put_VerboseLogging, 'CkHttpRequest_put_VerboseLogging');
  Chilkat_GetProcedureAddress(CkHttpRequest_get_LastMethodSuccess, 'CkHttpRequest_get_LastMethodSuccess');
  Chilkat_GetProcedureAddress(CkHttpRequest_put_LastMethodSuccess, 'CkHttpRequest_put_LastMethodSuccess');
  Chilkat_GetProcedureAddress(CkHttpRequest_get_Boundary, 'CkHttpRequest_get_Boundary');
  Chilkat_GetProcedureAddress(CkHttpRequest_put_Boundary, 'CkHttpRequest_put_Boundary');
  Chilkat_GetProcedureAddress(CkHttpRequest_get_Charset, 'CkHttpRequest_get_Charset');
  Chilkat_GetProcedureAddress(CkHttpRequest_put_Charset, 'CkHttpRequest_put_Charset');
  Chilkat_GetProcedureAddress(CkHttpRequest_get_ContentType, 'CkHttpRequest_get_ContentType');
  Chilkat_GetProcedureAddress(CkHttpRequest_put_ContentType, 'CkHttpRequest_put_ContentType');
  Chilkat_GetProcedureAddress(CkHttpRequest_get_EntireHeader, 'CkHttpRequest_get_EntireHeader');
  Chilkat_GetProcedureAddress(CkHttpRequest_put_EntireHeader, 'CkHttpRequest_put_EntireHeader');
  Chilkat_GetProcedureAddress(CkHttpRequest_get_HttpVerb, 'CkHttpRequest_get_HttpVerb');
  Chilkat_GetProcedureAddress(CkHttpRequest_put_HttpVerb, 'CkHttpRequest_put_HttpVerb');
  Chilkat_GetProcedureAddress(CkHttpRequest_get_HttpVersion, 'CkHttpRequest_get_HttpVersion');
  Chilkat_GetProcedureAddress(CkHttpRequest_put_HttpVersion, 'CkHttpRequest_put_HttpVersion');
  Chilkat_GetProcedureAddress(CkHttpRequest_get_NumHeaderFields, 'CkHttpRequest_get_NumHeaderFields');
  Chilkat_GetProcedureAddress(CkHttpRequest_get_NumParams, 'CkHttpRequest_get_NumParams');
  Chilkat_GetProcedureAddress(CkHttpRequest_get_Path, 'CkHttpRequest_get_Path');
  Chilkat_GetProcedureAddress(CkHttpRequest_put_Path, 'CkHttpRequest_put_Path');
  Chilkat_GetProcedureAddress(CkHttpRequest_get_SendCharset, 'CkHttpRequest_get_SendCharset');
  Chilkat_GetProcedureAddress(CkHttpRequest_put_SendCharset, 'CkHttpRequest_put_SendCharset');
  Chilkat_GetProcedureAddress(CkHttpRequest_AddFileForUpload, 'CkHttpRequest_AddFileForUpload');
  Chilkat_GetProcedureAddress(CkHttpRequest_AddFileForUpload2, 'CkHttpRequest_AddFileForUpload2');
  Chilkat_GetProcedureAddress(CkHttpRequest_AddHeader, 'CkHttpRequest_AddHeader');
  Chilkat_GetProcedureAddress(CkHttpRequest_AddParam, 'CkHttpRequest_AddParam');
  Chilkat_GetProcedureAddress(CkHttpRequest_AddStringForUpload, 'CkHttpRequest_AddStringForUpload');
  Chilkat_GetProcedureAddress(CkHttpRequest_AddStringForUpload2, 'CkHttpRequest_AddStringForUpload2');
  Chilkat_GetProcedureAddress(CkHttpRequest_AddSubHeader, 'CkHttpRequest_AddSubHeader');
  Chilkat_GetProcedureAddress(CkHttpRequest_GenerateRequestText, 'CkHttpRequest_GenerateRequestText');
  Chilkat_GetProcedureAddress(CkHttpRequest_GetHeaderField, 'CkHttpRequest_GetHeaderField');
  Chilkat_GetProcedureAddress(CkHttpRequest_GetHeaderName, 'CkHttpRequest_GetHeaderName');
  Chilkat_GetProcedureAddress(CkHttpRequest_GetHeaderValue, 'CkHttpRequest_GetHeaderValue');
  Chilkat_GetProcedureAddress(CkHttpRequest_GetParam, 'CkHttpRequest_GetParam');
  Chilkat_GetProcedureAddress(CkHttpRequest_GetParamName, 'CkHttpRequest_GetParamName');
  Chilkat_GetProcedureAddress(CkHttpRequest_GetParamValue, 'CkHttpRequest_GetParamValue');
  Chilkat_GetProcedureAddress(CkHttpRequest_GetUrlEncodedParams, 'CkHttpRequest_GetUrlEncodedParams');
  Chilkat_GetProcedureAddress(CkHttpRequest_LoadBodyFromFile, 'CkHttpRequest_LoadBodyFromFile');
  Chilkat_GetProcedureAddress(CkHttpRequest_LoadBodyFromString, 'CkHttpRequest_LoadBodyFromString');
  Chilkat_GetProcedureAddress(CkHttpRequest_RemoveAllParams, 'CkHttpRequest_RemoveAllParams');
  Chilkat_GetProcedureAddress(CkHttpRequest_RemoveHeader, 'CkHttpRequest_RemoveHeader');
  Chilkat_GetProcedureAddress(CkHttpRequest_RemoveParam, 'CkHttpRequest_RemoveParam');
  Chilkat_GetProcedureAddress(CkHttpRequest_SetFromUrl, 'CkHttpRequest_SetFromUrl');
  Chilkat_GetProcedureAddress(CkHttpRequest_StreamBodyFromFile, 'CkHttpRequest_StreamBodyFromFile');
  Chilkat_GetProcedureAddress(CkHttpRequest_StreamChunkFromFile, 'CkHttpRequest_StreamChunkFromFile');
  Chilkat_GetProcedureAddress(CkHttpRequest_GenerateRequestFile, 'CkHttpRequest_GenerateRequestFile');
  Chilkat_GetProcedureAddress(CkHttpRequest_AddMwsSignature, 'CkHttpRequest_AddMwsSignature');
  Chilkat_GetProcedureAddress(CkHttpRequest_LoadBodyFromBd, 'CkHttpRequest_LoadBodyFromBd');
  Chilkat_GetProcedureAddress(CkHttpRequest_LoadBodyFromSb, 'CkHttpRequest_LoadBodyFromSb');
  Chilkat_GetProcedureAddress(CkHttpRequest_AddBdForUpload, 'CkHttpRequest_AddBdForUpload');

end.
