zregvart commented on a change in pull request #298: Pulling data from json apis
URL: https://github.com/apache/camel-website/pull/298#discussion_r402443713
 
 

 ##########
 File path: layouts/shortcodes/contributors.html
 ##########
 @@ -0,0 +1,31 @@
+
+<table class="tableblock stretch">
+    <thead>
+        <tr>
+            <th>Avatar</th>
+            <th>Name</th>
+            <th>Organization</th>
+        </tr>
+    </thead>
+    <tbody>
+        {{ range  $page_count := (seq 10) }}
 
 Review comment:
   Option 1: comment so we know what this is about
   ```suggestion
           {{/* TODO we can't access HTTP headers and to fetch all contributors 
we need to load multiple pages, when Camel has over 1000 contributors the 10 
pages we have here will not be enough */}}
           {{ range  $page_count := (seq 10) }}
   ```
   
   Option 2: do a `range` over much bigger sequence and don't invoke `getJSON` 
if last invocation returned 100 contributors, something like:
   ```
   {{/* we're looping over 100 numbers in order to fetch paged data from GitHub 
API, we're invoking GitHub API only if we received all results per page (100) 
from the last page */}}
   {{ $pages := seq 100 }}¬
   {{ $last_contributors := 1 }}¬
   {{ range $page, $tmp := $pages }}¬
       {{ if eq $last_contributors 100 }}¬
           {{ $git_contributors := getJSON 
"https://api.github.com/repos/apache/camel/contributors?per_page=100&anon=1&page=";
 ($page | string) }}¬
           {{ $last_contributors = len $git_contributors }}¬
   ...
       {{ end }}¬
   {{ end }}¬
   
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to