Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(Delphi DLL) Trello List Member BoardsLists the boards that the user is a member of. For more information, see https://developers.trello.com/reference#membersidboards
uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, JsonArray, OAuth1, Rest, JsonObject; ... procedure TForm1.Button1Click(Sender: TObject); var jsonToken: HCkJsonObject; success: Boolean; oauth1: HCkOAuth1; rest: HCkRest; bAutoReconnect: Boolean; responseBody: PWideChar; jarr: HCkJsonArray; i: Integer; count_i: Integer; json: HCkJsonObject; name: PWideChar; desc: PWideChar; descData: PWideChar; closed: Boolean; idOrganization: PWideChar; limits: PWideChar; pinned: PWideChar; shortLink: PWideChar; dateLastActivity: PWideChar; datePluginDisable: PWideChar; creationMethod: PWideChar; ixUpdate: PWideChar; id: PWideChar; starred: Boolean; url: PWideChar; prefsPermissionLevel: PWideChar; prefsVoting: PWideChar; prefsComments: PWideChar; prefsInvitations: PWideChar; prefsSelfJoin: Boolean; prefsCardCovers: Boolean; prefsCardAging: PWideChar; prefsCalendarFeedEnabled: Boolean; prefsBackground: PWideChar; prefsBackgroundImage: PWideChar; prefsBackgroundTile: Boolean; prefsBackgroundBrightness: PWideChar; prefsBackgroundBottomColor: PWideChar; prefsBackgroundTopColor: PWideChar; prefsCanBePublic: Boolean; prefsCanBeEnterprise: Boolean; prefsCanBeOrg: Boolean; prefsCanBePrivate: Boolean; prefsCanInvite: Boolean; subscribed: Boolean; labelNamesGreen: PWideChar; labelNamesYellow: PWideChar; labelNamesOrange: PWideChar; labelNamesRed: PWideChar; labelNamesPurple: PWideChar; labelNamesBlue: PWideChar; labelNamesSky: PWideChar; labelNamesLime: PWideChar; labelNamesPink: PWideChar; labelNamesBlack: PWideChar; dateLastView: PWideChar; shortUrl: PWideChar; prefsBackgroundImageScaled: PWideChar; prefsBackgroundColor: PWideChar; j: Integer; count_j: Integer; width: Integer; height: Integer; idMember: PWideChar; memberType: PWideChar; unconfirmed: Boolean; deactivated: Boolean; begin // This example assumes the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. // curl --request GET \ // --url 'https://api.trello.com/1/members/{member_id}/boards?filter=all&fields=all&lists=none&memberships=none&organization=false&organization_fields=displayName' // First get our previously obtained access token. jsonToken := CkJsonObject_Create(); success := CkJsonObject_LoadFile(jsonToken,'qa_data/tokens/trello.json'); oauth1 := CkOAuth1_Create(); CkOAuth1_putConsumerKey(oauth1,'TRELLO_CONSUMER_KEY'); CkOAuth1_putConsumerSecret(oauth1,'TRELLO_CONSUMER_SECRET'); CkOAuth1_putToken(oauth1,CkJsonObject__stringOf(jsonToken,'oauth_token')); CkOAuth1_putTokenSecret(oauth1,CkJsonObject__stringOf(jsonToken,'oauth_token_secret')); rest := CkRest_Create(); // Connect using TLS. // A single REST object, once connected, can be used for many Trello REST API calls. // The auto-reconnect indicates that if the already-established HTTPS connection is closed, // then it will be automatically re-established as needed. bAutoReconnect := True; success := CkRest_Connect(rest,'api.trello.com',443,True,bAutoReconnect); if (success <> True) then begin Memo1.Lines.Add(CkRest__lastErrorText(rest)); Exit; end; CkRest_SetAuthOAuth1(rest,oauth1,False); CkRest_AddQueryParam(rest,'filter','all'); CkRest_AddQueryParam(rest,'fields','all'); CkRest_AddQueryParam(rest,'lists','none'); CkRest_AddQueryParam(rest,'memberships','normal'); CkRest_AddQueryParam(rest,'organization','false'); CkRest_AddQueryParam(rest,'organization_fields','name,displayName'); CkRest_AddHeader(rest,'Accept','application/json'); responseBody := CkRest__fullRequestNoBody(rest,'GET','/1/members/member_id/boards'); if (CkRest_getLastMethodSuccess(rest) <> True) then begin Memo1.Lines.Add(CkRest__lastErrorText(rest)); Exit; end; // We should expect a 200 response if successful. if (CkRest_getResponseStatusCode(rest) <> 200) then begin Memo1.Lines.Add('Request Header: '); Memo1.Lines.Add(CkRest__lastRequestHeader(rest)); Memo1.Lines.Add('----'); Memo1.Lines.Add('Response StatusCode = ' + IntToStr(CkRest_getResponseStatusCode(rest))); Memo1.Lines.Add('Response StatusLine: ' + CkRest__responseStatusText(rest)); Memo1.Lines.Add('Response Header:'); Memo1.Lines.Add(CkRest__responseHeader(rest)); Memo1.Lines.Add(responseBody); Exit; end; jarr := CkJsonArray_Create(); CkJsonArray_Load(jarr,responseBody); CkJsonArray_putEmitCompact(jarr,False); Memo1.Lines.Add(CkJsonArray__emit(jarr)); Memo1.Lines.Add('Success.'); // A sample JSON response: // (See the parsing code below...) // Use this online tool to generate parsing code from sample JSON: // Generate Parsing Code from JSON // [ // { // "name": "House Projects", // "desc": "", // "descData": null, // "closed": false, // "idOrganization": null, // "limits": null, // "pinned": null, // "shortLink": "j1hkQKKS", // "powerUps": [ // ], // "dateLastActivity": null, // "idTags": [ // ], // "datePluginDisable": null, // "creationMethod": null, // "ixUpdate": null, // "id": "5cc5fe862106bb8e05aa41e7", // "starred": false, // "url": "https://trello.com/b/j1hkQKKS/house-projects", // "prefs": { // "permissionLevel": "private", // "voting": "disabled", // "comments": "members", // "invitations": "members", // "selfJoin": false, // "cardCovers": true, // "cardAging": "regular", // "calendarFeedEnabled": false, // "background": "5cc344f6ba4cdc5f5cfc7d81", // "backgroundImage": "https://trello-backgrounds.s3.amazonaws.com/SharedBackground/2560x1709/4418c78f2f66d26932fef88aead2aff5/photo-1555985202-12975b0235dc", // "backgroundImageScaled": [ // { // "width": 140, // "height": 93, // "url": "https://trello-backgrounds.s3.amazonaws.com/SharedBackground/140x93/0aebced0ac2d8c9c4b9231b1960d28c2/photo-1555985202-12975b0235dc.jpg" // }, // ... // { // "width": 2560, // "height": 1709, // "url": "https://trello-backgrounds.s3.amazonaws.com/SharedBackground/2560x1709/4418c78f2f66d26932fef88aead2aff5/photo-1555985202-12975b0235dc" // } // ], // "backgroundTile": false, // "backgroundBrightness": "dark", // "backgroundBottomColor": "#412f23", // "backgroundTopColor": "#a99d97", // "canBePublic": true, // "canBeEnterprise": true, // "canBeOrg": true, // "canBePrivate": true, // "canInvite": true // }, // "subscribed": false, // "labelNames": { // "green": "", // "yellow": "", // "orange": "", // "red": "", // "purple": "", // "blue": "", // "sky": "", // "lime": "", // "pink": "", // "black": "" // }, // "dateLastView": "2019-04-28T19:28:18.159Z", // "shortUrl": "https://trello.com/b/j1hkQKKS", // "memberships": [ // { // "id": "5cc5fe862106bb8e05aa41e8", // "idMember": "5cc5c74067d5215921ca7677", // "memberType": "admin", // "unconfirmed": false, // "deactivated": false // } // ] // }, // { // "name": "Vacation Planning", // "desc": "", // "descData": null, // "closed": false, // "idOrganization": null, // "limits": null, // "pinned": null, // "shortLink": "QqIHvQyz", // "powerUps": [ // ], // "dateLastActivity": "2019-04-28T15:32:20.134Z", // "idTags": [ // ], // "datePluginDisable": null, // "creationMethod": "assisted", // "ixUpdate": null, // "id": "5cc5c783f5b10f8717a6b3d6", // "starred": false, // "url": "https://trello.com/b/QqIHvQyz/vacation-planning", // "prefs": { // "permissionLevel": "private", // "voting": "disabled", // "comments": "members", // "invitations": "members", // "selfJoin": true, // "cardCovers": true, // "cardAging": "regular", // "calendarFeedEnabled": false, // "background": "lime", // "backgroundImage": null, // "backgroundImageScaled": null, // "backgroundTile": false, // "backgroundBrightness": "dark", // "backgroundColor": "#4BBF6B", // "backgroundBottomColor": "#4BBF6B", // "backgroundTopColor": "#4BBF6B", // "canBePublic": true, // "canBeEnterprise": true, // "canBeOrg": true, // "canBePrivate": true, // "canInvite": true // }, // "subscribed": false, // "labelNames": { // "green": "", // "yellow": "", // "orange": "", // "red": "", // "purple": "", // "blue": "", // "sky": "", // "lime": "", // "pink": "", // "black": "" // }, // "dateLastView": "2019-04-28T19:32:21.009Z", // "shortUrl": "https://trello.com/b/QqIHvQyz", // "memberships": [ // { // "id": "5cc5c783f5b10f8717a6b3d7", // "idMember": "5cc5c74067d5215921ca7677", // "memberType": "admin", // "unconfirmed": false, // "deactivated": false // } // ] // } // ] i := 0; count_i := CkJsonArray_getSize(jarr); while i < count_i do begin json := CkJsonArray_ObjectAt(jarr,i); name := CkJsonObject__stringOf(json,'name'); desc := CkJsonObject__stringOf(json,'desc'); descData := CkJsonObject__stringOf(json,'descData'); closed := CkJsonObject_BoolOf(json,'closed'); idOrganization := CkJsonObject__stringOf(json,'idOrganization'); limits := CkJsonObject__stringOf(json,'limits'); pinned := CkJsonObject__stringOf(json,'pinned'); shortLink := CkJsonObject__stringOf(json,'shortLink'); dateLastActivity := CkJsonObject__stringOf(json,'dateLastActivity'); datePluginDisable := CkJsonObject__stringOf(json,'datePluginDisable'); creationMethod := CkJsonObject__stringOf(json,'creationMethod'); ixUpdate := CkJsonObject__stringOf(json,'ixUpdate'); id := CkJsonObject__stringOf(json,'id'); starred := CkJsonObject_BoolOf(json,'starred'); url := CkJsonObject__stringOf(json,'url'); prefsPermissionLevel := CkJsonObject__stringOf(json,'prefs.permissionLevel'); prefsVoting := CkJsonObject__stringOf(json,'prefs.voting'); prefsComments := CkJsonObject__stringOf(json,'prefs.comments'); prefsInvitations := CkJsonObject__stringOf(json,'prefs.invitations'); prefsSelfJoin := CkJsonObject_BoolOf(json,'prefs.selfJoin'); prefsCardCovers := CkJsonObject_BoolOf(json,'prefs.cardCovers'); prefsCardAging := CkJsonObject__stringOf(json,'prefs.cardAging'); prefsCalendarFeedEnabled := CkJsonObject_BoolOf(json,'prefs.calendarFeedEnabled'); prefsBackground := CkJsonObject__stringOf(json,'prefs.background'); prefsBackgroundImage := CkJsonObject__stringOf(json,'prefs.backgroundImage'); prefsBackgroundTile := CkJsonObject_BoolOf(json,'prefs.backgroundTile'); prefsBackgroundBrightness := CkJsonObject__stringOf(json,'prefs.backgroundBrightness'); prefsBackgroundBottomColor := CkJsonObject__stringOf(json,'prefs.backgroundBottomColor'); prefsBackgroundTopColor := CkJsonObject__stringOf(json,'prefs.backgroundTopColor'); prefsCanBePublic := CkJsonObject_BoolOf(json,'prefs.canBePublic'); prefsCanBeEnterprise := CkJsonObject_BoolOf(json,'prefs.canBeEnterprise'); prefsCanBeOrg := CkJsonObject_BoolOf(json,'prefs.canBeOrg'); prefsCanBePrivate := CkJsonObject_BoolOf(json,'prefs.canBePrivate'); prefsCanInvite := CkJsonObject_BoolOf(json,'prefs.canInvite'); subscribed := CkJsonObject_BoolOf(json,'subscribed'); labelNamesGreen := CkJsonObject__stringOf(json,'labelNames.green'); labelNamesYellow := CkJsonObject__stringOf(json,'labelNames.yellow'); labelNamesOrange := CkJsonObject__stringOf(json,'labelNames.orange'); labelNamesRed := CkJsonObject__stringOf(json,'labelNames.red'); labelNamesPurple := CkJsonObject__stringOf(json,'labelNames.purple'); labelNamesBlue := CkJsonObject__stringOf(json,'labelNames.blue'); labelNamesSky := CkJsonObject__stringOf(json,'labelNames.sky'); labelNamesLime := CkJsonObject__stringOf(json,'labelNames.lime'); labelNamesPink := CkJsonObject__stringOf(json,'labelNames.pink'); labelNamesBlack := CkJsonObject__stringOf(json,'labelNames.black'); dateLastView := CkJsonObject__stringOf(json,'dateLastView'); shortUrl := CkJsonObject__stringOf(json,'shortUrl'); prefsBackgroundImageScaled := CkJsonObject__stringOf(json,'prefs.backgroundImageScaled'); prefsBackgroundColor := CkJsonObject__stringOf(json,'prefs.backgroundColor'); j := 0; count_j := CkJsonObject_SizeOfArray(json,'powerUps'); while j < count_j do begin CkJsonObject_putJ(json,j); // ... j := j + 1; end; j := 0; count_j := CkJsonObject_SizeOfArray(json,'idTags'); while j < count_j do begin CkJsonObject_putJ(json,j); // ... j := j + 1; end; j := 0; count_j := CkJsonObject_SizeOfArray(json,'prefs.backgroundImageScaled'); while j < count_j do begin CkJsonObject_putJ(json,j); width := CkJsonObject_IntOf(json,'prefs.backgroundImageScaled[j].width'); height := CkJsonObject_IntOf(json,'prefs.backgroundImageScaled[j].height'); url := CkJsonObject__stringOf(json,'prefs.backgroundImageScaled[j].url'); j := j + 1; end; j := 0; count_j := CkJsonObject_SizeOfArray(json,'memberships'); while j < count_j do begin CkJsonObject_putJ(json,j); id := CkJsonObject__stringOf(json,'memberships[j].id'); idMember := CkJsonObject__stringOf(json,'memberships[j].idMember'); memberType := CkJsonObject__stringOf(json,'memberships[j].memberType'); unconfirmed := CkJsonObject_BoolOf(json,'memberships[j].unconfirmed'); deactivated := CkJsonObject_BoolOf(json,'memberships[j].deactivated'); j := j + 1; end; CkJsonObject_Dispose(json); i := i + 1; end; CkJsonObject_Dispose(jsonToken); CkOAuth1_Dispose(oauth1); CkRest_Dispose(rest); CkJsonArray_Dispose(jarr); end; |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.