# API

## Add DailyShop to your plugin

Since i don't have a public repositoty yet, you can go ahead and download the free version jar and add the jarfile to your classpath.

## Get DailyShop Instance

```java
    @Override
    public void onEnable() {
    
        DailyShop api = DailyShop.getInstance();
        shopsManager manager = api.getShopsManager();
    
    }
```

## Events

{% tabs %}
{% tab title="createdShopEvent" %}

```java
/**
* Event called when a new shop
* is created. Cannot be cancelled
**/
public void foo(CreatedShopEvent e) {

    dShop shop = e.getShop;
    Timestamp time = e.getTimestamp();

}


```

{% endtab %}

{% tab title="deletedShopEvent" %}

```java
/**
* Event called when a shop
* is deleted. Cannot be cancelled
**/
public void foo(deletedShopEvent e) {

    dShop shop = e.getShop;
    Timestamp time = e.getTimestamp();

}

```

{% endtab %}

{% tab title="reStockShopEvent" %}

```java
/**
* Event called when shop item's
* are updated.
**/
public void foo(reStockShopEvent e) {

    dShop shop = e.getShop;
    Timestamp time = e.getTimestamp();

}

```

{% endtab %}

{% tab title="updateItemEvent" %}

```java
/**
* Event called when an item
* of a certain shop is updated
**/
public void foo(deletedShopEvent e) {

    dShop shop = e.getShop;
    Timestamp time = e.getTimestamp();
    dItem item = e.getItem();            // The item updated
    updateType type = e.getType();       // UPDATE_ITEM, NEXT_AMOUNT, DELETE_ITEM

}

```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://diviosx.gitbook.io/daily-random-shop/developers/api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
