Module: SfCli::Sf::Org::ListMetadata

Included in:
Core
Defined in:
lib/sf_cli/sf/org/list_metadata.rb

Defined Under Namespace

Classes: MetadataList

Constant Summary collapse

Metadata =
Data.define(
:created_by_id,
:created_by_name,
:created_date,
:file_name,
:full_name,
:id,
:last_modified_by_id,
:last_modified_by_name,
:last_modified_date,
:manageable_state,
:type) do
  def name
    full_name
  end
end

Instance Method Summary collapse

Instance Method Details

#list_metadata(metadata, folder: nil, target_org: nil, api_version: nil, output_file: nil) ⇒ MetadataList

List the metadata components and properties of a specified type

Examples:

list = sf.org. :ApexClass
list.names                        #=> ["CommunitiesLandingController","SiteLoginControllerTest", ...]
list.find :MyProfilePageController #=> <Metadata: full_name="MyProfilePageController" ...>

Parameters:

  • metadata (Symbol, String)

    name of metadata type

  • folder (Symbol, String) (defaults to: nil)

    folder associated with the component such as Report, EmailTemplate, Dashboard and Document

  • target_org (Symbol, String) (defaults to: nil)

    an alias of paticular org, or username can be used

  • api_version (Numeric) (defaults to: nil)

    override the api version used for api requests made by this command

  • output_file (String) (defaults to: nil)

    pathname of the file in which to write the results

Returns:

  • (MetadataList)

    the list of metadata, which contains its name, its source file path and so on

See Also:



20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/sf_cli/sf/org/list_metadata.rb', line 20

def (, folder: nil, target_org: nil, api_version: nil, output_file: nil)
  flags    = {
    :"metadata-type" => ,
    :"folder"        => folder,
    :"target-org"    => target_org,
    :"api-version"   => api_version,
    :"output-file"   => output_file,
  }
  action = __method__.to_s.tr('_', ' ')
  json = exec(action, flags: flags, redirection: :null_stderr)

  MetadataList.new(json['result'])
end