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

flotiq-codegen-ts

v1.4.0

Published

CLI tool to generate API clients using Flotiq API and OpenAPI Generator

Downloads

360

Readme

flotiq-codegen-ts

This package generates Typescript Fetch API integration for your Flotiq project.

See it in action!

Flotiq API accessible through TypeScript

Go to this JSFiddle to see a (limited) demo.

Quickstart

npx flotiq-codegen-ts generate

Usage

Run flotiq-codegen-ts, provide your API key and wait for your Typescript code to be generated in the flotiqApi folder. Then start using it:

import {FlotiqApi} from 'flotiqApi/src';

const FLOTIQ_RO_API_KEY = 'YOUR_API_KEY';
const flotiq = new FlotiqApi(FLOTIQ_RO_API_KEY);

// Use your IDE IntelliSense to work with types & api endpoints!

const eventList = await flotiq.EventAPI.list({limit: 100});

Usage in JS project

If you wish to use flotiqApi in JS project you can use flotiq-codegen-ts with --compiled-js/-c flag

npx flotiq-codegen-ts generate --compiled-js

Now set of compiled d.ts and .js will be automatically generated in your flotiqApi folder. You can now import and use the API in your project:

import {FlotiqApi} from 'flotiqApi/index';

const FLOTIQ_RO_API_KEY = 'YOUR_API_KEY';
const flotiq = new FlotiqApi(FLOTIQ_RO_API_KEY);

// Use your IDE IntelliSense to work with types & api endpoints!

const eventList = await flotiq.EventAPI.list({limit: 100});

Watching for changes in your data in Flotiq

The flotiq-codegen-ts tool offers a feature to continuously monitor changes in the content on your Flotiq account. It automatically regenerates the SDK whenever changes are detected, ensuring that developers always have the most up-to-date data models in their IDE without manual intervention.

The --watch/-w option for flotiq-codegen-ts ensures your SDK stays up-to-date by automatically monitoring and regenerating based on content changes.

If you want to see changes made in Flotiq by your content editor in your IDE, use flotiq-codegen-ts with --watch/-w flag

npx flotiq-codegen-ts generate --watch

or, if you want your SDK to be directly compiled to JavaScript use flotiq-codegen-ts with flags --watch/-w and --compiled-js/-c

npx flotiq-codegen-ts generate --watch --compiled-js

Now, flotiq-codegen-ts will check for changes in your Flotiq content every 10 seconds. If changes are detected, it will automatically regenerate your SDK to reflect the updates.

Surpressing output messages

If you don't want to receive output messages, pass --silent/-s option to limit number of logs. This option assumes, that the generator cannot read api key from .env.* file and will not ask for key in the console.

npx flotiq-codegen-ts generate --silent

This is especially useful when you are using generator with other automation tools or you are running generate function by hand.

Changing SDK output path

By default, the SDK is generated in the flotiqApi folder in your working directory.

If you want to change the path for the generated SDK, use the --output/-o option with your chosen path.

npx flotiq-codegen-ts generate --output ./lib/flotiqApi

In the example above, the SDK will be placed in the flotiqApi folder within lib in your working directory.

Node.js api

You can use command handler in your scripts by importing command handler

const {handler} = require('flotiq-codegen-ts/commands/generate');

await handler({flotiqApiKey: 'test-ro-key', watch: false, silent: false, compiledJs: false});

Developing

To start developing this project, follow these steps:

  1. Clone the repository git clone [email protected]:flotiq/flotiq-codegen-ts.git
  2. Install dependencies yarn install
  3. Run the project yarn start

Collaborating

If you wish to talk with us about this project, feel free to hop on our Discord Chat.

If you found a bug, please report it in issues.