# \ServiceAccountsApi

All URIs are relative to *http://localhost*

Method | HTTP request | Description
------------- | ------------- | -------------
[**create_service_account**](ServiceAccountsApi.md#create_service_account) | **POST** /api/v1/service-accounts | Create a new service account
[**create_token**](ServiceAccountsApi.md#create_token) | **POST** /api/v1/service-accounts/{id}/tokens | Create a token for a service account
[**delete_service_account**](ServiceAccountsApi.md#delete_service_account) | **DELETE** /api/v1/service-accounts/{id} | Delete a service account
[**get_service_account**](ServiceAccountsApi.md#get_service_account) | **GET** /api/v1/service-accounts/{id} | Get a service account by ID
[**list_service_accounts**](ServiceAccountsApi.md#list_service_accounts) | **GET** /api/v1/service-accounts | List all service accounts
[**list_tokens**](ServiceAccountsApi.md#list_tokens) | **GET** /api/v1/service-accounts/{id}/tokens | List tokens for a service account
[**preview_repo_selector**](ServiceAccountsApi.md#preview_repo_selector) | **POST** /api/v1/service-accounts/repo-selector/preview | Preview which repositories match a given repo selector.
[**revoke_token**](ServiceAccountsApi.md#revoke_token) | **DELETE** /api/v1/service-accounts/{id}/tokens/{token_id} | Revoke a token from a service account
[**update_service_account**](ServiceAccountsApi.md#update_service_account) | **PATCH** /api/v1/service-accounts/{id} | Update a service account



## create_service_account

> models::ServiceAccountResponse create_service_account(create_service_account_request)
Create a new service account

### Parameters


Name | Type | Description  | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**create_service_account_request** | [**CreateServiceAccountRequest**](CreateServiceAccountRequest.md) |  | [required] |

### Return type

[**models::ServiceAccountResponse**](ServiceAccountResponse.md)

### Authorization

[bearer_auth](../README.md#bearer_auth)

### HTTP request headers

- **Content-Type**: application/json
- **Accept**: application/json

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)


## create_token

> models::CreateTokenResponse create_token(id, create_token_request)
Create a token for a service account

### Parameters


Name | Type | Description  | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**id** | **uuid::Uuid** | Service account ID | [required] |
**create_token_request** | [**CreateTokenRequest**](CreateTokenRequest.md) |  | [required] |

### Return type

[**models::CreateTokenResponse**](CreateTokenResponse.md)

### Authorization

[bearer_auth](../README.md#bearer_auth)

### HTTP request headers

- **Content-Type**: application/json
- **Accept**: application/json

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)


## delete_service_account

> delete_service_account(id)
Delete a service account

### Parameters


Name | Type | Description  | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**id** | **uuid::Uuid** | Service account ID | [required] |

### Return type

 (empty response body)

### Authorization

[bearer_auth](../README.md#bearer_auth)

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: Not defined

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)


## get_service_account

> models::ServiceAccountResponse get_service_account(id)
Get a service account by ID

### Parameters


Name | Type | Description  | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**id** | **uuid::Uuid** | Service account ID | [required] |

### Return type

[**models::ServiceAccountResponse**](ServiceAccountResponse.md)

### Authorization

[bearer_auth](../README.md#bearer_auth)

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: application/json

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)


## list_service_accounts

> models::ServiceAccountListResponse list_service_accounts()
List all service accounts

### Parameters

This endpoint does not need any parameter.

### Return type

[**models::ServiceAccountListResponse**](ServiceAccountListResponse.md)

### Authorization

[bearer_auth](../README.md#bearer_auth)

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: application/json

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)


## list_tokens

> models::TokenListResponse list_tokens(id)
List tokens for a service account

### Parameters


Name | Type | Description  | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**id** | **uuid::Uuid** | Service account ID | [required] |

### Return type

[**models::TokenListResponse**](TokenListResponse.md)

### Authorization

[bearer_auth](../README.md#bearer_auth)

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: application/json

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)


## preview_repo_selector

> models::PreviewRepoSelectorResponse preview_repo_selector(preview_repo_selector_request)
Preview which repositories match a given repo selector.

Does not create or modify anything. Useful for testing selectors before attaching them to a token.

### Parameters


Name | Type | Description  | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**preview_repo_selector_request** | [**PreviewRepoSelectorRequest**](PreviewRepoSelectorRequest.md) |  | [required] |

### Return type

[**models::PreviewRepoSelectorResponse**](PreviewRepoSelectorResponse.md)

### Authorization

[bearer_auth](../README.md#bearer_auth)

### HTTP request headers

- **Content-Type**: application/json
- **Accept**: application/json

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)


## revoke_token

> revoke_token(id, token_id)
Revoke a token from a service account

### Parameters


Name | Type | Description  | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**id** | **uuid::Uuid** | Service account ID | [required] |
**token_id** | **uuid::Uuid** | Token ID | [required] |

### Return type

 (empty response body)

### Authorization

[bearer_auth](../README.md#bearer_auth)

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: Not defined

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)


## update_service_account

> models::ServiceAccountResponse update_service_account(id, update_service_account_request)
Update a service account

### Parameters


Name | Type | Description  | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**id** | **uuid::Uuid** | Service account ID | [required] |
**update_service_account_request** | [**UpdateServiceAccountRequest**](UpdateServiceAccountRequest.md) |  | [required] |

### Return type

[**models::ServiceAccountResponse**](ServiceAccountResponse.md)

### Authorization

[bearer_auth](../README.md#bearer_auth)

### HTTP request headers

- **Content-Type**: application/json
- **Accept**: application/json

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

