Class: Stigg::Resources::V1::Events::Beta::Customers::Entities

Inherits:
Object
  • Object
show all
Defined in:
lib/stigg/resources/v1/events/beta/customers/entities.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Entities

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Entities.

Parameters:



201
202
203
# File 'lib/stigg/resources/v1/events/beta/customers/entities.rb', line 201

def initialize(client:)
  @client = client
end

Instance Method Details

#archive(id, ids:, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Models::V1::Events::Beta::Customers::EntityArchiveResponse

Some parameter documentations has been truncated, see Models::V1::Events::Beta::Customers::EntityArchiveParams for more details.

Archives entities in bulk for the given customer by id.

Parameters:

  • id (String)

    Path param: The customer identifier (owner) the entities belong to

  • ids (Array<String>)

    Body param: Entity identifiers to act on

  • x_account_id (String)

    Header param: Account ID — optional when authenticating with a user JWT (Bearer

  • x_environment_id (String)

    Header param: Environment ID — required when authenticating with a user JWT (Bea

  • request_options (Stigg::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/stigg/resources/v1/events/beta/customers/entities.rb', line 116

def archive(id, params)
  parsed, options = Stigg::V1::Events::Beta::Customers::EntityArchiveParams.dump_request(params)
  header_params = {x_account_id: "x-account-id", x_environment_id: "x-environment-id"}
  @client.request(
    method: :post,
    path: ["api/v1-beta/customers/%1$s/entities/archive", id],
    headers: parsed.slice(*header_params.keys).transform_keys(header_params),
    body: parsed.except(*header_params.keys),
    model: Stigg::Models::V1::Events::Beta::Customers::EntityArchiveResponse,
    options: options
  )
end

#list(id, after: nil, before: nil, include_archived: nil, limit: nil, type_ref_id: nil, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Internal::MyCursorIDPage<Stigg::Models::V1::Events::Beta::Customers::EntityListResponse>

Some parameter documentations has been truncated, see Models::V1::Events::Beta::Customers::EntityListParams for more details.

Retrieves a paginated list of entities for the given customer.

Parameters:

  • id (String)

    Path param: The customer identifier (owner) the entities belong to

  • after (String)

    Query param: Return items that come after this cursor

  • before (String)

    Query param: Return items that come before this cursor

  • include_archived (Symbol, Stigg::Models::V1::Events::Beta::Customers::EntityListParams::IncludeArchived)

    Query param: Whether to include archived entities. One of: true, false

  • limit (Integer)

    Query param: Maximum number of items to return

  • type_ref_id (String)

    Query param: Filter results to entities of a specific entity type, by the type’s

  • x_account_id (String)

    Header param: Account ID — optional when authenticating with a user JWT (Bearer

  • x_environment_id (String)

    Header param: Environment ID — required when authenticating with a user JWT (Bea

  • request_options (Stigg::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/stigg/resources/v1/events/beta/customers/entities.rb', line 77

def list(id, params = {})
  query_params = [:after, :before, :include_archived, :limit, :type_ref_id]
  parsed, options = Stigg::V1::Events::Beta::Customers::EntityListParams.dump_request(params)
  query = Stigg::Internal::Util.encode_query_params(parsed.slice(*query_params))
  @client.request(
    method: :get,
    path: ["api/v1-beta/customers/%1$s/entities", id],
    query: query.transform_keys(include_archived: "includeArchived", type_ref_id: "typeRefId"),
    headers: parsed.except(*query_params).transform_keys(
      x_account_id: "x-account-id",
      x_environment_id: "x-environment-id"
    ),
    page: Stigg::Internal::MyCursorIDPage,
    model: Stigg::Models::V1::Events::Beta::Customers::EntityListResponse,
    options: options
  )
end

#retrieve(entity_id, id:, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Models::V1::Events::Beta::Customers::EntityRetrieveResponse

Some parameter documentations has been truncated, see Models::V1::Events::Beta::Customers::EntityRetrieveParams for more details.

Retrieves a single entity for the given customer by its identifier.

Parameters:

  • entity_id (String)

    Path param: The entity identifier (refId)

  • id (String)

    Path param: The customer identifier (owner) the entity belongs to

  • x_account_id (String)

    Header param: Account ID — optional when authenticating with a user JWT (Bearer

  • x_environment_id (String)

    Header param: Environment ID — required when authenticating with a user JWT (Bea

  • request_options (Stigg::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/stigg/resources/v1/events/beta/customers/entities.rb', line 31

def retrieve(entity_id, params)
  parsed, options = Stigg::V1::Events::Beta::Customers::EntityRetrieveParams.dump_request(params)
  id =
    parsed.delete(:id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :get,
    path: ["api/v1-beta/customers/%1$s/entities/%2$s", id, entity_id],
    headers: parsed.transform_keys(
      x_account_id: "x-account-id",
      x_environment_id: "x-environment-id"
    ),
    model: Stigg::Models::V1::Events::Beta::Customers::EntityRetrieveResponse,
    options: options
  )
end

#unarchive(id, ids:, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Models::V1::Events::Beta::Customers::EntityUnarchiveResponse

Some parameter documentations has been truncated, see Models::V1::Events::Beta::Customers::EntityUnarchiveParams for more details.

Restores previously archived entities in bulk for the given customer by id.

Parameters:

  • id (String)

    Path param: The customer identifier (owner) the entities belong to

  • ids (Array<String>)

    Body param: Entity identifiers to act on

  • x_account_id (String)

    Header param: Account ID — optional when authenticating with a user JWT (Bearer

  • x_environment_id (String)

    Header param: Environment ID — required when authenticating with a user JWT (Bea

  • request_options (Stigg::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



150
151
152
153
154
155
156
157
158
159
160
161
# File 'lib/stigg/resources/v1/events/beta/customers/entities.rb', line 150

def unarchive(id, params)
  parsed, options = Stigg::V1::Events::Beta::Customers::EntityUnarchiveParams.dump_request(params)
  header_params = {x_account_id: "x-account-id", x_environment_id: "x-environment-id"}
  @client.request(
    method: :post,
    path: ["api/v1-beta/customers/%1$s/entities/unarchive", id],
    headers: parsed.slice(*header_params.keys).transform_keys(header_params),
    body: parsed.except(*header_params.keys),
    model: Stigg::Models::V1::Events::Beta::Customers::EntityUnarchiveResponse,
    options: options
  )
end

#upsert(id, entities:, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Models::V1::Events::Beta::Customers::EntityUpsertResponse

Some parameter documentations has been truncated, see Models::V1::Events::Beta::Customers::EntityUpsertParams for more details.

Creates or updates entities in bulk for the given customer. Existing entities matched by id are updated; new ids are created.

Parameters:

  • id (String)

    Path param: The customer identifier (owner) the entities belong to

  • entities (Array<Stigg::Models::V1::Events::Beta::Customers::EntityUpsertParams::Entity>)

    Body param: List of entities to create or update (1-100 entries)

  • x_account_id (String)

    Header param: Account ID — optional when authenticating with a user JWT (Bearer

  • x_environment_id (String)

    Header param: Environment ID — required when authenticating with a user JWT (Bea

  • request_options (Stigg::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



185
186
187
188
189
190
191
192
193
194
195
196
# File 'lib/stigg/resources/v1/events/beta/customers/entities.rb', line 185

def upsert(id, params)
  parsed, options = Stigg::V1::Events::Beta::Customers::EntityUpsertParams.dump_request(params)
  header_params = {x_account_id: "x-account-id", x_environment_id: "x-environment-id"}
  @client.request(
    method: :put,
    path: ["api/v1-beta/customers/%1$s/entities", id],
    headers: parsed.slice(*header_params.keys).transform_keys(header_params),
    body: parsed.except(*header_params.keys),
    model: Stigg::Models::V1::Events::Beta::Customers::EntityUpsertResponse,
    options: options
  )
end