@nulvless/nulvless-js 0.1.8 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +32 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +44 -27
- package/dist/index.d.ts +44 -27
- package/dist/index.mjs +32 -20
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1952,9 +1952,6 @@ var AuthServerClient = class extends AuthClient {
|
|
|
1952
1952
|
};
|
|
1953
1953
|
|
|
1954
1954
|
// src/comms/templates/index.ts
|
|
1955
|
-
function templatePath(channel, slug, language) {
|
|
1956
|
-
return language ? route`/templates/${channel}/${slug}/${language}` : route`/templates/${channel}/${slug}`;
|
|
1957
|
-
}
|
|
1958
1955
|
var TemplatesClient = class {
|
|
1959
1956
|
constructor(http) {
|
|
1960
1957
|
this.http = http;
|
|
@@ -1971,38 +1968,53 @@ var TemplatesClient = class {
|
|
|
1971
1968
|
return this.http.post("/templates", params, options);
|
|
1972
1969
|
}
|
|
1973
1970
|
/**
|
|
1974
|
-
* Updates
|
|
1971
|
+
* Updates the name, description, URL or config of a template.
|
|
1975
1972
|
*
|
|
1976
|
-
*
|
|
1973
|
+
* @example
|
|
1974
|
+
* await nulvless.comms.templates.update('email', 'welcome', { name: 'Welcome' })
|
|
1975
|
+
*/
|
|
1976
|
+
update(channel, slug, params, options) {
|
|
1977
|
+
return this.http.patch(route`/templates/${channel}/${slug}`, params, options);
|
|
1978
|
+
}
|
|
1979
|
+
/**
|
|
1980
|
+
* Creates or replaces a template translation.
|
|
1977
1981
|
*
|
|
1978
1982
|
* @example
|
|
1979
|
-
* await nulvless.comms.templates.
|
|
1983
|
+
* await nulvless.comms.templates.putTranslation('email', 'welcome', 'pt-BR', { subject: 'Olá!', content: '<h1>Olá {{name}}</h1>' })
|
|
1980
1984
|
*/
|
|
1981
|
-
|
|
1982
|
-
return this.http.
|
|
1985
|
+
putTranslation(channel, slug, language, params, options) {
|
|
1986
|
+
return this.http.put(route`/templates/${channel}/${slug}/${language}`, params, options);
|
|
1983
1987
|
}
|
|
1984
1988
|
/**
|
|
1985
|
-
* Deletes a template.
|
|
1989
|
+
* Deletes a template translation.
|
|
1986
1990
|
*
|
|
1987
|
-
*
|
|
1991
|
+
* @example
|
|
1992
|
+
* await nulvless.comms.templates.deleteTranslation('email', 'welcome', 'pt-BR')
|
|
1988
1993
|
*/
|
|
1989
|
-
|
|
1990
|
-
return this.http.delete(
|
|
1994
|
+
deleteTranslation(channel, slug, language, options) {
|
|
1995
|
+
return this.http.delete(route`/templates/${channel}/${slug}/${language}`, options);
|
|
1996
|
+
}
|
|
1997
|
+
/**
|
|
1998
|
+
* Deletes a template and its translations.
|
|
1999
|
+
*
|
|
2000
|
+
* @example
|
|
2001
|
+
* await nulvless.comms.templates.delete('email', 'welcome')
|
|
2002
|
+
*/
|
|
2003
|
+
delete(channel, slug, options) {
|
|
2004
|
+
return this.http.delete(route`/templates/${channel}/${slug}`, options);
|
|
1991
2005
|
}
|
|
1992
2006
|
/**
|
|
1993
2007
|
* Returns a template by channel and slug, falling back to the common template
|
|
1994
2008
|
* if no custom one exists.
|
|
1995
2009
|
*
|
|
1996
|
-
*
|
|
1997
|
-
*
|
|
1998
|
-
* The response includes `common: true` when the returned template is the
|
|
1999
|
-
* platform-level fallback rather than a custom override.
|
|
2010
|
+
* @example
|
|
2011
|
+
* const { data } = await nulvless.comms.templates.get('email', 'welcome')
|
|
2000
2012
|
*/
|
|
2001
|
-
get(channel, slug,
|
|
2002
|
-
return this.http.get(
|
|
2013
|
+
get(channel, slug, options) {
|
|
2014
|
+
return this.http.get(route`/templates/${channel}/${slug}`, options);
|
|
2003
2015
|
}
|
|
2004
2016
|
/**
|
|
2005
|
-
* Returns a paginated list of templates, optionally filtered by channel
|
|
2017
|
+
* Returns a paginated list of templates, optionally filtered by channel.
|
|
2006
2018
|
*
|
|
2007
2019
|
* @example
|
|
2008
2020
|
* const { data } = await nulvless.comms.templates.list({ channel: 'email', page_size: 20 })
|
|
@@ -2015,7 +2027,7 @@ var TemplatesClient = class {
|
|
|
2015
2027
|
...filters?.page_size !== void 0 ? { page_size: filters.page_size } : {},
|
|
2016
2028
|
...filters?.sort ? { sort: filters.sort } : {},
|
|
2017
2029
|
...filters?.channel ? { channel: filters.channel } : {},
|
|
2018
|
-
...filters?.
|
|
2030
|
+
...filters?.authored ? { authored: filters.authored } : {}
|
|
2019
2031
|
}
|
|
2020
2032
|
});
|
|
2021
2033
|
}
|