Skip to content

Latest commit

 

History

History
148 lines (96 loc) · 2.3 KB

api.md

File metadata and controls

148 lines (96 loc) · 2.3 KB

Search

Returns json data definitions and references for an identifier via text or numeric id search.

  • URL

    /search?needle=:needle or /search?id=:id

  • Method:

    GET

  • URL Params

    Required:

    needle=[string] or id=[integer]

  • Data Params

    None

  • Success Response:

    • Code: 200
      Content: { defs : [ { file_name: <file_name>, lines: [] } ], refs : [ { file_name: <file_name>, lines: [] } ] }
  • Error Response:

    • Code: 500 Internal Server Error
      Content: "Bad search string"

    OR

    • Code: 500 Internal Server Error
      Content: "Bad id: <id>"
  • Sample Call:

      $.ajax({
        url: "/search?needle=off_t",
        dataType: "json",
        type : "GET",
        success : function(r) {
          console.log(r);
        }
      });

Source

Returns json data for source directory or file.

  • URL

    /src/:path/:filename

  • Method:

    GET

  • URL Params

None

  • Data Params

    None

  • Success Response:

    • Code: 200
      Content: { Directory : { path : [], files: [] } }

    OR

    • Code: 200
      Content: { Source : { path : [], lines: [] } }
  • Error Response:

    • Code: 500 Internal Server Error
      Content: io::Error reading or writing path
  • Sample Call:

      $.ajax({
        url: "/src/src/lib.rs",
        dataType: "json",
        type : "GET",
        success : function(r) {
          console.log(r);
        }
      });

Find impls

Returns json array of impls for a struct or enum by id.

  • URL

    /find?impls=:id

  • Method:

    GET

  • URL Params

    Required:

    impls=[integer]

  • Data Params

    None

  • Success Response:

    • Code: 200
      Content: { results : [ { file_name : <filename>, lines: [] } ] }
  • Error Response:

    • Code: 500 Internal Server Error
      Content: "Unknown argument to find"

    OR

    • Code: 500 Internal Server Error
      Content: "Bad id: <id>"
  • Sample Call:

      $.ajax({
        url: "/find?impls=8",
        dataType: "json",
        type : "GET",
        success : function(r) {
          console.log(r);
        }
      });