# Module Reference

## upload\_binary

```python
def upload_binary(file_path, version_name, compare_version_id, project_id,
                  platform)
```

Uploads a file via POST request

Arguments:

* `file_path` *str* - Path to the file to upload
* `version_name` *str* - the version name of the new version to be created
* `compare_version_id` *str* - the version id against which we compare the new binary, if empty no comparison will be made
* `project_id` *str* - the project id of the project for which we are creating the version
* `platform` *str* - the platform of the new version (ARM|TRICORE)
* `scm_metadata` *SCMMetadata* - An object containing source control metadata used to provide context about the project and versions being compared.

Returns:

* `report_id` - report id of the new report comparing the new version vs the compare\_version

***

## get\_last\_version\_id

```python
def get_last_version_id(project_id)
```

Gets the version id of the latest valid version uploaded for the project

Arguments:

* `project_id` *str* - the project id for which we are getting the latest version

Returns:

* `version_id` *str* - the version id of the latest valid version uploaded for the project or '' if not found
* `version_name` *str* - the version name of the latest valid version uploaded for the project

***

## get\_versions

```python
def get_versions(project_id)
```

Returns list of all version objects for the project

Arguments:

* `project_id` *str* - the project's id for which we are getting the version objects

Returns:

* `versions` *\[Object]* - list of version objects for the project or \[] if none found

***

## get\_project\_id

```python
def get_project_id(project_name)
```

Returns the project id for the project with the given project name

Arguments:

* `project_name` *str* - the name of the project we are searching

Returns:

* `project_id` *str* - project id for the matched project or '' if not found
* `platform` *str* - the defined platform for the matched project or '' if not found

***

## get\_projects

```python
def get_projects()
```

Returns list of all project objects for the company

Arguments: None

Returns:

* `projects` *\[Object]* - list of project objects for the company

***

## upload\_finished

```python
def upload_finished(project_id, report_id)
```

Checks the status of the report with given report id

Arguments:

* `project_id` *str* - the project's id for which the report was created
* `report_id` *str* - the report id of the report we are uploading

Returns:

* `(finished, status)` *(boolean, int)* - returns the status of the upload

***

## get\_function\_insights

```python
def get_function_insights(version_id, version_id_base=None, perc_resp_limit=None,
                          perc_thro_limit=None, perc_bott_limit=None, pairs=None)
```

Returns a list of function insight objects containing performance metrics for the specified version.

Arguments:

* `version_id` *str* - id of the project version to retrieve function insights for
* `version_id_base` *str* (optional) - id of the base version to compare against
* `perc_resp_limit` *int* (optional) - minimum percentage change in response time required for a function to be included in the results
* `perc_thro_limit` *int* (optional) - minimum percentage change in throughput required for a function to be included in the results
* `perc_bott_limit` *int* (optional) - minimum percentage change in bottleneck required for a function to be included in the results
* `pairs` *\[Object]* (optional) - list of objects, each with `function_name`: *str* and `binary_name`: *str* fields, specifying which functions to return insights for

Returns:

* `function_insights` *\[Object]* - list of function insight objects for the specified version or an empty list if none are found

***

## get\_flame\_graph

```python
def get_flame_graph(project_id, version_id, source_container,
                          source_long_name)
```

Returns the flame graph for a specified function.

Arguments:

* `project_id` *str* - id of project
* `version_id` *str* - id of the project version
* `source_container` *str* - binary/container of the function
* `source_long_name` *str* - function long name

Returns:

* `flame_graph` *str* - string of the json representation of the flame graph for the specified function

***

## get\_version\_status

```python
def get_version_status(project_id, version_id)
```

Returns the status of a provided project version.

Arguments:

* `project_id` *str* - id of project
* `version_id` *str* - id of the project version to retrieve function insights for

Returns:

* `status_details` *dict|None* - A mapping with the structure below, or None if not found:

```json
{
  "status": int,
  "total": int,
  "counts": {
    "passed": int,
    "failed": int,
    "pending": int
  },
  "updated_at": str,
  "analysis": [
    {
      "binary": str,
      "step": str,
      "status": int,
      "updated_at": str
    },
    ...
  ]
}
```

***

## get\_report\_data

```python
def get_report_data(report_id)
```

Returns report symbols data.

Arguments:

* `report_id` *str* - id of report

Returns:

* `report_data` *dict|None* - A mapping with the structure below, or None if not found:

```json
{
  "target_total": int,
  "base_total": int,
  "modified": int,
  "new": int,
  "deleted": int
}
```

***

## get\_function\_insights\_summary

```python
def get_function_insights_summary(project_id, version_id, version_id_base, repository, pr_number)
```

Returns agent summary. In order for this to work, an environment variable `LOCI_GITHUB_TOKEN` that holds a GitHub PAT (Personal Access Token) is required.

Arguments:

* `project_id` *str* - id of project
* `version_id` *str* - id of target version
* `version_id_base` *str* - id of base version
* `scm_metadata` *SCMMetadata* - An object containing source control metadata used to provide context about the project and versions being compared.

Returns:

* `summary` *str|None* - An AI agent summary for the specified comparison or None if it is not generated.
