private async getAddonInfo()

in src/controller/addonController.ts [172:203]


  private async getAddonInfo(input: string): Promise<AddonInfoResponse> {
    const slug: string = this.getAddonSlug(input);
    const url = `${constants.apiBaseURL}addons/addon/${slug}`;
    const headers = await this.credentialController.makeAuthHeader();

    const response = await fetch(url, { headers: headers });
    if (!response.ok) {
      const errorMessages: ErrorMessages = {
        window: {
          404: `(Status ${response.status}): Addon not found`,
          401: `(Status ${response.status}): Unauthorized request`,
          403: `(Status ${response.status}): Inadequate permissions`,
          other: `(Status ${response.status}): Could not fetch addon info`,
        },
        thrown: {
          404: "Failed to fetch addon info",
          401: "Unauthorized request",
          403: "Forbidden request",
          other: "Failed to fetch addon info",
        },
      };

      return await NotificationView.showErrorMessage(
        errorMessages,
        response.status,
        this.getAddonInfo,
        [input]
      );
    }
    const json = await response.json();
    return json;
  }