Need some help? Contact us:
...
The SHELL adapter library is just intended to something you copy and rename and make it into a real adapter for a real system. It has all the boiler plate you need. I made it because I wanted to try to build a few adapters to Solve the calendar management problem.
...
The shell adapter ships with Iguana just add the Shell Example - see Create a Component .
So how do we use it say Let’s use the Shell Adapter to create an Atlassian adapter .using the Atlassian APIs:
Expand | ||
---|---|---|
| ||
In Iguana XIguanaX, an open system, we provide adapters as libraries to connect with various applications. These adapters are intentionally designed to be simple and intuitive, making them easily extendable by users to meet their specific needs. This approach contrasts with the complexity often found in open-source projects and the rigidness of complete platforms like Zapier. Iguana's inclusive environment, featuring a Translator, logging, queuing system, and dashboard, though convenient, requires users to invest effort in learning. Our goal is to empower users with adaptable tools, understanding that no adapter can be universally complete. See: |
...
Implementation Approach:
Expand | ||
---|---|---|
| ||
Let’s use a copy of new Custom component (Create a Component ) and name it ‘Confluence adapter’ |
Expand | ||
---|---|---|
| ||
Let’s say git@bitbucket.org:interfaceware/atlassian ( - see Create a library |
Expand | ||
---|---|---|
| ||
For instanceRename the Library Folders and Files to use a new prefix. For example: |
Expand | ||||
---|---|---|---|---|
| This gets
| |||
Use Project Search and Replace to replace all the prefixes consistentused within scripts on all files in the project. |
Expand | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
| |||||||||||
title | Add
So in In the case of Atlassian we need:
This adheres with Naming convention for table parameters in Iguana. These should just be passed through in the table arguments. So the code becomes:
| ||||||||||
Expand | |||||||||||
Now we need to add the API access key to | this projectthe project as a Custom Fields. The API access key needs to be treated as password. Thus we create in config.json a custom field named ‘key' of type 'Password’ and store in it the personal Atlassian API access key, respective to the user name in use. |
Expand | ||
---|---|---|
| ||
The custom method should do most is the guts of the adapter - handling most of the API call logic. Most web APIs have some magic sauce that you have to make an API call. The custom method does this and should make it easy to call methods on the API which have not been wrapped explicitly. Let’s call our new Custom custom method ATTLdescendants. We can rename ATTLhello into ATTLdescendants and to rewrite its content. This method will help us to invoke the API method ATTLgetDescendants. |
Expand | ||
---|---|---|
| ||
Let’s call our new API method ATTLgetDescendants. We can rename ATTLcustom into ATTLgetDescendants and to rewrite its content. This method will returns return all pages in a space. | ||
Expand | ||
| ||
Sometimes Now, sometimes an API method would require a parameter which can be discovered only programmatically. In our example of Confluence Adapter this is Confluence Space Id parameter, which isn’t the same as a Space Key above. The API method ATTLgetSpaceId will help us to discover this value. Let’s create new Lua file, name it ATTLgetSpaceId and write its content. |
Expand | ||
---|---|---|
| ||
Append to the Client’s meta table, the three newly added methods and the ‘space_id’ variable declaration.
|
Expand | ||
---|---|---|
| ||
Add Help files Files (*.help) to explain what parameters the methods expect. Other users will appreciate this! |
Expand | ||
---|---|---|
| ||
Let’s create a simple main.lua file:
| ||
Expand | ||
| ||
Right after declaration of Client instance and passing the parameters to it, we discover the Confluence Space ID. This value couldn’t be known without running this API call. Next we prepare for paginated API call and require only 2 calls to be executed by setting ‘count’ variable to number 2. This will save the time while testing. The parameters for this method are described in respective help file. And finally, we request from API to return the listing of descendants for 50 pages. |
Expand | ||
---|---|---|
| ||
So, we can query Atlassian API for Confluence! What it is good for? We can query documents, we can edit documents, we can modify/export/add/delete content in any manner we imagine. The complete documentation for this API is available here. Just create more API methods and more Custom methods. Custom methods are very helpful to keep the API methods true to vendors API documentation. Custom methods will help to create your specific parameters combination, and to massage the responses. Custom methods are the interface, between your code to clean and true API methods. |
...