Skip to content

commercelayer/commercelayer-cli-plugin-resources

Repository files navigation

@commercelayer/cli-plugin-resources

Commerce Layer CLI Resources plugin

oclif Version Downloads/week License CodeQL

Usage

commercelayer COMMAND

commercelayer [COMMAND] (--help | -h) for detailed information about plugin commands.

To install as a Commerce Layer CLI plugin run the following command:

$ commercelayer plugins:install resources

Commands

commercelayer resources

List all the available Commerce Layer API resources.

USAGE
  $ commercelayer resources [-h]

FLAGS
  -h, --help  Show CLI help.

DESCRIPTION
  list all the available Commerce Layer API resources

EXAMPLES
  $ cl-resources resources

  $ cl-res resources

  $ commercelayer resources

  $ cl resources

See code: src/commands/resources/index.ts

commercelayer resources:all RESOURCE

Fetch all resources.

USAGE
  $ commercelayer resources:all RESOURCE [-i <value>...] [-u -j] [-l curl|node [--doc | -R]] [--curl ] [--node ]
    [--save-args <value>] [--load-args <value>] [-w <value>...] [-s <value>...] [-x <value> | -X <value>] [-D ,|;|||TAB
    [-C -f <value>...]] [-H <value>... ] [-b] [-e <value>... | ]

ARGUMENTS
  RESOURCE  the resource type

FLAGS
  -C, --csv                 export fields in csv format
  -D, --delimiter=<option>  the delimiter character to use in the CSV output file (one of ',', ';', '|', TAB)
                            <options: ,|;|||TAB>
  -H, --header=<value>...   rename column headers defining a comma-separated list of values field:"renamed title"
  -R, --raw                 print out the raw API response
  -X, --save-path=<value>   save command output to file and create missing path directories
  -b, --blind               execute in blind mode without prompt and progress bar
  -e, --extract=<value>...  extract subfields from object attributes
  -f, --fields=<value>...   comma separeted list of fields in the format [resourceType/]field1,field2,field3
  -i, --include=<value>...  comma separated resources to include
  -j, --json                convert output in standard JSON format
  -s, --sort=<value>...     define results ordering
  -u, --unformatted         print unformatted JSON output
  -w, --where=<value>...    comma separated list of query filters
  -x, --save=<value>        save command output to file
      --load-args=<value>   load previously saved command arguments
      --save-args=<value>   save command data to file for future use

DOCUMENTATION FLAGS
  -l, --lang=<option>  show the CLI command in the specified language syntax
                       <options: curl|node>
      --curl           show the equivalent cURL command of the CLI command
      --doc            show the CLI command in a specific language
      --node           show the equivalent Node SDK source code of the CLI command

DESCRIPTION
  fetch all resources

ALIASES
  $ commercelayer all
  $ commercelayer ra
  $ commercelayer res:all

EXAMPLES
  $ commercelayer resources:all customers -f id,email,customer_group -i customer_group -s updated_at

  $ cl res:all customers -i customer_group -f customer_group -f customer_groups/name -w customer_group_name_eq="GROUP NAME"

  $ cl all customers -s -created_at --json

See code: src/commands/resources/all.ts

commercelayer resources:args

Show all the saved command arguments.

USAGE
  $ commercelayer resources:args [-D [-a <value> -o list|retrieve|create|update -r <value>]]

FLAGS
  -D, --delete              delete saved arguments associated to the alias
  -a, --alias=<value>       the alias associated to saved command arguments
  -o, --operation=<option>  the resource operation
                            <options: list|retrieve|create|update>
  -r, --resource=<value>    the resource type

DESCRIPTION
  show all the saved command arguments

ALIASES
  $ commercelayer res:args

See code: src/commands/resources/args.ts

commercelayer resources:count RESOURCE

Count the number of existent resources.

USAGE
  $ commercelayer resources:count RESOURCE [-w <value>...]

ARGUMENTS
  RESOURCE  the resource type

FLAGS
  -w, --where=<value>...  comma separated list of query filters

DESCRIPTION
  count the number of existent resources

ALIASES
  $ commercelayer count
  $ commercelayer res:count
  $ commercelayer rs:count

EXAMPLES
  $ commercelayer resources:count customers

  cl count customers -w customer_group_name_eq=<customer-group-name>

See code: src/commands/resources/count.ts

commercelayer resources:create RESOURCE

Create a new resource.

USAGE
  $ commercelayer resources:create RESOURCE [-i <value>...] [-f <value>...] [-u -j] [-l curl|node [--doc | -R]]
    [--curl ] [--node ] [-H ] [-Y ] [-O <value>...] [-D <value> | -a <value>... | -r <value>... | -m <value>... |  |
    --load-args <value> | --save-args <value>] [-t <value>...]

ARGUMENTS
  RESOURCE  the resource type

FLAGS
  -D, --data=<value>             the data file to use as request body
  -H, --headers                  show response headers
  -O, --object=<value>...        define a resource object attribute
  -R, --raw                      print out the raw API response
  -Y, --headers-only             show only response headers
  -a, --attribute=<value>...     define a resource attribute
  -f, --fields=<value>...        comma separeted list of fields in the format [resourceType/]field1,field2,field3
  -i, --include=<value>...       comma separated resources to include
  -j, --json                     convert output in standard JSON format
  -m, --metadata=<value>...      define a metadata attribute or a set of metadata attributes
  -r, --relationship=<value>...  define a relationship with another resource
  -t, --tags=<value>...          list of tags associated with the resource
  -u, --unformatted              print unformatted JSON output
      --load-args=<value>        load previously saved command arguments
      --save-args=<value>        save command data to file for future use

DOCUMENTATION FLAGS
  -l, --lang=<option>  show the CLI command in the specified language syntax
                       <options: curl|node>
      --curl           show the equivalent cURL command of the CLI command
      --doc            show the CLI command in a specific language
      --node           show the equivalent Node SDK source code of the CLI command

DESCRIPTION
  create a new resource

ALIASES
  $ commercelayer create
  $ commercelayer rc
  $ commercelayer res:create
  $ commercelayer post

EXAMPLES
  $ commercelayer resources:create customers -a email=user@test.com

  $ clayer res:create customers -a email="user@test-com" -r customer_group=customer_groups/<customerGroupId>

  $ cl create customers -a email=user@test.com -m meta_key="meta value"

  $ cl rc customers -D /path/to/data/file/data.json

See code: src/commands/resources/create.ts

commercelayer resources:delete RESOURCE [ID]

Delete an existing resource.

USAGE
  $ commercelayer resources:delete RESOURCE [ID] [-i <value>...] [-f <value>...] [-u -j] [-l curl|node [--doc | -R]]
    [--curl ] [--node ] [--save-args <value>] [--load-args <value>] [-H ] [-Y ]

ARGUMENTS
  RESOURCE  the resource type
  ID        id of the resource to delete

FLAGS
  -H, --headers             show response headers
  -R, --raw                 print out the raw API response
  -Y, --headers-only        show only response headers
  -f, --fields=<value>...   comma separeted list of fields in the format [resourceType/]field1,field2,field3
  -i, --include=<value>...  comma separated resources to include
  -j, --json                convert output in standard JSON format
  -u, --unformatted         print unformatted JSON output
      --load-args=<value>   load previously saved command arguments
      --save-args=<value>   save command data to file for future use

DOCUMENTATION FLAGS
  -l, --lang=<option>  show the CLI command in the specified language syntax
                       <options: curl|node>
      --curl           show the equivalent cURL command of the CLI command
      --doc            show the CLI command in a specific language
      --node           show the equivalent Node SDK source code of the CLI command

DESCRIPTION
  delete an existing resource

ALIASES
  $ commercelayer delete
  $ commercelayer rd
  $ commercelayer res:delete

EXAMPLES
  $ commercelayer resources:delete customers/<customerId>

  $ cl delete customers <customerId>

See code: src/commands/resources/delete.ts

commercelayer resources:doc RESOURCE

Open the default browser and show the online documentation for the resource.

USAGE
  $ commercelayer resources:doc RESOURCE [-p object|create|retrieve|list|update|delete]

ARGUMENTS
  RESOURCE  the resource for which you want to access the online documentation

FLAGS
  -p, --page=<option>  the doc page you want to access
                       <options: object|create|retrieve|list|update|delete>

DESCRIPTION
  open the default browser and show the online documentation for the resource

ALIASES
  $ commercelayer res:doc
  $ commercelayer doc

EXAMPLES
  $ commercelayer resources:doc customers

  $ cl res:doc customers

  $ cl doc customers -p create

See code: src/commands/resources/doc.ts

commercelayer resources:fetch PATH [ID]

Retrieve a resource or list a set of resources.

USAGE
  $ commercelayer resources:fetch PATH... [ID...] [-i <value>...] [-f <value>...] [-u -j] [-l curl|node [--doc | -R]]
    [--curl ] [--node ] [--save-args <value>] [--load-args <value>] [-H ] [-Y ] [-x <value> | -X <value>] [-e <value>...
    | ] [-w <value>...] [-p <value>] [-n <value>] [-s <value>...]

ARGUMENTS
  PATH...  path (or URL) of the resource(s) to fetch
  ID...    resource id

FLAGS
  -H, --headers             show response headers
  -R, --raw                 print out the raw API response
  -X, --save-path=<value>   save command output to file and create missing path directories
  -Y, --headers-only        show only response headers
  -e, --extract=<value>...  extract subfields from object attributes
  -f, --fields=<value>...   comma separeted list of fields in the format [resourceType/]field1,field2,field3
  -i, --include=<value>...  comma separated resources to include
  -j, --json                convert output in standard JSON format
  -n, --pageSize=<value>    number of elements per page
  -p, --page=<value>        page number
  -s, --sort=<value>...     define results ordering
  -u, --unformatted         print unformatted JSON output
  -w, --where=<value>...    comma separated list of query filters
  -x, --save=<value>        save command output to file
      --load-args=<value>   load previously saved command arguments
      --save-args=<value>   save command data to file for future use

DOCUMENTATION FLAGS
  -l, --lang=<option>  show the CLI command in the specified language syntax
                       <options: curl|node>
      --curl           show the equivalent cURL command of the CLI command
      --doc            show the CLI command in a specific language
      --node           show the equivalent Node SDK source code of the CLI command

DESCRIPTION
  retrieve a resource or list a set of resources

ALIASES
  $ commercelayer fetch
  $ commercelayer res:fetch
  $ commercelayer rf

EXAMPLES
  $ commercelayer resources:fetch customers

  $ commercelayer res:fetch customers

  $ clayer res:fetch customers/<customerId>

  $ cl fetch customers/<customerId>/<customerRelationship>

  $ cl fetch customers/{customerId}/orders aBcdEkYWx

See code: src/commands/resources/fetch.ts

commercelayer resources:filters

Show a list of all available filter predicates.

USAGE
  $ commercelayer resources:filters

DESCRIPTION
  show a list of all available filter predicates

ALIASES
  $ commercelayer res:filters

EXAMPLES
  $ commercelayer resources:filters

  $ cl res:filters

See code: src/commands/resources/filters.ts

commercelayer resources:get RESOURCE [ID]

Retrieve a resource or list a set of resources.

USAGE
  $ commercelayer resources:get RESOURCE... [ID...] [-i <value>...] [-f <value>...] [-u -j] [-l curl|node [--doc |
    -R]] [--curl ] [--node ] [--save-args <value>] [--load-args <value>] [-H ] [-Y ] [-w <value>...] [-p <value>] [-n
    <value>] [-s <value>...] [-x <value> | -X <value>] [-e <value>... | ]

ARGUMENTS
  RESOURCE...  the resource type
  ID...        id of the resource to retrieve

FLAGS
  -H, --headers             show response headers
  -R, --raw                 print out the raw API response
  -X, --save-path=<value>   save command output to file and create missing path directories
  -Y, --headers-only        show only response headers
  -e, --extract=<value>...  extract subfields from object attributes
  -f, --fields=<value>...   comma separeted list of fields in the format [resourceType/]field1,field2,field3
  -i, --include=<value>...  comma separated resources to include
  -j, --json                convert output in standard JSON format
  -n, --pageSize=<value>    number of elements per page
  -p, --page=<value>        page number
  -s, --sort=<value>...     define results ordering
  -u, --unformatted         print unformatted JSON output
  -w, --where=<value>...    comma separated list of query filters
  -x, --save=<value>        save command output to file
      --load-args=<value>   load previously saved command arguments
      --save-args=<value>   save command data to file for future use

DOCUMENTATION FLAGS
  -l, --lang=<option>  show the CLI command in the specified language syntax
                       <options: curl|node>
      --curl           show the equivalent cURL command of the CLI command
      --doc            show the CLI command in a specific language
      --node           show the equivalent Node SDK source code of the CLI command

DESCRIPTION
  retrieve a resource or list a set of resources

ALIASES
  $ commercelayer get
  $ commercelayer res:get
  $ commercelayer rg

EXAMPLES
  $ commercelayer resources:get customers

  $ commercelayer res:get customers

  $ clayer res:get customers/<customerId>

  $ cl get customers <customerId>

See code: src/commands/resources/get.ts

commercelayer resources:last RESOURCE

Show the last id of a resource type.

USAGE
  $ commercelayer resources:last RESOURCE

ARGUMENTS
  RESOURCE  the resource type

DESCRIPTION
  show the last id of a resource type

ALIASES
  $ commercelayer last
  $ commercelayer res:last

EXAMPLES
  $ commercelayer resources:last customers

  $ commercelayer last customer

  $ cl res:last customers

See code: src/commands/resources/last.ts

commercelayer resources:list RESOURCE

Fetch a collection of resources.

USAGE
  $ commercelayer resources:list RESOURCE [-i <value>...] [-f <value>...] [-u -j] [-l curl|node [--doc | -R]]
    [--curl ] [--node ] [--save-args <value>] [--load-args <value>] [-H ] [-Y ] [-w <value>...] [-p <value>] [-n
    <value>] [-s <value>...] [-x <value> | -X <value>] [-e <value>... | ]

ARGUMENTS
  RESOURCE  the resource type

FLAGS
  -H, --headers             show response headers
  -R, --raw                 print out the raw API response
  -X, --save-path=<value>   save command output to file and create missing path directories
  -Y, --headers-only        show only response headers
  -e, --extract=<value>...  extract subfields from object attributes
  -f, --fields=<value>...   comma separeted list of fields in the format [resourceType/]field1,field2,field3
  -i, --include=<value>...  comma separated resources to include
  -j, --json                convert output in standard JSON format
  -n, --pageSize=<value>    number of elements per page
  -p, --page=<value>        page number
  -s, --sort=<value>...     define results ordering
  -u, --unformatted         print unformatted JSON output
  -w, --where=<value>...    comma separated list of query filters
  -x, --save=<value>        save command output to file
      --load-args=<value>   load previously saved command arguments
      --save-args=<value>   save command data to file for future use

DOCUMENTATION FLAGS
  -l, --lang=<option>  show the CLI command in the specified language syntax
                       <options: curl|node>
      --curl           show the equivalent cURL command of the CLI command
      --doc            show the CLI command in a specific language
      --node           show the equivalent Node SDK source code of the CLI command

DESCRIPTION
  fetch a collection of resources

ALIASES
  $ commercelayer list
  $ commercelayer rl
  $ commercelayer res:list

EXAMPLES
  $ commercelayer resources:list customers -f id,email,customer_group -i customer_group -s updated_at

  $ cl res:list customers -i customer_group -f customer_group -f customer_groups/name -w customer_group_name_eq="GROUP NAME"

  $ cl list customers -p 5 -n 10 -s -created_at --raw

See code: src/commands/resources/list.ts

commercelayer resources:retrieve RESOURCE [ID]

Fetch a single resource.

USAGE
  $ commercelayer resources:retrieve RESOURCE [ID] [-i <value>...] [-f <value>...] [-u -j] [-l curl|node [--doc | -R]]
    [--curl ] [--node ] [--save-args <value>] [--load-args <value>] [-H ] [-Y ] [-x <value> | -X <value>] [-e <value>...
    | ]

ARGUMENTS
  RESOURCE  the resource type
  ID        id of the resource to retrieve

FLAGS
  -H, --headers             show response headers
  -R, --raw                 print out the raw API response
  -X, --save-path=<value>   save command output to file and create missing path directories
  -Y, --headers-only        show only response headers
  -e, --extract=<value>...  extract subfields from object attributes
  -f, --fields=<value>...   comma separeted list of fields in the format [resourceType/]field1,field2,field3
  -i, --include=<value>...  comma separated resources to include
  -j, --json                convert output in standard JSON format
  -u, --unformatted         print unformatted JSON output
  -x, --save=<value>        save command output to file
      --load-args=<value>   load previously saved command arguments
      --save-args=<value>   save command data to file for future use

DOCUMENTATION FLAGS
  -l, --lang=<option>  show the CLI command in the specified language syntax
                       <options: curl|node>
      --curl           show the equivalent cURL command of the CLI command
      --doc            show the CLI command in a specific language
      --node           show the equivalent Node SDK source code of the CLI command

DESCRIPTION
  fetch a single resource

ALIASES
  $ commercelayer retrieve
  $ commercelayer rr
  $ commercelayer res:retrieve

EXAMPLES
  $ commercelayer resources:retrieve customers/<customerId>

  $ commercelayer retrieve customers <customerId>

  $ cl res:retrieve customers <customerId>

  $ clayer rr customers/<customerId>

See code: src/commands/resources/retrieve.ts

commercelayer resources:schema

Show the current CommerceLayer OpenAPI schema version used by the plugin.

USAGE
  $ commercelayer resources:schema

DESCRIPTION
  show the current CommerceLayer OpenAPI schema version used by the plugin

ALIASES
  $ commercelayer schema
  $ commercelayer res:schema
  $ commercelayer rs

EXAMPLES
  $ commercelayer schema

  cl res:schema

See code: src/commands/resources/schema.ts

commercelayer resources:update RESOURCE [ID]

Update an existing resource.

USAGE
  $ commercelayer resources:update RESOURCE [ID] [-i <value>...] [-f <value>...] [-u -j] [-l curl|node [--doc | -R]]
    [--curl ] [--node ] [-H ] [-Y ] [-O <value>...] [-D <value> | -a <value>... | -r <value>... | [-m <value>... | -M
    <value>...] |  |  | --load-args <value> | --save-args <value>] [-t <value>...]

ARGUMENTS
  RESOURCE  the resource type
  ID        id of the resource to update

FLAGS
  -D, --data=<value>                 the data file to use as request body
  -H, --headers                      show response headers
  -M, --metadata-replace=<value>...  define a metadata attribute and replace every item already present in the remote
                                     resource
  -O, --object=<value>...            define a resource object attribute
  -R, --raw                          print out the raw API response
  -Y, --headers-only                 show only response headers
  -a, --attribute=<value>...         define a resource attribute
  -f, --fields=<value>...            comma separeted list of fields in the format [resourceType/]field1,field2,field3
  -i, --include=<value>...           comma separated resources to include
  -j, --json                         convert output in standard JSON format
  -m, --metadata=<value>...          define a metadata attribute and merge it with the metadata already present in the
                                     remote resource
  -r, --relationship=<value>...      define a relationship with another resource
  -t, --tags=<value>...              list of tags associated with the resource
  -u, --unformatted                  print unformatted JSON output
      --load-args=<value>            load previously saved command arguments
      --save-args=<value>            save command data to file for future use

DOCUMENTATION FLAGS
  -l, --lang=<option>  show the CLI command in the specified language syntax
                       <options: curl|node>
      --curl           show the equivalent cURL command of the CLI command
      --doc            show the CLI command in a specific language
      --node           show the equivalent Node SDK source code of the CLI command

DESCRIPTION
  update an existing resource

ALIASES
  $ commercelayer update
  $ commercelayer ru
  $ commercelayer res:update
  $ commercelayer patch

EXAMPLES
  $ commercelayer resources:update customers/<customerId> -a reference=referenceId

  $ commercelayer res:update customers <customerId> -a reference_origin="Ref Origin"

  $ cl update customers/<customerId> -m meta_key="meta value"

  $ cl ru customers <customerId> -M meta_key="metadata overwrite

  $ clayer update customers <customerId> -D /path/to/data/file/data.json

  $ cl update order <orderId> -r billing_address=addresses/<addressId>

  $ cl update customer <customerId> -r customer_group=<customerGroupId>

See code: src/commands/resources/update.ts