Changeset 6 for trunk/UFioAPI.pas
- Timestamp:
- Mar 14, 2013, 9:24:41 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UFioAPI.pas
r5 r6 1 1 unit UFioAPI; 2 2 3 {$mode objfpc}{$H+}3 {$mode delphi}{$H+} 4 4 5 5 interface … … 10 10 type 11 11 12 TFioDataFormat = (dfXML, dfCVS, dfGPC, dfOFX, dfJSON, dfHTML, dfSTA); 13 12 14 { TFioAPI } 13 15 … … 17 19 public 18 20 Token: string; 19 Format: string;21 Format: TFioDataFormat; 20 22 function DownloadInterval(TimeFrom, TimeTo: TDateTime; Data: TStrings): Boolean; 21 23 function DownloadMonthly(Year, Id: Integer; Data: TStrings): Boolean; 22 24 function DownloadLast(Data: TStrings): Boolean; 23 25 end; 26 27 const 28 DataFormatText: array[TFioDataFormat] of string = ('XML', 'CVS', 'GPC', 'OFX', 29 'JSON', 'HTML', 'STA'); 30 DataFormatURL: array[TFioDataFormat] of string = ('xml', 'cvs', 'gpc', 'ofx', 31 'json', 'html', 'sta'); 24 32 25 33 implementation … … 33 41 HTTPSender := THTTPSend.Create; 34 42 try 35 Format := 'xml';36 Token := 'dd';37 43 HTTPSender.HTTPMethod('GET', URL); 38 44 try … … 63 69 '/' + FormatDateTime('yyyy-mm-dd', TimeFrom) + 64 70 '/' + FormatDateTime('yyyy-mm-dd', TimeTo) + 65 '/transactions.' + Format, Data);71 '/transactions.' + DataFormatURL[Format], Data); 66 72 end; 67 73 … … 70 76 Result := Download('https://www.fio.cz/ib_api/rest/by-id/' + Token + 71 77 '/' + IntToStr(Year) + '/' + IntToStr(Id) + 72 '/transactions.' + Format, Data);78 '/transactions.' + DataFormatURL[Format], Data); 73 79 end; 74 80 … … 76 82 begin 77 83 Result := Download('https://www.fio.cz/ib_api/rest/last/' + Token + 78 '/transactions.' + Format, Data);84 '/transactions.' + DataFormatURL[Format], Data); 79 85 end; 80 86
Note:
See TracChangeset
for help on using the changeset viewer.