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
(Swift 3,4,5...) Trello List Member BoardsLists the boards that the user is a member of. For more information, see https://developers.trello.com/reference#membersidboards
func chilkatTest() { // 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. let jsonToken = CkoJsonObject()! var success: Bool = jsonToken.loadFile("qa_data/tokens/trello.json") let oauth1 = CkoOAuth1()! oauth1.consumerKey = "TRELLO_CONSUMER_KEY" oauth1.consumerSecret = "TRELLO_CONSUMER_SECRET" oauth1.token = jsonToken.string(of: "oauth_token") oauth1.tokenSecret = jsonToken.string(of: "oauth_token_secret") let rest = CkoRest()! // 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. var bAutoReconnect: Bool = true success = rest.connect("api.trello.com", port: 443, tls: true, autoReconnect: bAutoReconnect) if success != true { print("\(rest.lastErrorText!)") return } rest.setAuthOAuth1(oauth1, useQueryParams: false) rest.addQueryParam("filter", value: "all") rest.addQueryParam("fields", value: "all") rest.addQueryParam("lists", value: "none") rest.addQueryParam("memberships", value: "normal") rest.addQueryParam("organization", value: "false") rest.addQueryParam("organization_fields", value: "name,displayName") rest.addHeader("Accept", value: "application/json") var responseBody: String? = rest.fullRequestNoBody("GET", uriPath: "/1/members/member_id/boards") if rest.lastMethodSuccess != true { print("\(rest.lastErrorText!)") return } // We should expect a 200 response if successful. if rest.responseStatusCode.intValue != 200 { print("Request Header: ") print("\(rest.lastRequestHeader!)") print("----") print("Response StatusCode = \(rest.responseStatusCode.intValue)") print("Response StatusLine: \(rest.responseStatusText!)") print("Response Header:") print("\(rest.responseHeader!)") print("\(responseBody!)") return } let jarr = CkoJsonArray()! jarr.load(responseBody) jarr.emitCompact = false print("\(jarr.emit()!)") print("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 // } // ] // } // ] var i: Int var count_i: Int var json: CkoJsonObject? var name: String? var desc: String? var descData: String? var closed: Bool var idOrganization: String? var limits: String? var pinned: String? var shortLink: String? var dateLastActivity: String? var datePluginDisable: String? var creationMethod: String? var ixUpdate: String? var id: String? var starred: Bool var url: String? var prefsPermissionLevel: String? var prefsVoting: String? var prefsComments: String? var prefsInvitations: String? var prefsSelfJoin: Bool var prefsCardCovers: Bool var prefsCardAging: String? var prefsCalendarFeedEnabled: Bool var prefsBackground: String? var prefsBackgroundImage: String? var prefsBackgroundTile: Bool var prefsBackgroundBrightness: String? var prefsBackgroundBottomColor: String? var prefsBackgroundTopColor: String? var prefsCanBePublic: Bool var prefsCanBeEnterprise: Bool var prefsCanBeOrg: Bool var prefsCanBePrivate: Bool var prefsCanInvite: Bool var subscribed: Bool var labelNamesGreen: String? var labelNamesYellow: String? var labelNamesOrange: String? var labelNamesRed: String? var labelNamesPurple: String? var labelNamesBlue: String? var labelNamesSky: String? var labelNamesLime: String? var labelNamesPink: String? var labelNamesBlack: String? var dateLastView: String? var shortUrl: String? var prefsBackgroundImageScaled: String? var prefsBackgroundColor: String? var j: Int var count_j: Int var width: Int var height: Int var idMember: String? var memberType: String? var unconfirmed: Bool var deactivated: Bool i = 0 count_i = jarr.size.intValue while i < count_i { json = jarr.object(at: i) name = json!.string(of: "name") desc = json!.string(of: "desc") descData = json!.string(of: "descData") closed = json!.bool(of: "closed") idOrganization = json!.string(of: "idOrganization") limits = json!.string(of: "limits") pinned = json!.string(of: "pinned") shortLink = json!.string(of: "shortLink") dateLastActivity = json!.string(of: "dateLastActivity") datePluginDisable = json!.string(of: "datePluginDisable") creationMethod = json!.string(of: "creationMethod") ixUpdate = json!.string(of: "ixUpdate") id = json!.string(of: "id") starred = json!.bool(of: "starred") url = json!.string(of: "url") prefsPermissionLevel = json!.string(of: "prefs.permissionLevel") prefsVoting = json!.string(of: "prefs.voting") prefsComments = json!.string(of: "prefs.comments") prefsInvitations = json!.string(of: "prefs.invitations") prefsSelfJoin = json!.bool(of: "prefs.selfJoin") prefsCardCovers = json!.bool(of: "prefs.cardCovers") prefsCardAging = json!.string(of: "prefs.cardAging") prefsCalendarFeedEnabled = json!.bool(of: "prefs.calendarFeedEnabled") prefsBackground = json!.string(of: "prefs.background") prefsBackgroundImage = json!.string(of: "prefs.backgroundImage") prefsBackgroundTile = json!.bool(of: "prefs.backgroundTile") prefsBackgroundBrightness = json!.string(of: "prefs.backgroundBrightness") prefsBackgroundBottomColor = json!.string(of: "prefs.backgroundBottomColor") prefsBackgroundTopColor = json!.string(of: "prefs.backgroundTopColor") prefsCanBePublic = json!.bool(of: "prefs.canBePublic") prefsCanBeEnterprise = json!.bool(of: "prefs.canBeEnterprise") prefsCanBeOrg = json!.bool(of: "prefs.canBeOrg") prefsCanBePrivate = json!.bool(of: "prefs.canBePrivate") prefsCanInvite = json!.bool(of: "prefs.canInvite") subscribed = json!.bool(of: "subscribed") labelNamesGreen = json!.string(of: "labelNames.green") labelNamesYellow = json!.string(of: "labelNames.yellow") labelNamesOrange = json!.string(of: "labelNames.orange") labelNamesRed = json!.string(of: "labelNames.red") labelNamesPurple = json!.string(of: "labelNames.purple") labelNamesBlue = json!.string(of: "labelNames.blue") labelNamesSky = json!.string(of: "labelNames.sky") labelNamesLime = json!.string(of: "labelNames.lime") labelNamesPink = json!.string(of: "labelNames.pink") labelNamesBlack = json!.string(of: "labelNames.black") dateLastView = json!.string(of: "dateLastView") shortUrl = json!.string(of: "shortUrl") prefsBackgroundImageScaled = json!.string(of: "prefs.backgroundImageScaled") prefsBackgroundColor = json!.string(of: "prefs.backgroundColor") j = 0 count_j = json!.size(ofArray: "powerUps").intValue while j < count_j { json.j = j // ... j = j + 1 } j = 0 count_j = json!.size(ofArray: "idTags").intValue while j < count_j { json.j = j // ... j = j + 1 } j = 0 count_j = json!.size(ofArray: "prefs.backgroundImageScaled").intValue while j < count_j { json.j = j width = json!.int(of: "prefs.backgroundImageScaled[j].width").intValue height = json!.int(of: "prefs.backgroundImageScaled[j].height").intValue url = json!.string(of: "prefs.backgroundImageScaled[j].url") j = j + 1 } j = 0 count_j = json!.size(ofArray: "memberships").intValue while j < count_j { json.j = j id = json!.string(of: "memberships[j].id") idMember = json!.string(of: "memberships[j].idMember") memberType = json!.string(of: "memberships[j].memberType") unconfirmed = json!.bool(of: "memberships[j].unconfirmed") deactivated = json!.bool(of: "memberships[j].deactivated") j = j + 1 } json = nil i = i + 1 } } |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.