# PowerIAM.PermissionApi

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

Method | HTTP request | Description
------------- | ------------- | -------------
[**createPermission**](PermissionApi.md#createPermission) | **POST** /v2/create-permission | 
[**deletePermission**](PermissionApi.md#deletePermission) | **DELETE** /v2/delete-permission | 
[**editPermission**](PermissionApi.md#editPermission) | **PUT** /v2/edit-permission | 
[**getPermission**](PermissionApi.md#getPermission) | **GET** /v2/get-permission | 
[**getPermissions**](PermissionApi.md#getPermissions) | **GET** /v2/get-permissions | 

<a name="createPermission"></a>
# **createPermission**
> PermissionV2 createPermission(body)



Create a permission in a realm.

### Example
```javascript
import {PowerIAM} from '@poweriam/sdk';
let defaultClient = PowerIAM.ApiClient.instance;

// Configure API key authorization: JWT Token
let JWT Token = defaultClient.authentications['JWT Token'];
JWT Token.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//JWT Token.apiKeyPrefix = 'Token';

let apiInstance = new PowerIAM.PermissionApi();
let body = new PowerIAM.CreatePermissionCommandV2(); // CreatePermissionCommandV2 | 

apiInstance.createPermission(body, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
});
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **body** | [**CreatePermissionCommandV2**](CreatePermissionCommandV2.md)|  | 

### Return type

[**PermissionV2**](PermissionV2.md)

### Authorization

[JWT Token](../README.md#JWT Token)

### HTTP request headers

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

<a name="deletePermission"></a>
# **deletePermission**
> &#x27;String&#x27; deletePermission(opts)



Delete a permission.

### Example
```javascript
import {PowerIAM} from '@poweriam/sdk';
let defaultClient = PowerIAM.ApiClient.instance;

// Configure API key authorization: JWT Token
let JWT Token = defaultClient.authentications['JWT Token'];
JWT Token.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//JWT Token.apiKeyPrefix = 'Token';

let apiInstance = new PowerIAM.PermissionApi();
let opts = { 
  'permissionId': "permissionId_example" // String | 
};
apiInstance.deletePermission(opts, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
});
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **permissionId** | **String**|  | [optional] 

### Return type

**&#x27;String&#x27;**

### Authorization

[JWT Token](../README.md#JWT Token)

### HTTP request headers

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

<a name="editPermission"></a>
# **editPermission**
> PermissionV2 editPermission(opts)



Edit a permission in a realm.

### Example
```javascript
import {PowerIAM} from '@poweriam/sdk';
let defaultClient = PowerIAM.ApiClient.instance;

// Configure API key authorization: JWT Token
let JWT Token = defaultClient.authentications['JWT Token'];
JWT Token.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//JWT Token.apiKeyPrefix = 'Token';

let apiInstance = new PowerIAM.PermissionApi();
let opts = { 
  'permissionId': "permissionId_example", // String | 
  'domainId': "domainId_example", // String | 
  'name': "name_example", // String | 
  'description': "description_example", // String | 
  'externalId': "externalId_example" // String | 
};
apiInstance.editPermission(opts, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
});
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **permissionId** | **String**|  | [optional] 
 **domainId** | **String**|  | [optional] 
 **name** | **String**|  | [optional] 
 **description** | **String**|  | [optional] 
 **externalId** | **String**|  | [optional] 

### Return type

[**PermissionV2**](PermissionV2.md)

### Authorization

[JWT Token](../README.md#JWT Token)

### HTTP request headers

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

<a name="getPermission"></a>
# **getPermission**
> PermissionV2 getPermission(opts)



Get a permission.

### Example
```javascript
import {PowerIAM} from '@poweriam/sdk';
let defaultClient = PowerIAM.ApiClient.instance;

// Configure API key authorization: JWT Token
let JWT Token = defaultClient.authentications['JWT Token'];
JWT Token.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//JWT Token.apiKeyPrefix = 'Token';

let apiInstance = new PowerIAM.PermissionApi();
let opts = { 
  'permissionId': "permissionId_example" // String | 
};
apiInstance.getPermission(opts, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
});
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **permissionId** | **String**|  | [optional] 

### Return type

[**PermissionV2**](PermissionV2.md)

### Authorization

[JWT Token](../README.md#JWT Token)

### HTTP request headers

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

<a name="getPermissions"></a>
# **getPermissions**
> [PermissionV2] getPermissions(opts)



Get all permissions in the world, or in a realm.

### Example
```javascript
import {PowerIAM} from '@poweriam/sdk';
let defaultClient = PowerIAM.ApiClient.instance;

// Configure API key authorization: JWT Token
let JWT Token = defaultClient.authentications['JWT Token'];
JWT Token.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//JWT Token.apiKeyPrefix = 'Token';

let apiInstance = new PowerIAM.PermissionApi();
let opts = { 
  'inRealmId': "inRealmId_example", // String | 
  'inDomainId': "inDomainId_example" // String | 
};
apiInstance.getPermissions(opts, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
});
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **inRealmId** | **String**|  | [optional] 
 **inDomainId** | **String**|  | [optional] 

### Return type

[**[PermissionV2]**](PermissionV2.md)

### Authorization

[JWT Token](../README.md#JWT Token)

### HTTP request headers

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

