groups overview
Groups API For mor information about groups, see How to create and use groups
Added in v0.0.1
Table of contents
groups
create
Create a group!
Signature
export declare const create: (params: ICreateParams) => Effect<ICreateResult>
Example
import { groups, MlEnv } from '@frederic-latour/fp-ts-mailerlite'
import { pipe } from 'fp-ts/function'
const deps: MlEnv = {
config: {
token: process.env['ML_TOKEN'] ?? '',
baseUrl: 'https://connect.mailerlite.com/',
},
}
async function test() {
const res = await pipe(deps, groups.create({ name: 'test_group' }))()
return res
}
console.log(test())
Added in v0.0.1
list
List All groups
Signature
export declare const list: (params: IListParams) => Effect<IListResult>
Example
import { groups, MlEnv } from '@frederic-latour/fp-ts-mailerlite'
import { pipe } from 'fp-ts/function'
const deps: MlEnv = {
config: {
token: process.env['ML_TOKEN'] ?? '',
baseUrl: 'https://connect.mailerlite.com/',
},
}
async function test() {
const res = await pipe(deps, groups.list({ filter: { name: 'fltest' } }))()
return res
}
console.log(test())
Added in v0.0.1
utils
ICreateParams (interface)
Parmameters for creating a group
Signature
export interface ICreateParams {
/** Group name - max 255 chars */
name: string
}
Added in v0.0.1
IDelParams (interface)
Parmameters for deleting a group
Signature
export interface IDelParams {
/** Group Id */
id: string
}
Added in v0.0.1
IGetParams (interface)
Parmameters for getting a group by its id
Signature
export interface IGetParams {
/** Group Id */
id: string
}
Added in v0.0.1
IGroupData (interface)
Signature
export interface IGroupData {
id: string
name: string
active_count: number
sent_count: number
opens_count: number
open_rate: {
float: number
string: string
}
clicks_count: number
click_rate: {
float: number
string: string
}
unsubscribed_count: number
unconfirmed_count: number
bounced_count: number
junk_count: number
created_at: Date
}
Added in v0.0.1
IListParams (interface)
list parameters
Signature
export interface IListParams {
limit?: number
page?: number
sort?: `${SortOrder}${SortFields}`
filter?: {
name: string
}
}
Added in v0.0.1
IListResult (interface)
Result returned by list
Signature
export interface IListResult {
data: Array<IGroupData>
links: ILinks
meta: IMeta
}
Added in v0.0.1
IMeta (interface)
Signature
export interface IMeta {
current_page: number
from: number
last_page: number
links: Array<{ url: string | null; label: string; active: boolean }>
path: string
per_page: number
to: number
total: number
}
Added in v0.0.1
IUpdateParams (interface)
Signature
export interface IUpdateParams {
/** Group id */
id: string
/** new group name */
name: string
}
Added in v0.0.1
del
Signature
export declare const del: (params: IDelParams) => Effect<IDelResult>
Added in v0.0.1
get
Signature
export declare const get: (params: IGetParams) => Effect<IGetResult>
Added in v0.0.1
update
Signature
export declare const update: (params: IUpdateParams) => Effect<IUpdateResult>
Added in v0.0.1