Returns an array of resource objects of type build_event
1import { buildClient } from "@datocms/cma-client-node";2 3async function run() {4 const client = buildClient({ apiToken: process.env.DATOCMS_API_TOKEN });5 6 const buildEvents = await client.buildEvents.list();7 8 for (const buildEvent of buildEvents) {9 // Check the 'Returned output' tab for the result ☝️10 console.log(buildEvent);11 }12}13 14run();
1{2 id: "34",3 event_type: "response_success",4 data: {5 request_body: '{"object_kind":"build","ref":"master","tag":false,"before_sha":"0000000000000000000000000000000000000000","sha":"ecfccf5ea28af900c14b499a2b762e029c7492","build_id":10495,"build_name":"build","build_stage":"test","build_status":"success","build_started_at":"2016-09-20 18:49:22 UTC","build_finished_at":"2016-09-20 18:50:24 UTC","build_duration":62.279854524,"build_allow_failure":false,"project_id":195,"project_id":"Stefano Verna / awesome-website","user":{"id":null,"name":null,"email":null},"commit":{"id":6754,"sha":"ecfccf5ea28af900c6614b499a2b762e029c7492","message":"Update gems\\n","author_name":"Stefano Verna","author_email":"s.verna@datocms.com","status":"success","duration":62,"started_at":"2016-09-20 18:49:22 UTC","finished_at":"2016-09-20 18:50:24 UTC"},"repository":{"name":"awesome-website","url":"git@gitlab.com:stefanoverna/awesome-website.git","description":"","visibility_level":0}}',6 request_headers: {7 Via: "1.1 vegur",8 Host: "webhooks.datocms.com",9 Origin: null,10 Version: "HTTP/1.1",11 Connection: "close",12 "Connect-Time": "0",13 "X-Request-Id": "5c1beced-0fe3-4c5b-b45d-68ba4a15b5f3",14 "X-Gitlab-Event": "Build Hook",15 "X-Forwarded-For": "46.101.135.219",16 "X-Request-Start": "1474397424903",17 "Total-Route-Time": "0",18 "X-Forwarded-Port": "443",19 "X-Forwarded-Proto": "https",20 },21 },22 created_at: "2016-09-20T18:50:24.914Z",23 build_trigger: { type: "build_trigger", id: "1822" },24}