Skip to content

Commit

Permalink
Merge pull request #8 from jakubrekowski/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
jakubrekowski authored Oct 20, 2024
2 parents cb4fbfe + 45e29b1 commit 3e5e202
Show file tree
Hide file tree
Showing 9 changed files with 492 additions and 21 deletions.
61 changes: 49 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<img src="./assets/un_notice.svg" height="150px" alt="UN Notice" />
</a>

A TypeScript library for easily interacting with the Interpol public Notices API. This library provides a convenient, type-safe way to access data on Red, Yellow, and possibly in the future, other Interpol notices.
A TypeScript library for easily interacting with the Interpol public Notices API. This library provides a convenient, type-safe way to access data on Red, Yellow Interpol notices, and INTERPOL-United Nations Security Council Special Notices.

## Contents

Expand Down Expand Up @@ -66,22 +66,22 @@ It is important to note that Interpol notices are not international arrest warra

## Development Status

Currently, this library focuses on retrieving and interacting with **Red Notices**. Support for **Yellow** and **UN Notices** is planned for future releases but is not yet implemented. Contributions are welcome to accelerate the development of these features!
This library currently supports retrieving and interacting with **Red Notices** and **Yellow Notices**. Support for **INTERPOL-United Nations Security Council Special Notices** is planned for future releases but is not yet implemented. Contributions are welcome to accelerate the development of these features!

You can track the progress of these planned features in the project's issue tracker. We encourage community involvement in prioritizing and implementing support for additional notice types.

## Installation

```bash
npm install @jakubrekowski/interpol.ts
npm install interpol.ts
# or
yarn add @jakubrekowski/interpol.ts
yarn add interpol.ts
```

## Usage

```typescript
import { InterpolService } from "@jakubrekowski/interpol.ts";
import { InterpolService } from "interpol.ts";

async function getRedNotices() {
try {
Expand Down Expand Up @@ -146,26 +146,47 @@ cancelRedNoticeRequest();

## API Reference

### `InterpolService.getRedNotices(query?: RedNoticesQuery): CancelablePromise<RedNoticesEntitiy>`
### `InterpolService.getRedNotices(query?: RedNoticesQuery): CancelablePromise<RedNoticesEntity>`

Retrieves a list of Red Notices.

- **`query`**: Optional query parameters to filter the results (see `RedNoticesQuery` interface below).
- **Returns**: A `CancelablePromise` that resolves to a `RedNoticesEntitiy` object.
- **Returns**: A `CancelablePromise` that resolves to a `RedNoticesEntity` object.

### `InterpolService.getRedNoticeDetails(noticeID: string): CancelablePromise<RedNoticeDetailsEntitiy>`
### `InterpolService.getRedNoticeDetails(noticeID: string): CancelablePromise<RedNoticeDetailsEntity>`

Retrieves details for a specific Red Notice.

- **`noticeID`**: The ID of the Red Notice.
- **Returns**: A `CancelablePromise` that resolves to a `RedNoticeDetailsEntitiy` object.
- **Returns**: A `CancelablePromise` that resolves to a `RedNoticeDetailsEntity` object.

### `InterpolService.getRedNoticeDetailImages(noticeID: string): CancelablePromise<RedNoticeDetailImagesEntitiy>`
### `InterpolService.getRedNoticeDetailImages(noticeID: string): CancelablePromise<RedNoticeDetailImagesEntity>`

Retrieves images for a specific Red Notice.

- **`noticeID`**: The ID of the Red Notice.
- **Returns**: A `CancelablePromise` that resolves to a `RedNoticeDetailImagesEntitiy` object.
- **Returns**: A `CancelablePromise` that resolves to a `RedNoticeDetailImagesEntity` object.

### `InterpolService.getYellowNotices(query?: YellowNoticesQuery): CancelablePromise<YellowNoticesEntity>`

Retrieves a list of Yellow Notices.

- **`query`**: Optional query parameters to filter the results (see `YellowNoticesQuery` interface below).
- **Returns**: A `CancelablePromise` that resolves to a `YellowNoticesEntity` object.

### `InterpolService.getYellowNoticeDetails(noticeID: string): CancelablePromise<YellowNoticeDetailsEntity>`

Retrieves details for a specific Yellow Notice.

- **`noticeID`**: The ID of the Yellow Notice.
- **Returns**: A `CancelablePromise` that resolves to a `YellowNoticeDetailsEntity` object.

### `InterpolService.getYellowNoticeDetailImages(noticeID: string): CancelablePromise<YellowNoticeDetailImagesEntity>`

Retrieves images for a specific Yellow Notice.

- **`noticeID`**: The ID of the Yellow Notice.
- **Returns**: A `CancelablePromise` that resolves to a `YellowNoticeDetailImagesEntity` object.

### `RedNoticesQuery` Interface

Expand All @@ -180,7 +201,23 @@ interface RedNoticesQuery {
sexId?: "F" | "M" | "U"; // Sex ID
arrestWarrantCountryId?: string; // Country ID of arrest warrant (two-digit country code)
page?: number; // Page number for pagination
resultPerPage?: number; // Number of results per page
resultPerPage?: number; // Number of results per page; maximum is 160
}
```

### `YellowNoticesQuery` Interface

```typescript
interface YellowNoticesQuery {
forename?: string; // First name
name?: string; // Last name
nationality?: string; // Nationality (two-digit country code)
ageMax?: number; // Maximum age
ageMin?: number; // Minimum age
freeText?: string; // Free text search
sexId?: "F" | "M" | "U"; // Sex ID
page?: number; // Page number for pagination
resultPerPage?: number; // Number of results per page; maximum is 160
}
```

Expand Down
2 changes: 1 addition & 1 deletion src/models/RedNoticeDetailImages.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Represents the Red Notice Detail Images.
*/
export type RedNoticeDetailImagesEntitiy = {
export type RedNoticeDetailImagesEntity = {
/**
* Contains embedded images.
*/
Expand Down
2 changes: 1 addition & 1 deletion src/models/RedNoticeDetails.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Represents the details of a Red Notice entity.
*/
export type RedNoticeDetailsEntitiy = {
export type RedNoticeDetailsEntity = {
/**
* List of arrest warrants associated with the entity.
*/
Expand Down
2 changes: 1 addition & 1 deletion src/models/RedNotices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export interface RedNoticesQuery {
/**
* Represents a collection of Red Notices.
*/
export type RedNoticesEntitiy = {
export type RedNoticesEntity = {
/**
* The total number of Red Notices.
*/
Expand Down
53 changes: 53 additions & 0 deletions src/models/YellowNoticeDetailImages.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/**
* Represents the Yellow Notice Detail Images.
*/
export type YellowNoticeDetailImagesEntity = {
/**
* Contains embedded images.
*/
_embedded: {
/**
* Array of image objects.
*/
images: {
/**
* The ID of the picture.
*/
picture_id: string;
/**
* Links related to the image.
*/
_links: {
/**
* Link to the image itself.
*/
self: {
href: string;
};
};
}[];
};
/**
* Links related to the yellow notice.
*/
_links: {
/**
* Link to the yellow notice detail images.
*/
self: {
href: string;
};
/**
* Link to the notice.
*/
notice: {
href: string;
};
/**
* Link to the thumbnail image.
*/
thumbnail: {
href: string;
};
};
};
118 changes: 118 additions & 0 deletions src/models/YellowNoticeDetails.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
/**
* Represents the details of a Yellow Notice entity.
*/
export type YellowNoticeDetailsEntity = {
/**
* The country associated with the entity. Two digit country code.
*/
country: string;
/**
* The date of birth of the entity.
*/
date_of_birth?: string;
/**
* The name of the entity's mother.
*/
mother_name?: string;
/**
* List of countries likely to be visited by the entity. Two digit country code.
*/
countries_likely_to_be_visited: string[];
/**
* The forename of the entity's mother.
*/
mother_forename?: string;
/**
* The nationalities of the entity. Two digit country code.
*/
nationalities: string[];
/**
* The ID representing the eye color of the entity.
*/
eye_colors_id?: string;
/**
* The sex of the entity.
*/
sex_id?: "F" | "M" | "U";
/**
* The ID representing the hair type of the entity.
*/
hairs_id?: string;
/**
* The place associated with the entity.
*/
place: string;
/**
* List of IDs representing languages spoken by the entity. Three digit language code.
*/
language_spoken_ids: string[];
/**
* The date of the event related to the entity.
*/
date_of_event?: string;
/**
* The height of the entity.
*/
height?: number;
/**
* The forename of the entity's father.
*/
father_forename?: string;
/**
* Distinguishing marks of the entity.
*/
distinguishing_marks?: string;
/**
* The birth name of the entity.
*/
birth_name?: string;
/**
* The weight of the entity.
*/
weight?: number;
/**
* The unique identifier for the entity.
*/
entity_id: string;
/**
* The place of birth of the entity.
*/
place_of_birth?: string;
/**
* The name of the entity's father.
*/
father_name?: string;
/**
* The name of the entity.
*/
name: string;
_embedded: {
/**
* Array of link URLs.
*/
links: string[];
};
/**
* Hyperlinks related to the entity.
*/
_links: {
/**
* The self-reference hyperlink.
*/
self: {
href: string;
};
/**
* Link to images associated with the entity.
*/
images: {
href: string;
};
/**
* Link to the thumbnail image associated with the entity.
*/
thumbnail: {
href: string;
};
};
};
Loading

0 comments on commit 3e5e202

Please sign in to comment.