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 🙏

© 2024 – Pkg Stats / Ryan Hefner

yxlolxy-open-api

v1.3.7

Published

A Useful Lib For Github,Gitee,Gaode,etc API

Downloads

226

Readme

✨ Features

  • 🏁 Published with es modules
  • ⚽ Support gitee api
  • ⚾ Support github api
  • ⛄ Support gaode weather api
  • 🎓 Other useful tool,such as date, base64, dom, etc.

🔨 Install

yarn add yxlolxy-open-api
# Or with npm:
npm i yxlolxy-open-api

🍴 Import

1. full import

import { xxx } from 'yxlolxy-open-api';

2. partial import

import xxx from 'yxlolxy-open-api/dist/third-party/yyy';

🔧 Usage

1. prepare to use gitee/github/gd api

import axios from "axios";
import { request, gitee, github, gd } from "yxlolxy-open-api";

const TOKEN = 'xxxxyyyyzzzzz'; // your personal access tokens
const USERNAME = 'username'; // your github/gitee account name
const REPONAME = 'repoName'; // your github/gitee repo name
const client = request.initAxiosInterceptors(axios); // optional,your can use your own interceptors
const GDKEY = '1231321321'; // gaode api access key
const giteeFetch = new gitee.Fetcher(client, TOKEN, USERNAME, REPO, isDev());
const githubFetch = new github.Fetcher(client, TOKEN, USERNAME, REPO, isDev());

const gdFetch = new gd.Fetcher(client, GDKEY, isDev())
export {giteeFetch, githubFetch, gdFetch}; // import anywhere you need
...

2. gitee api list

// get content of a repo file, sunch as /test/a.json, add content to the repo file or update、delete
getContent(filenameWithPath?: string): Promise<any>;
addContent(filenameWithPath: string, content: string): Promise<any>;
updateContent(filenameWithPath: string, content: string, sha: string): Promise<any>;
deleteContent(filenameWithPath: string, sha: string): Promise<any>;

// get all labels of your repo
getLabels(): Promise<any>;
// get issues of your repo
getIssues(page: number, per_page: number, labels?: string[], sort?: 'updated' | 'created'): Promise<any>;
// get issue detail
getIssue(number: string): Promise<any>;
// parse gitee markdown
parseMarkdown(text: string): Promise<any>;
...
// more detail can be viewed in node_modules\yxlolxy-open-api\types\third-party\gitee.d.ts

3. github api list

// base64 encode
// get content of a repo file, sunch as /test/a.json, add content to the repo file or update、delete
getContent(filenameWithPath?: string): Promise<any>;
addContent(filenameWithPath: string, content: string, encode?: boolean): Promise<any>;
updateContent(filenameWithPath: string, content: string, sha: string, encode?: boolean): Promise<any>;
deleteContent(filenameWithPath: string, sha: string): Promise<any>;
...
// give it up because of CN firewall!!!

4. gaode api list

// get gaode location
locateByIp(): Promise<any>;
// get live weather data
getWeather(adcode: string): Promise<any>;
// more api to be continued

5. other api

// these apis list in node_modules\yxlolxy-open-api\types\utils
// get days of some month, such as 1 31
function getMonthDays(year: number, month: number): number;
// get the week day of some month's first day
function getFirstWeekday(year: number, month: number): number;
// get weekday array of some month
function getMonthDayArr(year: number, month: number): string[][];
// get weekday array of current month
function getCurMonthDayArr(): string[][];
// get datastr yyyy-MM-dd HH:mm:ss
function getDateTimeStr(str?: string): string;
// rt
function isBeforenoon(str?: string): boolean;
...
// more chek yourself

📞 Contact With Me

Email: [email protected]

enjoy it! 🍎🍎🍎