Forum Discussion

irach15's avatar
irach15
Maven
9 years ago

Custom Component: connect to and render a Github distribution

I'm looking for how to create a Custom Component to connect to and render a Github distribution.

Think about as I'm new to render from Github :-). I know how to create a custom component in Lithium.

The component can be:

- configured "talk to" a Github distribution/pull, render a link to the bits, possibly provide a tree-control/representation of prior versions, as well as other logical elements to enable a community visitor to see a download and initiate it from community (vs. leaving to visit GitHub) to get  posted tool/script...

----------------------------------

any ideas? Samples?

as more details as possible,

I have no idea how to start...

    • irach15's avatar
      irach15
      Maven

      Hi cike,

      I've seen this implementation for a survey, which is not working bz it's not free anymore to play with.

      Also,

      I'm  not sure it works for us cz we don't need an EndPoint page to be created. (or this is the only way to get it?....)

      We need a custom component, showing how many people downloaded files and what files from GitHub aka repository to show.

      Any close enough ideas how to do that?

      ........................

      I'm actually thinking to try GitHub APIs  to get the data I need without getting to EndPoint, is it possible?

      Thanks.

      • cike's avatar
        cike
        Champion

        Hi irach15,

         

        you're right the gizmo API is not free anymore. But you can use the basic architecture from the TKB article and replace the gizmo API with the Github API.

        I guess your custom component should request the API using AJAX and some other JavaScript magic. I think thats not possible during the Same Origin Policy. This will prevent your custom component from making successful request to third party APIs.

         

        With the http.client context object such third party API request will work, but the object can only be used within endpoints or the initialization scripts.

         

        So as described in the TKB you a 3-tier architecture:

        • A custom component which sends an AJAX request to an endpoint and renders the results
        • An endpoint which takes the request from the component and redirects this request to the Github API using the http.client context object
        • Github API (These are only the URLs of your requests)

         

        Hopefully, my description helps a bit more.

         

        Regards,

        Christian