2.3.1 • Published 8 days ago

@redhat-cloud-services/notifications-client v2.3.1

Weekly downloads
131
License
Apache-2.0
Repository
github
Last release
8 days ago

Javascript client for Notifications API

If you want to use RedHatInsights/notifications-backend you shouldn't use get requests directly, but rather use this client to integrate with this service.

Install

NPM

npm install --save @redhat-cloud-services/notifications-client

Or Yarn

yarn add @redhat-cloud-services/notifications-client

Usage

This client is using typescript and axios. Types are distributed with this package, so no need to define or install them separately.

To correctly bootstrap this API you should use this config (no need to define it multiple times, just one config and reimport it anywhere you want to use it).

// api.js
import APIFactory from '@redhat-cloud-services/notifications-client/utils'; 
import createBehaviorGroup from '@redhat-cloud-services/notifications-client/NotificationResourceV1CreateBehaviorGroup';
import updateBehaviorGroup from '@redhat-cloud-services/notifications-client/NotificationResourceV1UpdateBehaviorGroup';
import deleteBehaviorGroup from '@redhat-cloud-services/notifications-client/NotificationResourceV1DeleteBehaviorGroup';


// BASE_PATH should be set in your constants file
const notificationsApi = APIFactory(BASE_PATH, undefined, { createBehaviorGroup, updateBehaviorGroup, deleteBehaviorGroup });
export notificationsApi;

If you want to add some interceptors you can use axios build in interceptors

// api.js
import axios from 'axios';
import { NotificationsApi } from '@redhat-cloud-services/notifications-client';
const instance = axios.create();

// Request interceptor
instance.interceptors.request.use((request) => {
    // some logic to do with request
});

// Response interceptor
instance.interceptors.response.use((response) => {
    // some logic to do with request
});

// Error interceptor
instance.interceptors.response.use(null, (error) => {
    // some logic to do with error
});

// BASE_PATH should be set in your constants file
const notificationsApi = APIFactory(BASE_PATH, instance, { createBehaviorGroup, updateBehaviorGroup, deleteBehaviorGroup });
export notificationsApi;

Building

Run nx build @redhat-cloud-services/notifications-client to build the library.

Running unit tests

Run nx test @redhat-cloud-services/notifications-client to execute the unit tests via Jest.

API documentation

2.3.1

8 days ago

2.3.0

17 days ago

2.2.1

1 month ago

2.2.3

1 month ago

2.2.2

1 month ago

2.2.4

1 month ago

2.2.0

2 months ago

2.0.6

5 months ago

1.0.0

8 months ago

2.0.3

7 months ago

2.0.2

7 months ago

2.0.5

6 months ago

2.0.4

7 months ago

2.0.1

8 months ago

2.0.0

8 months ago

1.0.112

2 years ago

1.0.111

2 years ago

1.0.109

2 years ago

1.0.110

2 years ago

1.0.108

2 years ago

1.0.107

2 years ago

1.0.106

2 years ago

1.0.105

2 years ago

1.0.104

2 years ago

1.0.103

3 years ago

1.0.102

3 years ago

1.0.101

3 years ago

1.0.100

3 years ago

1.0.99

3 years ago

1.0.98

3 years ago

1.0.97

3 years ago

1.0.96

3 years ago

1.0.95

3 years ago

1.0.94

3 years ago

1.0.93

3 years ago

1.0.91

3 years ago

1.0.92

3 years ago

1.0.90

3 years ago

1.0.89

3 years ago

1.0.88

3 years ago

1.0.87

3 years ago

1.0.86

3 years ago

1.0.85

3 years ago

1.0.84

4 years ago

1.0.83

4 years ago

1.0.82

4 years ago

1.0.81

4 years ago

1.0.80

4 years ago

1.0.79

4 years ago

1.0.78

4 years ago

1.0.77

4 years ago

1.0.76

4 years ago

1.0.75

4 years ago

1.0.74

4 years ago

1.0.73

4 years ago

1.0.72

4 years ago

1.0.71

4 years ago

1.0.70

4 years ago

1.0.69

4 years ago

1.0.68

4 years ago

1.0.67

4 years ago

1.0.66

4 years ago

1.0.65

4 years ago

1.0.64

4 years ago

1.0.63

4 years ago

1.0.62

4 years ago

1.0.61

4 years ago

1.0.60

4 years ago

1.0.59

4 years ago

1.0.58

4 years ago

1.0.57

4 years ago

1.0.55

4 years ago

1.0.56

4 years ago

1.0.54

4 years ago

1.0.53

4 years ago

1.0.52

4 years ago

1.0.51

4 years ago

1.0.50

4 years ago

1.0.49

4 years ago

1.0.48

4 years ago

1.0.47

4 years ago

1.0.46

4 years ago

1.0.45

4 years ago

1.0.44

4 years ago

1.0.43

4 years ago

1.0.42

4 years ago

1.0.41

4 years ago

0.0.40

4 years ago

1.0.39

4 years ago

1.0.38

5 years ago

1.0.37

5 years ago

1.0.36

5 years ago

1.0.35

5 years ago

1.0.34

5 years ago

1.0.33

5 years ago

1.0.32

5 years ago

1.0.31

5 years ago

1.0.30

5 years ago

1.0.29

5 years ago

1.0.28

5 years ago

1.0.27

5 years ago