SPK Network - Using GraphQL for 3Speak Mobile App

49

  • 362
  • 1
  • 53.952
  • Reply

  • Open in the desktop app ADD TO PLAYLIST

    spknetwork

    Published on Jul 26, 2023
    About :

    spknetowrkcovergrql.png


    Hey everyone!

    With this 3Speak Video & Hive post, @sagarkothari88 illustrates how to use GraphQL Queries based on Union Indexer.

    SPK Network is always Open-source:

    What is GraphQL?

    • GraphQL is a query language for APIs and a runtime for fulfilling those queries with existing data
    • GraphQL provides an interactive way of building the queries & play around them.
    • You can select the attributes/fields/properties of your choice for the response.

    Why is GraphQL now on Mobile App?

    • The mobile app shows different feeds but is not sorted as per the curation amount.
    • For each video, payout info, votes, etc., values are fetched, over & over, when displayed on the screen.
    • This consumes internet bandwidth & you may want to avoid it if you are on mobile data.
    • There are other issues with the existing feed.
    • Feed needs to be updated.
    • With GraphQL, we can fix these issues & have needed data in a single request.
    • @sagarkothari88 is now implementing GraphQL-based feeds on 3Speak-Mobile application.

    How to use GraphQL?

    Screenshot 2023-07-27 at 12.29.43 AM.png

    • Select attributes that you need for your User Interface

    Screenshot 2023-07-27 at 12.31.17 AM.png

    • Do not forget to apply this filter if you only want the data for Videos.

    Screenshot 2023-07-27 at 12.34.46 AM.png

    • Hit the run button.

    Screenshot 2023-07-27 at 12.41.13 AM.png

    Ready-made GraphQL Queries for you

    Trending feed

    query MyQuery {
      trendingFeed(spkvideo: {only: true}) {
          items {
            ... on HivePost {
              spkvideo
              stats {
                num_comments
                num_votes
                total_hive_reward
              }
              lang
              title
              tags
              permlink
              created_at
              body
            }
        }
      }
    }
    

    New Videos Feed

    query MyQuery {
      socialFeed(spkvideo: {only: true}) {
              items {
            ... on HivePost {
              spkvideo
              stats {
                num_comments
                num_votes
                total_hive_reward
              }
              lang
              title
              tags
              permlink
              created_at
              body
            }
      }
    }
    

    First Uploads Feed

    query MyQuery {
      socialFeed(spkvideo: {only: true, firstUpload: true}) {
        items {
            ... on HivePost {
              spkvideo
              stats {
                num_comments
                num_votes
                total_hive_reward
              }
              lang
              title
              tags
              permlink
              created_at
              body
        }
      }
    }
    

    Related Videos

    query MyQuery {
      relatedFeed(permlink: "sdltslwo", author: "leofinance") {
            items {
            ... on HivePost {
              spkvideo
              stats {
                num_comments
                num_votes
                total_hive_reward
              }
              lang
              title
              tags
              permlink
              created_at
              body
            }
        }
      }
    }
    

    My Published Videos

    query MyQuery {
      socialFeed(
        spkvideo: {only: true}
        feedOptions: {byCreator: {_eq: "sagarkothari88"}}
      ) {
        items {
          ... on HivePost {
            body
            title
            tags
            stats {
              num_comments
              num_votes
              total_hive_reward
            }
            spkvideo
            permlink
            lang
            community
            created_at
          }
        }
      }
    }
    

    3Shorts

    query MyQuery {
      socialFeed(
        spkvideo: {only: true, isShort: true}
      ) {
        items {
          ... on HivePost {
            body
            title
            tags
            stats {
              num_comments
              num_votes
              total_hive_reward
            }
            spkvideo
            permlink
            lang
            community
            created_at
          }
        }
      }
    }
    

    Leaderboard

    Coming soon.

    Community Details

    query MyQuery {
      community(id: "hive-181335") {
        title
        about
        created_at
        images {
          avatar
          cover
        }
        roles {
          role
          title
          username
        }
        subscribers
      }
    }
    

    Videos from a community

    query MyQuery {
      community(id: "hive-181335") {
        title
        about
        created_at
        images {
          avatar
          cover
        }
        roles {
          role
          title
          username
        }
        subscribers
        trendingFeed {
          items {
            ... on HivePost {
              spkvideo
              stats {
                num_comments
                num_votes
                total_hive_reward
              }
              lang
              title
              tags
              permlink
              created_at
              body
            }
          }
        }
      }
    }
    

    About the SPK Network:

    The SPK Network is a decentralized Web 3.0 protocol that rewards value creators and infrastructure providers appropriately and autonomously by distributing reward tokens so that every user, creator, and platform can earn rewards on a level playing field.


    color3speak.png

    Important Links:

    3Speak LinktreeSPK Network Linktree
    3Speak.tv3Speak Twitter3Speak Hive Blog3Speak Telegram
    3Speak in SpanishDownload Android AppDownload iOS AppDownload Desktop App
    Join 3Speak DiscordSetup Encoder NodeVote for SPK Network ProposalBadge Recipients
    appStoreGooglePlayStore

    Vote for 3Speak as Witness - Support @threespeak

    Vote for Sagarkothari88 as Witness - Support @sagarkothari88

    Tags :

    graphql spknetwork 3speak threespeak leofinance video ctp development unionidexer

    Woo! This creator can upvote comments using 3speak's stake today because they are a top performing creator! Leave a quality comment relating to their content and you could receive an upvote worth at least a dollar.

    Their limit for today is $0!
    Comments:
    Time until spknetwork can give away $0 to their commenters.
    0 Days 0 Hours 0 Minutes 0 Seconds
    Reply:

    To comment on this video please connect a HIVE account to your profile: Connect HIVE Account

    01:21:47
    81 views a year ago $
    56:31
    38 views 11 months ago $
    01:02:48
    34 views 11 months ago $
    02:14:35
    69 views a year ago $

    More Videos

    00:21
    2 views a year ago $
    00:58
    11 views 5 months ago $
    00:11
    3 views a day ago $
    10:06
    11 views a year ago $
    00:22
    28 views 7 months ago $
    01:37
    2 views a week ago $