/**
* @param fields *(optional)* A list of fields to return in the response.
* Reference parameters of sub-objects with dot notation.
*
* @param exclude_fields *(optional)* A list of fields to exclude from the response.
* Reference parameters of sub-objects with dot notation. If both `fields` and `exclude_fields`
* are present, then only `exclude_fields` will be used.
*/
type Mailchimp = {
api_key: string;
server: string;
};
export async function main(
auth: Mailchimp,
fields?: string[],
exclude_fields?: string[],
count?: number,
offset?: number,
sort_dir?: "" | "ASC" | "DESC",
type?: "" | "regular" | "plaintext" | "absplit" | "rss" | "variate",
status?: "" | "save" | "paused" | "schedule" | "sending" | "sent",
before_send_time?: string,
since_send_time?: string,
before_create_time?: string,
since_create_time?: string,
list_id?: string,
folder_id?: string,
member_id?: string,
sort_field?: "" | "create_time" | "send_time",
) {
const url = new URL(`https://${auth.server}.api.mailchimp.com/3.0/campaigns`);
const params = {
fields,
exclude_fields,
count,
offset,
sort_dir,
type,
status,
before_send_time,
since_send_time,
before_create_time,
since_create_time,
list_id,
folder_id,
member_id,
sort_field,
};
for (const key in params) {
const value = params[<keyof typeof params>key];
if (value) {
url.searchParams.append(
key,
Array.isArray(value) ? value.join(",") : "" + value,
);
}
}
const response = await fetch(url, {
method: "GET",
headers: {
Authorization: `Bearer ${auth.api_key}`,
},
});
if (!response.ok) {
throw Error(await response.text());
}
return await response.json();
}
Submitted by admin 502 days ago
/**
* @param fields *(optional)* A list of fields to return in the response.
* Reference parameters of sub-objects with dot notation.
*
* @param exclude_fields *(optional)* A list of fields to exclude from the response.
* Reference parameters of sub-objects with dot notation. If both `fields` and `exclude_fields`
* are present, then only `exclude_fields` will be used.
*/
type Mailchimp = {
api_key: string;
server: string;
};
export async function main(
auth: Mailchimp,
fields?: string[],
exclude_fields?: string[],
count?: number,
offset?: number,
sort_dir?: '' | 'ASC' | 'DESC',
type?: '' | 'regular' | 'plaintext' | 'absplit' | 'rss' | 'variate',
status?: '' | 'save' | 'paused' | 'schedule' | 'sending' | 'sent',
before_send_time?: string,
since_send_time?: string,
before_create_time?: string,
since_create_time?: string,
list_id?: string,
folder_id?: string,
member_id?: string,
sort_field?: '' | 'create_time' | 'send_time',
) {
const url = new URL(`https://${auth.server}.api.mailchimp.com/3.0/campaigns`)
const params = {
fields,
exclude_fields,
count,
offset,
sort_dir,
type,
status,
before_send_time,
since_send_time,
before_create_time,
since_create_time,
list_id,
folder_id,
member_id,
sort_field
}
for(const key in params) {
const value = params[<keyof typeof params>key]
if(value) {
url.searchParams.append(key, Array.isArray(value) ? value.join(',') : '' + value)
}
}
const response = await fetch(url, {
method: 'GET',
headers: {
Authorization: `Bearer ${auth.api_key}`
}
})
if(!response.ok) {
throw Error(await response.text())
}
return await response.json()
}
Submitted by admin 506 days ago
import { Resource } from 'https://deno.land/x/windmill@v1.85.0/mod.ts'
/**
* @param fields *(optional)* A list of fields to return in the response.
* Reference parameters of sub-objects with dot notation.
*
* @param exclude_fields *(optional)* A list of fields to exclude from the response.
* Reference parameters of sub-objects with dot notation. If both `fields` and `exclude_fields`
* are present, then only `exclude_fields` will be used.
*/
export async function main(
auth: Resource<'mailchimp'>,
fields?: string[],
exclude_fields?: string[],
count?: number,
offset?: number,
sort_dir?: '' | 'ASC' | 'DESC',
type?: '' | 'regular' | 'plaintext' | 'absplit' | 'rss' | 'variate',
status?: '' | 'save' | 'paused' | 'schedule' | 'sending' | 'sent',
before_send_time?: string,
since_send_time?: string,
before_create_time?: string,
since_create_time?: string,
list_id?: string,
folder_id?: string,
member_id?: string,
sort_field?: '' | 'create_time' | 'send_time',
) {
const url = new URL(`https://${auth.server}.api.mailchimp.com/3.0/campaigns`)
const params = {
fields,
exclude_fields,
count,
offset,
sort_dir,
type,
status,
before_send_time,
since_send_time,
before_create_time,
since_create_time,
list_id,
folder_id,
member_id,
sort_field
}
for(const key in params) {
const value = params[<keyof typeof params>key]
if(value) {
url.searchParams.append(key, Array.isArray(value) ? value.join(',') : '' + value)
}
}
const response = await fetch(url, {
method: 'GET',
headers: {
Authorization: `Bearer ${auth.api_key}`
}
})
if(!response.ok) {
throw Error(await response.text())
}
return await response.json()
}
Submitted by adam186 634 days ago
import { Resource } from 'https://deno.land/x/windmill@v1.70.1/mod.ts'
/**
* @param fields *(optional)* A list of fields to return in the response.
* Reference parameters of sub-objects with dot notation.
*
* @param exclude_fields *(optional)* A list of fields to exclude from the response.
* Reference parameters of sub-objects with dot notation. If both `fields` and `exclude_fields`
* are present, then only `exclude_fields` will be used.
*/
export async function main(
auth: Resource<'mailchimp'>,
fields?: string[],
exclude_fields?: string[],
count?: number,
offset?: number,
sort_dir?: '' | 'ASC' | 'DESC',
type?: '' | 'regular' | 'plaintext' | 'absplit' | 'rss' | 'variate',
status?: '' | 'save' | 'paused' | 'schedule' | 'sending' | 'sent',
before_send_time?: string,
since_send_time?: string,
before_create_time?: string,
since_create_time?: string,
list_id?: string,
folder_id?: string,
member_id?: string,
sort_field?: '' | 'create_time' | 'send_time',
) {
const url = new URL(`https://${auth.server}.api.mailchimp.com/3.0/campaigns`)
const params = {
fields,
exclude_fields,
count,
offset,
sort_dir,
type,
status,
before_send_time,
since_send_time,
before_create_time,
since_create_time,
list_id,
folder_id,
member_id,
sort_field
}
for(const key in params) {
const value = params[<keyof typeof params>key]
if(value) {
url.searchParams.append(key, Array.isArray(value) ? value.join(',') : '' + value)
}
}
const response = await fetch(url, {
method: 'GET',
headers: {
Authorization: `Bearer ${auth.api_key}`
}
})
if(!response.ok) {
throw Error(await response.text())
}
return await response.json()
}
Submitted by adam186 669 days ago
import { Resource } from 'https://deno.land/x/windmill@v1.55.0/mod.ts'
/**
* @param fields *(optional)* A list of fields to return in the response.
* Reference parameters of sub-objects with dot notation.
*
* @param exclude_fields *(optional)* A list of fields to exclude from the response.
* Reference parameters of sub-objects with dot notation. If both `fields` and `exclude_fields`
* are present, then only `exclude_fields` will be used.
*/
export async function main(
auth: Resource<'mailchimp'>,
fields?: string[],
exclude_fields?: string[],
count?: number,
offset?: number,
sort_dir?: '' | 'ASC' | 'DESC',
type?: '' | 'regular' | 'plaintext' | 'absplit' | 'rss' | 'variate',
status?: '' | 'save' | 'paused' | 'schedule' | 'sending' | 'sent',
before_send_time?: string,
since_send_time?: string,
before_create_time?: string,
since_create_time?: string,
list_id?: string,
folder_id?: string,
member_id?: string,
sort_field?: '' | 'create_time' | 'send_time',
) {
const url = new URL(`https://${auth.server}.api.mailchimp.com/3.0/campaigns`)
const params = {
fields,
exclude_fields,
count,
offset,
sort_dir,
type,
status,
before_send_time,
since_send_time,
before_create_time,
since_create_time,
list_id,
folder_id,
member_id,
sort_field
}
for(const key in params) {
const value = params[<keyof typeof params>key]
if(value) {
url.searchParams.append(key, Array.isArray(value) ? value.join(',') : '' + value)
}
}
const response = await fetch(url, {
method: 'GET',
headers: {
Authorization: `Bearer ${auth.api_key}`
}
})
if(!response.ok) {
throw Error(await response.text())
}
return await response.json()
}
Submitted by adam186 740 days ago
/**
* @param server The data center for your Mailchimp account.
*
* @param fields *(optional)* A list of fields to return in the response.
* Reference parameters of sub-objects with dot notation.
*
* @param exclude_fields *(optional)* A list of fields to exclude from the response.
* Reference parameters of sub-objects with dot notation. If both `fields` and `exclude_fields`
* are present, then only `exclude_fields` will be used.
*/
export async function main(
api_key: string,
server: string,
fields?: string[],
exclude_fields?: string[],
count?: number,
offset?: number,
sort_dir?: '' | 'ASC' | 'DESC',
type?: '' | 'regular' | 'plaintext' | 'absplit' | 'rss' | 'variate',
status?: '' | 'save' | 'paused' | 'schedule' | 'sending' | 'sent',
before_send_time?: string,
since_send_time?: string,
before_create_time?: string,
since_create_time?: string,
list_id?: string,
folder_id?: string,
member_id?: string,
sort_field?: '' | 'create_time' | 'send_time',
) {
const url = new URL(`https://${server}.api.mailchimp.com/3.0/campaigns`)
const params = {
fields,
exclude_fields,
count,
offset,
sort_dir,
type,
status,
before_send_time,
since_send_time,
before_create_time,
since_create_time,
list_id,
folder_id,
member_id,
sort_field
}
for(const key in params) {
const value = params[<keyof typeof params>key]
if(value) {
url.searchParams.append(key, Array.isArray(value) ? value.join(',') : '' + value)
}
}
const response = await fetch(url, {
method: 'GET',
headers: {
Authorization: `Bearer ${api_key}`
}
})
if(!response.ok) {
throw Error(await response.text())
}
return await response.json()
}
Submitted by adam186 760 days ago