(snippet)
Methods related to Snippets
Delete snippets
import { Writer } from "@writerai/writer-sdk";
const writer = new Writer({
apiKey: "<YOUR_API_KEY_HERE>",
organizationId: 545907,
});
async function run() {
const teamId = 841399;
const xRequestID = "<value>";
const ids = [
"<value>",
];
const organizationId = 698486;
const result = await writer.snippet.delete(teamId, xRequestID, ids, organizationId);
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
teamId |
number | ✔️ | N/A |
xRequestID |
string | ➖ | N/A |
ids |
string[] | ➖ | N/A |
organizationId |
number | ➖ | N/A |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
Promise<operations.DeleteSnippetsResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.FailResponse | 400,401,403,404,500 | application/json |
errors.SDKError | 4xx-5xx | / |
Find snippets
import { Writer } from "@writerai/writer-sdk";
const writer = new Writer({
apiKey: "<YOUR_API_KEY_HERE>",
organizationId: 40141,
});
async function run() {
const result = await writer.snippet.find({
shortcuts: [
"<value>",
],
tags: [
"<value>",
],
teamId: 326883,
});
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.FindSnippetsRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
Promise<operations.FindSnippetsResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.FailResponse | 400,401,403,404,500 | application/json |
errors.SDKError | 4xx-5xx | / |
Update snippets
import { Writer } from "@writerai/writer-sdk";
const writer = new Writer({
apiKey: "<YOUR_API_KEY_HERE>",
organizationId: 857478,
});
async function run() {
const teamId = 24555;
const requestBody = [
{
id: "<id>",
snippet: "<value>",
tags: [
{
tag: "<value>",
},
],
},
];
const xRequestID = "<value>";
const organizationId = 597129;
const result = await writer.snippet.update(teamId, requestBody, xRequestID, organizationId);
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
teamId |
number | ✔️ | N/A |
requestBody |
shared.SnippetUpdate[] | ➖ | N/A |
xRequestID |
string | ➖ | N/A |
organizationId |
number | ➖ | N/A |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
Promise<operations.UpdateSnippetsResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.FailResponse | 400,401,403,404,500 | application/json |
errors.SDKError | 4xx-5xx | / |