Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:APIJSON APIJSON Demo Verify Model

From Leeroopedia
Knowledge Sources
Domains API_Design, Security, Data_Model
Last Updated 2026-10-14 00:00 GMT

Overview

Concrete tool for modeling verification code records with role-based access control via @MethodAccess annotations in the APIJSON Demo.

Description

The Verify model class extends BaseModel and represents a verification code record (phone, verify code, type). It uses the @MethodAccess annotation to define role-based access: GETS/HEADS allow all roles, PUT/DELETE require ADMIN. It defines verification type constants (TYPE_LOGIN, TYPE_REGISTER, TYPE_PASSWORD, TYPE_PAY_PASSWORD, TYPE_RELOAD).

Usage

Use this model class when building APIJSON requests that create or validate verification codes for login, registration, or password reset flows.

Code Reference

Source Location

Signature

@MethodAccess(
    GET = {},
    HEAD = {},
    GETS = {UNKNOWN, LOGIN, CONTACT, CIRCLE, OWNER, ADMIN},
    HEADS = {UNKNOWN, LOGIN, CONTACT, CIRCLE, OWNER, ADMIN},
    POST = {UNKNOWN, LOGIN, CONTACT, CIRCLE, OWNER, ADMIN},
    PUT = {ADMIN},
    DELETE = {ADMIN}
)
public class Verify extends BaseModel {
    public static final int TYPE_LOGIN = 0;
    public static final int TYPE_REGISTER = 1;
    public static final int TYPE_PASSWORD = 2;
    public static final int TYPE_PAY_PASSWORD = 3;
    public static final int TYPE_RELOAD = 4;

    private String phone;
    private String verify;
    private Integer type;

    public Verify();
    public Verify(int type, String phone);
    // getters/setters
}

Import

import apijson.demo.model.Verify;

I/O Contract

Inputs

Name Type Required Description
phone String Yes Phone number for verification
verify String No Verification code
type Integer Yes Verification type (0=login, 1=register, 2=password, 3=pay, 4=reload)

Outputs

Name Type Description
Verify instance Verify Model object for APIJSON CRUD operations

Usage Examples

Create a Login Verification Code

// APIJSON POST request to create a verification code
{
  "Verify": {
    "phone": "13800138000",
    "verify": "123456",
    "type": 0
  }
}

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment