> ## Documentation Index
> Fetch the complete documentation index at: https://codegeninc-tawsif-change-additional-tools-to-tools.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# CodeOwner

> CodeOwner is a class that represents a code owner in a codebase. It is used to iterate over all files that are owned by a specific owner.

export const Attribute = ({type, description}) => <div className="pl-4 py-6 first:pt-3 dark:border-zinc-300/[0.06] text-sm font-normal">
    <div className="inline-grid grid-cols-[auto_auto] gap-1 font-mono py-2">
      {type}
    </div>
    <p className="mt-2">{description}</p>
  </div>;

export const GithubLinkNote = ({link}) => <Info>
      <div className="flex gap-2 items-center">View Source on <a target="_blank" rel="noopener noreferrer" href={link}>Github</a></div>
   </Info>;

export const HorizontalDivider = ({light = false}) => <div className="divide-y">
        <div className={`divide-y ${light ? "dark:border-zinc-300/[0.06]" : "border-zinc-600"}`}></div>
        <div className={`divide-y ${light ? "dark:border-zinc-300/[0.06]" : "border-zinc-600"}`}></div>
    </div>;

export const Return = ({return_type, description}) => <div className="pl-6 divide-y">
    <h4 className="font-bold">Returns</h4>
    <div className="dark:border-zinc-300/[0.06] ">
        <div className="py-6 first:pt-3 text-sm font-normal">
            <div className="flex gap-4 items-center">
                <div className="inline-grid grid-cols-[auto_auto] gap-1 font-mono py-2">
                    {return_type}
                </div>
            </div>
            <p className="mt-2">{description}</p>
        </div>
    </div>
  </div>;

export const ParameterWrapper = ({children}) => <div className="pl-6 divide-y">
    <h4 className="font-bold">Parameters</h4>
    <div className="divide-y dark:border-zinc-300/[0.06]">
      {children}
    </div>
  </div>;

export const Parameter = ({name, type, description, defaultValue}) => <div className="py-6 first:pt-3 dark:border-zinc-300/[0.06] text-sm font-normal">
    <div className="flex justify-between items-start font-mono">
      <div className="flex gap-4 items-start">
        <div className="flex gap-1 items-center text-sm text-primary mt-2">
          {name}
        </div>
        <div className="inline-grid grid-cols-[auto_auto] gap-1 py-2">
          {type}
        </div>
      </div>

      <div className="flex-shrink-0 mt-2">
        {defaultValue ? <div className="flex gap-1 items-center text-sm border border-purple-500 px-2 py-0.5 rounded">
            <span className="text-zinc-500">default:</span>
            <span className="text-purple-500">{defaultValue}</span>
          </div> : <span className="text-sm border border-purple-500 px-2 py-0.5 rounded">
            required
          </span>}
      </div>
    </div>
    <p className="mt-2">{description}</p>
  </div>;

<GithubLinkNote link="https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/codeowner.py#L26-L102" />

## Attributes

<HorizontalDivider />

### <span className="text-primary">classes</span>

<HorizontalDivider light={true} />

<Attribute type={ <><span>list[</span> <a href="/api-reference/core/Class" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Class</a> <span>]</span></> } description="Get a recursive list of all classes in files container." />

### <span className="text-primary">exports</span>

<HorizontalDivider light={true} />

<Attribute type={ <><span>list[</span> <a href="/api-reference/typescript/TSExport" style={ {fontWeight: "inherit", fontSize: "inherit"} }>TSExport</a> <span>]</span></> } description="Get a recursive list of all exports in files container." />

### <span className="text-primary">files\_source</span>

<HorizontalDivider light={true} />

<Attribute type={ <><a href="/api-reference/core/Callable" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Callable</a> <span>[FilesParam, Iterable[TFile]]</span></> } description="A callable that returns an iterable of all files in the codebase." />

### <span className="text-primary">functions</span>

<HorizontalDivider light={true} />

<Attribute type={ <><span>list[</span> <a href="/api-reference/core/Function" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Function</a> <span>]</span></> } description="Get a recursive list of all functions in files container." />

### <span className="text-primary">global\_vars</span>

<HorizontalDivider light={true} />

<Attribute type={ <><span>list[</span> <a href="/api-reference/core/Assignment" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Assignment</a> <span>]</span></> } description="Get a recursive list of all global variables in files container." />

### <span className="text-primary">import\_statements</span>

<HorizontalDivider light={true} />

<Attribute type={ <><span>list[</span> <a href="/api-reference/core/ImportStatement" style={ {fontWeight: "inherit", fontSize: "inherit"} }>ImportStatement</a> <span>]</span></> } description="Get a recursive list of all import statements in files container." />

### <span className="text-primary">imports</span>

<HorizontalDivider light={true} />

<Attribute type={ <><span>list[</span> <a href="/api-reference/core/Import" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Import</a> <span>]</span></> } description="Get a recursive list of all imports in files container." />

### <span className="text-primary">name</span>

<HorizontalDivider light={true} />

<Attribute type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">str</code> } description="The name of the code owner." />

### <span className="text-primary">owner\_type</span>

<HorizontalDivider light={true} />

<Attribute type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">Literal[USERNAME, TEAM, EMAIL]</code> } description="The type of the owner (USERNAME, TEAM, EMAIL)." />

### <span className="text-primary">owner\_value</span>

<HorizontalDivider light={true} />

<Attribute type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">str</code> } description="The value of the owner." />

### <span className="text-primary">symbols</span>

<HorizontalDivider light={true} />

<Attribute type={ <><span>list[</span> <a href="/api-reference/core/Symbol" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Symbol</a> <span>]</span></> } description="Get a recursive list of all symbols in files container." />

## Methods

<HorizontalDivider />

### <span className="text-primary">files</span>

Recursively iterate over all files in the codebase that are owned by the current code owner.

<GithubLinkNote link="https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/codeowner.py#L85-L87" />

<Return return_type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">Iterable[TFile]</code> } description="" />

### <span className="text-primary">from\_parser</span>

Create a list of CodeOwner objects from a CodeOwnersParser.

<GithubLinkNote link="https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/codeowner.py#L56-L74" />

<ParameterWrapper>
  <Parameter name="parser" type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">CodeOwnersParser</code> } description="The CodeOwnersParser to use." defaultValue="" />

  <Parameter name="file_source" type={ <><a href="/api-reference/core/Callable" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Callable</a> <span>[FilesParam, Iterable[TFile]]</span></> } description="A callable that returns an iterable of all files in the codebase." defaultValue="" />
</ParameterWrapper>

<Return return_type={ <><span>list[</span> <a href="/api-reference/core/CodeOwner" style={ {fontWeight: "inherit", fontSize: "inherit"} }>CodeOwner</a> <span>]</span></> } description="A list of CodeOwner objects." />

### <span className="text-primary">get\_class</span>

Get a class by name in files container.

<GithubLinkNote link="https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/interfaces/has_symbols.py#L99-L101" />

<Return return_type={ <><a href="/api-reference/core/Class" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Class</a> <span>| None</span></> } description="" />

### <span className="text-primary">get\_export</span>

Get an export by name in files container (supports only typescript).

<GithubLinkNote link="https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/interfaces/has_symbols.py#L108-L113" />

<Return return_type={ <><a href="/api-reference/typescript/TSExport" style={ {fontWeight: "inherit", fontSize: "inherit"} }>TSExport</a> <span>| None</span></> } description="" />

### <span className="text-primary">get\_function</span>

Get a function by name in files container.

<GithubLinkNote link="https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/interfaces/has_symbols.py#L103-L105" />

<Return return_type={ <><a href="/api-reference/core/Function" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Function</a> <span>| None</span></> } description="" />

### <span className="text-primary">get\_global\_var</span>

Get a global variable by name in files container.

<GithubLinkNote link="https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/interfaces/has_symbols.py#L95-L97" />

<Return return_type={ <><a href="/api-reference/core/Assignment" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Assignment</a> <span>| None</span></> } description="" />

### <span className="text-primary">get\_import</span>

Get an import by name in files container.

<GithubLinkNote link="https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/interfaces/has_symbols.py#L115-L117" />

<Return return_type={ <><a href="/api-reference/core/Import" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Import</a> <span>| None</span></> } description="" />

### <span className="text-primary">get\_import\_statement</span>

Get an import statement by name in files container.

<GithubLinkNote link="https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/interfaces/has_symbols.py#L91-L93" />

<Return return_type={ <><a href="/api-reference/core/ImportStatement" style={ {fontWeight: "inherit", fontSize: "inherit"} }>ImportStatement</a> <span>| None</span></> } description="" />

### <span className="text-primary">get\_symbol</span>

Get a symbol by name in files container.

<GithubLinkNote link="https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/interfaces/has_symbols.py#L87-L89" />

<Return return_type={ <><a href="/api-reference/core/Symbol" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Symbol</a> <span>| None</span></> } description="" />
