# api
## Module Functions
### Delete API Project <a name="delete"></a>
**API Endpoint**: `DELETE /api/{api_name}`
#### Parameters
| `api_name` | ✓ | | `"my-project".to_string()` |
#### Example Snippet
```rust
let client = sideko_rest_api::SidekoClient::default()
.with_api_key_auth(&std::env::var("API_KEY").unwrap())
.with_cookie_auth(&std::env::var("API_KEY").unwrap());
let res = client
.api()
.delete(sideko_rest_api::resources::api::DeleteRequest {
api_name: "my-project".to_string(),
})
.await;
```
### List API Projects <a name="list"></a>
**API Endpoint**: `GET /api`
#### Example Snippet
```rust
let client = sideko_rest_api::SidekoClient::default()
.with_api_key_auth(&std::env::var("API_KEY").unwrap())
.with_cookie_auth(&std::env::var("API_KEY").unwrap());
let res = client.api().list().await;
```
#### Response
##### Type
Vec of [Api](/src/models/api.rs)
##### Example
```rust
vec![Api {created_at: "1970-01-01T00:00:00".to_string(), id: "3e4666bf-d5e5-4aa7-b8ce-cefe41c7568a".to_string(), name: "my-api-spec-name".to_string(), version_count: 10}]
```
### Get API Project <a name="get"></a>
**API Endpoint**: `GET /api/{api_name}`
#### Parameters
| `api_name` | ✓ | | `"my-project".to_string()` |
#### Example Snippet
```rust
let client = sideko_rest_api::SidekoClient::default()
.with_api_key_auth(&std::env::var("API_KEY").unwrap())
.with_cookie_auth(&std::env::var("API_KEY").unwrap());
let res = client
.api()
.get(sideko_rest_api::resources::api::GetRequest {
api_name: "my-project".to_string(),
})
.await;
```
#### Response
##### Type
[Api](/src/models/api.rs)
##### Example
```rust
Api {created_at: "1970-01-01T00:00:00".to_string(), id: "3e4666bf-d5e5-4aa7-b8ce-cefe41c7568a".to_string(), name: "my-api-spec-name".to_string(), version_count: 10}
```
### Create API Project <a name="create"></a>
**API Endpoint**: `POST /api`
#### Parameters
| `name` | ✓ | | `"my-api-spec".to_string()` |
#### Example Snippet
```rust
let client = sideko_rest_api::SidekoClient::default()
.with_api_key_auth(&std::env::var("API_KEY").unwrap())
.with_cookie_auth(&std::env::var("API_KEY").unwrap());
let res = client
.api()
.create(sideko_rest_api::resources::api::CreateRequest {
name: "my-api-spec".to_string(),
})
.await;
```
#### Response
##### Type
[Api](/src/models/api.rs)
##### Example
```rust
Api {created_at: "1970-01-01T00:00:00".to_string(), id: "3e4666bf-d5e5-4aa7-b8ce-cefe41c7568a".to_string(), name: "my-api-spec-name".to_string(), version_count: 10}
```
### Create API Project with OpenAPI <a name="init"></a>
Creates a new API project with an initial version
**API Endpoint**: `POST /api/init`
#### Parameters
| `name` | ✓ | | `"my-api-spec".to_string()` |
| `openapi` | ✓ | An OpenAPI specification in YAML or JSON | `UploadFile::from_path("uploads/openapi.yaml").unwrap()` |
| `allow_lint_errors` | ✗ | Allow API spec to be created even if it has linting errors | `true` |
| `mock_server_enabled` | ✗ | Enable a public mock server requests for this API Specification | `true` |
| `notes` | ✗ | Text field to add any notes (comments, changelog, etc.) relevant to the version in html format | `"<p>This version includes a number of excellent improvements</p>".to_string()` |
| `version` | ✗ | | `VersionOrBump::VersionBumpEnum(VersionBumpEnum::Auto)` |
#### Example Snippet
```rust
let client = sideko_rest_api::SidekoClient::default()
.with_api_key_auth(&std::env::var("API_KEY").unwrap())
.with_cookie_auth(&std::env::var("API_KEY").unwrap());
let res = client
.api()
.init(sideko_rest_api::resources::api::InitRequest {
name: "my-api-spec".to_string(),
notes: Some(
"<p>This version includes a number of excellent improvements</p>"
.to_string(),
),
openapi: sideko_rest_api::UploadFile::from_path("uploads/openapi.yaml")
.unwrap(),
..Default::default()
})
.await;
```
#### Response
##### Type
[ApiSpec](/src/models/api_spec.rs)
##### Example
```rust
ApiSpec {api: Api {created_at: "1970-01-01T00:00:00".to_string(), id: "3e4666bf-d5e5-4aa7-b8ce-cefe41c7568a".to_string(), name: "my-api-spec-name".to_string(), version_count: 10}, created_at: "1970-01-01T00:00:00".to_string(), id: "3e4666bf-d5e5-4aa7-b8ce-cefe41c7568a".to_string(), mock_server: ApiMockServer {enabled: true, url: "http://www.example.com".to_string()}, notes: "<p>This version includes a number of excellent improvements</p>".to_string(), version: "string".to_string()}
```
## Submodules
- [spec](spec/README.md) - spec