Edits history of script submission #23254 for ' Get Project Update (linear)'

  • bunnative
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    
    /**
     * Get Project Update
     * Get a single project status update by its ID.
     */
    export async function main(auth: RT.Linear, project_update_id: string) {
      const response = await fetch("https://api.linear.app/graphql", {
        method: "POST",
        headers: {
          Authorization: auth.apiKey,
          "Content-Type": "application/json",
          Accept: "application/json",
        },
        body: JSON.stringify({
          query: `query ($id: String!) { projectUpdate(id: $id) { id body health url createdAt updatedAt user { id name } project { id name } } }`,
          variables: { id: project_update_id },
        }),
      })
    
      if (!response.ok) {
        throw new Error(`${response.status} ${await response.text()}`)
      }
    
      const { data, errors } = await response.json()
      if (errors) {
        throw new Error(JSON.stringify(errors))
      }
    
      return data.projectUpdate
    }
    

    Submitted by hugo989 2 hours ago