Developing a Google Data Studio Connector: Part 3

This is part 3 of "Developing a Google Data Studio Connector". If you haven't read previous two posts I recommend you to go back and read those posts. That will give you an idea of data studio connector and you will feel confident following this tutorial. So lets start coding our connector.

Step 1: Define getAuthType Function 

In you app script file start by getAuthType function. Since we will be accessing public API of GitHub so we will be using no authorization tool. We will pass NONE as the required authorization type. Read more about it here. Here is the code snippet: 

getAuthType function

Step 2: Defining getConfig Function

Next we will define getConfig() function. Since we will be comparing the GitHub profiles so we add a input field to add the GitHub usernames. Here is the documentation on how to use getConfig().

getConfig function
Here config object is obtained from the connector. And then we define a newTextInput(). This makes a new text field and allows user to enter GitHub usernames. newInfo() on the upper side sets the info above the config fields to display some messages that user wants to display.

Step 3: Defining getSchema() Function 

Next we define getSchema() function. Code snippet for this function is given below.


Here we grab the usernames from the request.configParams.username, then separate them and convert it to an array. Now userNames array contains the usernames of all the users. To know more about the request object refer this doc.

Step 3: Defining getData() Function 

Next we define getData() function.This is the final function that we need to define. It will be triggered whenever we will create new visualizations/charts. All other functions defined in the projects will be supporting these main functions i.e. getAuthType, getConfig, getSchema, getData. To find the snippet of the this function following link: https://bit.ly/2MERLtf

Next Steps

Your basic connector should be ready at this moment. If you want to see the full code of this connector follow this link: https://github.com/pradeepgangwar/GitHub-DataStudio-Connector. Dont forget to star the repository if you liked it. In case you have any doubt related to code feel free to ping me or comment below. :D

Thanks for reading!
 


 

Comments

Popular posts from this blog

SPOJ- PIE solution

Developing a Google Data Studio Connector: Part 2

Developing a Google Data Studio Connector : Part 1