CompanyEvent


Modelo CompanyEvent

{
    "id": 3,
    "name": "Navidad",
    "type": "coupon_gen",
    "status": "running",
    "starts_at": "2020-12-17 19:01:34",
    "ends_at": null,
    "config": {
        "coupon_seeds": [
            {
                "win_rate": 50,
                "max_count": 5,
                "coupon_value_e2": 10,
                "coupon_min_purchase_e2": 0
            }
        ],
        "expires_at": null,
        "random_length": 1000,
        "winner_message": "Winner. ?",
        "loser_message": "Keep trying",
        "already_won_message": "Already won. $1 $2"
    },
    "created_at": "2020-12-17 18:54:13",
    "updated_at": "2020-12-22 17:06:58",
    "deleted_at": null
}

Insertar CompanyEvent

Método URI Cabeceras
POST /companies/{companyId}/company-events Authorization
{
    "name": "required|string|max:64",
    "type": "required|string|in:coupon_gen",
    "starts_at": "date|after:2021-08-18 13:58:35",
    "ends_at": "date|after:starts_at|after:2021-08-18 13:58:35",
    "timezone": {
        "string": true,
        "regex": "/^[\\+\\-]([0-1][0-9]|2[0-3]):[0-5][0-9]$/"
    },
    "config": {
        "coupon_seeds": [
            {
                "max_count": "required|integer|min:1",
                "coupon_value_e2": "integer|min:0",
                "coupon_value_prc": "numeric|between:0.0000,1.0000",
                "coupon_min_purchase_e2": "integer|min:0",
                "win_rate": "required|integer|min:1",
                "coupon_applies_to": "string|in:total,subtotal,base_price,service,delivery",
                "winner_message": "string|max:80",
                "already_won_message": "string|max:80",
                "available_since": "date",
                "available_until": "date"
            }
        ],
        "expires_at": "date|after:2021-08-18 13:58:35",
        "random_length": "integer|min:1",
        "winner_message": "string|max:80",
        "already_won_message": "string|max:80",
        "loser_message": "string|max:80"
    }
}

Listar CompanyEvent

{info} Soporta: Paginación Filters Carga dinámica

Método URI Cabeceras
GET /companies/{companyId}/company-events Authorization

Mostrar CompanyEvent

{info} Soporta: Carga dinámica

Método URI Cabeceras
GET /companies/{companyId}/company-events/{companyEventId} Authorization

Actualizar CompanyEvent

Método URI Cabeceras
PATCH /companies/{companyId}/company-events/{companyEventId} Authorization
{
    "name": "string|max:64",
    "type": "string|in:coupon_gen",
    "starts_at": "date|after:2021-08-18 13:58:35",
    "ends_at": "date|after:starts_at|after:2021-08-18 13:58:35",
    "timezone": {
        "string": true,
        "regex": "/^[\\+\\-]([0-1][0-9]|2[0-3]):[0-5][0-9]$/"
    },
    "config": {
        "coupon_seeds": [
            {
                "max_count": "required|integer|min:1",
                "coupon_value_e2": "integer|min:0",
                "coupon_value_prc": "numeric|between:0.0000,1.0000",
                "coupon_min_purchase_e2": "integer|min:0",
                "win_rate": "required|integer|min:1",
                "coupon_applies_to": "string|in:total,subtotal,base_price,service,delivery",
                "winner_message": "string|max:80",
                "already_won_message": "string|max:80",
                "available_since": "date",
                "available_until": "date"
            }
        ],
        "expires_at": "date|after:2021-08-18 13:58:35",
        "random_length": "integer|min:1",
        "winner_message": "string|max:80",
        "already_won_message": "string|max:80",
        "loser_message": "string|max:80"
    }
}

Acciones de CompanyEvent

Set Ready

Método URI Cabeceras
POST /companies/{companyId}/company-events/{companyEventId}/set-ready Authorization
{
    "starts_at": "date|after:2021-08-18 13:58:35",
    "ends_at": "date|after:starts_at|after:2021-08-18 13:58:35",
    "timezone": {
        "string": true,
        "regex": "/^[\\+\\-]([0-1][0-9]|2[0-3]):[0-5][0-9]$/"
    }
}

Set Finished

Método URI Cabeceras
POST /companies/{companyId}/company-events/{companyEventId}/set-finished Authorization

Shake

Método URI Cabeceras
GET /companies/{companyId}/events/shake Authorization

Enlaces de CompanyEvent