Class: HaveAPI::ClientExamples::TsGeneratedClient

Inherits:
HaveAPI::ClientExample show all
Defined in:
lib/haveapi/client_examples/ts_generated_client.rb

Constant Summary

Constants inherited from HaveAPI::ClientExample

HaveAPI::ClientExample::DEFAULT_DETAIL_LEVELS, HaveAPI::ClientExample::SIMPLE_DETAIL_LEVELS

Instance Attribute Summary

Attributes inherited from HaveAPI::ClientExample

#action, #action_name, #base_url, #context, #host, #resource, #resource_path, #version

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from HaveAPI::ClientExample

adapter_detail_levels_for, auth, clients, code, #comment_lines, detail_levels, example, #example_comment, id, init, #initialize, label, language, language_label, order, register, render, #thorough?, variant, #version_url, #with_context

Constructor Details

This class inherits a constructor from HaveAPI::ClientExample

Class Method Details

.available?(context) ⇒ Boolean

Returns:



13
14
15
# File 'lib/haveapi/client_examples/ts_generated_client.rb', line 13

def self.available?(context)
  context&.profile&.language == :typescript
end

.detail_levels_for(kind, context:, result:, auth_method: nil, auth_description: nil) ⇒ Object



17
18
19
20
# File 'lib/haveapi/client_examples/ts_generated_client.rb', line 17

def self.detail_levels_for(kind, context:, result:, auth_method: nil, auth_description: nil)
  adapter_detail_levels_for(adapter: context.profile.adapter, kind:, context:, result:,
                            mode: :async, auth_method:, auth_description:)
end

Instance Method Details

#auth(method, desc) ⇒ Object



26
27
28
# File 'lib/haveapi/client_examples/ts_generated_client.rb', line 26

def auth(method, desc)
  render_documentation(:auth, auth_method: method, auth_description: desc)
end

#example(sample) ⇒ Object



30
31
32
# File 'lib/haveapi/client_examples/ts_generated_client.rb', line 30

def example(sample)
  render_documentation(:example, rendering_context: context&.with(sample:))
end

#init ⇒ Object



22
23
24
# File 'lib/haveapi/client_examples/ts_generated_client.rb', line 22

def init
  render_documentation(:init)
end