# UserSourceAuthenticationApi

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

| Method | HTTP request | Description |
|------------- | ------------- | -------------|
| [**listUserSourceAuthentication**](UserSourceAuthenticationApi.md#listusersourceauthentication) | **GET** /authentications/users/{userId}/sources | Get all the available data sources for an user |
| [**updateUserSourceAuthentication**](UserSourceAuthenticationApi.md#updateusersourceauthentication) | **PUT** /authentications/users/{userId}/sources/{sourceKey} | Update the credentials of a given source for a user |



## listUserSourceAuthentication

> ListUserSourceAuthenticationResultSchema listUserSourceAuthentication(userId)

Get all the available data sources for an user

### Example

```ts
import {
  Configuration,
  UserSourceAuthenticationApi,
} from '@equisoft/ucx-proxy-sdk-typescript';
import type { ListUserSourceAuthenticationRequest } from '@equisoft/ucx-proxy-sdk-typescript';

async function example() {
  console.log("🚀 Testing @equisoft/ucx-proxy-sdk-typescript SDK...");
  const config = new Configuration({ 
    // To configure OAuth2 access token for authorization: default accessCode
    accessToken: "YOUR ACCESS TOKEN",
  });
  const api = new UserSourceAuthenticationApi(config);

  const body = {
    // string
    userId: userId_example,
  } satisfies ListUserSourceAuthenticationRequest;

  try {
    const data = await api.listUserSourceAuthentication(body);
    console.log(data);
  } catch (error) {
    console.error(error);
  }
}

// Run the test
example().catch(console.error);
```

### Parameters


| Name | Type | Description  | Notes |
|------------- | ------------- | ------------- | -------------|
| **userId** | `string` |  | [Defaults to `undefined`] |

### Return type

[**ListUserSourceAuthenticationResultSchema**](ListUserSourceAuthenticationResultSchema.md)

### Authorization

[default accessCode](../README.md#default-accessCode)

### HTTP request headers

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


### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | Success |  -  |
| **500** | An unexpected error happened. |  -  |

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


## updateUserSourceAuthentication

> UserSourceAuthenticationResultSchema updateUserSourceAuthentication(userId, sourceKey, updatePayloadUserSourceAuthenticationSchema)

Update the credentials of a given source for a user

### Example

```ts
import {
  Configuration,
  UserSourceAuthenticationApi,
} from '@equisoft/ucx-proxy-sdk-typescript';
import type { UpdateUserSourceAuthenticationRequest } from '@equisoft/ucx-proxy-sdk-typescript';

async function example() {
  console.log("🚀 Testing @equisoft/ucx-proxy-sdk-typescript SDK...");
  const config = new Configuration({ 
    // To configure OAuth2 access token for authorization: default accessCode
    accessToken: "YOUR ACCESS TOKEN",
  });
  const api = new UserSourceAuthenticationApi(config);

  const body = {
    // string
    userId: userId_example,
    // string
    sourceKey: sourceKey_example,
    // UpdatePayloadUserSourceAuthenticationSchema
    updatePayloadUserSourceAuthenticationSchema: ...,
  } satisfies UpdateUserSourceAuthenticationRequest;

  try {
    const data = await api.updateUserSourceAuthentication(body);
    console.log(data);
  } catch (error) {
    console.error(error);
  }
}

// Run the test
example().catch(console.error);
```

### Parameters


| Name | Type | Description  | Notes |
|------------- | ------------- | ------------- | -------------|
| **userId** | `string` |  | [Defaults to `undefined`] |
| **sourceKey** | `string` |  | [Defaults to `undefined`] |
| **updatePayloadUserSourceAuthenticationSchema** | [UpdatePayloadUserSourceAuthenticationSchema](UpdatePayloadUserSourceAuthenticationSchema.md) |  | |

### Return type

[**UserSourceAuthenticationResultSchema**](UserSourceAuthenticationResultSchema.md)

### Authorization

[default accessCode](../README.md#default-accessCode)

### HTTP request headers

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


### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | Success |  -  |
| **400** | Source not updated. Authentication may have failed. |  -  |
| **404** | Source Authentication not found |  -  |
| **500** | An unexpected error happened. |  -  |

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

