ijlyttle / yamr

Embed a 'Yammer' Item into a Web Page
Other
0 stars 0 forks source link

signature of embed_yammer() #1

Open ijlyttle opened 5 years ago

ijlyttle commented 5 years ago

From https://developer.yammer.com/docs/embed:

<script type="text/javascript" src="https://c64.assets-yammer.com/assets/platform_embed.js"></script>
<div id="embedded-feed" style="height:400px;width:500px;"></div>
<script>
    yam.connect.embedFeed({
        container: '#embedded-feed',
        network: 'fourleaf.com',
        feedType: 'group',                // can be 'group', 'topic', or 'user'    
        feedId: '123',                     // feed ID from the instructions above
        config: {
             defaultGroupId: 3257958      // specify default group id to post to 
        }
    });    
</script>

From https://developer.yammer.com/docs/single-sign-on:

yam.connect.embedFeed({
    container: '#embedded-feed',
    network: 'domain.com', // network domain configured for federation
    feedType: '',
    feedId: '',
    config: {
        use_sso: true, // this line enables SSO
        header: true,
        footer: true,
        showOpenGraphPreview: false,
        defaultGroupId: 3257958      // specify default group id to post to 
    }
});
ijlyttle commented 5 years ago

This suggests a signature:

yam_embed <- function(id, width = "100%", height = "auto", network, feed_type, feed_id, 
                      config = yam_embed_config()) {

 container <- glue::glue("#{id}")

  htmltools::taglist(
    yam_embed_script_cdn(),
    yam_embed_div(id, width, height),
    yam_embed_script(container = id, network, feed_type, feed_id, config)
  )
}

and a helper function:

yam_embed_config <- function(...) {
  # returns list
}

perhaps with some internal functions:

yam_embed_script_cdn <- function() {
  # returns script tag
}
yam_embed_div <- function(id, width, height) {
  # returns div tag
}
yam_embed_script <- function(container, network, feed_type, feed_id, config) {
  # consider using options for network, config

  # returns script tag
}