# openapi.api.CustomersApi

## Load the API package
```dart
import 'package:openapi/api.dart';
```

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

Method | HTTP request | Description
------------- | ------------- | -------------
[**changeDefaultAddress**](CustomersApi.md#changedefaultaddress) | **PATCH** /api/customers/dashboard/{id}/address/{addressId}/default | Update customer default address
[**create**](CustomersApi.md#create) | **POST** /api/customers/dashboard | Create a customer
[**deleteMultipleCustomers**](CustomersApi.md#deletemultiplecustomers) | **DELETE** /api/customers/dashboard | Delete multiple customers
[**findAll**](CustomersApi.md#findall) | **GET** /api/customers/dashboard | Find all customers
[**getCustomer**](CustomersApi.md#getcustomer) | **GET** /api/customers/dashboard/{id} | Find a customer by ID
[**getCustomerNames**](CustomersApi.md#getcustomernames) | **GET** /api/customers/dashboard/get-customer-names | Find all customers name
[**update**](CustomersApi.md#update) | **PUT** /api/customers/dashboard/{id} | Update a customer


# **changeDefaultAddress**
> MessageResponseApiProperty changeDefaultAddress(id, addressId)

Update customer default address

### Example
```dart
import 'package:openapi/api.dart';

final api = Openapi().getCustomersApi();
final num id = 1; // num | ID of customer
final num addressId = 1; // num | ID of customer address

try {
    final response = api.changeDefaultAddress(id, addressId);
    print(response);
} catch on DioError (e) {
    print('Exception when calling CustomersApi->changeDefaultAddress: $e\n');
}
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **id** | **num**| ID of customer | 
 **addressId** | **num**| ID of customer address | 

### Return type

[**MessageResponseApiProperty**](MessageResponseApiProperty.md)

### Authorization

No authorization required

### 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)

# **create**
> CustomerEntity create(customerEntity)

Create a customer

### Example
```dart
import 'package:openapi/api.dart';

final api = Openapi().getCustomersApi();
final CustomerEntity customerEntity = {"customerNumber":10010,"firstName":"name","lastName":"name","email":"name@example.com","password":"**********","phone":"123456789","status":"string","addresses":[{"customerId":1,"firstName":"First name","lastName":"Last name","email":"example@example.com","phone":"000000000","company":"Company","country":"Country","city":"City","street":"Street","houseNumber":"H-123","postalCode":"00000","alternativeAddress":"Address","description":"Description"}]}; // CustomerEntity | 

try {
    final response = api.create(customerEntity);
    print(response);
} catch on DioError (e) {
    print('Exception when calling CustomersApi->create: $e\n');
}
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **customerEntity** | [**CustomerEntity**](CustomerEntity.md)|  | 

### Return type

[**CustomerEntity**](CustomerEntity.md)

### Authorization

No authorization required

### 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)

# **deleteMultipleCustomers**
> MessageResponseApiProperty deleteMultipleCustomers(ids)

Delete multiple customers

### Example
```dart
import 'package:openapi/api.dart';

final api = Openapi().getCustomersApi();
final BuiltList<num> ids = ; // BuiltList<num> | 

try {
    final response = api.deleteMultipleCustomers(ids);
    print(response);
} catch on DioError (e) {
    print('Exception when calling CustomersApi->deleteMultipleCustomers: $e\n');
}
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **ids** | [**BuiltList&lt;num&gt;**](num.md)|  | 

### Return type

[**MessageResponseApiProperty**](MessageResponseApiProperty.md)

### Authorization

No authorization required

### 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)

# **findAll**
> GetAllCustomersResponse findAll(page, limit, search, sort, type, customerIds)

Find all customers

### Example
```dart
import 'package:openapi/api.dart';

final api = Openapi().getCustomersApi();
final num page = 8.14; // num | Page number
final num limit = 8.14; // num | Number of results to be returned
final String search = search_example; // String | 
final GetAllCustomerSort sort = ; // GetAllCustomerSort | sort of customer
final GetAllCustomerTypeEnum type = ; // GetAllCustomerTypeEnum | type of customer (guest or customer)
final BuiltList<num> customerIds = ; // BuiltList<num> | customerIds that you want to get

try {
    final response = api.findAll(page, limit, search, sort, type, customerIds);
    print(response);
} catch on DioError (e) {
    print('Exception when calling CustomersApi->findAll: $e\n');
}
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **page** | **num**| Page number | [default to 1]
 **limit** | **num**| Number of results to be returned | [default to 10]
 **search** | **String**|  | [optional] 
 **sort** | [**GetAllCustomerSort**](.md)| sort of customer | [optional] 
 **type** | [**GetAllCustomerTypeEnum**](.md)| type of customer (guest or customer) | [optional] 
 **customerIds** | [**BuiltList&lt;num&gt;**](num.md)| customerIds that you want to get | [optional] 

### Return type

[**GetAllCustomersResponse**](GetAllCustomersResponse.md)

### Authorization

No authorization required

### 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)

# **getCustomer**
> CustomerEntity getCustomer(id)

Find a customer by ID

### Example
```dart
import 'package:openapi/api.dart';

final api = Openapi().getCustomersApi();
final num id = 1; // num | ID of customer

try {
    final response = api.getCustomer(id);
    print(response);
} catch on DioError (e) {
    print('Exception when calling CustomersApi->getCustomer: $e\n');
}
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **id** | **num**| ID of customer | 

### Return type

[**CustomerEntity**](CustomerEntity.md)

### Authorization

No authorization required

### 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)

# **getCustomerNames**
> GetCustomerNamesResponse getCustomerNames()

Find all customers name

### Example
```dart
import 'package:openapi/api.dart';

final api = Openapi().getCustomersApi();

try {
    final response = api.getCustomerNames();
    print(response);
} catch on DioError (e) {
    print('Exception when calling CustomersApi->getCustomerNames: $e\n');
}
```

### Parameters
This endpoint does not need any parameter.

### Return type

[**GetCustomerNamesResponse**](GetCustomerNamesResponse.md)

### Authorization

No authorization required

### 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)

# **update**
> MessageResponseApiProperty update(id, updateCustomerBody)

Update a customer

### Example
```dart
import 'package:openapi/api.dart';

final api = Openapi().getCustomersApi();
final num id = 1; // num | ID of customer
final UpdateCustomerBody updateCustomerBody = ; // UpdateCustomerBody | 

try {
    final response = api.update(id, updateCustomerBody);
    print(response);
} catch on DioError (e) {
    print('Exception when calling CustomersApi->update: $e\n');
}
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **id** | **num**| ID of customer | 
 **updateCustomerBody** | [**UpdateCustomerBody**](UpdateCustomerBody.md)|  | 

### Return type

[**MessageResponseApiProperty**](MessageResponseApiProperty.md)

### Authorization

No authorization required

### 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)

