@ningboyz/ding 1.0.9 → 1.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,10 @@
1
+ import { IAxiosConfig } from '../types/core/IAxiosConfig';
2
+ import { IResponse } from '@ningboyz/types';
3
+ declare class DingRequest {
4
+ private instance;
5
+ private constructor();
6
+ static create(config: IAxiosConfig): DingRequest;
7
+ post<T>(url: string, querys?: object, data?: object, headers?: object): Promise<IResponse<T>>;
8
+ }
9
+ declare const createDingRequest: (config: IAxiosConfig) => DingRequest;
10
+ export { type DingRequest, createDingRequest };
@@ -0,0 +1,31 @@
1
+ import m from "axios";
2
+ import { TResponse as u } from "../node_modules/.pnpm/@ningboyz_types@1.2.150/node_modules/@ningboyz/types/src/response/IResponse.js";
3
+ class r {
4
+ instance;
5
+ constructor(t) {
6
+ this.instance = m.create({
7
+ baseURL: t.baseURL,
8
+ timeout: t.timeout
9
+ });
10
+ }
11
+ static create(t) {
12
+ return new r(t);
13
+ }
14
+ post(t, n, o, c) {
15
+ return new Promise((s) => {
16
+ this.instance.post(t, o, {
17
+ params: n,
18
+ headers: c
19
+ }).then((e) => {
20
+ s(e.data);
21
+ }).catch((e) => {
22
+ const i = u.toError(JSON.stringify(e));
23
+ s(i);
24
+ });
25
+ });
26
+ }
27
+ }
28
+ const R = (a) => r.create(a);
29
+ export {
30
+ R as createDingRequest
31
+ };
@@ -0,0 +1,26 @@
1
+ import { IDingConfig } from '../types/core/IDingConfig';
2
+ import { IGetUserInfoByAuthCodeQuerys } from '../types/request/IGetUserInfoByAuthCodeQuerys';
3
+ import { IDingTalkUserAuthCodeResponse } from '../types/response/IDingTalkUserAuthCodeResponse';
4
+ import { IGetUserInfoByQrCodeQuerys } from '../types/request/IGetUserInfoByQrCodeQuerys';
5
+ declare class DingClient {
6
+ private prefixURL;
7
+ private config;
8
+ private dingRequest;
9
+ private constructor();
10
+ static create: (config: IDingConfig) => DingClient;
11
+ private createURL;
12
+ /**
13
+ * 通过临时授权码获取用户信息
14
+ * @param querys
15
+ * @returns
16
+ */
17
+ getUserInfoByAuthCode(querys: IGetUserInfoByAuthCodeQuerys): Promise<import('@ningboyz/types').IResponse<IDingTalkUserAuthCodeResponse[]>>;
18
+ /**
19
+ * 扫码通过临时授权码获取用户信息
20
+ * @param querys
21
+ * @returns
22
+ */
23
+ getUserInfoByQrCode(querys: IGetUserInfoByQrCodeQuerys): Promise<import('@ningboyz/types').IResponse<IDingTalkUserAuthCodeResponse[]>>;
24
+ }
25
+ declare const createDingClient: (config: IDingConfig) => DingClient;
26
+ export { type DingClient, createDingClient };
@@ -0,0 +1,33 @@
1
+ import { createDingRequest as s } from "../axios/dingRequest.js";
2
+ class r {
3
+ prefixURL = "dapi";
4
+ config;
5
+ dingRequest;
6
+ constructor(e) {
7
+ this.config = e, this.dingRequest = s({ baseURL: e.dingTalkURL, timeout: 6e4 });
8
+ }
9
+ static create = (e) => new r(e);
10
+ createURL = (e) => `/${this.prefixURL}${e}`;
11
+ /**
12
+ * 通过临时授权码获取用户信息
13
+ * @param querys
14
+ * @returns
15
+ */
16
+ getUserInfoByAuthCode(e) {
17
+ const t = this.createURL("/user/get_userinfo_by_authcode");
18
+ return this.dingRequest.post(t, e, void 0, { appid: this.config.appId });
19
+ }
20
+ /**
21
+ * 扫码通过临时授权码获取用户信息
22
+ * @param querys
23
+ * @returns
24
+ */
25
+ getUserInfoByQrCode(e) {
26
+ const t = this.createURL("/user/get_userinfo_by_qrcode");
27
+ return this.dingRequest.post(t, e, void 0, { appid: this.config.scanAppId });
28
+ }
29
+ }
30
+ const o = (i) => r.create(i);
31
+ export {
32
+ o as createDingClient
33
+ };
package/es/index.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ import { DingClient, createDingClient } from './client/dingClient';
2
+ import * as DCore from "./types/core";
3
+ import * as DRequest from "./types/request";
4
+ import * as DResponse from "./types/response";
5
+ export { type DingClient, createDingClient, DCore, DRequest, DResponse };
package/es/index.js ADDED
@@ -0,0 +1,10 @@
1
+ import { createDingClient as i } from "./client/dingClient.js";
2
+ import * as e from "./types/core/index.js";
3
+ import * as o from "./types/request/index.js";
4
+ import * as r from "./types/response/index.js";
5
+ export {
6
+ e as DCore,
7
+ o as DRequest,
8
+ r as DResponse,
9
+ i as createDingClient
10
+ };
@@ -0,0 +1,30 @@
1
+ import r from "lodash";
2
+ const T = class T {
3
+ };
4
+ T.toError = (A) => ({
5
+ DATASIZE: 0,
6
+ ERORCODE: -1,
7
+ ERORMEMO: A,
8
+ LISTDATA: [],
9
+ ONSTATUS: !1,
10
+ DATATIME: (/* @__PURE__ */ new Date()).getTime(),
11
+ DATADATE: 0,
12
+ REALPAGE: 0,
13
+ PAGESIZE: 0,
14
+ TOTALCNT: 0
15
+ }), T.toTrue = (A, E) => ({
16
+ DATASIZE: r.isArray(A) ? A.length : 0,
17
+ ERORCODE: 0,
18
+ ERORMEMO: E,
19
+ LISTDATA: A,
20
+ ONSTATUS: !0,
21
+ DATATIME: (/* @__PURE__ */ new Date()).getTime(),
22
+ DATADATE: 0,
23
+ REALPAGE: 0,
24
+ PAGESIZE: 0,
25
+ TOTALCNT: 0
26
+ });
27
+ let t = T;
28
+ export {
29
+ t as TResponse
30
+ };
@@ -0,0 +1,8 @@
1
+ export interface IAxiosConfig {
2
+ baseURL: string;
3
+ timeout: number;
4
+ }
5
+ export declare class TAxiosConfig implements IAxiosConfig {
6
+ baseURL: string;
7
+ timeout: number;
8
+ }
@@ -0,0 +1,7 @@
1
+ class o {
2
+ baseURL = "";
3
+ timeout = 6e4;
4
+ }
5
+ export {
6
+ o as TAxiosConfig
7
+ };
@@ -0,0 +1,10 @@
1
+ export interface IDingConfig {
2
+ appId: string;
3
+ scanAppId: string;
4
+ dingTalkURL: string;
5
+ }
6
+ export declare class TDingConfig implements IDingConfig {
7
+ appId: string;
8
+ scanAppId: string;
9
+ dingTalkURL: string;
10
+ }
@@ -0,0 +1,8 @@
1
+ class a {
2
+ appId = "";
3
+ scanAppId = "";
4
+ dingTalkURL = "";
5
+ }
6
+ export {
7
+ a as TDingConfig
8
+ };
@@ -0,0 +1,3 @@
1
+ import { IAxiosConfig, TAxiosConfig } from './IAxiosConfig';
2
+ import { IDingConfig, TDingConfig } from './IDingConfig';
3
+ export { type IAxiosConfig, type IDingConfig, TAxiosConfig, TDingConfig };
@@ -0,0 +1,6 @@
1
+ import { TAxiosConfig as i } from "./IAxiosConfig.js";
2
+ import { TDingConfig as g } from "./IDingConfig.js";
3
+ export {
4
+ i as TAxiosConfig,
5
+ g as TDingConfig
6
+ };
@@ -0,0 +1,6 @@
1
+ export interface IGetUserInfoByAuthCodeQuerys {
2
+ authcode: string;
3
+ }
4
+ export declare class TGetUserInfoByAuthCodeQuerys implements IGetUserInfoByAuthCodeQuerys {
5
+ authcode: string;
6
+ }
@@ -0,0 +1,6 @@
1
+ class o {
2
+ authcode = "";
3
+ }
4
+ export {
5
+ o as TGetUserInfoByAuthCodeQuerys
6
+ };
@@ -0,0 +1,6 @@
1
+ export interface IGetUserInfoByQrCodeQuerys {
2
+ authcode: string;
3
+ }
4
+ export declare class TGetUserInfoByQrCodeQuerys implements IGetUserInfoByQrCodeQuerys {
5
+ authcode: string;
6
+ }
@@ -0,0 +1,6 @@
1
+ class o {
2
+ authcode = "";
3
+ }
4
+ export {
5
+ o as TGetUserInfoByQrCodeQuerys
6
+ };
@@ -0,0 +1,3 @@
1
+ import { IGetUserInfoByAuthCodeQuerys, TGetUserInfoByAuthCodeQuerys } from './IGetUserInfoByAuthCodeQuerys';
2
+ import { IGetUserInfoByQrCodeQuerys, TGetUserInfoByQrCodeQuerys } from './IGetUserInfoByQrCodeQuerys';
3
+ export { type IGetUserInfoByAuthCodeQuerys, type IGetUserInfoByQrCodeQuerys, TGetUserInfoByAuthCodeQuerys, TGetUserInfoByQrCodeQuerys };
@@ -0,0 +1,6 @@
1
+ import { TGetUserInfoByAuthCodeQuerys as o } from "./IGetUserInfoByAuthCodeQuerys.js";
2
+ import { TGetUserInfoByQrCodeQuerys as f } from "./IGetUserInfoByQrCodeQuerys.js";
3
+ export {
4
+ o as TGetUserInfoByAuthCodeQuerys,
5
+ f as TGetUserInfoByQrCodeQuerys
6
+ };
@@ -0,0 +1,14 @@
1
+ export interface IDingTalkUserAuthCodeResponse {
2
+ accountId: string;
3
+ userName: string;
4
+ employeeCode: string;
5
+ avatar: string;
6
+ encryptData: string;
7
+ }
8
+ export declare class TDingTalkUserAuthCodeResponse implements IDingTalkUserAuthCodeResponse {
9
+ accountId: string;
10
+ userName: string;
11
+ employeeCode: string;
12
+ avatar: string;
13
+ encryptData: string;
14
+ }
@@ -0,0 +1,10 @@
1
+ class a {
2
+ accountId = "";
3
+ userName = "";
4
+ employeeCode = "";
5
+ avatar = "";
6
+ encryptData = "";
7
+ }
8
+ export {
9
+ a as TDingTalkUserAuthCodeResponse
10
+ };
@@ -0,0 +1,2 @@
1
+ import { IDingTalkUserAuthCodeResponse, TDingTalkUserAuthCodeResponse } from './IDingTalkUserAuthCodeResponse';
2
+ export { type IDingTalkUserAuthCodeResponse, TDingTalkUserAuthCodeResponse };
@@ -0,0 +1,4 @@
1
+ import { TDingTalkUserAuthCodeResponse as r } from "./IDingTalkUserAuthCodeResponse.js";
2
+ export {
3
+ r as TDingTalkUserAuthCodeResponse
4
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ningboyz/ding",
3
- "version": "1.0.9",
3
+ "version": "1.0.10",
4
4
  "private": false,
5
5
  "description": "宁波甬政钉钉库",
6
6
  "author": "nbyt-syq",