unit Chilkat.Rest;

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

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

interface

uses
  SysUtils,
  Chilkat.Base;

type

  { TRest wraps CkRest via the C bridge layer. }
  TRest = 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  GetAuthorization: string;
    procedure SetAuthorization(AValue: string);
    function  GetHeartbeatMs: Integer;
    procedure SetHeartbeatMs(AValue: Integer);
    function  GetHost: string;
    procedure SetHost(AValue: string);
    function  GetIdleTimeoutMs: Integer;
    procedure SetIdleTimeoutMs(AValue: Integer);
    function  GetLastRequestHeader: string;
    function  GetLastRequestStartLine: string;
    function  GetNumResponseHeaders: Integer;
    function  GetPartSelector: string;
    procedure SetPartSelector(AValue: string);
    function  GetResponseHeader: string;
    function  GetResponseStatusCode: Integer;
    function  GetResponseStatusText: string;
    function  GetStreamNonChunked: Boolean;
    procedure SetStreamNonChunked(AValue: Boolean);
    function  GetConnectFailReason: Integer;
    function  GetPercentDoneOnSend: Boolean;
    procedure SetPercentDoneOnSend(AValue: Boolean);
    function  GetAllowHeaderQB: Boolean;
    procedure SetAllowHeaderQB(AValue: Boolean);
    function  GetAllowHeaderFolding: Boolean;
    procedure SetAllowHeaderFolding(AValue: Boolean);
    function  GetConnectTimeoutMs: Integer;
    procedure SetConnectTimeoutMs(AValue: Integer);
    function  GetDebugMode: Boolean;
    procedure SetDebugMode(AValue: Boolean);
    function  GetUncommonOptions: string;
    procedure SetUncommonOptions(AValue: string);
    function  GetLastRedirectUrl: string;
    function  GetEnableSecrets: Boolean;
    procedure SetEnableSecrets(AValue: Boolean);
    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 Authorization: string read GetAuthorization write SetAuthorization;
    property HeartbeatMs: Integer read GetHeartbeatMs write SetHeartbeatMs;
    property Host: string read GetHost write SetHost;
    property IdleTimeoutMs: Integer read GetIdleTimeoutMs write SetIdleTimeoutMs;
    property LastRequestHeader: string read GetLastRequestHeader;
    property LastRequestStartLine: string read GetLastRequestStartLine;
    property NumResponseHeaders: Integer read GetNumResponseHeaders;
    property PartSelector: string read GetPartSelector write SetPartSelector;
    property ResponseHeader: string read GetResponseHeader;
    property ResponseStatusCode: Integer read GetResponseStatusCode;
    property ResponseStatusText: string read GetResponseStatusText;
    property StreamNonChunked: Boolean read GetStreamNonChunked write SetStreamNonChunked;
    property ConnectFailReason: Integer read GetConnectFailReason;
    property PercentDoneOnSend: Boolean read GetPercentDoneOnSend write SetPercentDoneOnSend;
    property AllowHeaderQB: Boolean read GetAllowHeaderQB write SetAllowHeaderQB;
    property AllowHeaderFolding: Boolean read GetAllowHeaderFolding write SetAllowHeaderFolding;
    property ConnectTimeoutMs: Integer read GetConnectTimeoutMs write SetConnectTimeoutMs;
    property DebugMode: Boolean read GetDebugMode write SetDebugMode;
    property UncommonOptions: string read GetUncommonOptions write SetUncommonOptions;
    property LastRedirectUrl: string read GetLastRedirectUrl;
    property EnableSecrets: Boolean read GetEnableSecrets write SetEnableSecrets;

    { 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;

    function  AddHeader(const name: string; const value: string): Boolean;
    function  AddQueryParam(const name: string; const value: string): Boolean;
    function  AddQueryParams(const queryString: string): Boolean;
    function  ClearAllHeaders: Boolean;
    function  ClearAllQueryParams: Boolean;
    procedure ClearResponseBodyStream;
    function  Connect(const hostname: string; port: Integer; tls: Boolean; autoReconnect: Boolean): Boolean;
    function  Disconnect(maxWaitMs: Integer): Boolean;
    function  FullRequestFormUrlEncoded(const httpVerb: string; const uriPath: string): string;
    function  FullRequestMultipart(const httpVerb: string; const uriPath: string): string;
    function  FullRequestNoBody(const httpVerb: string; const uriPath: string): string;
    function  FullRequestStream(const httpVerb: string; const uriPath: string; stream: TChilkatBase): string;
    function  FullRequestString(const httpVerb: string; const uriPath: string; const bodyText: string): string;
    function  ReadRespBodyStream(stream: TChilkatBase; autoSetStreamCharset: Boolean): Boolean;
    function  ReadRespBodyString: string;
    function  ReadResponseHeader: Integer;
    function  RemoveHeader(const name: string): Boolean;
    function  RemoveQueryParam(const name: string): Boolean;
    function  ResponseHdrByName(const name: string): string;
    function  ResponseHdrName(index: Integer): string;
    function  ResponseHdrValue(index: Integer): string;
    function  SendReqFormUrlEncoded(const httpVerb: string; const uriPath: string): Boolean;
    function  SendReqMultipart(const httpVerb: string; const uriPath: string): Boolean;
    function  SendReqNoBody(const httpVerb: string; const uriPath: string): Boolean;
    function  SendReqStreamBody(const httpVerb: string; const uriPath: string; stream: TChilkatBase): Boolean;
    function  SendReqStringBody(const httpVerb: string; const uriPath: string; const bodyText: string): Boolean;
    function  SetAuthAws(authProvider: TChilkatBase): Boolean;
    function  SetAuthAzureStorage(authProvider: TChilkatBase): Boolean;
    function  SetAuthBasic(const username: string; const password: string): Boolean;
    function  SetAuthGoogle(authProvider: TChilkatBase): Boolean;
    function  SetAuthOAuth1(authProvider: TChilkatBase; useQueryParams: Boolean): Boolean;
    function  SetAuthOAuth2(authProvider: TChilkatBase): Boolean;
    function  SetMultipartBodyStream(stream: TChilkatBase): Boolean;
    function  SetMultipartBodyString(const bodyText: string): Boolean;
    function  SetResponseBodyStream(expectedStatus: Integer; autoSetStreamCharset: Boolean; responseStream: TChilkatBase): Boolean;
    function  UseConnection(connection: TChilkatBase; autoReconnect: Boolean): Boolean;
    function  FullRequestSb(const httpVerb: string; const uriPath: string; requestBody: TChilkatBase; responseBody: TChilkatBase): Boolean;
    function  AddQueryParamSb(const name: string; value: TChilkatBase): Boolean;
    function  SetMultipartBodySb(bodySb: TChilkatBase): Boolean;
    function  SetMultipartBodyBd(bodyData: TChilkatBase): Boolean;
    function  SendReqSb(const httpVerb: string; const uriPath: string; bodySb: TChilkatBase): Boolean;
    function  SendReqBd(const httpVerb: string; const uriPath: string; body: TChilkatBase): Boolean;
    function  ReadRespSb(responseBody: TChilkatBase): Boolean;
    function  ReadRespBd(responseBody: TChilkatBase): Boolean;
    function  ClearAllParts: Boolean;
    function  FullRequestNoBodySb(const httpVerb: string; const uriPath: string; sb: TChilkatBase): Boolean;
    function  FullRequestBd(const httpVerb: string; const uriPath: string; binData: TChilkatBase; responseBody: TChilkatBase): Boolean;
    function  FullRequestNoBodyBd(const httpVerb: string; const uriPath: string; binData: TChilkatBase): Boolean;
    function  SetAuthAzureSas(authProvider: TChilkatBase): Boolean;
    function  AddMwsSignature(const httpVerb: string; const uriPath: string; const domain: string; const mwsSecretKey: string): Boolean;
    function  ClearAuth: Boolean;
    function  AddPathParam(const name: string; const value: string): Boolean;
    function  ClearAllPathParams: Boolean;
    function  SetAuthBasicSecure(username: TChilkatBase; password: TChilkatBase): Boolean;
    function  GetLastDebugRequest(bd: TChilkatBase): Boolean;
    function  ReadRespChunkBd(minSize: Integer; bd: TChilkatBase): Integer;
    procedure GetLastJsonData(json: TChilkatBase);
  end;

implementation

uses
  CkDllLoader,
  Chilkat.Utils;

{ ---- C bridge function pointer types ---- }
type
  TCkRest_Create  = function(): Pointer; cdecl;
  TCkRest_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;
  TCkRest_SetAbortCheckCallback   = procedure(handle: Pointer; cb: TCkBridgeAbortCheckCb; userData: Pointer); cdecl;
  TCkRest_SetPercentDoneCallback  = procedure(handle: Pointer; cb: TCkBridgePercentDoneCb; userData: Pointer); cdecl;
  TCkRest_SetProgressInfoCallback = procedure(handle: Pointer; cb: TCkBridgeProgressInfoCb; userData: Pointer); cdecl;
  TCkRest_get_LastErrorHtml = function(handle: Pointer): PAnsiChar; cdecl;
  TCkRest_get_LastErrorText = function(handle: Pointer): PAnsiChar; cdecl;
  TCkRest_get_LastErrorXml = function(handle: Pointer): PAnsiChar; cdecl;
  TCkRest_get_Version = function(handle: Pointer): PAnsiChar; cdecl;
  TCkRest_get_DebugLogFilePath = function(handle: Pointer): PAnsiChar; cdecl;
  TCkRest_put_DebugLogFilePath = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkRest_get_VerboseLogging = function(handle: Pointer): LongBool; cdecl;
  TCkRest_put_VerboseLogging = procedure(handle: Pointer; value: LongBool); cdecl;
  TCkRest_get_LastMethodSuccess = function(handle: Pointer): LongBool; cdecl;
  TCkRest_put_LastMethodSuccess = procedure(handle: Pointer; value: LongBool); cdecl;
  TCkRest_get_Authorization = function(handle: Pointer): PAnsiChar; cdecl;
  TCkRest_put_Authorization = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkRest_get_HeartbeatMs = function(handle: Pointer): Integer; cdecl;
  TCkRest_put_HeartbeatMs = procedure(handle: Pointer; value: Integer); cdecl;
  TCkRest_get_Host = function(handle: Pointer): PAnsiChar; cdecl;
  TCkRest_put_Host = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkRest_get_IdleTimeoutMs = function(handle: Pointer): Integer; cdecl;
  TCkRest_put_IdleTimeoutMs = procedure(handle: Pointer; value: Integer); cdecl;
  TCkRest_get_LastRequestHeader = function(handle: Pointer): PAnsiChar; cdecl;
  TCkRest_get_LastRequestStartLine = function(handle: Pointer): PAnsiChar; cdecl;
  TCkRest_get_NumResponseHeaders = function(handle: Pointer): Integer; cdecl;
  TCkRest_get_PartSelector = function(handle: Pointer): PAnsiChar; cdecl;
  TCkRest_put_PartSelector = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkRest_get_ResponseHeader = function(handle: Pointer): PAnsiChar; cdecl;
  TCkRest_get_ResponseStatusCode = function(handle: Pointer): Integer; cdecl;
  TCkRest_get_ResponseStatusText = function(handle: Pointer): PAnsiChar; cdecl;
  TCkRest_get_StreamNonChunked = function(handle: Pointer): LongBool; cdecl;
  TCkRest_put_StreamNonChunked = procedure(handle: Pointer; value: LongBool); cdecl;
  TCkRest_get_ConnectFailReason = function(handle: Pointer): Integer; cdecl;
  TCkRest_get_PercentDoneOnSend = function(handle: Pointer): LongBool; cdecl;
  TCkRest_put_PercentDoneOnSend = procedure(handle: Pointer; value: LongBool); cdecl;
  TCkRest_get_AllowHeaderQB = function(handle: Pointer): LongBool; cdecl;
  TCkRest_put_AllowHeaderQB = procedure(handle: Pointer; value: LongBool); cdecl;
  TCkRest_get_AllowHeaderFolding = function(handle: Pointer): LongBool; cdecl;
  TCkRest_put_AllowHeaderFolding = procedure(handle: Pointer; value: LongBool); cdecl;
  TCkRest_get_ConnectTimeoutMs = function(handle: Pointer): Integer; cdecl;
  TCkRest_put_ConnectTimeoutMs = procedure(handle: Pointer; value: Integer); cdecl;
  TCkRest_get_DebugMode = function(handle: Pointer): LongBool; cdecl;
  TCkRest_put_DebugMode = procedure(handle: Pointer; value: LongBool); cdecl;
  TCkRest_get_UncommonOptions = function(handle: Pointer): PAnsiChar; cdecl;
  TCkRest_put_UncommonOptions = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkRest_get_LastRedirectUrl = function(handle: Pointer): PAnsiChar; cdecl;
  TCkRest_get_EnableSecrets = function(handle: Pointer): LongBool; cdecl;
  TCkRest_put_EnableSecrets = procedure(handle: Pointer; value: LongBool); cdecl;
  TCkRest_AddHeader = function(handle: Pointer; name: PAnsiChar; value: PAnsiChar): LongBool; cdecl;
  TCkRest_AddQueryParam = function(handle: Pointer; name: PAnsiChar; value: PAnsiChar): LongBool; cdecl;
  TCkRest_AddQueryParams = function(handle: Pointer; queryString: PAnsiChar): LongBool; cdecl;
  TCkRest_ClearAllHeaders = function(handle: Pointer): LongBool; cdecl;
  TCkRest_ClearAllQueryParams = function(handle: Pointer): LongBool; cdecl;
  TCkRest_ClearResponseBodyStream = procedure(handle: Pointer); cdecl;
  TCkRest_Connect = function(handle: Pointer; hostname: PAnsiChar; port: Integer; tls: LongBool; autoReconnect: LongBool): LongBool; cdecl;
  TCkRest_Disconnect = function(handle: Pointer; maxWaitMs: Integer): LongBool; cdecl;
  TCkRest_FullRequestFormUrlEncoded = function(handle: Pointer; httpVerb: PAnsiChar; uriPath: PAnsiChar): PAnsiChar; cdecl;
  TCkRest_FullRequestMultipart = function(handle: Pointer; httpVerb: PAnsiChar; uriPath: PAnsiChar): PAnsiChar; cdecl;
  TCkRest_FullRequestNoBody = function(handle: Pointer; httpVerb: PAnsiChar; uriPath: PAnsiChar): PAnsiChar; cdecl;
  TCkRest_FullRequestStream = function(handle: Pointer; httpVerb: PAnsiChar; uriPath: PAnsiChar; stream: Pointer): PAnsiChar; cdecl;
  TCkRest_FullRequestString = function(handle: Pointer; httpVerb: PAnsiChar; uriPath: PAnsiChar; bodyText: PAnsiChar): PAnsiChar; cdecl;
  TCkRest_ReadRespBodyStream = function(handle: Pointer; stream: Pointer; autoSetStreamCharset: LongBool): LongBool; cdecl;
  TCkRest_ReadRespBodyString = function(handle: Pointer): PAnsiChar; cdecl;
  TCkRest_ReadResponseHeader = function(handle: Pointer): Integer; cdecl;
  TCkRest_RemoveHeader = function(handle: Pointer; name: PAnsiChar): LongBool; cdecl;
  TCkRest_RemoveQueryParam = function(handle: Pointer; name: PAnsiChar): LongBool; cdecl;
  TCkRest_ResponseHdrByName = function(handle: Pointer; name: PAnsiChar): PAnsiChar; cdecl;
  TCkRest_ResponseHdrName = function(handle: Pointer; index: Integer): PAnsiChar; cdecl;
  TCkRest_ResponseHdrValue = function(handle: Pointer; index: Integer): PAnsiChar; cdecl;
  TCkRest_SendReqFormUrlEncoded = function(handle: Pointer; httpVerb: PAnsiChar; uriPath: PAnsiChar): LongBool; cdecl;
  TCkRest_SendReqMultipart = function(handle: Pointer; httpVerb: PAnsiChar; uriPath: PAnsiChar): LongBool; cdecl;
  TCkRest_SendReqNoBody = function(handle: Pointer; httpVerb: PAnsiChar; uriPath: PAnsiChar): LongBool; cdecl;
  TCkRest_SendReqStreamBody = function(handle: Pointer; httpVerb: PAnsiChar; uriPath: PAnsiChar; stream: Pointer): LongBool; cdecl;
  TCkRest_SendReqStringBody = function(handle: Pointer; httpVerb: PAnsiChar; uriPath: PAnsiChar; bodyText: PAnsiChar): LongBool; cdecl;
  TCkRest_SetAuthAws = function(handle: Pointer; authProvider: Pointer): LongBool; cdecl;
  TCkRest_SetAuthAzureStorage = function(handle: Pointer; authProvider: Pointer): LongBool; cdecl;
  TCkRest_SetAuthBasic = function(handle: Pointer; username: PAnsiChar; password: PAnsiChar): LongBool; cdecl;
  TCkRest_SetAuthGoogle = function(handle: Pointer; authProvider: Pointer): LongBool; cdecl;
  TCkRest_SetAuthOAuth1 = function(handle: Pointer; authProvider: Pointer; useQueryParams: LongBool): LongBool; cdecl;
  TCkRest_SetAuthOAuth2 = function(handle: Pointer; authProvider: Pointer): LongBool; cdecl;
  TCkRest_SetMultipartBodyStream = function(handle: Pointer; stream: Pointer): LongBool; cdecl;
  TCkRest_SetMultipartBodyString = function(handle: Pointer; bodyText: PAnsiChar): LongBool; cdecl;
  TCkRest_SetResponseBodyStream = function(handle: Pointer; expectedStatus: Integer; autoSetStreamCharset: LongBool; responseStream: Pointer): LongBool; cdecl;
  TCkRest_UseConnection = function(handle: Pointer; connection: Pointer; autoReconnect: LongBool): LongBool; cdecl;
  TCkRest_FullRequestSb = function(handle: Pointer; httpVerb: PAnsiChar; uriPath: PAnsiChar; requestBody: Pointer; responseBody: Pointer): LongBool; cdecl;
  TCkRest_AddQueryParamSb = function(handle: Pointer; name: PAnsiChar; value: Pointer): LongBool; cdecl;
  TCkRest_SetMultipartBodySb = function(handle: Pointer; bodySb: Pointer): LongBool; cdecl;
  TCkRest_SetMultipartBodyBd = function(handle: Pointer; bodyData: Pointer): LongBool; cdecl;
  TCkRest_SendReqSb = function(handle: Pointer; httpVerb: PAnsiChar; uriPath: PAnsiChar; bodySb: Pointer): LongBool; cdecl;
  TCkRest_SendReqBd = function(handle: Pointer; httpVerb: PAnsiChar; uriPath: PAnsiChar; body: Pointer): LongBool; cdecl;
  TCkRest_ReadRespSb = function(handle: Pointer; responseBody: Pointer): LongBool; cdecl;
  TCkRest_ReadRespBd = function(handle: Pointer; responseBody: Pointer): LongBool; cdecl;
  TCkRest_ClearAllParts = function(handle: Pointer): LongBool; cdecl;
  TCkRest_FullRequestNoBodySb = function(handle: Pointer; httpVerb: PAnsiChar; uriPath: PAnsiChar; sb: Pointer): LongBool; cdecl;
  TCkRest_FullRequestBd = function(handle: Pointer; httpVerb: PAnsiChar; uriPath: PAnsiChar; binData: Pointer; responseBody: Pointer): LongBool; cdecl;
  TCkRest_FullRequestNoBodyBd = function(handle: Pointer; httpVerb: PAnsiChar; uriPath: PAnsiChar; binData: Pointer): LongBool; cdecl;
  TCkRest_SetAuthAzureSas = function(handle: Pointer; authProvider: Pointer): LongBool; cdecl;
  TCkRest_AddMwsSignature = function(handle: Pointer; httpVerb: PAnsiChar; uriPath: PAnsiChar; domain: PAnsiChar; mwsSecretKey: PAnsiChar): LongBool; cdecl;
  TCkRest_ClearAuth = function(handle: Pointer): LongBool; cdecl;
  TCkRest_AddPathParam = function(handle: Pointer; name: PAnsiChar; value: PAnsiChar): LongBool; cdecl;
  TCkRest_ClearAllPathParams = function(handle: Pointer): LongBool; cdecl;
  TCkRest_SetAuthBasicSecure = function(handle: Pointer; username: Pointer; password: Pointer): LongBool; cdecl;
  TCkRest_GetLastDebugRequest = function(handle: Pointer; bd: Pointer): LongBool; cdecl;
  TCkRest_ReadRespChunkBd = function(handle: Pointer; minSize: Integer; bd: Pointer): Integer; cdecl;
  TCkRest_GetLastJsonData = procedure(handle: Pointer; json: Pointer); cdecl;

{ ---- C bridge function pointer variables ---- }
var
  CkRest_Create:  TCkRest_Create  = nil;
  CkRest_Dispose: TCkRest_Dispose = nil;
  CkRest_SetAbortCheckCallback:   TCkRest_SetAbortCheckCallback   = nil;
  CkRest_SetPercentDoneCallback:  TCkRest_SetPercentDoneCallback  = nil;
  CkRest_SetProgressInfoCallback: TCkRest_SetProgressInfoCallback = nil;
  CkRest_get_LastErrorHtml: TCkRest_get_LastErrorHtml = nil;
  CkRest_get_LastErrorText: TCkRest_get_LastErrorText = nil;
  CkRest_get_LastErrorXml: TCkRest_get_LastErrorXml = nil;
  CkRest_get_Version: TCkRest_get_Version = nil;
  CkRest_get_DebugLogFilePath: TCkRest_get_DebugLogFilePath = nil;
  CkRest_put_DebugLogFilePath: TCkRest_put_DebugLogFilePath = nil;
  CkRest_get_VerboseLogging: TCkRest_get_VerboseLogging = nil;
  CkRest_put_VerboseLogging: TCkRest_put_VerboseLogging = nil;
  CkRest_get_LastMethodSuccess: TCkRest_get_LastMethodSuccess = nil;
  CkRest_put_LastMethodSuccess: TCkRest_put_LastMethodSuccess = nil;
  CkRest_get_Authorization: TCkRest_get_Authorization = nil;
  CkRest_put_Authorization: TCkRest_put_Authorization = nil;
  CkRest_get_HeartbeatMs: TCkRest_get_HeartbeatMs = nil;
  CkRest_put_HeartbeatMs: TCkRest_put_HeartbeatMs = nil;
  CkRest_get_Host: TCkRest_get_Host = nil;
  CkRest_put_Host: TCkRest_put_Host = nil;
  CkRest_get_IdleTimeoutMs: TCkRest_get_IdleTimeoutMs = nil;
  CkRest_put_IdleTimeoutMs: TCkRest_put_IdleTimeoutMs = nil;
  CkRest_get_LastRequestHeader: TCkRest_get_LastRequestHeader = nil;
  CkRest_get_LastRequestStartLine: TCkRest_get_LastRequestStartLine = nil;
  CkRest_get_NumResponseHeaders: TCkRest_get_NumResponseHeaders = nil;
  CkRest_get_PartSelector: TCkRest_get_PartSelector = nil;
  CkRest_put_PartSelector: TCkRest_put_PartSelector = nil;
  CkRest_get_ResponseHeader: TCkRest_get_ResponseHeader = nil;
  CkRest_get_ResponseStatusCode: TCkRest_get_ResponseStatusCode = nil;
  CkRest_get_ResponseStatusText: TCkRest_get_ResponseStatusText = nil;
  CkRest_get_StreamNonChunked: TCkRest_get_StreamNonChunked = nil;
  CkRest_put_StreamNonChunked: TCkRest_put_StreamNonChunked = nil;
  CkRest_get_ConnectFailReason: TCkRest_get_ConnectFailReason = nil;
  CkRest_get_PercentDoneOnSend: TCkRest_get_PercentDoneOnSend = nil;
  CkRest_put_PercentDoneOnSend: TCkRest_put_PercentDoneOnSend = nil;
  CkRest_get_AllowHeaderQB: TCkRest_get_AllowHeaderQB = nil;
  CkRest_put_AllowHeaderQB: TCkRest_put_AllowHeaderQB = nil;
  CkRest_get_AllowHeaderFolding: TCkRest_get_AllowHeaderFolding = nil;
  CkRest_put_AllowHeaderFolding: TCkRest_put_AllowHeaderFolding = nil;
  CkRest_get_ConnectTimeoutMs: TCkRest_get_ConnectTimeoutMs = nil;
  CkRest_put_ConnectTimeoutMs: TCkRest_put_ConnectTimeoutMs = nil;
  CkRest_get_DebugMode: TCkRest_get_DebugMode = nil;
  CkRest_put_DebugMode: TCkRest_put_DebugMode = nil;
  CkRest_get_UncommonOptions: TCkRest_get_UncommonOptions = nil;
  CkRest_put_UncommonOptions: TCkRest_put_UncommonOptions = nil;
  CkRest_get_LastRedirectUrl: TCkRest_get_LastRedirectUrl = nil;
  CkRest_get_EnableSecrets: TCkRest_get_EnableSecrets = nil;
  CkRest_put_EnableSecrets: TCkRest_put_EnableSecrets = nil;
  CkRest_AddHeader: TCkRest_AddHeader = nil;
  CkRest_AddQueryParam: TCkRest_AddQueryParam = nil;
  CkRest_AddQueryParams: TCkRest_AddQueryParams = nil;
  CkRest_ClearAllHeaders: TCkRest_ClearAllHeaders = nil;
  CkRest_ClearAllQueryParams: TCkRest_ClearAllQueryParams = nil;
  CkRest_ClearResponseBodyStream: TCkRest_ClearResponseBodyStream = nil;
  CkRest_Connect: TCkRest_Connect = nil;
  CkRest_Disconnect: TCkRest_Disconnect = nil;
  CkRest_FullRequestFormUrlEncoded: TCkRest_FullRequestFormUrlEncoded = nil;
  CkRest_FullRequestMultipart: TCkRest_FullRequestMultipart = nil;
  CkRest_FullRequestNoBody: TCkRest_FullRequestNoBody = nil;
  CkRest_FullRequestStream: TCkRest_FullRequestStream = nil;
  CkRest_FullRequestString: TCkRest_FullRequestString = nil;
  CkRest_ReadRespBodyStream: TCkRest_ReadRespBodyStream = nil;
  CkRest_ReadRespBodyString: TCkRest_ReadRespBodyString = nil;
  CkRest_ReadResponseHeader: TCkRest_ReadResponseHeader = nil;
  CkRest_RemoveHeader: TCkRest_RemoveHeader = nil;
  CkRest_RemoveQueryParam: TCkRest_RemoveQueryParam = nil;
  CkRest_ResponseHdrByName: TCkRest_ResponseHdrByName = nil;
  CkRest_ResponseHdrName: TCkRest_ResponseHdrName = nil;
  CkRest_ResponseHdrValue: TCkRest_ResponseHdrValue = nil;
  CkRest_SendReqFormUrlEncoded: TCkRest_SendReqFormUrlEncoded = nil;
  CkRest_SendReqMultipart: TCkRest_SendReqMultipart = nil;
  CkRest_SendReqNoBody: TCkRest_SendReqNoBody = nil;
  CkRest_SendReqStreamBody: TCkRest_SendReqStreamBody = nil;
  CkRest_SendReqStringBody: TCkRest_SendReqStringBody = nil;
  CkRest_SetAuthAws: TCkRest_SetAuthAws = nil;
  CkRest_SetAuthAzureStorage: TCkRest_SetAuthAzureStorage = nil;
  CkRest_SetAuthBasic: TCkRest_SetAuthBasic = nil;
  CkRest_SetAuthGoogle: TCkRest_SetAuthGoogle = nil;
  CkRest_SetAuthOAuth1: TCkRest_SetAuthOAuth1 = nil;
  CkRest_SetAuthOAuth2: TCkRest_SetAuthOAuth2 = nil;
  CkRest_SetMultipartBodyStream: TCkRest_SetMultipartBodyStream = nil;
  CkRest_SetMultipartBodyString: TCkRest_SetMultipartBodyString = nil;
  CkRest_SetResponseBodyStream: TCkRest_SetResponseBodyStream = nil;
  CkRest_UseConnection: TCkRest_UseConnection = nil;
  CkRest_FullRequestSb: TCkRest_FullRequestSb = nil;
  CkRest_AddQueryParamSb: TCkRest_AddQueryParamSb = nil;
  CkRest_SetMultipartBodySb: TCkRest_SetMultipartBodySb = nil;
  CkRest_SetMultipartBodyBd: TCkRest_SetMultipartBodyBd = nil;
  CkRest_SendReqSb: TCkRest_SendReqSb = nil;
  CkRest_SendReqBd: TCkRest_SendReqBd = nil;
  CkRest_ReadRespSb: TCkRest_ReadRespSb = nil;
  CkRest_ReadRespBd: TCkRest_ReadRespBd = nil;
  CkRest_ClearAllParts: TCkRest_ClearAllParts = nil;
  CkRest_FullRequestNoBodySb: TCkRest_FullRequestNoBodySb = nil;
  CkRest_FullRequestBd: TCkRest_FullRequestBd = nil;
  CkRest_FullRequestNoBodyBd: TCkRest_FullRequestNoBodyBd = nil;
  CkRest_SetAuthAzureSas: TCkRest_SetAuthAzureSas = nil;
  CkRest_AddMwsSignature: TCkRest_AddMwsSignature = nil;
  CkRest_ClearAuth: TCkRest_ClearAuth = nil;
  CkRest_AddPathParam: TCkRest_AddPathParam = nil;
  CkRest_ClearAllPathParams: TCkRest_ClearAllPathParams = nil;
  CkRest_SetAuthBasicSecure: TCkRest_SetAuthBasicSecure = nil;
  CkRest_GetLastDebugRequest: TCkRest_GetLastDebugRequest = nil;
  CkRest_ReadRespChunkBd: TCkRest_ReadRespChunkBd = nil;
  CkRest_GetLastJsonData: TCkRest_GetLastJsonData = nil;

constructor TRest.Create;
begin
  inherited Create;
  FHandle := CkRest_Create();
end;

destructor TRest.Destroy;
begin
  if FHandle <> nil then
    CkRest_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 TRest_AbortCheckThunk(userData: Pointer): Integer; cdecl;
var
  obj: TRest;
begin
  Result := 0;
  obj := TRest(userData);
  if Assigned(obj) and Assigned(obj.FOnAbortCheck) then
    if obj.FOnAbortCheck(obj) then Result := 1;
end;

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

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

procedure TRest.SetOnAbortCheck(AValue: TChilkatAbortCheckEvent);
begin
  FOnAbortCheck := AValue;
  if Assigned(AValue) then
    CkRest_SetAbortCheckCallback(FHandle, @TRest_AbortCheckThunk, Self)
  else
    CkRest_SetAbortCheckCallback(FHandle, nil, nil);
end;

procedure TRest.SetOnPercentDone(AValue: TChilkatPercentDoneEvent);
begin
  FOnPercentDone := AValue;
  if Assigned(AValue) then
    CkRest_SetPercentDoneCallback(FHandle, @TRest_PercentDoneThunk, Self)
  else
    CkRest_SetPercentDoneCallback(FHandle, nil, nil);
end;

procedure TRest.SetOnProgressInfo(AValue: TChilkatProgressInfoEvent);
begin
  FOnProgressInfo := AValue;
  if Assigned(AValue) then
    CkRest_SetProgressInfoCallback(FHandle, @TRest_ProgressInfoThunk, Self)
  else
    CkRest_SetProgressInfoCallback(FHandle, nil, nil);
end;

function TRest.GetLastErrorHtml: string;
begin
  Result := CkToStr(CkRest_get_LastErrorHtml(FHandle));
end;

function TRest.GetLastErrorText: string;
begin
  Result := CkToStr(CkRest_get_LastErrorText(FHandle));
end;

function TRest.GetLastErrorXml: string;
begin
  Result := CkToStr(CkRest_get_LastErrorXml(FHandle));
end;

function TRest.GetVersion: string;
begin
  Result := CkToStr(CkRest_get_Version(FHandle));
end;

function TRest.GetDebugLogFilePath: string;
begin
  Result := CkToStr(CkRest_get_DebugLogFilePath(FHandle));
end;

procedure TRest.SetDebugLogFilePath(AValue: string);
begin
  CkRest_put_DebugLogFilePath(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function TRest.GetVerboseLogging: Boolean;
begin
  Result := Boolean(CkRest_get_VerboseLogging(FHandle));
end;

procedure TRest.SetVerboseLogging(AValue: Boolean);
begin
  CkRest_put_VerboseLogging(FHandle, LongBool(AValue));
end;

function TRest.GetLastMethodSuccess: Boolean;
begin
  Result := Boolean(CkRest_get_LastMethodSuccess(FHandle));
end;

procedure TRest.SetLastMethodSuccess(AValue: Boolean);
begin
  CkRest_put_LastMethodSuccess(FHandle, LongBool(AValue));
end;

function TRest.GetAuthorization: string;
begin
  Result := CkToStr(CkRest_get_Authorization(FHandle));
end;

procedure TRest.SetAuthorization(AValue: string);
begin
  CkRest_put_Authorization(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function TRest.GetHeartbeatMs: Integer;
begin
  Result := CkRest_get_HeartbeatMs(FHandle);
end;

procedure TRest.SetHeartbeatMs(AValue: Integer);
begin
  CkRest_put_HeartbeatMs(FHandle, AValue);
end;

function TRest.GetHost: string;
begin
  Result := CkToStr(CkRest_get_Host(FHandle));
end;

procedure TRest.SetHost(AValue: string);
begin
  CkRest_put_Host(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function TRest.GetIdleTimeoutMs: Integer;
begin
  Result := CkRest_get_IdleTimeoutMs(FHandle);
end;

procedure TRest.SetIdleTimeoutMs(AValue: Integer);
begin
  CkRest_put_IdleTimeoutMs(FHandle, AValue);
end;

function TRest.GetLastRequestHeader: string;
begin
  Result := CkToStr(CkRest_get_LastRequestHeader(FHandle));
end;

function TRest.GetLastRequestStartLine: string;
begin
  Result := CkToStr(CkRest_get_LastRequestStartLine(FHandle));
end;

function TRest.GetNumResponseHeaders: Integer;
begin
  Result := CkRest_get_NumResponseHeaders(FHandle);
end;

function TRest.GetPartSelector: string;
begin
  Result := CkToStr(CkRest_get_PartSelector(FHandle));
end;

procedure TRest.SetPartSelector(AValue: string);
begin
  CkRest_put_PartSelector(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function TRest.GetResponseHeader: string;
begin
  Result := CkToStr(CkRest_get_ResponseHeader(FHandle));
end;

function TRest.GetResponseStatusCode: Integer;
begin
  Result := CkRest_get_ResponseStatusCode(FHandle);
end;

function TRest.GetResponseStatusText: string;
begin
  Result := CkToStr(CkRest_get_ResponseStatusText(FHandle));
end;

function TRest.GetStreamNonChunked: Boolean;
begin
  Result := Boolean(CkRest_get_StreamNonChunked(FHandle));
end;

procedure TRest.SetStreamNonChunked(AValue: Boolean);
begin
  CkRest_put_StreamNonChunked(FHandle, LongBool(AValue));
end;

function TRest.GetConnectFailReason: Integer;
begin
  Result := CkRest_get_ConnectFailReason(FHandle);
end;

function TRest.GetPercentDoneOnSend: Boolean;
begin
  Result := Boolean(CkRest_get_PercentDoneOnSend(FHandle));
end;

procedure TRest.SetPercentDoneOnSend(AValue: Boolean);
begin
  CkRest_put_PercentDoneOnSend(FHandle, LongBool(AValue));
end;

function TRest.GetAllowHeaderQB: Boolean;
begin
  Result := Boolean(CkRest_get_AllowHeaderQB(FHandle));
end;

procedure TRest.SetAllowHeaderQB(AValue: Boolean);
begin
  CkRest_put_AllowHeaderQB(FHandle, LongBool(AValue));
end;

function TRest.GetAllowHeaderFolding: Boolean;
begin
  Result := Boolean(CkRest_get_AllowHeaderFolding(FHandle));
end;

procedure TRest.SetAllowHeaderFolding(AValue: Boolean);
begin
  CkRest_put_AllowHeaderFolding(FHandle, LongBool(AValue));
end;

function TRest.GetConnectTimeoutMs: Integer;
begin
  Result := CkRest_get_ConnectTimeoutMs(FHandle);
end;

procedure TRest.SetConnectTimeoutMs(AValue: Integer);
begin
  CkRest_put_ConnectTimeoutMs(FHandle, AValue);
end;

function TRest.GetDebugMode: Boolean;
begin
  Result := Boolean(CkRest_get_DebugMode(FHandle));
end;

procedure TRest.SetDebugMode(AValue: Boolean);
begin
  CkRest_put_DebugMode(FHandle, LongBool(AValue));
end;

function TRest.GetUncommonOptions: string;
begin
  Result := CkToStr(CkRest_get_UncommonOptions(FHandle));
end;

procedure TRest.SetUncommonOptions(AValue: string);
begin
  CkRest_put_UncommonOptions(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function TRest.GetLastRedirectUrl: string;
begin
  Result := CkToStr(CkRest_get_LastRedirectUrl(FHandle));
end;

function TRest.GetEnableSecrets: Boolean;
begin
  Result := Boolean(CkRest_get_EnableSecrets(FHandle));
end;

procedure TRest.SetEnableSecrets(AValue: Boolean);
begin
  CkRest_put_EnableSecrets(FHandle, LongBool(AValue));
end;

function TRest.AddHeader(const name: string; const value: string): Boolean;
begin
  Result := Boolean(CkRest_AddHeader(FHandle, PAnsiChar(StrToCk(name)), PAnsiChar(StrToCk(value))));
end;

function TRest.AddQueryParam(const name: string; const value: string): Boolean;
begin
  Result := Boolean(CkRest_AddQueryParam(FHandle, PAnsiChar(StrToCk(name)), PAnsiChar(StrToCk(value))));
end;

function TRest.AddQueryParams(const queryString: string): Boolean;
begin
  Result := Boolean(CkRest_AddQueryParams(FHandle, PAnsiChar(StrToCk(queryString))));
end;

function TRest.ClearAllHeaders: Boolean;
begin
  Result := Boolean(CkRest_ClearAllHeaders(FHandle));
end;

function TRest.ClearAllQueryParams: Boolean;
begin
  Result := Boolean(CkRest_ClearAllQueryParams(FHandle));
end;

procedure TRest.ClearResponseBodyStream;
begin
  CkRest_ClearResponseBodyStream(FHandle);
end;

function TRest.Connect(const hostname: string; port: Integer; tls: Boolean; autoReconnect: Boolean): Boolean;
begin
  Result := Boolean(CkRest_Connect(FHandle, PAnsiChar(StrToCk(hostname)), port, LongBool(tls), LongBool(autoReconnect)));
end;

function TRest.Disconnect(maxWaitMs: Integer): Boolean;
begin
  Result := Boolean(CkRest_Disconnect(FHandle, maxWaitMs));
end;

function TRest.FullRequestFormUrlEncoded(const httpVerb: string; const uriPath: string): string;
begin
  Result := CkToStr(CkRest_FullRequestFormUrlEncoded(FHandle, PAnsiChar(StrToCk(httpVerb)), PAnsiChar(StrToCk(uriPath))));
end;

function TRest.FullRequestMultipart(const httpVerb: string; const uriPath: string): string;
begin
  Result := CkToStr(CkRest_FullRequestMultipart(FHandle, PAnsiChar(StrToCk(httpVerb)), PAnsiChar(StrToCk(uriPath))));
end;

function TRest.FullRequestNoBody(const httpVerb: string; const uriPath: string): string;
begin
  Result := CkToStr(CkRest_FullRequestNoBody(FHandle, PAnsiChar(StrToCk(httpVerb)), PAnsiChar(StrToCk(uriPath))));
end;

function TRest.FullRequestStream(const httpVerb: string; const uriPath: string; stream: TChilkatBase): string;
begin
  Result := CkToStr(CkRest_FullRequestStream(FHandle, PAnsiChar(StrToCk(httpVerb)), PAnsiChar(StrToCk(uriPath)), stream.Handle));
end;

function TRest.FullRequestString(const httpVerb: string; const uriPath: string; const bodyText: string): string;
begin
  Result := CkToStr(CkRest_FullRequestString(FHandle, PAnsiChar(StrToCk(httpVerb)), PAnsiChar(StrToCk(uriPath)), PAnsiChar(StrToCk(bodyText))));
end;

function TRest.ReadRespBodyStream(stream: TChilkatBase; autoSetStreamCharset: Boolean): Boolean;
begin
  Result := Boolean(CkRest_ReadRespBodyStream(FHandle, stream.Handle, LongBool(autoSetStreamCharset)));
end;

function TRest.ReadRespBodyString: string;
begin
  Result := CkToStr(CkRest_ReadRespBodyString(FHandle));
end;

function TRest.ReadResponseHeader: Integer;
begin
  Result := CkRest_ReadResponseHeader(FHandle);
end;

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

function TRest.RemoveQueryParam(const name: string): Boolean;
begin
  Result := Boolean(CkRest_RemoveQueryParam(FHandle, PAnsiChar(StrToCk(name))));
end;

function TRest.ResponseHdrByName(const name: string): string;
begin
  Result := CkToStr(CkRest_ResponseHdrByName(FHandle, PAnsiChar(StrToCk(name))));
end;

function TRest.ResponseHdrName(index: Integer): string;
begin
  Result := CkToStr(CkRest_ResponseHdrName(FHandle, index));
end;

function TRest.ResponseHdrValue(index: Integer): string;
begin
  Result := CkToStr(CkRest_ResponseHdrValue(FHandle, index));
end;

function TRest.SendReqFormUrlEncoded(const httpVerb: string; const uriPath: string): Boolean;
begin
  Result := Boolean(CkRest_SendReqFormUrlEncoded(FHandle, PAnsiChar(StrToCk(httpVerb)), PAnsiChar(StrToCk(uriPath))));
end;

function TRest.SendReqMultipart(const httpVerb: string; const uriPath: string): Boolean;
begin
  Result := Boolean(CkRest_SendReqMultipart(FHandle, PAnsiChar(StrToCk(httpVerb)), PAnsiChar(StrToCk(uriPath))));
end;

function TRest.SendReqNoBody(const httpVerb: string; const uriPath: string): Boolean;
begin
  Result := Boolean(CkRest_SendReqNoBody(FHandle, PAnsiChar(StrToCk(httpVerb)), PAnsiChar(StrToCk(uriPath))));
end;

function TRest.SendReqStreamBody(const httpVerb: string; const uriPath: string; stream: TChilkatBase): Boolean;
begin
  Result := Boolean(CkRest_SendReqStreamBody(FHandle, PAnsiChar(StrToCk(httpVerb)), PAnsiChar(StrToCk(uriPath)), stream.Handle));
end;

function TRest.SendReqStringBody(const httpVerb: string; const uriPath: string; const bodyText: string): Boolean;
begin
  Result := Boolean(CkRest_SendReqStringBody(FHandle, PAnsiChar(StrToCk(httpVerb)), PAnsiChar(StrToCk(uriPath)), PAnsiChar(StrToCk(bodyText))));
end;

function TRest.SetAuthAws(authProvider: TChilkatBase): Boolean;
begin
  Result := Boolean(CkRest_SetAuthAws(FHandle, authProvider.Handle));
end;

function TRest.SetAuthAzureStorage(authProvider: TChilkatBase): Boolean;
begin
  Result := Boolean(CkRest_SetAuthAzureStorage(FHandle, authProvider.Handle));
end;

function TRest.SetAuthBasic(const username: string; const password: string): Boolean;
begin
  Result := Boolean(CkRest_SetAuthBasic(FHandle, PAnsiChar(StrToCk(username)), PAnsiChar(StrToCk(password))));
end;

function TRest.SetAuthGoogle(authProvider: TChilkatBase): Boolean;
begin
  Result := Boolean(CkRest_SetAuthGoogle(FHandle, authProvider.Handle));
end;

function TRest.SetAuthOAuth1(authProvider: TChilkatBase; useQueryParams: Boolean): Boolean;
begin
  Result := Boolean(CkRest_SetAuthOAuth1(FHandle, authProvider.Handle, LongBool(useQueryParams)));
end;

function TRest.SetAuthOAuth2(authProvider: TChilkatBase): Boolean;
begin
  Result := Boolean(CkRest_SetAuthOAuth2(FHandle, authProvider.Handle));
end;

function TRest.SetMultipartBodyStream(stream: TChilkatBase): Boolean;
begin
  Result := Boolean(CkRest_SetMultipartBodyStream(FHandle, stream.Handle));
end;

function TRest.SetMultipartBodyString(const bodyText: string): Boolean;
begin
  Result := Boolean(CkRest_SetMultipartBodyString(FHandle, PAnsiChar(StrToCk(bodyText))));
end;

function TRest.SetResponseBodyStream(expectedStatus: Integer; autoSetStreamCharset: Boolean; responseStream: TChilkatBase): Boolean;
begin
  Result := Boolean(CkRest_SetResponseBodyStream(FHandle, expectedStatus, LongBool(autoSetStreamCharset), responseStream.Handle));
end;

function TRest.UseConnection(connection: TChilkatBase; autoReconnect: Boolean): Boolean;
begin
  Result := Boolean(CkRest_UseConnection(FHandle, connection.Handle, LongBool(autoReconnect)));
end;

function TRest.FullRequestSb(const httpVerb: string; const uriPath: string; requestBody: TChilkatBase; responseBody: TChilkatBase): Boolean;
begin
  Result := Boolean(CkRest_FullRequestSb(FHandle, PAnsiChar(StrToCk(httpVerb)), PAnsiChar(StrToCk(uriPath)), requestBody.Handle, responseBody.Handle));
end;

function TRest.AddQueryParamSb(const name: string; value: TChilkatBase): Boolean;
begin
  Result := Boolean(CkRest_AddQueryParamSb(FHandle, PAnsiChar(StrToCk(name)), value.Handle));
end;

function TRest.SetMultipartBodySb(bodySb: TChilkatBase): Boolean;
begin
  Result := Boolean(CkRest_SetMultipartBodySb(FHandle, bodySb.Handle));
end;

function TRest.SetMultipartBodyBd(bodyData: TChilkatBase): Boolean;
begin
  Result := Boolean(CkRest_SetMultipartBodyBd(FHandle, bodyData.Handle));
end;

function TRest.SendReqSb(const httpVerb: string; const uriPath: string; bodySb: TChilkatBase): Boolean;
begin
  Result := Boolean(CkRest_SendReqSb(FHandle, PAnsiChar(StrToCk(httpVerb)), PAnsiChar(StrToCk(uriPath)), bodySb.Handle));
end;

function TRest.SendReqBd(const httpVerb: string; const uriPath: string; body: TChilkatBase): Boolean;
begin
  Result := Boolean(CkRest_SendReqBd(FHandle, PAnsiChar(StrToCk(httpVerb)), PAnsiChar(StrToCk(uriPath)), body.Handle));
end;

function TRest.ReadRespSb(responseBody: TChilkatBase): Boolean;
begin
  Result := Boolean(CkRest_ReadRespSb(FHandle, responseBody.Handle));
end;

function TRest.ReadRespBd(responseBody: TChilkatBase): Boolean;
begin
  Result := Boolean(CkRest_ReadRespBd(FHandle, responseBody.Handle));
end;

function TRest.ClearAllParts: Boolean;
begin
  Result := Boolean(CkRest_ClearAllParts(FHandle));
end;

function TRest.FullRequestNoBodySb(const httpVerb: string; const uriPath: string; sb: TChilkatBase): Boolean;
begin
  Result := Boolean(CkRest_FullRequestNoBodySb(FHandle, PAnsiChar(StrToCk(httpVerb)), PAnsiChar(StrToCk(uriPath)), sb.Handle));
end;

function TRest.FullRequestBd(const httpVerb: string; const uriPath: string; binData: TChilkatBase; responseBody: TChilkatBase): Boolean;
begin
  Result := Boolean(CkRest_FullRequestBd(FHandle, PAnsiChar(StrToCk(httpVerb)), PAnsiChar(StrToCk(uriPath)), binData.Handle, responseBody.Handle));
end;

function TRest.FullRequestNoBodyBd(const httpVerb: string; const uriPath: string; binData: TChilkatBase): Boolean;
begin
  Result := Boolean(CkRest_FullRequestNoBodyBd(FHandle, PAnsiChar(StrToCk(httpVerb)), PAnsiChar(StrToCk(uriPath)), binData.Handle));
end;

function TRest.SetAuthAzureSas(authProvider: TChilkatBase): Boolean;
begin
  Result := Boolean(CkRest_SetAuthAzureSas(FHandle, authProvider.Handle));
end;

function TRest.AddMwsSignature(const httpVerb: string; const uriPath: string; const domain: string; const mwsSecretKey: string): Boolean;
begin
  Result := Boolean(CkRest_AddMwsSignature(FHandle, PAnsiChar(StrToCk(httpVerb)), PAnsiChar(StrToCk(uriPath)), PAnsiChar(StrToCk(domain)), PAnsiChar(StrToCk(mwsSecretKey))));
end;

function TRest.ClearAuth: Boolean;
begin
  Result := Boolean(CkRest_ClearAuth(FHandle));
end;

function TRest.AddPathParam(const name: string; const value: string): Boolean;
begin
  Result := Boolean(CkRest_AddPathParam(FHandle, PAnsiChar(StrToCk(name)), PAnsiChar(StrToCk(value))));
end;

function TRest.ClearAllPathParams: Boolean;
begin
  Result := Boolean(CkRest_ClearAllPathParams(FHandle));
end;

function TRest.SetAuthBasicSecure(username: TChilkatBase; password: TChilkatBase): Boolean;
begin
  Result := Boolean(CkRest_SetAuthBasicSecure(FHandle, username.Handle, password.Handle));
end;

function TRest.GetLastDebugRequest(bd: TChilkatBase): Boolean;
begin
  Result := Boolean(CkRest_GetLastDebugRequest(FHandle, bd.Handle));
end;

function TRest.ReadRespChunkBd(minSize: Integer; bd: TChilkatBase): Integer;
begin
  Result := CkRest_ReadRespChunkBd(FHandle, minSize, bd.Handle);
end;

procedure TRest.GetLastJsonData(json: TChilkatBase);
begin
  CkRest_GetLastJsonData(FHandle, json.Handle);
end;

initialization
  Chilkat_GetProcedureAddress(CkRest_Create,  'CkRest_Create');
  Chilkat_GetProcedureAddress(CkRest_Dispose, 'CkRest_Dispose');
  Chilkat_GetProcedureAddress(CkRest_SetAbortCheckCallback, 'CkRest_SetAbortCheckCallback');
  Chilkat_GetProcedureAddress(CkRest_SetPercentDoneCallback, 'CkRest_SetPercentDoneCallback');
  Chilkat_GetProcedureAddress(CkRest_SetProgressInfoCallback, 'CkRest_SetProgressInfoCallback');
  Chilkat_GetProcedureAddress(CkRest_get_LastErrorHtml, 'CkRest_get_LastErrorHtml');
  Chilkat_GetProcedureAddress(CkRest_get_LastErrorText, 'CkRest_get_LastErrorText');
  Chilkat_GetProcedureAddress(CkRest_get_LastErrorXml, 'CkRest_get_LastErrorXml');
  Chilkat_GetProcedureAddress(CkRest_get_Version, 'CkRest_get_Version');
  Chilkat_GetProcedureAddress(CkRest_get_DebugLogFilePath, 'CkRest_get_DebugLogFilePath');
  Chilkat_GetProcedureAddress(CkRest_put_DebugLogFilePath, 'CkRest_put_DebugLogFilePath');
  Chilkat_GetProcedureAddress(CkRest_get_VerboseLogging, 'CkRest_get_VerboseLogging');
  Chilkat_GetProcedureAddress(CkRest_put_VerboseLogging, 'CkRest_put_VerboseLogging');
  Chilkat_GetProcedureAddress(CkRest_get_LastMethodSuccess, 'CkRest_get_LastMethodSuccess');
  Chilkat_GetProcedureAddress(CkRest_put_LastMethodSuccess, 'CkRest_put_LastMethodSuccess');
  Chilkat_GetProcedureAddress(CkRest_get_Authorization, 'CkRest_get_Authorization');
  Chilkat_GetProcedureAddress(CkRest_put_Authorization, 'CkRest_put_Authorization');
  Chilkat_GetProcedureAddress(CkRest_get_HeartbeatMs, 'CkRest_get_HeartbeatMs');
  Chilkat_GetProcedureAddress(CkRest_put_HeartbeatMs, 'CkRest_put_HeartbeatMs');
  Chilkat_GetProcedureAddress(CkRest_get_Host, 'CkRest_get_Host');
  Chilkat_GetProcedureAddress(CkRest_put_Host, 'CkRest_put_Host');
  Chilkat_GetProcedureAddress(CkRest_get_IdleTimeoutMs, 'CkRest_get_IdleTimeoutMs');
  Chilkat_GetProcedureAddress(CkRest_put_IdleTimeoutMs, 'CkRest_put_IdleTimeoutMs');
  Chilkat_GetProcedureAddress(CkRest_get_LastRequestHeader, 'CkRest_get_LastRequestHeader');
  Chilkat_GetProcedureAddress(CkRest_get_LastRequestStartLine, 'CkRest_get_LastRequestStartLine');
  Chilkat_GetProcedureAddress(CkRest_get_NumResponseHeaders, 'CkRest_get_NumResponseHeaders');
  Chilkat_GetProcedureAddress(CkRest_get_PartSelector, 'CkRest_get_PartSelector');
  Chilkat_GetProcedureAddress(CkRest_put_PartSelector, 'CkRest_put_PartSelector');
  Chilkat_GetProcedureAddress(CkRest_get_ResponseHeader, 'CkRest_get_ResponseHeader');
  Chilkat_GetProcedureAddress(CkRest_get_ResponseStatusCode, 'CkRest_get_ResponseStatusCode');
  Chilkat_GetProcedureAddress(CkRest_get_ResponseStatusText, 'CkRest_get_ResponseStatusText');
  Chilkat_GetProcedureAddress(CkRest_get_StreamNonChunked, 'CkRest_get_StreamNonChunked');
  Chilkat_GetProcedureAddress(CkRest_put_StreamNonChunked, 'CkRest_put_StreamNonChunked');
  Chilkat_GetProcedureAddress(CkRest_get_ConnectFailReason, 'CkRest_get_ConnectFailReason');
  Chilkat_GetProcedureAddress(CkRest_get_PercentDoneOnSend, 'CkRest_get_PercentDoneOnSend');
  Chilkat_GetProcedureAddress(CkRest_put_PercentDoneOnSend, 'CkRest_put_PercentDoneOnSend');
  Chilkat_GetProcedureAddress(CkRest_get_AllowHeaderQB, 'CkRest_get_AllowHeaderQB');
  Chilkat_GetProcedureAddress(CkRest_put_AllowHeaderQB, 'CkRest_put_AllowHeaderQB');
  Chilkat_GetProcedureAddress(CkRest_get_AllowHeaderFolding, 'CkRest_get_AllowHeaderFolding');
  Chilkat_GetProcedureAddress(CkRest_put_AllowHeaderFolding, 'CkRest_put_AllowHeaderFolding');
  Chilkat_GetProcedureAddress(CkRest_get_ConnectTimeoutMs, 'CkRest_get_ConnectTimeoutMs');
  Chilkat_GetProcedureAddress(CkRest_put_ConnectTimeoutMs, 'CkRest_put_ConnectTimeoutMs');
  Chilkat_GetProcedureAddress(CkRest_get_DebugMode, 'CkRest_get_DebugMode');
  Chilkat_GetProcedureAddress(CkRest_put_DebugMode, 'CkRest_put_DebugMode');
  Chilkat_GetProcedureAddress(CkRest_get_UncommonOptions, 'CkRest_get_UncommonOptions');
  Chilkat_GetProcedureAddress(CkRest_put_UncommonOptions, 'CkRest_put_UncommonOptions');
  Chilkat_GetProcedureAddress(CkRest_get_LastRedirectUrl, 'CkRest_get_LastRedirectUrl');
  Chilkat_GetProcedureAddress(CkRest_get_EnableSecrets, 'CkRest_get_EnableSecrets');
  Chilkat_GetProcedureAddress(CkRest_put_EnableSecrets, 'CkRest_put_EnableSecrets');
  Chilkat_GetProcedureAddress(CkRest_AddHeader, 'CkRest_AddHeader');
  Chilkat_GetProcedureAddress(CkRest_AddQueryParam, 'CkRest_AddQueryParam');
  Chilkat_GetProcedureAddress(CkRest_AddQueryParams, 'CkRest_AddQueryParams');
  Chilkat_GetProcedureAddress(CkRest_ClearAllHeaders, 'CkRest_ClearAllHeaders');
  Chilkat_GetProcedureAddress(CkRest_ClearAllQueryParams, 'CkRest_ClearAllQueryParams');
  Chilkat_GetProcedureAddress(CkRest_ClearResponseBodyStream, 'CkRest_ClearResponseBodyStream');
  Chilkat_GetProcedureAddress(CkRest_Connect, 'CkRest_Connect');
  Chilkat_GetProcedureAddress(CkRest_Disconnect, 'CkRest_Disconnect');
  Chilkat_GetProcedureAddress(CkRest_FullRequestFormUrlEncoded, 'CkRest_FullRequestFormUrlEncoded');
  Chilkat_GetProcedureAddress(CkRest_FullRequestMultipart, 'CkRest_FullRequestMultipart');
  Chilkat_GetProcedureAddress(CkRest_FullRequestNoBody, 'CkRest_FullRequestNoBody');
  Chilkat_GetProcedureAddress(CkRest_FullRequestStream, 'CkRest_FullRequestStream');
  Chilkat_GetProcedureAddress(CkRest_FullRequestString, 'CkRest_FullRequestString');
  Chilkat_GetProcedureAddress(CkRest_ReadRespBodyStream, 'CkRest_ReadRespBodyStream');
  Chilkat_GetProcedureAddress(CkRest_ReadRespBodyString, 'CkRest_ReadRespBodyString');
  Chilkat_GetProcedureAddress(CkRest_ReadResponseHeader, 'CkRest_ReadResponseHeader');
  Chilkat_GetProcedureAddress(CkRest_RemoveHeader, 'CkRest_RemoveHeader');
  Chilkat_GetProcedureAddress(CkRest_RemoveQueryParam, 'CkRest_RemoveQueryParam');
  Chilkat_GetProcedureAddress(CkRest_ResponseHdrByName, 'CkRest_ResponseHdrByName');
  Chilkat_GetProcedureAddress(CkRest_ResponseHdrName, 'CkRest_ResponseHdrName');
  Chilkat_GetProcedureAddress(CkRest_ResponseHdrValue, 'CkRest_ResponseHdrValue');
  Chilkat_GetProcedureAddress(CkRest_SendReqFormUrlEncoded, 'CkRest_SendReqFormUrlEncoded');
  Chilkat_GetProcedureAddress(CkRest_SendReqMultipart, 'CkRest_SendReqMultipart');
  Chilkat_GetProcedureAddress(CkRest_SendReqNoBody, 'CkRest_SendReqNoBody');
  Chilkat_GetProcedureAddress(CkRest_SendReqStreamBody, 'CkRest_SendReqStreamBody');
  Chilkat_GetProcedureAddress(CkRest_SendReqStringBody, 'CkRest_SendReqStringBody');
  Chilkat_GetProcedureAddress(CkRest_SetAuthAws, 'CkRest_SetAuthAws');
  Chilkat_GetProcedureAddress(CkRest_SetAuthAzureStorage, 'CkRest_SetAuthAzureStorage');
  Chilkat_GetProcedureAddress(CkRest_SetAuthBasic, 'CkRest_SetAuthBasic');
  Chilkat_GetProcedureAddress(CkRest_SetAuthGoogle, 'CkRest_SetAuthGoogle');
  Chilkat_GetProcedureAddress(CkRest_SetAuthOAuth1, 'CkRest_SetAuthOAuth1');
  Chilkat_GetProcedureAddress(CkRest_SetAuthOAuth2, 'CkRest_SetAuthOAuth2');
  Chilkat_GetProcedureAddress(CkRest_SetMultipartBodyStream, 'CkRest_SetMultipartBodyStream');
  Chilkat_GetProcedureAddress(CkRest_SetMultipartBodyString, 'CkRest_SetMultipartBodyString');
  Chilkat_GetProcedureAddress(CkRest_SetResponseBodyStream, 'CkRest_SetResponseBodyStream');
  Chilkat_GetProcedureAddress(CkRest_UseConnection, 'CkRest_UseConnection');
  Chilkat_GetProcedureAddress(CkRest_FullRequestSb, 'CkRest_FullRequestSb');
  Chilkat_GetProcedureAddress(CkRest_AddQueryParamSb, 'CkRest_AddQueryParamSb');
  Chilkat_GetProcedureAddress(CkRest_SetMultipartBodySb, 'CkRest_SetMultipartBodySb');
  Chilkat_GetProcedureAddress(CkRest_SetMultipartBodyBd, 'CkRest_SetMultipartBodyBd');
  Chilkat_GetProcedureAddress(CkRest_SendReqSb, 'CkRest_SendReqSb');
  Chilkat_GetProcedureAddress(CkRest_SendReqBd, 'CkRest_SendReqBd');
  Chilkat_GetProcedureAddress(CkRest_ReadRespSb, 'CkRest_ReadRespSb');
  Chilkat_GetProcedureAddress(CkRest_ReadRespBd, 'CkRest_ReadRespBd');
  Chilkat_GetProcedureAddress(CkRest_ClearAllParts, 'CkRest_ClearAllParts');
  Chilkat_GetProcedureAddress(CkRest_FullRequestNoBodySb, 'CkRest_FullRequestNoBodySb');
  Chilkat_GetProcedureAddress(CkRest_FullRequestBd, 'CkRest_FullRequestBd');
  Chilkat_GetProcedureAddress(CkRest_FullRequestNoBodyBd, 'CkRest_FullRequestNoBodyBd');
  Chilkat_GetProcedureAddress(CkRest_SetAuthAzureSas, 'CkRest_SetAuthAzureSas');
  Chilkat_GetProcedureAddress(CkRest_AddMwsSignature, 'CkRest_AddMwsSignature');
  Chilkat_GetProcedureAddress(CkRest_ClearAuth, 'CkRest_ClearAuth');
  Chilkat_GetProcedureAddress(CkRest_AddPathParam, 'CkRest_AddPathParam');
  Chilkat_GetProcedureAddress(CkRest_ClearAllPathParams, 'CkRest_ClearAllPathParams');
  Chilkat_GetProcedureAddress(CkRest_SetAuthBasicSecure, 'CkRest_SetAuthBasicSecure');
  Chilkat_GetProcedureAddress(CkRest_GetLastDebugRequest, 'CkRest_GetLastDebugRequest');
  Chilkat_GetProcedureAddress(CkRest_ReadRespChunkBd, 'CkRest_ReadRespChunkBd');
  Chilkat_GetProcedureAddress(CkRest_GetLastJsonData, 'CkRest_GetLastJsonData');

end.
