unit Chilkat.AuthAzureSAS;

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

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

interface

uses
  SysUtils,
  Chilkat.Base;

type

  { TAuthAzureSAS wraps CkAuthAzureSAS via the C bridge layer. }
  TAuthAzureSAS = 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  GetStringToSign: string;
    procedure SetStringToSign(AValue: string);
    function  GetAccessKey: string;
    procedure SetAccessKey(AValue: string);
  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 StringToSign: string read GetStringToSign write SetStringToSign;
    property AccessKey: string read GetAccessKey write SetAccessKey;

    function  SetTokenParam(const name: string; const authParamName: string; const value: string): Boolean;
    function  SetNonTokenParam(const name: string; const value: string): Boolean;
    function  GenerateToken: string;
    procedure Clear;
  end;

implementation

uses
  CkDllLoader,
  Chilkat.Utils;

{ ---- C bridge function pointer types ---- }
type
  TCkAuthAzureSAS_Create  = function(): Pointer; cdecl;
  TCkAuthAzureSAS_Dispose = procedure(handle: Pointer); cdecl;
  TCkAuthAzureSAS_get_LastErrorHtml = function(handle: Pointer): PAnsiChar; cdecl;
  TCkAuthAzureSAS_get_LastErrorText = function(handle: Pointer): PAnsiChar; cdecl;
  TCkAuthAzureSAS_get_LastErrorXml = function(handle: Pointer): PAnsiChar; cdecl;
  TCkAuthAzureSAS_get_Version = function(handle: Pointer): PAnsiChar; cdecl;
  TCkAuthAzureSAS_get_DebugLogFilePath = function(handle: Pointer): PAnsiChar; cdecl;
  TCkAuthAzureSAS_put_DebugLogFilePath = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkAuthAzureSAS_get_VerboseLogging = function(handle: Pointer): LongBool; cdecl;
  TCkAuthAzureSAS_put_VerboseLogging = procedure(handle: Pointer; value: LongBool); cdecl;
  TCkAuthAzureSAS_get_LastMethodSuccess = function(handle: Pointer): LongBool; cdecl;
  TCkAuthAzureSAS_put_LastMethodSuccess = procedure(handle: Pointer; value: LongBool); cdecl;
  TCkAuthAzureSAS_get_StringToSign = function(handle: Pointer): PAnsiChar; cdecl;
  TCkAuthAzureSAS_put_StringToSign = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkAuthAzureSAS_get_AccessKey = function(handle: Pointer): PAnsiChar; cdecl;
  TCkAuthAzureSAS_put_AccessKey = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkAuthAzureSAS_SetTokenParam = function(handle: Pointer; name: PAnsiChar; authParamName: PAnsiChar; value: PAnsiChar): LongBool; cdecl;
  TCkAuthAzureSAS_SetNonTokenParam = function(handle: Pointer; name: PAnsiChar; value: PAnsiChar): LongBool; cdecl;
  TCkAuthAzureSAS_GenerateToken = function(handle: Pointer): PAnsiChar; cdecl;
  TCkAuthAzureSAS_Clear = procedure(handle: Pointer); cdecl;

{ ---- C bridge function pointer variables ---- }
var
  CkAuthAzureSAS_Create:  TCkAuthAzureSAS_Create  = nil;
  CkAuthAzureSAS_Dispose: TCkAuthAzureSAS_Dispose = nil;
  CkAuthAzureSAS_get_LastErrorHtml: TCkAuthAzureSAS_get_LastErrorHtml = nil;
  CkAuthAzureSAS_get_LastErrorText: TCkAuthAzureSAS_get_LastErrorText = nil;
  CkAuthAzureSAS_get_LastErrorXml: TCkAuthAzureSAS_get_LastErrorXml = nil;
  CkAuthAzureSAS_get_Version: TCkAuthAzureSAS_get_Version = nil;
  CkAuthAzureSAS_get_DebugLogFilePath: TCkAuthAzureSAS_get_DebugLogFilePath = nil;
  CkAuthAzureSAS_put_DebugLogFilePath: TCkAuthAzureSAS_put_DebugLogFilePath = nil;
  CkAuthAzureSAS_get_VerboseLogging: TCkAuthAzureSAS_get_VerboseLogging = nil;
  CkAuthAzureSAS_put_VerboseLogging: TCkAuthAzureSAS_put_VerboseLogging = nil;
  CkAuthAzureSAS_get_LastMethodSuccess: TCkAuthAzureSAS_get_LastMethodSuccess = nil;
  CkAuthAzureSAS_put_LastMethodSuccess: TCkAuthAzureSAS_put_LastMethodSuccess = nil;
  CkAuthAzureSAS_get_StringToSign: TCkAuthAzureSAS_get_StringToSign = nil;
  CkAuthAzureSAS_put_StringToSign: TCkAuthAzureSAS_put_StringToSign = nil;
  CkAuthAzureSAS_get_AccessKey: TCkAuthAzureSAS_get_AccessKey = nil;
  CkAuthAzureSAS_put_AccessKey: TCkAuthAzureSAS_put_AccessKey = nil;
  CkAuthAzureSAS_SetTokenParam: TCkAuthAzureSAS_SetTokenParam = nil;
  CkAuthAzureSAS_SetNonTokenParam: TCkAuthAzureSAS_SetNonTokenParam = nil;
  CkAuthAzureSAS_GenerateToken: TCkAuthAzureSAS_GenerateToken = nil;
  CkAuthAzureSAS_Clear: TCkAuthAzureSAS_Clear = nil;

constructor TAuthAzureSAS.Create;
begin
  inherited Create;
  FHandle := CkAuthAzureSAS_Create();
end;

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

function TAuthAzureSAS.GetLastErrorHtml: string;
begin
  Result := CkToStr(CkAuthAzureSAS_get_LastErrorHtml(FHandle));
end;

function TAuthAzureSAS.GetLastErrorText: string;
begin
  Result := CkToStr(CkAuthAzureSAS_get_LastErrorText(FHandle));
end;

function TAuthAzureSAS.GetLastErrorXml: string;
begin
  Result := CkToStr(CkAuthAzureSAS_get_LastErrorXml(FHandle));
end;

function TAuthAzureSAS.GetVersion: string;
begin
  Result := CkToStr(CkAuthAzureSAS_get_Version(FHandle));
end;

function TAuthAzureSAS.GetDebugLogFilePath: string;
begin
  Result := CkToStr(CkAuthAzureSAS_get_DebugLogFilePath(FHandle));
end;

procedure TAuthAzureSAS.SetDebugLogFilePath(AValue: string);
begin
  CkAuthAzureSAS_put_DebugLogFilePath(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function TAuthAzureSAS.GetVerboseLogging: Boolean;
begin
  Result := Boolean(CkAuthAzureSAS_get_VerboseLogging(FHandle));
end;

procedure TAuthAzureSAS.SetVerboseLogging(AValue: Boolean);
begin
  CkAuthAzureSAS_put_VerboseLogging(FHandle, LongBool(AValue));
end;

function TAuthAzureSAS.GetLastMethodSuccess: Boolean;
begin
  Result := Boolean(CkAuthAzureSAS_get_LastMethodSuccess(FHandle));
end;

procedure TAuthAzureSAS.SetLastMethodSuccess(AValue: Boolean);
begin
  CkAuthAzureSAS_put_LastMethodSuccess(FHandle, LongBool(AValue));
end;

function TAuthAzureSAS.GetStringToSign: string;
begin
  Result := CkToStr(CkAuthAzureSAS_get_StringToSign(FHandle));
end;

procedure TAuthAzureSAS.SetStringToSign(AValue: string);
begin
  CkAuthAzureSAS_put_StringToSign(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function TAuthAzureSAS.GetAccessKey: string;
begin
  Result := CkToStr(CkAuthAzureSAS_get_AccessKey(FHandle));
end;

procedure TAuthAzureSAS.SetAccessKey(AValue: string);
begin
  CkAuthAzureSAS_put_AccessKey(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function TAuthAzureSAS.SetTokenParam(const name: string; const authParamName: string; const value: string): Boolean;
begin
  Result := Boolean(CkAuthAzureSAS_SetTokenParam(FHandle, PAnsiChar(StrToCk(name)), PAnsiChar(StrToCk(authParamName)), PAnsiChar(StrToCk(value))));
end;

function TAuthAzureSAS.SetNonTokenParam(const name: string; const value: string): Boolean;
begin
  Result := Boolean(CkAuthAzureSAS_SetNonTokenParam(FHandle, PAnsiChar(StrToCk(name)), PAnsiChar(StrToCk(value))));
end;

function TAuthAzureSAS.GenerateToken: string;
begin
  Result := CkToStr(CkAuthAzureSAS_GenerateToken(FHandle));
end;

procedure TAuthAzureSAS.Clear;
begin
  CkAuthAzureSAS_Clear(FHandle);
end;

initialization
  Chilkat_GetProcedureAddress(CkAuthAzureSAS_Create,  'CkAuthAzureSAS_Create');
  Chilkat_GetProcedureAddress(CkAuthAzureSAS_Dispose, 'CkAuthAzureSAS_Dispose');
  Chilkat_GetProcedureAddress(CkAuthAzureSAS_get_LastErrorHtml, 'CkAuthAzureSAS_get_LastErrorHtml');
  Chilkat_GetProcedureAddress(CkAuthAzureSAS_get_LastErrorText, 'CkAuthAzureSAS_get_LastErrorText');
  Chilkat_GetProcedureAddress(CkAuthAzureSAS_get_LastErrorXml, 'CkAuthAzureSAS_get_LastErrorXml');
  Chilkat_GetProcedureAddress(CkAuthAzureSAS_get_Version, 'CkAuthAzureSAS_get_Version');
  Chilkat_GetProcedureAddress(CkAuthAzureSAS_get_DebugLogFilePath, 'CkAuthAzureSAS_get_DebugLogFilePath');
  Chilkat_GetProcedureAddress(CkAuthAzureSAS_put_DebugLogFilePath, 'CkAuthAzureSAS_put_DebugLogFilePath');
  Chilkat_GetProcedureAddress(CkAuthAzureSAS_get_VerboseLogging, 'CkAuthAzureSAS_get_VerboseLogging');
  Chilkat_GetProcedureAddress(CkAuthAzureSAS_put_VerboseLogging, 'CkAuthAzureSAS_put_VerboseLogging');
  Chilkat_GetProcedureAddress(CkAuthAzureSAS_get_LastMethodSuccess, 'CkAuthAzureSAS_get_LastMethodSuccess');
  Chilkat_GetProcedureAddress(CkAuthAzureSAS_put_LastMethodSuccess, 'CkAuthAzureSAS_put_LastMethodSuccess');
  Chilkat_GetProcedureAddress(CkAuthAzureSAS_get_StringToSign, 'CkAuthAzureSAS_get_StringToSign');
  Chilkat_GetProcedureAddress(CkAuthAzureSAS_put_StringToSign, 'CkAuthAzureSAS_put_StringToSign');
  Chilkat_GetProcedureAddress(CkAuthAzureSAS_get_AccessKey, 'CkAuthAzureSAS_get_AccessKey');
  Chilkat_GetProcedureAddress(CkAuthAzureSAS_put_AccessKey, 'CkAuthAzureSAS_put_AccessKey');
  Chilkat_GetProcedureAddress(CkAuthAzureSAS_SetTokenParam, 'CkAuthAzureSAS_SetTokenParam');
  Chilkat_GetProcedureAddress(CkAuthAzureSAS_SetNonTokenParam, 'CkAuthAzureSAS_SetNonTokenParam');
  Chilkat_GetProcedureAddress(CkAuthAzureSAS_GenerateToken, 'CkAuthAzureSAS_GenerateToken');
  Chilkat_GetProcedureAddress(CkAuthAzureSAS_Clear, 'CkAuthAzureSAS_Clear');

end.
