Giter Club home page Giter Club logo

go_friends_api's Introduction

在线访问地址

 Friends Management

开发框架说明

项目背景

For any application with a need to build its own social network, "Friends Management" is a common requirement which ussually starts off simple but can grow in complexity depending on the application's use case. Usually, applications would start with features like "Friend", "Unfriend", "Block", "Receive Updates" etc.

项目说明

  • Swagger 注释说明
  • swagger/main.go 生成Swagger文档
  • 配置文件config/app_config.ini,首次运行时创建或自行创建

app_config.ini

  #数据库连接
  dburl            = postgres://user:password@ip:port/dbname?sslmode=disable
  #端口 predix时为cloud
  port             = port
  #Swagger Basepath
  swagger_basepath = http://ip:port

API说明

https://wangjingzhu.run.aws-jp01-pr.ice.predix.io/swagger-ui/

1 /user/friends    [POST]

Create a friend connection between two email addresses.

JSON request:

  {
    "friends":[
        "[email protected]",
        "[email protected]"
     ]
  }

JSON response on success:

  {
    "success": true
  }

2 /user/friends/list    [POST]

Retrieve the friends list for an email address.

JSON request:

  {
    "email": "[email protected]"
  }

JSON response on success:

  {
     "success": true,
     "friends" : [
         "[email protected]"
     ],
     "count" : 1
  }

3 /user/friends/common    [POST]

Retrieve the common friends list between two email addresses.

JSON request:

  {
     "friends":[
         "[email protected]",
         "[email protected]"
     ]
  }

JSON response on success:

  {
     "success": true,
     "friends":[
         "[email protected]"
     ],
     "count" : 1
  }

4 /user/friend/subscribe    [POST]

Subscribe to updates from an email address.

That "subscribing to updates" is NOT equivalent to "adding a friend connection".

JSON request:

  {
      "requestor": "[email protected]",
      "target": "[email protected]"
  }

JSON response on success:

  {
      "success": true
  }

5 /user/friend/block    [POST]

Block updates from an email address.

Suppose "[email protected]" blocks "[email protected]":

  • if they are connected as friends, then "andy" will no longer receive notifications from "john"
  • if they are not connected as friends, then no new friends connection can be added

JSON request:

  {
      "requestor": "[email protected]",
      "target": "[email protected]"
  }

JSON response on success:

  {
      "success": true
  }

6 /user/friends/sender    [POST]

Retrieve all email addresses that can receive updates from an email address.

Eligibility for receiving updates from i.e. "[email protected]":

JSON request:

  {
     "sender": "[email protected]",
     "text": "Hello World! [email protected]"
  }

JSON response on success:

  {
     "success": true,
     "recipients" : [
        "[email protected]",
        "[email protected]"
     ]
  }
  • Demo.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.