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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@jiangzhx/kuaishou-marketing-api

v1.10.1-port.4

Published

TypeScript SDK ported from github.com/bububa/kwai-marketing-api for Kuaishou Magnetic Engine Marketing API.

Readme

@jiangzhx/kuaishou-marketing-api

基于社区 Go SDK github.com/bububa/kwai-marketing-api 转译的快手磁力引擎 Marketing API Node.js/TypeScript SDK。

源码不是快手官方 SDK。当前对标 Go 模块 v1.10.1

安装

npm install @jiangzhx/kuaishou-marketing-api

使用入口

import { SDKClient, advertiser, campaign, file, oauth, report, unit } from "@jiangzhx/kuaishou-marketing-api";

const client = new SDKClient(appId, secret);

const authorizeUrl = oauth.url(client, {
  redirect_uri: "https://example.com/callback",
  scope: ["ad:manage"],
});

const token = await oauth.accessToken(client, authCode);
const info = await advertiser.info(client, token.access_token ?? "", token.advertiser_id ?? 0);
const campaignId = await campaign.create(client, token.access_token ?? "", {
  advertiser_id: token.advertiser_id,
  campaign_name: "plan-1",
  type: 5,
});
const unitId = await unit.create(client, token.access_token ?? "", {
  advertiser_id: token.advertiser_id,
  campaign_id: campaignId,
  unit_name: "unit-1",
});

函数同时提供 camelCase 和 Go 原名:

await advertiser.Info(client, accessToken, advertiserId);
await oauth.AccessToken(client, authCode);

转译范围

业务文件由 adclipackages/codegen/src/kuaishou 解释器从 Go 源码生成,不是手翻。

bun run --cwd /path/to/adcli codegen:kuaishou:generate /path/to/kwai-marketing-api /path/to/kuaishou-marketing-api/src

当前生成规模对标上游 v1.10.1:209 个 API、534 个 model。core.SDKClient 仍是手写 runtime。对外入口和类型检查覆盖 oauthadvertiserdsp/campaigndsp/unitreportfilereport/asynctask

oauth.approvalList 额外接受官方成功码 code=1;其他接口仍只认 code=0report.materialReport 在响应没有 data 时返回顶层 total_count / details。Node ESM 目录导入在构建时改写成 */index.js

跳过的上游文件:api/track/*(不走 SDKClient)。OpenTelemetry 没有搬。

映射规则

  • Go 的 NewSDKClient(appID, secret) 映射为 new SDKClient(appId, secret)
  • Go 的 Url() 映射为 path(),避免和 JSON 字段 url(落地页)撞名。
  • Go 的 clt.Post/Get/Upload 保留为 client 方法;API 函数继续接收 (client, accessToken, ...)
  • Go context.Context 映射为可选 AbortSignal
  • Go uint64 / int64 ID 映射为 number | string,响应用 json-bigintstoreAsString: true 解析,避免大整数丢精度。
  • 请求/响应字段名保持官方 JSON snake_case,例如 advertiser_idaccess_token
  • Go 匿名嵌入 struct(如报表请求里的 ReportRequest)会摊平到生成 class 的字段和 encode()
  • 文件一一对应:api/advertiser/info.go -> src/api/advertiser/info.ts

源码许可

上游 SDK 使用 Apache-2.0。本包是衍生作品,保留同样许可证和上游署名。