Edits history of script submission #16585 for ' Get KViews (kustomer)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    type Kustomer = {
      apiKey: string;
    };
    /**
     * Get KViews
     * Retrieves all the KViews for a resource.
    
    Optionally, the context can be included to be more specific.
    
    If the context is included, the KViews will be ordered according to when the KView was added or the order specified in the KView ordering endpoint.
     */
    export async function main(auth: Kustomer) {
      const url = new URL(`https://api.kustomerapp.com/v1/kviews`);
    
      const response = await fetch(url, {
        method: "GET",
        headers: {
          Authorization: "Bearer " + auth.apiKey,
        },
        body: undefined,
      });
      if (!response.ok) {
        const text = await response.text();
        throw new Error(`${response.status} ${text}`);
      }
      return await response.json();
    }
    

    Submitted by hugo697 235 days ago