npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

cafe24-api-client

v1.8.4

Published

[![npm](https://img.shields.io/badge/npm-CB3837?style=for-the-badge&logo=npm&logoColor=white)](https://www.npmjs.com/package/cafe24-api-client) [![github](https://img.shields.io/badge/GitHub-100000?style=for-the-badge&logo=github&logoColor=white)](https:/

Readme

cafe24-api-client

npm github

카페24 REST API HTTP 클라이언트입니다.

Installation

npm install cafe24-api-client

Usage

Quick Start

import api from 'cafe24-api-client';

const client = new api.admin.Client({
  mallId: 'myMallId',
  taskQueue: true, // Cafe24의 Rate limit을 준수하는 TaskQueue를 사용합니다.
  accessToken: "token", // Admin API 엑세스를 위한 Access Token
});

const { products } = await client.products.retrieveAListOfProducts(
  {
    display: "T",
    selling: "T",
    limit: 100,
  },
  { 
    // `api.admin.Client` 생성 시 accessToken을 설정하지 않고 
    // API 요청 시마다 accessToken을 설정할 수 있습니다.
    accessToken: "token", 
    // API 요청이 TaskQueue를 통해 실행되도록 하여
    // Cafe24의 Rate limit을 준수할 수 있습니다.
    fetchPolicy: "queue",
  },
);

console.log(products);

Client의 종류

Cafe24에서는 admin, front, d.collection, analytics의 4개 종류의 API를 제공하며, 본 라이브러리에서는 이 4개의 API에 대한 Client를 각각 제공합니다.

import api from 'cafe24-api-client';

const admin = new api.admin.Client({/* ... */} satisfies api.admin.ClientOptions);
const front = new api.front.Client({/* ... */} satisfies api.front.ClientOptions);
const dcollection = new api.dcollection.Client({/* ... */} satisfies api.dcollection.ClientOptions);
const analytics = new api.analytics.Client({/* ... */} satisfies api.analytics.ClientOptions);

Client의 구성

각 client는 해당 documentation 페이지의 toc 구조를 따라 method를 제공합니다.

예를 들어, front API의 경우 Categories products 섹션이 존재합니다.

여기서 Categories products 는 특수문자를 제외한 lowercase로 변환되어 categoriesproducts라는 이름의 scope가 됩니다.

이 scope는 Categories products 섹션의 *properties 섹션을 제외한 하위 섹션들을 method로 제공합니다. 이때 method의 이름은 해당 섹션의 해시를 camelCase로 변환한 것이 됩니다.

  • https://developers.cafe24.com/docs/ko/api/front/#retrieve-a-list-of-products-by-category : retrieveAListOfProductsByCategory
  • https://developers.cafe24.com/docs/ko/api/front/#retrieve-a-count-of-products-by-category : retrieveACountOfProductsByCategory

위의 내용들을 코드로 정리하면 아래와 같습니다.

import api from 'cafe24-api-client';

const front = new api.front.Client({
  clientId: 'myClientId',
});

const { products } = await front.categoriesproducts.retrieveAListOfProductsByCategory(
  {
    categoryNo: 1,
    limit: 100,
  },
  { fetchPolicy: "queue" },
);

console.log(products);

Request/Response 타입 가져오기

각 API 요청의 Request, Response 스키마는 interface로 정의되어 있는데, 본 패키지에서는 그 수가 너무 많아 이들을 직접 export 하지 않습니다.

대신, RequestTypeResponseType을 사용하여 Request, Response 타입을 가져올 수 있습니다.

import api, { RequestType, ResponseType } from 'cafe24-api-client';

type RetrieveAListOfProductsRequest = RequestType<api.admin.Client['products']['retrieveAListOfProducts']>;
type RetrieveAListOfProductsResponse = ResponseType<api.admin.Client['products']['retrieveAListOfProducts']>;

Everything is camelCased

모든 method의 request 타입, response 타입의 property는 camelCase로 변환되어 있습니다.

이는 camelCase가 JS/TS에서 일반적으로 사용되는 네이밍 컨벤션이기 때문입니다.

License

MIT