Asterisk - The Open Source Telephony Project  18.5.0
Public Member Functions | Data Fields | Static Public Attributes
ResourceApi Class Reference
Inheritance diagram for ResourceApi:
Inheritance graph
[legend]
Collaboration diagram for ResourceApi:
Collaboration graph
[legend]

Public Member Functions

def __init__ (self)
 
def load (self, api_json, processor, context)
 
def load_api_declaration (self, base_dir, processor)
 
- Public Member Functions inherited from Stringify
def __repr__ (self)
 

Data Fields

 api_declaration
 
 description
 
 file
 
 path
 

Static Public Attributes

list required_fields = ['path', 'description']
 

Detailed Description

Model of an API listing in the resources.json file.

Definition at line 680 of file swagger_model.py.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self)

Definition at line 686 of file swagger_model.py.

686  def __init__(self):
687  self.path = None
688  self.description = None
689  self.api_declaration = None
690 

Member Function Documentation

◆ load()

def load (   self,
  api_json,
  processor,
  context 
)

Definition at line 691 of file swagger_model.py.

References ast_codec.description, media_variant.description, ast_app.description, ast_xml_doc_item.description, ast_calendar_tech.description, ast_tone_zone.description, ast_xmpp_resource.description, ast_calendar_event.description, ast_http_uri.description, manager_action.description, ast_switch.description, ast_fax_tech.description, ast_test_info.description, Parameter.description, ast_module_info.description, Api.description, dahdi_pvt.description, Property.description, Model.description, iax2_peer.description, ast_channel_tech.description, ResourceApi.description, stasis_subscription_change.description, ast_value_translation.description, sip_peer.description, ast_uri.path, stir_shaken_store.path, stir_shaken_certificate.path, ast_bucket_file.path, ast_sip_contact.path, Api.path, ResourceApi.path, sip_peer.path, path_lock.path, replace(), Parameter.required_fields, ErrorResponse.required_fields, Operation.required_fields, Api.required_fields, Property.required_fields, Model.required_fields, ApiDeclaration.required_fields, ResourceApi.required_fields, and swagger_model.validate_required_fields().

Referenced by ResourceListing.load_file().

691  def load(self, api_json, processor, context):
692  context = context.next_stack(api_json, 'path')
693  validate_required_fields(api_json, self.required_fields, context)
694  self.path = api_json['path'].replace('{format}', 'json')
695  self.description = api_json['description']
696 
697  if not self.path or self.path[0] != '/':
698  raise SwaggerError("Path must start with /", context)
699  processor.process_resource_api(self, context)
700  return self
701 
def validate_required_fields(json, required_fields, context)
static int replace(struct ast_channel *chan, const char *cmd, char *data, struct ast_str **buf, ssize_t len)
Definition: func_strings.c:790

◆ load_api_declaration()

def load_api_declaration (   self,
  base_dir,
  processor 
)

Definition at line 702 of file swagger_model.py.

702  def load_api_declaration(self, base_dir, processor):
703  self.file = (base_dir + self.path)
704  self.api_declaration = ApiDeclaration().load_file(self.file, processor)
705  processor.process_resource_api(self, [self.file])
706 
707 
static int load_file(const char *filename, char **ret)
Read a TEXT file into a string and return the length.

Field Documentation

◆ api_declaration

api_declaration

Definition at line 689 of file swagger_model.py.

◆ description

description

Definition at line 688 of file swagger_model.py.

Referenced by ResourceApi.load().

◆ file

file

Definition at line 703 of file swagger_model.py.

◆ path

path

Definition at line 687 of file swagger_model.py.

Referenced by ResourceApi.load().

◆ required_fields

list required_fields = ['path', 'description']
static

Definition at line 684 of file swagger_model.py.

Referenced by ResourceApi.load(), and ResourceListing.load().


The documentation for this class was generated from the following file: