# Code

These are the endpoints used to retrieve system code: packages, classes and methods.

It is important to mention that the JSON objects returned by these endpoints should include common properties of every `object`. This is used by Webside IDE to provide inspection services over objects of the meta-model (classes, methods, etc.). These are the common properties at the moment:

```json
{
  "class": "string",
  "hasNamedSlots": "boolean",
  "hasIndexedSlots": "boolean",
  "size": "number",
  "printString": "string"
}
```

## Endpoints

| Method | Path                                                                                             | Description                                                                                                                                                                                                             |                                                                                      Parameters                                                                                     | Payload |
| :----: | ------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | ------- |
|   GET  | [/methods](https://webside.gitbook.io/webside/api/code/methods/get)                              | Retrieve methods satisfying the condition specified in the query (or all the methods in the system if no condition is provided)                                                                                         | `selector`, `category`, `accessing`, `using`, `assigning`, `sending`, `referencingClass`, `selectorMatching`, `ast`, `annotations`, `bytecodes`, `dissasembly`, `count`, `modified` | -       |
|   GET  | [/classes](https://webside.gitbook.io/webside/api/code/classes/get)                              | Retrieve all subclasses of a given root class (if no root is provided, the uppermost class in the system is used). It is also possible get a tree-like structure as well as to limit the depth in the classes hierarchy |                                                                     `root`, `names`, `tree`, `depth`, `category`                                                                    | -       |
|   GET  | [/classes/{name}](https://webside.gitbook.io/webside/api/code/classes/get-1)                     | Retrieve a given class                                                                                                                                                                                                  |                                                                                          -                                                                                          | -       |
|   GET  | [/classes/{name}/superclasses](https://webside.gitbook.io/webside/api/code/classes/get-11)       | Retrieve superclasses a given class                                                                                                                                                                                     |                                                                                          -                                                                                          | -       |
|   GET  | [/classes/{name}/subclasses](https://webside.gitbook.io/webside/api/code/classes/get-10)         | Retrieve subclasses a given class                                                                                                                                                                                       |                                                                                          -                                                                                          | -       |
|   GET  | [/classes/{name}/variables](https://webside.gitbook.io/webside/api/code/classes/get-3)           | Retrieve instance and class variables of a given class                                                                                                                                                                  |                                                                                          -                                                                                          | -       |
|   GET  | [/classes/{name}/instance-variables](https://webside.gitbook.io/webside/api/code/classes/get-5)  | Retrieve instance variables of a given class                                                                                                                                                                            |                                                                                          -                                                                                          | -       |
|   GET  | [/classes/{name}/class-variables](https://webside.gitbook.io/webside/api/code/classes/get-4)     | Retrieve class variables of a given class                                                                                                                                                                               |                                                                                          -                                                                                          | -       |
|   GET  | [/classes/{name}/categories](https://webside.gitbook.io/webside/api/code/classes/get-2)          | Retrieve categories of a given class                                                                                                                                                                                    |                                                                                          -                                                                                          | -       |
|   GET  | [/classes/{name}/used-categories](https://webside.gitbook.io/webside/api/code/classes/get-12)    | Retrieve categories used throughout the hierarchy of a given class                                                                                                                                                      |                                                                                          -                                                                                          | -       |
|   GET  | [/classes/{name}/methods](https://webside.gitbook.io/webside/api/code/classes/get-7)             | Retrieve methods of a given class                                                                                                                                                                                       |                                                                                          -                                                                                          | -       |
|   GET  | [/classes/{name}/selectors](https://webside.gitbook.io/webside/api/code/classes/get-6)           | Retrieve selectors of a given class                                                                                                                                                                                     |                                                                                          -                                                                                          | -       |
|   GET  | [/classes/{name}/methods/{selector}](https://webside.gitbook.io/webside/api/code/classes/get-8)  | Retrieve the method with the given selector in the given class                                                                                                                                                          |                                                                                          -                                                                                          | -       |
|   GET  | [/categories](https://webside.gitbook.io/webside/api/code/categories/get)                        | Retrieve all categories in the system                                                                                                                                                                                   |                                                                                          -                                                                                          | -       |
|   GET  | [/usual-categories](https://webside.gitbook.io/webside/api/code/categories/get-1)                | Retrieve popular categories used throughout the system                                                                                                                                                                  |                                                                                          -                                                                                          | -       |
|   GET  | [/packages](https://webside.gitbook.io/webside/api/code/packages/get)                            | Retrieve all packages                                                                                                                                                                                                   |                                                                                       `names`                                                                                       | -       |
|   GET  | [/packages/{name}](https://webside.gitbook.io/webside/api/code/packages/get-1)                   | Retrieve a given package                                                                                                                                                                                                |                                                                                          -                                                                                          | -       |
|   GET  | [/packages/{name}/classes](https://webside.gitbook.io/webside/api/code/packages/get-2)           | Retrieve actual classes of a given package                                                                                                                                                                              |                                                                       `extended`, `tree`, `names`, `category`                                                                       | -       |
|   GET  | [/packages/{name}/methods](https://webside.gitbook.io/webside/api/code/packages/get-3)           | Retrieve actual methods of a given package                                                                                                                                                                              |                                                                                          -                                                                                          | -       |
|   GET  | [/search](https://webside.gitbook.io/webside/api/code/get)                                       | Perform a search on the system                                                                                                                                                                                          |                                                                      `text`, `ignoreCase`, `condition`, `type`                                                                      | -       |
|   GET  | [/autocompletions](https://webside.gitbook.io/webside/api/code/autocompletions/post)             | Retrieve completion entries for a given code, position and context                                                                                                                                                      |                                                                                          -                                                                                          | -       |
|   GET  | [/classtemplate](https://webside.gitbook.io/webside/api/code/classtemplate/get)                  | Provide a class template                                                                                                                                                                                                |                                                                                      `package`                                                                                      | -       |
|   GET  | [/methodtemplate](https://webside.gitbook.io/webside/api/code/classtemplate/get-1)               | Provide a method template                                                                                                                                                                                               |                                                                                          -                                                                                          | -       |
|  POST  | [/selector](https://github.com/guillermoamaral/Webside/blob/main/docs/api/code/selector/post.md) | Find a selector in a piece of source code                                                                                                                                                                               |                                                                                          -                                                                                          | -       |
