//native
type Square = {
token: string;
};
/**
* SearchTerminalActions
* Retrieves a filtered list of Terminal action requests created by the account making the request. Terminal action requests are available for 30 days.
*/
export async function main(
auth: Square,
body: {
query?: {
filter?: {
device_id?: string;
created_at?: { start_at?: string; end_at?: string };
status?: string;
type?:
| "QR_CODE"
| "PING"
| "SAVE_CARD"
| "SIGNATURE"
| "CONFIRMATION"
| "RECEIPT"
| "DATA_COLLECTION"
| "SELECT";
};
sort?: { sort_order?: "DESC" | "ASC" };
};
cursor?: string;
limit?: number;
},
) {
const url = new URL(
`https://connect.squareup.com/v2/terminals/actions/search`,
);
const response = await fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer " + auth.token,
},
body: JSON.stringify(body),
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 235 days ago