This commit is contained in:
2025-11-18 20:47:48 +00:00
commit 747fb787e1
38 changed files with 18518 additions and 0 deletions

View File

@@ -0,0 +1,82 @@
import type { PeeringDbClient } from './peeringdb.classes.client.js';
import type { INetIxLan } from './interfaces/peeringdb.api.netixlan.js';
import type { IQueryOptions } from './peeringdb.types.js';
/**
* Manager for NetIxLan resources (network presence at IX)
*/
export class NetIxLanManager {
constructor(private client: PeeringDbClient) {}
/**
* List network-IX connections with optional filtering
*/
async list(options: IQueryOptions = {}): Promise<INetIxLan[]> {
return this.client.request<INetIxLan>('netixlan', 'GET', options);
}
/**
* Get a single network-IX connection by ID
*/
async getById(id: number, depth?: 0 | 1 | 2): Promise<INetIxLan | null> {
const options: IQueryOptions = { id };
if (depth !== undefined) {
options.depth = depth;
}
const results = await this.client.request<INetIxLan>('netixlan', 'GET', options);
return results[0] || null;
}
/**
* Get network-IX connections by network ID
*/
async getByNetId(netId: number, options: IQueryOptions = {}): Promise<INetIxLan[]> {
return this.client.request<INetIxLan>('netixlan', 'GET', {
...options,
net_id: netId,
});
}
/**
* Get network-IX connections by IX LAN ID
*/
async getByIxLanId(ixlanId: number, options: IQueryOptions = {}): Promise<INetIxLan[]> {
return this.client.request<INetIxLan>('netixlan', 'GET', {
...options,
ixlan_id: ixlanId,
});
}
/**
* Get network-IX connections by ASN
*/
async getByAsn(asn: number, options: IQueryOptions = {}): Promise<INetIxLan[]> {
return this.client.request<INetIxLan>('netixlan', 'GET', {
...options,
asn,
});
}
/**
* Create a new network-IX connection (requires authentication)
*/
async create(data: Partial<INetIxLan>): Promise<INetIxLan> {
const results = await this.client.request<INetIxLan>('netixlan', 'POST', {}, data);
return results[0];
}
/**
* Update a network-IX connection (requires authentication)
*/
async update(id: number, data: Partial<INetIxLan>): Promise<INetIxLan> {
const results = await this.client.request<INetIxLan>(`netixlan/${id}`, 'PUT', {}, data);
return results[0];
}
/**
* Delete a network-IX connection (requires authentication)
*/
async delete(id: number): Promise<void> {
await this.client.request('netixlan', 'DELETE', { id });
}
}