larksuite / larksuite/oapi-sdk-python

[feature request] Add some Enum types

Open
#57 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
559
Forks
102
PR merge metrics
No merged PRs in 30d

Description

I'm using docx.v1.ListDocumentBlockRequest to get a docx.v1.Block. Then I'd like to write:

def get_text_block_by_type(block: docx.v1.Block) -> docx.v1.Text:
    name = FeishuBlockType(block.block_type).name
    value = block.__getattribute__(name)
    if isinstance(value, docx.v1.Text):
        return value
    else:
        return None

class FeishuBlockType(Enum):
    page = 1
    text = 2
    heading1 = 3
    heading2 = 4
    heading3 = 5
    heading4 = 6
    heading5 = 7
    heading6 = 8
    heading7 = 9
    heading8 = 10
    heading9 = 11
    bullet = 12
    ordered = 13
    code = 14
    quote = 15
    equation = 16
    todo = 17
    bitable = 18
    callout = 19
    chat_card = 20
    uml_diagram = 21
    divider = 22
    file = 23
    grid = 24
    grid_column = 25
    iframe = 26
    image = 27
    isv = 28
    mindnote = 29
    sheet = 30
    table = 31
    table_cell = 32
    view = 33
    quote_container = 34
    task = 35
    okr = 36
    okr_objective = 37
    okr_key_result = 38
    okr_progress = 39
    add_ons = 40
    jira_issue = 41
    wiki_catalog = 42

I belive it will be useful for developers to have the Enum types in lark_oapi , perticularly the fields like:

image
image
image

Relate to https://open.feishu.cn/document/server-docs/docs/docs/docx-v1/document/list

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by inspecting the lark_oapi model definitions for docx.v1.Block and the related fields shown in the issue. Compare their numeric values and names with the Feishu Docx API documentation. Done means the requested Enum types are available for these fields and remain consistent with the documented values.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.