GithubHelp home page GithubHelp logo

zygos / mailerlite-api-v2-node Goto Github PK

View Code? Open in Web Editor NEW
42.0 42.0 7.0 490 KB

Node.js wrapper for MailerLite API v2 with Promises, Typescript and camelCase by default.

License: MIT License

JavaScript 5.12% TypeScript 94.88%

mailerlite-api-v2-node's People

Contributors

dependabot[bot] avatar fmilioni avatar imervin avatar pcianes avatar pedrogaudencio avatar zygos avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

mailerlite-api-v2-node's Issues

Unnecessary await return

I see loads of code with return await like in this example from account.ts:

return {
    async getAccountRaw(): Promise<AccountWrap> {
      return await client.get('me')
    },

    async getAccount() {
      const { account } = await this.getAccountRaw()
      return account
    },

    async getMe() {
      return await this.getAccount()
    },
  }

since client is already a Promise you could do just:

return {
   getAccountRaw(): Promise<AccountWrap> {
      return client.get('me')
    },
...
}

How to secure the API key in Server side?

Hello,

I am testing this repo. It works fine.
However now I am using it in development mode, in a specific React component.

I understand this is not secure, because the API key will be exposed publicly.

Can you please suggest how to implement a server side management of the authentication process?
Thank you

Id number differs which cause 404 error

Hey there!

 I have been working with the mailer lite API integration. while using this npm package to get a list of groups. I am getting a group id while fetching data form that group using that group Id i am getting a 404 error as a response. While doing the same in postman i am getting a different group id where i am able to get desired response. why the id of the group differs while using the fetch method and in postman. Can you please help me to resolve this issue.

Thank You in Advance

Error code 1, Access Denied

Hey! Thanks for making this api. I had given up last year after having been unable to find anything useable in my React application. I have kind of a weird issue, I installed the api and used it once with success. I was able to add my email to my group and verified it inside my MailerLite account. When I went to make a component that did that (it was originally just raw html inside another component), I got an error code saying access was denied. Specifically, it says:

"Access to XMLHttpRequest at 'https://api.mailerlite.com/api/v2/groups/104625980/subscribers' from origin 'http://localhost:3000' has been blocked by CORS policy: Request header field x-mailerlite-apikey is not allowed by Access-Control-Allow-Headers in preflight response."

Here is my MailerLite.js file:
const MailerLite = require('mailerlite-api-v2-node').default;
var apikey = example_api_key;
const mailerlite = MailerLite(apikey);
export default mailerlite;

Here is the function I am using to post my new subscriber:
addEmailSub = () => {
var email = document.getElementById("email").value;
mailerlite.addSubscriberToGroup(104625980, email);
}

Any input would be appreciated!

'isAxiosError' problem with posting via this package

Hey

I'm sorry I don't know if this is the right place for this... I'm slightly at my wits end trying to figure out what's wrong here. It should work I think. I've tried using your package and it just won't accept my post to add a new subscriber.

I posted about this on stack overflow, here's the link: https://stackoverflow.com/questions/65355078/axios-post-in-react-front-end-leading-to-error-when-posting-to-mailerlite

Do you have any suggestions for what is going wrong here?

City and company should be optional in SubscriberFields

Hi,

currently you have such an interface: (before)

export interface SubsriberFields {
  city: string
  company: string
  [key: string]: any
}

I think this interface should look like this: (after)

export interface SubsriberFields {
  [key: string]: string | number | Date
}

since only these types are allowed and field can be any string.

Has no exported member 'CampaignAction'

I am trying to build express.js app and got this error.

node_modules/mailerlite-api-v2-node/dist/index.d.ts:48:66 - error TS2694: Namespace '"/Users/henprokuror/VS_Code/Datrics/backend/node_modules/mailerlite-api-v2-node/dist/@types/index"' has no exported member 'CampaignAction'.

48 actOnCampaign(campaignId: number, action: import("./@types").CampaignAction, data?: import("./@types").CampaignSendData): Promise<import("axios").AxiosResponse>;

"mailerlite-api-v2-node": ^1.0.2
Screenshot 2020-10-22 at 15 15 12
Screenshot 2020-10-22 at 15 14 56

Reexport input types

Hi!
Right now if we want to use the input types directly, we have to import them from dist like import { GroupSubscriberData } from 'mailerlite-api-v2-node/dist/@types';.
It would be nice if we could import them directly from the root.
Happy to push a PR I just wanted your input before doing so.
Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.