Coder Social home page Coder Social logo

gti785-lab2-spec's Introduction

Transfer protocol specification

General notes

Variables

Elements like {ID} represents variables that will be replaced at runtime.

Constants

All requests must return a value if the request is processed correctly or return a 404 or a 500 when an error occurs

##Command

GET /

Return QR Code

GET /files/

Return list of files on the server

GET /server/

Return the status of the server (name, localisation)

POST /files/

The file must be in the file variable in the payload.

POST Data

This call sends a file to the remote server Return transfer status (Success or failed)

POST /files/delete/

POST Data

    {
        "file" : "{FILE PATH}"
    }

POST /files/transfer/

####POST Data

    {
        "file" : "{FILE PATH}",
        "server" : "{SERVER URL}"
    }

####Returns Return transfer status (200 or 500)

POST /polling/

Returns nothing if nothing happened or the text of the notification to show. ####Returns A notification.

##Definition of a specific command

Get QR Code

Content of the QR code {URL}

Get List of Files

<response>
    <files>
      <file>
         {FILE MODEL REPRESENTATION}
      </file>
      <file>
        ...
      </file>
        ...
      </files>
</response>

Model Representation

File

    <file>
        <id>1</id>
        <name>Foo</name>
        <path>Bar</path>
    </file>

Server Info

    <server>
        <url>http://127.0.0.1:8080</url>
        <name>Test</name>
        <localisation>Montreal</localisation>
    </server>

Notification

    <notification>
        <file>/test.png</file>
        <action>TRANSFER_FAIL</action>
    </notification>

List of actions possible

  • UPLOAD_SUCCESS : upload successful
  • UPLOAD_FAIL : upload failed
  • TRANSFER_SUCCESS : file transfer succesful
  • TRANSFER_FAIL : file transfer failed
  • FILE_ADDED : a new file was added to the server
  • FILE_DELETED : a file was deleted
  • FILE_DELETE_FAIL : a delete operation failed

gti785-lab2-spec's People

Contributors

lemieux avatar njmyi avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

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.