src/endpoints/account-blob.js
function accountGuilds (client) {
  return client.account().get().then(account => {
    if (!account.guild_leader) {
      return []
    }

    let requests = account.guild_leader.map(id => wrap(() => guildData(id)))
    return flow.parallel(requests)
  })

  function guildData (id) {
    let requests = {
      data: wrap(() => client.guild().get(id)),
      members: wrap(() => client.guild(id).members().get()),
      ranks: wrap(() => client.guild(id).ranks().get()),
      stash: wrap(() => client.guild(id).stash().get()),
      teams: wrap(() => Promise.resolve(null)),
      treasury: wrap(() => client.guild(id).treasury().get()),
      upgrades: wrap(() => client.guild(id).upgrades().get())
    }

    return flow.parallel(requests)
  }
}
function accountGuilds (client) {
  return client.account().get().then(account => {
    if (!account.guild_leader) {
      return []
    }

    let requests = account.guild_leader.map(id => wrap(() => guildData(id)))
    return flow.parallel(requests)
  })

  function guildData (id) {
    let requests = {
      data: wrap(() => client.guild().get(id)),
      members: wrap(() => client.guild(id).members().get()),
      ranks: wrap(() => client.guild(id).ranks().get()),
      stash: wrap(() => client.guild(id).stash().get()),
      teams: wrap(() => Promise.resolve(null)),
      treasury: wrap(() => client.guild(id).treasury().get()),
      upgrades: wrap(() => client.guild(id).upgrades().get())
    }

    return flow.parallel(requests)
  }
}
function accountGuilds ( client ) { return client . account ( ) . get ( ) . then ( account => { if ( ! account . guild_leader ) { return [ ] } let requests = account . guild_leader . map ( id => wrap ( ( ) => guildData ( id ) ) ) return flow . parallel ( requests ) } ) function guildData ( id ) { let requests = { data : wrap ( ( ) => client . guild ( ) . get ( id ) ) , members : wrap ( ( ) => client . guild ( id ) . members ( ) . get ( ) ) , ranks : wrap ( ( ) => client . guild ( id ) . ranks ( ) . get ( ) ) , stash : wrap ( ( ) => client . guild ( id ) . stash ( ) . get ( ) ) , teams : wrap ( ( ) => Promise . resolve ( null ) ) , treasury : wrap ( ( ) => client . guild ( id ) . treasury ( ) . get ( ) ) , upgrades : wrap ( ( ) => client . guild ( id ) . upgrades ( ) . get ( ) ) } return flow . parallel ( requests ) } }
Get the guild data accessible for the account
Get the guild data accessible for the account