### Install DMM SDK with npm Source: https://github.com/licht-77/dmm-sdk/blob/main/README.md Install the DMM Affiliate API v3 SDK using npm. This command adds the SDK package to your project's dependencies. ```bash npm install @licht-77/dmm-sdk ``` -------------------------------- ### Search Actresses using DMM API in TypeScript Source: https://github.com/licht-77/dmm-sdk/blob/main/README.md Perform a search for actresses using the DMM Affiliate API. This example shows how to filter actresses by initial, ID, or keyword and logs the results. ```typescript // 例: 女優検索 async function searchActresses() { try { const params = { initial: 'あ', // 頭文字 (任意) actress_id: '12345', // 女優ID (任意) keyword: '女優名', // キーワード (任意) hits: 5, offset: 1, }; const response = await client.searchActress(params); console.log('女優検索結果:', response.actress); } catch (error) { console.error('女優検索エラー:', error); } } searchActresses(); ``` -------------------------------- ### Get Floor List using DMM API in TypeScript Source: https://github.com/licht-77/dmm-sdk/blob/main/README.md Retrieve a list of available floors from the DMM Affiliate API. This function calls the `getFloorList` method and logs the site information from the response. ```typescript async function getFloors() { try { const response = await client.getFloorList(); console.log('フロア一覧:', response.site); } catch (error) { console.error('フロア一覧取得エラー:', error); } } getFloors(); ``` -------------------------------- ### Initialize DMM API Client in TypeScript Source: https://github.com/licht-77/dmm-sdk/blob/main/README.md Initialize the DMM API client by providing your API ID and Affiliate ID. These credentials can be obtained from the DMM affiliate management screen. An optional baseUrl can also be specified. ```typescript import { DmmApiClient } from '@licht-77/dmm-sdk'; const client = new DmmApiClient({ apiId: 'YOUR_API_ID', // あなたのAPI IDに置き換えてください affiliateId: 'YOUR_AFFILIATE_ID', // あなたのアフィリエイト ID に置き換えてください // baseUrl: 'https://api.dmm.com/affiliate/v3', // 任意: APIベースURL }); ``` -------------------------------- ### Search Items using DMM API in TypeScript Source: https://github.com/licht-77/dmm-sdk/blob/main/README.md Perform a product search using the DMM Affiliate API. This function demonstrates how to set search parameters like site, service, floor, hits, offset, sort, keyword, and article/article_id filters. It logs the search results and total count. ```typescript async function searchItems() { try { const params = { site: 'FANZA', // 検索対象サイト ('DMM.com' | 'FANZA') service: 'digital', // 検索対象サービス (任意) floor: 'videoa', // 検索対象フロア (任意) hits: 10, // 取得件数 (デフォルト: 20, 最大: 100) offset: 1, // 検索開始位置 (デフォルト: 1) sort: 'rank', // ソート順 (任意) keyword: 'キーワード', // 検索キーワード (任意) // 絞り込み(配列のみ対応) article: ['genre', 'actress'], article_id: ['6003', '15187'], // ... その他、API仕様で定義されているパラメータ }; const response = await client.getItemList(params); console.log('検索結果:', response.items); console.log('総件数:', response.total_count); } catch (error) { console.error('商品検索エラー:', error); } } searchItems(); ``` -------------------------------- ### Import Type Definitions in TypeScript Source: https://github.com/licht-77/dmm-sdk/blob/main/README.md Import type definitions for request parameters and responses from the DMM SDK. This enables type checking in TypeScript projects. ```typescript import { ItemListRequestParams, ItemListResponse, Item } from '@licht-77/dmm-sdk'; ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.