# Fetch User Events

```typescript
import authefyNodeClient from './path/to/@authefy/node-client';

/*
    filter(optional) - filters the query with selected information
    sort(optional) - ASC | DESC sorts the order of the edges
    size(optional) - limits the page size
    after(optional) - query user events after the given cursor
    before(optional) - query user events before the given cursor
*/

await authefyNodeClient.event.fetch({
    filter: {
        type: UserCreated | UserUpdated | UserDeleted,
    },
    sort: 'ASC',
    size: 5,
    after: 'gejtiwzosusivozi',
    before: 'mulfikpahfafiwas'
})
/* 
    returns: {
        edges: { node: UserEvent; cursor: string };
        endCursor?: string;
        totalCount: number;
    }
*/
```

UserEvent Object:&#x20;

```typescript
type UserEvent {
    id: string
    user: string;
    externalId?: string;
    application: string;
    type: UserCreated | UserUpdated | UserDeleted;
    body?: Record<string, any>;
    dateTimeCreated: string;
    cursor: string;
}
```
